/* --- Credits
//
//	Lightbox v2.02
//	by Lokesh Dhakar - http://www.huddletogether.com
//	3/31/06
//
//	For more information on this script, visit:
//	http://huddletogether.com/projects/lightbox2/
//
//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
//	
//	Credit also due to those who have helped, inspired, and made their code available to the public.
//	Including: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.org), Thomas Fuchs(mir.aculo.us), and others.
//
//
// -----------------------------------------------------------------------------------
*/
function AC_AddExtension(_1,_2){if(_1.indexOf("?")!=-1){
return _1.replace(/\?/,_2+"?");}else{return _1+_2;}}

function AC_Generateobj(_3,_4,_5){
var _6="<object ";
for(var i in _3){_6+=i+"=\""+_3[i]+"\" ";}_6+=">";
for(var i in _4){_6+="<param name=\""+i+"\" value=\""+_4[i]+"\" /> ";}_6+="<embed ";
for(var i in _5){_6+=i+"=\""+_5[i]+"\" ";}_6+=" ></embed></object>";return _6;}

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

function AC_GetArgs(_9,_a,_b,_c,_d){
var _e=new Object();_e.embedAttrs=new Object();_e.params=new Object();_e.objAttrs=new Object();
for(var i=0;i<_9.length;i=i+2){
var _10=_9[i].toLowerCase();
switch(_10){
case "classid":break;case "pluginspage":_e.embedAttrs[_9[i]]=_9[i+1];break;case "src":case "movie":_e.embedAttrs["src"]=_9[i+1];_e.params[_b]=_9[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 "codebase":_e.objAttrs[_9[i]]=_9[i+1];break;case "width":case "height":case "align":case "vspace":case "hspace":case "class":case "title":case "accesskey":case "name":case "id":case "tabindex":_e.embedAttrs[_9[i]]=_e.objAttrs[_9[i]]=_9[i+1];break;default:_e.embedAttrs[_9[i]]=_e.params[_9[i]]=_9[i+1];}}_e.objAttrs["classid"]=_c;if(_d){_e.embedAttrs["type"]=_d;}return _e;}function showSelectBoxes(){selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="visible";}}

function hideSelectBoxes(){
selects=document.getElementsByTagName("select");
for(i=0;i!=selects.length;i++){selects[i].style.visibility="hidden";}
}

function pause(_11){
var now=new Date();var _13=now.getTime()+_11;while(true){now=new Date();if(now.getTime()>_13){return;}}
}

var Lightbox=Class.create();
Lightbox.prototype={
initialize:function(){
this.fileLoadingImage="/js/lightbox/loading.gif";
this.fileBottomNavCloseImage="/theme/fr/js/lightbox/closelabel.gif";
this.fileBottomNavSuivanteImage="/theme/fr/js/lightbox/suivante.gif";
this.fileBottomNavPrecedenteImage="/theme/fr/js/lightbox/precedente.gif";
this.fileChgImage="/theme/fr/js/lightbox/chg.gif";

var _14=7;
this.borderSize=0;
if(_14>10){_14=10;}if(_14<1){_14=1;}this.resizeDuration=(11-_14)*0.15;
this.resizeDuration=0;
if(!document.getElementsByTagName){return;}

var _15=document.getElementsByTagName("a");
this.single=[];
this.diapo=[];l=this;var _16=/^lightbox\[(.*)\]$/;
var c=0;
for(var i=0;i<_15.length;i++){
var _19=_15[i];
var _1a=String(_19.getAttribute("rel"));
if(_19.getAttribute("href")&&(_1a.toLowerCase().match(/^lightbox/))){var t=this.parseType(_19.getAttribute("href"));var _1c={a:_19,type:t.type,param:t.param,src:t.cleanHref,title:_19.getAttribute("title")};
var r=_16.exec(_1a.toLowerCase());
if(r!=null&&r.length==2){
if(typeof (this.diapo[r[1]])=="undefined"){
this.diapo[r[1]]=[];this.diapo[r[1]].push(_1c);c=0;}else{c=-1;this.diapo[r[1]].each(function(e,_1f){
if(e.src==_1c.src){c=_1f;}});
if(c==-1){this.diapo[r[1]].push(_1c);c=this.diapo[r[1]].length-1;}}}
else{this.single.push(_1c);var c=0;}var f=function(rel,num){l.start(rel,num);return false;};_19.onclick=f.bind(f,_1a,c);}
}
var _23=document.getElementsByTagName("body").item(0);

var _24=document.createElement("div");_24.setAttribute("id","overlay");_24.style.display="none";_24.onclick=function(){l.end();return false;};_23.appendChild(_24);

var _25=document.createElement("div");_25.setAttribute("id","lightbox");_25.style.display="none";_23.appendChild(_25);
var _26=document.createElement("div");_26.setAttribute("id","outerImageContainer");_25.appendChild(_26);

// Nouveau div
//var _26_02=document.createElement("div");_26_02.setAttribute("id","imageContainer_02");_26.appendChild(_26_02);

// inclusion de imageContainer dans le nouveau div
//var _27=document.createElement("div");_27.setAttribute("id","imageContainer");_26.appendChild(_27);
var _27=document.createElement("div");_27.setAttribute("id","imageContainer");_26.appendChild(_27);
// _27_02 utile pour swf sinon coin hd n'apparait pas !
var _27_02=document.createElement("div");_27_02.setAttribute("id","imageContainer_02");_27.appendChild(_27_02);
var _28=document.createElement("img");_28.setAttribute("id","lightboxImage");_27_02.appendChild(_28);
var _29=document.createElement("div");_29.setAttribute("id","lightboxObj");_27_02.appendChild(_29);
var _2a=document.createElement("div");_2a.setAttribute("id","hoverNav");_27_02.appendChild(_2a);
var _2b=document.createElement("a");_2b.setAttribute("id","prevLink");_2b.setAttribute("href","#");_2a.appendChild(_2b);
var _2c=document.createElement("a");_2c.setAttribute("id","nextLink");_2c.setAttribute("href","#");_2a.appendChild(_2c);
var _2d=document.createElement("div");_2d.setAttribute("id","loading");_27_02.appendChild(_2d);
var _2e=document.createElement("a");_2e.setAttribute("id","loadingLink");_2e.setAttribute("href","#");_2e.onclick=function(){l.end();return false;};_2d.appendChild(_2e);
var _2f=document.createElement("img");_2f.setAttribute("src",this.fileLoadingImage);_2e.appendChild(_2f);
//var _29_clear=document.createElement("div");_29_clear.setAttribute("style","clear: both;");_29.appendChild(_29_clear);


var _30=document.createElement("div");_30.setAttribute("id","imageDataContainer");_30.className="clearfix";_25.appendChild(_30);
// Nouveau div
var _31_02=document.createElement("div");_31_02.setAttribute("id","imageData_02");_30.appendChild(_31_02);
// Inclusion de imageData dans nouveau div
var _31=document.createElement("div");_31.setAttribute("id","imageData");_31_02.appendChild(_31);

var _32=document.createElement("div");_32.setAttribute("id","imageDetails");_31.appendChild(_32);
var _33=document.createElement("div");_33.setAttribute("id","caption");_32.appendChild(_33);
var _34=document.createElement("div");_34.setAttribute("id","numberDisplay");_32.appendChild(_34);
var _35=document.createElement("div");_35.setAttribute("id","bottomNav");_31.appendChild(_35);
var _36=document.createElement("a");_36.setAttribute("id","bottomNavClose");_36.setAttribute("href","#");_36.onclick=function(){l.end();return false;};
_35.appendChild(_36);

var _37=document.createElement("img");
_37.setAttribute("src",this.fileBottomNavCloseImage);
_36.appendChild(_37);
var _32_clear=document.createElement("div");_32_clear.setAttribute("style","clear: both;");_31.appendChild(_32_clear);
},parseType:function(_38){
var t={type:"",param:[],cleanHref:""};
var d=_38.split("#");if(d.length==2){t.param=d[1].split(",");t.type=t.param[0];if(t.type=="swf"){t.param[1]=parseInt(t.param[1]);t.param[2]=parseInt(t.param[2]);}}else{t.param=[];var r=d[0].match(/\.[^.]+$/);if(r==null){t.type="img";}else{if(r[0]==".swf"){t.type="swf";}else{t.type="img";}}if(t.type=="swf"){t.param[1]=150;t.param[2]=150;}}t.cleanHref=d[0];return t;},getType:function(_3c){var r=_3c.match(/\.[^.]+(#[^.]*)?$/);if(r==null){return "img";}else{if(r[0]==".swf"){return "flash";}else{return "img";}}},start:function(rel,num){hideSelectBoxes();
var _40=KBInfo.getPageSize();$("overlay").style.height=_40.pageHeight+"px";new Effect.Appear("overlay",{duration:0.2,from:0,to:0.8});this.oPile=[];this.oNum=num;if(!document.getElementsByTagName){return;}if(rel=="lightbox"){var obj=this.single[this.oNum];this.oPile.push(obj);}else{if((r=rel.match(/^lightbox\[(.*)\]$/))!=null){var obj=this.diapo[r[1]][this.oNum];this.oPile=this.diapo[r[1]];}}
var _42=KBInfo.getPageScroll();
var _43=_42.y+(_40.windowHeight/15);
$("lightbox").style.top=_43+"px";
Element.show("lightbox");
this.changeImage(this.oNum);},changeImage:function(num){this.oNum=num;Element.show("loading");
Element.hide("lightboxImage");
Element.hide("lightboxObj");Element.hide("hoverNav");
Element.hide("prevLink");
Element.hide("nextLink");
Element.hide("imageDataContainer");
Element.hide("numberDisplay");
imgPreloader=new Image();var o=this.oPile[num];
var l=this;
if(o.type=="swf"){
imgPreloader.src=this.fileLoadingImage;
var _47=$("lightboxObj");
_47.setAttribute("width",o.param[1]);_47.setAttribute("height",o.param[2]);l.resizeImageContainer(o.param[1],o.param[2]);
_47.innerHTML=AC_FL_RunContent("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0","width",o.param[1],"height",o.param[2],"src",o.src,"quality","high","pluginspage","http://www.macromedia.com/go/getflashplayer","movie",o.src);
}
else{
imgPreloader.onload=function(){$("lightboxImage").src=o.src;l.resizeImageContainer(imgPreloader.width,imgPreloader.height);};
imgPreloader.src=o.src;
}},resizeImageContainer:function(_48,_49){this.wCur=$("outerImageContainer").offsetWidth;
this.hCur=Element.getHeight("outerImageContainer");
this.xScale=((_48+(this.borderSize*2))/this.wCur)*100;this.yScale=((_49+(this.borderSize*2))/this.hCur)*100;
wDiff=(this.wCur-this.borderSize*2)-_48;hDiff=(this.hCur-this.borderSize*2)-_49;
if(!(hDiff==0)){new Effect.Scale("outerImageContainer",this.yScale,{scaleX:false,duration:this.resizeDuration,queue:"front"});}
if(!(wDiff==0)){new Effect.Scale("outerImageContainer",this.xScale,{scaleY:false,delay:this.resizeDuration,duration:this.resizeDuration});}
if((hDiff==0)&&(wDiff==0)){if(navigator.appVersion.indexOf("MSIE")!=-1){pause(250);}else{pause(100);}}$("prevLink").style.height=_49+"px";$("nextLink").style.height=_49+"px";
$("imageDataContainer").style.width=_48+(this.borderSize*2)+"px";

// Détermination de la largeur pour les flottants
$("imageData").style.width=_48-40+"px";
$("imageData_02").style.width=_48+"px";

this.showImage();},showImage:function(){var o=this.oPile[this.oNum];
switch(o.type){
	case "swf":var e="lightboxObj";break;case "img":var e="lightboxImage";break;
}
Element.hide("loading");
var l=this;
new Effect.Appear(e,{duration:0.5,queue:"end",afterFinish:function(){l.updateDetails();}});},updateDetails:function(){var o=this.oPile[this.oNum];

var l=this;

Element.show("caption");
$("caption").innerHTML="Zoom&nbsp;"+eval(this.oNum+1)+"&nbsp;sur&nbsp;"+this.oPile.length;
//$("caption").innerHTML=o.title;

if(this.oPile.length>1){

	var nav="";
	/*
	if(this.oNum!=0){
		nav+="<a href=\"javascript:void(0);\" onclick=\"myLightbox.changeImage(myLightbox.oNum - 1);\">Pr\xe9c\xe9dente</a> / ";
	}
	if(this.oNum!=(this.oPile.length-1)){
		if(this.oNum!=0){nav+="&nbsp;";}
		nav+="<a href=\"javascript:void(0);\" onclick=\"myLightbox.changeImage(myLightbox.oNum + 1);\">Suivante</a>";
	}
	*/
	if(this.oNum!=0){
		nav+="<a href=\"javascript:void(0);\" onclick=\"myLightbox.changeImage(myLightbox.oNum - 1);\"><img src=\""+this.fileBottomNavPrecedenteImage+"\" /></a>";
	}
	if(this.oNum!=(this.oPile.length-1)){
		if(this.oNum!=0){nav+="&nbsp;";}
		nav+="<a href=\"javascript:void(0);\" onclick=\"myLightbox.changeImage(myLightbox.oNum + 1);\"><img src=\""+this.fileBottomNavSuivanteImage+"\" /></a>";
	}
	
	$("numberDisplay").innerHTML=nav;
	Element.show("numberDisplay");			
	//$("numberDisplay").innerHTML=nav;
	// Element.show("numberDisplay");

}
new Effect.Parallel([new Effect.SlideDown("imageDataContainer",{sync:true,duration:this.resizeDuration+0.25,from:0,to:1}),new Effect.Appear("imageDataContainer",{sync:true,duration:1})],{duration:0.65,afterFinish:function(){l.updateNav();}});},updateNav:function(){Element.show("hoverNav");
var l=this; /*if(this.oNum!=0){ Element.show("prevLink");
document.getElementById("prevLink").onclick=function(){l.changeImage(l.oNum-1);return false;};} */
/* if(this.oNum!=(this.oPile.length-1)){Element.show("nextLink");
document.getElementById("nextLink").onclick=function(){l.changeImage(l.oNum+1);return false;};} */
this.enableKeyboardNav();},enableKeyboardNav:function(){document.onkeydown=this.keyboardAction;},disableKeyboardNav:function(){document.onkeydown="";},keyboardAction:function(e){var l=this;
if(e==null){keycode=event.keyCode;}else{keycode=e.which;}key=String.fromCharCode(keycode).toLowerCase();
if((key=="x")||(key=="o")||(key=="c")){l.end();}else{if(key=="p"){if(this.oNum!=0){l.disableKeyboardNav();
l.changeImage(l.oNum-1);}}else{if(key=="n"){if(this.oNum!=(this.oPile.length-1)){l.disableKeyboardNav();
l.changeImage(l.oNum+1);}}}}},preloadNeighborImages:function(){if((this.oPile.length-1)>this.oNum){preloadNextImage=new Image();
preloadNextImage.src=this.oPile[this.oNum+1][0];}if(this.oNum>0){preloadPrevImage=new Image();
preloadPrevImage.src=this.oPile[this.oNum-1][0];}},end:function(){this.disableKeyboardNav();Element.hide("lightbox");
new Effect.Fade("overlay",{duration:0.2});showSelectBoxes();}};
myLightbox={};
function initLightbox(){
	myLightbox=new Lightbox();
	var firstLight;
	if(firstLight=document.getElementById('anim_accueil')) 
		firstLight.onclick.apply(firstLight);
}
poolOnLoad.push(initLightbox);
