////////////////////////////////////////////////////////////////////////////////
// menu.js -- JavaScript API for the drop down menu in the navigation toolbar
////////////////////////////////////////////////////////////////////////////////

// initialize the menu after the page is loaded
window.onload = initializeMenu;

////////////////////////////////////////////////////////////////////////////////
// initializeMenu() -- initializes the menu if possible

function initializeMenu() {
    if (!document.getElementById || !document.getElementsByTagName) {
        return false;
    }

    var menus = document.getElementById('navigation').getElementsByTagName('div');

    for (var i = 0; i < menus.length; i++) {
        var menu = menus[i];

        if (menu.getElementsByTagName('ul').length != 0) {
            menu.onmouseover = showDropDownMenu;
            menu.onfocus = showDropDownMenu;

            menu.onmouseout = hideDropDownMenu;
            menu.onblur = hideDropDownMenu;
        }
    }
}

////////////////////////////////////////////////////////////////////////////////
// showDropDownMenu() -- shows a drop down menu

function showDropDownMenu() {
    this.getElementsByTagName('ul')[0].style.display = 'block';
}

////////////////////////////////////////////////////////////////////////////////
// hideDropDownMenu() -- hides a drop down menu

function hideDropDownMenu() {
    this.getElementsByTagName('ul')[0].style.display = 'none';
}

////////////////////////////////////////////////////////////////////////////////
// menu.js -- end of script
