$(document).ready(initPage);

function initPage()
{
	ensureSize();	
	showPublicite();
}

$(window).resize(function()
{
	defer_ads();
});

/*
Bug sur Iphone => Si l'utilisateur scroll avant le chargement de la page, les pubs se placent sur le viewport au lieu de la window
$(window).scroll(function()
{
	defer_ads();
});*/

function secureTextarea(){
    $('textarea[maxlength]').keyup(
		function() {
        	var max = parseInt($(this).attr('maxlength'));
	        if ($(this).val().length > max) 
			{
	            $(this).val($(this).val().substr(0, $(this).attr('maxlength')));
        	}
	    }
		);
}

function ensureSize()
{
	c1Height = $("#majojColumn1").height();
	c2Height = $("#majorColumn2").height();
	if (c1Height<c2Height)
		$("#majojColumn1").height($("#majorColumn2").height());
}

function goFakeLink()
{
	if ($(this).children("a.fakeLink").attr("target"))
	{
		if ($(this).children("a.fakeLink").attr("target")=="_blank" || $(this).children("a.fakeLink").attr("target")=="blank")
		{
			window.open($(this).children("a.fakeLink").attr("href"));
		}else{
			document.location = $(this).children("a.fakeLink").attr("href");
		}
	}else{
		document.location = $(this).children("a.fakeLink").attr("href");
	}
}

function goToDos()
{
	document.location = $("#dosLink"+curDos).attr("href");
}

function switchTab()
{
	id = $(this).attr("id").split("_")[1];
	
	friendTabs = $(this).parent().children("a.tab");
	
	friendTabs.removeClass("selected");
	$(this).addClass("selected");
	
	for (f=0;f<friendTabs.length;f++)
	{
		inid = $(friendTabs[f]).attr("id").split("_")[1];
		$("#"+inid).css("display", "none");
	}
	
	$("#"+id).css("display", "block");
	
	return false;
}

// Fonction qui lance une popup Facebook pour se connecter ou s'inscrire
function lancer_connexion_facebook()
{
	FB.login(function(){},{scope:'email,user_birthday,publish_stream'});
}

function swapVideoZap()
{
	shouldMoveLeft = $(this).attr("id")=="vzArrowLeft";
	if (shouldMoveLeft && curVideo-1 >= 0)
		curVideo --;
	else
	if (!shouldMoveLeft && curVideo+1 < $(".videoOverlayBig").length)
	{
		curVideo++;
	}

	pos = curVideo * 66;
	$("#vzBigImgTitle a").empty();
	$("#vzBigImgTitle a").attr("href",$("#videoOverlayBig"+(curVideo+1)+" a").attr("href"));
	$("#vzBigImgTitle a").append($("#videoOverlayBig"+(curVideo+1)).attr("title"));
	$("#vzCursor").animate({"left":pos-2}, 200);
	/*APO - Chargement des images de video zap en asynchrone*/
	$("#zvBigImage").attr("src",$("#thumb_"+curVideo).children('img').attr("src").replace("w80","w250"));
	$(".videoOverlayBig").css("display","none");
	$("#videoOverlayBig"+(curVideo+1)).css("display","block");
	return false;
}

function jumpVideoZap()
{
	id = $(this).attr("id").split("_")[1];
	
	curVideo = parseInt(id);
	
	pos = curVideo * 66;
	$("#vzCursor").animate({"left":pos-2}, 200);
	$("#vzBigImgTitle a").empty();
	$("#vzBigImgTitle a").attr("href",$("#videoOverlayBig"+(curVideo+1)+" a").attr("href"));
	$("#vzBigImgTitle a").append($("#videoOverlayBig"+(curVideo+1)).attr("title"));
	/*APO - Chargement des images de video zap en asynchrone*/
	$("#zvBigImage").attr("src",$("#thumb_"+curVideo).children('img').attr("src").replace("w80","w250"));
	$(".videoOverlayBig").css("display","none");
	$("#videoOverlayBig"+(curVideo+1)).css("display","block");
}


function fade()
{
	fadeTime = 100;
	items = $("#footerNewsPage"+curFooterPage+" .footerNewsItem");
	
	switch(curMode)
	{
		case OUT_FROM_LEFT2RIGHT:
			if (curFooterItem < items.length) 
			{
				$(items[curFooterItem]).animate({"opacity": 0.5}, fadeTime, fade);
				curFooterItem++;
			}				
			
			if (curFooterItem - 1 >= 0) 
			{
				if (curFooterItem  == items.length)
				{
					curMode --;
					$(items[curFooterItem - 1]).animate({"opacity": 0}, fadeTime, fade);
					curFooterItem--;

					$("#footerNewsPage"+curFooterPage).css("display","none");
					curFooterPage++;
					$(".footerNavPage").removeClass("footerNavPageActive").addClass("footerNavPageInactive");
					$("#page"+curFooterPage).removeClass("footerNavPageInactive").addClass("footerNavPageActive");		
					$("#footerNewsPage"+curFooterPage).css("display","block");
				}
				else 
					$(items[curFooterItem - 1]).animate({"opacity": 0}, fadeTime);
			}
						
			break;

		case OUT_FROM_RIGHT2LEFT:
			if (curFooterItem >= 0) 
			{
				if (curFooterItem >= items.length)
					curFooterItem = items.length-1;

				$(items[curFooterItem]).animate({"opacity": 0.5}, fadeTime, fade);
				curFooterItem--;
			}	

			if (curFooterItem + 1 < items.length) 
			{
				if (curFooterItem + 1 == 0)
				{
					$(items[curFooterItem + 1]).animate({"opacity": 0}, fadeTime, fade);
					curMode --;
					curFooterItem++;

					$("#footerNewsPage"+curFooterPage).css("display","none");
					curFooterPage--;
					$(".footerNavPage").removeClass("footerNavPageActive").addClass("footerNavPageInactive");
					$("#page"+curFooterPage).removeClass("footerNavPageInactive").addClass("footerNavPageActive");		
					$("#footerNewsPage"+curFooterPage).css("display","block");
				}
				else 
					$(items[curFooterItem + 1]).animate({"opacity": 0}, fadeTime);
			}
			
			break;

		case IN_FROM_RIGHT2LEFT:	
			if (curFooterItem + 1 < items.length) 
				$(items[curFooterItem + 1]).animate({"opacity": 1}, fadeTime);
			
			if (curFooterItem >= 0) 
			{
				if (curFooterItem >= items.length)
					curFooterItem = items.length-1;
				$(items[curFooterItem]).animate({"opacity": 0.5}, fadeTime, fade);
				curFooterItem--;
			}	
			break;

		case IN_FROM_LEFT2RIGHT:
			if (curFooterItem - 1 >= 0) 
				$(items[curFooterItem - 1]).animate({"opacity": 1}, fadeTime);
			
			if (curFooterItem < items.length && curFooterItem >= 0) 
			{
				$(items[curFooterItem]).animate({"opacity": 0.5}, fadeTime, fade);
				curFooterItem++;
			}	
			break;
	}
}


function changeFooterPage()
{
	/*APO - Chargement des images du footer en asynchrone*/
	$("#footerNewsPage2 .fniPic").each(function(){
		fniPicA=$(this).children('a')[0];
		if(fniPicA.id){
			fniPicA.innerHTML='';
			fniPicImg=document.createElement('img');
			fniPicImg.width='165';
			fniPicImg.height='187';
			fniPicImg.src=fniPicA.id;
			fniPicImg.alt=fniPicA.title;
			fniPicA.appendChild(fniPicImg);
			$(this).children('a').children('img').addClass('imageLink');   
			fniPicA.removeAttribute('id');
			fniPicA.removeAttribute('title');
		}
	});
	
	shouldMoveLeft = $(this).attr("id")=="footerNavLeft";
	if (shouldMoveLeft && curFooterPage>1)
	{
		curFooterItem = 3;
		curMode = OUT_FROM_RIGHT2LEFT;
		fade();
	}
	else
	if (!shouldMoveLeft && curFooterPage<$(".footerNewsPage").length)
	{
		curFooterItem = 0;
		curMode = OUT_FROM_LEFT2RIGHT;
		fade();	
	}
	return false;
}

function IsNumeric(input)
{
   return (input - 0) == input && input.length > 0;
}

function hidePublicite(node)
{	
	if (node == null) {
		$('div.defer_ads').each(function()
		{
			$(this).css(
			{
			  "left": -1000 +"px",
			  "top": -1000 +"px"
			});
		});
		$('div[id^="div-gpt-ad"]').each(function()
		{
			$(this).css(
			{
			  "left": -1000 +"px",
			  "top": -1000 +"px",
			  "position": "absolute"
			});
		});
	}else{
		// node examples : "#ARTICLE_TEXTE_CENTRE_GAUCHE" or "#top_ads" or "#PAVE_COLONNE_2"
		$(node + "_DEFER_ADS").css(
		{
		  "left": -1000 +"px",
		  "top": -1000 +"px"
		});
		
		$(node + ' div[id^="div-gpt-ad"]').each(function()
		{
			$(this).css(
			{
			  "left": -1000 +"px",
			  "top": -1000 +"px",
			  "position": "absolute"
			});
		});
	}
}

function showPublicite()
{
	defer_ads();
}

function launchpopup(url)
{
	window.open(url,'_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width=768');
	return false;
}

function synchronizeContent(synchronizeDelay)
{
	synchronizeContentTimer = setTimeout("window.location.href = window.location.href", synchronizeDelay);
}

/* Champ de recherches */

function urlEncode(str)
{
    str=str.replace(new RegExp(' ','g'),'-');
    str=escape(str);
    str=str.replace(new RegExp('\\+','g'),'%2B');
    str=str.replace(new RegExp('%20','g'),'+');
	return "/"+str+"/";
}

function helpSaisie()
{
	/* Initialise la barre de recherche*/
	$('#champ_recherche').removeAttr('disabled');
	$('.ui-widget input').removeClass('recherche_inactive');
	$('.ui-widget input').addClass('recherche_active')
	//attach autocomplete
	$("#champ_recherche").autocomplete({
		//define callback to format results
		source: function(req, add){
			//pass request to server
			$.getJSON("/_FORM_recherche.php?callback=?", req, function(data) {
				//create array for response objects
				var suggestions = [];
				//process response
				$.each(data, function(i, val) {
					suggestions.push(val);
				});
				if ($("#recherche_empty").length > 0)
				{
					$( "#recherche_empty" ).remove();
				}
				add(suggestions);
			});
		},
		//define select handler
		select: function(e, ui) {
			redirection_en_cours=1;
			document.location = ui.item.URL;
		},
		focus: function( event, ui ) {
			$( "#champ_recherche" ).val( ui.item.REPONSE );
			return false;
		}
	}).live('keydown', function (e) {
		var keyCode = e.keyCode || e.which;
		if((keyCode == 13)) 
		{
			var premier=$(".ui-autocomplete li:visible:first").text().toLowerCase();
			if (premier.length)
			{
				document.location = urlEncode(premier);
			}else{
				if ($("#recherche_empty").length == 0 && redirection_en_cours == 0)
				{
					$("#recherche").append("<div id='recherche_empty' class='ui-widget-content'>Pas de r&eacute;sultat pour votre recherche</div>");
					hidePublicite("#top_ads");//On cache uniquement la zone de pub sous la recherche
				}
			}			
		}
	}).data( "autocomplete" )._renderItem = function( ul, item ) {
		hidePublicite("#top_ads");//On cache uniquement la zone de pub sous la recherche
		return $( "<li></li>" )
			.data( "item.autocomplete", item )
			.append( "<a><img src='"+ item.PHOTO + "' /><span>" + item.REPONSE + "</span></a>" )
			.appendTo( ul );
	};
}

$("#recherche").click(function(){
	$("#champ_recherche").focus();
});

$("#champ_recherche").focusout(function(){
	defer_ads("#top_ads");//On réaffiche uniquement la zone de pub sous la recherche
	$('#recherche_empty').remove();
});

$("#champ_recherche").attr('disabled','disabled');

function defer_ads(emplacement)
{
	// On ne positionne les publicités QUE si la pop-up d'inscription est invisible
	if (!$("#popupInscription").is(":visible"))
	{
		if (emplacement == null) {
			$('div.defer_ads').each(function()
			{
			  var id = $(this).attr('id').replace(/_DEFER_ADS/, '');
			  var pos = $("#" + id).offset();
			  
			  if (pos)
			  {
				$(this).css(
				{
				  "left": pos.left +"px",
				  "top":  pos.top  +"px"
				});

				$("#" + id).height($(this).height());
				$("#" + id).width($(this).width());
			  }
			});
			$('div[id^="div-gpt-ad"]').each(function()
			{
				$(this).css(
				{
				  "left": 0,
				  "top":  0,
				  "position": "relative"
				});

			});
		}else{
			var id = emplacement.replace('#', '');
			var pos = $("#" + id).offset();
			
			if (pos)
			{
				$("#" + id + "_DEFER_ADS").css(
				{
					"left": pos.left +"px",
					"top":  pos.top  +"px"
				});
				
				$("#" + id).height($("#" + id + "_DEFER_ADS").height());
				$("#" + id).width($("#" + id + "_DEFER_ADS").width());
			}
	 		
	 		// In this case, emplacement is a node selector. It can be a class or an id which contains a iframe google ad
			$(emplacement + ' div[id^="div-gpt-ad"]').each(function()
			{
				$(this).css(
				{
				  "left": 0,
				  "top":  0,
				  "position": "relative"
				});
			});
		}
	}
	else
	{
		hidePublicite();
	}
}

// APO - Redirige vers la page jail_publicite.php avec l'url courante en paramètre
function ensure_ads()
{
	count_ensure_ads++;
	if(count_defer_ads < count_ensure_ads && window.location.pathname != "/jail_publicite.php")
	{
		window.location = "/jail_publicite.php?origine="+encodeURIComponent(window.location.href);
	}
}

// APO - Retourne la valeur d'un paramètre d'une url
// @param string param
// nom du paramètre dont on souhaite avoir la valeur
// @param url
// url dans laquelle on souhaite récupérer le paramètre ou rien si l'on souhaite travailler sur l'url courante
// @return String
function getParamValue(param,url)
{
	var u = url == undefined ? document.location.href : url;
	var reg = new RegExp('(\\?|&|^)'+param+'=(.*?)(&|$)');
	matches = u.match(reg);
	return matches[2] != undefined ? decodeURIComponent(matches[2]).replace(/\+/g,' ') : '';
}

// Redimensionnement des widgets Kelkoo
function truncate_kelkoo_description(emplacement,longueur)
{
	$(emplacement+' .name').each(function(){
		if($(this).children('a').text().length>longueur)
		{
			$(this).children('a').text($(this).children('a').text().toUpperCase().substring(0,1)+$(this).children('a').text().toLowerCase().substring(1,longueur)+'...');
		}else{
			$(this).children('a').text($(this).children('a').text().toLowerCase());
		}
	});
}

function lancer_popup_action_non_connecte(){
	createSlidingPopup("Rejoignez "+nom_site,"Vous avez effectu&eacute; une action r&eacute;serv&eacute;e aux membres du site, et nous l'avons bien prise en compte !<br /><br /> <b>Pour la valider</b>, inscrivez-vous en un clic gr&acirc;ce &agrave; votre compte Facebook.<span class='bouton_connexion_facebook launch_facebook_connexion facebookConnexionPopupMessage'></span><a href=\"/inscription.php\" class='slidingPopupNoFacebookLink'>Je n'ai pas de compte Facebook</a>","","",lien_photo_editeur,"info_popup");
	$(".launch_facebook_connexion").click(lancer_connexion_facebook);
}

// APO - Popup Inscription
function loadPopupInscription(lethemePopup){
	//on ajoute le thème dans la barre perso de l'utilisateur au click
	if(lethemePopup!=''){
		$("#facebookArea").addClass('communaute_ajout_tag_fans');
		$("#facebookArea").attr('theme',lethemePopup);
		$(".communaute_ajout_tag_fans").click(ajouter_tag_fans);
	}
	//on affiche la popup
	hidePublicite();
	$("#backgroundPopup").css({"opacity": "0.7"});
	$("#backgroundPopup").fadeIn("slow");
	$("#popupInscription").fadeIn("slow");
	$("#popupInscription").click(function(e){
		if($(e.target).attr("id")!="popupInscriptionClose")
		{
			lancer_connexion_facebook();
		}
	});
}

var LANCER_MINIPOPUP_ONCLOSE=0;

function createPopupInscription(titreArticlePopup,photoPopupUrl){
	$("#popupInscription").remove();
	//on crée et attache la popup au body
	if(photoPopupUrl!='')
		$('<div id=\"popupInscription\"><a id=\"popupInscriptionClose\">Fermer <b>x</b></a><div id=\"articleArea\"><p><b>Int&eacute;ress&eacute;(e) par '+titreArticlePopup+' ?</b><br/><br/>Rejoignez d\'autres passionn&eacute;s et acc&eacute;dez &agrave; toutes nos actus, photos et vid&eacute;os !</p><img id=\"photoArea\" src=\"'+photoPopupUrl+'\" width=\"125\" height=\"141\"></div><div id=\"facebookArea\"></div></div><div id=\"backgroundPopup\"></div>').appendTo('body');
	else
		$('<div id=\"popupInscription\"><a id=\"popupInscriptionClose\">Fermer <b>x</b></a><div id=\"articleArea\"><p><b>Int&eacute;ress&eacute;(e) par '+titreArticlePopup+' ?</b><br/><br/>Rejoignez d\'autres passionn&eacute;s et acc&eacute;dez &agrave; toutes nos actus, photos et vid&eacute;os !</p></div><div id=\"facebookArea\"></div></div><div id=\"backgroundPopup\"></div>').appendTo('body');
	//on centre la popup
	$("#popupInscription").css({
		"top": (windowHeight/2)-($("#popupInscription").height()/2),
		"left": (windowWidth/2)-($("#popupInscription").width()/2)
	});
	//force la hauteur
	$("#backgroundPopup").css({"height":windowHeight});
	//evenements de fermeture
	$("#popupInscriptionClose").click(disablePopupInscription);
}

function disablePopupInscription(){
	$("#backgroundPopup").fadeOut("slow");
	$("#popupInscription").remove();	
	if(LANCER_MINIPOPUP_ONCLOSE)
	{
		lancer_popup_action_non_connecte();
		LANCER_MINIPOPUP_ONCLOSE=0;
	}
	showPublicite();
}

function initPopupInscription(){
		createPopupInscription(titleArticlePopup,urlPhotoPopup);
		loadPopupInscription(themePopup);
}

//APO - communaute sliding popup
function createSlidingPopup(communaute_sliding_popup_titre,communaute_sliding_popup_message,communaute_sliding_popup_emetteur,communaute_sliding_popup_date,communaute_sliding_popup_image,communaute_sliding_popup_class) {
	if($('#communaute_sliding_popup').length){
		return false;
	}
	else{
		$('<div id="communaute_sliding_popup"></div>').appendTo('body');
		divPopup = $('#communaute_sliding_popup');
		if(communaute_sliding_popup_image!='')
			divPopup.html("<div id=\"communaute_sliding_popup_titre\"><span class=\"communaute_sliding_popup_icone\"></span><p>"+communaute_sliding_popup_titre+"</p><div id=\"communaute_sliding_popup_close\" class=\"communaute_sliding_popup_closer\"><a href=\"#\">X</a></div></div><div id=\"communaute_sliding_popup_corps\"><a id=\"communaute_sliding_popup_image\" href=\""+communaute_sliding_popup_emetteur+"\"><img class=\"linkImage\" src=\""+communaute_sliding_popup_image+"\"></a><span id=\"communaute_sliding_popup_contenu\"><i>"+communaute_sliding_popup_date+"</i><p>"+communaute_sliding_popup_message+"</p></span></div>")
		else
			divPopup.html("<div id=\"communaute_sliding_popup_titre\"><span class=\"communaute_sliding_popup_icone\"></span><p>"+communaute_sliding_popup_titre+"</p><div id=\"communaute_sliding_popup_close\" class=\"communaute_sliding_popup_closer\"><a href=\"#\">X</a></div></div><div id=\"communaute_sliding_popup_corps\"><a id=\"communaute_sliding_popup_image\" href=\""+communaute_sliding_popup_emetteur+"\"></a><span id=\"communaute_sliding_popup_contenu\"><i>"+communaute_sliding_popup_date+"</i><p>"+communaute_sliding_popup_message+"</p></span></div>")
		divPopup.css({"bottom": -1 * divPopup.height()});
		if(communaute_sliding_popup_class!=''){
			divPopup.addClass(communaute_sliding_popup_class);
		}
		divPopup.show().animate( { bottom: 0 }, 1000);
		$('.communaute_sliding_popup_closer').click(function(){
			closeSlidingPopup();
			return false;
		});
	}
}

function closeSlidingPopup(communaute_sliding_popup_timer) {
	if($('#communaute_sliding_popup').length){
		divPopup = $('#communaute_sliding_popup');
		setTimeout("divPopup.animate({ bottom: divPopup.height() * -1 }, 1000, function () { divPopup.remove(); })",communaute_sliding_popup_timer);
	}
	else{
		return false;
	}
}

function checkIfBlogsEnParlent_tabIsSelectedThenDeploy(){
	if(!$("#communauteBlogsEnParlentTabBar .BlogsEnParlent_tab").eq(0).hasClass('selected')) {
		$("#communauteBlogsEnParlentTabBar .BlogsEnParlent_tab").eq(0).mouseover();
	}
}

function checkIftopDebats_tabIsSelectedThenDeploy(){	
	if(!$("#communauteTopDebatsTabBar .topDebats_tab").eq(0).hasClass('selected')) {
		$("#communauteTopDebatsTabBar .topDebats_tab").eq(0).mouseover();
	}
}

function checkIfcommunauteCommun300_tabIsSelectedThenDeploy(){
	if(!$("#communauteCommun300TabBar .communauteCommun300_tab").eq(0).hasClass('selected')) {	
		$("#communauteCommun300TabBar .communauteCommun300_tab").eq(0).mouseover();
	}
}

function checkIfblocList_tabIsSelectedThenDeploy(){	
	if(!$("#followthem .blocList_tab").eq(0).hasClass('selected')) {
		$("#followthem .blocList_tab").eq(0).mouseover();
	}
}

//////////////////////////////////////////////////
// Fonctions chargées avant que la page soit prête
//////////////////////////////////////////////////

// Initialisation des variables
var curVideo = 0;
var curFooterPage = 1;

var IN_FROM_RIGHT2LEFT = 0;
var OUT_FROM_LEFT2RIGHT = 1;
var IN_FROM_LEFT2RIGHT = 2;
var OUT_FROM_RIGHT2LEFT = 3;

var curMode;
var curFooterItem;

var curDos = 1;

var hidePreviewTimer;

var count_defer_ads=0;
var count_ensure_ads=0;

var TOPBAR_DROPDOWN_DELAY;

var redirection_en_cours = 0;

//Variables globales des dimensions de la fenêtres
var windowWidth = 0, windowHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	windowWidth = window.innerWidth;
	windowHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	windowWidth = document.documentElement.clientWidth;
	windowHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	windowWidth = document.body.clientWidth;
	windowHeight = document.body.clientHeight;
}

$(".fakeClickZone").click(goFakeLink);
secureTextarea();

// Fil actualité des blogs (autre que home)
$("#blogsNewsList").css("display", "none");

// Switchs onglets
$(".tab").click(switchTab);
$(".tab.nonJS").unbind();

// Dossier colonne 2
$("#dossier #dossier_overlay").click(goToDos);	

// VIDEO ZAPPING
$(".vzArrow").click(swapVideoZap);
$(".vzThumb").click(jumpVideoZap);

// Pied de page
$(".footerNavArrow").click(changeFooterPage);
$(".footerNewsPage").css("display", "none");
$(".footerNewsPage .footerNewsItem").css("opacity",0);
$("#footerNewsPage1").css("display", "block");
$("#footerNewsPage1 .footerNewsItem").css("opacity",1);

// APO - Scroll animé vers une ancre
$('.smooth_scroll_to_anchor').click(function(){
	var id = $(this).attr("id");
	$('html,body').animate({scrollTop: $("#"+id+"_anchor").offset().top},'slow');		
});

// APO - Modifie le href d'un lien avec le contenu d'un paramètre de l'uri
$('.redirection').click(function(){
	$(this).attr('href',getParamValue($(this).attr('url')));
});

// APO - Délai topbar
$('.dropdown').mouseenter(function(){
	clearTimeout(TOPBAR_DROPDOWN_DELAY);
	$('.dropdown').removeClass('topbar-nav-dropdown-delay');
	$(this).addClass('topbar-nav-dropdown-delay');
}).mouseleave(function(){
	cible=$(this);
	TOPBAR_DROPDOWN_DELAY=setTimeout(function(){
		cible.removeClass('topbar-nav-dropdown-delay');
	},1200);
});

// APO - On vérifie si des onglets de modules ne sont pas "selected"
checkIfBlogsEnParlent_tabIsSelectedThenDeploy();
checkIftopDebats_tabIsSelectedThenDeploy();
checkIfcommunauteCommun300_tabIsSelectedThenDeploy();
checkIfblocList_tabIsSelectedThenDeploy();

