var objMainMenu = null;
var objPrevMainMenu = null;
var objPrevDropMenu = null;
var isIE = null;

function intitializeVariables()
{
    objMainMenu = null;
    objPrevMainMenu = null;
    objPrevDropMenu = null;
    isIE = null;
}

function showDropMenu(strMenu)
{
    if (navigator.appName.indexOf('Microsoft Internet Explorer') != -1) isIE=1;

    strMainMenu = 'nav' + strMenu;
    strSubMenuName = 'drop' + strMenu;

    // if user is browsing menu, set previous and current menu objects:
    if(objMainMenu != null)
    {

        // set previous main menu item:
        objPrevMainMenu = objMainMenu;

        // get the id of the previous menu item:
        strPrevMenuNumber = objPrevMainMenu.id.substring(3, objPrevMainMenu.id.length);      
    }

    // set the global main menu item:
    objMainMenu = document.getElementById(strMainMenu);
    
    // get the background object:
    var objBg = document.getElementById('subMenuBG');
    
    // get the submenu object:
	var objSubMenu = document.getElementById(strSubMenuName);

	if(objSubMenu != null)
	{
	    if(objPrevMainMenu != null)
	    {
	        hideDropMenu(strPrevMenuNumber);
	    } 

	    objBg.style.visibility = 'visible';
	    objSubMenu.style.visibility = 'visible';
	}
}

function hideDropMenu(strMenu)
{
    var objBg = document.getElementById('subMenuBG');
    strSubMenuName = 'drop' + strMenu;

    objSubMenu = document.getElementById(strSubMenuName);
    
    objSubMenu.style.visibility = 'hidden';

    objBg.style.visibility = 'hidden';
}

function hideAll()
{
    for(i=1; i<7; i++)
    {
        objSubMenu = document.getElementById('dropMenu' + i);
        
        if(objSubMenu != null)
        {
            hideDropMenu('Menu' + i);
            objSubMenu = null;
        }
    }
}