/*
 * menuDropdown.js - implements an dropdown menu based on a HTML list
 * Author: Dave Lindquist (http://www.gazingus.org)
 * Edited by: M. Jackson Wilkinson (http://www.jackwilkinson.com)
 */

var currentMenu = null;

if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId, retId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);
    var intro = document.getElementById("introtext");
    var ret = document.getElementById(retId);

    if (menu == null || actuator == null) return;

    //if (window.opera) return; // I'm too tired

/*    actuator.onmouseover = function() {
        if (currentMenu) {
	    currentMenu.style.display = "none";
            this.showMenu();
        }
    } */
  
    actuator.onclick = function() {
        if (currentMenu) {
	    currentMenu.style.display = "none";
            this.showMenu();
        }
        if (currentMenu == null) {
            this.showMenu();
        }
//        else {
//	    currentMenu.style.display = "none";
//	    intro.style.display = "block";
//            currentMenu = null;
//        }
        return false;
    }

    ret.onclick = function() {
	currentMenu.style.display = "none";
        intro.style.display = "block";
        currentMenu = null;
    }

    actuator.showMenu = function() {
	menu.style.display = "block";
	intro.style.display = "none";
        currentMenu = menu;
    }
}

