var activemenu = false;
var activemenuhighlight = false;
var menutimeout = false;

function showMenu(menuid, menuidhighlight) {
    if (activemenu == menuid) {
        myClearTimeout();
        return;
    }
    hideMenu();

    var menuDiv = document.getElementById(menuid);
	var menuWrapperDiv = document.getElementById(menuid + "Wrapper");
    menuWrapperDiv.className = 'subCatLinkDivOn';
    menuDiv.style.display = 'block';
    activemenu = menuid;
	
	if(menuidhighlight) {
		var menuDiv = document.getElementById(menuidhighlight);
	    menuDiv.style.display = 'block';
	    activemenuhighlight = menuidhighlight;
	}	
	
}

function mySetTimeout() {
    if (!activemenu)  return;
    menutimeout = setTimeout("hideMenu()", 350);
}

function myClearTimeout() {
    if (!menutimeout)  return;

    clearTimeout(menutimeout);
    menutimeout = false;
}

function hideMenu() {
    if (!activemenu)  return;
    myClearTimeout();

    var menuDiv = document.getElementById(activemenu);
	var menuWrapperDiv = document.getElementById(activemenu + "Wrapper");
    menuWrapperDiv.className = 'subCatLinkDiv';
    menuDiv.style.display = 'none';
	
	//****** CLEAR MENU HIGHLIGHT
	if(activemenuhighlight) {
		var menuDiv = document.getElementById(activemenuhighlight);
	    menuDiv.style.display = 'none';
	}
	
    activemenu = false;
	activemenuhighlight = false;
}

function getUrl(url){
	window.location = url;
}

function leftLinkOver(which){
	var activeDiv = document.getElementById(which.id);
	var activeLink = document.getElementById(which.id + 'Link');
	if (document.images) {
		activeDiv.className = 'leftLinkDivOn';
		activeLink.className = 'menuLinkOn';
	}
}

function leftLinkOff(which){
	var activeDiv = document.getElementById(which.id);
	var activeLink = document.getElementById(which.id + 'Link');
	if (document.images) {
		activeDiv.className = 'leftLinkDiv';
		activeLink.className = 'menuLink';
	}
}
