var kcMenu = {
	showTimer : 0,
	resetTimer : 0,
	resetDelay : 600, // how long after rolloff will the menu reset to a normal/previous state
	fadeDelay : 300,	// how long for a newly rolled-over item to fade in its children
	showDelay: 300, // how long before a rolled over item will actually register the rollover

	init :		function (){
						kcMenu.active = $("td.nav_one a.active-trail").attr("id")
						if (kcMenu.active) kcMenu.active = kcMenu.active.split("_")[1];
						$("td.nav_one a").hover(
							function(){ kcMenu.parentIn($(this)); },
							function(){ kcMenu.bothOut(); }
						);
						$("div.nav_two").hover(
							function(){ kcMenu.kidIn($(this)); },
							function(){ kcMenu.bothOut(); }
						);						
					},

	parentIn : 	function (jqo){
						kcMenu.clear();
						$("a.nav_one").removeClass("one_over");
						kcMenu.showing = jqo.attr("id").split("_")[1];
						jqo.addClass("one_over");
						kcMenu.showTimer = setTimeout(kcMenu.showKid, kcMenu.showDelay);
					},

	bothOut : 	function (){
						kcMenu.clear();
						$("a.nav_one").removeClass("one_over");
						kcMenu.resetTimer = setTimeout(kcMenu.reset,kcMenu.resetDelay);
					},
	
	kidIn : 		function (jqo){
						kcMenu.clear();
						kcMenu.showing = jqo.attr("id").split("_")[2];
						$("a#link_"+kcMenu.showing).addClass("one_over");
					},

	showKid : 	function (){
						$("div.nav_two").hide();
						var jqo = $("div#nav_two_"+kcMenu.showing);
						jqo.fadeIn(kcMenu.fadeDelay);
					},

	reset :		function(){
						$("a.nav_one").removeClass("one_over");
						$("div.nav_two").hide();
						$("div#nav_two_"+kcMenu.active).fadeIn(kcMenu.fadeDelay);
					},

	clear :		function (){
						clearTimeout(kcMenu.showTimer);
						clearTimeout(kcMenu.resetTimer);
					},
	
	showing : 0, // int showing the item currently highlighted and whose children are display, if any
	active : 0 // int showing the active-trail selector, the page that is currently showing the browser
};

$(function(){
	kcMenu.init();
});
