// Used to keep track of which menu is currently expanded
var menu_expanded = '';

function showHide(id)
{
    var obj = document.getElementById(id);
    
    if(!obj) return false;
    
    var status = obj.className;

    if (status == 'hide') {
        if (menu_expanded != '' && document.getElementById(menu_expanded)) {
            var last_obj = document.getElementById(menu_expanded);
            last_obj.className = 'hide';
        }

        obj.className = 'show';
        menu_expanded = id;
        
    } else {
        obj.className = 'hide';
    }
}

// Initialise menu and show any menu that is set for expanding in menu_expanded var
function menuInit() {
        showHide(menu_expanded);
}


//--- Make sure menu loads but doesn't interfere with other onload scripts ---//
var oldonload = window.onload;
if (typeof window.onload != 'function') {
    window.onload = menuInit;
} else {
    window.onload = function() {
        if (oldonload) {
            oldonload();
        }
        menuInit();
    }
}

