/*
 * menuDropdown.js - implements an dropdown menu based on a HTML list
 * Author: Dave Lindquist (http://www.gazingus.org)
 */

var currentMenu = null;
var currentSubMenu = null;

if (!document.getElementById)
    document.getElementById = function() { return null; }


function initializeMenu(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    //if (window.opera) return; // I'm too tired

    actuator.onmouseover = function() {
        if (currentMenu) { currentMenu.style.visibility = "hidden"; }
        if (currentSubMenu) { currentSubMenu.style.visibility = "hidden"; }
        this.showMenu();
    }
  
    actuator.showMenu = function() {
        menu.style.left = this.offsetLeft + "px";
        menu.style.top = this.offsetTop + this.offsetHeight + "px";
        menu.filters.revealTrans.Apply()
        menu.style.visibility = "visible";
        menu.filters.revealTrans.Play()
        currentMenu = menu;
    }
}

function initializeSubMenu(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    //if (window.opera) return; // I'm too tired

    actuator.onmouseover = function() {
        if (currentSubMenu) { currentSubMenu.style.visibility = "hidden"; }
            this.showMenu();
    }
  
    actuator.showMenu = function() {
		this.style.bgcolor = "#001";
        menu.style.left = this.offsetWidth + "px";
        menu.style.top = this.offsetTop + "px";
        menu.style.visibility = "visible";
        currentSubMenu = menu;	
    }
}

function hidemenus() {
        if (currentMenu) { currentMenu.style.visibility = "hidden"; }
        if (currentSubMenu) { currentSubMenu.style.visibility = "hidden"; }
}