var obj = null;

function checkHover() {
	if (obj) {
		obj.find('ul').fadeOut('fast');	
	} //if
} //checkHover

$(document).ready(function() {

	if (jQuery.browser.msie){
	
		jQuery('#NavCha > li').hover(function() {
			obj1 = jQuery(this);
			obj1.stop().animate({height: '40px'},{queue: false, duration: 500, easing: 'easeOutBack'});
			obj1.find('.maintext a').animate({ marginTop: "0.05in"}, {duration: 700,specialEasing: {width: 'linear', height: 'easeOutBounce'},
				complete: function() {
					
					obj1.find('ul').css( {'margin-top': "-17px",'z-index':'5000'});
					obj1.find('ul').fadeIn('fast');
				}
			});
		}, function() {
			obj1 = jQuery(this);
			obj1.find('ul').css( {'margin-top': 0});
			obj1.find('ul').fadeOut('fast');
			obj1.find('.maintext a').animate({ marginTop: "-3px"}, {duration: 1000,specialEasing: {width: 'linear', height: 'easeOutBounce'}});
			obj1.stop().animate({height: '30px'},{queue: false,	duration: 500,easing: 'easeOutBack'});
		});
		
	}else{
	/*********************/
		jQuery('#NavCha > li').hover(function() {
		
		var obj1;
		obj1 = jQuery(this);
		var haut="-5px";
		/*jQuery.each(jQuery.browser, function(i) {
		   if(jQuery.browser.msie){
			  haut=20;
		   }else{
			  haut=20;
		   }
		 });*/
		obj1.stop().animate({height:'84px'},{queue:false, duration:600, easing: 'easeOutBounce'});
		obj1.find('.maintext a').animate({ marginTop: "0.64in"}, {duration: 250,specialEasing: {width: 'linear', height: 'easeOutBounce'}, 
			complete: function() {
				//alert('comptleted');
				obj1.find('ul').css( {'margin-top': haut});
				//obj1.find('ul.MenuCha').css( {'background': 'green'});
				//obj1.find('ul.MenuCha li').css( {'background': 'purple','margin-top': '5px'});
				obj1.find('ul').fadeIn('fast');
			},
			error:function(){
				//alert('failure');
			},
			success:function(){
				//alert('success');
			}
		});
		if (obj) {
			obj.find('ul').fadeOut('fast');
			obj = null;
		} 
		
		}, function() {
		//alert('not comptleted');
			var hautin='0.13in';
			var hauteurDiv ='42px';
			/*jQuery.each(jQuery.browser, function(i) {
			   if($.browser.msie){
				 hautin='0in';
				 hauteurDiv='54px';
			   }else{
				  hautin='0in';
			   }
			 });*/
			obj = jQuery(this);
			setTimeout("checkHover()",10); //retarder la disparition, c'est ici
			//obj1.find('ul .MenuCha').fadeOut('fast');
			obj.find('.maintext a').stop().animate({ marginTop: hautin}, {duration: 600,specialEasing: {width: 'linear', height: 'easeOutBounce'}});
			obj.stop().animate({height:hauteurDiv}, {duration: 200, specialEasing: {width: 'linear', height: 'easeOutBounce'}});
			
		});
		
		
	/*********************/
	}
	
});
