var obj = null;

function checkHover() {
	if (obj) {
		//obj.find('ul').css("display","none");	
	} //if
} //checkHover

$(document).ready(function() {


$("'#nav  li ul").animate({
    opacity: '0'
 }, 500);
	$('#nav > li').hover(function() {
		   var n_item = $(this).find('ul.nav_sub li').length;
		   	   var h_item = 0;
			   for(var i=0;i<n_item;i++)
			   {h_item =h_item +$(this).find('ul.nav_sub li').eq(i).height();}
        $(this).find('ul.nav_sub').stop();
		$(this).addClass('hov');

		$(this).find('ul.nav_sub').css("display","block").animate({height: h_item,opacity: '80'}, 200);
	}, function() {

	        $('#nav  li ul').stop();
		$('#nav  li ul').animate({height: "0%",opacity: '0'}, 500);
		obj = $(this);
		$(this).removeClass('hov')
		setTimeout(
			checkHover(),
			1000); 
			 // si vous souhaitez retarder la disparition, c'est ici
	});
});