var timerId;
var currentMenu;
var inCount = 0;

function showMenu(menuName, menuText) {
	window.status = menuText;
	toggleLayer(menuName);
	if (currentMenu != menuName) {
		if (currentMenu) {
			hideMenu_internal(currentMenu);
		}
		currentMenu = menuName;
		inCount = 0;
	}
	inCount++;
	clearTimeout(timerId);
}

function hideMenu(menuName) {
	if (currentMenu == menuName) {
		inCount--;
		if (inCount <= 0) {
			timerId = setTimeout("hideMenu_internal('" + menuName + "')", 500);
		}
	}
}

function hideMenu_internal(menuName) {
	window.status = '';
	switchOffLayer(menuName);
}

function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "block";
		style2.zindex = 9999;
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "block";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "block";
	}
}


function switchOffLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "none";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "none";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "none";
	}
}