
var onLoadFunctionList = [];
var onUnloadFunctionList = [];
/* registriert eine Funktion, die bei document.onload ausgeführt werden soll */
function registerOnLoadFunction (refFunction) {
	onLoadFunctionList.push(refFunction);
}
function registerOnUnloadFunction (refFunction) {
	onUnloadFunctionList.push(refFunction);
}

/* führt alle registrierten Funktionen bei document.onload aus */
function startOnLoadFunctions () {
	for (var i=0; i<onLoadFunctionList.length;i++) {
		onLoadFunctionList[i]();
	}
}
function startOnUnloadFunctions () {
	for (var i=0; i<onUnloadFunctionList.length;i++) {
		onUnloadFunctionList[i]();
	}
}



var active = '';
var subactive = '';
var timer;
function showlayer(wert){ // alert("HUHU" + wert);
    if(wert == 0) return; // sofortiges Aussteigen auf der Homepage
    if(active != ''){
	hidelayer(active,false);
	document.getElementById('nav' + wert).className = 'on';
	active = wert;
    } else {
	document.getElementById('nav' + wert).className = 'on';
	active = wert;
    }
}
function hidelayer(wert,istimed){
    clearTimeout(timer);
    if(wert && wert != 0){
        document.getElementById('nav' + wert).className = '';
    }
    active = '';
    if(istimed){
	showclickedlayer();
    }
    if(subactive != ''){
	hidesublayer(subactive);
    }
}
function settimer(number){ 
	clearTimeout(timer);
        // timer = setTimeout("hidelayer('" + active + "',true)", 1000);
        timer = setTimeout("showlayer(" + number + ")", 1000);
}
function highlight(sub, subsub){
	document.getElementById('nav' + sub + 'sub' + subsub).className = 'on';
}
function showclickedlayer(){
    try{
	if(clickedlayer.length > 0){
	    if(clickedlayer.length == 1){
		showlayer(clickedlayer);
		active = clickedlayer;
	    } else { 
		var clicked = new Array();
		clicked = clickedlayer.split(',');
		showlayer(clicked[0]);
		highlight(clicked[0], clicked[1]);
		active = clicked[0];
	    }
	}
    } catch(e){}
}

var wmtt = null;
function showhelp(element,id){
    wmtt = document.getElementById("help" + id);
    document.onmousemove = update;
    wmtt.style.display = "block";
}

function hidehelp(elm,id){
    document.onmousemove = null;
    document.getElementById("help" + id).style.display = "none";
}

/* IE Version checken */
var useragent = navigator.userAgent;
var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(useragent) != null)
var ieversion = parseFloat( RegExp.$1 );

function update(e) {
    if (typeof window.pageYOffset != 'undefined') {
	x = (document.all) ? window.event.x + window.pageXOffset : e.pageX;
	y = (document.all) ? window.event.y + window.pageYOffset  : e.pageY;
    }
    else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat' && ieversion != '8') {
	x = (document.all) ? window.event.x + document.documentElement.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.documentElement.scrollTop  : e.pageY;
    }
    else if (typeof document.body != 'undefined') {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
    }
    if (wmtt != null) {
	wmtt.style.left = (x+10) + "px";
	wmtt.style.top 	= (y+10) + "px";
    }
}

