
	/**
		© 2009 Алексей Забродин (drvhart@ya.ru)
	*/

	var Menu = {
		setEvent: function(obj, event, func)
		{
			if (obj.attachEvent) obj.attachEvent('on' + event, func);
			else obj.addEventListener(event, func, false);
		},
		each: function(arr, func)
		{
			for (var i = 0; i < arr.length; i++)
			{
				func.call(arr[i], i);
			}
		},
		init: function(id)
		{
			var box = document.getElementById(id);
			var ul = box.getElementsByTagName('ul');
			var li = box.getElementsByTagName('li');
			if (ul)
			{
				Menu.each(ul, function(i)
				{
					if (i)
					{
						this.style.display = 'none';
					}
				});
			}
			if (li)
			{
				Menu.each(li, function(i)
				{
					this.onmouseover = Menu.open;
				});
			}
		},
		open: function()
		{
			var list;
			if (list = this.getElementsByTagName('ul')[0])
			{
				list.style.display = 'block';
				this.onmouseout = function()
	          	{
	              	list.style.display = 'none';
	          	}
			}
		}
	};
	Menu.setEvent(window, 'load', function()
	{
		Menu.init('menu');
	});