        flg = 0;
        iddev = "";
		effmsgboxauto = 0;
		xmouse = 0; ymouse = 0; cmouse = 0;
        xmousecart = 0; ymousecart = 0; divmouse = 0;
        isie = 0;
        rt = unescape("%0D");
function start(){
// Fonction lancée automatiquement à chaque page
// Des instructions spécifiques à une page peuvent être lancées à partir de la fonction "startpage()" si présente dans cette même page
    // Affect l'évènement mouse en fonction du navigateur
    if (navigator.appName.substring(0,3) == "Net") {document.captureEvents(Event.MOUSEMOVE); document.onmousemove = positionns;} else {document.onmousemove = positionie; isie = 1;}
    // Calques transparents
        moverall = document.getElementById("overall");
        moveralltrans = document.getElementById("overalltrans");
    // Div "Veuillez patienter"
        mpwait = document.getElementById("pwait");
    // Divs affichage photo
        mphotoaff = document.getElementById("photoaff");
        mphotocont = document.getElementById("photocont");
        mphotoplan = document.getElementById("photoplan");
        mphotomove = document.getElementById("photomove");
    // Divs affichage message box
        mmsgbox = document.getElementById("msgbox");
        mmsgboxcont = document.getElementById("msgboxcont");
        mmsgboxaffcont = document.getElementById("messageaffcont");
        mmsgboxaff = document.getElementById("messageaff");
        mmsgboxmove = document.getElementById("msgboxmove");
        mmsgboxbutts = document.getElementById("msgboxbutts");
        mmsgboxbuttok = document.getElementById("msgboxbuttok");
        mmsgboxbuttannuler = document.getElementById("msgboxbuttannuler");
    // Form et div "Envoyer à un ami"
        formami = document.getElementById("amiform");
        mamibox = document.getElementById("amibox");
        mamiboxmove = document.getElementById("amiboxmove");
        mamiboxcont = document.getElementById("amiboxcont");
    // Effacement de tous les divs
    effoverall();
    effoveralltrans();
    effpwait();
    effphoto();
    effmsgbox();
    effamibox();
    verifchpsami();
    // Dimensionne le séparateur pointillé à la bonne hauteur
    setcolm();
    // Dimensions totale de la zone d'affichage
        bodywidth = parseInt(document.body.scrollWidth);
        bodyheight = parseInt(document.body.scrollHeight);
    // Flag autorisant les fonctions après chargement complet de la page
   		flg=1;
    // Lancement des instructions spécifiques à une page au démarrage
	if (typeof(startpage) == 'function') {startpage();}
}
function setcolm() {
    if (document.getElementById("colm")) {
            mcolg = document.getElementById("colg");
            mcolm = document.getElementById("colm");
            mcold = document.getElementById("cold");
            hcolg = parseInt(mcolg.offsetHeight);
            hcold = parseInt(mcold.offsetHeight);
        if (hcolg > hcold) {hcolm = hcolg;} else {hcolm = hcold;}
            mcolm.style.height = hcolm + "px";
    }
}
function imprimer(url){
        param = "";
        url2 = url;
		qm = url.indexOf('?');
	if (qm > 0) {
            param = "&" + url.substr(qm + 1);
            url2 = basename(url);
    }
        fl = 770;
        ht = Math.round(screen.height / 5) * 3;
        xdec = Math.round((screen.width - fl) / 2);
        ydec = Math.round((screen.height - ht) / 2) - 30;
        options = 'resizable=0,toolbar=0,status=1,scrollbars=1,menubar=0,location=0,width=' + fl + ',height=' + ht + ',left=' + xdec + ',top=' + ydec;
        loc = "imprimer.phtml?page=" + url2 + param;
        newinimp = window.open('', 'imp', options);
        newinimp.location = loc;
    waitimp();
}
function waitimp(){
	if (window.newinimp.flg == 1){
    	if (typeof(copimp) == 'function') {copimp();}
	} else {
        setTimeout("waitimp()", 200);
	}
}
function basename(url){
		basen=escape(url);
		cr=basen.indexOf('%3F');
	if (cr>=0) {basen=basen.substr(0,cr);}
		basen=unescape(basen);
		okk=1;
	while (okk>0) {
   			cr=basen.indexOf('/');
		if (cr>=0) {basen=basen.substr(cr+1);} else {okk=0;}
	}
	return basen;
}
function photo(phot){
    if (flg) {
            mphotoaff.src = phot;
        affoverall();
        affpwait();
        setTimeout("waitphoto()", 300);
    }
}
function waitphoto(){
	if (mphotoaff.complete && mphotoaff.width > 1){
        effpwait();
        getscrollpos();
            xpw = parseInt(mphotoaff.offsetWidth);
            yph = parseInt(mphotoaff.offsetHeight);
            xpos = Math.round((screen.width - xpw) / 2) + Xscroll;
        if (xpos < 0) {xpos = 0;}
            ypos = Math.round((screen.height - yph) / 2) - 100 + Yscroll;
        if (ypos < 0) {ypos = 0;}
        mphotoplan.style.left = xpos + "px";
        mphotoplan.style.top = ypos + "px";
        mphotomove.style.width = xpw + "px";
        mphotocont.style.width = xpw + "px";
        mphotoplan.style.visibility = "visible";
	} else {
        setTimeout("waitphoto()", 200);
	}
}
function effphoto() {
        mphotoaff.src = "img/px.gif";
        mphotoplan.style.visibility = "hidden";
    if (moverall.style.visibility == "visible") {effoverall();}
    effpwait();
        cmouse = 0;
}
function positionns(e){xmouse = e.pageX; ymouse = e.pageY; movediv();}
function positionie(e){
        xmouse = event.clientX;
        ymouse = event.clientY;
    if (document.documentElement && document.documentElement.clientWidth) {docbase = document.documentElement;} else {docbase = document.body;}
        xmouse+= docbase.scrollLeft;
        ymouse+= docbase.scrollTop;
    movediv();
}
function setposmouse (div) {
        divmouse = div;
        Xposdiv = parseInt(divmouse.style.left);
        Yposdiv = parseInt(divmouse.style.top);
        largdiv = parseInt(divmouse.offsetWidth)
        hautdiv = parseInt(divmouse.offsetHeight)
        xmousecart = xmouse - Xposdiv;
        ymousecart = ymouse - Yposdiv;
        xmousemax = bodywidth - largdiv + xmousecart + Xscroll;
        ymousemax = bodyheight - hautdiv + ymousecart + Yscroll;
}
function movediv() {
    if (cmouse) {
        if (xmouse < xmousecart) {xmouse = xmousecart;}
        if (xmouse > xmousemax) {xmouse = xmousemax;}
        if (ymouse < ymousecart) {ymouse = ymousecart;}
        if (ymouse > ymousemax) {ymouse = ymousemax;}
            divmouse.style.left = xmouse - xmousecart + "px";
            divmouse.style.top = ymouse - ymousecart + "px";
    }
}
function mousedragonoff() {
    if (cmouse) {
            divmouse.onselectstart = function () {return true};
            cmouse = 0;
    } else {
            divmouse.onselectstart = function () {return false};
            cmouse = 1;
    }
}
function affoverall() {
        moverall.style.height = bodyheight + "px";
        moverall.style.width = bodywidth + "px";
        moverall.style.visibility = "visible";
}
function effoverall() {
        moverall.style.visibility = "hidden";
    if (mphotoplan.style.visibility == "visible") {effphoto();}
}
function affoveralltrans() {
// Affiche un div transparent sur toute la page pour empêcher toute action
        moveralltrans.style.height = bodyheight + "px";
        moveralltrans.style.width = bodywidth + "px";
        moveralltrans.style.visibility = "visible";
}
function effoveralltrans() {moveralltrans.style.visibility = "hidden";}
function affpwait() {
        getscrollpos();
            xpos = Math.round((screen.width - parseInt(mpwait.offsetWidth)) / 2) + Xscroll;
        if (xpos < 0) {xpos = 0;}
            ypos = Math.round((screen.height - parseInt(mpwait.offsetHeight)) / 2) - 100 + Yscroll;
        if (ypos < 0) {ypos = 0;}
        mpwait.style.left = xpos + "px";
        mpwait.style.top = ypos + "px";
        mpwait.style.visibility = "visible";
}
function effpwait() {mpwait.style.visibility = "hidden";}
function findPos(obj) {
        var curleft = obj.offsetLeft || 0;
        var curtop = obj.offsetTop || 0;
    while (obj = obj.offsetParent) {curleft+= obj.offsetLeft; curtop+= obj.offsetTop;}
    return {x:curleft,y:curtop};
}
function emailverif(emailv) {
        emailv2 = emailv.toLowerCase();
        reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/;
    return (reg.exec(emailv2) != null);
}
function getwindowdims() {
    if (typeof(window.innerHeight) == 'number') {
            winwidth = window.innerWidth;
            winheight = window.innerHeight;
    } else {
        if (document.documentElement && document.documentElement.clientHeight) {
                winwidth = document.documentElement.clientWidth;
                winheight = document.documentElement.clientHeight;
        } else if (document.body && document.body.clientHeight) {
                winwidth = document.body.clientWidth;
                winheight = document.body.clientHeight;
        }
    }
}
function getscrollpos() {
    if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
            Xscroll = document.documentElement.scrollLeft;
            Yscroll = document.documentElement.scrollTop;
    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
            Xscroll = document.body.scrollLeft;
            Yscroll = document.body.scrollTop;
    } else {
            Xscroll = 0;
            Yscroll = 0;
    }
}
function affmsgbox(message, suiteopok, suiteopannule, modeop){
// Affiche "message" dans une box centrée sur l'écran
// Execute "suiteopok" si clic sur "OK" ou "suiteopannule" si clic sur "Annuler"
// Si modeop= 0, affiche "OK". Si modeop= 1, affiche "OK", "Annuler"
    // Affiche le div transparent
    affoveralltrans();
    // Demande la position du scroll
    getscrollpos();
    // Mémorise les opérations à effectuer après fermeture de la box pour les boutons "OK" et "Annuler"
    // Ces varibles sont reprises dans les liens boutons de la box
        suiteopmsgboxok = suiteopok;
        suiteopmsgboxannule = suiteopannule;
    // Insère le contenu
        mmsgboxaff.innerHTML = "<div align='center'>" + message + "</div>";
    // Centre le contenu verticalement
        msgh1 = parseInt(mmsgboxaffcont.offsetHeight);
    if (msgh1 < 180) {msgh1 = 180; mmsgboxaffcont.style.height = msgh1 + "px";}
        msgh2 = parseInt(mmsgboxaff.offsetHeight);
        msgy = Math.round(msgh1 - msgh2) / 2;
    if (msgy < 0) {msgy = 0;}
        mmsgboxaff.style.top = msgy + "px";
    // Adapte le bandeau du haut en largeur
        mmsgboxmove.style.width = parseInt(mmsgboxcont.offsetWidth) - 2 + "px";
    // Place les boutons
        largbutts = parseInt(mmsgboxbutts.offsetWidth);
        largbuttok = parseInt(mmsgboxbuttok.offsetWidth);
    // Centre la box
        msgwidth = parseInt(mmsgbox.offsetWidth);
        msgheight = parseInt(mmsgbox.offsetHeight);
        xpos = Math.round((screen.width - msgwidth) / 2) - 11 + Xscroll;
    if(xpos < 0){xpos = 0;}
        ypos = Math.round((screen.height - msgheight) / 2) - 200 + Yscroll;
    if(ypos < 0){ypos = 0;}
        mmsgbox.style.left = xpos + "px";
        mmsgbox.style.top = ypos + "px";
    if (modeop) {
        // Boutons "OK" et "Annuler"
            mmsgboxbuttannuler.style.display = "block";
            largbuttannuler = parseInt(mmsgboxbuttannuler.offsetWidth);
            ecartbutts = 50;
            largtot = largbuttok + largbuttannuler + ecartbutts;
            posbuttok = Math.round((largbutts - largtot) / 2);
            posbuttannuler = posbuttok + largbuttok + ecartbutts;
            mmsgboxbuttok.style.left = posbuttok + "px";
            mmsgboxbuttannuler.style.left = posbuttannuler + "px";
    } else {
        // Bouton "OK" seulement
            mmsgboxbuttannuler.style.display = "none";
            mmsgboxbuttok.style.left = Math.round((largbutts - largbuttok) / 2) + "px";
    }
    // Affiche la box
        mmsgbox.style.visibility = "visible";
    // Si un délai est défini, effacera la box après ce délai
    if (effmsgboxauto > 0) {setTimeout("effmsgbox()", effmsgboxauto);}
}
function effmsgbox(){
    // Efface la box
    mmsgbox.style.visibility = "hidden";
    // Interdit le movediv
        cmouse = 0;
    // Initialise l'effacement de la box après délai
        effmsgboxauto = 0;
    // Efface le div transparent
    if (mamibox.style.visibility == "hidden") {effoveralltrans();}
}
function effmsgboxsuiteop(suiteop){
// Execute les instructions "suiteop" après clic sur "OK" ou "Annuler"
    effmsgbox();
    if (suiteop) {setTimeout(suiteop, 20);}
}
function envoyeraunami() {
// Affiche la box "Envoyer à un ami"
    // Affiche le div transparent
    affoveralltrans();
    // Demande la position du scroll
    getscrollpos();
    // Centre la box
        amiwidth = parseInt(mamibox.offsetWidth);
        amiheight = parseInt(mamibox.offsetHeight);
        xpos = Math.round((screen.width - amiwidth) / 2) - 11 + Xscroll;
    if (xpos < 0){xpos = 0;}
        ypos = Math.round((screen.height - amiheight) / 2) - 200 + Yscroll;
    if (ypos < 0){ypos = 0;}
        mamibox.style.left = xpos + "px";
        mamibox.style.top = ypos + "px";
    // Adapte le bandeau du haut en largeur
        mamiboxmove.style.width = parseInt(mamiboxcont.offsetWidth) - 2 + "px";
        mamibox.style.visibility = "visible";
}
function effamibox() {
    // Efface la box
        mamibox.style.visibility = "hidden";
    // Interdit le movediv
        cmouse = 0;
    // Efface le div transparent
    if (mmsgbox.style.visibility == "hidden") {effoveralltrans();}
}
function envoiami() {
    changechpami(formami.votrenom);
    changechpami(formami.emailami);
        okenvoi = 1;
    if (!formami.votrenom.value && okenvoi) {affmsgbox("Vous n'avez pas encore saisi<br />votre nom.", "", "", 0); okenvoi = 0;}
    if (!formami.emailami.value && okenvoi) {affmsgbox("Vous n'avez pas encore saisi<br />l'email de votre ami(e).", "", "", 0); okenvoi = 0;}
    if (okenvoi) {
            okenvoi = emailverif(formami.emailami.value);
        if (!okenvoi) {affmsgbox("Il semble que l'adresse email de votre ami(e)<br />ne soit pas correcte.", "formami.emailami.focus()", "", 0);}
    }
    if (okenvoi) {
        effamibox();
        affoveralltrans();
        affpwait();
        envoyeraunamiajax();
    } else {
        verifchpsami();
    }
}
function changechpami(chp) {
    if (isie) {
        if (chp.className == "chpaminotsel") {chp.className = "chpami"; chp.value = "";}
    } else {
        if (chp.getAttribute("class") == "chpaminotsel") {chp.setAttribute("class", "chpami"); chp.value = "";}
    }
}
function verifchpami(chp, txt) {
    if (chp.value == "") {
        if (isie) {chp.className = "chpaminotsel";} else {chp.setAttribute("class", "chpaminotsel");}
            chp.value = txt;
    }
}
function verifchpsami() {
    verifchpami(formami.votrenom, 'Votre nom');
    verifchpami(formami.emailami, 'L\'email de votre ami(e)');
    verifchpami(formami.messami, 'Votre message');
}
function envoyeraunamiajax() {
        erreurajax = 0; reponseajax = "";
    if (window.XMLHttpRequest) {
            xhr = new XMLHttpRequest(); /* Firefox, Safari, ... */
    } else if (window.ActiveXObject) {
            xhr = new ActiveXObject("Microsoft.XMLHTTP"); /* Internet Explorer */
    }
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4) {
            effpwait();
            if (xhr.status == 200) {
                    reponseajax = xhr.responseText;
                    affmsgbox(reponseajax, "", "", 0);
            } else {
                    erreurajax = xhr.status;
                    affmsgbox("Une erreur est survenue.<br />Cette page n'a pas &eacute;t&eacute; envoy&eacute;e<br />&agrave; votre ami(e).", "", "", 0);
            }
        }
    }
    donnees = "envoiami=1";
    donnees+= "&page2="+encodeURIComponent(formami.pageact.value);
    donnees+= "&emailami="+encodeURIComponent(formami.emailami.value);
    donnees+= "&messami="+encodeURIComponent(formami.messami.value);
    donnees+= "&votrenom="+encodeURIComponent(formami.votrenom.value);
    xhr.open("POST", "envoyer-a-un-ami.phtml", true);
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xhr.send(donnees);
}
function affserv(divserv) {
    document.getElementById("serv_dsm").style.zIndex = 0;
    document.getElementById("serv_cg").style.zIndex = 0;
    document.getElementById("serv_cw").style.zIndex = 0;
    document.getElementById(divserv).style.zIndex = 10;
}
datecookie = new Date;
datecookie.setFullYear(datecookie.getFullYear() + 1);
pathcookie = "/";
function setson(mode) {
    Set_Cookie ("cookieson", mode, datecookie);
}
function setreal(modereal) {
    Set_Cookie ("cookiereal", modereal, datecookie);
}
function Set_Cookie(nom, valeur) {
    var argv = Set_Cookie.arguments;
    var argc = Set_Cookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = nom + "=" + escape(valeur) +
    ((expires == null) ? "" : ("; expires = "+expires.toGMTString()))+
    ((path == null) ? "" : ("; path = "+path))+
    ((domain == null) ? "" : ("; domain = "+domain))+
    ((secure == true) ? "; secure" : "");
}
function affichesite(site) {
        newsite = window.open('', 'site');
        newsite.location = site;
}

