/*
 * menuDropdown.js - implements an dropdown menu based on a HTML list
 * Author: Dave Lindquist (http://www.gazingus.org)
 */



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; // I'm too tired

    actuator.onmouseover = function() {
        if (currentMenu == null) {
            this.showMenu();
        }
        else {
            document.getElementById('sub_navigation').innerHTML = "";
            currentMenu = null;
        }
	this.showMenu();
	
    }

    actuator.onclick = function() {}

	menu.onmouseover = function() {
	currentMenu = menu; 
	}

	actuator.onmouseout = function(){

		if (document.all) {
			
			}

		else {document.captureEvents(Event.MOUSEMOVE)
			}
		document.onmousemove = moveHandler
	}
	
		
		function moveHandler(evt) {
			if (document.all) {
				animateMenu(window.event.clientX,window.event.clientY) 
			}
			else {
				animateMenu(evt.pageX,evt.pageY)
			}
		}

		function animateMenu(xPos,yPos) {
			//try{
				if(document.getElementById('sub_navigation') && currentMenu){
					if(yPos > (eval(currentMenu.offsetHeight + 170))){
					document.getElementById('sub_navigation').innerHTML = "";
					}
				}		
			//} 
			//catch(e){animateMenu(xPos,yPos)}   
		}
			

			

    actuator.showMenu = function() {
        document.getElementById('sub_navigation').innerHTML = '<div class="submenu">'+menu.innerHTML+'</div>';
        currentMenu = menu;
    }
}    
    
        window.onload = function() {
            initializeMenu("chairmanMenu", "chairmanActuator");
            initializeMenu("ceoMenu", "ceoActuator");
            initializeMenu("divisionalMenu", "divisionalActuator");
           initializeMenu("reviewMenu", "reviewActuator");
            initializeMenu("finMenu", "finActuator"); 

        }
        
function showSub(subId){
	if(document.getElementById){
		document.getElementById(subId).style.display != "block"?document.getElementById(subId).style.display = "block":document.getElementById(subId).style.display = "none";
	}
	return false;
}        
