var navTimer = false;
var currentID = false;
function topmenuClear() {
	var navRoot = document.getElementById("menu");
	for (var i=0; i<navRoot.childNodes.length; i++) {
		var node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
			node.className=node.className.replace("over", "");
			node.childNodes[0].className="";
		}
	}
	if (currentID && currentID != "") {
		document.getElementById(currentID).className = "current";
	}
}
function topmenuHover() {
	var i, j, node;
	if(document.getElementById("menu")) {
		var navRoot = document.getElementById("menu");
		for (j=0; j<navRoot.childNodes.length; j++) {
			if (navRoot.childNodes[j].className == 'current') {
				currentID = navRoot.childNodes[j].id;
			}
		}
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					clearTimeout(navTimer); topmenuClear();
					this.className=this.className.replace("fade","");
					this.className+=" over";
					this.childNodes[0].className="over";
					if (currentID && currentID != "" && currentID != this.id) {
						document.getElementById(currentID).className="current fade";
					}
				};
				node.onmouseout=function() {
					navTimer = setTimeout(topmenuClear,2000);
				};
			}
		}
	}
}
