function ValideDate(theForm, theField, sL)
{
  if (theForm(theField).value == "")
  {
    alert("Tapez une valeur (jj/mm/aaaa) dans ce champ date.");
    theForm(theField).focus();
    return (false);
  }

  if (theForm(theField).value.length < 8)
  {
    alert("Tapez au moins 8 caractères dans ce champ date.");
    /* theForm(theField).focus(); */
    return (false);
  }

  if (theForm(theField).value.length > 10)
  {
    alert("Tapez au plus 10 caractères dans ce champ date.");
    theForm(theField).focus();
    return (false);
  }
  var checkOK = "0123456789-/";
  var checkStr = theForm(theField).value;
  var bCarDateD = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      bCarDateD = false;
      break;
    }
  }
  if (!bCarDateD)
  {
    alert("Ne tapez que  chiffre et \"/\" dans ce champ date.");
    theForm(theField).focus();
    return (false);
  }

  if (ErrDate(theForm(theField)) == true)
  {
    return (false);
  }
  else {
  	retuen (true);
  }
}

function ErrDate(champ)
{
 
  valcp=champ.value;
  if (valcp != "")
	{
  	msgerr=" Format des dates de type jj/mm/aa. Exemple 01/01/99"
  	pos=valcp.indexOf("/")
  	if (pos==-1)
  	{
    	alert("Il manque un séparateur."+msgerr);
    	champ.focus();
    	return (true);
  	}
  	pos1=valcp.indexOf("/", pos+1)
  	if (pos1==-1)
  	{
    	alert("Il manque un séparateur."+msgerr);
    	champ.focus();
    	return (true);
  	}
    	jour=valcp.substring(0,pos)
    	mois=valcp.substring(pos+1,pos1)
    	annee=valcp.substring(pos1+1,valcp.length)
   	jour=parseInt(jour,10)
    	mois=parseInt(mois,10)
    	annee=parseInt(annee,10)
	if (isNaN(jour)){
		alert("Le jour n'est pas correct."+msgerr);
		champ.focus();
		return (true);
	}
	if (isNaN(mois)){
		alert("Le mois n'est pas correct."+msgerr);
		champ.focus();
		return (true);
	}
	if (isNaN(annee)){
		alert("L'année n'est pas correcte."+msgerr);
		champ.focus();
		return (true);
	}
    	tDate=new Date(annee,mois-1,jour)
    	annee=tDate.getYear()
    	mois=tDate.getMonth()+1
	if (mois < 10) {
		mois="0"+mois
	}
    	jour=tDate.getDate()
	if (jour < 10) {
		jour="0"+jour
	}
    	champ.value=jour+"/"+mois+"/"+annee
	}
return(false);
}
