/****************************************/
/* @project: 	Klammino				*/
/* @author:		(c) 2009 by Simon Nagel */
/* @filename:	klammino.js				*/
/****************************************/


/** Navigation **/

ddaccordion.init({
	headerclass: "ausklappbar", //Shared CSS class name of headers group that are expandable
	contentclass: "kategoriepunkt", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

ddaccordion.init({ //2nd level headers initialization
	headerclass: "subausklappbar", //Shared CSS class name of sub headers group that are expandable
	contentclass: "subkategoriepunkt", //Shared CSS class name of sub contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})


/** Startseiten-Timer **/

function Timer()
{
    if(reload != -1) {
		now=new Date();
	    now=parseInt((now.getTime()/1000));
	
	    out=parseInt((reload-now)/60)+':';
	        sek=(reload-now)%60;
	        if(sek<10){out+='0';}
	        out+=sek;
	
	    document.getElementById('timer').innerHTML=""+out+"";
	
	    if ((reload-now) > -1) window.setTimeout("Timer()", 1000);
	    else
	    {
	        
	        document.getElementById('timer').innerHTML="<a class=\"green\" href=\"?content=/intern/startseite&slink=true\">Bereit</a>";
	    }
    }

}


/** Ajax-Klickbereich **/

window.onload=function()
{
	if(content=='/verdienen/klick4') {
		printFilecontent('ajax/forced_load.php','ajax_return');
	}
	if(content=='/verdienen/mailhistory') {
		printFilecontent('ajax/mailhistory_load.php','ajax_return');
	}
	if(content=='/verdienen/premium') {
		printFilecontent('ajax/premium_load.php','ajax_return');
	}
}


/** Login-Felder **/

function user_value()
{
	if(document.getElementById("userid").value=="Klamm ID") { 
		document.getElementById("userid").value=""; 
	}
}

function user_value2()
{
	if(document.getElementById("userid").value=="") { 
		document.getElementById("userid").value="Klamm ID"; 
	}
}

function pass_value()
{
	if(document.getElementById("passwort").value=="Passwort") { 
		document.getElementById("passwort").value=""; 
	}
} 

function pass_value2()
{
	if(document.getElementById("passwort").value=="") { 
		document.getElementById("passwort").value="Passwort"; 
	}
}

/** Emailadresse verschlüsseln **/

function getaddress(emr2array) {
	var enc_adr = ''
	for (var i=0; i < emr2array.length; i++){
		enc_adr += String.fromCharCode(((Number(emr2array[i])-emr2array.length)/3))
	}
	document.write('<a href="mailto:' +enc_adr+ '">'+enc_adr+'</a>')
}

/** Ladebalken mit Prozent-Anzeige **/

var zaehler = 1;
function ladebalken_load(ziel,gesamt) {
	if (zaehler < ziel) {
		zaehler = zaehler + 1;
		document.getElementById("ladebalken").style.width = zaehler + "px";
		var prozent = Math.round(zaehler/gesamt * 100);
		document.getElementById("ladebalken_prozent").innerHTML = prozent+" %";
		window.setTimeout("ladebalken_load('" + ziel + "','" + gesamt + "')", 25);
	} else {
		zaehler = 1;
	}
}
	