window.onload = function()
{
	Menus.init();
}




Menus =
{
	totalMenus: 4,
	timer: 0,
	timeout: 400,
	currentMenu: null
}




Menus.init = function ()
{
	//alert(this.totalMenus);
	for (var i=0; i<this.totalMenus; i++)
	{
		this['menu_h'+i] = document.getElementById('menu_h'+i);
		this['menu'+i] = document.getElementById('menu'+i);
		this['menu_h'+i].i = this['menu'+i].i = i;
		


		this['menu_h'+i].onmouseover = this['menu'+i].onmouseover = function()
		{
			if (Menus.timer)
			{
				if (Menus.currentMenu != null && Menus.currentMenu != this.i) Menus.showMenu(Menus.currentMenu, 0);
				clearTimeout(Menus.timer);
				Menus.timer = 0;
			};
			Menus.showMenu(this.i, 1)
		}


		this['menu_h'+i].onmouseout = this['menu'+i].onmouseout =function()
		{
			if (Menus.timer) return;
			Menus.timer = setTimeout('Menus.showMenu('+ this.i +', 0)', Menus.timeout);
		}
		
	}
}




Menus.showMenu = function(i, show)
{
	this.currentMenu = i;
	this['menu'+i].style.display = show ? 'block' : 'none';
}