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);

	
    if (menu == null || actuator == null) return;

    //if (window.opera) return;
	actuator.onmouseover = function() {
		if (currentMenu == null) {
		this.className = "selected";
		this.showMenu();
		}
		else if(currentMenu) {
		this.className = "selected";
		currentMenu.style.visibility = "hidden";
		this.showMenu();
		}
		a=0;
		return false;
	}
  
	actuator.onmouseout = function() {
		actuator.className = "actuator";
		a=1;setTimeout('if(a==1){currentMenu.style.visibility = "hidden"};',150);
	}
	
	menu.onmouseover = function(){
		a=0;
		actuator.className = "selected";
	}
	
	menu.onmouseout = function() {
		a=1;
		actuator.className = "actuator";
		setTimeout('if(a==1){currentMenu.style.visibility = "hidden"};',150);
	}

    actuator.showMenu = function() {
        menu.style.left = this.offsetLeft + "px";
        menu.style.top = this.offsetTop + this.offsetHeight + "px";
        menu.style.visibility = "visible";
		currentMenu = menu;
    }
}

window.onload = function() {
	initializeMenu("overviewMenu", "overviewActuator");
	initializeMenu("academicsMenu", "academicsActuator");
	initializeMenu("researchMenu", "researchActuator");
	initializeMenu("careersMenu", "careersActuator");
	initializeMenu("peopleMenu", "peopleActuator");
	initializeMenu("contactMenu", "contactActuator");
}

