// VP : 30/11/2005 : Type thesaurus dans showAndInitRechInd()// VP : 22/11/2005 : Test existance dans MaJChamp()// VP : 07/11/2005 : Modification retour valeurs dans MaJChamp()// XS : 18/10/2005 : Ajout de la fonction "explodeArray()" + Simplification du traitement des index, utilisation de la seule fonction "showAndInitRechInd()"// XS : 13/10/2005 : Modif de MaJChamp pour que les valeurs du champs input se concatennent// XS : 05/10/2005 : Modification de la  fonction "removeLine()", ajout d'un param�tre "type" + Ajout de la gestion des cancels (retour de la fonction "confirm()") dans "removeLine()" et "removeAll()"// XS : 27/09/2005 : Fonction affiche/cache qui permet d'afficher/chacher des �l�ments + Cr�ation de "removeAll()"// JC : 17/06/2005 : rajout d'un fonction pour se connecter facilement (d�mo opsis uniquement)// JC : 01/06/2005 : rajout de quelques fonctions pour la recherche avanc�e// JavaScript Document/** Récupère la valeur d'un paramètre dans une url. IN: param, OUT:valeur (string) **/function getURLParam(strParamName){  var strReturn = "";  var strHref = window.location.href;  if ( strHref.indexOf("&") > -1 ){    var strQueryString = strHref.substr(strHref.indexOf("&")).toLowerCase();    var aQueryString = strQueryString.split("&");    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){      if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){        var aParam = aQueryString[iParam].split("=");        strReturn = aParam[1];        break;      }    }  }  return strReturn;}function checkAll() {    // fonction appelee lors du clic sur une checkbox    var compteur = 0;    for (var j = 1; j <= document.form1.length-1; j++) {    box = eval("document.liste.checkbox" + j);    if (box.checked == true) compteur += 1;   }   //alert("You selected " + compteur + " boxes.");    compteurPanier(compteur);}function compteurPanier(valeur){    // fonction qui affiche dans le compteur du panier le nombre de document selectionnes    //if(valeur!=null) document.all['compteur'].innerHTML=valeur;    if(valeur!=null) document.panier.compteur.value=document.panier.compteurref.value+valeur;    else document.write('0');}function reloadIframe(id){    var url;    box = eval("document.documentSelection.checkbox" + id);    if(box.checked==true) url="iframePanier.php?ajouteDoc="+id;    else url="iframePanier.php?enleveDoc="+id;    document.getElementById('framePanier').src=url;}function ajouterPanier(id){    document.getElementById('framePanier').src="iframePanier.php?ajouteDoc="+id;}function addItem() {    document.form1.commande.value="ADD";    document.form1.submit();}function removeVersion(version) {	if (confirm("Confirmez-vous la suppression de cette version ?")) {		document.form1.commande.value="SUP";		document.form1.version2suppr.value=version;		document.form1.submit();		}}function removeItem(url) {    if (confirm("Confirmez-vous la suppression ?")) {        document.form1.commande.value="SUP";        document.form1.page.value=url;        document.form1.submit();        }}function duplicateItem(url) {     if (confirm("Confirmez-vous la duplication ?")) {        document.form1.commande.value="DUP";        if (url && url!='') document.form1.page.value=url;        document.form1.submit();     }}function save() {    document.form1.commande.value="SAVE";    document.form1.submit();}function saveAndGo(url) {	// Le formulaire doit avoir un champ save_action qui détermine le type de sauvegarde	// à effectuer (ex : doc, sequence, matériel, etc...)	if (!document.form1.save_action) commande="SAVE";	else commande=document.form1.save_action.value;    document.form1.commande.value=commande;    document.form1.page.value=url;    document.form1.submit();}function submitKey() {    if(event.keyCode == 13){        submitForm();    }}function submitForm() {    document.form1.submit();}function goUrl(url) {    document.form1.action=url;    document.form1.submit();}function getSiteRoot() {	url=window.location.href.split('?');	return url[0];}function removeAll() {    if (confirm("Confirmez-vous la suppression de toutes les lignes ?")) {        document.form1.commande.value="SUP_ALL";        document.form1.submit();    }else{        document.form1.commande.value="CANCEL";        document.form1.submit();    }}function removeLine(i,type,action) {    if (confirm("Confirmez-vous la suppression de la ligne ? ")) {        document.form1.ligne.value=i;        if (typeof(action)=='undefined') action="SUP";        document.form1.commande.value=action;        if (type){            document.form1.type.value=type;        }        document.form1.submit();    }else{    	if (typeof(action)=='undefined') action="CANCEL";        document.form1.commande.value=action;        document.form1.submit();    }}function updateLine(i,action) {    document.form1.ligne.value=i;    if (typeof(action)=='undefined') action="SAVE";    document.form1.commande.value=action;    document.form1.submit();}function addLine(i,action) {    document.form1.ligne.value=i;    if (typeof(action)=='undefined') action="ADD";    document.form1.commande.value=action;    document.form1.submit();}function popupWindow(newURL, newName, newFeatures, orgName) {  var remote = open(newURL, newName, newFeatures);  if (remote.opener == null)    remote.opener = window;  remote.opener.name = orgName;  remote.focus();  //return remote;}function popupVideo(newURL,orgName,w,h){	if (!w) w=512; if(!h) h=335;    if(newURL.indexOf("popUpVisionnage")==0) {    // Appel capsule    popupWindow(newURL, 'Visionnage', 'height='+h+', width='+w+',screenX=50,left=50,screenY=50,top=50,fullscreen=0,resizable=1,scrollbars=0,menubar=0,toolbar=0', orgName);    } else {    // Appel player    popupWindow(newURL, 'Visionnage', 'height=400,width=400,screenX=50,left=50,screenY=50,top=50,fullscreen=0,resizable=1,scrollbars=0,menubar=0,toolbar=0', orgName);    }}function popupPrint(newURL,orgName){    popupWindow(newURL, 'Print','height=500,width=520,screenX=100,left=100,screenY=100,top=100,fullscreen=0,resizable=1,scrollbars=1,menubar=1,toolbar=1', orgName);}function popupUpload(newURL,orgName,type){    //alert(window['Upload_'+type]);    // on n'ouvre pas si elle existe déjà car on pourrait annuler un transfert en cours    popupWindow(newURL, 'Upload_'+type,'height=600,width=480,screenX=100,left=100,screenY=100,top=100,fullscreen=0,resizable=1,scrollbars=1,menubar=0,toolbar=0,status=1', orgName);}function popupDoc(newURL,orgName){    popupWindow(newURL, 'Document','height=600,width=900,screenX=50,left=50,screenY=50,top=50,fullscreen=0,resizable=1,scrollbars=1,menubar=1,toolbar=1', orgName);}function popupLex(newURL,orgName){    popupWindow(newURL, 'Lexique','height=500,width=600,screenX=350,left=350,screenY=150,top=150,fullscreen=0,resizable=1,scrollbars=1,menubar=0,toolbar=0', orgName);}function popupVal(newURL,orgName){    popupWindow(newURL, 'Valeurs','height=500,width=500,screenX=350,left=350,screenY=150,top=150,fullscreen=0,resizable=1,scrollbars=1,menubar=0,toolbar=0', orgName);}function popupMat(newURL,orgName){    popupWindow(newURL, 'Materiel','height=600,width=500,screenX=300,left=300,screenY=100,top=100,fullscreen=0,resizable=1,scrollbars=1,menubar=0,toolbar=0', orgName);}function popupUsager(newURL,orgName){    popupWindow(newURL, 'Usager','height=600,width=500,screenX=300,left=350,screenY=100,top=100,fullscreen=0,resizable=1,scrollbars=1,menubar=0,toolbar=0', orgName);}function popupSelect(newURL,orgName){    popupWindow(newURL, 'Select','height=500,width=500,screenX=250,left=250,screenY=150,top=150,fullscreen=0,resizable=0,scrollbars=auto,menubar=0,toolbar=0', orgName);}function popupAbout(newURL,orgName){    popupWindow(newURL, 'About','height=200,width=200,screenX=350,left=350,screenY=250,top=150,fullscreen=0,resizable=0,scrollbars=auto,menubar=0,toolbar=0', orgName);}function popupSave(newURL,orgName){    popupWindow(newURL, 'About','height=100,width=400,screenX=350,left=350,screenY=250,top=150,fullscreen=0,resizable=0,scrollbars=auto,menubar=0,toolbar=0', orgName);}function popupImage(img,txt) {		window.open("popupImage.php?img="+img+"&amp;txt="+txt,'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');//onblur='window.close()' onclick='window.close()'}function popupInfo(newURL,orgName){    popupWindow(newURL, 'Info','height=400,width=790,screenX=100,left=100,screenY=100,top=100,fullscreen=0,resizable=1,scrollbars=1,menubar=0,toolbar=0', orgName);}function popupPersonne(newURL,orgName){    popupWindow(newURL, 'Personne','height=550,width=800,screenX=150,left=150,screenY=100,top=100,fullscreen=0,resizable=1,scrollbars=1,menubar=0,toolbar=0', orgName);}function popupPlayerFlash(id){    document.getElementById('player').src="popupPlayerFlash.php?id_doc="+id;}function copyValue(f1,f2) {    if(f2.value=='') f2.value=f1.value;}/* Assigne une valeur à un champ, qq soit son type*/function setValue(val,field,matchcase) {	if (field.type=='text' || field.type=='textarea') field.value=val;	if (field.type=='select-one') {		for(i=0;i<field.length;i++) {			if (field.options[i].value==val && matchcase) field.options[i].selected=true;			if (field.options[i].value.toLowerCase()==val.toLowerCase() && !matchcase) field.options[i].selected=true;		}	}	//to be continued...}function setValues(f1,f2) {    if(f1.value!='') {        f2.value=f1.value;        f2.text=f1.text;        }}function setValueBox(box,field) {	var val="";	for(i=0;i<box.length;i++){		if(box[i].checked) {			if(val=='') val= box[i].value;			else val+=", "+box[i].value;			}	}    field.value=val;}function selectMenu(f,url,src) {    if(f.selectedIndex==2){    //Selection    popupSelect(url, src)    }    else if(f.selectedIndex==3) {    //Suppression        f.options[0].value='';        f.options[0].text=''        }    f.selectedIndex=0;}function selectMenuAndSend(f,url,src) {    if(f.selectedIndex==2){    //Selection    popupSelect(url, src)    }    else if(f.selectedIndex==3) {    //Suppression        f.options[0].value='';        f.options[0].text=''        f.selectedIndex=0;        }    f.selectedIndex=0;        document.form1.commande.value='SELECT'        document.form1.submit();}function formatDate(srcField) {    var value_date = srcField.value;    if ( (value_date.length == 4) && (value_date.indexOf("-") == -1) ) {        value_date = value_date  + "-";        srcField.value = value_date;    }    if ( (value_date.length == 7) && (value_date.lastIndexOf("-") == 4) ) {        value_date = value_date  + "-";        srcField.value = value_date;    }     p = "--";    if (value_date.match(p)) {        value_date = value_date.replace(p, "-");        srcField.value = value_date;    }}function formatNum(n) {if(n<10) return "0"+n;else return n;}function formatTime(srcField) {    var value_tc = srcField.value;    if ( (value_tc.length == 1) && (value_tc.indexOf("0") == -1) && (value_tc.indexOf("1") == -1) && (value_tc.indexOf("2") == -1) ) {       srcField.value = "";        return;    }    if ( (value_tc.length == 2) && (value_tc.indexOf(":") == -1) ) {        value_tc = value_tc  + ":";        srcField.value = value_tc;        return;    }    if ( (value_tc.length == 5) && (value_tc.lastIndexOf(":") == 2) ) {        value_tc = value_tc  + ":";        srcField.value = value_tc;        return;    }    p = "::";    if (value_tc.match(p)) {        value_tc = value_tc.replace(p, ":");        srcField.value = value_tc;    }}function formatTC(srcField) {    var value_tc = srcField.value;    if ( (value_tc.length == 1) && (value_tc.indexOf("0") == -1) && (value_tc.indexOf("1") == -1) && (value_tc.indexOf("2") == -1) ) {       srcField.value = "";        return;    }    if ( (value_tc.length == 2) && (value_tc.indexOf(":") == -1) ) {        value_tc = value_tc  + ":";        srcField.value = value_tc;        return;    }    if ( (value_tc.length == 5) && (value_tc.lastIndexOf(":") == 2) ) {        value_tc = value_tc  + ":";        srcField.value = value_tc;        return;    }    if ( (value_tc.length == 8) && (value_tc.lastIndexOf(":") == 5) ) {        value_tc = value_tc  + ":";        srcField.value = value_tc;        return;    }    p = "::";    if (value_tc.match(p)) {        value_tc = value_tc.replace(p, ":");        srcField.value = value_tc;    }}function checkDate(srcField) {    if(srcField.value !='') {        dat = srcField.value;        dat = dat.replace(/\//gi,'-');        datret = dat;        x = dat.indexOf("-");        if(x>0) {            a=parseInt(dat.substring(0,x),10);            y = dat.indexOf("-",x+1);            if(y==-1) {                m=parseInt(dat.substring(x+1),10);                if(isNaN(m))m=0;                datret = formatNum(a) + "-" + formatNum(m);            } else {                m=parseInt(dat.substring(x+1,y),10);                j=parseInt(dat.substring(y+1),10);                if(isNaN(j))j=0;                if(isNaN(m))m=0;                datret = formatNum(a) + "-" + formatNum(m) + "-" + formatNum(j);            }        }        srcField.value = datret;        //alert("Format : AAAA-MM-JJ");    }}function checkTime(srcField) {    t = srcField.value;    x = t.indexOf(":");    h=0;    m=0;    s=0;    if(x==-1) h=parseInt(t,10);    else {        h=parseInt(t.substring(0,x),10);        y = t.indexOf(":",x+1);        if(y==-1) m=parseInt(t.substring(x+1),10);        else {            m=parseInt(t.substring(x+1,y),10);            s=parseInt(t.substring(y+1),10);        }    }    if ((m<60) && (s<60)) {        ret= h + ":";        if(m<10)  ret +="0";        ret += m + ":";        if(s<10) ret +="0";        srcField.value =  ret + s;        }    else {        srcField.value = t;        alert("Format : 00:00:00");    }}function checkTC(srcField) {    t = srcField.value;    x = t.indexOf(":");    h=0;    m=0;    s=0;    f=0;    if(x==-1) {        h=parseInt(t.substring(0,2),10);        m=parseInt(t.substring(2,4),10);        s=parseInt(t.substring(4,6),10);        f=parseInt(t.substring(6,8),10);    } else {        h=parseInt(t.substring(0,x).substring(0,2),10);        y = t.indexOf(":",x+1);        z = t.indexOf(":",y+1);        if(y==-1) m=parseInt(t.substring(x+1).substring(0,2),10);        else {            m=parseInt(t.substring(x+1,y).substring(0,2),10);            if(z==-1) s=parseInt(t.substring(y+1).substring(0,2),10);            else {                s=parseInt(t.substring(y+1,z).substring(0,2),10);                f=parseInt(t.substring(z+1).substring(0,2),10);            }        }    }    if(isNaN(h)) h=0;    if(isNaN(m)) m=0;    if(isNaN(s)) s=0;    if(isNaN(f)) f=0;    srcField.value =  formatNum(h) + ":" + formatNum(m) + ":" + formatNum(s)+ ":" + formatNum(f);}function showAndInitRechInd2(titre_index,valeur,id_lang,champ,id_input_result){	var lex_aff=0;	var type_lex="";	if(document.getElementById("thes_"+champ)) {		lex_aff=1;		type_lex=document.getElementById("thes_"+champ).value;	}	showAndInitRechInd(titre_index,valeur,id_lang,champ,id_input_result,lex_aff,type_lex);}function showAndInitRechInd(titre_index,valeur,id_lang,champ,id_input_result,lex_aff,type_lex){    var url = "chercheIndex.php?";    url +='titre_index='+titre_index+'&id_lang='+id_lang+'&valeur='+valeur+'&champ='+champ+'&id_input_result='+id_input_result;	if(lex_aff) url+='&lex_aff='+lex_aff;	if(type_lex) url+='&type_lex='+type_lex;    iframeChrchInd.location.href=url;}// JC 01/06/05 : Pour mettre � jour les champs du formulaire du document parent, depuis l'iframe qu'il incorpore.//(utilis�e par exemple dans l'iframe chercheIndex.php, incorpor�e dans cherche2.php (dans cherche2.inc.php) ).function MaJChamp(id_champ, valeur){	var valChamp = window.parent.document.getElementById(id_champ).value;	if(valChamp.indexOf('"'+valeur+'"')==-1){		if (valChamp!=""){			window.parent.document.getElementById(id_champ).value+=',"'+valeur+'"';		}else{			window.parent.document.getElementById(id_champ).value='"'+valeur+'"';		}	}}// JC 17/06/05 : utile uniquement pour la d�mofunction doConnect(login, password){    document.getElementById('login').value=login;    document.getElementById('password').value=password;    document.connexion.submit();}// Permet de cacher/montrer l'�lement "id_objet" (utilis� pour les storyboards)    function cache(id) {        if (document.getElementById) { // DOM3 = IE5, NS6            document.getElementById(id).style.display = 'none';        }        else {            if (document.layers) { // Netscape 4                document.id.display = 'none';            }            else { // IE 4                document.all.id.style.display = 'none';            }        }    }    function affiche(id) {        if (document.getElementById) { // DOM3 = IE5, NS6            document.getElementById(id).style.display = 'block';        }        else {            if (document.layers) { // Netscape 4                document.id.display = 'block';            }            else { // IE 4                document.all.id.style.display = 'block';            }        }    }// Permet de cacher/montrer l'�lement "id_objet" (utilis� pour les storyboards)function affiche_cache(id) {    if (document.getElementById) { // DOM3 = IE5, NS6        if (document.getElementById(id).style.display == 'none'){            document.getElementById(id).style.display = 'block';        }else{            document.getElementById(id).style.display = 'none';        }    }    else {        if (document.layers) { // Netscape 4            if (document.id.display == 'none'){                document.id.display = 'block';            }else{                document.id.display = 'none';            }        }        else { // IE 4            if (document.all.id.style.display == 'none'){                document.all.id.style.display = 'block';            }else{                document.all.id.style.display = 'none';            }        }    }}function alterne_texte(objet,text1,text2) {        if (objet.value == text1){            objet.value = text2;        }else{            objet.value = text1;        }}// R�alise un explode de 'item' selon 'delimiter'function explodeArray(item,delimiter) {  tempArray=new Array(1);  var Count=0;  var tempString=new String(item);  while (tempString.indexOf(delimiter)>0) {    tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));    tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1);    Count=Count+1  }  tempArray[Count]=tempString;  return tempArray;}// Formate une durée saisie en minute en h:mm si celle-ci dépasse 60 minutesfunction calcDuree(fld) {	if (isNaN(fld.value)) return;	hours=parseInt(fld.value/60);	mins=fld.value-60*hours;	fld.value=hours+":"+mins;	checkTime(fld);}// Ajout de la fonction TRIM aux strings : retire les espaces au début et à la fin d'une chaine.// usage : mytrimmedString=myString.Trim()if (typeof String.prototype.Trim == "undefined") {	String.prototype.Trim = function () {		var s = this.replace(/^\s*/, "");		return s.replace(/\s*$/, "");	}}/*if (typeof HTMLSelectElement.prototype.selectedValue== "undefined") {	HTMLSelectElement.prototype.selectedValue= function (_val) {		for (i=0;i<this.options.length;i++) {			if (this.options[i].value==_val) this.options[i].selected=true;		}	}}*/function encodeQuotes(str) {	//str.replace(/"/,'&quot;');	return str;}function Quote(str) {	str=str.split("'").join("\\'");	return str;}//Fonction de formulaire : vérifie si un champ est videfunction formCheckNonEmpty(val) {	if (val.Trim()=='') {return false;} else {return true;}}//Fonction de formulaire : vérifie si une adresse mail est validefunction formCheckEmail(val) {    re=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; //from Quirksmode.org	if (val.search(re)!=-1) {return true;} else {return false;}}//Fonction de formulaire : vérifie si 2 valeurs sont identiques, ex: ctrl password.function formCheckSameVal(val1,val2) {	if (val1===val2 && val1.Trim()!='') {return true;} else {return false;}}function formCheckDate(val) {	re = /^([0-9]){2}(\/|-){1}([0-9]){2}(\/|-)([0-9]){4}$/;	if (val.search(re)!=-1) {return true;} else {return false;}}function formCheckInt(val) {	if (isNaN(parseInt(val))) return false; else return true;}function formCheckFloat(val) {	if (isNaN(parseFloat(val))) return false; else return true;}// FONCTIONS AJAXfunction getHTTPObject(fonc) {	var xmlhttp=false;	/* Compil addit IE */	/*@cc_on	@if (@_jscript_version >= 5)		try {			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");		} catch(e) {			try {					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");			} catch (E) {				xmlhttp=false;				}		}		@else			xmlhttp=false;	@end @*/	/* création objet si pas encore fait */	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {		try {			xmlhttp=new XMLHttpRequest();		} catch (e) {xmlhttp=false;}	}	if (xmlhttp) {		xmlhttp.onreadystatechange=function() {			if (xmlhttp.readyState==4) { /* COMPLETE */				if (xmlhttp.status==200) { /*HTTP PAGE OK */					eval('window.'+fonc+'(xmlhttp.responseText);'); //by LD, transfo window.parent en window				}			}		}	}	return xmlhttp;}function sendData(method,url,data,fonc) {	if (typeof(fonc)=='undefined') fonc='dspResult';	var xmlhttp=getHTTPObject(fonc);	if (!xmlhttp) {alert('pas xml');return false;}	if (method=='GET') {		if (data=='null') {			xmlhttp.open("GET",url,true); //ouverture async		} else {			xmlhttp.open("GET",url+"?"+data,true);		}		xmlhttp.send(null);	} else if (method=='POST') {		alert(data);		xmlhttp.open("POST",url,true);		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencode');		xmlhttp.send(data);	}	return true;}function importXML(str){ //Transforme une chaine XML en objet XML	if (document.implementation && document.implementation.createDocument)	{	  var parser=new DOMParser();	  var xmlDoc=parser.parseFromString(str,"text/xml");	}	else if (window.ActiveXObject)	{		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");		xmlDoc.async=false; 		xmlDoc.loadXML(str); 	}	else	{		alert('Your browser can\'t handle this script');		return;	}	return xmlDoc;}function getPageDimensions() {		var x,y;		var test1 = document.body.scrollHeight;		var test2 = document.body.offsetHeight		if (test1 > test2) // all but Explorer Mac		{			x = document.body.scrollWidth;			y = document.body.scrollHeight;		}		else // Explorer Mac;		     //would also work in Explorer 6 Strict, Mozilla and Safari		{			x = document.body.offsetWidth;			y = document.body.offsetHeight;		}	return {x:x,y:y};	}function getBrowserDimensions() {		var x,y;		if (window.innerWidth) // FF / SF		{			x = window.innerWidth;			y = window.innerHeight;		}		else //IE		{			x = document.documentElement.clientWidth; 			y = document.documentElement.clientHeight; //note : le pas utiliser body car renvoie des vals diff selon ie6 ou ie7		}	return {x:x,y:y};	}function getScrollDimensions() {	var x,y;	if (self.pageYOffset) // all except Explorer	{		x = self.pageXOffset;		y = self.pageYOffset;	}	else if (document.documentElement && document.documentElement.scrollTop)		// Explorer 6 Strict	{		x = document.documentElement.scrollLeft;		y = document.documentElement.scrollTop;	}	else if (document.body) // all other Explorers	{		x = document.body.scrollLeft;		y = document.body.scrollTop;	}	return {x:x,y:y};}function choose(fromElement,params,classname,ww,hh) {	if (!ww) ww=300;	if (!hh) hh=400;		w=fromElement.offsetWidth;		h=fromElement.offsetHeigth;				myDiv=document.getElementById('chooser');		myDiv.position='absolute';	if (document.getElementById('frmchoose')) {		document.getElementById('frmchoose').parentNode.removeChild(document.getElementById('frmchoose'));	}	myIFrame=document.createElement('iframe');	if (classname!='') {myIFrame.className=classname;} else {myIFrame.style.border="2px solid black";}	myIFrame.id='frmchoose';	myIFrame.name='frmchoose';	myIFrame.width=(ww-4)+'px';	myIFrame.height=(hh-4)+'px';	myIFrame.style.backgroundColor='white';	myDiv.style.width=ww+'px';	myDiv.style.height=hh+'px';	myDiv.appendChild(myIFrame);	myDiv.style.display='block';	// on remet la src après tout, sinon il y a un bug safari	myIFrame.src=	"palette.php?urlaction=chercheIndex2&"+params+"&id_input_result="+fromElement.id+"&w="+ww+"&h="+hh;	x=getLeft(fromElement)+w;	y=getTop(fromElement);	if (document.documentElement && document.documentElement.clientHeight ) {			winh=document.documentElement.clientHeight+(document.documentElement.scrollTop||document.body.scrollTop); //Hack Safari3			winw=document.documentElement.clientWidth+document.documentElement.scrollLeft;	} else {			winh=document.body.clientHeight+document.body.scrollTop;			winw=document.body.clientWidth+document.body.scrollLeft;	}	if ((y+hh+10) > winh) y=winh-(hh+10);	if ((x+ww+10) > winw) x=winw-(ww+10);		myDiv.style.left=x+"px";	myDiv.style.top=y+"px";}function getLeft(MyObject)//Fonction permettant de connaître la position d'un objet//par rapport au bord gauche de la page.//Cet objet peut être à l'intérieur d'un autre objet.    {    if (MyObject.offsetParent)        return (MyObject.offsetLeft + getLeft(MyObject.offsetParent));    else        return (MyObject.offsetLeft);    }function getTop(MyObject)//Fonction permettant de connaître la position d'un objet//par rapport au bord haut de la page.//Cet objet peut être à l'intérieur d'un autre objet.    {    if (MyObject.offsetParent)        return (MyObject.offsetTop + getTop(MyObject.offsetParent));    else        return (MyObject.offsetTop);    }// FONCTIONS DRAG'N'DROP PALETTEfunction getMouseOffset(target, ev){	ev = ev || window.event;	var docPos    = getPosition(target);	var mousePos  = mouseCoords(ev);	return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};}function getPosition(e){	var left = 0;	var top  = 0;	while (e.offsetParent){		left += e.offsetLeft;		top  += e.offsetTop;		e     = e.offsetParent;	}	left += e.offsetLeft;	top  += e.offsetTop;	return {x:left, y:top};}function _mouseMove(ev){	ev           = ev || window.event;	var mousePos = mouseCoords(ev);	if(typeof(dragObject)!='undefined' && dragObject){		dragObject.style.position = 'absolute';		dragObject.style.top      = mousePos.y - mouseOffset.y+"px";		dragObject.style.left     = mousePos.x - mouseOffset.x+"px";		if (typeof(dragObject.style.mozOpacity)!='undefined') dragObject.style.mozOpacity=0.7;		if (typeof(dragObject.style.opacity)!='undefined')  dragObject.style.opacity=0.7;		if (typeof(dragObject.style.filter)!='undefined') dragObject.style.filter = 'alpha(opacity=70)';		window.status='x:'+(mousePos.x - mouseOffset.x)+'   y:'+(mousePos.y - mouseOffset.y);		return false;	}}function _mouseUp(){	if (typeof(dragObject)!='undefined' && dragObject) {		if (typeof(dragObject.style.mozOpacity)!='undefined') dragObject.style.mozOpacity=1;		if (typeof(dragObject.style.opacity)!='undefined')  dragObject.style.opacity=1;		if (typeof(dragObject.style.filter)!='undefined') dragObject.style.filter = 'alpha(opacity=100)';	}	dragObject = null;}function mouseCoords(ev){	if(ev.pageX || ev.pageY){		return {x:ev.pageX, y:ev.pageY};	}	return {		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,		y:ev.clientY + document.body.scrollTop  - document.body.clientTop	};}function makeDraggable(item){	if(!item) {return;}	item.onmousedown = function(ev){		dragObject  = this;		mouseOffset = getMouseOffset(this, ev);		return false;	}	document.onmousemove=_mouseMove;	item.onmouseup=_mouseUp;}function removeValue(id_div) {		fld=document.getElementById(id_div);		fld.parentNode.removeChild(fld);}function toggleVisibility(myDiv,imgArrow) { 		if (myDiv.style.display=='block') { 			myDiv.style.display='none'; 			if (imgArrow) imgArrow.src='design/images/arrow_right.gif'; 		} else { 			myDiv.style.display='block'; 			if (imgArrow) imgArrow.src='design/images/arrow_down.gif'; 		} 	}/** flèches up/down présentes sur certaines pages **/function moveUp(elt) {		tab=elt.parentNode.parentNode;		div=elt.parentNode;		prv=div.previousSibling;		//alert("mydiv: "+div.id+"  parent: "+tab.id+"  previous: "+prv.nodeName);		if (prv.nodeName!='SCRIPT') tab.insertBefore(div,prv);}function moveDown(elt) {		tab=elt.parentNode.parentNode;		div=elt.parentNode;		nxt=div.nextSibling;		//alert("mydiv: "+div.id+"  parent: "+tab.id+"  next: "+nxt.nodeName);		if ((nxt.nodeName=='DIV' || nxt.nodeName=='SPAN') && nxt.className!='miniButton' ) tab.insertBefore(div,nxt.nextSibling);}/** Scan des propriétés d'un objet JS, appelé par obj_show **/function show_props_R (obj, obj_name, equ, delim, depth) {  var result = ''  depth--  for (var i in obj) {    if (parseInt (navigator.appVersion)==2)      var typ= 'number'     // Netscape 2.0 doesn't know about typeof    else      var typ= typeof (obj[i])    if (typ=='number' && i=='length') continue    var del= (typ=='string') ? '"' : ''    var suf= (typ!='string' && typ!='number' && typ!='object') ?              ' ('+typ+')' : ''    result += obj_name+'.'+i+equ+del+obj[i]+del+suf+delim    if (depth>0)// && typ=='object')      result += show_props_R (obj[i], obj_name+'.'+i, equ, delim, depth)  }  return result;}/** Fonctionne avec show_props : affiche tts les propriétés d'un objet JS **/function objshow (object, depth) {  var str= show_props_R (eval (object), object, '=</TD><TD VALIGN=TOP>',                         '</TD></TR>\n<TR><TD VALIGN=TOP>', depth)//Output everything in one go. Required for Netscape 3.0b5, which forgets//everything once we start writing to the new page.  document.writeln ('<TABLE>\n<TR><TD>',str,'</TABLE>')//Finish off page (needed for Netscape 3.0b4 and before).  document.close()}// Faire des fade-in fade-out !function opacity(id, opacStart, opacEnd, millisec) {    //speed for each frame    var speed = Math.round(millisec / 100);    var timer = 0;    //determine the direction for the blending, if start and end are the same nothing happens    if(opacStart > opacEnd) {        for(i = opacStart; i >= opacEnd; i--) {            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));            timer++;        }    } else if(opacStart < opacEnd) {        for(i = opacStart; i <= opacEnd; i++)            {            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));            timer++;        }    }}//change the opacity for different browsersfunction changeOpac(opacity, id) {    var object = document.getElementById(id).style;    object.opacity = (opacity / 100);    object.MozOpacity = (opacity / 100);    object.KhtmlOpacity = (opacity / 100);    object.filter = "alpha(opacity=" + opacity + ")";} //Renvoie un enfant d'un noeud DOM en passant l'id de cet enfantfunction getChildById(node,eltid) {	if (!node.childNodes) return false;	for (i=0;i<node.childNodes.length;i++) {		if (node.childNodes[i].id==eltid) return node.childNodes[i];	}	return false;}/** UTILISE PROTOTYPE : affiche une alert en FADE IN / 5 sec / FADE OUT**/function showAlert(message,elt,mode,offsetX,offsetY) {	if (typeof(elt)=='string') el=document.getElementById(elt);	else el=elt;	if (!el || typeof el == 'undefined') {alert(message);return;} //pas de div alertBox ? on revient à une alerte "bete"	contentDiv=getChildById(el,'alertBoxContent');	if (contentDiv) contentDiv.innerHTML=message; else el.innerHTML=message; //S'il existe, on place dans le contenu		var sizeX=parseInt(el.offsetWidth)-1; //récupère la largeur de l'alertBox	var sizeY=parseInt(el.offsetHeight)-1; //et la hauteur		if (isNaN(sizeX)) sizeX=500;	if (isNaN(sizeY)) sizeY=150;	if (isNaN(offsetX)) offsetX=0;	if (isNaN(offsetY)) offsetY=0;			browserDim=getBrowserDimensions();	_refy=(browserDim.y-sizeY)/2; //calculer le milieu d'écran en tenant compte du DIV	_refx=(browserDim.x-sizeX)/2;		el.style.display="block"; //Au cas où	if (document.all) el.style.position="absolute"; else el.style.position="fixed"; //Si support du fixed on l'active		if (!mode) mode='slideLeft' //par déft, slideLeft, notamment pour compatibilité descendante		var queue = { scope: el.id, position: 'end' };	if (mode=='slideLeft') { //slide depuis la gauche		el.style.left=-(sizeX+10)+"px";		el.style.top=_refy+offsetY+"px";		new Effect.Move(el , { x: sizeX, duration: 0.5, queue: queue });		new Effect.Move(el , { delay: 5, x: -sizeX, duration: 1, queue: queue });	}	if (mode=='slideDown') { //slide depuis le haut		el.style.top=-(sizeY+10)+"px";			el.style.left=_refx+offsetX+"px";			new Effect.Move(el , { y: sizeY, duration: 0.5, queue: queue });		new Effect.Move(el , { delay: 5, y: -sizeY, duration: 1, queue: queue });		}	if (mode=='fade') { //fade InOut		el.style.top=_refy+offsetY+"px";		el.style.left=_refx+offsetX+"px";		new Effect.Opacity(el , { from: 0, to: 1, duration: 0.5, queue: queue });		new Effect.Opacity(el , { delay: 5, from: 1, to: 0, duration: 1, queue: queue });				}						}/** Dans un élément qui a plusieurs boutons, permet de mettre le bouton en highlight et afficherla section div correspondante, ex: saisie matériel, consult docOn mettra sur chaque bouton une propriété custom "related_div" alimentée par l'ID du DIVà montrer.Dans la page, on mettra dans le Name du bouton la même valeur que l'ID du DIV **/function toggleDisplay(btn) {	arrBtn=btn.parentNode.getElementsByTagName(btn.nodeName);	for (i=0;i<arrBtn.length;i++) {		if (arrBtn[i]==btn) {			btn.className='selected';			mes2=document.getElementById(btn.getAttributeNode('related_div').value);			document.getElementById(btn.getAttributeNode('related_div').value).style.display='block';			btn.getElementsByTagName('img')[0].style.display='inline';					} else {			arrBtn[i].className='';			arrBtn[i].getAttributeNode('related_div').value;			document.getElementById(arrBtn[i].getAttributeNode('related_div').value).style.display='none';				arrBtn[i].getElementsByTagName('img')[0].style.display='none';											}					}	}
