function dropdownmenuload() {
	
	var submenu;
	var anchor;
	var oldAnchor;
	var showInterval;
	var hideInterval;
	var inDropDown;
	
	var ddm = document.getElementById('hdropdownmenu');
	ddm.onmouseover = function() {
		inDropDown = true;
		clearInterval(hideInterval);
	}
	ddm.onmouseout = function() {
		inDropDown = false;
		anchor = null;
		hideInterval = setTimeout(function(){hideSubmenu();},250);
	}
	var items = document.getElementsByName('toplevelmenuitem');
	var len = items.length;
	for(var i = 0; i < len; i++) {
		items[i].onmouseover = function() {
			anchor = this;
			var tmpAnchor = anchor;
			this.style.backgroundImage='url(/indarktan.jpg)';
			if(submenu != undefined) {
				hideSubmenu();
			}
			if(hasActiveCategory() && (this != document.getElementById("activeCategory"))) {
				document.getElementById('activeCategory').style.backgroundImage='url(/intan.jpg)';
			}
			var childlen = this.parentNode.childNodes;
			for(var k = 0; k < childlen.length; k++) {
				if(childlen[k].nodeName == "UL") {
					submenu = childlen[k];
					submenu.onmouseover = function() {
						inDropDown = true;
						anchor = tmpAnchor;
						clearInterval(hideInterval);
						anchor.style.backgroundImage='url(/indarktan.jpg)';
						if(hasActiveCategory()) {
							if(anchor != document.getElementById("activeCategory")) {
								document.getElementById('activeCategory').style.backgroundImage='url(/intan.jpg)';
							}
						}
					}
					submenu.onmouseout = function() {
						inDropDown = false;
						hideInterval = setTimeout(function(){hideSubmenu();},250);
						anchor.style.backgroundImage='url(/intan.jpg)';
						if(hasActiveCategory()) {
							document.getElementById('activeCategory').style.backgroundImage='url(/indarktan.jpg)';
						}
					}
					showInterval = setTimeout(function(){showSubmenu(submenu);},250);
				}
			}
		}
		items[i].onmouseout = function() {
			oldAnchor = this;
			this.style.backgroundImage='url(/intan.jpg)';
			if(hasActiveCategory()) {
				document.getElementById('activeCategory').style.backgroundImage='url(/indarktan.jpg)';
			}
			clearInterval(showInterval);
			hideInterval = setTimeout(function(){hideSubmenu();},250);
		}
	}

	function showSubmenu(node) {
		node.style.display = "block";
		if(document.all) {
			var sf = document.getElementById("selectfix");
			sf.style.display = "block";
			sf.width = node.offsetWidth;
			sf.height = node.offsetHeight;
			sf.style.top = node.offsetTop;
			sf.style.left = node.offsetLeft;
		}
	}
	function hideSubmenu() {
		if(anchor == oldAnchor) return;
		if(inDropDown) return;
		document.getElementById("selectfix").style.display = "none";
		if(submenu) {
			submenu.style.display = "none";
		}
	}
	function hasActiveCategory() {
		return (document.getElementById("activeCategory") != undefined);
	}
}

addOnLoadEvent( dropdownmenuload );
