<!-- Scripts Des Trucsweb www.trucsweb.com -->
<!-- Veuillez s.v.p. laisser cette mention -->

<!-- 
function valpresent(champ) {
var pass=true;
if (document.images) {
for (i=0;i<champ.length;i++) {
var tempobj=champ.elements[i];
if (tempobj.name.substring(0,3)=="obl") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
champnom=tempobj.name.substring(3,30).toUpperCase();
alert("Assurez vous d'entrer le champ "+champnom+" qui est obligatoire.");
return false;
}
else
return true;
}
//  Fin -->

<!-- 
function valchar(champ,valid) {
var ok = "yes";
var temp;
for (var i=0; i<champ.value.length; i++) {
temp = "" + champ.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Saisie invalide! Seul les caractères " + valid + " sont acceptés.");
champ.focus();
champ.select();
   }
}
//  End -->

<!-- Début
function valsite(champ) {
var ok = "yes";
txt=champ.value;
if (txt.indexOf(".com")>-1) ok = "no";
if (txt.indexOf(".fr")>-1) ok = "no";
if(txt.indexOf("www")>-1)ok = "no";
if(txt.indexOf("http")>-1)ok = "no";
if((txt.indexOf("WWW")>-1)&&(txt.indexOf(".fr")>-1)&&(txt.indexOf(".net")>-1)&&(txt.indexOf("http")>-1)&&(txt.indexOf("HTTP")>-1)&&(txt.indexOf(".org")>-1))  ok = "no";
if (ok == "no") {
alert("Désolé. Vous ne pouvez pas placer un site dans ce champ.");
champ.focus();
champ.select();
   }
}
// Fin -->

<!-- Début
function valcourriel(champ) {
var ok = "yes";
txt=champ.value;
if (txt.indexOf("@")<3) ok = "no";
if ((txt.indexOf(".com")<5)&&(txt.indexOf(".org")<5)
&&(txt.indexOf("ucl.ac.be")<5)
&&(txt.indexOf(".fr")<5)&&(txt.indexOf(".net")<5)
&&(txt.indexOf(".gov")<5)&&(txt.indexOf(".qc.ca")<5)
&&(txt.indexOf(".gov")<5)&&(txt.indexOf(".co.uk")<5)
&&(txt.indexOf(".ca")<5)&&(txt.indexOf(".edu")<5))ok = "no";
if (ok == "no") {
alert("Désolé. Votre adresse de courrier électronique est invalide.");
champ.focus();
champ.select();
   }
}
// Fin -->
<!-- Début
function valmax(champ,max) {
if (champ.value.length > max) {
alert("S.V.P. ne pas entrer plus de 20 caractères.  Essayez de nouveau!");
champ.focus();
champ.select();
   }
}
// Fin -->
function valdate(champ) {
var err = 0
string = champ.value;
var valid = "0123456789/"
var ok = "yes";
var temp;
for (var i=0; i< string.length; i++) {
temp = "" + string.substring(i, i+1);
if (valid.indexOf(temp) == "-1") err = 1;
}
if (string.length != 8) err=1
b = string.substring(0, 2) // day
c = string.substring(2, 3)// '/'
d = string.substring(3, 5) // month
e = string.substring(5, 6)// '/'
f = string.substring(6, 8) // year
if (b<1 || b>31) err = 1
if (c != '/') err = 1
if (d<1 || d>12) err = 1
if (e != '/') err = 1
if (f<0 || f>99) err = 1
if (b==4 || b==6 || b==9 || b==11){
if (d==31) err=1
}
if (b==2){
var g=parseInt(f/4)
if (isNaN(g)) {
err=1
}
if (d>29) err=1
if (d==29 && ((f/4)!=parseInt(f/4))) err=1
}
if (err==1) {
alert('Date illégale');
champ.focus();
champ.select();
}
}
//-->
<!-- Début
function valpass(form) {
pw1 = form.oblpasse1.value;
pw2 = form.oblpasse2.value;

if (pw1 != pw2) {
alert ("\nLes deux mots de passe ne sont pas identiques. Essayez de nouveau!")
return false;
}
else return true;
}
// Fin -->
function Teste_numero()
{
  var numero = document.forms[0].elements[0].value;
  var totalcarte=0;
  var dnum=0;
  var test=0;
  if (numero.length < 13) {
	alert ('Nombre de chiffres entrés incorrect');
	document.forms[0].elements[0].focus();
	}
	else
	{
  for ( i = numero.length; i >= 1 ;  i--)
  {
    test=test+1;
	num = numero.charAt(i-1);
    if ((test % 2) != 0)
       totalcarte=totalcarte+parseInt(num)
    else {
       dnum=parseInt(num)*2;
       if (dnum >= 10)
          totalcarte=totalcarte+1+dnum-10
       else
          totalcarte=totalcarte+dnum;
    }
   
  }
  if ((totalcarte % 10) != 0){
       alert('Numéro de carte non valide: somme='+ totalcarte);
       document.forms[0].elements[0].focus();
       return (false);
  }else{
       alert ('Carte acceptée : somme='+ totalcarte);
       return(true);
  }
}
}

