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 + "?__c=1&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?__c=1&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?__c=1&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?__c=1&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: break;
		}
	}
	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 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);
	}
};

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 a 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 ){};

/**
 * 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";
    }
};


function escapeXml( sParam ){
	var sTemp = sParam;
	sTemp = sTemp.replace( /&/g, '&amp;' );
	sTemp = sTemp.replace( /</g, '&lt;' );
	sTemp = sTemp.replace( />/g, '&gt;' );
	sTemp = sTemp.replace( /"/g, '&quot;' );
	sTemp = sTemp.replace( /'/g, '&apos;' );
	return sTemp;
};

function isEmpty( val ){
	return ( trim( val ) == "" );
};


// Ultimate client-side JavaScript client sniff. Version 3.03
// (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.
// Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
// Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
//                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4,
//                      correct Opera 5 detection
//                      add support for winME and win2k
//                      synch with browser-type-oo.js
// Revised 26 Mar 01 to correct Opera detection
// Revised 02 Oct 01 to add IE6 detection

// Everything you always wanted to know about your JavaScript client
// but were afraid to ask. Creates "is_" variables indicating:
// (1) browser vendor:
//     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
// (2) browser version number:
//     is_major (integer indicating major version number: 2, 3, 4 ...)
//     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
// (3) browser vendor AND major version number
//     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
//     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_ie6, is_ie6up, is_hotjava3, is_hotjava3up,
//     is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
// (4) JavaScript version number:
//     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
// (5) OS platform and version:
//     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
//     is_os2
//     is_mac, is_mac68k, is_macppc
//     is_unix
//     is_sun, is_sun4, is_sun5, is_suni86
//     is_irix, is_irix5, is_irix6
//     is_hpux, is_hpux9, is_hpux10
//     is_aix, is_aix1, is_aix2, is_aix3, is_aix4
//     is_linux, is_sco, is_unixware, is_mpras, is_reliant
//     is_dec, is_sinix, is_freebsd, is_bsd
//     is_vms
//
// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
// for detailed lists of userAgent strings.
//
// Note: you don't want your Nav4 or IE4 code to "turn off" or
// stop working when new versions of browsers are released, so
// in conditional code forks, use is_ie5up ("IE 5.0 or greater")
// is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
// to check version in code which you want to work on future
// versions.
// Example:
// var b = new BrowserInfo();
// alert(b.version); 

function Is(){
    // convert all characters to lowercase to simplify testing
    this.agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    this.version = navigator.appVersion.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    this.nav  = ((this.agt.indexOf('mozilla')!=-1) && (this.agt.indexOf('spoofer')==-1)
                && (this.agt.indexOf('compatible') == -1) && (this.agt.indexOf('opera')==-1)
                && (this.agt.indexOf('webtv')==-1) && (this.agt.indexOf('hotjava')==-1));
    this.nav2 = (this.nav && (this.major == 2));
    this.nav3 = (this.nav && (this.major == 3));
    this.nav4 = (this.nav && (this.major == 4));
    this.nav4up = (this.nav && (this.major >= 4));
    this.navonly      = (this.nav && ((this.agt.indexOf(";nav") != -1) ||
                          (this.agt.indexOf("; nav") != -1)) );
    this.nav6 = (this.nav && (this.major == 5));
    this.nav6up = (this.nav && (this.major >= 5));
    this.gecko = (this.agt.indexOf('gecko') != -1);


    this.ie     = ((this.agt.indexOf("msie") != -1) && (this.agt.indexOf("opera") == -1));
    this.ie3    = (this.ie && (this.major < 4));
    this.ie4    = (this.ie && (this.major == 4) && (this.agt.indexOf("msie 4")!=-1) );
    this.ie4up  = (this.ie && (this.major >= 4));
    this.ie5    = (this.ie && (this.major == 4) && (this.agt.indexOf("msie 5.0")!=-1) );
    this.ie5_5  = (this.ie && (this.major == 4) && (this.agt.indexOf("msie 5.5") !=-1));
    this.ie5up  = (this.ie && !this.ie3 && !this.ie4);
    this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5);
    this.ie6    = (this.ie && (this.major == 4) && (this.agt.indexOf("msie 6.")!=-1) );
    this.ie6up  = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
	
	this.safari = (this.agt.indexOf("safari")!=-1);
	this.safariVersion = this.safari ? parseInt( this.version.substring( this.version.indexOf( "safari/" ) + 7, this.version.length ) ) : 0;
	this.safari1_25 = ( (this.safari) && (this.safariVersion == 125 ) );
	this.safari1_25up = ( (this.safari) && (this.safariVersion >= 125 ) );
	this.safari2 = ( (this.safari) && (this.safariVersion == 412 ) );
	this.safari2up = ( (this.safari) && (this.safariVersion >= 412 ) );
	
    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables this.aol, this.aol3, and this.aol4 aren't 100% reliable.
    this.aol   = (this.agt.indexOf("aol") != -1);
    this.aol3  = (this.aol && this.ie3);
    this.aol4  = (this.aol && this.ie4);
    this.aol5  = (this.agt.indexOf("aol 5") != -1);
    this.aol6  = (this.agt.indexOf("aol 6") != -1);

    this.opera = (this.agt.indexOf("opera") != -1);
    this.opera2 = (this.agt.indexOf("opera 2") != -1 || this.agt.indexOf("opera/2") != -1);
    this.opera3 = (this.agt.indexOf("opera 3") != -1 || this.agt.indexOf("opera/3") != -1);
    this.opera4 = (this.agt.indexOf("opera 4") != -1 || this.agt.indexOf("opera/4") != -1);
    this.opera5 = (this.agt.indexOf("opera 5") != -1 || this.agt.indexOf("opera/5") != -1);
    this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4);

    this.webtv = (this.agt.indexOf("webtv") != -1);

    this.TVNavigator = ((this.agt.indexOf("navio") != -1) || (this.agt.indexOf("navio_aoltv") != -1));
    this.AOLTV = this.TVNavigator;

    this.hotjava = (this.agt.indexOf("hotjava") != -1);
    this.hotjava3 = (this.hotjava && (this.major == 3));
    this.hotjava3up = (this.hotjava && (this.major >= 3));

    // *** JAVASCRIPT VERSION CHECK ***
    this.js;
    if (this.nav2 || this.ie3) this.js = 1.0;
    else if (this.nav3) this.js = 1.1;
    else if (this.opera5up) this.js = 1.3;
    else if (this.opera) this.js = 1.1;
    else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2;
    else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3;
    else if (this.hotjava3up) this.js = 1.4;
    else if (this.nav6 || this.gecko) this.js = 1.5;
    // NOTE: In the future, update this code when newer versions of JS
    // are released. For now, we try to provide some upward compatibility
    // so that future versions of Nav and IE will show they are at
    // *least* JS 1.x capable. Always check for JS version compatibility
    // with > or >=.
    else if (this.nav6up) this.js = 1.5;
    // NOTE: ie5up on mac is 1.4
    else if (this.ie5up) this.js = 1.3;

    // HACK: no idea for other browsers; always check for JS version with > or >=
    else this.js = 0.0;

    // *** PLATFORM ***
    this.win   = ( (this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1) );
    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
    //        Win32, so you can't distinguish between Win95 and WinNT.
    this.win95 = ((this.agt.indexOf("win95")!=-1) || (this.agt.indexOf("windows 95")!=-1));

    // is this a 16 bit compiled version?
    this.win16 = ((this.agt.indexOf("win16")!=-1) ||
               (this.agt.indexOf("16bit")!=-1) || (this.agt.indexOf("windows 3.1")!=-1) ||
               (this.agt.indexOf("windows 16-bit")!=-1) ); 

    this.win31 = ((this.agt.indexOf("windows 3.1")!=-1) || (this.agt.indexOf("win16")!=-1) ||
                    (this.agt.indexOf("windows 16-bit")!=-1));

    this.winme = ((this.agt.indexOf("win 9x 4.90")!=-1));
    this.win2k = ((this.agt.indexOf("windows nt 5.0")!=-1));

    // NOTE: Reliable detection of Win98 may not be possible. It appears that:
    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
    //       - On Mercury client, the 32-bit version will return "Win98", but
    //         the 16-bit version running on Win98 will still return "Win95".
    this.win98 = ((this.agt.indexOf("win98")!=-1) || (this.agt.indexOf("windows 98")!=-1));
    this.winnt = ((this.agt.indexOf("winnt")!=-1) || (this.agt.indexOf("windows nt")!=-1));
    this.win32 = (this.win95 || this.winnt || this.win98 ||
                    ((this.major >= 4) && (navigator.platform == "Win32")) ||
                    (this.agt.indexOf("win32")!=-1) || (this.agt.indexOf("32bit")!=-1));

    this.os2   = ((this.agt.indexOf("os/2")!=-1) ||
                    (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                    (this.agt.indexOf("ibm-webexplorer")!=-1));

    this.mac    = (this.agt.indexOf("mac")!=-1);
    // hack ie5 js version for mac
    if (this.mac && this.ie5up) this.js = 1.4;
    this.mac68k = (this.mac && ((this.agt.indexOf("68k")!=-1) ||
                               (this.agt.indexOf("68000")!=-1)));
    this.macppc = (this.mac && ((this.agt.indexOf("ppc")!=-1) ||
                                (this.agt.indexOf("powerpc")!=-1)));

    this.sun   = (this.agt.indexOf("sunos")!=-1);
    this.sun4  = (this.agt.indexOf("sunos 4")!=-1);
    this.sun5  = (this.agt.indexOf("sunos 5")!=-1);
    this.suni86= (this.sun && (this.agt.indexOf("i86")!=-1));
    this.irix  = (this.agt.indexOf("irix") !=-1);    // SGI
    this.irix5 = (this.agt.indexOf("irix 5") !=-1);
    this.irix6 = ((this.agt.indexOf("irix 6") !=-1) || (this.agt.indexOf("irix6") !=-1));
    this.hpux  = (this.agt.indexOf("hp-ux")!=-1);
    this.hpux9 = (this.hpux && (this.agt.indexOf("09.")!=-1));
    this.hpux10= (this.hpux && (this.agt.indexOf("10.")!=-1));
    this.aix   = (this.agt.indexOf("aix") !=-1);      // IBM
    this.aix1  = (this.agt.indexOf("aix 1") !=-1);   
    this.aix2  = (this.agt.indexOf("aix 2") !=-1);   
    this.aix3  = (this.agt.indexOf("aix 3") !=-1);   
    this.aix4  = (this.agt.indexOf("aix 4") !=-1);   
    this.linux = (this.agt.indexOf("inux")!=-1);
    this.sco   = (this.agt.indexOf("sco")!=-1) || (this.agt.indexOf("unix_sv")!=-1);
    this.unixware = (this.agt.indexOf("unix_system_v")!=-1);
    this.mpras    = (this.agt.indexOf("ncr")!=-1);
    this.reliant  = (this.agt.indexOf("reliantunix")!=-1);
    this.dec   = ((this.agt.indexOf("dec")!=-1) || (this.agt.indexOf("osf1")!=-1) ||
           (this.agt.indexOf("dec_alpha")!=-1) || (this.agt.indexOf("alphaserver")!=-1) ||
           (this.agt.indexOf("ultrix")!=-1) || (this.agt.indexOf("alphastation")!=-1));
    this.sinix = (this.agt.indexOf("sinix")!=-1);
    this.freebsd = (this.agt.indexOf("freebsd")!=-1);
    this.bsd = (this.agt.indexOf("bsd")!=-1);
    this.unix  = ((this.agt.indexOf("x11")!=-1) || this.sun || this.irix || this.hpux ||
                 this.sco ||this.unixware || this.mpras || this.reliant ||
                 this.dec || this.sinix || this.aix || this.linux || this.bsd || this.freebsd);

    this.vms   = ((this.agt.indexOf("vax")!=-1) || (this.agt.indexOf("openvms")!=-1));
};

var is = new Is();

/*------------------------------------------------------------
	Compatibilités
------------------------------------------------------------*/
var IS_JQUERY = ( is.ie5_5up ) || ( is.gecko && is.major >= 5 );

function debugUserAgentInfo(){
	var m = '';
	m = append( m, "agent : " + is.agt, "\n" ); 
	m = append( m, "version navigator : " + navigator.appVersion , "\n" ); 
	m = append( m, "version : major[" + is.major + "] minor[" + is.minor , "]\n" ); 
	m = append( m, "version js : " + is.js, "\n" ); 
	m = append( m, "JQuery : " + IS_JQUERY, "\n" ); 
	m = append( m, "parse float : " + parseFloat("5.0") + " " + parseFloat( "5.5" ), "\n" ); 
	alert( m );
};

function append( s1, s2 , s3 ){ return s1 + s2 + s3;	};

var oSH_Element = [];

/**
* Show / Hide a element with JQuery
*
*/
function SH( sEl, force ){
	if ( typeof oSH_Element == "undefined" ) return false;
	var oEl = oSH_Element[ sEl ];
	if ( typeof oEl == "undefined" ) return false;
	if ( typeof force != "undefined"  ){ oEl.visible = !force; }
	var speed = oEl.speed || "normal";
	if ( /\d+/.test( speed ) ) speed = parseInt( speed );
	
	if ( IS_JQUERY ) {
		// avec JQuery
		if ( oEl.visible ){
			switch ( oEl.effect ){
				case 'glisse':
				case 'slide':
					$('#' + oEl.block ).slideUp( speed ); break;
				case 'fondu':
				case 'fade':
					$('#' + oEl.block ).fadeOut( speed ); break;
				case '':
				case 'simple':
				default:
					$('#' + oEl.block ).show(); break;
			}
		} else {
			switch ( oEl.effect ){
				case 'glisse':
				case 'slide':
					$('#' + oEl.block ).slideDown( speed ); break;
				case 'fondu':
				case 'fade':
					$('#' + oEl.block ).fadeIn( speed ); break;
				case '':
				case 'simple':
				default:
					$('#' + oEl.block ).hide(); break;
			}
		}
		$('#' + oEl.image ).set( "src", oEl.imageOff );
		// on modifie l'image
		if ( oEl.image && oEl.imageOn && oEl.imageOff ) $('#' + oEl.image ).set( "src", oEl.visible ? oEl.imageOn : oEl.imageOff );
	}else{
		// sans JQuery
		if ( oEl.visible ) {
			MM_findObj( oEl.block ).style.display = "none";
		}else{
			MM_findObj(  oEl.block ).style.display = "";
		}
		if ( oEl.image && oEl.imageOn && oEl.imageOff ) {
			MM_findObj( oEl.image ).src = oEl.visible ? oEl.imageOn : oEl.imageOff ;
		}
	}
	oEl.visible = ! oEl.visible;
	return true;
};
	
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
};

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
};

function getObj(name)
{
  if (document.getElementById)
  {
	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = document.layers[name];
	this.style = document.layers[name];
  }
};

function menuLeft( totalWidth, menuLeftByCenter ){
	var width = window.page.winW();
	if ( width < totalWidth ) width = totalWidth;
	return Math.round( ( width/ 2 ) - ( menuLeftByCenter / 2) );
};