
/* file: ./addons/plugins/page/pixels/pixels.js */
var plg_page_pixels = new function()
{

	this.redisplayPixels = function()
	{
		var ZSM = $('img[src*="erdbeer.ivwbox.de"]');
		var FBO = $('script[src*="erdbeer.ivwbox.de"]');
		var rnd = ( Math.random() * 100000 );
		var reg = /([\d]+)(\.)([\d]+)$/g;

		if( ZSM.length )
		{
			var OLDSRC = $(ZSM).attr('src');
			var NEWSRC = OLDSRC.replace( reg, rnd );
			$(ZSM).attr('src', NEWSRC);
		}

		if( FBO.length )
		{
			var OLDSRC = $(FBO).attr('src');
			var NEWSRC = OLDSRC + '?' + rnd;
			jQuery.getScript( NEWSRC );
		}
	}

	this.redisplayPixelsStyler = function()
	{
		var ZSM = $('img[src*="erdbeer.ivwbox.de"]');
		var FBO = $('script[src*="erdbeer.ivwbox.de"]');
		var rnd = ( Math.random() * 100000 );
		var reg = /([\d]+)(\.)([\d]+)$/g;

		if( ZSM.length )
		{
			var OLDSRC = $(ZSM).attr('src');
			var NEWSRC = OLDSRC.replace( reg, rnd );
			$(ZSM).attr('src', NEWSRC);
		}

		if( FBO.length )
		{
			var OLDSRC = $(FBO).attr('src');
			var NEWSRC = OLDSRC + '?' + rnd;
			jQuery.getScript( NEWSRC );
		}
	}

	this.redisplayPixelsStylerWithReplacing = function( replaceFrom, replaceInto )
	{
		var ZSM = $('img[src*="erdbeer.ivwbox.de"]');
		var FBO = $('script[src*="erdbeer.ivwbox.de"]');
		var rnd = ( Math.random() * 100000 );
		var reg = /([\d]+)(\.)([\d]+)$/g;

		if( ZSM.length )
		{
			code = replaceInto;

			var OLDSRC = $(ZSM).attr('src');
			var NEWSRC = OLDSRC.replace( reg, rnd ).replace( replaceFrom, replaceInto );

			$(ZSM).attr('src', NEWSRC);
		}

		if( FBO.length )
		{
			szmvars = szmvars.replace( replaceFrom, replaceInto );

			var OLDSRC = $(FBO).attr('src');
			var NEWSRC = OLDSRC + '?' + rnd;

			jQuery.getScript( NEWSRC );
		}
	}
	this.showPixel = function(code, type, comment){
		$cont = $('#szmContainer');
		if($cont.length){
			var _code = code;
			var _type = type?type:"CP";
			var _comment = comment?comment:"";
//			var IVW	= "http://erdbeer.ivwbox.de/cgi-bin/ivw/"+_type+"/"+_code+";["+_comment+"]";
			var IVW	= "http://erdbeer.ivwbox.de/cgi-bin/ivw/%type%/%code%;[%comment%]"
					.replace('%code%', _code)
					.replace('%type%', _type)
					.replace('%comment%', _comment)+
					"?"+$.param({r:document.referrer, d:Math.random()*100000});
			var $img = "<img src='%src%' width='1' height='1' alt='szmtag' />"
				.replace('%src%',IVW);
			console.log($img);
			$img = $($img);
			$cont.append($img);
			
		}
	}
}


/* file: ./addons/plugins/menu/menu.js */
function createPopUp() 
{
	var div = document.createElement('div'); 
	div.innerHTML = "<div class='popUp'><iframe src='http://erdbeerlounge2.spreadshirt.net' height='1000' width='710'></iframe><br><button onclick='this.parentNode.parentNode.removeChild(this.parentNode);'>Close</button></div>"; 
	document.body.appendChild(div.firstChild); 
}

/* file: ./addons/plugins/header/search/search.js */

plg_header_search  = {
	submitForm 	: function ( form ){

		if(!form.keyword.value){
			form.keyword.focus();
			return false;
		}
		location.href = form[ 'searchURL_' + form.category.value ].value.replace(/KEYWORD/,encodeURIComponent(form.keyword.value));
		return false;
	}
}



/* file: ./addons/plugins/messages/notifier/notifier.js */
var plg_messages_notifier = new function()
{
	var _self = this;

	this.blink = function( n )
	{
		if( $('#jQ_newMessageNotifier').length > 0 )
		{
			if( n > 0 )
			{
				var c = $('#jQ_newMessageNotifier a').css('color') == 'rgb(255, 255, 255)' ? '#FFAE00' : '#FFFFFF';
				$('#jQ_newMessageNotifier a').css('color', c);
				window.setTimeout( function() { _self.blink( parseInt(n-1) ); }, 1000 );
			}
			else
			{
				$('#jQ_newMessageNotifier a').css('color', '#FFFFFF');
			}
		}
	}
}

$( document ).ready( function() {

	plg_messages_notifier.blink( 10 );

} );

/* file: ./addons/plugins/video/top/top.js */
var plg_video_top = new function()
{
	var _featuredVideo 	= null;
	var _curOffset		= null;
	var _minOffset		= null;
	var _maxOffset		= null;

	this.init = function()
	{
		plg_video_top._featuredVideo = featuredVideo;

		plg_video_top._curOffset	= 0;
		plg_video_top._minOffset	= 0;
		plg_video_top._maxOffset	= plg_video_top._featuredVideo.found_rows[0] - 1;

		plg_video_top.show();
	}

	this.show = function()
	{
		$('.jQ_featured .jQ_pic').each( function(Index, Object)
		{
			$( Object ).attr( 'src', plg_video_top._featuredVideo.data[plg_video_top._curOffset].pic );
		});

		$('.jQ_featured .jQ_link').each( function(Index, Object)
		{
			$( Object ).attr( 'href', plg_video_top._featuredVideo.data[plg_video_top._curOffset].url );
		});

		$('.jQ_featured .jQ_title .jQ_link').each( function(Index, Object)
		{
			$( Object ).html( plg_video_top._featuredVideo.data[plg_video_top._curOffset].title );
		});

		$('.jQ_featured .jQ_desc').each( function(Index, Object)
		{
			$( Object ).html( plg_video_top._featuredVideo.data[plg_video_top._curOffset].description );
		});

		plg_video_top._curOffset = plg_video_top._curOffset + 1;
		if( plg_video_top._curOffset > plg_video_top._maxOffset ) plg_video_top._curOffset = plg_video_top._minOffset;

		setTimeout( 'plg_video_top.show();', 7000 );
	}
}


/* file: ./addons/plugins/video/video.js */
var plg_video = new function()
{

	var _player 		= null;
	var _videoData 		= null;
	var _playListData	= null;

	var _minOffset 	= null;
	var _curOffset 	= null;
	var _maxOffset 	= null;
	var _limit		= null;

	this.init = function()
	{
		plg_video._player 		= new SWFObject( '/system/swf/player_skinned.swf', 'playerObj', '454', '384', '9' );
		plg_video._videoData 	= videoData;
		plg_video._playListData = playListData;

		plg_video._minOffset 	= 0;
		plg_video._curOffset 	= 0;
		plg_video._maxOffset 	= plg_video._playListData.found_rows[0] - 3;
		plg_video._limit		= 3;

		plg_video._player.addParam( 'allowfullscreen', 	'true' );
		plg_video._player.addParam( 'allowscriptaccess', 'always' );
		plg_video._player.addParam( 'wmode', 'opaque' );
		plg_video._player.addVariable( 'file', plg_video._videoData.link );

		if( plg_video._playListData.found_rows[0] > 3 )
		{
			$('#slide_up').click( plg_video.slide );
			$('#slide_down').click( plg_video.slide );
			$('#slide_up, #slide_down').click(function(){plg_page_pixels.redisplayPixels();});
		}
	}

	this.play = function()
	{
		plg_video._player.addVariable( 'autostart', true );
	}

	this.show = function()
	{
		plg_video._player.write('preview');
	}

	this.slide = function( sender )
	{
		var move_direction 	= $( sender.target ).attr( 'id' ).split( '_' )[1];
		var move_value 		= move_direction == 'up' ? -1 : 1;
		var tmp 			= plg_video._curOffset + move_value;

		if( tmp >= plg_video._minOffset && tmp <= plg_video._maxOffset )
		{
			if( plg_video._curOffset != tmp )
			{
				plg_video._curOffset = tmp;
				plg_video.ajaxQuery();
			}
		}
	}

	this.ajaxQuery = function()
	{
		$('.jQ_list').toggle();
		$('.jQ_loading').toggle();
		majax.call_callback( 'plg_video::ajaxGetDataForPlaylist', plg_video.ajaxQuery__callback, [ plg_video._curOffset, plg_video._limit, pluginParams ] );
	}

	this.ajaxQuery__callback = function( response )
	{
		var response = eval( response );

		$('.jQ_list .jQ_container').each( function(Index, Object)
		{
			$( Object ).removeClass( 'row_actv' );
			if( response.data[Index].videoId == pluginParams.itemId ) $( Object ).addClass( 'row_actv' );
		});

		$('.jQ_list .jQ_pic').each( function(Index, Object)
		{
			$( Object ).attr( 'src', response.data[Index].pic );
			$( Object ).attr( 'alt', response.data[Index].title );
		});

		$('.jQ_list .jQ_link').each( function(Index, Object)
		{
			$( Object ).attr( 'href', response.data[Index].url );
		});

		$('.jQ_list .jQ_link2').each( function(Index, Object)
		{
			$( Object ).attr( 'href', response.data[Index].url );
		});

		$('.jQ_list .jQ_title').each( function(Index, Object)
		{
			$( Object ).html( response.data[Index].title );
		});

		$('.jQ_list .jQ_desc').each( function(Index, Object)
		{
			$( Object ).html( response.data[Index].description );
		});

		$('.jQ_list').toggle();
		$('.jQ_loading').toggle();
	}

	this.getVideoURL = function()
	{
		return currentVideoURL;
	}

}

/* file: ./addons/plugins/video/tabs/tabs.js */
var plg_video_tabs = new function()
{

}


/* file: ./addons/plugins/popup/popup.js */
var plg_popup = new function(){

	var $_objects = null;

	this.headerTPL = $('<div class="head oo"><a href="#" class="btn_close jQ_close"></a><h2></h2></div>');
	this.popupTPL = $('<div class="popup"><div class="content oo"></div></div>');
	this.buttonTPL = $('<button type="submit" class="btn btn_b fright" value=""><font><span class="p_1"></span></font></button>');

	this.preparePopup = function(){
		//return $('<div class="popup"><div class="top"></div><div class="content oo"></div><div class="bottom"></div></div>');
		return this.popupTPL.clone();
	};

	this.setContent = function(popup,content){
		if(popup.find(".content.oo:first-child").length > 0){
			if(popup.find(".content.oo .head.oo").length > 0){
				if(popup.find(".content.oo .head.oo + *").length > 0){
					popup.find(".content.oo .head.oo + *").eq(0).replaceWith(content);
				} else {
					if(popup.find(".content.oo ~ *").length > 0){
						popup.find(".content.oo:first-child").replaceWith(content);
					} else {
						popup.find(".content.oo:first-child").append(content);
					}
				}
			} else {
				popup.find(".content.oo").append(content);
			}
		} else {
			popup.find(".content.oo").append(content);
		}
		return popup;
	};

	this.removeContent = function(popup) {
		popup.find(".content.oo *").remove();
		return popup;
	}

	this.setTitle = function(popup,content){
		popup = $(popup);
		if(popup.find(".head.oo h2").length > 0){
			popup.find(".head.oo h2").html(content);
		} else {
			popup.find('.content.oo').prepend(this.headerTPL.clone()).find('h2').html(content);
		}
		return popup;
	};

	this.delButton = function(popup,index){
		popup = $(popup);
		var buttons = popup.find('.content.oo button');

		if(index != undefined){
			buttons.eq(index).remove();
		} else {
			buttons.remove();
		}
	}

	this.addButton = function(popup,text,click){
		popup = $(popup);

			var btn = this.buttonTPL.clone().click(click);
				btn.find('span').html(text);

			popup.find('.content.oo').append(btn);
		return popup;
	};

	this.show = function(popup){
		$.unblockUI();
		$.blockUI(popup);
		$(popup).find('.jQ_close').unbind('click').click(plg_popup.hide);
		var top = parseInt ( ( parseInt( screen.height ) - parseInt( $(popup).get(0).offsetHeight )) / 3 );
		$(".blockMsg").css({ border:'0px', left:'400px', top: top+'px', cursor:'default'});
		$_objects = $('object, embed');

		if( $_objects !== null )
			$_objects.css({visibility:'hidden'});

	};

	this.hide = function(){
		$.unblockUI();

		if( $_objects !== null )
			$_objects.css({visibility:'visible'});

		$_objects = null;
	return false;
	};

	this.showConfirm = function(title,text,yesText,yesCallback,noText,noCallback){
		var confirm = this.preparePopup();
		this.setTitle(confirm,title);
		this.setContent(confirm,text);
		this.addButton(confirm,noText,noCallback);
		this.addButton(confirm,yesText,yesCallback);
		this.show(confirm);
	return confirm;
	}

	$.blockUI.defaults.fadeOut = false;
	$.extend( $.blockUI.defaults.overlayCSS, { backgroundColor: '#000', cursor:'default' } );

}


/* file: ./addons/plugins/popup/recommend/recommend.js */

var plg_popup_recommend = new function(){

	this.TYPE_PHOTO 	= 1;
	this.TYPE_VIDEO		= 2;
	this.contentType 	= 1;

	this.send = function(form){
		try{
			if( this.__id != 0){

				plg_popup_recommend.clearErrors( form );

				var data = new Object();
					data.contentType 		= this.contentType;
					data.senderFirstname 	= form.senderFirstname.value;
					data.personalText	 	= form.personalText.value;
					data.url 				= this.contentType == 2 ? plg_video.getVideoURL() : location.href.replace('#', '');
					data.friends			= [];
					$(form).find('.jQ_friends_list_item').each(
						function (){
							data.friends.push( {
									firstname	: $(this).find('input[name="friendFirstname[]"]').val(),
									email		: $(this).find('input[name="friendEmail[]"]').val()
								}
							);
						}
					);
					majax.call_callback("plg_popup_recommend::send", function (response) { plg_popup_recommend.showConfirm( response, form ); },[data]);

			} else {
				$(".popup .errors").show('slow');
				setTimeout(function(){ $(".popup .errors").hide('slow'); },2000);
			}
		} catch (e) {
			return false;
		}
	}

	this.show = function(id,contentType){
		this.contentType = contentType;
		var popup = $('.jQ_pop_photo_recommend:eq(0)').clone(true);
		plg_popup.show( popup );
		sys.maxChars(".blockUI textarea[name=personalText]",'.blockUI span.personalTextCharsLeft');
	}

	this.showConfirm = function( response, form ){
		if( response.success ){

			plg_popup.hide();
			var popup = plg_popup.preparePopup();
			plg_popup.setContent(popup,"<h2>" + response.messages[0] + "</h2>");
			plg_popup.show(popup);
			window.setTimeout(function(){ plg_popup.hide(); },2000);

		} else {

			try{
				if( undefined != response.messages.senderFirstname[0] ){
					$(form).find('.jQ_recommend_sender .errors').show().find('p').html( response.messages.senderFirstname[0] );
				}
			} catch (e) {}

			try{
				if( undefined != response.messages.personalText[0] ) {
					$(form).find('.jQ_recommend_personalText .errors').show().find('p').html( response.messages.personalText[0] );
				}
			} catch (e) {}

			try{
				if( undefined != response.messages.friends.firstname[0] ) {
					$(form).find('.jQ_recommend_friends .errors').show().find('p').html( response.messages.friends.firstname[0] );
				}
			} catch (e) {}

			try{
				if( undefined != response.messages.friends.email.emailAddressInvalid ) {
					$(form).find('.jQ_recommend_friends .errors').show().find('p').html( response.messages.friends.email.emailAddressInvalid );
				}
			} catch (e) {}
		}
	}

	this.addEntry = function (){
		var $items 		= $('.jQ_friends_list_item');
		var $itemLast 	= $('.jQ_friends_list_item:last');

		$itemLast.after( $cloned = $itemLast.clone(true) );
		$cloned.find('input').val('');
		$cloned.find('.errors').hide().find('p').html('');

		if( $items.length >= 4 ){
			$('a.jQ_recommend_more').hide();
		}
	}

	this.clearErrors = function ( form ){
		$(form).find('.errors').hide().find('p').html('');
	}
}

$(document).ready(
	function(){
		$('.jQ_recommend_more').click( plg_popup_recommend.addEntry );
	}
);

/* file: ./addons/plugins/register/onPageContainer/onPageContainer.js */

var plg_register_onPageContainer = new function(){
	
	var _self = this;
	
	this.tabsExtendendClass = '';
	this.activeTab = -1;
	
	function activateTab(tabIndex){
		plg_tabs.getTabs().eq(tabIndex).click(); 
		return false;	
	}
	
	this.init = function(){
		
		plg_tabs.setSelector("_r."+_self.tabsExtendendClass);
		var $tabs = plg_tabs.getTabs().unbind('click').click(_self.tabClicked);
		
		$(".registerOnPageContainer .unauthorized button[type='submit']").click(function(){
			return activateTab(1); });
		$(".registerOnPageContainer .unauthorized a.jQLogin").click(function(){
			return activateTab(0);
		});
		$(".registerOnPageContainer .unauthorized a.jQRegister").click(function(){
			return activateTab(1);
		});
		$("button[type='submit'], a.jQLogin, a.jQRegister", ".registerOnPageContainer .unauthorized")
			.add(plg_tabs.getTabs())
			.click(function(){
				plg_page_pixels.redisplayPixels();
			});
		if( _self.activeTab > -1){
			$tabs.eq(_self.activeTab).click();
		}
		
	}
	
	this.tabClicked = function(tab){
		var index =$(plg_tabs.selector+" a").index(this);
		plg_tabs.setActiveTab(index);
		_self.showPanelForIndex(index);
	return false;
	}
	
	this.showPanelForIndex = function(index){
		var i = index+1;
		var $panels = $(".registerOnPageContainer .ropc_item");
		var $currentPanel = $panels.eq(i);
		$panels.not(":eq("+i+")").slideUp('fast',function(){ $currentPanel.slideDown(); });
		
		$currentPanel.find('form').not("input[name='_currenetPanel']").prepend("<input type='hidden' name='_currenetPanel' value='"+(i-1)+"'>");
		
	}	
	
}


/* file: ./addons/plugins/comments/write/write.js */
var cache = {};

$().ready( function() {

	$('#commentBody').focus( clearDefault );
	$('#commentBody').blur( resetToDefault );
	$('#commentForm').submit( submitEvent );

});

function clearDefault(sender)
{
	if( !$(sender.target).hasClass('examples') ) return;

	$(sender.target).removeClass('examples');
	eval ( 'cache.' + $(sender.target).attr('id') + ' = $(this).val() ');
	$(sender.target).val('');
}

function resetToDefault(sender)
{
	if( $(sender.target).val() == '' )
	{
		$(sender.target).addClass('examples');
		eval ( '$(this).val( cache.' + $(sender.target).attr('id') + ' )' );
	}
}

function submitEvent()
{
	$('#commentForm .examples').each( function(I,O)
	{
		var tmp = {};
		tmp.target = O;
		clearDefault(tmp);
	});
}

/* file: ./addons/plugins/tabs/tabs.js */
var plg_tabs = new function(){
	var _self = this;
	this.tabs = null;
	this.selector = '';
	
	this.setSelector = function(className){
		this.selector = ".tabsmenu"+(className.indexOf("_") != 0 ? '.':'')+className;
		this.tabs = $(this.selector);
		return this;	
	}
	
	this.resetStates = function(){
		this.tabs.find("a.active").removeClass('active');
		return this;
	}
	
	this.setActiveTab = function(index){
		this.resetStates().tabs.find("a:eq("+index +')' ).addClass('active');
		return false;	
	}
	
	this.setActiveTabByReference = function(tab){
		this.resetStates();
		$(tab).addClass('active');
		return false;	
	}
	
	this.getTabs = function(){
		return this.tabs.find("a");
	}
}


/* file: ./addons/plugins/register/normal/normal.js */
RegistrationForm = function( elementSelector ) {

	var _self				= this;

	/**
	 * CSS class used to describe containers with error messages
	 */
	_self.errorClass			= '.errors';

	/**
	 * element that holds error text
	 */
	_self.errorElement		= 'p';

	/**
	 * selector that describes whole container
	 */
	_self.elementSelector	= elementSelector;

	/**
	 * selector for the registration form
	 */
	_self.formSelector		= elementSelector + ' form[name="jQ_register_layer_form"]';

	/**
	 * selectors used to find input elements
	 */
	_self.selectors			= {
		userName:	_self.formSelector + ' input[name="userName"]',
		password1:	_self.formSelector + ' input[name="password1"]',
		password2:	_self.formSelector + ' input[name="password2"]',
		firstName:	_self.formSelector + ' input[name="firstName"]',
		eMail:		_self.formSelector + ' input[name="eMail"]',
		cityUser:	_self.formSelector + ' input[name="cityUser"]',
		country:	_self.formSelector + ' select[name="country"]',
		city:		_self.formSelector + ' input[name="city"]',
		captcha:	_self.formSelector + ' input[name="captcha"]',
		newsletter:	_self.formSelector + ' input[name="newsletter"]',
		terms:		_self.formSelector + ' input[name="terms"]'
	};

	/**
	 * provides quick access to an input
	 * @param {String} name
	 */
	this.getField			= function( name ) {
		return $(_self.selectors[ name ]);
	};

	/**
	 * gets a reference to an error message
	 * @param {String} name
	 */
	this.error				= function( errorName ) {
		return $( _self.elementSelector ).find( errorName );
	};

	/**
	 * gets a text of error message
	 * @param {String} errorName
	 */
	this.errorMsg			= function( errorName ) {
		
		var $elem = _self.error( errorName );
		
		if( $elem.size() == 0 ){
			return '';
		}
		
		return _self.error( errorName ).text();
	};
	
	/**
	 * defines validation messages (evaluated by methods)
	 */
	this.validationMessages		= {
		userName:	{
			required:		_self.errorMsg( '.jQ_USERNAME_SHORT'),
			minlength:		_self.errorMsg( '.jQ_USERNAME_SHORT'),
			maxlength:		_self.errorMsg( '.jQ_USERNAME_LONG'),
			userName:		_self.errorMsg( '.jQ_USERNAME_MALFORMED')
		},
		password1:	{
			required:		_self.errorMsg( '.jQ_PASSWORD_SHORT' ),
			minlength:		_self.errorMsg( '.jQ_PASSWORD_SHORT' )
		},
		password2:	{
			required:		_self.errorMsg( '.jQ_PASSWORD_SHORT' ),
			minlength:		_self.errorMsg( '.jQ_PASSWORD_SHORT' ),
			equalTo:		_self.errorMsg( '.jQ_PASSWORD_MISMATCH' )
		},
		firstName:	{
			required:		_self.errorMsg( '.jQ_FIRSTNAME_EMPTY' ),
			minlength:		_self.errorMsg( '.jQ_FIRSTNAME_SHORT' ),
			germanNames:		_self.errorMsg( '.jQ_FIRSTNAME_MALFORMED' )
		},
		eMail:		{
			required:		_self.errorMsg( '.jQ_EMAIL_WRONG' ),
			email:			_self.errorMsg( '.jQ_EMAIL_WRONG' )
		},
		postal:		{
			required:		_self.errorMsg( '.jQ_ZIP_EMPTY' ),
			digits:			_self.errorMsg( '.jQ_ZIP_WRONG' ),
			minlength:		_self.errorMsg( '.jQ_ZIP_WRONG' ),
			postal:			_self.errorMsg( '.jQ_ZIP_WRONG' )
		},
		city:		{
			minlength:		_self.errorMsg( '.jQ_CITY_WRONG' ),
			required:		_self.errorMsg( '.jQ_CITY_WRONG' ),
			cityNames:		_self.errorMsg( '.jQ_CITY_WRONG' )
		},
		captcha:	{
			minlength:		_self.errorMsg( '.jQ_CAPTCHA_MISMATCH' ),
			required:		_self.errorMsg( '.jQ_CAPTCHA_MISMATCH' )
		},
		terms:		{
			required:		_self.errorMsg( '.jQ_TERMS_UNCHECKED' )
		}
	};

	this.createValidator		= function(){

		/**
		 * define validation rules
		 */
		_self.validationRules = {
			userName:	{ required:true, minlength:4, maxlength:15, userName:true },
			password1:	{ required:true, minlength:6 },
			password2:	{ required:true, minlength:6, equalTo: _self.getField( 'password1' ).get(0) },
			firstName:	{ required:true, minlength:3, germanNames:true },
			eMail:		{ required:true, email:true },
			postal:		{ required:true, digits:true, postal:_self.getField('country') },
				// minLength:( _self.getField('country').val() == 'de_DE' ? 5 : 4 ) },
			city:		{ required:true, cityNames:true, minlength:2 },
			captcha:	{ required:captchaRequired, minlength:6 },
			terms:		{ required:true }
		};

		/**
		 * create Validator object
		 */
		this.validator	= $( this.formSelector ).validate( {
			event:			'blur',
			errorElement:	_self.errorElement,
			rules:			_self.validationRules,
			messages:		_self.validationMessages,
			errorPlacement: function( error, element ) {
				//exception for Captcha
				if( $(element).attr('name') == 'captcha' ) {
					$( error ).prependTo( $(element).parent().parent().parent().find( '.errors' ) ).fadeIn();
				} else {
					//input container
					var cnt = $( element ).parent();
					//input is a checkbox put into container
					if( cnt.hasClass( 'jQ_checkbox_container' ) ) {
						//step out two containers
						$( error ).prependTo( cnt.parent().next().next( '.errors') ).fadeIn();
					} else {
						//shorter path; for text inputs
						$( error ).prependTo( cnt.next( '.errors' ) ).fadeIn();
					}
				}
			}
		} );
		//remove potential error from postal field
		$('input[name="postal"]').blur();
	};

	/**
	 * initially generate the validator
	 */
	this.createValidator();

	/**
	 * adds 'generate new' functionality to Captcha image
	 */
	$(this.formSelector + ' img.jQ_captcha').click( function(){
		$(this).attr('src', '/imagecode.png?ts=' + (new Date()).valueOf());
	});

	/**
	 * gets a list of all visible errors
	 */
	this.getVisibleErrors		= function(){
		return $(_self.formSelector + ' ' + _self.errorClass + ' ' + _self.errorElement + ':visible');
	};

	/**
	 * indicates whether or not a form has errors
	 */
	this.hasErrors				= function(){
		return _self.getVisibleErrors().length > 0;
	};

	this.raiseError			= function( errorName ) {
		_self.error( errorName ).hide().fadeIn();
	};

	this.getField( 'country' ).change( _self.createValidator );

	try {
		if (typeof(regErrors) != 'undefined') {
			_self.validator.showErrors(regErrors);
		}
	} catch( e ) {
	}
};

var regForm		= null;

$('document').ready( function(){
	regForm			= new RegistrationForm( '#jQ_register' );
});

/* file: ./addons/plugins/magazine/articles/home/list/list.js */
var plg_magazine_articles_home_list = new function(  )
{
	this.run = function( prefix )
	{
		$('#prev_'+prefix).click( function(){
			plg_magazine_articles_home_list.change(prefix , this);
		} );
		$('#next_'+prefix).click( function(){
			plg_magazine_articles_home_list.change(prefix , this);
		} );
		
		$('#prev_'+prefix).add('#next_'+prefix).click(function() {
			plg_page_pixels.redisplayPixels();
		});
	}

	this.doAjaxQuery = function( p )
	{
		$('#moreListInner').fadeOut("slow");
		majax.call_callback( 'plg_magazine_articles_home_list::ajaxGetContent', plg_magazine_articles_home_list.doAjaxQueryCallback, [DATA[ p ]['SECTION'], DATA[ p ]['NOW_PAGE_NR'], DATA[ p ]['PER_PAGE'], DATA[ p ]['START_OFFSET'], DATA[ p ]['CONTEXT_ARTICLE_ID'], DATA[ p ]['CAT_ID'] , p, DATA[ p ]['EXCLUDED_IDS']] );
	}

	this.doAjaxQueryCallback = function(response)
	{
		var response = eval(response);

		var prefix_plg = response.prefix;
		for( var i = 0; i < DATA[ prefix_plg ]['PER_PAGE']; i++ )
		{
			if( response.data[i] )
			{
				$('#photo_'+ prefix_plg + '_' + i).attr('src', response.data[i].photoSrc);
				$('#photo_'+ prefix_plg + '_' + i).attr('alt', response.data[i].subject);
				//$('#title_' + i).html(response.data[i].subject);
				$('#linkT_' + prefix_plg+ '_'+ i).html(response.data[i].subject);
				$('#teaser_'+ prefix_plg + '_' +i).html(response.data[i].teaser);
				$('#moreItem_'+prefix_plg+'_' + i).removeClass('hid');
				$('#linkT_'+prefix_plg+'_' + i).attr('href', response.data[i].moreUrl);
				$('#linkT2_'+prefix_plg+'_' + i).attr('href', response.data[i].moreUrl);
				$('#linkImg_'+prefix_plg+'_' + i).attr('href', response.data[i].moreUrl);
			}
			else
			{
				$('#moreItem_'+ prefix_plg + '_' + i).addClass('hid');
			}
		}

		setTimeout( function() {
			$('#moreListInner_'+prefix_plg).fadeIn("slow");
			$('#next_'+prefix_plg).removeClass('hid');
			$('#prev_'+prefix_plg).removeClass('hid');
			if( DATA[ prefix_plg ]['NOW_PAGE_NR'] == DATA[ prefix_plg ]['MAX_PAGE_NR'] ) {
				$('#next_'+prefix_plg).addClass('hid');
			} else if ( DATA[ prefix_plg ]['NOW_PAGE_NR'] == DATA[ prefix_plg ]['MIN_PAGE_NR'] ) {
				$('#prev_'+prefix_plg).addClass('hid');
			}
		} , 250);
	}

	this.change = function( p , obj_c)
	{
		var ac = $(obj_c).attr('id');
		if( ac == ('next_'+p) ) {
			if( DATA[ p ]['NOW_PAGE_NR'] < DATA[ p ]['MAX_PAGE_NR'] ) {
				DATA[ p ]['NOW_PAGE_NR']++;
				plg_magazine_articles_home_list.doAjaxQuery( p );
			}
		} else if( ac == ('prev_'+p) ) {
			if( DATA[ p ]['NOW_PAGE_NR'] > DATA[ p ]['MIN_PAGE_NR'] )
			{
				$('#prev_'+p).removeClass('hid');
				DATA[ p ]['NOW_PAGE_NR']--;
				plg_magazine_articles_home_list.doAjaxQuery( p );
			}
		}
	}
}

/* file: ./addons/plugins/magazine/sound/sound.js */
var clicked = null;

$(document).ready( function() {

	//$('#styleLink').click( voteForStyle );
	$('.jQ_magazineSound input[name="vote"]').click( voteForStyle );
	$('#closeLink').click( function() { $('#styleErr').hide('fast'); } );
	$('#closeButton').click( function() { $('#styleErr').hide('fast'); } );

});

function voteForStyle()
{
	clicked = $(this);

	var rate = $('input[name="vote"]').filter(':checked');

	if( $(rate).length )
	{
		$('#styleErr').fadeOut( "slow" );
		var voteVal = $(rate.get(0)).val();
		var voteId	= $('#styleId').val();

		majax.call_callback( 'plg_magazine_sound::ajaxVote', callback__voteForStyle, [voteId, voteVal] );
	}
	else
	{
		$('#styleErr').fadeIn( "slow", function() { setTimeout( function() { $('#styleErr').fadeOut( "slow") }, 3000 ) } );
		$('#styleLink').click( voteForStyle );
		return false;
	}
}

function callback__voteForStyle(response)
{
	$('input[name="vote"]').attr( 'class', 'sel' );
	clicked.parent().addClass( 'voted' );
	var response = eval(response);
	document.location.href = response.url;
//	$('#styleYes').html( response.percentage.iWantIsAsWell.toString() + '%');
//	$('#styleMaybe').html( response.percentage.itSOk.toString()  + '%');
//	$('#styleNo').html( response.percentage.exchangeIt.toString()  + '%');

	//$('#styleLink').fadeOut( "slow", function() { $('#styleLinkNext').fadeIn( "slow"); $('#styleLinkNext').click( showNextStyle ) } );
	//$('#styleLink').fadeOut( "slow", function() { $('#styleLinkNextFollow').fadeIn( "slow" ); } );
}

function showNextStyle()
{
	majax.call_callback( 'plg_magazine_sound::ajaxGetStyleForVote', callback__showNextStyle, [] );
}

function callback__showNextStyle(response)
{
	var response = eval(response);

	if( response == -1 )
	{
		$('#styleLinkNext').fadeOut( "slow" );
		return;
	}

	$('#linkTxt').attr('href', response.url);
	$('#linkImg').attr('href', response.url);

	$('#styleTitle').html( response.title );
	$('#stylePhoto').attr('src', response.photo );
	$('#stylePhoto').attr('alt', response.title );
	$('#styleId').val( response.styleId );

	$('#styleYes').html( '?' );
	$('#styleMaybe').html( '?' );
	$('#styleNo').html( '?' );

	$('#styleLinkNext').fadeOut( "slow", function() { $('#styleLink').fadeIn( "slow"); $('#styleLink').click( voteForStyle ) } );
}


/* file: ./addons/plugins/tagsV2/cloud/box/box.js */
var plg_tagsV2_cloud_box = new function()
{
	this.relasetShow = function( prefix )
	{
		var isDisplay = $('#'+prefix+'_moreRelated').css( 'display' );
		if( isDisplay == 'none' ) {
			$('#'+prefix+'_moreRelated').show();
		} else {
			$('#'+prefix+'_moreRelated').hide();
		}
		
	}
	this.combinShow = function()
	{
		var isDisplay = $('#moreCombin').css( 'display' );
		
		if( isDisplay == 'none' ) {
			$('#moreCombin').show();
		} else {
			$('#moreCombin').hide();
		}
		
	}
	
	this.boldBaseTag = function( prefix , word )
	{
		var _baseTag = $('#'+prefix+'_baseTag').val();
		$('#'+prefix+'_related a.inv').each(function(){
			var text = $(this).html();
			text = text.replace( eval( '/(.*)(' + _baseTag + ')(.*)/i') , '$1<font class="bld">' + word + '</font>$3' );
			$(this).html( text );
		});
	}
}

