// fonction laetis
nav = navigator.appName.substring(0,3);
ver = navigator.appVersion.substring(0,1);

var detect = navigator.userAgent.toLowerCase();
var OS,navigateur,versionNavigateur,total,thestring;

if (checkIt('konqueror'))
{
	navigateur = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) navigateur = "Safari"
else if (checkIt('omniweb')) navigateur = "OmniWeb"
else if (checkIt('opera')) navigateur = "Opera"
else if (checkIt('webtv')) navigateur = "WebTV";
else if (checkIt('icab')) navigateur = "iCab"
else if (checkIt('msie')) navigateur = "Internet Explorer"
else if (checkIt('firefox')) navigateur = "Firefox"
else if (!checkIt('compatible'))
{
	navigateur = "Netscape Navigator"
	versionNavigateur = detect.charAt(8);
}
else navigateur = "An unknown navigateur";

if (!versionNavigateur) versionNavigateur = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function printAll()
	{
	if (nav == "Mic" && ver >= 4 && navigator.platform.substring(0,3)=="Win")
		{
		window.self.print();
		}
	else
		{
		window.alert("Appuyez sur Pomme + P, pour imprimer cette page");
		}
	}

function ajouterFavoris()
{
if (nav == "Mic" && ver >= 4 && navigator.platform.substring(0,3)=="Win")
{
url_site=window.self.location.href;
titre_site = window.document.title;
window.external.AddFavorite(url_site, titre_site);
}
else
{
if (navigator.platform.substring(0,3)=="Win")
{
window.alert("Appuyez sur Ctrl + D, pour ajouter ce site à vos favoris");
}
else
{
window.alert("Appuyez sur Pomme + D, pour ajouter ce site à vos favoris");
}

}
}

function envoyerPageAmiFr()
{
	MM_openBrWindow("/fr/popup/envoyer_page_ami.php" + "?titreAmi=" + window.document.title + "&urlAmi=" + window.document.location.href,"pageAmi",'status=yes,menubar=yes,scrollbars=yes,width=520,height=600');
}

function envoyerPageAmiUk()
{
	MM_openBrWindow("/uk/popup/envoyer_page_ami.php" + "?titreAmi=" + window.document.title + "&urlAmi=" + window.document.location.href,"pageAmi",'status=yes,menubar=yes,scrollbars=yes,width=520,height=600');
}

function openPopupSite(theURL,nomPop)
{
	MM_openBrWindow(theURL,nomPop,'status=yes,menubar=yes,scrollbars=yes,width=520,height=600');
}

function lanceDetailZa(idZa)
{
	var winl = (screen.availwidth - 640) / 2;
    var wint = (screen.availheight - 600) / 2;
    MM_openBrWindow("/fr/implantation_aveyron/details_zone-pop.php?ID_za=" + idZa,"zoneActivite",'status=yes,menubar=yes,scrollbars=yes,width=660,height=600,top='+wint+',left='+winl);
}

function lanceCarto(idTheme)
{
	var winl = (screen.availWidth - 767) / 2;
    var wint = (screen.availheight - 638) / 2;
	MM_openBrWindow("http://www.aveyron-expansion.asso.fr/fr/cartographie/index.php?ID_Theme=" + idTheme,"carto",'status=yes,menubar=no,scrollbars=no,width=767,height=638,top='+wint+',left='+winl);
}

function openNewsLetter()
{
	var winl = (screen.availWidth - 600) / 2;
    var wint = (screen.availheight - 500) / 2;
	MM_openBrWindow("/fr/popup/lettre_diffusion.php","carto",'status=yes,menubar=no,scrollbars=no,width=600,height=500,top='+wint+',left='+winl);
}

function openNewsLetterUk()
{
	var winl = (screen.availWidth - 600) / 2;
    var wint = (screen.availheight - 500) / 2;
	MM_openBrWindow("/uk/popup/lettre_diffusion.php","carto",'status=yes,menubar=no,scrollbars=no,width=600,height=500,top='+wint+',left='+winl);
}

function openPopupZoneActivite(theURL,nomPop)
{
	MM_openBrWindow(theURL,nomPop,'status=yes,menubar=yes,scrollbars=yes,width=700,height=600');
}

function openPopupNewsletter(theURL,nomPop)
{
	MM_openBrWindow(theURL,nomPop,'status=yes,menubar=yes,scrollbars=yes,width=700,height=600');
}


function affecterDonneesInseeZA(chaineEntree1, chaineEntree2)
	{
	codeInseeEnCours = MM_findObj("insee_com");
	codePostalEnCours = MM_findObj("cod_com");
	nomCantonEnCours = MM_findObj("nom_canton");
	codeCantonEnCours = MM_findObj("cod_canton");
	nomCommuneEnCours = MM_findObj("nom_com");

	temp=chaineEntree1.split(",");
	codeInseeEnCours.value = temp[0];
	codePostalEnCours.value = temp[1];
	nomCantonEnCours.value = temp[2];
	codeCantonEnCours.value = temp[3];

	nomCommuneEnCours.value = chaineEntree2;
	}

function affecterDonneesZE(chaineEntree1, chaineEntree2)
	{
	codeZE = MM_findObj("cod_ze");
	codeZE.value = chaineEntree1;
	nomZE = MM_findObj("zone_emploi");
	nomZE.value = chaineEntree2;	
	}
	
/*
appel: <a href="javascript:lsjs_openVotreAvis('le_site');">Votre avis sur le site </a>
*/
function lsjs_openVotreAvis(siteInternet)
 {
 winAvis=window.open('http://www.interview.laetis.fr/fr/votre-avis/questionnaire.php?siteInternet='+siteInternet,'VotreAvis','height=692,width=650,toolbar=0,menubar=no,scrollbars=yes,Status=yes');
 winAvis.opener = self; winAvis.focus();
 winAvis.focus();
 }
 
 /*
Fonction "Contenus illicites"
Appel: <a href="http://www.laetis.fr/contenus-illicites/index.htm" onClick="lsjs_popupMentions(); return false;"> D&eacute;clarer un contenu illicite </a>
Ouvre la page "contenus illicites" sur laetis.fr
*/
function lsjs_popupMentions()
{
winMentions=window.open('http://www.laetis.fr/contenus-illicites/index.htm','mentions','height=692,width=730,toolbar=0,menubar=no,scrollbars=yes,Status=yes');
winMentions.opener = self; 
winMentions.focus();
} // FIN function lsjs_popupMentions(siteInternet)