var obj = null;

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

$(document).ready(function() {
	
	//actions au survol
	$('.menutop').hover(function() {
		if (obj) {
			obj.find('ul').fadeOut('fast');
			obj = null;
		} //if
		
		$(this).find('ul').fadeIn('fast');
	}, function() {
		obj = $(this);
		setTimeout(
			"checkHover()",
			0); // si vous souhaitez retarder la disparition, c'est ici
	});
	
	//actus dans le menu
	setInterval("jQuery('.actu').animate({'opacity':0},{duration:500});jQuery('.actu').animate({'opacity':0.7},{duration:500});",1000);
	
	//on retire la marge droite pour le dernier element
	$(".menutop:last").css('padding-right','0');	
	
	$(".menutop").each(function(index) {	
		var adr = $(this).find('li a').attr('href');		
		$(this).find('a:first').attr('href',adr);
		
		var n = $(this).find('li').length;
		if(n <= 1){			
			$(this).find('li a').css('display','none');			
		}
		
	});
	
	//antispam mailto email pour les liens de classe email
	$('a.email').each(function(index) {
		
        var text = $(this).text();
		var adr = $(this).attr('href');
		
        var texte = text.replace("[at]", "@").replace("mailto:", "");
		var address = adr.replace("[at]", "@").replace("mailto:", "");
		
        $(this).attr('href', 'mailto:' + address);
        $(this).text(texte);   
		    
    });
	
});


