/* Auslesen des UserAgent und Konvertierung in Kleinbuchstaben
-------------------------------------------------------------*/
var uAgent 		= navigator.userAgent.toLowerCase();

/* Auslesen der AppVersion
-------------------------------------------------------------*/
var vNumber 	= parseInt(navigator.appVersion);
var vNumber2 	= parseFloat(navigator.appVersion);


var counter = 0;
var counterclose;
var Flag = true;

function OpenMenu(trg,size,wo) {
if (Flag == true) {
	
	NewUrl(wo);
	
	checkNode = trg.parentNode.nextSibling;
	//	Bugfix IE Sibling-Bug
	if (checkNode.nodeType == 3) {
		checkNode = checkNode.nextSibling;
	}

	if (checkNode.id != "active" && checkNode.id != "subactive" ) {
		ToOpen = checkNode;

		if (ToOpen.childNodes[0].tagName == "DL") {
	 		ToOpen.childNodes[0].style.display = "block";
 		} else {
 			ToOpen.childNodes[1].style.display = "block";
		}

		if (trg.parentNode.parentNode.className == "secondlevel") {
			HTarget = "subactive";
		} else {
			HTarget = "active";
			if (document.getElementById("subactive")) {
				document.getElementById("subactive").style.display = "none";
			}
		}
		
		ToClose = document.getElementById(HTarget);
		
		if (document.all && !window.opera) {
			ToClose.style.overflow = "hidden";
			ToOpen.style.overflow = "hidden";
		}
		
		//	Bugfix IE Sibling-Bug		
		//	
		if (ToClose.firstChild.tagName == "DL") {
			ToClose.firstChild.style.display = "none";
		} else if (ToClose.firstChild.nextSibling.tagName == "DL") {
			ToClose.firstChild.nextSibling.style.display = "none";
		}
		
		//	Bugfix IE Sibling-Bug
		//	Die Kreuze werden auf sicht-/unsichtbar gesetzt
		if (ToOpen.previousSibling.nodeType == 3) {
			ToOpen.previousSibling.previousSibling.style.backgroundPosition = "-20px -20px";
			ToClose.previousSibling.previousSibling.style.backgroundPosition = "98% 50%";
		} else {
			ToOpen.previousSibling.style.backgroundPosition = "-20px -20px";
			ToClose.previousSibling.style.backgroundPosition = "98% 50%";
		}
		
		//	Die zu šffnenden DD wird vorsorglich auf 0 gestellt
		ToOpen.style.height = "0";
		ToOpen.style.padding = "0";
		ToOpen.style.margin = "0";
		ToOpen.style.display = "block";


		//	Bugfix IE Sibling-Bug
		//	Positionieren der Child-DL
		if (ToOpen.firstChild.nodeType == 3) {
			/*if (uAgent.indexOf("netscape/")) {
				ToOpen.firstChild.nextSibling.style.display = "none";
			}*/
			ToOpen.firstChild.nextSibling.style.left = "52%";
			ToOpen.firstChild.nextSibling.style.position = "absolute";
			ToOpen.style.overflow = "auto";
		} else {
			ToOpen.firstChild.style.position = "absolute";	
			ToOpen.firstChild.style.left = "52%";
			if ((vNumber >= 4) && (uAgent.indexOf("msie 5.") != -1)) {
				ToOpen.firstChild.style.display = "none";
				ToOpen.style.overflow = "hidden";
			}
		}
		
		if (Flag == true) {
			Flag = false;
			counter = 0;
			if (HTarget == "subactive") {
				counterclose = size;
			} else {
				counterclose = size;
			}
			openit = window.setInterval("OpenChart(ToOpen,ToClose,HTarget)", 50);
		}
	}
}
}

function OpenChart(trg,tcl,ntrg) {
	if (counterclose>0 && !window.opera) {
		counter += 2;
		counterclose -= 2;
		tcl.style.height = counterclose + "em";
		trg.style.height = counter + "em";
/*
		if (document.all && !window.opera) {
			tmp = true;
		} else { 
			trg.firstChild.nextSibling.style.height = counter + "em";
		}
*/
	} else {
		trg.id = ntrg;
		tcl.id = "";
		tcl.style.display = "none";
		tcl.style.height = "0em";
		trg.style.height = counter+ "em";
		
		if (document.all && !window.opera) {
			trg.style.overflow = "auto";
			if ((vNumber >= 4) && (uAgent.indexOf("msie 5.") != -1)) {
				if (ntrg!="subactive") {
					trg.style.overflow = "visible";
				} else {
					trg.style.overflow = "auto";
					trg.style.padding = "0.75em 0 0 0";
				}
				trg.firstChild.style.display = "block";
			}
		}

		if (window.opera) {
			if (ntrg!="subactive") {
				trg.style.overflow = "visible";
			} else {
				trg.style.overflow = "auto";
			}
		}
		
		/*
		if (uAgent.indexOf("netscape/")) {
			trg.firstChild.nextSibling.style.display = "block";
			trg.firstChild.nextSibling.style.position = "absolute";
		} 
		*/
		
		window.clearInterval(openit);
		Flag = true;
	}
}

function ShowElementsForIE() {
	document.getElementById("picture").style.height = document.getElementById("firstlevel").offsetHeight + "px";
	if (document.all && !window.opera) {
		document.getElementById("active").style.overflow = "visible";
	}
}

function resizeLayout() {
	wx = document.body.offsetWidth;
	wy = document.body.offsetHeight;
	if (wx <= 790) {
		document.getElementById("wrapper").style.width = "70em";
		document.getElementById("wrapper").style.margin = "0 0 0 -35em";
	} else {
		document.getElementById("wrapper").style.width = "90em";
		document.getElementById("wrapper").style.margin = "0 0 0 -45em";
	}
}

function OpenPage(select) {
	var val = select.options[select.options.selectedIndex].value;
	window.location.href = val;
}

function PrintPage() {
	window.print();
}

function TextSize(dir) {
	var allbodies = document.getElementsByTagName("BODY");
	for (i=0;i<allbodies.length;i++) {
		allbodies[i].style.fontSize = dir +"%";
	}
}

function ShowForm() {
	document.getElementById("mailer").style.display = "block";
}

function HideForm() {
	document.getElementById("mailer").style.display = "none";
}

function NewUrl(wo) {
	document.forms["send"].elements["wo"].value = wo;
	tmp = document.URL.indexOf("?");
	var part = document.URL.substring(0, tmp);
	var newurl = part+"?wo="+wo;
	document.getElementById("url").innerHTML = newurl;
}

function NewUrlLoad(wo) {
	tmp = document.URL.indexOf("?");
	var part = document.URL.substring(0, tmp);
	var newurl = part+"?wo="+wo;
	document.getElementById("url").innerHTML = newurl;
}