$(document).ready(function() {
	
  	$("#ts-ourProducts").hover(function(){
		$("#prodMenu").show();
		$("#prodMenu").stop().fadeTo(300,1);
	}, function(){
		$("#prodMenu").stop().fadeTo(300,0, function(){
			$("#prodMenu").hide();	
		});
	});
	
	$(".prodMenuItem").hover(function(){
		var $item = $(this).find(".subMenuWrap");
		
		$item.show();
		$item.find(".subMenu").stop().animate({left: 0});
	}, function(){
		var $item = $(this).find(".subMenuWrap");
		
		$item.find(".subMenu").stop().animate({left: -194}, 500, function() {
			$item.hide();
		});
	});
 
 
 
	function megaHoverOver(){
		if ($(this).find("a").hasClass("nm")){
			//do nothing
		} else{
			$(".menuShadow").show().css({"left":$(this).position().left});
			$(".menuShadow").css({"width": $(this).find(".sub").outerWidth()});
			$(this).find(".sub").stop().slideDown();
		};
				
		
	}
	
	function megaHoverOut(){ 
	  if ($(this).find("a").hasClass("nm")){
			//do nothing
		} else{
			$(this).find(".sub").slideUp(200, function(){
				$(".menuShadow").hide();	
			});
			
		};
	  
	}
 
 
	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: 100, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
 
	$("ul#topnav li .sub").css({'opacity':'1'});
	$("ul#topnav li").hoverIntent(config);
 
 
 
});
 
