function MM_swapImgRestore() {
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() {
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//FLASH FUNKTIONEN
var estop = 0;

function Bigflash() { 
	//alert("Bigflash");
	MM_goToURL('hiddentrack','fileadmin/hiddentrack.php?hires=Servtec+Video');

   //die anderen flash am Apfel weg
	var ver = navigator.appVersion;
	if (ver.indexOf("Mac")!=-1) {
		var flash1 = MM_findObj('crossflash')
		flash1.style.display = 'none';
		flash1.style.visibility = 'hidden';
		var flash2 = MM_findObj('TEASER')
		flash2.style.display = 'none';			
		flash2.style.visibility = 'hidden';
//		alert('ich bin eine Apfelkiste und nerfe!');
	} 
	cr_counter1 = 1;
	estop = 0;	
	var obj = MM_findObj('bigblack_layer')
	obj.style.display = 'block';			
	var obj1 = MM_findObj('bigflash_layer')
	obj1.style.display = 'block';	
	var obj2 = MM_findObj('ie_close');
	obj2.style.display = 'block';	
	zaehler();
	
}

function closeMedia() { 
	//alert("closeMedia");
	estop = 1;
	window.document.bigplayer.stopMedia();
	//die anderen flash am Apfel wieder herstellen
	var ver = navigator.appVersion;
	if (ver.indexOf("Mac")!=-1) {
		var flash1 = MM_findObj('crossflash')
		flash1.style.display = 'block';			
		flash1.style.visibility = 'visible';
		var flash2 = MM_findObj('TEASER')
		flash2.style.display = 'block';	
		flash2.style.visibility = 'visible';
//		alert('MAC nerf net!');
	}  
	
	var obj = MM_findObj('bigblack_layer')
	obj.style.display = 'none';			
	var obj1 = MM_findObj('bigflash_layer')
	obj1.style.display = 'none';			
	var obj2 = MM_findObj('ie_close')
	obj2.style.display = 'none';	
	
}
function cuFlash() { 
	//alert("cuFlash");
	//wenn ka Apfel dann schlie�en
	var ver = navigator.appVersion;
	if (ver.indexOf("Mac")!=-1) {
	}else{
		closeMedia();	
	}
}

function zaehler() {
	//alert(estop);	
	if (cr_counter1 > 0) {
		cr_counter1 --;
		setTimeout("zaehler()",3000);
	} else {
		if(estop<1){
			window.document.bigplayer.playMedia();
		}
	}
}

//News / Events umsschalten

function switchNE(was){
	if(was=='n'){
		var obj = MM_findObj('newslayer')
		obj.style.display = '';			
		var obj1 = MM_findObj('eventlayer')
		obj1.style.display = 'none';			
	}else{
		var obj = MM_findObj('newslayer')
		obj.style.display = 'none';			
		var obj1 = MM_findObj('eventlayer')
		obj1.style.display = '';			
	}
}

var checkhide = 0;

function cr_show(id){
	var obj = MM_findObj(id)
	obj.style.display = '';			
}

function cr_hide(id,sofort){
	if(sofort>0 || checkhide==1){
		var obj = MM_findObj(id)
		obj.style.display = 'none';			
	}
}
function cr_hide1(id){
	checkhide = 1	
	setTimeout("cr_hide(\""+id+"\",0)",200);
}
function cr_stay(){
	checkhide = 0	
}

function newCaptcha() {
	var zeit = new Date();   
	document.getElementById("captcha-img").src = "fileadmin/inc/class.captcha.php?" + zeit.getMilliseconds();
}

var rodeo = 0;
function cr_messe_rodeo(){
	var i=0;
	while ($("messe_"+i)){
		$("messe_"+i).style.display = 'none';
		i++;
	}
	//$("messe_"+rodeo).style.display = '';
	Effect.Appear("messe_"+rodeo, { duration: 1 });	
	rodeo++;
	if($("messe_"+rodeo)){
		setTimeout("cr_messe_rodeo()",4000);
	}else{
		if(rodeo>1)	{
			rodeo=0;	
			setTimeout("cr_messe_rodeo()",4000);
		}
	}
}


function setcookie(name, value, days, path, domain, secure) { 
	var expires = -1; 
	if(typeof days == "number" && days >= 0) {
		var d = new Date(); d.setTime(d.getTime()+(days*24*60*60*1000)); expires = d.toGMTString(); 
	} 
	value = escape(value); 
	document.cookie = name + "=" + value + ";" + (expires != -1 ? " expires=" + expires + ";" : "") + (path ? "path=" + path : "") + (			domain ? "; domain=" + domain : "") + (secure ? "; secure" : ""); 
}

function delcookie(name) { setcookie(name, "-", 0); }
function getcookie(name) { 
	var idx = document.cookie.indexOf(name+'='); 
	if(idx == -1) { 
		return null; 
	} 
	value = document.cookie.substring(idx+name.length+1); 
	var end = value.indexOf(';'); 
	if(end == -1) { 
		end = value.length; 
	} 
	
	value = value.substring(0, end); 
	value = unescape(value); return value; 
}

function setFontSize(fs) {
	document.body.style.fontSize=fs+"px";
	document.body.style.lineHeight=((fs*1)+5)+"px";
	
	//changeClassProperties(fs);
	
	var obj = document.getElementsByTagName("td");
						
	for (var i=0; i<obj.length; i++) {
		with ( obj[i] ) {
			style.fontSize= fs+"px";
			style.lineHeight=  ((fs*1)+5)+"px";							}
	}
	
	setcookie('cr_font_size', fs, 365, '/');
	try {
		resizeContent('font');
	}catch(e){
	}
}

function setFontSizeLoad(fs) {
	document.body.style.fontSize=fs+"px";
	document.body.style.lineHeight=((fs*1)+5)+"px";
	changeClassProperties(fs);
	setcookie('cr_font_size', fs, 365, '/');
	try {
		//resizeContent();
	}catch(e){
	}
}
function loadFontSize() {
	//alert('cookie: '+getcookie('oeci_font_size'));
	if(getcookie('cr_font_size')){ setFontSize(getcookie('cr_font_size')); }	
}
