var cssmenuids = ["nav_main_list"]	// Enter id(s) of CSS Horizontal UL menus, separated by commas
var currentElement = false;			// Contains the object the mouse is over
var timer;							// Holds timer obj		
var timecount = 100;				// How long sub menus should stay up

HorMenu = function() {
	for (var j=0; j < cssmenuids.length; j++) {
		if (document.getElementById(cssmenuids[j]))	{
			var navRoot = document.getElementById(cssmenuids[j]);
			lis = navRoot.childNodes;
			for (i=0; i < lis.length; i++) {
				if (lis[i].nodeName == "LI") {
					li = lis[i];
					if(li.getElementsByTagName("UL").length > 0) {
						li.onmouseover = function() {
							clearTimeout(timer);
							if(currentElement) {
								openList = currentElement.getElementsByTagName("UL")[0];
								HorMenuClose(openList);
							}
							subMenu = this.getElementsByTagName("UL")[0];
							HorMenuOpen(subMenu);
							currentElement = this;
						}
						li.onmouseout = function() {
							subMenu = this.getElementsByTagName("UL")[0];
							timer = setTimeout('HorMenuClose(subMenu)', timecount);
						}
					}
				}
			}
		}
	}
}

HorMenuOpen = function(menu) {
	menu.parentNode.style.zIndex = 100;
	menu.style.visibility = "visible";
	menu.style.zIndex = 10;
}

HorMenuClose = function(menu) {
	menu.parentNode.style.zIndex = 10;
	menu.style.visibility = "hidden";
	menu.style.zIndex = 100;
}

if (window.addEventListener)
	window.addEventListener("load", HorMenu, false)
else if (window.attachEvent)
	window.attachEvent("onload", HorMenu)
