var obj20020329 = null;
function FermerApercu (){if (obj20020329 && !obj20020329.closed) {obj20020329.close (); obj20020329 = null;}}
function IsExtension (sIn, sExt){
	var s = sIn.substr(sIn.lastIndexOf(".")+1).toUpperCase();
	var a = sExt.split (",");
	var bRet = false;
	for (i = 0; i < a.length && !bRet; i++) {if (s == a[i]) bRet = true;}
	return bRet;
}
function Apercu (sUrl, sSource, sTitre, sWidth, sHeight){
	var iWidth = parseInt (sWidth);
	var iHeight = parseInt (sHeight);
	var bS = false;

	FermerApercu ();
	if (iWidth + 30 > screen.availWidth) {iWidth = screen.availWidth - 30; bS = true;}
	if (iHeight + 30 > screen.availHeight) {iHeight = screen.availHeight - 30; bS = true;}
	var pr = "";

	pr = pr + "location=no,directories=no,status=no,toolbar=no,menubar=no";
	if (bS == true) {pr = pr + ",scrollbars=yes,resizable=yes";}
	else {pr = pr + ",scrollbars=no,resizable=no";}
	pr = pr + ",width=" + iWidth + ",height=" + iHeight;

	sUrl = sUrl + "?sSource=" + sSource;
	sUrl = sUrl + "&sTitre=" + sTitre;
	obj20020329 = window.open (sUrl, "Image"+sWidth+"x"+sHeight, pr);
}
/**
 * Apercu2
 ***
 * sRacine : chaemin jusqu'à la racine du site
 * sUrl	   : Url de l'image
 */
function Apercu2(sRacine_, sUrl_){
	FermerApercu ();
	var opt = "location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,personalbar=no";
	opt += ",width=100,height=100";
	if (sRacine_.lastIndexOf("/") != (sRacine_.length - 1)) sRacine_ += "/";
	var sUrl = sRacine_;
	sUrl += "pages/misc/image.asp?sSource=";
	sUrl += sUrl_;
	obj20020329 = window.open (sUrl, "apercu", opt);
}
/**
 * pApercu
 ***
 * sRacine : chaemin jusqu'à la racine du site
 * key	   : Clef de l'image
 */
function pApercu(sRacine_, sKey_, sTitre_){
	FermerApercu ();
	var opt = "location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,personalbar=no";
	opt += ",width=100,height=100";
	if (sRacine_.lastIndexOf("/") != (sRacine_.length - 1)) sRacine_ += "/";
	var sUrl = sRacine_;
	sUrl += "pages/misc/image.asp?k=";
	sUrl += sKey_;
	if (sTitre_ != null){
		sUrl += "&sTitre=";
		sUrl += sTitre_;
	}
	obj20020329 = window.open (sUrl, "apercu", opt);
}

/**
 * pApercu
 ***
 * sRacine : chaemin jusqu'à la racine du site
 * key	   : Clef de l'image
 */
function pIdApercu(sRacine_, sId_, sTitre_){
	FermerApercu ();
	var opt = "location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,personalbar=no";
	opt += ",width=100,height=100";
	if (sRacine_.lastIndexOf("/") != (sRacine_.length - 1)) sRacine_ += "/";
	var sUrl = sRacine_;
	sUrl += "pages/misc/image.asp?id=";
	sUrl += sId_;
	if (sTitre_ != null){
		sUrl += "&sTitre=";
		sUrl += sTitre_;
	}
	obj20020329 = window.open (sUrl, "apercu", opt);
}


function CocheDecoche(sForm,sElement){
	var i;
	var n;
	if(this.document.forms[sForm]&&this.document.forms[sForm].elements[sElement]){
		n=this.document.forms[sForm].elements[sElement].length;
		if(n){
			if(this.document.forms[sForm].elements[sElement][0].checked==true)for(i=0;i<n;i++)this.document.forms[sForm].elements[sElement][i].checked=false;
			else for(i=0;i<n;i++)this.document.forms[sForm].elements[sElement][i].checked=true;
		}else{
			if(this.document.forms[sForm].elements[sElement].checked==true)this.document.forms[sForm].elements[sElement].checked=false;
			else this.document.forms[sForm].elements[sElement].checked=true;
		}
	}
}


var obj20020415 = null;

function FermerOpenWindow(){
	if (obj20020415 && !obj20020415.closed) {obj20020415.close (); obj20020415 = null;}
}

function OpenWindow(sUrl,sW,iL,iH,sP){
	var sPr="";
	var bOrigin = false;
	for(i=0;sP.charAt(i)!=0;i++){
		switch(sP.charAt(i)){
			//,'left=10,top=10,height=400,width=500,menubar=0,menu=0,menuBar=0,directory=0,favorites=0,personalbar=0,location=0,toolbar=0,status=0,scrollbars=1,title=0,resizable=1'
			case "l":sPr=sPr+"location=yes,"; break;
			case "d":sPr=sPr+"directories=yes,"; break;
			case "s":sPr=sPr+"status=yes,"; break;
			case "t":sPr=sPr+"toolbar=yes,"; break;
			case "m":sPr=sPr+"menubar=yes,"; break;
			case "a":sPr=sPr+"scrollbars=yes,"; break;	// ascenseur
			case "r":sPr=sPr+"resizable=yes,"; break;	// 
			case "p":sPr=sPr+"personalbar=yes,"; break;	// 
			default:
		}
	}
	if ( (iL==-1) || (iH==-1) )
		bOrigin = true;
	//alert(iL + " x " + iH);
	if (iL==-1) iL = screen.availWidth - 10;
	if (iH==-1) iH = screen.availHeight - 150;
	//alert(iL + " x " + iH);
	if (!(iL<-1&&iH<-1)) sPr=sPr+"width="+iL+",height="+iH;
	//alert(sPr);
	FermerOpenWindow();
	obj20020415 = window.open(sUrl,sW,sPr);
	if (bOrigin) obj20020415.moveTo(0,0);
	obj20020415.focus();
}

function popUpWindow(URLStr, left, top, width, height, option){
	var popUp;
	var sOption='';
	for(var i=0;option.charAt(i)!=0;i++){
		switch(option.charAt(i)){
			case "l":sOption=sOption+"location=yes,"; break;
			case "d":sOption=sOption+"directories=yes,"; break;
			case "s":sOption=sOption+"status=yes,"; break;
			case "t":sOption=sOption+"toolbar=yes,"; break;
			case "m":sOption=sOption+"menubar=yes,"; break;
			case "a":sOption=sOption+"scrollbars=yes,"; break;	// ascenseur
			case "r":sOption=sOption+"resizable=yes,"; break;	// ascenseur
			case "p":sOption=sOption+"personalbar=yes,"; break;	// ascenseur
			default:
		}
	}
	popUp = open(URLStr, 'popUpWin', sOption + 'width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	return popUp;
}
function Int2Str(_iNb,_i){
	var s=new String(_iNb);
	while(s.length<_i)s="0"+s;
	return s;
}

function ObjDate2ODBC(_obj){
	return _obj.getFullYear()+"-"+Int2Str((_obj.getMonth()+1),2)+"-"+Int2Str(_obj.getDate(),2);
}
function ObjDate2Fr(_obj){
	return Int2Str(_obj.getDate(),2)+"/"+Int2Str((_obj.getMonth()+1),2)+"/"+_obj.getFullYear();
}
function CreeObjDate(_str){
	var objDate;
	var jour="";
	var mois="";
	var annee="";
	for(i=0;i<_str.length&&_str.charAt(i)!="/";i++)jour+=_str.charAt(i);
	for(i++;i<_str.length&&_str.charAt(i)!="/";i++)mois+=_str.charAt(i);
	for(i++;i<_str.length&&_str.charAt(i)!="/";i++)annee+=_str.charAt(i);
	if(annee.length==2){
		var iAn=parseInt(annee);
		if(!isNaN(iAn)){
			if(iAn>50)iAn+=1900;
			else iAn+=2000;
			annee=iAn.toString();
		}
	}
	if(jour==""||mois==""||annee=="")objDate=NaN;
	else objDate=new Date(annee,mois-1,jour);
	return objDate;
}
function IsDate(_str,_dtMin,_dtMax,_bErr, _sMsg){
	var str="";
	var objDate=CreeObjDate(_str);
	var objDateMin=CreeObjDate(_dtMin);
	var objDateMax=CreeObjDate(_dtMax);
	if(isNaN(objDate)||objDate<objDateMin||objDate>objDateMax){
		if(_bErr){
			var s="1. Les dates doivent \u00EAtre formatt\u00E9es comme suit : JJ/MM/AAAA ou JJ/MM/AA\n2. L'ann\u00E9e doit \u00EAtre comprise entre "+_dtMin+" et "+_dtMax;
			if(_sMsg.length) s=_sMsg+"\n\n"+s;
			else s="Vous avez saisi une date incorrecte !\n\n"+s;
			alert(s);
		}
	}else{
		str=ObjDate2Fr(objDate);
	}
	return str;
}

function CreeObjTime(_str){
	var objTime;
	var heure="";
	var minute="";
	var seconde="";
	for(i=0;i<_str.length&&_str.charAt(i)!=":";i++)heure+=_str.charAt(i);
	for(i++;i<_str.length&&_str.charAt(i)!=":";i++)minute+=_str.charAt(i);
	for(i++;i<_str.length&&_str.charAt(i)!=":";i++)seconde+=_str.charAt(i);
	if(heure==""){
		objTime=null;
	}else{
		if(minute=="")minute=0;
		if(seconde=="")seconde=0;
		if(isNaN(heure)||isNaN(minute)||isNaN(seconde)){
			objTime=null;
		}else{
			if(heure<0||minute<0||seconde<0||heure>23||minute>59||seconde>59){
				objTime=null;
			}else{
				objTime=Int2Str(heure,2)+":"+Int2Str(minute,2)+":"+Int2Str(seconde,2);
			}
		}
	}
	return objTime;
}

function IsTime(_str,_tMin,_tMax,_bErr){
	var str="";
	var objTime=CreeObjTime(_str);
	var objTimeMin=CreeObjTime(_tMin);
	var objTimeMax=CreeObjTime(_tMax);
	if(!objTime||objTime<objTimeMin||objTime>objTimeMax){
		if(_bErr)alert("Vous avez saisi une heure incorrecte !\n\n1. Les heures doivent \u00EAtre formatt\u00E9es comme suit : HH ou HH:MM ou HH:MM:SS\n2. L'heure doit \u00EAtre comprise entre "+_tMin+" et "+_tMax);
	}else{
		str=objTime;
	}
	return str;
}

function OnKeyUp(a,t){
	if(a.value.length>t){
		alert("Vous avez atteint le nombre de caract\u00E8res maximum autoris\u00E9 pour ce champ ("+t+" caract\u00E8res)\u000ALe texte sera tronqu\u00E9.");
		a.value=a.value.substr(0,t);
	}
}

function Remplace (s, ch1, ch2){
	var s1="";
	var i;
	for(i=0;i<s.length;i++){
		if(s.charAt(i)==ch1) s1=s1+ch2;
		else s1=s1+s.charAt(i);
	}
	return s1;
}

function RemplaceStr (s, s1, s2){
	var iL1=s1.length;
	if (iL1==0) return s;
	var str="";
	for(var i=0;i<=s.length-iL1;i++){
		if(s.substr(i,iL1)==s2) {str=str+s2;i+=iL1-1;}
		else str=str+s.charAt(i);
	}
	return str;
}



function InSelect(sForm,sElement){
	var sz="";
	var i;
	var n;
	if(this.document.forms[sForm]&&this.document.forms[sForm].elements[sElement]){
		n=this.document.forms[sForm].elements[sElement].length;
		if(n){
			for(i=0;i<n;i++){
				if(this.document.forms[sForm].elements[sElement][i].checked==true){
					if (sz!="") sz+=",";
					sz+=this.document.forms[sForm].elements[sElement][i].value;
				}
			}
		}else{
			if(this.document.forms[sForm].elements[sElement].checked==true) sz=this.document.forms[sForm].elements[sElement].value;
		}
	}
	return sz;
}

var w = 0;		// Différence de taille par rapport à la taille initiale
var h = 0;
var l = 0;		// The last image pour le roll-over
var Img = "";

function Resize (iW, iH, iL, sImg){
	// Gestion du resize
	window.resizeBy (iW-w, iH-h);
	w = iW;
	h = iH;
	
	// Gestion du roll-over
	if (l != 0) FrameLeft.document.images["Img" + l].src=Img;		// On restitue les anciennes valeurs
	if ((l = iL) != 0){
		Img = FrameLeft.document.images["Img" + l].src;
		FrameLeft.document.images["Img" + l].src=sImg;
	}else
		Img = "";
}

function MoveResize (x, y, w, h){
	var iD; // Décalage pour un double écran
	var iL;	// Largeur disponible
	if (screen.availWidth / screen.availHeight > 2)		{
		iD = screen.availWidth / 2;
		iL = screen.availWidth / 2;
	}else{
		iD = 0;
		iL = screen.availWidth;
	}

	var iW;
	var iH;
	if (w >= 0) iW = w;
	else iW = iL;
	
	if (h >= 0) iH = h;
	else iH = screen.availHeight;
	
	if (x >= 0)
		iX = x;
	else{
		if (iW > iL) iX = iD;
		else iX = iD + (iL - iW) / 2;
	}

	if (y >= 0)
		iY = y;
	else{
		if (iH > screen.availHeight) iY = 0;
		else iY = (screen.availHeight - iH) / 2;
	}
	
	window.moveTo (iX, iY);
	window.resizeTo (iW, iH);
}

/******************************************
Fonctions MACROMEDIA
******************************************/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/******************************************
Fin Fonctions MACROMEDIA
******************************************/
function changeCKB(ckbControl)	{
	sControl = "_BL_" + ckbControl.name.substring(3);
	sValue = (ckbControl.checked) ? "1" : "0";
	// alert(sControl + " : " + sValue);
	document.forms['Form'].elements[sControl].value = sValue;
}

/******************************************
affichLayer : affiche ou masque un calque
layer : calque à masquer ou à afficher
******************************************/
function afficheLayer(layer){
	//var calque = document.getElementById(layer);
	var calque = MM_findObj(layer);
	
	if (calque != null){
		if (calque.style.display == "none"){
			calque.style.display = "block";
		}else{
			calque.style.display = "none";
		}
	}
}

/******************************************
affichLayer : affiche ou masque un calque
layer : calque à masquer ou à afficher
******************************************/
function onOff(layer){
	var calque = MM_findObj(layer);
	if (calque != null){
		if (calque.style.display == "none"){
			calque.style.display = "";
		}else{
			calque.style.display = "none";
		}
	}
}

/******************************************
affichLayer : affiche ou masque un calque
layer : calque à masquer ou à afficher
******************************************/
function afficheLayer2(layer, imageOff, imageOn, forceAffiche){
	var calque = MM_findObj(layer);
	var image = MM_findObj("img" + layer);
	var bShow = null;
	
	if (calque != null){
		if (forceAffiche == null) bShow = (calque.style.display == "none") ? true : false;
		else bShow = forceAffiche;
		
		if (bShow){
			calque.style.display = "block";
			if (image != null)
				image.src = imageOff;
		}else{
			calque.style.display = "none";
			if (image != null)
				image.src = imageOn;
		}
	}
}

var isLayerAffich = false;
function afficheAll(layerImage, layerPrefixe_, imageOff, imageOn, image2Off, image2On){
	var oLayer = null;
	isLayerAffich = !isLayerAffich;
	
	// on recherche tous les calques
	if (document.getElementsByTagName){
		oLayer = document.getElementsByTagName("div");
	}else if (document.all){
		oLayer = document.all.tags("div");		
	}
	
	if (oLayer != null){
		for (var i = 0; i < oLayer.length; i++){
			if (oLayer[i].id.search("^" + layerPrefixe_) != -1 ){
				afficheLayer2(oLayer[i].id, image2Off, image2On, isLayerAffich)	;
			}
		}
	}
	
	var image = MM_findObj(layerImage);
	if (image != null){
		image.src = (!isLayerAffich) ? imageOn : imageOff ;
	}
	
}

function refreshBandeau(calque_){
	var oCalque = MM_findObj('bandeau' + calque_);
	//eval("document.getElementById(\"bandeau" + calque_ + "\");")
	if (oCalque != null){
		//alert(eval("iCpt" + calque_) + " " + eval("tText" + calque_ + ".length"));
		if ( eval("iCpt" + calque_ + "==(tText" + calque_ + ".length - 1)"))
			eval("iCpt" + calque_ + "=0");
		else
			eval("iCpt" + calque_ + "++");
		// on change le texte
		if (document.getElementById || document.all ){
			oCalque.innerHTML = eval("tText" + calque_ + "[iCpt" + calque_ + "]");
			//alert("glop");
		}else{
			oCalque.innerTEXT = eval("tText" + calque_ + "[iCpt" + calque_ + "]");
			//alert("pas glop :-)");
		}
		// on raffraichie dans ...
		setTimeout("refreshBandeau('1')", eval("refresh" + calque_));
	}
} 

function changeTheme(theme_){
	var url_ = new String(self.location);
	// on enleve le theme si il  est dans l'url
	url_ = url_.replace(/&theme=\w+/, "");
	url_ = url_.replace(/\?theme=\w+&/, "?");
	url_ = url_.replace(/#$/, "");
	if (url_ != null){
		if (url_.indexOf("?", 0) != -1)
			url_ += "&theme=" + theme_ + "&home=1";
		else
			url_ += "&theme=" + theme_ + "&home=1";
	}
	self.location = url_;
}

function changeLangue(langue_){
	var url_ = new String(self.location);
	// on enleve le theme si il  est dans l'url
	url_ = url_.replace(/&langue=\w+/, "");
	url_ = url_.replace(/\?langue=\w+&/, "?");
	url_ = url_.replace(/#$/, "");
	if (url_ != null){
		if (url_.indexOf("?", 0) != -1)
			url_ += "&langue=" + langue_;
		else
			url_ += "&langue=" + langue_;
	}
	self.location = url_;
}

function arrondir( num, p ){
	p=Math.pow(10,p);
	return Math.round(num*p)/p;
}

function trim(sParam){ return leftTrim(rightTrim(sParam)); }
function leftTrim(sString){	while (sString.substring(0,1) == ' '){sString = sString.substring(1, sString.length);} return sString; }
function rightTrim(sString){ while (sString.substring(sString.length-1, sString.length) == ' '){sString = sString.substring(0,sString.length-1);} return sString; }

if (!String.prototype.trim){
	String.prototype.trim = function() {
		var x=this;
		return leftTrim(rightTrim(x));
	};
}



function getPlugin(mess_, url_){
	if (confirm(mess_)){
		OpenWindow(url_, 'plug', -1, -1, "ldstmar");
	}
}


/*************************************************
* class::bngSelect
**************************************************
- permet d'ajouter à une liste html des éléments
- de filtrer ces éléments
*************************************************/
function BngSelect(id_){
	this._id = id_;
	this._oSelect = MM_findObj(this._id);
	this._tData = null;
	this._tSelected = null;
}
/**
* isInit
* permet de savoir si la liste est utilisable
*/
BngSelect.prototype.isInit = function(){
	return (this._id != null);
}
/**
* load
* on charge la liste
*/
BngSelect.prototype.load = function(data_){
	if (!this.isInit()){
		this.setError("-- objet non initialisé --");
		return;
	}
	
	if (typeof data_ != "undefined"){
		this._tData = data_;
	}
	// on vide la liste
	this.clean();
	// on charge la liste
	for (var i=0; i < this._tData.length ; i++){
		var oOption = new Option();
		oOption.value = this._tData[i]["value"];
		oOption.text = this._tData[i]["text"];
		if (this._tData[i]["cssClass"]) oOption.className = this._tData[i]["cssClass"];
		this._oSelect.options[this._oSelect.options.length] = oOption;
	}
}
/**
* load
* on charge la liste
*/
BngSelect.prototype.filter = function(re_){
	if (!this.isInit()){
		this.setError("-- objet non initialisé --");
		return;
	}
	
	var oRE = new RegExp(".*" + re_, "ig");
	var text_ = null;
	// on recharge la liste
	this.load();

	// on filtre chaque entrée
	for (var i = this._oSelect.options.length - 1; i >= 0 ; i--){
		var oOption = this._oSelect.options[i];
		if ( oOption ){
			text_ = oOption.text; 
			//alert(text_ + ' - ' + oRE + ' - ' + re_)
			if ( text_.search(oRE) ){
				this._oSelect.remove(i);
			}
		}
	}
}
/**
* select
* on selectionne les elements
*/
BngSelect.prototype.select = function(selected_){
	
	if (!this.isInit()){
		this.setError("-- objet non initialisé --");
		return;
	}
	
	if (typeof selected_ != "undefined"){
		this._tSelected = selected_;
	}
	
	for (var i = 0; i < this._oSelect.options.length ; i++){
		this._oSelect.options[i].selected = false;
		if (this._tSelected){
			for (var j = 0; j < this._tSelected.length ; j++){
				if ( this._oSelect.options[i].value == this._tSelected[j] ){
					this._oSelect.options[i].selected = true;
					break;
				}	
			}
		}
	}
}
/**
* select
* on selectionne les elements
*/
BngSelect.prototype.getSelected = function(){
	
	if (!this.isInit()){
		this.setError("-- objet non initialisé --");
		return;
	}
	
	var tTemp = null, iCpt = 0;
	
	for (var i = 0; i < this._oSelect.options.length ; i++){
		if (this._oSelect.options[i].selected == true){
			tTemp[iCpt] = this._oSelect.options[i].value;
			iCpt++;
		}
	}
	
	return tTemp;
}
/**
* clean
* on vide la liste
*/
BngSelect.prototype.clean = function(){
	if (this.isInit()){
		this._oSelect.options.length = 0;
	}
}
BngSelect.prototype.setError = function(sError){
	alert(sError);
}
//*********************************************
//class::bngSelect



/*************************************************
* class::BngDiaporama
**************************************************

*************************************************/
function BngDiaporama( id , tData, racine ){
	this.id = id;
	this.tData = tData;
	this.index = 0;
	this.size = (tData) ? tData.length -1 : -1;
	this.tempo = 5000;	// temporisation en ms
	this.slideShow = true;	// temporisation en ms
	this.debug = false;
	this.racine = racine; 			// racine du site
	this.width = 500;		// largeur par défaut en pixel
	this.height = 300;		// hauteur par défaut en pixel
	// éléments HTML
	this.oTitle = MM_findObj( 'diapoTitre' + id );
	this.oDesc = MM_findObj( 'diapoDesc' + id );
	this.oPreview = MM_findObj( 'diapoPreview' + id );
	this.oCounter = MM_findObj( 'diapoCompteur' + id );
	// Fonctions de rappel
	this.listenerFunction = new Array();
}

/**
* Affiche l'image correspondant à l'index si passé en argument
*/
BngDiaporama.prototype.preview = function( index, keepSlideShow ) {
	if ( !this.tData ){
		this.info( 'Aucune image à afficher !' );
		return;
	}
	
	if (typeof index != "undefined") { this.index = index ; }
	// on verifie la cohérence
	if ( this.index < 0 ) this.index = this.size; 
	if ( this.index > this.size ) this.index = 0;	
	
	if (typeof keepSlideShow == "undefined") keepSlideShow = false;
	if (!keepSlideShow) this.slideShow = false;
						
	if ( this.oPreview ){
		// on charge l'image
		//this.info( this.index );
		if ( this.tData[this.index].path == '' )
			this.oPreview.src = this.racine + "/pages/misc/thumbs.asp?id=" + escape( this.tData[this.index].id ) + "&iW=" + this.width + "&iH=" + this.height ;
		else
			this.oPreview.src = this.racine + "/pages/misc/thumbs.asp?file=" + escape( this.tData[this.index].path ) + "&iW=" + this.width + "&iH=" + this.height ;
		
		// maj du compteur
		if ( this.oCounter )  this.oCounter.value = (this.index + 1) + ' / ' + ( this.size + 1 );
		// maj du nom
		if ( this.oTitle ){
			if ( this.tData[this.index].name != '' ){
				this.oTitle.innerHTML = this.tData[this.index].name;
				this.oTitle.style.display = "block";						
			}else{
				this.oTitle.style.display = "none";						
			}
		}
		// maj de la description
		if ( this.oDesc ){
			if ( this.tData[this.index].description != '' ){
				this.oDesc.innerHTML = this.tData[this.index].description;
				this.oDesc.style.display = "block";						
			}else{
				this.oDesc.style.display = "none";						
			}
		}
		// fonction de rappel
		this.notify();
	}else{
		this.info( 'oPreview n\'est pas présent dans le document.' );
	}
};
/**
*	Permet d'afficher l'image precedente
*/
BngDiaporama.prototype.open = function( index, keepSlideShow ) {
	if (typeof index != "undefined") { this.index = index ;	}
	if (typeof keepSlideShow == "undefined") keepSlideShow = false;
	if (!keepSlideShow) this.slideShow = false;
	if (this.tData){
		if ( this.tData[this.index].path == '' )
			 pIdApercu( this.racine + '/', this.tData[ this.index ].id, this.tData[ this.index ].name );
		else
			Apercu2( this.racine + '/', escape( this.tData[ this.index ].path ));
	}
};

/**
*	Ajoute des fonctions à appelé qd on change d'image
*/
BngDiaporama.prototype.addEventListener = function( function_ ) {
	this.listenerFunction.push( function_ );
};
/**
*	Appel des fonctions qd on change d'image
*/
BngDiaporama.prototype.notify = function() {
	for ( var i = 0; i<this.listenerFunction.length; i++){
		this.listenerFunction[i].call();
	}
};


/**
*	Permet d'afficher l'image precedente
*/
BngDiaporama.prototype.previous = function() {
	if ( this.size > 0 ){
		this.index--;
		this.preview( this.index );
	}
};
/**
*	Permet d'afficher l'image suivante
*/
BngDiaporama.prototype.next = function() {
	if ( this.size > 0 ){
		this.index++;
		this.preview( this.index );
	}
};

/**
*	Permet d'afficher l'image suivante - slideshow
*/
BngDiaporama.prototype.slide = function( timer ) {
	if ( this.slideShow && this.size > 0 ){
		this.index++;
		this.preview( this.index, true );
	} else {
		clearInterval( this.timer );
	}
};
				
/**
*	Permet d'afficher des messages d'alertes
*/
BngDiaporama.prototype.info = function( message ) {
	if (this.debug) alert(message);
};

/**
*	Permet d'afficher des messages d'alertes
*/
BngDiaporama.prototype.toString = function(  ) {
	var msg = '- id : ' + this.id;
	msg += '\n- index : ' + this.index;
	msg += '\n- taille : ' + this.size;
	msg += '\n- slideshow : ' + this.slideShow + "[ " + this.tempo+ " ms ]";
	msg += '\n- debug : ' + this.debug;
	return  msg ;
};

function showMenuToolTip( message ){}

function getCookie__( name ){
	var cookies = document.cookie.split( '; ' );
	var RE = new RegExp( "(.*)=(.*)" ), result;
	for ( var i = 0 ; i < cookies.length ; i++ ){
		result = RE.exec( cookies[i] );
		if ( result )
			if ( result[1] == name ) return result[ 2 ];
		/*
		var c = cookies[ i ];
		var pos = c.indexOf( '=' );
		var n = c.substring( 0, pos );
		if ( n = name )
			return c.substring( pos+1 );
		*/
	}
	return null;
}

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}