var WindowObjectReference = [];
function openWindow_(key,url,width,height,params) {
	if (typeof params == 'undefined') var params=',menubar=no,resizable=no';
	if (!$.inArray(key,WindowObjectReference) || ($.inArray(key,WindowObjectReference) && (WindowObjectReference[key]== null || WindowObjectReference[key].closed))) {
		WindowObjectReference[key] = window.open(url,key,'width='+width+',height='+height+',toolbar=no,scrollbars=no'+params);
		}
	WindowObjectReference[key].focus();
	}
$(function(){
	var adAnim=true;
	var interval=5000;
	$.easing.easeOutQuart = function (x,t,b,c,d) { return -c*((t=t/d-1)*t*t*t-1)+b; };
	$.fn.replaceAttr = function(attr,string,replace) { return this.attr(attr,function(){return $(this).attr(attr).replace(string,replace);}); }; 
//	if (adAnim) $('#headTeaser').innerfade({speed:'slow',timeout:3500});
	if (adAnim) $('#slideshow').serialScroll({
		items:'li',
		prev:'#slideshowWrapper a.prev',
		next:'#slideshowWrapper a.next',
		axis:'x',
		offset:0,
		start:0,
		duration:500,
		interval:4000,
		exclude:5,
		force:true,
		stop:true,
		lock:false,
		cycle:true,
		easing:'easeOutQuart',
		jump: false //click on the images to scroll to them
		});
	$('a[rel^="@_"]').attr('href',function(){return this.rel.replace(/@_/,'mailto:').replace(/__at__/,'@');});
	if (adAnim && 1==2) window.setInterval(function(){
		$('#rightContent').toggle('slide',{direction:'right',callback:function(){
			$(this).load('/_foxcms/foxcore.php',{ad:'next'},function(responseText,textStatus,XMLHttpRequest){
				if (textStatus=='success') $(this).toggle('slide',{direction:'right'});
				});
			}});
		return false;
		}, interval);
	//if ($.browser.msie && /^6.*/.test($.browser.version)) $.get("/_foxcms/__window/ie6.php", function(data){$.modal(data);});
	var fullUrl=document.location.toString();
	var url=fullUrl.split("?")[0];
	if (document.location.toString()==url) url=document.location.toString().split("#")[0];
	$('#foxtopmenu a').each(function(i,e){if (e==url) $(e).addClass('active');});
	var searchItem=$('.header_big>span').html();
	$('ul.videoMenu>li>a').each(function(i,e){if ($(e).html()==searchItem) $(e).addClass('active');});
	function getType(object) { return String(object.constructor).split(' ')[1].split('()').join(''); }
/*
	$('a[@rel^="external:"]').click(function(){
		var rel=$(this).attr('rel');
		var result=/^external\:\[key:(.+),width:(.+),height:(.+)\]$/g.exec(rel);
		openWindow_(result[1],this,result[2],result[3]);
		return false;
		});
*/
	$('.tooltip').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		opacity: 1,
		fixPNG: true,
		showBody: '- ',
		extraClass: 'pretty',
		top: -10,
		left: 15
		});
    document.write = function(html){
        $('td.footer').append('<br/><br/>'+html+'');
        }
/*
<script type="text/javascript">
google_ad_client = "pub-9328241759808769";
google_ad_slot = "2927620782";
google_ad_width = 728;
google_ad_height = 90;
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
*/
	var adSense='<script type="text/javascript"><!--google_ad_client = "pub-9328241759808769";/* 728x90, Erstellt 26.10.08 */google_ad_slot = "1881865170";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
	adSense='<script type="text/javascript">google_ad_client = "pub-9328241759808769";google_ad_slot = "2927620782";google_ad_width = 728;google_ad_height = 90;</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
    var adHtml='<div style="margin-top:20px;">'+adSense+'</div>';
	$('body').append(adHtml);
	
	});




			  function onValidateJoinForm() {
			    var form = document.forms['JoinForm'];
			    if (!(validateRequiredField(form['join_handle'], '{l_username}'))) {
			      alert("Du musst einen Profilnamen eingeben.");
                  return false;
			    }
			    if (!(validateMinLength(form['join_handle'], '{l_username}','4'))) {
			      alert("Dein Profilname muss mindestens 4 Zeichen enthalten.");
                  return false;
			    }
			    if (!(validateMaxLength(form['join_handle'], '{l_username}','20'))) {
                  alert("Dein Profilname darf max. 20 Zeichen lang sein.");
			      return false;
			    }
			    if (!(validateAlphaNumeric(form['join_handle'], '{l_username}'))) {
                  alert("Dein Profilname darf nur Buchstaben enthalten.");
			      return false;
			    }
			    if (!(validateRequiredField(form['join_password'], '{l_password}'))) {
                  alert("Du musst ein Passwort eingeben.");
			      return false;
			    }
			    if (!(validateMinLength(form['join_password'], '{l_password}','6'))) {
                  alert("Dein Passwort muss mindestens 4 Zeichen enthalten.");
			      return false;                        
			    }
			    if (!(validateMaxLength(form['join_password'], '{l_password}','15'))) {
                  alert("Dein Passwort darf max. 15 Zeichen lang sein.");
			      return false;
			    }
			    if (!(validateAlphaNumeric(form['join_password'], '{l_password}'))) {
			      return false;
			    }
			    if (!(validateNotTwoFields(form['join_password'],'{l_password}',form['join_handle'],'{l_username}'))) {
			      alert("Dein Passwort darf nicht mit Deinem Profilnamen identisch sein.");
                  return false;
			    }
			    if (!(validateTwoFields(form['verify_password'],'{l_verify_password}',form['join_password'],'{l_password}'))) {
			      alert("Dein Passwort ist nicht mit der Wiederholungseingabe identisch!");
                  return false;
			    }
			    if (!(validateRequiredField(form['email'], '{l_email_address}'))) {
                  alert("Du musst Deine eMail Adresse eingeben.");
			      return false;
			    }
			    if (!(validateMaxLength(form['email'], '{l_email_address}','100'))) {
                  alert("Deine eMail Adresse darf max. 100 Zeichen lang sein.");
			      return false;
			    }
			    if (!(validateEmailField(form['email'], '{l_email_address}'))) {
                  alert("Es wurde eine fehlerhafte eMail Adresse festgestellt.");
			      return false;
			    }
			    if (!(validateRequiredField(form['verify_email'], '{l_verify_email}'))) {
                  alert("Du musst Deine eMail Adresse wiederholen.");
			      return false;
			    }
			    if (!(validateMaxLength(form['verify_email'], '{l_verify_email}','100'))) {
                  alert("Deine eMail Adresse darf max. 100 Zeichen lang sein.");
			      return false;
			    }
			    if (!(validateEmailField(form['verify_email'], '{l_verify_email}'))) {
                  alert("Es wurde eine fehlerhafte - wiederholte eMail Adresse festgestellt.");
			      return false;
			    }
			    if (!(validateTwoFields(form['verify_email'],'{l_verify_email}',form['email'],'{l_email_address}'))) {
			      alert("Deine eMail Adresse ist nicht mit der Wiederholungseingabe identisch!");
                  return false;
			    }
			    if (!(validateRequiredSelect(form['orientation'],'{l_orientation}','00'))) {
                  alert("Bitte gib an");
			      return false;
			    }
			    if (!(validateRequiredField(form['orientation'], '{l_orientation}', '00'))) {

			      return false;
			    }
			    if (!(validateRequiredSelect(form['country'],'{l_country}','-1'))) {
			      return false;
			    }
			    if (!(validateRequiredField(form['country'], '{l_country}', '-1'))) {
			      return false;
			    }
			    if (!(validateRequiredField(form['month'], '{l_month}'))) {
			      return false;
			    }
			    if (!(validateRequiredField(form['day'], '{l_day}'))) {
			      return false;
			    }
			    if (!(validateRequiredField(form['year'], '{l_year}'))) {
			      return false;
			    }
			    if (!(validateRequiredCheckbox(form['privacy_policy'],'','{l_agree_privete_policy}'))) {
			      return false;
			    }
			    return true;
			  }

			  function validateJoinForm() {
			    blockSubmission = true;
			     if (typeof beforeJoinFormValidation != 'undefined') {
			       beforeJoinFormValidation();
			    }
			    var validated = onValidateJoinForm();
			    if (validated && (typeof uponSuccessfulJoinFormValidation != 'undefined')) {
			      validated = uponSuccessfulJoinFormValidation();
			    }
			    else if (!validated && (typeof uponUnsuccessfulJoinFormValidation != 'undefined')) {
			      uponUnsuccessfulJoinFormValidation();
			    }
			    if (!validated) {

			    }
			    return validated;
			  }

			  function submitJoinForm() {
			   if (validateJoinForm()) document.JoinForm.submit();
			   else return false;
			  }
				function OpenWindow( sUri, iWidth, iHeight )
				{
					var sWindowName = 'win' + Math.floor( Math.random()*1000 )
					var iRealWidth = iWidth ? iWidth : 600
					var iRealHeight = iHeight ? iHeight : screen.height - 300

					var iLeft = Math.round( (screen.width-iRealWidth)/2 )
					var iTop =  Math.round( (screen.height-iRealHeight)/2 ) - 35

					var sWindowOptions = 'status=yes,menubar=no,toolbar=no'
					sWindowOptions += ',resizable=yes,scrollbars=yes,location=no'
					sWindowOptions += ',width='  + iRealWidth
					sWindowOptions += ',height=' + iRealHeight
					sWindowOptions += ',left='   + iLeft
					sWindowOptions += ',top='    + iTop

					var oWindow = window.open( sUri, sWindowName, sWindowOptions )
					oWindow.focus()

					return oWindow
				}
