$(document).ready(function() {
$("ul#topnav li.top").hoverIntent({
     sensitivity: 9, // number = sensitivity threshold (must be 1 or higher)
     interval: 200, // number = milliseconds for onMouseOver polling interval
     timeout: 200, // number = milliseconds delay before onMouseOut
     over: expand,
     out: collapse
});

function expand(){ //Hover over event on list item
        $(this).find('ul.subhead').stop().animate({height:'toggle'},{queue:true, duration:200,easing: 'easeOutSine'});
        $(this).find('ul.subhead li').animate({height:'toggle'},{queue:true, duration:200,easing: 'easeInSine'})
        }

function collapse() { //on hover out...
	$(this).find('.subhead').stop().animate({height:'toggle'},{queue:true, duration:100,easing: 'easeInSine'}); //Hide the subnav
        $(this).find('ul.subhead li').animate({opacity:'toggle'},{queue:true, duration:100,easing: 'easeInSine'});
        //$(this).find('.subcategory').css({'width':'0','display':'none'})
        }

$("ul#topnav li.top").hover(
    function(){
        $(this).css({'background-color':'#dedbd4'})
        $(this).find('a.head').css({'color' : '#52453e'});
    },
    function(){
        $(this).css({'background':'none'});
        $(this).find('a.head').css({'color' : '#b4b4b4'})
        }
)

$("ul#topnav li ul.subhead li a").hover(
    function(){
        $(this).nextAll('.subcategory').animate({'width': '250px'});
        //$(this).css({'text-decoration':'underline'})
        } ,
    function() {
        //$(this).css({'text-decoration':'none'});
});
})