jMad.menu={
	 timeout:250
	,timer:0
	,item:0
	,init:function()
	{
		this.bind(null);
		$(document).click(jMad.menu.close);
	}
	,bind:function(id)
	{
		var sel="div.mad_menu";
		if(id)sel+="#"+id;
		$(sel+" > ul > li").bind("mouseenter", jMad.menu.eIn).bind("mouseleave", jMad.menu.eOut);
	}
	,eIn:function()
	{	
		jMad.menu._t0();
		jMad.menu.close();
		jMad.menu.item=$(this).addClass("open");
	}
	,eOut:function()	{jMad.menu._t1();}
	,eTimer:function()	{jMad.menu.close();}
	,close:function()
	{	
		var e=jMad.menu.item;
		if(e)
		{
			e.removeClass("open");
			jMad.menu.item=null;
		}
	}
	,_t1:function()	{ this.timer = window.setTimeout(this.eTimer, this.timeout); }
	,_t0:function()
	{
		if(this.timer)
		{
			window.clearTimeout(this.timer);
			this.timer = 0;
		}
	}
};
