var currentmenu = 0;

// Input: selectedmenu : 0, 1, 2, ... The primary menu ID
// Output: Set all items of selected menu to visible and reset previous menu to invisible
function toggleMenuOn( selectedmenu )
{
//  alert( 'toggleMenu: ' + document.getElementById( "menu_" + selectedmenu ).style.visibility );
    
    toggleMenuOff(currentmenu);
    
    var elements = document.getElementsByName( "menu_" + selectedmenu );
    for (i=0; i<elements.length; i++)
    {
        elements[i].style.visibility = 'visible';
    }
    
    currentmenu = selectedmenu;
}

// Input: selectedmenu : 0, 1, 2, ... The primary menu ID
// Output: Set all items in the selected menu to invisible
function toggleMenuOff( selectedmenu )
{
//  alert( 'toggleMenu: ' + document.getElementById( "menu_" + selectedmenu ).style.visibility );

    var elements = document.getElementsByName( "menu_" + selectedmenu );
    for (i=0; i<elements.length; i++)
    {
        elements[i].style.visibility = 'hidden';
    }
}


