var currentItemSubmenu = null;

function menuInit() {
	if(window.navigator.systemLanguage && !window.navigator.language)
		hoverIE();
}

function hoverIE() {
	var LI = document.getElementById("nav").firstChild;

	do {
		if(LI.className == "nav_current") {
			if(LI.firstChild.nodeName == "A")
				LI.firstChild.style.backgroundColor = "#666666";
		}

		var UL = sucheUL(LI.firstChild);

		if(UL) {
			LI.onmouseover=einblenden;
			LI.onmouseout=ausblenden;
			UL.onmouseover=einblenden;
			UL.onmouseout=ausblenden;

			if(LI.className == "nav_current") {
				currentItemSubmenu = UL;

				var subLI = UL.firstChild;
				while(subLI) {
					if(subLI.className == "nav_current") {
						subLI.firstChild.style.backgroundColor = "#666666";
						break;
					}
					subLI = subLI.nextSibling;
				}
			}
		}

		LI = LI.nextSibling;
	} while(LI);
}

function sucheUL(UL) {
	do {
		if(UL)
			UL = UL.nextSibling;
		if(UL && UL.nodeName == "UL") {
			return UL;
		}
	} while(UL);
	return false;
}

function einblenden() {
	if(this.nodeName == "UL") {
		this.style.display = "block";
	} else {
		var UL = sucheUL(this.firstChild);
		UL.style.display = "block";
	}
}

function ausblenden() {
	if(this.nodeName == "UL")
		this.style.display = "none";
	else {
		sucheUL(this.firstChild).style.display = "none";
	}
	if(currentItemSubmenu) {
		currentItemSubmenu.style.display="block";
	}
}


