function testDateQuicksearch(formulaire) {
	var message='';
	var todaydate=new Date();
	
	var today=new Date(todaydate.getFullYear(),todaydate.getMonth(), todaydate.getDate());
	//test de la date
	choixdate=new Date(formulaire.fyear.options[formulaire.fyear.selectedIndex].value, formulaire.fmonth.options[formulaire.fmonth.selectedIndex].value-1, formulaire.fday.options[formulaire.fday.selectedIndex].value);
	
	
	if (today<=choixdate) { } else {message='Date invalide : merci de modifier la date saisie.';}
	
	
	// affichage du message d'erreur
	if (message!='') alert(message);
	else {
	 formulaire.submit();
	}
}

// you may use/modify this code, but please give credit as a courtesy
// script by Arash Ramin (http://www.digitalroom.net)
function dateQuicksearch() {
  // changes the date selector menus to the current date
  var currentDate = new Date();

   var mois = currentDate.getMonth()+1;
   var annee = currentDate.getFullYear();
   if( mois < 10)
   mois ='0'+ mois;
   var i;
   var anneemois = annee + "" +  mois ;
   for( i = 0; i < document.formQuicksearch.fmonth.length; i++)
   {
	   if(document.formQuicksearch.fmonth.options[i].value == anneemois)
	   {
			document.formQuicksearch.fmonth.options[i].selected = true;
			break;
		}
   }
  setDateQuicksearch();
  document.formQuicksearch.fday.selectedIndex = currentDate.getDate() - 1;
}

function setDateQuicksearch() {

  var Monthlong = document.formQuicksearch.fmonth.options[document.formQuicksearch.fmonth.selectedIndex].value;
  var m=Monthlong.substring(4,6);
  var y=eval(Monthlong.substring(0,4));

  // find number of days in current month
  days = 31;
  if ( (m == "04") || (m == "06") || (m == "09") || (m == "11") ) {
    days = 30;
  }
  else if (m == "02") {
    // check for leapyear - Any year divisible by 4, except those divisible by 100 (but NOT 400)
    if ( (Math.floor(y/4) == (y/4)) && ((Math.floor(y/100) != (y/100)) || (Math.floor(y/400) == (y/400))) )
      days = 29;
    else
      days = 28;
  }


  // if (days in new month > current days) then we must add the extra days
  if (days > document.formQuicksearch.fday.length) {
    for (i = document.formQuicksearch.fday.length; i < days; i++) {
      document.formQuicksearch.fday.length = days;
      document.formQuicksearch.fday.options[i].text = i + 1;
      document.formQuicksearch.fday.options[i].value = i + 1;
    }
  }

  
  // if (days in new month < current days) then we must delete the extra days
  if (days < document.formQuicksearch.fday.length) {
    document.formQuicksearch.fday.length = days;
    if (document.formQuicksearch.fday.selectedIndex == -1) 
      document.formQuicksearch.fday.selectedIndex = days - 1;
  }

}