/* function menu(obj){
	if (!obj.length) return;
	$(obj).find("ul").css({display: "none"});
	$(obj).hover(function(){
		$(this).find('ul').slideDown(300);
	},function(){
		$(this).find('ul').slideUp(300);
	});
}

$(document).ready(function(){
	menu($("#topnav li"));
});*/
/*$(document).ready(function() {
	$("#topnav li").hover(function() {
		$(this).children().stop().slideDown(300);
	}, function() {
		$(this).children().stop().slideUp(300);
	});
});*/
$(document).ready(function() {
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
		}
	//On Hover Out
	function megaHoverOut(){
	 /* $(this).find(".sub").stop().fadeTo('fast', 0, function()*/
	   $(this).find(".sub").stop().slideUp(300,function() { //Fade to 0 opactiy
		  $(this).hide();  //after fading, hide it
	  });
	}
	var config = {
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		 interval: 50, // number = milliseconds for onMouseOver polling interval
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
		 timeout: 300, // number = milliseconds delay before onMouseOut
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};
	
	$("ul#topnav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
	$("ul#topnav li").hoverIntent(config);
});
