var isNav=false;
var isIE=false;
var DOM = (document.getElementById) ? true : false;
var isNav = (document.layers) ? true : false;
var isIE = (document.all) ? true : false;

function csuk(it) {
        if (DOM) document.getElementById(it).style.visibility = "hidden";
        if (isNav) { document.layers[it].visibility="hidden";}
}

function refi() {
        if (document.referrer== "http://www.coolcamels.de/setfood.pet" || document.referrer== "http://www.coolcamels.de/setdrink.pet") {
                self.location.href="myteve.pet#kajapia";
        }
}


 var ord= rand(1000000);
 ord=Math.random();
 ufacol=new Array();
 ufauz=new Array();

 nowx=-400;
 errin=0;

function checkAll(field) {
	if (field.length>1) {
	        for (i = 0; i < field.length; i++)
        	field[i].checked = true ;
	} else {
		field.checked=true;
	}
}

function uncheckAll(field) {
	if (field.length>1) {
	        for (i = 0; i < field.length; i++)
        	field[i].checked = false ;
	} else {
		field.checked=false;
	}
}


//fades layer out
ie5 = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);
opac2 = 100;

function fadeOut() {

	//document.write(opac2);
	if(opac2 > 0){
		opac = 0;
		opac2-=3;
		if(ie5) document.getElementById('cchu').filters.alpha.opacity = opac2;
		if(ns6) document.getElementById('cchu').style.MozOpacity = opac2/100;
		setTimeout('fadeOut()', 10);
	} else {
	        document.getElementById("cchu").style.visibility='hidden';    
	}
}

function open_cchu() {    
        document.getElementById("cchu").style.visibility='visible';   
	//fadeIn();
	setTimeout("close_cchu()",10000) 
}

function close_cchu() {    
	fadeOut();
	//alert("over");
}




function close_dailytip () {
	document.getElementById("dailytip").style.visibility='hidden';
}

function open_dailytip() {
	document.getElementById("dailytip").style.visibility='visible';
}


function getCookie(NameOfCookie) { 
	if (document.cookie.length > 0) { 
		begin = document.cookie.indexOf(NameOfCookie+"=");
		if (begin != -1) { 
			begin += NameOfCookie.length+1;
			end = document.cookie.indexOf(";", begin);
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end)); 
		}
	}
	return null;
}

function setCookie(NameOfCookie, value, expiredays) { 
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}


function delCookie (NameOfCookie) { 
	if (getCookie(NameOfCookie)) {
		document.cookie = NameOfCookie + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function rand(n) {return (Math.floor(Math.random()*n));}

function loadImages(){

images=["mh_02_02","mh_04_02","mh_04_02_mail","mh_06_02","mh_08_02","mh_10_02","mh_12_02","mh_14_02","mh_ext_02","gaming"];
        for (i=0;i<images.length;i++)
        {
                eval("inamenu"+i+" = new Image()");
                eval("inamenu"+i+".src= '/img_des/" + images[i]+".gif'");

                eval("aktmenu"+i+" = new Image()");   
                eval("aktmenu"+i+".src= '/img_des/" + images[i]+"_a.gif'");

        }
}

function xchg(no,e) {
 
        gu ="inamenu";  
        if (e=="a") gu="aktmenu";
 
        //alert(eval(gu+no+".src"));
        eval("document.menu"+no+".src= "+gu+no+".src");
}




// Timeout
        
function alert2(alhtml) {
        document.getElementById('errorbox').innerHTML=alhtml;
        bringerror();
        return false;
}


function bringerror() {
        errin=1;
        if(Math.abs(targetx-nowx) > 5) {
                nowx=Math.floor((nowx*3+targetx)/4);
                document.getElementById('errorbox').style.left=nowx+'px';
		    document.getElementById('errorbox').style.top=(document.body.scrollTop<350)?(Math.floor(350+document.body.scrollTop*document.body.scrollTop/784)):(document.body.scrollTop+100)
                setTimeout('bringerror()',10);
        }
}

function ikalert() {
        window.focus();
        alert2('{{IDOKORLAT_1}} <A HREF="javascript:window.location.reload()" STYLE="color:#FF0000">{{IDOKORLAT_2}}</A> {{IDOKORLAT_3}}');
        setTimeout("location='/logout.pet'",1000*60*2);
}
        
 
setTimeout('errinit()',1000);
        
 
function errinit() {
        if(!document.body) {setTimeout('errinit()',1000);} else {
                cntaw();
                document.body.onresize=cntaw;
                // document.body.onscroll=schnd;
        }
}
        
function cntaw() {   
        if(document.all){aw = document.body.clientWidth;} else {aw = innerWidth;}
        targetx=Math.floor((aw-400)/2);
        if(errin==1) {bringerror();}
}
        


