var currentMenu = null;
var currentActuator = null;

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

function initializeMenu(menuId, actuatorId) {
	var browser  = navigator.appName;
	var thisframe = document.getElementById("frame");
	var thisbanner = document.getElementById("banner");
	var thismainarea = document.getElementById("mainarea");
	var menu = document.getElementById(menuId);
	var actuator = document.getElementById(actuatorId);
	
	if (menu == null || actuator == null) {
		return;
	}
	
	actuator.onmouseover = function() {
		if (currentMenu == null) {
			this.showMenu();
		} else {
			currentMenu.style.visibility = "hidden";
			this.showMenu();
		}
	}
	
	thisbanner.onmouseover = function() {
		if (currentMenu != null) {
			currentMenu.style.visibility = "hidden";
			currentMenu = null;
			currentActuator = null;
		}
	}
	
	thismainarea.onmouseover = function() {
		if (currentMenu != null) {
			currentMenu.style.visibility = "hidden";
			currentMenu = null;
			currentActuator = null;
		}
	}
	
	actuator.showMenu = function() {
		if (browser.indexOf("Internet Explorer") != -1) {
			menu.style.left = (thisframe.offsetLeft + this.offsetLeft) + "px";
		} else {
			menu.style.left = this.offsetLeft + "px";
		}
		menu.style.top = (this.offsetTop + this.offsetHeight) + "px";
		menu.style.visibility = "visible";
		currentMenu = menu;
		currentActuator = actuator;
	}
	
}

function initializeOffswitch(actuatorId) {
	var actuator = document.getElementById(actuatorId);
	
	if (actuator == null) {
		return;
	}
	
	actuator.onmouseover = function() {
		if (currentMenu != null) {
			currentMenu.style.visibility = "hidden";
			currentMenu = null;
			currentActuator = null;
		}
	}

	
}



