function dropdownmenuload() {
	
	$(".categoryListItem").hover(
		function(){
			var department = $(this).text();
			switch(department){
				case "Women's":
					$(this).next(".submenuleft").css({"margin-left":"-77px"});
					break;
				case "Kids'":
					$(this).next(".submenuleft").css({"margin-left":"-171px"});
					break;
				case "Footwear":
					$(this).next(".submenuleft").css({"margin-left":"-235px"});
					break;
				case "Outdoor Gear - Hunt/Fish":
					$(this).next(".submenuright").css({"margin-left":"-331px"});
					break;
				case "Luggage":
					$(this).next(".submenuright").css({"margin-left":"-535px"});
					break;
				case "Home":
					$(this).next(".submenuright").css({"margin-left":"-623px"});
					break;
					/*
				case "Sale":
					$(this).next(".submenuright").css({"margin-left":"-694px"});
					break;
				case "レディース":
					$(this).next(".submenuleft").css({"margin-left":"-79px"});
					break;	
				case "キッズ":
					$(this).next(".submenuleft").css({"margin-left":"-192px"});
					break;
				case "アウトドア用品":
					$(this).next(".submenuright").css({"margin-left":"-272px"});
					break;
				case "トラベル用品":
					$(this).next(".submenuright").css({"margin-left":"-418px"});
					break;
				case "ホーム用品":
					$(this).next(".submenuright").css({"margin-left":"-552px"});
					break;
				case "セール":
					$(this).next(".submenuright").css({"margin-left":"-674px"});
					break;	
					*/
				default:
					$(this).next(".submenuleft").css({"margin-left":"0px"});
					break;
			}
			
		}, function(){});
	
	
	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.backgroundColor = "#708363";
			if(submenu != undefined) {
				hideSubmenu();
			}
			if(hasActiveCategory() && (this != document.getElementById("activeCategory"))) {
				document.getElementById('activeCategory').style.backgroundColor = '#82996f';
			}
			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.backgroundColor = "#708363";
						if(hasActiveCategory()) {
							if(anchor != document.getElementById("activeCategory")) {
								document.getElementById('activeCategory').style.backgroundColor = '#82996f';
							}
						}
					}
					submenu.onmouseout = function() {
						inDropDown = false;
						hideInterval = setTimeout(function(){hideSubmenu();},250);
						anchor.style.backgroundColor = "#82996f";
						if(hasActiveCategory()) {
							document.getElementById('activeCategory').style.backgroundColor = "#708363";
						}
					}
					showInterval = setTimeout(function(){showSubmenu(submenu);},250);
				}
			}
		}
		items[i].onmouseout = function() {
			oldAnchor = this;
			this.style.backgroundColor = "#82996f";
			if(hasActiveCategory()) {
				document.getElementById('activeCategory').style.backgroundColor = '#708363';
			}
			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 );

/*
$(document).ready(function(){
	if($("#hdropdownmenu ul").size() < 1){
		writeTopNav();
	}
});
*/