function makeValidDate() {
  year = document.theForm.selYear.options[ document.theForm.selYear.selectedIndex ].value;
  month = document.theForm.selMonth.options[ document.theForm.selMonth.selectedIndex ].value;
  day = document.theForm.selDay.options[ document.theForm.selDay.selectedIndex ].value;
  maxDay = 31;
  if ( month == 4 || month == 6 || month == 9 || month == 11 ) {
    maxDay = 30;
  } else if ( month == 2 ) {
    if ( year%100 != 0 && year%4 == 0 ) {
      maxDay = 29;
    } else {
      maxDay = 28;
    }
  }
  document.theForm.selDay.selectedIndex = Math.min(day, maxDay)-1;
}
var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

    function checkDate(){

      var day = parseInt(document.theForm.selDay.options[ document.theForm.selDay.selectedIndex ].value);
      var month = parseInt(document.theForm.selMonth.options[ document.theForm.selMonth.selectedIndex ].value);
      var year = parseInt(document.theForm.selYear.options[ document.theForm.selYear.selectedIndex ].value);

      if (!day || !month || !year)
      return false;

      if (year/4 == parseInt(year/4))
      monthLength[1] = 29;

      if (day > monthLength[month-1])
      return false;

      monthLength[1] = 28;

      var now = new Date();
      now = now.getTime(); //NN3

      var dateToCheck = new Date();
      dateToCheck.setYear(year);
      dateToCheck.setMonth(month-1);
      dateToCheck.setDate(day);
      var checkDate = dateToCheck.getTime();

      var futureDate = (now < checkDate);
      var pastDate = (now > checkDate);

      if(pastDate)
      {
      //alert("La date saisie est incorrecte.");
      return false;
      }
      else
      {
      document.theForm.Submit.value=1;
      return true;
      }
      
}