// Hover Over
function showNav(){
    $(this).find(".sub").stop().fadeTo('slow', 1).show();
}
// Hover Out
function hideNav(){
  $(this).find(".sub").stop().fadeTo('slow', 0, function() {
      $(this).hide();
  });
}
$(function() {
	//Set custom configurations
	var config = {
	     sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
	     interval: 100, // number = milliseconds for onMouseOver polling interval
	     over: showNav, // function = onMouseOver callback (REQUIRED)
	     timeout: 300, // number = milliseconds delay before onMouseOut
	     out: hideNav // function = onMouseOut callback (REQUIRED)
	};
	
	$("ul#topnav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
	$("ul#topnav li").hoverIntent(config); //Trigger Hover intent with custom configurations
});
