// ******************************* // * * // * Industry 3 * // * * // * 1 Mai 2003 * // * * // ******************************* // // Toute reproduction, m�me partielle, // est strictement interdite // sans autorisation pr�alable. // // (c) 1999-2020 - Eurojeu.com // function setfocus(elem){ document.forms[0].elements[elem].focus(); } function initArray(){ this.length=initArray.arguments.length; for(var i=0;i < this.length;i++) this[i]=initArray.arguments[i]; } function isDigit(num){ return (parseInt(num,10) >= 0 && parseInt(num,10) <=9 ); } function isSeparator(sep){ // return ( sep == "/" || sep == ":" || sep == "-" || sep == ".") ; return (sep === "/" ); } function isDay(day){ return (day >=1 && day <= 31); } function isMonth(month){ return (month >= 1 && month <= 12) ; } function isYear(year){ for (var i=0; i31) return false; if (i30) return false; } return (month ==2 && (day >29 || (day == 29 && year%4 !=0)))?false:true; } function SepIndex(dat,index){ for (var i=index;i=0 && temp <=9 ) temp="200"+temp; else if ( (temp >=10) && (temp <=49) ) temp="20"+temp; else if ( (temp >= 50) && (temp <=99) ) temp="19"+temp; return parseInt(temp,10); } function GetDateElement(dat,flag){ Dformat="DMY"; first=SepIndex(dat,0); second=SepIndex(dat,first+1); for(var i=0;i<3;i++){ if (Dformat.charAt(i) == flag) break; } return (i==0?dat.substring(0,first):(i==1?dat.substring(first+1,second):(i==2?dat.substring(second+1,dat.length):-1))); } function isDate(elem){ dat=document.forms[0].elements[elem].value; if (dat.length==0) return true; return checkDate(dat); } function checkDate(dat){ if (!FirstCheck(dat)) return false; Dformat="DMY"; if ( (first=SepIndex(dat,0)) == -1) return false; if (!CheckDateElement(dat.substring(0,first),Dformat.substring(0,1))) return false; if ( (second=SepIndex(dat,first+1)) == -1) return false; if (!CheckDateElement(dat.substring(first+1,second),Dformat.substring(1,2))) return false; if (!CheckDateElement(dat.substring(second+1,dat.length),Dformat.substring(2,3)) ) return false; return FurtherCheck(dat); } function compareDates(date1,date2){ // returns <0, 0, >0 if less,equal or greater respectively y = GetYear(date1) -GetYear(date2); if (y) return y; m= GetMonth(date1)-GetMonth(date2); if (m) return m; return (GetDay(date1) - GetDay(date2)); } function alertDate(elem){ document.forms[0].elements[elem].value = trim(document.forms[0].elements[elem].value); if (!isDate(elem)){ setfocus(elem); alert ("Date incorrecte : "+document.forms[0].elements[elem].value); return false; } return true; } function isNumber(elem){ el =document.forms[0].elements[elem]; if (el.value.length == 0) return true; for (var i=0; i -1) { if (VALUE.charAt(iTemp) !== w_space) { strTemp = VALUE.substring(0, iTemp + 1); break; } iTemp = iTemp-1; } return strTemp; } function lTrim(VALUE){ var w_space = String.fromCharCode(32); var v_length = VALUE.length; var strTemp = ""; if(v_length < 1) return ""; var iTemp = 0; while(iTemp < v_length){ if(VALUE.charAt(iTemp) !== w_space) { strTemp = VALUE.substring(iTemp,v_length); break; } iTemp = iTemp + 1; } return strTemp; }