//v1.5.0 (20/02/2008) //v1.4.0 (03/09/2007) //v1.3.0 (22/05/2006) //v1.2.0 (06/11/2006) //v1.1.0 (27/09/2006) /***************************************************** NOM :setDisabledCheckBoxesOn DESCRIPTION :Réactive les cases à cocher d'un formulaire *****************************************************/ function setDisabledCheckBoxesOn(objForm) { var arrElements___ = objForm.getElementsByTagName("input"); var strMyType___ = ""; for (var i = 0; i < arrElements___.length; i++) { strMyType___ = arrElements___[i].getAttribute("type"); if ( strMyType___ == "checkbox") { arrElements___[i].disabled = false; } } } /****************************************************/ /*Fonctions de gestion des cookies */ /****************************************************/ function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (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 getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; path = "/"; 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 DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } function Browser() { var ua, s, i; this.isIE = false; this.isNS = false; this.version = null; ua = navigator.userAgent; s = "MSIE"; if ((i = ua.indexOf(s)) >= 0) { this.isIE = true; this.version = parseFloat(ua.substr(i + s.length)); return; } s = "Netscape6/"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = parseFloat(ua.substr(i + s.length)); return; } // Treat any other "Gecko" browser as NS 6.1. s = "Gecko"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = 6.1; return; } } function FCT_GetMousePosition(bLeft, e) { IE = document.all?true:false; if (IE) { tempX = event.clientX + document.body.scrollLeft tempY = event.clientY + document.body.scrollTop } else { tempX = e.pageX tempY = e.pageY } // catch possible negative values in NS4 if (tempX < 0){tempX = 0} if (tempY < 0){tempY = 0} if(bLeft){ return tempX }else{ return tempY } } function ConfirmPlus(strMessage, strBoutonOuiTexte, strBoutonOuiActionToEval, strBoutonNonTexte, strBoutonNonActionToEval, strBoutonAnnulerTexte, strBoutonAnnulerActionToEval){ var objDivFond__ = document.getElementById("confirm_div_fond"); var objDivTexte__ = document.getElementById("confirm_div_texte"); var objDivConfirm__ = document.getElementById("confirm_div"); var objYesButton__ = document.getElementById("confirm_div_bouton_oui"); var objNoButton__ = document.getElementById("confirm_div_bouton_non"); var objCancelButton__ = document.getElementById("confirm_div_bouton_annuler"); if(!objDivFond__){ // objDivFond__ = document.createElement("img"); objDivFond__.setAttribute("id", "confirm_div_fond"); objDivFond__.src = "../Images/point_vide.gif"; objDivFond__.style.position = "absolute"; objDivFond__.style.zIndex = "45"; objDivFond__.style.width = "30px"; objDivFond__.style.height = "30px"; objDivFond__.style.top = "0px"; objDivFond__.style.left = "0px"; //objDivFond__.style.behavior = "url('../Images/pngbehavior.htc')"; objDivConfirm__ = document.createElement("div"); objDivConfirm__.setAttribute("id", "confirm_div"); objDivConfirm__.style.padding = "20px"; objDivConfirm__.style.textAlign = "center"; objDivConfirm__.style.font = "bold 15px calibri"; objDivConfirm__.style.position = "absolute"; objDivConfirm__.style.zIndex = "46"; objDivConfirm__.style.background = "#FFFFFF"; objDivConfirm__.style.border = "solid 1px #C0C0C0"; objDivConfirm__.style.display = "block"; objDivTexte__ = document.createElement("div"); objDivTexte__.setAttribute("id", "confirm_div_texte"); objDivTexte__.style.textAlign = "center"; objYesButton__ = document.createElement("input"); objYesButton__.setAttribute("type", "button"); objYesButton__.setAttribute("value", "Oui"); objYesButton__.setAttribute("id", "confirm_div_bouton_oui"); objYesButton__.style.marginTop = "5px"; objYesButton__.style.fontSize = "11px"; objNoButton__ = document.createElement("input"); objNoButton__.setAttribute("type", "button"); objNoButton__.setAttribute("value", "Non"); objNoButton__.setAttribute("id", "confirm_div_bouton_non"); objNoButton__.style.marginTop = "5px"; objNoButton__.style.fontSize = "11px"; objNoButton__.style.marginLeft = "4px"; objCancelButton__ = document.createElement("input"); objCancelButton__.setAttribute("type", "button"); objCancelButton__.setAttribute("value", "Annuler"); objCancelButton__.setAttribute("id", "confirm_div_bouton_annuler"); objCancelButton__.style.marginTop = "5px"; objCancelButton__.style.fontSize = "11px"; objCancelButton__.style.marginLeft = "4px"; var objTexte__ = document.createTextNode("Confirmer?"); objDivTexte__.appendChild(objTexte__); objDivTexte__.appendChild(document.createElement("br")); objDivTexte__.appendChild(document.createElement("br")); objDivTexte__.appendChild(objYesButton__); objDivTexte__.appendChild(objNoButton__); objDivTexte__.appendChild(objCancelButton__); objDivConfirm__.appendChild(objDivTexte__); document.body.appendChild(objDivFond__); document.body.appendChild(objDivConfirm__); } objDivTexte__.firstChild.nodeValue = strMessage; objYesButton__.setAttribute("value", strBoutonOuiTexte); objYesButton__.onclick = function(){ eval(strBoutonOuiActionToEval); eval("document.getElementById('confirm_div').style.display = 'none';"); eval("document.getElementById('confirm_div_fond').style.display = 'none';"); } objNoButton__.setAttribute("value", strBoutonNonTexte); objNoButton__.onclick = function(){ eval(strBoutonNonActionToEval); eval("document.getElementById('confirm_div').style.display = 'none';"); eval("document.getElementById('confirm_div_fond').style.display = 'none';"); } objCancelButton__.setAttribute("value", strBoutonAnnulerTexte); objCancelButton__.onclick = function(){ if(strBoutonAnnulerActionToEval != undefined){eval(strBoutonAnnulerActionToEval)}; eval("document.getElementById('confirm_div').style.display = 'none';"); eval("document.getElementById('confirm_div_fond').style.display = 'none';"); } objDivFond__.style.width = (document.body.scrollWidth == 0) ? document.body.offsetWidth + "px" : document.body.scrollWidth + "px"; objDivFond__.style.height = (document.body.scrollHeight == 0) ? document.body.offsetHeight + "px" : document.body.scrollHeight + "px"; objDivFond__.style.display = "block"; objDivConfirm__.style.display = "block"; //objDivConfirm__.style.left = (document.body.offsetWidth/2) - (objDivConfirm__.offsetWidth/2) objDivConfirm__.style.left = (1024/2) - (objDivConfirm__.offsetWidth/2) objDivConfirm__.style.top = (document.body.offsetHeight/2) - (objDivConfirm__.offsetHeight/2) + document.body.scrollTop; } function removeElementFromArrayByKey(arrTheArray, StrKeyToRemove, arrFieldsToCheck){ var ArrayTempForReturn = new Array for(sFieldLibelle in arrTheArray) { if (arrFieldsToCheck[sFieldLibelle]!=StrKeyToRemove) { ArrayTempForReturn[sFieldLibelle] = arrTheArray[sFieldLibelle]; } } return ArrayTempForReturn; } function removeElementFromArrayByIndex(arrTheArray, intIndexToRemove){ var intCompteur___ = 0; for(var intIndex___ in arrTheArray) { if(intIndex___==intIndexToRemove) arrTheArray.splice(intCompteur___, 1); intCompteur___++; } return arrTheArray; } function removeElementFromArrayByValue(arrTheArray, sValueToRemove){ for(i=0;i ''' Fonction de requête d'une page web via XML HTTP ''' ''' ''' ''' Désigne la variable globale véhiculant l'objet XMLHTTP ''' Désigne l'url de la requête ''' Désigne les paramètres de la requête, au format suivant: "param1=value1¶m2=value2" ''' Désigne la fonction gérant la réponse à la requête ''' ''' 24/11/2005 Created ''' '''******************************************************************************************** */ function sendXmlHttpRequest(strUrl, strParameters, fnReturnFunction){ objHttp_request = false; try{ if (window.XMLHttpRequest) { // Mozilla, Safari,... objHttp_request = new XMLHttpRequest(); if (objHttp_request.overrideMimeType) { objHttp_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { objHttp_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { objHttp_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!objHttp_request) { alert('Abandon :( Impossible de créer une instance XMLHTTP'); return false; } //Appel de la page de traitement objHttp_request.onreadystatechange = fnReturnFunction; objHttp_request.open("POST", strUrl, true); objHttp_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); objHttp_request.send(strParameters); }catch(exp){ alert(exp.message); } } //Affiche/masque les listes déroulantes de la page (pour corriger bug ie des éléments sur les listes déroulantes) function fnShowHideComboBoxes(){ var colCombos = document.getElementsByTagName("select"); for(var i=0;i= 2){ if(strMyLocation.indexOf("?") <= 0){ strMyLocation += "?" } for(i=0; i= 2){ if(strMyLocation.indexOf("?") <= 0){ strMyLocation += "?" } for(i=0; i 2){ for(i=2; i ''' Confirm_Alloris () --> Effectue la meme chose que confirm() ''' ''' ''' Attention si vous avez des parametres a passer pour la fonction de retour il suffit de les mettre apres le nom de la fonction de retour separes ''' par des # du type NomFonctionRetour#Param1#Param2#Param3#Param4 ''' Ils seront traites par la fonction retour en arguments[0], arguments[1],arguments[2],arguments[3] ''' Param1 = arguments[0] ''' Param2 = arguments[1] ''' Param3 = arguments[2] ''' Param4 = arguments[3] ''' La fonction Fonctionne correctement sous IE et FireFox mais utilise un traitement differrent. ''' exemple d utilisation dans la page ----> adm_fic_img.asp ''' ''' le message a afficher ''' Label du bouton 1 retourne tjs TRUE ''' Label du bouton 2 retourne tjs FALSE ''' Nom de la fonction qui traitera les valeurs retournées par Confirm_Alloris ''' Largeur de la pop-up ''' Hauteur de la pop-up ''' ''' Création ''' ''' ''' '''******************************************************************************************** */ function Confirm_Alloris(argMessage,argBt1,argBt2,NomFonctionTraitementRetour,argLargeur,argHauteur) { var largeur = argLargeur var hauteur = argHauteur var top=(screen.height-hauteur)/2; var left=(screen.width-largeur)/2; var Reponse if (arguments.length == 6) { if (window.showModalDialog) { var objMonObjet = new Object(); objMonObjet.Message = argMessage; objMonObjet.BT1 = argBt1; objMonObjet.BT2 = argBt2; objMonObjet.NomFonctionTraitementRetour = NomFonctionTraitementRetour; Reponse = window.showModalDialog("../Misc/PopUp_Confirme.asp",objMonObjet,"dialogWidth:" + largeur + "px;dialogHeight:" + hauteur + "px;center:1;scroll:0;help:0;status:0"); if (Reponse!=undefined) { arrRetour = Reponse[0].split("#") if (arrRetour.length > 0) { var chaine = "" for (var i=1;i 0) { var chaine = "" for (var i=1;i ''' Ajoute la fonction de remove a l objet array ''' ''' ''' ''' ''' 24/07/2007 Created ''' '''******************************************************************************************** */ function ArrayRemove(sValueToRemove,arrTableau){ for(i=0;i"); objMyRegExp = new RegExp(""", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, ''); objMyRegExp = new RegExp("'", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, ''); objMyRegExp = new RegExp("é", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "é"); objMyRegExp = new RegExp("è", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "è"); objMyRegExp = new RegExp("ê", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "ê"); objMyRegExp = new RegExp("à", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "à"); objMyRegExp = new RegExp("â", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "â"); objMyRegExp = new RegExp("ä", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "ä"); objMyRegExp = new RegExp("ù", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "ù"); objMyRegExp = new RegExp("û", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "û"); objMyRegExp = new RegExp("ô", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "ô"); objMyRegExp = new RegExp("ö", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "ö"); return strForTreatment; } //v1.0.0 (20/02/2008) function fnGetNiceName(strForTreatment, strToreplace) { objMyRegExp = new RegExp("[éèêë]", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "e"); objMyRegExp = new RegExp("[àäâã]", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "a"); objMyRegExp = new RegExp("[ûùü]", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "u"); objMyRegExp = new RegExp("[öôòõ]", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "o"); objMyRegExp = new RegExp("[îïì]", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "o"); objMyRegExp = new RegExp("ç", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "c"); objMyRegExp = new RegExp("ÿ", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "y"); objMyRegExp = new RegExp("ñ", "gi"); strForTreatment = strForTreatment.replace(objMyRegExp, "n"); objMyRegExp = new RegExp("[()#\"~&²%µ£¤§?<>°@`!:;*+,{}\\$\\= \\[\\]\\|\\.\\'\\^/\\\\]", "g"); strForTreatment = strForTreatment.replace(objMyRegExp, strToreplace); return strForTreatment; } /* '''******************************************************************************************** ''' ''' Supprimme les doublons d'un array ''' ''' ''' ''' ''' 23/04/2008 Created ''' '''******************************************************************************************** */ function supDoublons(TabInit) { NvTab= new Array(); var q=0; var LnChaine= TabInit.length; for(x=0;x