var modeDebug = false;

/**
*@desc Permet d'ajouter des évènements au window.onload
*Usage : addLoadEvent(function(){maFonction(monParam)});
*@param string fonction à ajouter
*/
var addLoadEvent = function(func) {
    if(typeof window.addEventListener != 'undefined')
    {
        //.. gecko, safari, konqueror and standard
        window.addEventListener('load', func, false);
    }
    else if(typeof document.addEventListener != 'undefined')
    {
        //.. opera 
        document.addEventListener('load', func, false);
    }
    else if(typeof window.attachEvent != 'undefined')
    {
        //.. win/ie
        window.attachEvent('onload', func);
    }    
    //** remove this condition to degrade older browsers
    else
    {
        //.. mac/ie5 and anything else that gets this far
        if(typeof window.onload == 'function')
        {
            var existing = onload;
            window.onload = function()
            {
                existing();                
                func;
            };
        }
        else
        {
            window.onload = func;
        }
    }
};

/**
*@desc Permet d'ajouter des évènements au window.onresize
*Usage : addResizeEvent(function(){maFonction(monParam)});
*@param string fonction à ajouter
*/
var addResizeEvent = function(func) {
    var oldonresize = window.onresize;
    if (typeof window.onresize != 'function') {
        window.onresize = func;
    } else {
        window.onresize = function() {
            if (oldonresize) {
                oldonresize();
            }
            func();
        }
    }
};

/**
*@desc Permet de connaitre le navigateur
*@return string Nom du navigateur
*/
var navigateur=function() {
	var strChUserAgent = navigator.userAgent;
	var intSplitStart = strChUserAgent.indexOf("(", 0);
	var intSplitEnd = strChUserAgent.indexOf(")", 0);
	var strChStart = strChUserAgent.substring(0, intSplitStart);
	var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
	var strChEnd = strChUserAgent.substring(intSplitEnd);
	
    if(strChMid.indexOf("MSIE 8") != -1)
    {    return "IE8";  }
	if(strChMid.indexOf("MSIE 7") != -1)
	{	return "IE7";  }
	else if(strChMid.indexOf("MSIE 6") != -1)
	{	return "IE6";  }
    else if(strChMid.indexOf("MSIE 6") != -1)
    {    return "IE";  }
	else if(strChEnd.indexOf("Firefox/2") != -1)
	{	return "Firefox2";  }
	else if(strChEnd.indexOf("Firefox") != -1)
	{	return "Firefox";  }
	else if(strChEnd.indexOf("Netscape/7") != -1)
	{	return "NS7";  }
	else if(strChEnd.indexOf("Netscape") != -1)
	{	return "NS";  }
	else if(strChStart.indexOf("Opera/9") != -1)
	{	return "Opera9";  }
	else if(strChStart.indexOf("Opera") != -1)
	{	return "Opera";  }
	else if(strChEnd.indexOf("Safari") != -1)
	{	return "Safari";  }
	else 
	{	return "Autre";  }
};

/**
*@desc Permet de faire fonctionnner les transparences des fichiers png � partir de IE5.5
*/
var correctPNG=function() {
    var browser = navigateur();
    if (browser.indexOf("IE6") != -1) {
        for(var i=0; i<document.images.length; i++) {
            var img = document.images[i];
            var imgName = img.src.toUpperCase();
            if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
            {
                //var dimensionImage = getNaturalDimension(img);
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText 
                if (img.align == "left") imgStyle = "float:left;" + imgStyle
                if (img.align == "right") imgStyle = "float:right;" + imgStyle
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
                + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
                img.outerHTML = strNewHTML
                i = i-1
            }
        }
    }
};
//Ajout de la fonction correctPNG à window.onload
addLoadEvent(correctPNG);

/**
*@desc Pour ajouter le site aux favoris (IE7, Firefox)
*@param string pLibelle Libellé du site
*@param string pUrl domaine
*/
var libelleFavoris = '';
var ajouterFavoris = function(pLibelle, pUrl) {
    siteURL = window.location.href != "" ? window.location.href : pUrl;
    siteNOM = libelleFavoris != "" ? libelleFavoris : pLibelle;
    
    /*-- MESSAGE --*/
    function myMessage (raccourciClavier) {
        alert ("Utilisez '" + raccourciClavier + "'\npour ajouter " + siteNOM + " dans vos favoris !");
    }

    /*-- TRAITEMENT DES NAVIGATEURS --*/

    //Konqueror
    if (navigator.userAgent.indexOf('Konqueror') >= 0) {
    /*Test a effectuer avant tout les autres car repond TRUE aux differents tests sans pouvoir les exploiter*/
        myMessage("CTRL + B");
    }
    else if (window.sidebar) {
        /* Netscape 6+ ; Mozilla, FireFox et compagnie (K-Meleon ...) */
        window.sidebar.addPanel(siteNOM,siteURL,"");
    }
    else if (window.external) {
        /* Internet Explorer 4+, et ses d�riv�s (Crazy Browser, Avent Browser ...) */
        window.external.AddFavorite(siteURL,siteNOM);
    }
    else if (document.all && (navigator.userAgent.indexOf('Win') < 0)) {
        /* Internet Explorer Mac */
        myMessage("POMME + D");
    }
    else if (window.opera && window.print) {
        /* Opera 6+ */
        myMessage("CTRL + T");
    }
    else if (document.layers) {
        /* Netsccape 4 */
        myMessage("CTRL + D");
    }
    else if (navigator.userAgent.indexOf('Safari') >= 0) {
        /* Safari */
        myMessage("POMME + D ou CTRL + D");
    }
    else alert ("Cette fonction n'est pas disponible pour votre navigateur.");
};

/**
*@desc print_r javascript
*@param array array
*@param string pUrl domaine
*@return string
*/
var print_r = function( array, return_val ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Michael White (http://crestidg.com)
    // +   improved by: Ben Bryan
    // *     example 1: print_r(1, true);
    // *     returns 1: 1
    var output = "", pad_char = " ", pad_val = 4;
    var formatArray = function (obj, cur_depth, pad_val, pad_char) {
        if (cur_depth > 0) {
            cur_depth++;
        }

        var base_pad = repeat_char(pad_val*cur_depth, pad_char);
        var thick_pad = repeat_char(pad_val*(cur_depth+1), pad_char);
        var str = "";

        if (obj instanceof Array || obj instanceof Object) {
            str += "Array\n" + base_pad + "(\n";
            for (var key in obj) {
                if (obj[key] instanceof Array) {
                    str += thick_pad + "["+key+"] => "+formatArray(obj[key], cur_depth+1, pad_val, pad_char);
                } else {
                    str += thick_pad + "["+key+"] => " + obj[key] + "\n";
                }
            }
            str += base_pad + ")\n";
        } else {
            str = obj.toString();
        }

        return str;
    };

    var repeat_char = function (len, pad_char) {
        var str = "";
        for(var i=0; i < len; i++) {
            str += pad_char;
        };
        return str;
    };
    output = formatArray(array, 0, pad_val, pad_char);

    if (return_val !== true) {
        document.write("<pre>" + output + "</pre>");
        return true;
    } else {
        return output;
    }
};

/**
*@desc Permet de cacher la div (divIntro) contenant l'intro flash
*@param integer duree_loading Durée de chargement de l'anim d'intro
*@param integer duree_regardee Durée de visionnage de l'anim d'intro
*@param bool regardee_completement true si l'anim a été regardée complètement
*/
var hide_intro = function(duree_loading, duree_regardee, regardee_completement)
{	
	if(typeof(document.getElementById('divIntro')) != 'undefined')
    {
         document.getElementById('divIntro').style.display = 'none';
         var divAnim = document.getElementById(idDivAnim);
         if(divAnim != null) {
            divAnim.innerHTML = tampon_navig;       
         }
         if(document.getElementById('ConteneurQuicksearch') != null)
         {
            document.getElementById('ConteneurQuicksearch').outerHTML = tampon_qs;
         }
         var htmlElement = document.getElementsByTagName('html')[0];
         htmlElement.style.overflow = '';
         if(document.body)
         {                                            
            document.body.style.overflow = "";
         }
		 
		 if (modeDebug) {
		 	alert('duree_loading : ' + duree_loading);
		 	alert('duree_regardee : ' + duree_regardee);
		 	alert('regardee_completement : ' + regardee_completement);
		 }
		 
		 if (duree_loading != undefined) {
		 	if(duree_regardee == undefined) { duree_regardee = 0; }
			if(regardee_completement == undefined) { regardee_completement = 0; }
			
		 	envoiStatsAnim(duree_loading, duree_regardee, regardee_completement);
		 }
    }
};


/**
*@desc Permet d'envoyer les stats fournies par l'anim d'intro, à un script PHP, pour l'enregistrement en base
*@param integer duree_loading Durée de chargement de l'anim d'intro
*@param integer duree_regardee Durée de visionnage de l'anim d'intro
*@param bool regardee_completement true si l'anim a été regardée complètement
*/
var envoiStatsAnim = function(duree_loading, duree_regardee, regardee_completement)
{
    var xhr = createXHR();
    if (modeDebug) {
		xhr.onreadystatechange = function(){
			if (xhr.readyState == 4) {
				if (xhr.status == 200) {
					alert(xhr.responseText);
				}
			}
		};
	}
	
	var adresseURL = document.URL.split('/');

	var urlStats = '/apicius_plateforme2/intro/stats.php?lang=' + adresseURL[3] + '&duree_loading=' + duree_loading + '&duree_regardee=' + duree_regardee+ '&regardee_completement=' + regardee_completement;  
    xhr.open("GET", urlStats , true);
    xhr.send(null);
};

/**
*@desc Permet de rechercher les mots saisis par l'internaute dans des blocs E-news
*@param string mots
*/
var speedsearch = function(modeSearch, mots, exact, aumoins, aucun, langue)
{
	if(document.getElementById('ResultSearch')) {
		document.getElementById('ResultSearch').innerHTML = '';
	}
    if (!exact && !aumoins && !aucun && !langue) {      //Recherche simple 
        //Trim de la valeur envoyée
        mots = mots.replace(/^\s+|\s+$/g, "");
        if (mots != "") {
            var retour = chargePage('speed-search-texte.php?advancedsearch='+(modeSearch == 'advanced' ? 1 : 0)+'&s_q=' + mots, 0, false, 'displayed')
        }
    } else {                                            //Recherche avancée
        //Trim de la valeur envoyée
        mots = mots.replace(/^\s+|\s+$/g, "");
        exact = exact.replace(/^\s+|\s+$/g, "");
        aumoins = aumoins.replace(/^\s+|\s+$/g, "");
        aucun = aucun.replace(/^\s+|\s+$/g, "");
        
        if (mots + exact + aumoins + aucun != "") {
            var retour = chargePage('speed-search-texte.php?advancedsearch='+(modeSearch == 'advanced' ? 1 : 0)+'&s_q=' + mots + '&s_eqp=' + exact + '&s_oq=' + aumoins + '&s_eq=' + aucun + '&s_lg=' + langue, 0, false, 'displayed')
        }
    }
    //Pour ne pas valider le formulaire
    return false;
}

/**
*@desc Permet d'afficher l'heure et qu'elle se rafraichisse
*/
var heureLocale = null;
var intervalleHeureLocale = null;
var refreshTime = function(heure, intervalleSeconde) {
	objectHtmlLocalTime = document.getElementById('localTime');
	if(objectHtmlLocalTime) {
		if(typeof(heure) == 'string') {
			heureTab = heure.split(':');
			heureLocale = new Date();	
			if(heureTab.length == 2) {
				heureLocale.setHours(heureTab[0], heureTab[1]);
			} else if(heureTab.length == 3) {
				heureLocale.setHours(heureTab[0], heureTab[1], heureTab[2]);
			}
		}
		if(typeof(intervalleSeconde) == 'number') {
			intervalleHeureLocale = intervalleSeconde;
		}
		heureLocale.setSeconds(heureLocale.getSeconds() + intervalleHeureLocale);
	   
		var  h = heureLocale.getHours();
		if (h<10) {h = "0" + h}
		
		var m = '';
		if(intervalleHeureLocale <= 60) {
			m = heureLocale.getMinutes();
			if (m<10) {m = "0" + m}
			m = ":" + m;
		}
		
		var s = '';
		if(intervalleHeureLocale <= 1) {
			s = heureLocale.getSeconds();
			if (s<10) {s = "0" + s}
			s = ":" + s;
		}
		
		objectHtmlLocalTime.innerHTML = h+m+s;
		
		setTimeout("refreshTime()", intervalleHeureLocale * 1000);
	}
};
// Fonction a utiliser si vous souhaiter envoyer des infos vers Flash
var emetteurVersFlash = function(nomPage) {
    var doc_flash ;
    
   /* var doc_flash = swfobject.getObjectById("navigation");*/
    
    if(/*!doc_flash && */document.getElementById("navigation"))
    {
        if (navigator.appName.indexOf("Microsoft") != -1)
        {
            doc_flash = window["navigation"];
        }
        else
        {
            if (document["navigation"].length != undefined)
            {
                doc_flash = document["navigation"][1];
            }
            else
            {
                doc_flash = document["navigation"];
            }
        }        
    }
    
    if(doc_flash && doc_flash.recepteurDepuisJavascript) {
        doc_flash.recepteurDepuisJavascript(nomPage);
    }
};


// Fonction a utiliser si vous souhaitez renvoyer des infos depuis Flash
var recepteurDepuisFlash = function(pParam) {
};


//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
//Attention ce n'est pas la fonction d'orige elle à été hacké par Ghislain et Jean pour le support de la molette sous IE
var flashmousewheel=function(e){
   nav = navigateur();
   if(nav.indexOf("IE")!=-1){ document.body.scrollTop-=e.wheelDelta/2; }
 }

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else 
    return src + ext;   
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{
  var str = '<object onmousewheel="flashmousewheel(event);"';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs) {
    str += i + '="' + embedAttrs[i] + '" ';
  }
  str += ' ></embed></object>';
  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "name":
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "id":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

/*--------------------------------------------------------------------------
 *  Smooth Scroller Script, version 1.0.1
 *  (c) 2007 Dezinerfolio Inc. <midart@gmail.com>
 *
 *  For details, please check the website : http://dezinerfolio.com/
 *
/*--------------------------------------------------------------------------*/

Scroller = {
    // control the speed of the scroller.
    // dont change it here directly, please use Scroller.speed=50;
    speed:80,
    shouldStop: false,

    // returns the Y position of the div
    gy: function (d) {
        gy = d.offsetTop;
        if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop;
        return gy;
    },

    // returns the current scroll position
    scrollTop: function (){
        body=document.body;
        d=document.documentElement;
        if (body && body.scrollTop) return body.scrollTop;
        if (d && d.scrollTop) return d.scrollTop;
        if (window.pageYOffset) return window.pageYOffset;
        return 0;
    },

    // attach an event for an element
    // (element, type, function)
    add: function(element, type, d) {
        if (element.addEventListener) return element.addEventListener(type, d,false);
        if (element.attachEvent) return element.attachEvent('on'+type, d);
    },

    // kill an event of an element
    end: function(e){
        if (window.event) {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
            return;
        }
        if (e.preventDefault && e.stopPropagation) {
          e.preventDefault();
          e.stopPropagation();
        }
    },
    
    // move the scroll bar to the particular div.
    scroll: function(d){
        if(Scroller.shouldStop) return;
        i = window.innerHeight || document.documentElement.clientHeight;
        h=document.body.scrollHeight;
        a = Scroller.scrollTop();
        if(d>a)
            if(h-d>i)
                a+=Math.ceil((d-a)/Math.abs(100-Scroller.speed));
            else
                a+=Math.ceil((d-a-(h-d))/Math.abs(100-Scroller.speed));
        else
            a = a+(d-a)/Math.abs(100-Scroller.speed);
        window.scrollTo(0,a);
        if(a==d || Scroller.offsetTop==a) clearInterval(Scroller.interval);
            Scroller.offsetTop=a;
    },
    scrollToElement : function(el){
        this.shouldStop = false; 
        Scroller.end(this); 
        clearInterval(Scroller.interval); 
        Scroller.interval=setInterval('Scroller.scroll('+Scroller.gy(el)+')',10);  
    },
    requestStop : function(){
        Scroller.shouldStop = true;
    },
    init : function(){
        /** Firefox. */
         if (window.addEventListener)
        window.addEventListener('DOMMouseScroll', Scroller.requestStop, false);
        /** IE/Opera. */
        window.onmousewheel = document.onmousewheel = Scroller.requestStop;
    }
}

Scroller.init();


/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
/**
 * Fichier inclu pour gérer l'historique navigateur avec Ajax
 * Fait le 26/05/2009 par Frédérik BOBET
 */


/**
 * Fonction qui récupère l'ancre ajoutée par le gestionnaire d'historique (#histoire-tradition.php)
 * @param {String} url adresse url contenant l'ancre (http://www.aide1.fr/fr/restaurant.php#histoire-tradition.php)
 * @return (String) histoire-tradition.php
 */
var getAjaxAnchor = function(url) 
{ 
    if( url.length == 0 ) return ""; 
    var sharp = url.lastIndexOf("#"); 
    if( sharp == -1 ) return ""; 
    var page = url.substr(sharp+1,url.length); 
    return page; 
}; 

/**
 * Fonction qui récupère le début de l'url (http://www.aide1.fr/fr)
 * @param {String} url adresse url complète
 * @return (String) http://www.aide1.fr/fr
 */
var getBaseFolder = function(url)
{
    var arrayUrl = url.split("/");
    arrayUrl.pop();
    return arrayUrl.join("/");
};

/**
 * Fonction qui test si le format de str est bien [String].php
 * @param {String} str
 * @return (Boolean) Résultat du test isPagePhp
 */
var isPagePhp = function(str)
{ 
    var arrayPage = str.split("\.");
    if(arrayPage.length != 2) return false;
    if(arrayPage[1] != 'php') return false;
    return true;
};

var url = window.location.href;
var pagePhp = getAjaxAnchor(url);
if(pagePhp != "" && isPagePhp(pagePhp)){
    window.location.href = getBaseFolder(url)+"/"+pagePhp;
} 







//*********** juste avant le <body>: placer le code suivant (entete_typeX.php)(remplacer les informations compte et email si nécessaire):
//<script type="text/javascript">
//    var _Pagename     = "<?=affiche_titre_pdv()?>";
//    var _Compte     = "compte";
//    var _fma        = "email";
//    var fcn="fs"+_Compte;var fid="";var exdate=new Date();_fstart=exdate.getTime();charSet="";if(document.cookie.length>0){fcs=document.cookie.indexOf(fcn+"=");if(fcs!=-1){fcs=fcs+fcn.length+1;fce=document.cookie.indexOf(";",fcs);if(fce==-1)fce=document.cookie.length;fid=unescape(document.cookie.substring(fcs,fce));}}if(fid==""){for (var i=1;i<20;++i){charSet="0abc1def2ijk3lmn4opq5rst6uvw7xyz89";fid=fid+charSet.charAt(Math.floor(Math.random()*(charSet.length-0))+0);}exdate.setDate(exdate.getDate()+365);document.cookie=fcn+"="+escape(fid)+((365==null) ? "" : ";expires="+exdate.toGMTString());}
//    document.write("<img id='perferencement_simple' src='http://www.efficienttraffic.com/config/statv3.php?Lg="+_Compte+"&page="+_Pagename+"&us="+escape(location.href)+"&reso_w="+screen.width+"&reso_h="+screen.height+"&color="+screen.colorDepth+"&referer="+escape(window.document.referrer)+"&idfs="+fid+"&fma="+_fma+"' style='visibility:hidden;width:0px;height:0px;border:none;postion:absolute;'>");
//</script>
//
//*********** juste avant le </body> placer le code suivant (pied_typeX.php):
//<script type="text/javascript">
//    _fdt=new Date;_fend=_fdt.getTime();_ftc=(_fend-_fstart)/1000;
//    document.write("<img id='perferencement_rebond' src='http://www.efficienttraffic.com/config/statv3_off.php?Lg="+_Compte+"&ftc="+_ftc+"' style='visibility:hidden;width:0px;height:0px;border:none;postion:absolute;'>");
//</script>
//

var perferencement = {
    reload_tag_simple: function(_Pagename){
        var fcn="fs"+_Compte;var fid="";var exdate=new Date();_fstart=exdate.getTime();charSet="";if(document.cookie.length>0){fcs=document.cookie.indexOf(fcn+"=");if(fcs!=-1){fcs=fcs+fcn.length+1;fce=document.cookie.indexOf(";",fcs);if(fce==-1)fce=document.cookie.length;fid=unescape(document.cookie.substring(fcs,fce));}}if(fid==""){for (var i=1;i<20;++i){charSet="0abc1def2ijk3lmn4opq5rst6uvw7xyz89";fid=fid+charSet.charAt(Math.floor(Math.random()*(charSet.length-0))+0);}exdate.setDate(exdate.getDate()+365);document.cookie=fcn+"="+escape(fid)+((365==null) ? "" : ";expires="+exdate.toGMTString());}
        document.getElementById("perferencement_simple").src = "http://www.efficienttraffic.com/config/statv3.php?Lg="+_Compte+"&page="+_Pagename+"&us="+escape(location.href)+"&reso_w="+screen.width+"&reso_h="+screen.height+"&color="+screen.colorDepth+"&referer="+escape(window.document.referrer)+"&idfs="+fid+"&fma="+_fma+"&Dummy="+Math.random();    
    },
    reload_tag_rebond: function(){
        _fdt=new Date;_fend=_fdt.getTime();_ftc=(_fend-_fstart)/1000;
        document.getElementById("perferencement_rebond").src = "http://www.efficienttraffic.com/config/statv3_off.php?Lg="+_Compte+"&ftc="+_ftc+"&Dummy="+Math.random();    
    }
}
Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
};


var set_stylesheet = function(){
	var arrayurl = window.location.href.split('/');
	var url_page=arrayurl.pop();
	chargePagePlugin.Exec('',url_page);
};

var chargePagePlugin = {
	Params: '',
	Exec : function(p,url){
		active_style(url);
	}
};
var active_style = function(url){
    tabURL = url.split('?');
    url = tabURL[0];
	if(typeof(styles_page[url])!="undefined"){
		var active_styles = styles_page[url];        
	}else{
        var active_styles = ['default'];
    }
		
		for(i=0;(a = document.getElementsByTagName("link")[i]);i++){
			if(active_styles.in_array(a.getAttribute("href"))){
			  //alert('enable: '+a.getAttribute("href"));
				a.media='screen';
				a.disabled=false;
			}
			else {
				if(a.getAttribute("ref")=="switch"){
				  //alert('disable: '+a.getAttribute("href"));
					a.media='none';
					a.disabled=true;
				}
			}
			
		}
};

if (window.addEventListener) {
  window.addEventListener("load",set_stylesheet,false);
} else if (window.attachEvent) {
  window.attachEvent("onload",set_stylesheet);
} else {
  addLoadEvent(function(){set_stylesheet();})
}



//Fonction d'appel des pages E-NEWS et Tracking
var pop = function(pLien, id_track, pBoolean,QuickEdit) {
    var taille = GetWindowSize();
    lyteflash(pLien,taille[0],taille[1]);
    //Click(id_track);
    if(typeof(QuickEdit)!='undefined' && typeof(quickedit)!='undefined'){
        //variable déclarée globale dans les header (header_static.php) quand on est authentidfied
        quickedit=true;
    }
    if (!pBoolean) return pBoolean; 
    
} 

var lyteflash = function(url,width,height) {

   var objLink = document.createElement('a');
   objLink.setAttribute('href',url);
   objLink.setAttribute('rel','lyteframe');
   objLink.setAttribute('rev','width:'+width+';height:'+height+';')          
   myLytebox.start(objLink, false, true);

}

var isset=function(variable){
  if ( typeof(variable) != "undefined" ) {
    return true;
  }
  else {
    return false;
  }
}

/*
Fonction de détection de la taille interne de la fenêtre
*/
GetWindowSize = function() {
        w = window;
        //var popLargeur = 680;
        //var popHauteur = 500;
        if(typeof(popLargeur) != "undefined" && typeof(popHauteur) != "undefined")
        {
          var width = popLargeur != '' && popLargeur>0 ? popLargeur : 680;
          var height = popHauteur != '' && popLargeur>0 ? popHauteur : 500;
        }
        else
        {
          var width = 680;
          var height = 500;
        }
        width = width + 4;
        return [width, height]
}


/*
var xmlhttp = false;
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
}
*/
function Click(a) {
    if (a != 0) {
        fragment_url = '/clic.php?sort='+a;
        xmlhttp.open("GET", fragment_url);
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                tmp = xmlhttp.responseText;
            }
        }
        xmlhttp.send(null);
    }
}

 
//***********************************************************************************************************************************/
//    LyteBox v3.22
//
//     Author: Markus F. Hay
//  Website: http://www.dolem.com/lytebox
//       Date: October 2, 2007
//    License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
//                * Firefox: 2.0.0.7, 1.5.0.12
//                * Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
//                * Opera: 9.23
//
// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62
//                * v3.22 (10/02/07)
//                * v3.21 (09/30/07)
//                * v3.20 (07/12/07)
//                * v3.10 (05/28/07)
//                * v3.00 (05/15/07)
//                * v2.02 (11/13/06)
//
//   Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
//             information please visit http://huddletogether.com/projects/lightbox2/
//***********************************************************************************************************************************/
Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } }
Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }

var nb_popenews = 0;



function LyteBox() {
    /*** Start Global Configuration ***/
        this.theme                = 'grey';    // themes: grey (default), red, green, blue, gold
        this.hideFlash            = false;        // controls whether or not Flash objects should be hidden
        this.outerBorder        = true;        // controls whether to show the outer grey (or theme) border
        this.resizeSpeed        = 10;        // controls the speed of the image resizing (1=slowest and 10=fastest)
        this.maxOpacity            = 60;        // higher opacity = darker overlay, lower opacity = lighter overlay
        this.navType            = 1;        // 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
        this.autoResize            = true;        // controls whether or not images should be resized if larger than the browser window dimensions
        this.doAnimations        = false;        // controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.
        
        this.borderSize            = 0;        // if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
    /*** End Global Configuration ***/
    
    /*** Configure Slideshow Options ***/
        this.slideInterval        = 4000;        // Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
        this.showNavigation        = true;        // true to display Next/Prev buttons/text during slideshow, false to hide
        this.showClose            = true;        // true to display the Close button, false to hide
        this.showDetails        = true;        // true to display image details (caption, count), false to hide
        this.showPlayPause        = true;        // true to display pause/play buttons next to close button, false to hide
        this.autoEnd            = false;        // true to automatically close Lytebox after the last image is reached, false to keep open
        this.pauseOnNextClick    = false;    // true to pause the slideshow when the "Next" button is clicked
        this.pauseOnPrevClick     = true;        // true to pause the slideshow when the "Prev" button is clicked
    /*** End Slideshow Configuration ***/
    
    if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
    if(this.resizeSpeed < 1) { resizeSpeed = 1; }
    this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
    this.resizeWTimerArray        = new Array();
    this.resizeWTimerCount        = 0;
    this.resizeHTimerArray        = new Array();
    this.resizeHTimerCount        = 0;
    this.showContentTimerArray    = new Array();
    this.showContentTimerCount    = 0;
    this.overlayTimerArray        = new Array();
    this.overlayTimerCount        = 0;
    this.imageTimerArray        = new Array();
    this.imageTimerCount        = 0;
    this.timerIDArray            = new Array();
    this.timerIDCount            = 0;
    this.slideshowIDArray        = new Array();
    this.slideshowIDCount        = 0;
    this.imageArray     = new Array();
    this.activeImage = null;
    this.slideArray     = new Array();
    this.activeSlide = null;
    this.frameArray     = new Array();
    this.activeFrame = null;
    this.checkFrame();
    this.isSlideshow = false;
    this.isLyteframe = true;
    /*@cc_on
        /*@if (@_jscript)
            this.ie = (document.all && !window.opera) ? true : false;
        /*@else @*/
            this.ie = false;
        /*@end
    @*/
    this.ie7 = (this.ie && window.XMLHttpRequest);
    this.ie8 = (navigator.appVersion.indexOf("MSIE 8.0")!=-1);   
    this.initialize();
}
LyteBox.prototype.initialize = function() {
    this.updateLyteboxItems();
    var objBody = this.doc.getElementsByTagName("body").item(0);    
    if (this.doc.getElementById('lbOverlay')) {
        objBody.removeChild(this.doc.getElementById("lbOverlay"));
        objBody.removeChild(this.doc.getElementById("lbMain"));
        
    }
    
    var objOverlay = this.doc.createElement("div");
        objOverlay.setAttribute('id','lbOverlay');
        objOverlay.setAttribute('className', this.theme);
        objOverlay.setAttribute('class', this.theme);
        if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) {
            objOverlay.style.position = 'absolute';
        }
        objOverlay.style.display = 'none';
        objBody.appendChild(objOverlay);
        
    var objLytebox = this.doc.createElement("div");
        objLytebox.setAttribute('id','lbMain');
        objLytebox.style.display = 'none';
        objBody.appendChild(objLytebox);
        
    var objDetailsContainer = this.doc.createElement("div");
        objDetailsContainer.setAttribute('id','lbDetailsContainer');
        objDetailsContainer.setAttribute('className', 'dialog_content dialog_nw dialog_ne');
        objDetailsContainer.setAttribute('class', 'dialog_content dialog_nw dialog_ne');
        objLytebox.appendChild(objDetailsContainer); 
        
    var objOuterContainer = this.doc.createElement("div");
        objOuterContainer.setAttribute('id','lbOuterContainer');
        objOuterContainer.setAttribute('className', 'dialog_content dialog_sw dialog_se');
        objOuterContainer.setAttribute('class', 'dialog_content dialog_sw dialog_se');
        objLytebox.appendChild(objOuterContainer);
        
    var objIframeContainer = this.doc.createElement("div");
        objIframeContainer.setAttribute('id','lbIframeContainer');
        objIframeContainer.style.display = 'none';
        objOuterContainer.appendChild(objIframeContainer);
        
    var objIframe = this.doc.createElement("iframe");
        objIframe.setAttribute('id','lbIframe');
        objIframe.setAttribute('name','lbIframe');
        objIframe.setAttribute('frameborder',0); 
        objIframe.style.display = 'none';
        objIframeContainer.appendChild(objIframe);
        
    var objImageContainer = this.doc.createElement("div");
        objImageContainer.setAttribute('id','lbImageContainer');
        objOuterContainer.appendChild(objImageContainer);
        
    var objLyteboxImage = this.doc.createElement("img");
        objLyteboxImage.setAttribute('id','lbImage');
        objImageContainer.appendChild(objLyteboxImage);
        
    var objLoading = this.doc.createElement("div");
        objLoading.setAttribute('id','lbLoading');
        objOuterContainer.appendChild(objLoading);
              
    var objDetailsData =this.doc.createElement("div");
        objDetailsData.setAttribute('id','lbDetailsData');
        objDetailsData.setAttribute('className', 'dialog_content');
        objDetailsData.setAttribute('class', 'dialog_content');
        objDetailsContainer.appendChild(objDetailsData);
        
    var objDetails = this.doc.createElement("div");
        objDetails.setAttribute('id','lbDetails');
        objDetailsData.appendChild(objDetails);
    var objCaption = this.doc.createElement("span");
        objCaption.setAttribute('id','lbCaption');
        objDetails.appendChild(objCaption);
    var objHoverNav = this.doc.createElement("div");
        objHoverNav.setAttribute('id','lbHoverNav');
        objImageContainer.appendChild(objHoverNav);
    var objBottomNav = this.doc.createElement("div");
        objBottomNav.setAttribute('id','lbBottomNav');
        objBottomNav.setAttribute('className', 'dialog_close');
        objBottomNav.setAttribute('class', 'dialog_close');
        objDetailsData.appendChild(objBottomNav);
    var objPrev = this.doc.createElement("a");
        objPrev.setAttribute('id','lbPrev');
        objPrev.setAttribute('className', this.theme);
        objPrev.setAttribute('class', this.theme);
        objPrev.setAttribute('href','#');
        objHoverNav.appendChild(objPrev);
    var objNext = this.doc.createElement("a");
        objNext.setAttribute('id','lbNext');
        objNext.setAttribute('className', this.theme);
        objNext.setAttribute('class', this.theme);
        objNext.setAttribute((this.ie && !this.ie8 ? 'className' : 'class'), this.theme);
        objNext.setAttribute('href','#');
        objHoverNav.appendChild(objNext);
    var objNumberDisplay = this.doc.createElement("span");
        objNumberDisplay.setAttribute('id','lbNumberDisplay');
        objDetails.appendChild(objNumberDisplay);
    var objNavDisplay = this.doc.createElement("span");
        objNavDisplay.setAttribute('id','lbNavDisplay');
        objNavDisplay.style.display = 'none';
        objDetails.appendChild(objNavDisplay);
    
    var objCloseGlobal = this.doc.createElement("span");
        objCloseGlobal.setAttribute('id','lbCloseGlobal');
        objCloseGlobal.setAttribute('className', 'dialog_close');
        objCloseGlobal.setAttribute('class', 'dialog_close');
        objBottomNav.appendChild(objCloseGlobal);
    
    
    var objClose = this.doc.createElement("a");
        objClose.setAttribute('id','lbClose');
        objClose.setAttribute('className', this.theme);
        objClose.setAttribute('class', this.theme);
        objClose.setAttribute('href','#');
        objCloseGlobal.appendChild(objClose);
    var objCloseText = this.doc.createElement("a");
        objCloseText.setAttribute('id','lbCloseText');
        objCloseText.setAttribute('href','#');
        objCloseGlobal.appendChild(objCloseText);
    var objPause = this.doc.createElement("a");
        objPause.setAttribute('id','lbPause');
        objPause.setAttribute('className', this.theme);
        objPause.setAttribute('class', this.theme);
        objPause.setAttribute('href','#');
        objPause.style.display = 'none';
        objBottomNav.appendChild(objPause);
    var objPlay = this.doc.createElement("a");
        objPlay.setAttribute('id','lbPlay');
        objPlay.setAttribute('className', this.theme);
        objPlay.setAttribute('class', this.theme);
        objPlay.setAttribute('href','#');
        objPlay.style.display = 'none';
        objBottomNav.appendChild(objPlay);
        
};
LyteBox.prototype.updateLyteboxItems = function() {    
    //var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
    var anchors = document.getElementsByTagName('a');
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        var relAttribute = String(anchor.getAttribute('rel'));
        if (anchor.getAttribute('href')) {
            if (relAttribute.toLowerCase().match('lytebox')) {
                anchor.onclick = function () { myLytebox.start(this, false, false); return false; }
            } else if (relAttribute.toLowerCase().match('lyteshow')) {
                anchor.onclick = function () { myLytebox.start(this, true, false); return false; }
            } else if (relAttribute.toLowerCase().match('lyteframe')) {
                anchor.onclick = function () { myLytebox.start(this, false, true); return false; }
            }
        }
    }
};
LyteBox.prototype.start = function(imageLink, doSlide, doFrame) {
    if (this.ie && !this.ie7) {    this.toggleSelects('hide');    }
    if (this.hideFlash) { this.toggleFlash('hide'); }
    this.isLyteframe = (doFrame ? true : false);
    var pageSize    = this.getPageSize();
    var objOverlay    = this.doc.getElementById('lbOverlay');
    var objBody        = this.doc.getElementsByTagName("body").item(0);
    objOverlay.style.height = pageSize[1] + "px";
    objOverlay.style.display = '';
    this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity));
    var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
    if (this.isLyteframe) {
        this.frameArray = [];
        this.frameNum = 0;
        var taille = GetWindowSize(popLargeur,popHauteur);
        if ((imageLink.getAttribute('rel') == 'lyteframe')) {
            var rev = imageLink.getAttribute('rev');
            this.frameArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: '+taille[0]+'; height: '+taille[1]+'; scrolling: auto;' : rev)));
        } else {
            if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) {
                for (var i = 0; i < anchors.length; i++) {
                    var anchor = anchors[i];
                    if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
                        var rev = anchor.getAttribute('rev');
                        this.frameArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: '+taille[0]+'; height: '+taille[1]+'; scrolling: auto;' : rev)));
                    }
                }
                this.frameArray.removeDuplicates();
                while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('href')) { this.frameNum++; }
            }
        }
    } else {
        this.imageArray = [];
        this.imageNum = 0;
        this.slideArray = [];
        this.slideNum = 0;
        if ((imageLink.getAttribute('rel') == 'lytebox')) {
            this.imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
        } else {
            if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) {
                for (var i = 0; i < anchors.length; i++) {
                    var anchor = anchors[i];
                    if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
                        this.imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
                    }
                }
                this.imageArray.removeDuplicates();
                while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('href')) { this.imageNum++; }
            }
            if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) {
                for (var i = 0; i < anchors.length; i++) {
                    var anchor = anchors[i];
                    if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
                        this.slideArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
                    }
                }
                this.slideArray.removeDuplicates();
                while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('href')) { this.slideNum++; }
            }
        }
    }
    var object = this.doc.getElementById('lbMain');
    object.style.top = (this.getPageScroll() + (pageSize[3] / 20)) + "px";
    object.style.display = '';
    if (!this.outerBorder) {
        //this.doc.getElementById('lbOuterContainer').style.border = 'none';
        //this.doc.getElementById('lbDetailsContainer').style.border = 'none';
    } else {
        //this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
        //this.doc.getElementById('lbOuterContainer').setAttribute((this.ie && !this.ie8 ? 'className' : 'class'), 'dialog_content dialog_e');
    }
    //this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }
    this.doc.getElementById('lbMain').onclick = function(e) {
        var e = e;
        if (!e) {
            if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
                e = window.parent.window.event;
            } else {
                e = window.event;
            }
        }
        var id = (e.target ? e.target.id : e.srcElement.id);
        //if (id == 'lbMain') { myLytebox.end(); return false; }
    }
    this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }
    this.doc.getElementById('lbCloseText').onclick = function() { myLytebox.end(); return false; }
    this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }
    this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }    
    this.isSlideshow = doSlide;
    this.isPaused = (this.slideNum != 0 ? true : false);
    if (this.isSlideshow && this.showPlayPause && this.isPaused) {
        this.doc.getElementById('lbPlay').style.display = '';
        this.doc.getElementById('lbPause').style.display = 'none';
    }
    if (this.isLyteframe) {
        this.changeContent(this.frameNum);
    } else {
        if (this.isSlideshow) {
            this.changeContent(this.slideNum);
        } else {
            this.changeContent(this.imageNum);
        }
    }
};
LyteBox.prototype.changeContent = function(imageNum) {
    if (this.isSlideshow) {
        for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
    }
    this.activeImage = this.activeSlide = this.activeFrame = imageNum;
    if (!this.outerBorder) {
        //this.doc.getElementById('lbOuterContainer').style.border = 'none';
        //this.doc.getElementById('lbDetailsContainer').style.border = 'none';
    } else {
        //this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
        //this.doc.getElementById('lbOuterContainer').setAttribute((this.ie && !this.ie8 ? 'className' : 'class'), 'dialog_content dialog_e');
    }
    this.doc.getElementById('lbLoading').style.display = '';
    this.doc.getElementById('lbImage').style.display = 'none';
    this.doc.getElementById('lbIframe').style.display = 'none';
    this.doc.getElementById('lbPrev').style.display = 'none';
    this.doc.getElementById('lbNext').style.display = 'none';
    this.doc.getElementById('lbIframeContainer').style.display = 'none';
    //this.doc.getElementById('lbDetailsContainer').style.display = 'none';
    this.doc.getElementById('lbNumberDisplay').style.display = 'none';
    if (this.navType == 2 || this.isLyteframe) {
        object = this.doc.getElementById('lbNavDisplay');
        object.innerHTML = '&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">&laquo; prev</span><a href="#" id="lbPrev2" class="' + this.theme + '" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b> <span id="lbNext2_Off" style="display: none;" class="' + this.theme + '">next &raquo;</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next &raquo;</a>';
        object.style.display = 'none';
    }
    if (this.isLyteframe) {
        var iframe = myLytebox.doc.getElementById('lbIframe');
        var styles = this.frameArray[this.activeFrame][2];
        var aStyles = styles.split(';');
        for (var i = 0; i < aStyles.length; i++) {
            if (aStyles[i].indexOf('width:') >= 0) {
                var w = aStyles[i].replace('width:', '');
                iframe.width = w.trim();
            } else if (aStyles[i].indexOf('height:') >= 0) {
                var h = aStyles[i].replace('height:', '');
                iframe.height = h.trim();
            } else if (aStyles[i].indexOf('scrolling:') >= 0) {
                var s = aStyles[i].replace('scrolling:', '');
                iframe.scrolling = s.trim();
            } else if (aStyles[i].indexOf('border:') >= 0) {
                // Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
                //var b = aStyles[i].replace('border:', '');
                //iframe.style.border = b.trim();
            }
        }
        this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
    } else {
        imgPreloader = new Image();
        imgPreloader.onload = function() {
            var imageWidth = imgPreloader.width;
            var imageHeight = imgPreloader.height;
            if (myLytebox.autoResize) {
                var pagesize = myLytebox.getPageSize();
                var x = pagesize[2] - 150;
                var y = pagesize[3] - 150;
                if (imageWidth > x) {
                    imageHeight = Math.round(imageHeight * (x / imageWidth));
                    imageWidth = x; 
                    if (imageHeight > y) { 
                        imageWidth = Math.round(imageWidth * (y / imageHeight));
                        imageHeight = y; 
                    }
                } else if (imageHeight > y) { 
                    imageWidth = Math.round(imageWidth * (y / imageHeight));
                    imageHeight = y; 
                    if (imageWidth > x) {
                        imageHeight = Math.round(imageHeight * (x / imageWidth));
                        imageWidth = x;
                    }
                }
            }
            var lbImage = myLytebox.doc.getElementById('lbImage')
            lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);
            lbImage.width = imageWidth;
            lbImage.height = imageHeight;
            myLytebox.resizeContainer(imageWidth, imageHeight);
            imgPreloader.onload = function() {};
        }
        imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
    }
};
LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {
    this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;
    this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;
    this.xScale = (((imgWidth  + (this.borderSize * 2)) / this.wCur) * 100);
    this.yScale = ((imgHeight  + (this.borderSize * 2)) / this.hCur) * 100;
    var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;
    var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;
    if (!(hDiff == 0)) {
        this.hDone = false;
        this.resizeH('lbOuterContainer', this.hCur, imgHeight, this.getPixelRate(this.hCur, imgHeight));
    } else {
        this.hDone = true;
    }
    if (!(wDiff == 0)) {
        this.wDone = false;
        this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));
    } else {
        this.wDone = true;
    }
    if ((hDiff == 0) && (wDiff == 0)) {
        if (this.ie){ this.pause(250); } else { this.pause(100); } 
    }
    offsetIE = 0;
    if(this.ie){
        offsetIE = 2;
    }
    this.doc.getElementById('lbPrev').style.height = imgHeight + "px";
    this.doc.getElementById('lbNext').style.height = imgHeight + "px";
    this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth - offsetIE + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";
    if(typeof(largeur_pourcent) != "undefined")
    {
      if(largeur_pourcent == 1)
      {
        this.doc.getElementById('lbDetailsContainer').style.width = imgWidth + "%";
        this.doc.getElementById('lbOuterContainer').style.width = imgWidth + "%";
        this.doc.getElementById('lbIframe').style.width = "100%";
      }
    }
    /*POSITIONNEMENT VERTICAL*/
    if(typeof(hauteur_pourcent) != "undefined")
    {
      if(hauteur_pourcent == 1)
      {
        var percentheight = document.body.clientHeight*(imgHeight/100);
        this.doc.getElementById('lbOuterContainer').style.height = document.body.clientHeight*(imgHeight/100) + "px";
        this.doc.getElementById('lbIframe').style.height = "100%";
        /*
        if(typeof(decalage_top) == "undefined")
        {
          //Calcul du décalage depuis le haut pour centrer la pop dans l'espace vertical disponible
          var percenttop = ((document.body.clientHeight-(document.body.clientHeight*(imgHeight/100)))/2)-30;
          if(percenttop>0 && percenttop<500)
          {
            this.doc.getElementById('lbMain').style.top = percenttop + "px";
          }
        }*/
      }
    }
    else
    {
      /*
      if(typeof(decalage_top) == "undefined")
      {
        //Calcul du décalage depuis le haut pour centrer la pop dans l'espace vertical disponible
        var percenttop = ((document.body.clientHeight-imgHeight)/2)-30;
        if(percenttop>0 && percenttop<500)
        {
          this.doc.getElementById('lbMain').style.top = percenttop + "px";
        }
      }
      */
    }
    
    if(typeof(decalage_top) != "undefined")
    {
      if(decalage_top>=0 && decalage_top<500)
      {
        this.doc.getElementById('lbMain').style.top = decalage_top + "px";
      }
    }

    

    this.showContent();
};
LyteBox.prototype.showContent = function() {
    if (this.wDone && this.hDone) {
        for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }
        if (this.outerBorder) {
            //this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';
        }
        this.doc.getElementById('lbLoading').style.display = 'none';
        if (this.isLyteframe) {
            this.doc.getElementById('lbIframe').style.display = '';
            this.appear('lbIframe', (this.doAnimations ? 0 : 100));
        } else {
            this.doc.getElementById('lbImage').style.display = '';
            this.appear('lbImage', (this.doAnimations ? 0 : 100));
            this.preloadNeighborImages();
        }
        if (this.isSlideshow) {
            if(this.activeSlide == (this.slideArray.length - 1)) {
                if (this.autoEnd) {
                    this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);
                }
            } else {
                if (!this.isPaused) {
                    this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);
                }
            }
            this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');
            this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');
            this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none');
            this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');
            this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');
            this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');
        } else {
            this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');
            if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
                this.doc.getElementById('lbNavDisplay').style.display = '';
            } else {
                this.doc.getElementById('lbNavDisplay').style.display = 'none';
            }
            this.doc.getElementById('lbClose').style.display = '';
            this.doc.getElementById('lbDetails').style.display = '';
            this.doc.getElementById('lbPause').style.display = 'none';
            this.doc.getElementById('lbPlay').style.display = 'none';
        }
        this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
        this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
        try {                 
            this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];
            this.doc.getElementById('lbIframe').frameBorder = '0';
        } catch(e) { }
    } else {
        this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);
    }
};   
LyteBox.prototype.updateDetails = function() {
    var object = this.doc.getElementById('lbCaption');
    var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));
    object.style.display = '';
    object.innerHTML = (sTitle == null ? '' : sTitle);
    this.updateNav();
    this.doc.getElementById('lbDetailsContainer').style.display = '';
    //Gestion du bouton fermer/close
    object = this.doc.getElementById('lbCloseText');
    object.innerHTML = '<span>'+popBoutonFermeture+'</span>';
    //FIN
    object = this.doc.getElementById('lbNumberDisplay');
    if (this.isSlideshow && this.slideArray.length > 1) {
        object.style.display = '';
        object.innerHTML = "Image " + eval(this.activeSlide + 1) + " of " + this.slideArray.length;
        this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');
    } else if (this.imageArray.length > 1 && !this.isLyteframe) {
        object.style.display = '';
        object.innerHTML = "Image " + eval(this.activeImage + 1) + " of " + this.imageArray.length;
        this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');
    } else if (this.frameArray.length > 1 && this.isLyteframe) {
        object.style.display = '';
        object.innerHTML = "Page " + eval(this.activeFrame + 1) + " of " + this.frameArray.length;
        this.doc.getElementById('lbNavDisplay').style.display = '';
    } else {
        this.doc.getElementById('lbNavDisplay').style.display = 'none';
    }
    this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));
};
LyteBox.prototype.updateNav = function() {
    if (this.isSlideshow) {
        if (this.activeSlide != 0) {
            var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
                object.style.display = '';
                object.onclick = function() {
                    if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
                    myLytebox.changeContent(myLytebox.activeSlide - 1); return false;
                }
        } else {
            if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
        }
        if (this.activeSlide != (this.slideArray.length - 1)) {
            var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
                object.style.display = '';
                object.onclick = function() {
                    if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
                    myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
                }
        } else {
            if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
        }
    } else if (this.isLyteframe) {
        if(this.activeFrame != 0) {
            var object = this.doc.getElementById('lbPrev2');
                object.style.display = '';
                object.onclick = function() {
                    myLytebox.changeContent(myLytebox.activeFrame - 1); return false;
                }
        } else {
            this.doc.getElementById('lbPrev2_Off').style.display = '';
        }
        if(this.activeFrame != (this.frameArray.length - 1)) {
            var object = this.doc.getElementById('lbNext2');
                object.style.display = '';
                object.onclick = function() {
                    myLytebox.changeContent(myLytebox.activeFrame + 1); return false;
                }
        } else {
            this.doc.getElementById('lbNext2_Off').style.display = '';
        }        
    } else {
        if(this.activeImage != 0) {
            var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
                object.style.display = '';
                object.onclick = function() {
                    myLytebox.changeContent(myLytebox.activeImage - 1); return false;
                }
        } else {
            if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
        }
        if(this.activeImage != (this.imageArray.length - 1)) {
            var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
                object.style.display = '';
                object.onclick = function() {
                    myLytebox.changeContent(myLytebox.activeImage + 1); return false;
                }
        } else {
            if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
        }
    }
    this.enableKeyboardNav();
};
LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; };
LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; };
LyteBox.prototype.keyboardAction = function(e) {
    var keycode = key = escape = null;
    keycode    = (e == null) ? event.keyCode : e.which;
    key        = String.fromCharCode(keycode).toLowerCase();
    escape  = (e == null) ? 27 : e.DOM_VK_ESCAPE;
    if ((key == 'x') || (key == 'c') || (keycode == escape)) {
        myLytebox.end();
    } else if ((key == 'p') || (keycode == 37)) {
        if (myLytebox.isSlideshow) {
            if(myLytebox.activeSlide != 0) {
                myLytebox.disableKeyboardNav();
                myLytebox.changeContent(myLytebox.activeSlide - 1);
            }
        } else if (myLytebox.isLyteframe) {
            if(myLytebox.activeFrame != 0) {
                myLytebox.disableKeyboardNav();
                myLytebox.changeContent(myLytebox.activeFrame - 1);
            }
        } else {
            if(myLytebox.activeImage != 0) {
                myLytebox.disableKeyboardNav();
                myLytebox.changeContent(myLytebox.activeImage - 1);
            }
        }
    } else if ((key == 'n') || (keycode == 39)) {
        if (myLytebox.isSlideshow) {
            if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {
                myLytebox.disableKeyboardNav();
                myLytebox.changeContent(myLytebox.activeSlide + 1);
            }
        } else if (myLytebox.isLyteframe) {
            if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {
                myLytebox.disableKeyboardNav();
                myLytebox.changeContent(myLytebox.activeFrame + 1);
            }
        } else {
            if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {
                myLytebox.disableKeyboardNav();
                myLytebox.changeContent(myLytebox.activeImage + 1);
            }
        }
    }
};
LyteBox.prototype.preloadNeighborImages = function() {
    if (this.isSlideshow) {
        if ((this.slideArray.length - 1) > this.activeSlide) {
            preloadNextImage = new Image();
            preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];
        }
        if(this.activeSlide > 0) {
            preloadPrevImage = new Image();
            preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];
        }
    } else {
        if ((this.imageArray.length - 1) > this.activeImage) {
            preloadNextImage = new Image();
            preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
        }
        if(this.activeImage > 0) {
            preloadPrevImage = new Image();
            preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
        }
    }
};
LyteBox.prototype.togglePlayPause = function(hideID, showID) {
    if (this.isSlideshow && hideID == "lbPause") {
        for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
    }
    this.doc.getElementById(hideID).style.display = 'none';
    this.doc.getElementById(showID).style.display = '';
    if (hideID == "lbPlay") {
        this.isPaused = false;
        if (this.activeSlide == (this.slideArray.length - 1)) {
            this.end();
        } else {
            this.changeContent(this.activeSlide + 1);
        }
    } else {
        this.isPaused = true;
    }
};
LyteBox.prototype.end = function(caller) {
    if (this.isLyteframe) {
         //this.initialize();
         document.getElementById('lbIframe').src = 'about:blank';
    }
    var closeClick = (caller == 'slideshow' ? false : true);
    if (this.isSlideshow && this.isPaused && !closeClick) { return; }
    this.disableKeyboardNav();
    this.doc.getElementById('lbMain').style.display = 'none';
    this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));
    this.toggleSelects('visible');
    if (this.hideFlash) { this.toggleFlash('visible'); }
    if (this.isSlideshow) {
        for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
    }
    if(typeof(quickedit)!='undefined' ){
        if(quickedit==true){
            window.location.href=window.location.href;
        }
    }
    
};
LyteBox.prototype.checkFrame = function() {
    if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
        this.isFrame = true;
        this.lytebox = "window.parent." + window.name + ".myLytebox";
        this.doc = parent.document;
    } else {
        this.isFrame = false;
        this.lytebox = "myLytebox";
        this.doc = document;
    }
};
LyteBox.prototype.getPixelRate = function(cur, img) {
    var diff = (img > cur) ? img - cur : cur - img;
    if (diff >= 0 && diff <= 100) { return 10; }
    if (diff > 100 && diff <= 200) { return 15; }
    if (diff > 200 && diff <= 300) { return 20; }
    if (diff > 300 && diff <= 400) { return 25; }
    if (diff > 400 && diff <= 500) { return 30; }
    if (diff > 500 && diff <= 600) { return 35; }
    if (diff > 600 && diff <= 700) { return 40; }
    if (diff > 700) { return 45; }
};
LyteBox.prototype.appear = function(id, opacity) {
    var object = this.doc.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + (opacity + 10) + ")";
    if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {
        try { object.removeAttribute("filter"); } catch(e) {}    /* Fix added for IE Alpha Opacity Filter bug. */
        this.updateDetails();
    } else if (opacity >= this.maxOpacity && id == 'lbOverlay') {
        for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }
        return;
    } else if (opacity >= 100 && id == 'lbDetailsContainer') {
        try { object.removeAttribute("filter"); } catch(e) {}    /* Fix added for IE Alpha Opacity Filter bug. */
        for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }
        this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";
    } else {
        if (id == 'lbOverlay') {
            this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1);
        } else {
            this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1);
        }
    }
};
LyteBox.prototype.fade = function(id, opacity) {
    var object = this.doc.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
    if (opacity <= 0) {
        try {
            object.display = 'none';
        } catch(err) { }
    } else if (id == 'lbOverlay') {
        this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1);
    } else {
        this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1);
    }
};
LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {
    if (!this.hDone) {
        this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);
        return;
    }
    var object = this.doc.getElementById(id);
    var timer = speed ? speed : (this.resizeDuration/2);
    var newW = (this.doAnimations ? curW : maxW);
    object.style.width = (newW) + "px";
    if (newW < maxW) {
        newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;
    } else if (newW > maxW) {
        newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;
    }
    this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);
    if (parseInt(object.style.width) == maxW) {
        this.wDone = true;
        for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }
    }
};
LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {
    var timer = speed ? speed : (this.resizeDuration/2);
    var object = this.doc.getElementById(id);
    var newH = (this.doAnimations ? curH : maxH);
    object.style.height = (newH) + "px";
    if (newH < maxH) {
        newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;
    } else if (newH > maxH) {
        newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;
    }
    this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);
    if (parseInt(object.style.height) == maxH) {
        this.hDone = true;
        for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }
    }
};
LyteBox.prototype.getPageScroll = function() {
    if (self.pageYOffset) {
        return this.isFrame ? parent.pageYOffset : self.pageYOffset;
    } else if (this.doc.documentElement && this.doc.documentElement.scrollTop){
        return this.doc.documentElement.scrollTop;
    } else if (document.body) {
        return this.doc.body.scrollTop;
    }
};
LyteBox.prototype.getPageSize = function() {    
    var xScroll, yScroll, windowWidth, windowHeight;
    if (window.innerHeight && window.scrollMaxY) {
        xScroll = this.doc.scrollWidth;
        yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
    } else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
        xScroll = this.doc.body.scrollWidth;
        yScroll = this.doc.body.scrollHeight;
    } else {
        xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
        yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
        xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
        yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
    }
    if (self.innerHeight) {
        windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
        windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        windowWidth = this.doc.documentElement.clientWidth;
        windowHeight = this.doc.documentElement.clientHeight;
    } else if (document.body) {
        windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
        windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
        windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
        windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
    }
    var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
    var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
    return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
};
LyteBox.prototype.toggleFlash = function(state) {
    var objects = this.doc.getElementsByTagName("object");
    for (var i = 0; i < objects.length; i++) {
        objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
    }
    var embeds = this.doc.getElementsByTagName("embed");
    for (var i = 0; i < embeds.length; i++) {
        embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
    }
    if (this.isFrame) {
        for (var i = 0; i < parent.frames.length; i++) {
            try {
                objects = parent.frames[i].window.document.getElementsByTagName("object");
                for (var j = 0; j < objects.length; j++) {
                    objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
                }
            } catch(e) { }
            try {
                embeds = parent.frames[i].window.document.getElementsByTagName("embed");
                for (var j = 0; j < embeds.length; j++) {
                    embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
                }
            } catch(e) { }
        }
    }
};
LyteBox.prototype.toggleSelects = function(state) {
    var selects = this.doc.getElementsByTagName("select");
    for (var i = 0; i < selects.length; i++ ) {
        selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
    }
    if (this.isFrame) {
        for (var i = 0; i < parent.frames.length; i++) {
            try {
                selects = parent.frames[i].window.document.getElementsByTagName("select");
                for (var j = 0; j < selects.length; j++) {
                    selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
                }
            } catch(e) { }
        }
    }
};
LyteBox.prototype.pause = function(numberMillis) {
    var now = new Date();
    var exitTime = now.getTime() + numberMillis;
    while (true) {
        now = new Date();
        if (now.getTime() > exitTime) { return; }
    }
};

if(typeof(myLytebox)=="undefined"){
  if (window.addEventListener) {
      window.addEventListener("load",initLytebox,false);
  } else if (window.attachEvent) {
      window.attachEvent("onload",initLytebox);
  } else {
      window.onload = function() {initLytebox();}
  }
}
function initLytebox() { myLytebox = new LyteBox();}
<!-- Fonctions supplémentaires propres au site -->
var popViaMichelin = function(){
  var largeur_pourcent_old = largeur_pourcent;
  var hauteur_pourcent_old = hauteur_pourcent;
  largeur_pourcent = 0;           //activation de la largeur proportionnelle (donner la taille en %)
  hauteur_pourcent = 0;           //activation de la hauteur proportionnelle (donner la taille en %) 
  lyteflash('./situation-et-plan-d-acces-formulaire.php',560,850);
  largeur_pourcent = largeur_pourcent_old;
  hauteur_pourcent = hauteur_pourcent_old;
  return false;
}
/*var popArticle= function(){
  var largeur_pourcent_old = largeur_pourcent;
  var hauteur_pourcent_old = hauteur_pourcent;
  largeur_pourcent = 0;           //activation de la largeur proportionnelle (donner la taille en %)
  hauteur_pourcent = 0;           //activation de la hauteur proportionnelle (donner la taille en %) 
  lyteflash('./article2.php',500,500);
  largeur_pourcent = largeur_pourcent_old;
  hauteur_pourcent = hauteur_pourcent_old;
  return false;
}*/
