//=============================================================================
// Fonctions globales Javascript
// Copyright 2007 - M-tech Industries
// Version        : 2.3
// Derniere modif : HJ 23/08/07
//=============================================================================


//-----------------------------------------------------------------------------
// Detection navigateur M-tech Industries (v2) - HJ 070822
//-----------------------------------------------------------------------------

	// ----- Obsolete, utiliser clsNav
	NavName = navigator.appName;
	NavVers = navigator.appVersion; 
	NavCode = navigator.appCodeName; 
	NavAgent = navigator.userAgent;
	NavRealName = NavName;
	var IE4 = (document.all && !document.getElementById) ? true : false;
	var NS4 = (document.layers) ? true : false;
	var IE5 = (document.all && document.getElementById) ? true : false;
	var NS6 = (document.getElementById && !document.all) ? true : false;
	var IE7 = false;
	if (NavVers.indexOf('Mac') > -1) { // Detection de l'OS
		NavOS = "Mac OS";
		if (NavAgent.indexOf('OS X') > -1 || NavAgent.indexOf('OmniWeb') > -1) {
			NavOS = "Mac OS X"; }
		Win=0;
	} else {
		if (NavVers.indexOf('Win') > -1) {
			if (NavAgent.indexOf('NT 5.1') > -1)  NavOS = "Windows XP";
			else if (NavVers.indexOf('NT 5') > -1)  NavOS = "Windows 2000";
			else if (NavVers.indexOf('NT') > -1)  NavOS = "Windows NT";
			else if (NavVers.indexOf('95') > -1)  NavOS = "Windows 95";
			else if (NavVers.indexOf('98') > -1)  NavOS = "Windows 98";		
			else NavOS = "Windows";
			Win=1;
		} else {
			NavOS = "Inconnu"
			Win=-1; } }

//-----------------------------------------------------------------------------
function clsNav() {
	this.soft="--"; // Nom commercial du logiciel : IE / FF / SF / OP / NS
	this.softfull="Navigateur inconnu" // Nom complet
	this.eng="--" // Moteur de rendu : Tr / Ta / Gk / Wk / Pr / Ek
	this.os="O"; // Plateforme : W / M / L / O
	this.vos="Inconnu"; // Version OS : Windows Vista / Mac OS X / Linux Ubuntu / ...
	this.vers="1.0"; // Version complete
	this.vmaj=1; // Version majeure
	this.vmin=0; // Versin mineure
	this.lang="" // Langue

	NavName = navigator.appName;
	NavVers = navigator.appVersion;
	NavVersNum = NavVers.substr(0, 3);
	NavCode = navigator.appCodeName; 
	this.navag = navigator.userAgent;
	this.js = navigator.javaEnabled();

	agent = this.navag.toLowerCase();
	this.major = parseInt(NavVers);
	//this.minor = parseFloat(NavVers);
	this.minor = NavVersNum.substr(NavVersNum.indexOf('.')+1, NavVersNum.length);
	
	this.ns = ((agent.indexOf("mozilla") != -1) && (agent.indexOf("spoofer") == -1) && (agent.indexOf("compatible") == -1) && (agent.indexOf("opera") == -1) && (agent.indexOf("webtv") == -1) && (agent.indexOf("hotjava") == -1));
	this.ns2 = (this.ns && (this.major == 2));
	this.ns3 = (this.ns && (this.major == 3));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	
	this.ie = ((agent.indexOf("msie") != -1) && (agent.indexOf("opera") == -1));
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 4") != -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.") != -1) && (agent.indexOf("msie 5.5") == -1) && (agent.indexOf("mac") == -1));
	this.iem5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.") != -1) && (agent.indexOf("mac") != -1));
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (this.major == 4) && (agent.indexOf("msie 6.") != -1));
	this.ie7 = (this.ie && (this.major == 4) && (agent.indexOf("msie 7") != -1));
	
	this.nsdom = (this.ns4 || this.ns6);
	this.ie5dom = (this.ie5 || this.iem5 || this.ie55);
	this.iedom = (this.ie4 || this.ie5dom || this.ie6);
	this.w3dom = (this.ns6 || this.ie6 ||this.ie7);

	// ----- Detection du type de navigateur
	if(this.ns){this.soft="NS"}
	if(this.ie){this.soft="IE"}
	if(agent.indexOf("firefox")!=-1){this.soft="FF"} 
	if((agent.indexOf("safari")!=-1) && (agent.indexOf("omniweb")==-1) && (agent.indexOf("shiira")==-1)){this.soft="SF"} 
	if(agent.indexOf("opera")!=-1){this.soft="OP"}
	if(agent.indexOf("omniweb")!=-1){this.soft="OW"}
	if(agent.indexOf("camino")!=-1){this.soft="CM"}
	if(agent.indexOf("icab")!=-1){this.soft="IC"}
	if(agent.indexOf("shiira")!=-1){this.soft="SH"}

	// ----- Detection de la version du navigateur
	this.vers=NavVers.substr(0, 3);
	switch (this.soft) {
		case "IE" :
			this.softfull="Internet Explorer"
			this.vers=agent.substr(agent.indexOf('msie')+5, 3);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "NS" :
			this.softfull="Netscape"
			this.vers=agent.substr(agent.indexOf('netscape')+9, 3);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "FF" :
			this.softfull="Firefox"
			this.vers=agent.substr(agent.indexOf('firefox')+8, 7);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "SF" : // Safari
			this.softfull="Safari"
			// Safari 3b : AppleWebKit/522.15.5 (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5
			this.vers=agent.substr(agent.indexOf('safari')+7, 5);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "OP" : // Opera
			this.softfull="Opera"
			this.vers=agent.substr(agent.indexOf('opera')+6, 4);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "OW" : // Omniweb
			this.softfull="Omniweb"
			this.vers=agent.substr(agent.indexOf('omniweb')+9, 5);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "CM" : // Camino
			this.softfull="Camino"
			this.vers=agent.substr(agent.indexOf('camino')+7, 3);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "IC" : // iCab
			this.softfull="iCab"
			this.vers=agent.substr(agent.indexOf('icab')+5, 5);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		case "SH" : // Shiira
			this.softfull="Shiira"
			this.vers=agent.substr(agent.indexOf('applewebkit')+12, 7);
			this.vmaj=parseInt(this.vers);
			this.vmin=this.vers.substr(this.vers.indexOf('.')+1, this.vers.length);
			break;
		default :
			this.vmaj=this.major;
			this.vmin=this.minor;
	}

	// ----- Detection de l'OS
	if (agent.indexOf('mac') > -1) {
		this.os="M";
		this.vos="Mac OS";
		if (agent.indexOf('os x') != -1 || this.soft=="OW") {
			this.vos="Mac OS X";
		}
	} else {
		if (agent.indexOf('win') > -1) {
			this.os="W";
			if (agent.indexOf('nt 6') > -1)  this.vos="Windows Vista";
			else if (agent.indexOf('nt 5.1') > -1)  this.vos="Windows XP";
			else if (agent.indexOf('nt 5') > -1)  this.vos="Windows 2000";
			else if (agent.indexOf('nt') > -1)  this.vos="Windows NT";
			else if (agent.indexOf('95') > -1)  this.vos="Windows 95";
			else if (agent.indexOf('98') > -1)  this.vos="Windows 98";		
			else this.vos="Windows";
		} else {
			if (agent.indexOf('linux') > -1) {
				this.os="L";
				this.vos="Linux";
				if (agent.indexOf('ubuntu') > -1) this.vos="Linux Ubuntu";
			}
		}
	}

	// ----- Detection du moteur de rendu
	if(this.ie){this.eng="Trident"} //ou MSHTML
	if(this.iem5){this.eng="Tasman"}
	if((this.soft=="NS") && (this.vmaj==5)){this.eng="Mariner"}
	if(agent.indexOf('applewebkit')>-1){this.eng="Webkit"} // ou KHTML
	if((this.soft=="FF") || ((agent.indexOf('gecko')>-1) && ((agent.indexOf('applewebkit')==-1)))){this.eng="Gecko"}
	if((this.soft=="OP") && (this.vmaj<7)){this.eng="Elektra"}
	if((this.soft=="OP") && (this.vmaj>=7)){this.eng="Presto"}
	if(this.soft=="IC"){this.eng="iCab"}

	// ----- Detection de la langue
	NavLangFR = 'Inconnu...';
	//if (this.ie4 || this.ie5)
	if (this.ie)
		this.lang = navigator.browserLanguage;
	else
		this.lang = navigator.language;
	
	if (this.lang.indexOf('fr') > -1) NavLangFR = 'Fran&ccedil;ais';
	else if (this.lang.indexOf('nl') > -1) NavLangFR = 'Neerlandais';
	else if (this.lang.indexOf('en') > -1) NavLangFR = 'Anglais';
	else if (this.lang.indexOf('de') > -1) NavLangFR = 'Allemand';
	else if (this.lang.indexOf('ja') > -1) NavLangFR = 'Japonais';
	else if (this.lang.indexOf('it') > -1) NavLangFR = 'Italien';
	else if (this.lang.indexOf('pt') > -1) NavLangFR = 'Portugais';
	else if (this.lang.indexOf('es') > -1) NavLangFR = 'Espagnol';
	else if (this.lang.indexOf('sv') > -1) NavLangFR = 'Suedois';
	else if (this.lang.indexOf('zh') > -1) NavLangFR = 'Chinois';
	// Pour rediriger selon la langue :
	//if (NavLang.indexOf('zh') > -1) document.location.href = NavLangFR +'.html';
	
	IE7=this.ie7;
}
clsNav.prototype.DisplayNavInfos = function(mode) {
// ----- Affichage des infos
// mode : false=ds page; true=alert
	var inf="";
	var sep="<br />";
	var bs="<b>";
	var be="</b>";
	if(mode) { sep="\n";bs="";be="" }
	inf+="Nom du navigateur : " + bs + this.softfull + be + sep;
	inf+="Version du navigateur : " + bs + this.vmaj+"."+this.vmin + be + sep;
	inf+="Moteur de rendu : " + bs + this.eng + be + sep;
	inf+="Agent du navigateur : " + bs + this.navag + be + sep;
	inf+=unescape("D%E9tails du navigateur : ") + bs + NavVers + be + sep;
	inf+="Code du navigateur : " + bs + NavCode + be + sep;
	inf+="Javascript actif : " + bs + this.js + be + sep;
	inf+="Plateforme   : " + bs + this.os + be + sep;
	inf+="OS du navigateur : " + bs + this.vos + be + sep;
	inf+="Langue du navigateur : " + bs + this.lang + " (" + NavLangFR + ")" + be + sep;
	if(mode) { alert(inf); } else { document.write(inf); }
}
var is = new clsNav();


//-----------------------------------------------------------------------------
// Gestion de fenetres
//-----------------------------------------------------------------------------


function LanceSite() {
	//alert(document.URL + "\n" + document.SitesForm.listeSites.value);
	//document.URL=document.SitesForm.listeSites.value;
	window.location=document.FormEdit.listeData.value
	return false;
}


function newWindow(wUrl,wName,wParams) {
//* url, name, width, height, resizable, scrollbars, menubar, toolbar, directories, location, status
	//url='calend.asp?champ='+field;
	//alert(wName);
	if (wName == "") {
		wName="theWin";
	}
	if (wParams == "") {
		wParams="width=300,height=200,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no";
	}
	theWindow=window.open(wUrl,wName,wParams);
	theWindow.focus();
}


function remLink() {
  if (window.theWindow && window.theWindow.open && !window.theWindow.closed)
    window.theWindow.opener = null;
}


// Impression de la fenetre
function PrintWindow() {
    if (window.print) {
        if (confirm(std_TT["PRINT"])) {
            window.print();
        }
    } else {
		alert(std_TT["USE_PRINT_MENU"] + NavName + ".\n" + NavName + " " + NavVersNum + " (" + NavOS + std_TT["NO_PRINT_FN"]);
    }
}

function GetMaxPossibleWidth(theMode,minWidth,marginWidth) {
// Calcule la largeur maxi possible pour ouvrir une nvelle fenetre
// theMode		: taille max / S(creen) ou P(arent)
// minWidth		: largeur mini
// marginWidth	: marge optionnelle gauche et droite
	// Recup taille fenetre parente :
	if (self.innerWidth) {
		parentWidth = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) { // Explorer 6 Strict Mode
		parentWidth = document.documentElement.clientWidth;
	} else if (document.body) { // other Explorers
		parentWidth = document.body.clientWidth; }
	
	if (theMode == "S") { theW=self.screen.availWidth-marginWidth; } else { theW=parentWidth-marginWidth; }
	if (theW<minWidth) { theW=minWidth; }
	
	return theW;
}

function GetMaxPossibleHeight(theMode,minHeight,marginHeight) {
// Calcule la largeur maxi possible pour ouvrir une nvelle fenetre
// theMode		: taille max / S(creen) ou P(arent)
// minHeight	: hauteur mini
// marginHeight	: marge optionnelle haut et bas
	// Recup taille fenetre parente :
	if (self.innerHeight) { // tous sauf Explorer
		parentHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		parentHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		parentHeight = document.body.clientHeight; }

	if (theMode == "S") { theH=self.screen.availHeight-marginHeight; } else { theH=parentHeight-marginHeight; }
	if (theH<minHeight) { theH=minHeight; }
	
	return theH;
}

function LocateWindow(theMode,alignX,alignY,deltaX,deltaY) {
// Positionnement de la fenetre a l'ecran
// http://www.xs4all.nl/~ppk/js/winprop.html
// !!! Chgt de parametres le 27/09/02 par HJ
// theMode : S(creen) ou P(arent)
// alignX : G(auche), M(ilieu) ou D(roite)
// alignY : H(aut), M(ilieu) ou B(as)

	// Recup taille zone interieur fenetre :
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	else return;
	
	// Recup taille fenetre parente :
	if (self.innerWidth)
	{
		parentWidth = window.opener.self.innerWidth;
		parentHeight = window.opener.self.innerHeight;
	}
	else if (document.body)
	{
		parentWidth = window.opener.document.body.clientWidth;
		parentHeight = window.opener.document.body.clientHeight;
	}
	else return;

	// Recup position fenetre parente :
	if (self.innerWidth) {
		parentX = window.opener.self.screenX;
		parentY = window.opener.self.screenY;
	} else if (window.screenTop) { // document.body
		parentX = window.opener.screenLeft;
		parentY = window.opener.screenTop;
		} else {
			parentX = 0;
			parentY = 0;
		}

//alert(frameWidth + " x " + frameHeight + "\n" + parentWidth + " x " + parentHeight + "\n" + parentX + "," + parentY);

	switch (alignX) {
		case "G" :
			if (theMode == "S") {
				posX=deltaX;
			} else {
				posX=parentX+deltaX;
			}
			break;
		case "D" :
			if (theMode == "S") {
				posX=self.screen.width-deltaX-frameWidth;
			} else {
				posX=(parentX+parentWidth)-deltaX-frameWidth;
			}
			break;
		default :
			if (theMode == "S") {
				posX=(self.screen.width-frameWidth)/2+deltaX;
			} else {
				posX=parentX+(parentWidth-frameWidth)/2+deltaX;
			}
			// Autres cas
	}
	
	switch (alignY) {
		case "H" :
			if (theMode == "S") {
				posY=deltaY;
			} else {
				posY=parentY+deltaY;
			}
			break;
		case "B" :
			if (theMode == "S") {
				posY=self.screen.height-deltaY-frameHeight;
			} else {
				posY=(parentY+parentHeight)-deltaY-frameHeight;
			}
			break;
		default :
			if (theMode == "S") {
				posY=(self.screen.height-frameHeight)/2+deltaY;
			} else {
				posY=parentY+(parentHeight-frameHeight)/2+deltaY;
				//alert("posY : P " + posY);
			}
			// Autres cas
	}
	
	if ((posX+frameWidth)>self.screen.width) {
		posX=self.screen.width-frameWidth;
	}
	if ((posY+frameHeight)>self.screen.height) {
		posY=self.screen.height-frameHeight;
	}
	parent.window.moveTo(posX,posY);

}


//-----------------------------------------------------------------------------
// Gestion de l'aide
//-----------------------------------------------------------------------------
var isHelpOn = false;

function activateHelpBub() {
	var helpOption = (document.getElementById) ? document.getElementById('BtHelp') : eval("document.all['BtHelp']");
	var helpPanOption = (document.getElementById) ? document.getElementById('BtHelpPanel') : eval("document.all['BtHelpPanel']");
	var helpPanel = (document.getElementById) ? document.getElementById('HelpArea') : eval("document.all['HelpArea']");
	isHelpOn=helpOption.checked;
	if (isHelpOn) {
		helpPanOption.checked=false;
		activateHelpPanel();
		//helpPanel.style.visibility="visible";
		//helpPanel.style.display="inline"; //"block"
		//helpPanel.style.left="0px";
	} else {
		//helpPanel.style.visibility="hidden";
		helpPanel.style.display="none";
	}
}

function activateHelpPanel() {
	var divs,i;
	divs=document.getElementsByTagName('div');
	var helpOption = (document.getElementById) ? document.getElementById('BtHelp') : eval("document.all['BtHelp']");
	var helpPanOption = (document.getElementById) ? document.getElementById('BtHelpPanel') : eval("document.all['BtHelpPanel']");
	var helpPanel = (document.getElementById) ? document.getElementById('HelpArea') : eval("document.all['HelpArea']");
	if (helpPanOption.checked) {
		helpOption.checked=false;
		isHelpOn = false
		helpPanel.style.position="absolute";
		helpPanel.style.display="block"; //"block";
		helpPanel.style.right="0px";
		/* helpPanel.style.width="250px"; */
		for(i in divs) {
			if(divs[i].className=="helpPop") {
				divs[i].style.visibility="visible";
				divs[i].style.display="block";
				divs[i].style.position="relative";
				divs[i].style.top="auto";
				divs[i].style.left="auto";
			}
		}
	} else {
		helpPanel.style.position="absolute"; // "relative";
		helpPanel.style.display="none";
		helpPanel.style.right="auto";
		for(i in divs) {
			if(divs[i].className=="helpPop") {
				divs[i].style.visibility="hidden";
				divs[i].style.display="none";
				divs[i].style.position="absolute";
			}
		}
	}
}

/* Script "z'experts" : http://perso.wanadoo.fr/coin.des.experts/
   delivre sans aucune garantie, ni des auteurs, ni du gouvernement. 
   Diffusion libre, mais merci de conserver cette signature :-)  */
   
/* Attention au doctype : si vous en mettez un (c'est quand meme mieux) et 
   si voulez que ca fonctionne avec IE6 il faut un HTLM 4 transitional **SANS URL**
   (cf ci-dessus), c.a.d. IE6 doit rester dans son mode "microsoft".
   Toujours ? cause des bugs de IE6, n'essayez pas de permuter les
   tests sur document.all et sur document.getElementById */   

/* Les bulles doivent avoir ete preparees dans autant de calques separes
   en position:absolute (sans qu'il soit necessaire de preciser de top ou 
   left) que l'on rendra invisible (visibility:hidden). Il est important 
   d'avoir fixe la largeur et la hauteur de ces calques-bulles EN PIXELS. */

 /* La fonction tipShow() qui ouvre la bulle d'aide doit etre appelee 
    avec 2 arguments:
   - le premier est l'identificateur (ID) du calque a faire apparaitre. 
   - LE DEUXIEME EST OBLIGATOIREMENT "event" (sans les guillemets) 
   c.a.d. un mot cle du javascript.
  */

var bulleStyle=null;
if (!document.layers && !document.all && !document.getElementById)
   event="chut";  //pour apaiser NN3 et autres antiquites


function tipShow(idd,evt) {
	var xfenetre,yfenetre,xpage,ypage,element=null;
	var offset= 20;           // decalage par defaut
	var bulleWidth=200;       // largeur par defaut 
	var hauteur=50;           // hauteur par defaut
	bulleStyle=null;
	
	if (isHelpOn) {
		var helpPanel = (document.getElementById) ? document.getElementById('HelpArea') : eval("document.all['HelpArea']");
		if (document.layers) {
			bulleStyle=document.layers[idd];
			xpage = evt.pageX ; ypage  = evt.pageY;
			xfenetre = xpage ;yfenetre = ypage ;
			} else if (document.all) {
			element=document.all[idd]
			xfenetre = evt.x ;yfenetre = evt.y ;
			xpage=xfenetre ; ypage=yfenetre ;
			if (document.body.scrollLeft) xpage = xfenetre + document.body.scrollLeft ; 
			if (document.body.scrollTop) ypage = yfenetre + document.body.scrollTop;
			} else if (document.getElementById) {
			  element=document.getElementById(idd)
			xfenetre = evt.clientX ; yfenetre = evt.clientY ;
			xpage=xfenetre ; ypage=yfenetre ;
			if(evt.pageX) xpage = evt.pageX ;
			if(evt.pageY) ypage  = evt.pageY ;
		}
		
		if(element)  bulleStyle=element.style;
				
		if(bulleStyle) {
			
			var yp0=ypage; var yf0=yfenetre;
			
			/* tests incongrus ? cause d'Opera5 */
			if(bulleStyle.width) bulleWidth = parseFloat(bulleStyle.width);
			if(bulleStyle.height) hauteur = parseFloat(bulleStyle.height);
			
			/* on met la bulle ? gauche du pointeur (si c'est possible) 
				et en haut du pointeur si on est assez bas dans l'ecran */
				
			if (xfenetre > bulleWidth+offset) xpage=xpage-bulleWidth-offset;
			else {
				 if (xfenetre >0.5*bulleWidth+offset) xpage=xpage-0.5*bulleWidth-offset;
						 else xpage=xpage+15; }
			if ( yfenetre > hauteur+offset ) ypage=ypage-hauteur-offset
				 else ypage=ypage+offset;
				 
				/* a cause des debilites d'Opera5 il faut rectifier 'ypage' pour eviter
				   que la bulle ne s'ouvre par-dessus la souris. La bulle s'ouvrira
					 TOUJOURS en bas avec Opera5. Derniere vacherie : il faut faire le test sur
					 bulleStyle.width pour se proteger des distraits qui n'auront pas
					 rempli bulleStyle.height */
				
			if (!bulleStyle.width)	ypage=yfenetre+offset;
			if(typeof(bulleStyle.left)=='string') {
				bulleStyle.left=xpage+'px'; bulleStyle.top=ypage+'px';  
			} else {
				bulleStyle.left=xpage     ; bulleStyle.top=ypage ;
			}
			helpPanel.style.display="block";
			bulleStyle.visibility="visible";
			bulleStyle.display="block";
			bulleStyle.zIndex="99";
		}
	}
}
 
function tipHide(){
	if(bulleStyle) {
		var helpPanel = (document.getElementById) ? document.getElementById('HelpArea') : eval("document.all['HelpArea']");
		bulleStyle.visibility="hidden";
		bulleStyle.display="none";
		helpPanel.style.display="none";
	}
}


//-----------------------------------------------------------------------------
// Gestion des images
//-----------------------------------------------------------------------------


function ChangePict(thePict, theWidth, theHeight, theName, theOptions, theMode) {
// Cree ou met a jour une image en adaptant la taille
// theMode : 0 = creation (document.write) 1 = update (document.src)
// ViewWidth : Largeur maxi d'affichage en pixels (0 sinon). Var globale.
// ViewHeight : Hauteur maxi d'affichage en pixels (0 sinon). Var globale.

	if (theName=="")  { theName="thePictName"; }

	if (ViewWidth>0 && theWidth>ViewWidth) {
		dispWidth=ViewWidth
		dispHeight=Math.round(ViewWidth*theHeight/theWidth)
	} else {
		dispWidth=theWidth
		dispHeight=theHeight	
	}
	if (ViewHeight>0  && theHeight>ViewHeight)  {
		dispWidth=Math.round(dispWidth*ViewHeight/dispHeight)
		dispHeight=ViewHeight			
	}
	
	if (theMode) {
		document.images[theName].src=thePict;
		document.images[theName].width=dispWidth;
		document.images[theName].height=dispHeight;
	} else {
		document.write("<img height=" + dispHeight + " width=" + dispWidth + " ")	
		document.write("src='" + thePict + "' " )
		document.write("name='" + theName + "' " + theOptions + ">")
	}
}


function DelPict(theImgObj,theField,theNoPictSrc) {
	if (theImgObj.src.indexOf('common/nopict.gif') < 1) {
		if (validerSuppr(1)==true) { // Necessite Checkdata_lib.js !
			theImgObj.src=theNoPictSrc;
			theImgObj.border=0;
			theImgObj.width=100;
			theImgObj.height=54;
			tmp=eval("document.FormEdit.elements['" + theField + "']"); // HJ 070108
			tmp.value='';
			if (document.getElementById('Del'+theField)){
				DelPictSuite(theField);
			}
		}
	} else {
		alert(std_TT["NOTHING"]);
	}
}

function DelFile(theFormField) {
	theFormField.value='';
}


function OpenPict(theImgObj,W,H) {
// Ouvre une image en adaptant la taille de la fenetre
	//theImgObj.src.indexOf('common/nopict.gif') < 1
	if (W==0 || H==0) {
		W=theImgObj.width;
		H=theImgObj.height;
	}
	if (W > 40 && H > 40) {
		if (!is.ie) {
			W += 15;
			H += 15;
		} else
		{
			W += 5;
			H += 5;
		}
	} else {
		W=600;
		H=400;
	}
	newWindow(theImgObj.src,'wPict','width=' + W + ',height=' + H + ',resizable=yes,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no');
}

theWindowCont="francais/showpict.html";

function OpenPictInWindow(pictName) {
	theWindow=window.open(pictPath + pictName,'wPict','width=' + '640' + ',height=' + '400' + ',resizable=yes,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no');	
//	theWindow=window.open(homePath+theWindowCont,'wPict','width=' + '320' + ',height=' + '240' + ',resizable=yes,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no');	
/*	n=1;
	while( n < 10000 ) {
		n ++
	}
	alert(theWindow.onLoad);
	alert(theWindow.document.images.length + "\n" + theWindow.document.url);*/
	//alert(theWindow.innerHeight + "\n" + theWindow.document.thePict.width);
	//theWindow.resizeTo(theWindow.document.theCustPict.width + 40,theWindow.document.theCustPict.height + 60);
//	theWindow.document.theCustPict.src=homePath+ pictPath + pictName;
	theWindow.focus();
}


// Interdiction clic droit
function disableClick(e) {
	if (IE4) { // IE
		if (event.button==2||event.button==3) {
			if (event.srcElement.tagName=="IMG"){
				alert(theCopyRight);
				return false; } } }
	else if (NS4) { // NS 4
		if (e.which == 3) {
			alert(theCopyRight);
			return false; } }
	else if (NS6){ // NS 6
		if (e.which==3&&e.target.tagName=="IMG"){
			alert(theCopyRight)
			return false } }
}

function imageEvents() {
	for(i=0;i<document.images.length;i++)
		document.images[i].onmousedown=disableClick; // Event !
}

function noClick() { // Pour declencher, mettre dans BODY onload=noClick()
if (IE4)
	document.onmousedown=disableClick
else if (NS6)
	document.onmouseup=disableClick
else if (NS4)
	imageEvents()
}


//-----------------------------------------------------------------------------
// Gestion de temps de chargement de fichier
//-----------------------------------------------------------------------------
// Utilisation :
//	theSize=5066646;theConn=2;
//	document.write("(" + RoundSize(theSize,1) + " - " + RoundTime(GetDownloadTime(theSize,speedsConn[theConn])) +
//			" par " + namesConn[theConn] + ")");

// Globales
var namesConn=new Array(std_TT["M28"],std_TT["M33"],std_TT["M56"],std_TT["ISDN"],std_TT["ADSL"],std_TT["T1"],std_TT["T3"]);
var speedsConn=new Array(28800,33600,56000,64000,128000,256000,384000);

function GetDownloadTime(theSize,theSpeed) {	
	return Math.round(theSize/(theSpeed/8)); // Renvoie des s
}

function RoundTime(theTime) { // Temps en s
	if (theTime < 60) {
		theTimeStr=theTime + "&nbsp;s"
		//Date.getSeconds()
	} else {
		if (theTime < 3600) {
			theTimeStr=Math.round((theTime/60) - 0.5) + "&nbsp;mn&nbsp;" + theTime % 60  + "&nbsp;s"
			//Date.getMinutes()
		} else {
			theTimeStr=Math.round((theTime/3600) - 0.5) + "&nbsp;h&nbsp;" + theTime % 3600  + "&nbsp;mn"
			//Date.getHours()
		}
	}
	return theTimeStr;
}

function RoundSize(theSize,thePrec) { // Taille en octets
	thePrec=Math.round(thePrec);
	if (thePrec < 0) { thePrec=0; }
	if (theSize < 1024) {
		theSizeStr=theSize + "&nbsp;" + std_TT["BYTES"]
	} else {
		if (theSize < (1024*1024)) {
			theSizeStr=Math.round((theSize/1024)*Math.pow(10,thePrec))/Math.pow(10,thePrec) + "&nbsp;" + std_TT["KB"]
		} else {
			theSizeStr=Math.round((theSize/1024/1024)*Math.pow(10,thePrec))/Math.pow(10,thePrec) + "&nbsp;" + std_TT["MB"]
		}
	}
	return theSizeStr;
}

function IsNew(theDate,theMsg,theCSS) {
// Ecrit "Nouveau" si theDate validite > date jour
	var theToday = new Date();
	theDisp=theMsg;
	if (theMsg=="") {theDisp=std_TT["NEW"];}
	if (theToday<=theDate) {
		if (theCSS != "") {
			document.write("<span class='" + theCSS + "'>" + theDisp + "</span>");
		} else {
			document.write(theDisp);
		}
	}
}


//-----------------------------------------------------------------------------
// Chaines - [HJ 20/04/07]
//-----------------------------------------------------------------------------
function Left(str, n){
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}

function Right(str, n){
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else {
		var iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
	}
}


//-----------------------------------------------------------------------------
// Cookies - HJ 17/09/03
//-----------------------------------------------------------------------------
function CookieSet (name, value) {
	var argv=CookieSet.arguments;
	var argc=CookieSet.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function CookieGet (name) {
	var arg=name+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg)
                       return CookieGetVal (j);
               i=document.cookie.indexOf(" ",i)+1;
                       if (i==0) break;}
	return null;
}

function CookieGetVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1)
     		endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}



//-----------------------------------------------------------------------------
// Debug
//-----------------------------------------------------------------------------
// Pour debug mettre dans la page:
// var DebugOn=false;
function DisplayDebug(theString) {	
	if ( DebugOn ) alert(theString); }


// Affichage des propriete de l'ecran
function PrintScreenProperties() {

var props = new Array(
	'self.pageXOffset',
	'self.pageYOffset',
	'self.screenX',
	'self.screenY',
	'self.innerHeight',
	'self.innerWidth',
	'self.outerHeight',
	'self.outerWidth',
	'self.screen.height',
	'self.screen.width',
	'self.screen.availHeight',
	'self.screen.availWidth',
	'self.screen.availTop',
	'self.screen.availLeft',
	'self.screen.Top',
	'self.screen.Left',
	'self.screenTop',
	'self.screenLeft',
	'self.screen.colorDepth',
	'self.screen.pixelDepth',
	'document.body.clientHeight',
	'document.body.clientWidth',
	'document.body.scrollHeight',
	'document.body.scrollWidth',
	'document.body.scrollLeft',
	'document.body.scrollTop',
	'document.body.offsetHeight',
	'document.body.offsetWidth',
	'document.body.offsetTop',
	'document.body.offsetLeft');

	for (var i=0;i<props.length;i++)
	{
		if (!self.screen && props[i].indexOf('self.screen') != -1) continue;
		if (!document.body && props[i].indexOf('document.body') != -1) continue;
		if (eval(props[i])) document.write('<br />' + props[i] + ': ' + eval(props[i]));
	}
}

