$(document).ready(function() {
	// affichage bottom1 ou criteo
	/*var criteo = $("#teleg_E div.A:eq(0)"); // (teleg_E a 3 div avec la classe A)
	var isBottom1Off = $("#teleg_E div.A:eq(1) a img");
	if (isBottom1Off.length==0 || (isBottom1Off.length==1 && isBottom1Off.height()>1)){ // pub oas bottom1
		criteo.hide();
	}
	// cacher les pub oas vides de la section teleg_E
	if($("#teleg_E div.A:eq(1) a img").length>0) $("#teleg_E div.A:eq(1)").hide();
	if($("#teleg_E div.A:eq(2) a img").length>0) $("#teleg_E div.A:eq(2)").hide();*/
});

/*
Masque les calques publicitaires vide
*/
function HideDiv(myDiv,rub,ville,connected)
{
 isScripts = false ;
 /*if (typeof console == "object") {
	console.log("Div pub : "+myDiv);
 }*/
 adDiv = document.getElementById(myDiv);
 imgs = adDiv.getElementsByTagName('img');
 scripts = adDiv.getElementsByTagName('script') ;


 if(scripts.length > 2){isScripts = true ;}

//document.write(navigator.appName);
//document.write(navigator.userAgent.indexOf('MSIE 7.0'));
//alert(navigator.userAgent.indexOf('MSIE 7.0'));

 if (!isScripts && adDiv.getElementsByTagName('object').length == 0)
 {
  for(i = 0; i < imgs.length; i++)
  {
	nomImage = imgs[i].src;
	if ( (nomImage.indexOf('empty') > 0) || (nomImage.indexOf('vide') > 0) )
	{
		/*
		PAS DE PUB A AFFICHER
		*/
		if (myDiv == 'Position4') //MEGABANN
		{		
			if( (rub == 'tb:www:une' || ville == 1) || (rub == 'tb:www:local' && connected == 0) ) {
				$("#teleg_DA").css("margin-top","0px");
				$("#teleg_DB").css("margin-top","0px");
			}
			else {
				$("#teleg_DA").css("margin-top","16px");
				$("#teleg_DB").css("margin-top","8px");
			}
			

			$("#teleg_D1_depech div.A").css("background","url(http://www3.letelegramme.com/img/points3.gif) repeat-x 0 38px");

		}
		adDiv.style.display = "none";
	} 
	else { // pub existante
		if (myDiv == 'Position4') //MEGABANN
		{
			$("#Position4").show();			
			$("#teleg_DA").css("margin-top","8px");
		}
	}
  }
 }	else { // PUB FLASH EXISTANTE
	if (myDiv == 'Position4') //MEGABANN
	{
		$("#Position4").show();
		$("#teleg_DA").css("margin-top","8px");
	}
}

}

/* ajouter site menu demarrer windows (ie9 seulement) */
function addSite()
{
    try {
        window.external.msAddSiteMode();
    }
    catch (e) {
        alert("Cette option est rÃ©servÃ©e Ã  Internet Explorer 9.");
    }
}
