// version of mainmenu script to work-around the select element z-index bug.
// this fix is specific to the select element #jobsdropdown which is used on the hp.
// it toggles visibility of the select element when a menu is toggled.

var currentMenu = null;

function hideJobsDropDownIE() {
if(document.getElementById("jobsdropdown")) {
	document.getElementById("jobsdropdown").style.visibility = "hidden";
	}
}

function showJobsDropDownIE() {
if(document.getElementById("jobsdropdown")) {
	document.getElementById("jobsdropdown").style.visibility = "visible";
	}
}

function setMenuHider() {
	var links = document.getElementsByTagName("A");
	for(var i=0; i<links.length; i++) {
		if(links[i].parentNode.parentNode.className != "menu" && links[i].className != "actuator") {
			links[i].onfocus = function() {
				if (currentMenu) {
					currentMenu.style.visibility = "hidden";
					currentMenu = null;
				}
			};
		}
	}
}

window.document.onmouseover= function(e) {
	var currNode ;
	if(window.event) {
		currNode=window.event.srcElement ;
	}
	if(e) {
		currNode=e.target;
	}
	while(currNode && currNode !=document.getElementById("mainMenu")) {
		currNode=currNode.parentNode ;
	}
        	if (currentMenu && !currNode) {
		currentMenu.style.visibility = "hidden";
		currentMenu = null;
		showJobsDropDownIE() ;
	}
};

if (!document.getElementById) {
	document.getElementById = function() {
		return null;
	};
}

function initializeMenu(menuId, actuatorId) {
	var menu = document.getElementById(menuId);
	var actuator = document.getElementById(actuatorId);
	if (menu == null || actuator == null) {
		// alert(menuId +" or "+actuatorId+ "not found") ;
		return;
	}
	actuator.onmouseover = function() {
		if (currentMenu) {
			currentMenu.style.visibility = "hidden";
		}
		this.showMenu();
	};

	actuator.onfocus = actuator.onmouseover;
	actuator.showMenu = function() {
		menu.style.left = this.offsetLeft + "px";
		menu.style.top = this.offsetTop + this.offsetHeight + "px";
		menu.style.visibility = "visible";
		currentMenu = menu;
		hideJobsDropDownIE() ;
	};
}