var PopWindow=null; function popupUnique(url, nom, w, h, sc){ PopWindow = window.open(url, nom, 'resizable=no,left=0,top=0,scrollbars=' + sc + ',menubar=no,width=' + w + ',height=' + h); } function popup(page,details) { window.open (page,"",details); } //appercue d'image pour WCards/Form.jsp function sowpict(str) { if (str != null && str != "0") { msg = window.open("","msg","width=350 height=250"); msg.focus(); msg.document.write("
"); } } function JSC_strTrim_String(str) { str=str.replace(/^\s+/g,""); str=str.replace(/\s+$/g,""); return str; } function JSC_isEmpty_String(str) { return (JSC_strTrim_String(str).length==0); } function JSC_isTel_String(str) { if (str.search(/[^0-9\(\)+\-. ]/gi)!=-1) // Y a-t-il des caracteres autres que "0" a "9", "(", ")", "+", "-", " " et "." ? return false; // -> ce n'est pas un numero de telephone else return true; } function JSC_isNumber_String(str,hasComma) { str=JSC_strTrim_String(str); // Enlevons les espaces inutiles ! intFCT_virgules=0; // Nombre de separateurs decimaux trouves // On accepte les caracteres "+" et "-" uniquement en debut de chaîne if (str.charAt(0)=="-" || str.charAt(0)=="+") str=str.substring(1,str.length); // On se debarasse du signe for (i=0 ; i"9") // Pas numerique ? return false; // -> ce n'est pas un nombre if (intFCT_virgules>1) // Plus d'un separateur decimal ? return false; // -> ce n'est pas un nombre return true; } function JSC_IsValideURL(str) { if (str.indexOf("'")!=-1) // "'" refuse return false; if (str.indexOf(" ")!=-1) // " " refuse return false; if (str.indexOf('"')!=-1) // '"' refuse return false; if (str.indexOf("#")!=-1) // "#" refuse return false; if (str.indexOf("(")!=-1) // "(" refuse return false; if (str.indexOf(")")!=-1) // ")" refuse return false; if (str.indexOf("/")!=-1) // "/" refuse return false; if (str.indexOf("\\")!=-1) // "\" refuse return false; if (str.indexOf("?")!=-1) // "?" refuse return false; if (str.indexOf(":")!=-1) // ":" refuse return false; if (str.indexOf(";")!=-1) // ";" refuse return false; if (str.indexOf("+")!=-1) // "+" refuse return false; if (str.indexOf("=")!=-1) // "=" refuse return false; if (str.indexOf("<")!=-1) // "<" refuse return false; if (str.indexOf(">")!=-1) // ">" refuse return false; if (str.indexOf("*")!=-1) // "*" refuse return false; if (str.indexOf("%")!=-1) // "%" refuse return false; if (str.indexOf("&")!=-1) // "&" refuse return false; if (str.indexOf("@")!=-1) // "@" refuse return false; if (str.indexOf("|")!=-1) // "|" refuse return false; if (str.indexOf("{")!=-1) // "{" refuse return false; if (str.indexOf("}")!=-1) // "}" refuse return false; if (str.indexOf("[")!=-1) // "[" refuse return false; if (str.indexOf("]")!=-1) // "]" refuse return false; if (str.indexOf("~")!=-1) // "~" refuse return false; if (str.indexOf("¤")!=-1) // "¤" refuse return false; if (str.indexOf("£")!=-1) // "£" refuse return false; if (str.indexOf("$")!=-1) // "$" refuse return false; if (str.indexOf("^")!=-1) // "^" refuse return false; if (str.indexOf(".")!=-1) // "." refuse return false; if (str.indexOf("!")!=-1) // "!" refuse return false; if (str.indexOf("§")!=-1) // "§" refuse return false; if (str.indexOf("°")!=-1) // "°" refuse return false; return true; } function JSC_isEmail_String(str) { if (str.indexOf("'")!=-1) // "'" refuse return false; if (str.indexOf(" ")!=-1) // " " refuse return false; if (str.indexOf('"')!=-1) // '"' refuse return false; if (str.indexOf("#")!=-1) // "#" refuse return false; if (str.indexOf("(")!=-1) // "(" refuse return false; if (str.indexOf(")")!=-1) // ")" refuse return false; if (str.indexOf("/")!=-1) // "/" refuse return false; if (str.indexOf("\\")!=-1) // "\" refuse return false; if (str.indexOf("?")!=-1) // "?" refuse return false; if (str.indexOf(":")!=-1) // ":" refuse return false; if (str.indexOf(";")!=-1) // ";" refuse return false; if (str.indexOf("+")!=-1) // "+" refuse return false; if (str.indexOf("=")!=-1) // "=" refuse return false; if (str.indexOf("<")!=-1) // "<" refuse return false; if (str.indexOf(">")!=-1) // ">" refuse return false; if (str.indexOf("*")!=-1) // "*" refuse return false; if (str.indexOf("%")!=-1) // "%" refuse return false; if (str.indexOf("&")!=-1) // "&" refuse return false; if (str.indexOf(".@")!=-1) // "*.@*" refuse return false; if (str.indexOf("@.")!=-1) // "*@.*" refuse return false; if (".@".indexOf(str.charAt(0))!=-1) // "@*" et ".*" refuses return false; if (".@".indexOf(str.charAt(str.length-1))!=-1) // "*@" et "*." refuses return false; if (str.search(/@.*@/g)!=-1) // "*@*@*" et "*@@*" refuses return false; if (str.indexOf("..")!=-1) // "*..*" refuse return false; if (str.search(/@.*\./g)==-1) // On refuse s'il n'y a pas de point a droite de "@" return false; if (str.length>5+str.lastIndexOf(".")) // On refuse les extensions de plus de 4 caracteres return false; str=str.substr(str.lastIndexOf("."),5); return (str.length>1 && !JSC_isNumber_String(str,false)); } //cree une nouvelle option
function cloneOption(option) { var out = new Option(option.text,option.value); out.selected = option.selected; out.defaultSelected = option.defaultSelected; return out; } //method de deplacemnt
function moveSelected(from,to) { newTo = new Array(); for(i=0; i < to.options.length; i++) { newTo[newTo.length] = cloneOption(to.options[i]); newTo[newTo.length-1].selected = false; } for(i=0; i < from.options.length; i++) { if (from.options[i].selected) { newTo[newTo.length] = cloneOption(from.options[i]); from.options[i] = null; i--; } } to.options.length = 0; for(i=0; i < newTo.length; i++) { to.options[to.options.length] = newTo[i]; } } //mise ajour du champs cache de submit
function updateHiddenChooserField(chosen,hidden) { hidden.value=''; var opts = chosen.options; for(var i=0; i < opts.length; i++) { hidden.value = hidden.value + opts[i].value; if (i < opts.length-1) hidden.value = hidden.value + "\n"; } } //deplace l'element selectionne au dessus
function moveSelectedUp(chosen) { //si pas de choix, ou choix le premier => rien if (chosen.selectedIndex <= 0) { return; } sindex = chosen.selectedIndex; //sinon, on refait un tableau preceding = cloneOption(chosen.options[sindex-1]); sel = cloneOption(chosen.options[sindex]); chosen.options[sindex-1] = sel; chosen.options[sindex] = preceding; } //deplace l'element selectionne au dessous
function moveSelectedDown(chosen) { //si pas de choix, ou choix le dernier => rien if (chosen.selectedIndex == -1) { return; } if (chosen.selectedIndex == chosen.options.length -1) { return; } sindex = chosen.selectedIndex; //sinon, on refait un tableau following = cloneOption(chosen.options[chosen.selectedIndex+1]); sel = cloneOption(chosen.options[chosen.selectedIndex]); chosen.options[sindex+1] = sel; chosen.options[sindex] = following; } //select the given value in the list function selectDefaultValue(list, value) { if (value.length > 0) { for (i=0; i < (list.options.length); i++) { if ( (list.options[i].value) == value) { list.options[i].selected = true; break; } } } } //tells how many items are selected function getSelectedItemsNumber(list) { var account = 0; for(i=0; i < list.options.length; i++) { if (list.options[i].selected) { account++; } } return account; }