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.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("searchMenu", "searchActuator");
	initializeMenu("newsMenu", "newsActuator");
	initializeMenu("funMenu", "funActuator");
	initializeMenu("karateMenu", "karateActuator");
	initializeMenu("carsMenu", "carsActuator");
	initializeMenu("langMenu", "langActuator");
	initializeMenu("photoMenu", "photoActuator");
}

