var KEFMenu = {
	currentItem:null,
	timeout:null,
	over:function(item){
		if(item == this.currentItem && this.timeout != null)
		{
			clearTimeout(this.timeout);
			this.timeout = null;
		}
	},
	out:function(item){
		if(item == this.currentItem)
		{
			this.timeout = setTimeout(this.closeMenu, 300);
		}
		
	},
	click:function(item){
		if(this.currentItem != null && this.currentItem != item)
		{
			this.closeMenu();
		}
		this.currentItem = item;
		$(item).addClass("hovering");
	},
	closeMenu:function(){
		if(this != KEFMenu)
		{
			KEFMenu.closeMenu();
			return;
		}
		$(this.currentItem).removeClass('hovering');
		this.currentItem = null;
		this.timeout = null;
	},
	init:function(){
		$("li.mega").click(function(){
			KEFMenu.click(this);
		});
		$("li.mega").hover(function(){
			KEFMenu.over(this);
		},function(){
			KEFMenu.out(this);
		});
	}
};
$(document).ready(function(){
	KEFMenu.init();
});

