if(!window.SVFX_lightbox) SVFX_lightbox = new Object();

//*************************************************************************
//		Paramètres
//*************************************************************************
SVFX_lightbox.colorCache = '000000';
SVFX_lightbox.colorBox = '#ffffff';
SVFX_lightbox.borderBox = '0px Solid #000000';
SVFX_lightbox.srcImageLoader = '../Img_clicpostal/Img_site/Lightbox/loader.gif';
SVFX_lightbox.srcImageNext = '../Img_clicpostal/Img_site/Lightbox/btn_droite.gif';
SVFX_lightbox.srcImagePrev = '../Img_clicpostal/Img_site/Lightbox/btn_gauche.gif';
SVFX_lightbox.srcImageClose = '../Img_clicpostal/Img_site/Lightbox/btn_fermer.jpg';
SVFX_lightbox.imageMargeTop = 15;
SVFX_lightbox.imageMargeLeft = 15;
SVFX_lightbox.imageWidthMax = 600;
SVFX_lightbox.imageHeightMax = 420;
SVFX_lightbox.infosNumPosition = 'left';
SVFX_lightbox.infosTitlePosition = 'center';
SVFX_lightbox.infosButtonPosition = 'right';
SVFX_lightbox.infosHeight = 40;
SVFX_lightbox.font = "Verdana";
SVFX_lightbox.fontSize = "8pt";
SVFX_lightbox.fontWeight = "bold";
SVFX_lightbox.titleSize = "9pt";
SVFX_lightbox.titleWeight = "normal";
SVFX_lightbox.buttonsWidth = 150;
SVFX_lightbox.numbersWidth = 70;



//*************************************************************************
//		Variables
//*************************************************************************
SVFX_lightbox.images = new Array();
SVFX_lightbox.titles = new Array();
SVFX_lightbox.alphaCache = 0;
SVFX_lightbox.alphaCacheMax = 70;
SVFX_lightbox.alphaCacheSpeed = 10;
SVFX_lightbox.resizeIncrement = 20;
SVFX_lightbox.resizeSpeed = 10;
SVFX_lightbox.resizeTemp = 12;
SVFX_lightbox.imageWidth = 0;
SVFX_lightbox.imageHeight = 0;
SVFX_lightbox.imageOpacity = 0;
SVFX_lightbox.imageOpacityIncrement = 10;
SVFX_lightbox.imageOpacitySpeed = 40;
SVFX_lightbox.cacheOk = false;
SVFX_lightbox.groupName = '';
SVFX_lightbox.index = 0;
SVFX_lightbox.imageLoaderWidth = 0;
SVFX_lightbox.imageLoaderHeight = 0;
SVFX_lightbox.imageLoaderStatus = false;
SVFX_lightbox.imageNextStatus = false;
SVFX_lightbox.imagePrevStatus = false;
SVFX_lightbox.imageCloseStatus = false;
SVFX_lightbox.isIE = false;
if(navigator.appName.indexOf("Microsoft Internet Explorer") != -1) SVFX_lightbox.isIE = true;

//*************************************************************************
//		Fonctions secondaires
//*************************************************************************
SVFX_lightbox.getPageSize=function(){
	var xScroll = 0;
	var yScroll = 0;
	
	if(window.innerHeight&&window.scrollMaxY){
		xScroll=window.innerWidth+window.scrollMaxX;
		yScroll=window.innerHeight+window.scrollMaxY;
	}
	else if(document.body.scrollHeight>document.body.offsetHeight){
		xScroll=document.body.scrollWidth;
		yScroll=document.body.scrollHeight;
	}
	else if(document.body.style.pixelHeight){
		xScroll = document.body.style.pixelWidth;
		yScroll = document.body.style.pixelHeight;
	}
	else{
		xScroll=document.body.offsetWidth;
		yScroll=document.body.offsetHeight;
	}
	
	var windowWidth = 0;
	var windowHeight = 0;
	
	if(self.innerHeight){
		if(document.documentElement.clientWidth) windowWidth=document.documentElement.clientWidth
		else windowWidth=self.innerWidth;
		windowHeight=self.innerHeight
	}
	else if(document.documentElement&&document.documentElement.clientHeight){
		windowWidth=document.documentElement.clientWidth;
		windowHeight=document.documentElement.clientHeight;
	}
	else if(document.body){
		windowWidth=document.body.clientWidth;
		windowHeight=document.body.clientHeight;
	}
	
	if(yScroll<windowHeight) pageHeight=windowHeight;
	else pageHeight=yScroll;
	
	if(xScroll<windowWidth)	pageWidth=xScroll;
	else pageWidth=windowWidth;
	
	arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	
	return arrayPageSize;
}

SVFX_lightbox.empty = function(test){
	if(test == undefined || test == 'undefined' || test == 0 || test == '' || test == false || test == 'false') return true;
	else return false
}

SVFX_lightbox.explode = function(str,char1,char2,char3){
	var strList = new Array();
	var buffer = '';
	var memPos = 0;

	for(var i=0;i<str.length;i++){
		if(str.charAt(i) == char1 || str.charAt(i) == char2 || str.charAt(i) == char3){
			strList[strList.length] = str.substring(memPos,i);
			memPos = i+1;
		}
	}
	
	if(!this.empty(str.substring(memPos,str.length))) strList[strList.length] = str.substring(memPos,str.length);
	return strList;
}

//*************************************************************************
//		Fonctions principales
//*************************************************************************



//-------------------------------------------------------------------------
//		Execute le lightbox quand on clique sur un lien
//-------------------------------------------------------------------------
SVFX_lightbox.run = function(group,index){
	
	//Récupère la hauteur du scroll
	var width = document.body.offsetWidth;
	var posHeight = 0;
	var db=!document.body.width?document.documentElement:document.body;
	posHeight = db.scrollTop;
	if(posHeight == 0) posHeight = document.body.scrollTop;
	//var tmp = this.getPageSize();
	//posHeight=tmp[1];
	//Créé les blocs html
	
	//--- Bloc principal
	var main = document.createElement("DIV");
	main.setAttribute("id","SVFX_lightbox_main");
	main.style.backgroundColor = this.colorBox;
	main.style.position = 'absolute';
	main.style.zIndex = '10001';
	main.style.top = (parseInt(posHeight)+parseInt(80))+"px";
	main.style.left = ((width / 2) - 100)+"px";
	main.style.width = "200px";
	main.style.height = "150px";
	main.style.border = this.borderBox;

	//--- Loading
	var loading = document.createElement('DIV');
	loading.setAttribute('id','SVFX_lightbox_loading');
	loading.style.position = 'absolute';
	loading.style.fontFamily = this.font;
	loading.style.fontSize = '9pt';
	loading.style.color = '#666666';
	loading.style.display = 'none';
	loading.appendChild(document.createTextNode('Loading...'));
	
	//--- Infos
	var infos = document.createElement('DIV');
	infos.setAttribute('id','SVFX_lightbox_infos');
	infos.style.position = 'absolute';
	infos.style.width = '100%';
	infos.style.height = '40px';
	infos.style.bottom = '0px';
	infos.style.left = '0px';
	infos.style.visibility = 'hidden';
	infos.style.backgroundColor = '#ffffff';
	infos.style.display = 'block';
	
	var id_left = 'SVFX_lightbox_number';
	if(this.infosNumPosition == 'left') id_left = 'SVFX_lightbox_number';
	else if(this.infosTitlePosition == 'left') id_left = 'SVFX_lightbox_title';
	else if(this.infosButtonPosition == 'left') id_left = 'SVFX_lightbox_button';
	
	var id_center = 'SVFX_lightbox_title';
	if(this.infosNumPosition == 'center') id_center = 'SVFX_lightbox_number';
	else if(this.infosTitlePosition == 'center') id_center = 'SVFX_lightbox_title';
	else if(this.infosButtonPosition == 'center') id_center = 'SVFX_lightbox_button';
	
	var id_right = 'SVFX_lightbox_right';
	if(this.infosNumPosition == 'right') id_right = 'SVFX_lightbox_number';
	else if(this.infosTitlePosition == 'right') id_right = 'SVFX_lightbox_title';
	else if(this.infosButtonPosition == 'right') id_right = 'SVFX_lightbox_button';
	
	infos.innerHTML = "<table border='0' cellpadding='0' cellspacing='0' style='background-color:#ffffff;width:100%;font-family:"+this.font+";font-size:"+this.fontSize+";'><tr valign='middle'><td id='"+id_left+"' align='left'></td><td id='"+id_center+"' align='center'></td><td id='"+id_right+"' align='right'></td></tr></table>";

	//--- ImageLoading
	var imgLoading = document.createElement('IMG');
	imgLoading.setAttribute('id','SVFX_lightbox_imgLoading');
	imgLoading.style.position = 'absolute';
	imgLoading.style.top = this.imageMargeTop+'px';
	imgLoading.style.left = this.imageMargeLeft+'px';
	imgLoading.style.display = 'block';

	//--- Image
	var img = document.createElement('IMG');
	img.setAttribute('id','SVFX_lightbox_image');
	img.style.position = 'absolute';
	img.style.top = this.imageMargeTop+'px';
	img.style.left = this.imageMargeLeft+'px';
	img.style.display = 'none';
	
	//Ajoute les éléments créés à la page
	main.appendChild(loading);
	main.appendChild(infos);
	main.appendChild(imgLoading);
	main.appendChild(img);
	document.body.appendChild(main);
	
	//Mets en place les boutons
	this.setControls();
	
	//Défini le groupe d'image à afficher
	this.groupName = group;
	this.index = index;
	
	//Affichage du cache
	var offSetHeight = this.getPageSize();
	var cache = document.getElementById('SVFX_lightbox_cache');
	cache.style.height = offSetHeight[1] + 'px';
	
	
	this.alphaCache = 0;
	this.displayCache();
	this.loadImage();
}


//-------------------------------------------------------------------------
//		Ferme le lightbox
//-------------------------------------------------------------------------
SVFX_lightbox.sleep = function(){
	this.hideCache();
	var main = document.getElementById('SVFX_lightbox_main');
	document.body.removeChild(main);
}


//-------------------------------------------------------------------------
//		Ajoute les boutons de contrôle
//-------------------------------------------------------------------------
SVFX_lightbox.setControls = function(){
	if(!this.empty(document.getElementById('SVFX_lightbox_button'))){
		if(this.imagePrevStatus == true){
			this.imagePrev.onclick = function(){ SVFX_lightbox.changeImage(-1); };
			this.imagePrev.style.marginRight = '5px';
			this.imagePrev.style.marginLeft = this.imageMargeLeft+'px';
			this.imagePrev.style.marginTop = '5px';
			this.imagePrev.style.marginBottom = '5px';
			this.imagePrev.style.cursor = 'pointer';
			document.getElementById('SVFX_lightbox_button').appendChild(this.imagePrev);
		}
		else{
			var prev_lnk = document.createElement('a');
			prev_lnk.setAttribute('href','javascript:SVFX_lightbox.changeImage(-1);');
			prev_lnk.style.marginRight = '5px';
			prev_lnk.style.marginLeft = this.imageMargeLeft+'px';
			prev_lnk.style.marginTop = '5px';
			prev_lnk.style.marginBottom = '5px';
			prev_lnk.appendChild(document.createTextNode(' << '));
			document.getElementById('SVFX_lightbox_button').appendChild(prev_lnk);
		}
		
		if(this.imageNextStatus == true){
			this.imageNext.onclick = function(){ SVFX_lightbox.changeImage(1); };
			this.imageNext.style.marginRight = '5px';
			this.imageNext.style.marginTop = '5px';
			this.imageNext.style.marginBottom = '5px';
			this.imageNext.style.cursor = 'pointer';
			document.getElementById('SVFX_lightbox_button').appendChild(this.imageNext);
		}
		else{
			var next_lnk = document.createElement('a');
			next_lnk.setAttribute('href','javascript:SVFX_lightbox.changeImage(1);');
			next_lnk.style.marginRight = '5px';
			next_lnk.style.marginTop = '5px';
			next_lnk.style.marginBottom = '5px';
			next_lnk.appendChild(document.createTextNode(' >> '));
			document.getElementById('SVFX_lightbox_button').appendChild(next_lnk);
		}
		
		if(this.imageCloseStatus == true){
			this.imageClose.onclick = function(){ SVFX_lightbox.sleep(); };
			this.imageClose.style.marginRight = this.imageMargeLeft+'px';
			this.imageClose.style.marginTop = '5px';
			this.imageClose.style.marginBottom = '5px';
			this.imageClose.style.cursor = 'pointer';
			document.getElementById('SVFX_lightbox_button').appendChild(this.imageClose);
		}
		else{
			var close_lnk = document.createElement('a');
			close_lnk.setAttribute('href','javascript:SVFX_lightbox.sleep();');
			close_lnk.style.marginRight = this.imageMargeLeft+'px';
			close_lnk.style.marginTop = '5px';
			close_lnk.style.marginBottom = '5px';
			close_lnk.appendChild(document.createTextNode('Close'));
			document.getElementById('SVFX_lightbox_button').appendChild(close_lnk);
		}
		document.getElementById('SVFX_lightbox_button').style.padding = '5px';
		document.getElementById('SVFX_lightbox_button').style.width = this.buttonsWidth + 'px';
	}	
}


//-------------------------------------------------------------------------
//		Charge l'image (définie par this.groupName et this.index)
//-------------------------------------------------------------------------
SVFX_lightbox.loadImage = function(){
	//Récupère les id des blocs utilisés
	var main = document.getElementById('SVFX_lightbox_main');
	var img = document.getElementById('SVFX_lightbox_image');
	var imgLoading = document.getElementById('SVFX_lightbox_imgLoading');
	var loading = document.getElementById('SVFX_lightbox_loading');
	img.style.display = 'none';
	
	//Affiche l'image de chargement si elle existe, sinon le texte "loading..."
	if(this.imageLoaderStatus == true){
		imgLoading.style.display = 'block';
		imgLoading.style.top = ((main.offsetHeight / 2) - (this.imageLoader.height / 2)) + 'px';
		imgLoading.style.left = ((main.offsetWidth / 2) - (this.imageLoader.width / 2)) + 'px';
		imgLoading.src = this.imageLoader.src;
	}
	else{
		loading.style.display = 'block';
		loading.style.left = (parseFloat(main.offsetWidth / 2) - parseFloat(loading.offsetWidth / 2)) + 'px';
		loading.style.top = (parseFloat(main.offsetHeight / 2) - parseFloat(loading.offsetHeight / 2)) + 'px';
	}
	
	//Créé un nouvel objet image
	image = new Image();
	image.onload = function(){ SVFX_lightbox.waitCache(this); }
	image.onerror = function(){ alert('Image Loading Failed'); }
	image.src = this.images[this.groupName][this.index]; //Lance le chargement de l'image
	
	//Affiche le numero de la photo
	var num = (parseInt(this.index) + 1);
	var total = this.images[this.groupName].length;
	if(!this.empty(document.getElementById('SVFX_lightbox_number'))){
		document.getElementById('SVFX_lightbox_number').style.paddingLeft = this.imageMargeLeft + 'px';
		document.getElementById('SVFX_lightbox_number').innerHTML = '<p style="margin:0px;padding:0px;width:'+ this.numbersWidth +'px;font-weight:'+this.fontWeight+';">'+num+'/'+total+'</p>';
		document.getElementById('SVFX_lightbox_title').innerHTML = '<span style="font-weight:'+this.titleWeight+';font-size:'+this.titleSize+';">'+this.titles[this.groupName][this.index]+'</span>';
	}
}


//-------------------------------------------------------------------------
//		Fonction appelé lorsque l'image est chargée
//-------------------------------------------------------------------------
SVFX_lightbox.waitCache = function(image){
	//Attend que l'animation du cache soit fini avant de lancer celle du redimentionnement du bloc
	if(this.cacheOk == true){
		document.getElementById('SVFX_lightbox_image').onload = function(){ SVFX_lightbox.resizeBloc(image); }
		document.getElementById('SVFX_lightbox_image').src = image.src;
		//charge l'image dans le bloc principal
	}
	else setTimeout(function(){ SVFX_lightbox.waitCache(image); },100);
}


//-------------------------------------------------------------------------
//		Initialise le redimentionnement du bloc
//-------------------------------------------------------------------------
SVFX_lightbox.resizeBloc = function(image){
	//Met l'opacité de l'image à 0
	this.setOpacity(document.getElementById('SVFX_lightbox_image'),0);
	//Masque le 'loader'
	document.getElementById('SVFX_lightbox_imgLoading').style.display = 'none';
	document.getElementById('SVFX_lightbox_loading').style.display = 'none';
	//Récupère les blocs
	var main = document.getElementById('SVFX_lightbox_main');
	var width = document.body.offsetWidth;
	var height = document.body.offsetHeight;
	
	//Calcul les nouvelles dimensions de l'image
	var ratio = (image.width / image.height);
	var newWidth = 100;
	var newHeight = 100;
	var screenRatio = (screen.width / screen.height);
	
	if(ratio >= screenRatio){
		if(image.width > this.imageWidthMax) newWidth = this.imageWidthMax;
		else newWidth = image.width;
		newHeight = newWidth / ratio;
	}
	else{
		if(image.height > this.imageHeightMax) newHeight = this.imageHeightMax;
		else newHeight = image.height;
		newWidth = newHeight * ratio;
	}
	
	this.imageWidth = newWidth;
	this.imageHeight = newHeight;
	
	//Calcul les dimensions du bloc en fonction de celles de l'image
	if(!this.empty(document.getElementById('SVFX_lightbox_infos').offsetHeight)) this.infosHeight = document.getElementById('SVFX_lightbox_infos').offsetHeight;
	newHeight += parseInt(this.imageMargeTop * 2) + parseInt(this.infosHeight);
	newWidth += parseInt(this.imageMargeLeft * 2);
	
	//Vérifie si on réduit ou si on augmente la taille du bloc
	var dirW = 0;
	if(newWidth > main.offsetWidth) dirW = 1;
	else if(newWidth < main.offsetWidth) dirW = -1;
	
	var dirH = 0;
	if(newHeight > main.offsetHeight) dirH = 1;
	else if(newHeight < main.offsetHeight) dirH = -1;
	
	//Lance l'animation de redimensionnement
	this.resizeBlocAnimation(newWidth,dirW,newHeight,dirH);
}


//-------------------------------------------------------------------------
//		Anime le redimensionnement du bloc
//-------------------------------------------------------------------------
SVFX_lightbox.resizeBlocAnimation = function(newWidth,dirW,newHeight,dirH){
	var main = document.getElementById('SVFX_lightbox_main');
	var width = document.body.offsetWidth;
	
	//Récupère les dimensions du bloc
	var mw = main.offsetWidth;
	var mh = main.offsetHeight;
	
	//Calcul les nouvelles dimensions
	if(dirW < 0){
		mw -= this.resizeIncrement;
		if(mw < newWidth) mw = newWidth;
	}
	else if(dirW > 0){
		mw += this.resizeIncrement;
		if(mw > newWidth) mw = newWidth;
	}
	
	if(dirH < 0){
		mh -= this.resizeIncrement;
		if(mh < newHeight) mh = newHeight;
	}
	else if(dirH > 0){
		mh += this.resizeIncrement;
		if(mh > newHeight) mh = newHeight;
	}
	
	//Affecte les nouvelles dimensions
	main.style.width = mw + 'px';
	main.style.height = mh + 'px';
	main.style.left = (parseInt(width / 2) - parseInt(mw / 2 )) + 'px';

	//Relance l'animation si le redimensionnement n'est pas fini
	if(mh != newHeight || mw != newWidth) setTimeout(function(){ SVFX_lightbox.resizeBlocAnimation(newWidth,dirW,newHeight,dirH); },SVFX_lightbox.resizeSpeed);
	else{
		//Sinon lance l'animation de fondu de l'image
		document.getElementById('SVFX_lightbox_infos').style.visibility = 'visible';
		document.getElementById('SVFX_lightbox_infos').style.display = 'block';
		var img = document.getElementById('SVFX_lightbox_image');
		img.style.top = this.imageMargeTop + 'px';
		img.style.left = this.imageMargeLeft + 'px';
		main.style.width = newWidth + 'px';
		main.style.height = newHeight + 'px';
		this.imageOpacity = 0;
		this.displayImage();
	}
}


//-------------------------------------------------------------------------
//		Anime le fondu de l'image
//-------------------------------------------------------------------------
SVFX_lightbox.displayImage = function(){
	var img = document.getElementById('SVFX_lightbox_image');
	img.width = SVFX_lightbox.imageWidth;
	img.height = SVFX_lightbox.imageHeight;
	img.style.display = 'block';
	if(SVFX_lightbox.imageOpacity < 100){
		SVFX_lightbox.imageOpacity += parseInt(SVFX_lightbox.imageOpacityIncrement);
		SVFX_lightbox.setOpacity(img,SVFX_lightbox.imageOpacity);
		setTimeout(SVFX_lightbox.displayImage,SVFX_lightbox.imageOpacitySpeed);
	}
}


//--------------------------------------------------------------------------------
//		Fonction appelée par les boutons, charge l'image suivante ou précédente
//--------------------------------------------------------------------------------
SVFX_lightbox.changeImage = function(ind){
	var lastIndex = (this.images[this.groupName].length - 1);
	
	if(ind < 0){
		if(this.index > 0) this.index--;
		else this.index = lastIndex;
	}
	else{
		if(this.index < lastIndex) this.index++;
		else this.index = 0;
	}
	
	this.loadImage();
}


//-------------------------------------------------------------------------
//		Affecte une opacité à un bloc
//-------------------------------------------------------------------------
SVFX_lightbox.setOpacity = function(elt,op){
	if(this.isIE) elt.style.filter = "alpha(opacity="+op+")";
	else{
		var opacite = (op / 100);
		elt.style.setProperty( "-moz-opacity",opacite , "");
		elt.style.setProperty( "-khtml-opacity", opacite, "");
		elt.style.setProperty( "opacity",opacite , "");
	}
}


//-------------------------------------------------------------------------
//		Anime l'affichage du cache
//-------------------------------------------------------------------------
SVFX_lightbox.displayCache = function(){
	var relance = false;
	if(this.alphaCache < this.alphaCacheMax){
		this.alphaCache += this.alphaCacheSpeed;
		relance = true;
	}
	else this.alphaCache = this.alphaCacheMax;
	
	var elt = document.getElementById('SVFX_lightbox_cache');
	this.setOpacity(elt,this.alphaCache);
	
	if(relance) setTimeout("SVFX_lightbox.displayCache()",10);
	else{
		elt.onclick = function(){ SVFX_lightbox.sleep(); }
		this.cacheOk = true;
	}
}


//-------------------------------------------------------------------------
//		Anime le masquage du cache
//-------------------------------------------------------------------------
SVFX_lightbox.hideCache = function(){
	this.cacheOk = false;
	var relance = false;
	if(this.alphaCache > 0){
		this.alphaCache -= this.alphaCacheSpeed;
		relance = true;
	}
	else this.alphaCache = 0;
	
	var elt = document.getElementById('SVFX_lightbox_cache');
	this.setOpacity(elt,this.alphaCache);
	
	if(relance) setTimeout("SVFX_lightbox.hideCache()",33);
	else{
		elt.style.height = '0px';
		elt.onclick = null;
	}
}


//-------------------------------------------------------------------------
//		Initialise le lightbox
//-------------------------------------------------------------------------
SVFX_lightbox.loadEvent = function(){
	//liste toutes les balises <a>
	var links = document.body.getElementsByTagName('a');
	SVFX_lightbox.images = new Array();
	SVFX_lightbox.titles = new Array();
	
	for(var i=0;i<links.length; i++){
		//Si elles contiennent l'attribut 'rel'
		if(!SVFX_lightbox.empty(links[i].rel)){
			
			var rel = SVFX_lightbox.explode(links[i].rel,'[',']');
			//Si l'attribut rel contient la chaine lightbox[...] et que le lien n'est pas vide
			if(rel[0] == 'lightbox'){
				if(!SVFX_lightbox.empty(rel[1]) && !SVFX_lightbox.empty(links[i].href)){
					//Récupère les infos nécessaires
					var group = rel[1];
					var src = links[i].href;
					var title = links[i].title;
					
					//Si le groupe ( chaine de caractère entre les [ ] ) n'existe pas, on le créé
					if(SVFX_lightbox.empty(SVFX_lightbox.images[group])){
						SVFX_lightbox.images[group] = new Array();
						SVFX_lightbox.titles[group] = new Array();
					}
					
					//Mémorise le lien et les infos du lien
					var index = SVFX_lightbox.images[group].length;
					SVFX_lightbox.images[group][index] = src;
					SVFX_lightbox.titles[group][index] = title;
					
					//Remplace le lien
					links[i].href = "javascript:SVFX_lightbox.run('"+group+"','"+index+"')";
				}
			}
		}
	}
	
	//Créé l'élément cache
	if(SVFX_lightbox.empty(document.getElementById('SVFX_lightbox_cache'))){
		var width = document.body.offsetWidth;
		var cache = document.createElement("DIV");
		cache.setAttribute("id","SVFX_lightbox_cache");
		cache.style.backgroundColor = '#'+SVFX_lightbox.colorCache;
		cache.style.position = 'absolute';
		cache.style.top = '0px';
		cache.style.left = '0px';
		cache.style.width = width+'px';
		cache.style.height = '0px';
		cache.style.zIndex = '10000';
		document.body.appendChild(cache);
	
		var elt = document.getElementById('SVFX_lightbox_cache');
		SVFX_lightbox.setOpacity(elt,0);
		
		//Charge les images des boutons
		SVFX_lightbox.imageLoader = new Image();
		SVFX_lightbox.imageLoader.onload = function(){ SVFX_lightbox.imageLoaderStatus = true; }
		SVFX_lightbox.imageLoader.src = SVFX_lightbox.srcImageLoader;
		SVFX_lightbox.imageNext = new Image();
		SVFX_lightbox.imageNext.onload = function(){ SVFX_lightbox.imageNextStatus = true; }
		SVFX_lightbox.imageNext.src = SVFX_lightbox.srcImageNext;
		SVFX_lightbox.imagePrev = new Image();
		SVFX_lightbox.imagePrev.onload = function(){ SVFX_lightbox.imagePrevStatus = true; }
		SVFX_lightbox.imagePrev.src = SVFX_lightbox.srcImagePrev;
		SVFX_lightbox.imageClose = new Image();
		SVFX_lightbox.imageClose.onload = function(){ SVFX_lightbox.imageCloseStatus = true; }
		SVFX_lightbox.imageClose.src = SVFX_lightbox.srcImageClose;
	}
}

//---------------------------------------------------------------
//   Appel de la function au chargement de la page
//---------------------------------------------------------------

if(Event.domReady) Event.domReady.add(SVFX_lightbox.loadEvent);
else{
	var fn = window.onload;
	window.onload = function(){
		SVFX_lightbox.loadEvent();
		fn();
	}
}

