$(document).ready(function() {
						   
	$("#miniFeatures li").last().css({margin: '0'});
	
	//On Hover Over
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
		(function($) {
			//Function to calculate total width of all ul's
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() { //for each ul...
					rowWidth += $(this).width(); //Add each ul's width together
				});
			};
		})(jQuery); 
	}
	//On Hover Out
	function megaHoverOut(){
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
		  $(this).hide();  //after fading, hide it
	  });
	}
	
	//Set custom configurations
	var config = {
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		 interval: 100, // number = milliseconds for onMouseOver polling interval
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
		 timeout: 500, // number = milliseconds delay before onMouseOut
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};
	
	$("ul#nav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
	$("ul#nav li").hoverIntent(config); //Trigger Hover intent with custom configurations


	// Mini Features Hover Effects
		//On Hover Over
		function miniHoverOver(){
			$(this).find("img").stop().fadeTo('fast', 1).show(); //Find img and fade it in
		}
		//On Hover Out
		function miniHoverOut(){
			$(this).find("img").stop().fadeTo('fast', 0.7).show(); //Fade to 0 opactiy
		}
		
		$("ul#miniFeatures li h2 a img").css({'opacity':'0.7'}); //Fade sub nav to 0 opacity on default
		$("ul#miniFeatures li h2 a").hover(miniHoverOver, miniHoverOut); //Trigger Hover intent with custom configurations

});
