$(document).ready(function(){	



// sub Navigation 

//On Hover Over

function navHoverOver(){

    $(this).parent().find(".subnav").stop().fadeTo('fast', 1).show(); //Find sub and fade it in

	$(this).parent().find("#nav-work").addClass("current");

}

//On Hover Out

function navHoverOut(){

  $(this).parent().find(".subnav").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy

      $(this).hide();

	  $(this).parent().parent().find("#nav-work").removeClass("current");//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: navHoverOver, // function = onMouseOver callback (REQUIRED)

     timeout: 500, // number = milliseconds delay before onMouseOut

     out: navHoverOut // function = onMouseOut callback (REQUIRED)

};

$(".subnav").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default

$("#nav-work").hoverIntent(config); //Trigger Hover intent with custom configurations

});
