var lastMenu = 0;
var myTimer = false;

function showMenu(menuId,state) {
	if (state == 1) {
		clearTimeout(myTimer);
		document.getElementById("subMenu"+menuId).style.visibility = "visible";
		if (lastMenu != menuId && lastMenu) {
			document.getElementById("subMenu"+lastMenu).style.visibility = "hidden";
		}
		lastMenu = menuId;
	}
	else if (state == 0) {
		myTimer = setTimeout(function() {hideMenu(menuId, state)},1000);
	}
}

function hideMenu(menuId,state) {
	document.getElementById("subMenu"+menuId).style.visibility = "hidden";
}

function hilite(obj,state) {
	obj.style.backgroundColor = state ? "#d0d0d0" : "";
}