/*
 * menuDropdown.js - implements an dropdown menu based on a HTML list
 * Author: Dave Lindquist (http://www.gazingus.org)
 * Modified by Andrew Cutler, PAG www.pag.com.au.
 */

var currentMenu = null;

if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    actuator.onmouseover = function() {
        if (currentMenu != null) {
            currentMenu.style.visibility = "hidden";
            currentMenu = null;
        }
        if (menu != null) {
            this.showMenu();
        }
    }

    actuator.showMenu = function() {
        menu.style.left = this.offsetLeft + "px";
        menu.style.top = this.offsetTop + this.offsetHeight + "px";
        menu.style.visibility = "visible";
        currentMenu = menu;
    }
    
}
