<!--  
//-----------------------------------------------------
function Leading_Zero(str, places)
{
  while (str.length < places) str = '0'+str;
  return str;
}
//-----------------------------------------------------

function Leap_Year(WhichYear)
{
  if ( (WhichYear/4) == Math.floor(WhichYear/4) ) return 1;
  else return 0;
}
//-----------------------------------------------------

//function for returning how many days there are in a month including leap years
function Days_In_Month(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == 4 || WhichMonth == 6 || WhichMonth == 9 || WhichMonth == 11) DaysInMonth = 30;
  if (WhichMonth == 2 && !Leap_Year(WhichYear) )	DaysInMonth = 28;
  if (WhichMonth == 2 && Leap_Year(WhichYear) )	DaysInMonth = 29;
  return DaysInMonth;
}
//-----------------------------------------------------

//function to change the available days in a months
function ChangeOptionDays(dayObj, monthObj, yearObj)
{
  Month = parseInt(monthObj.value);
  Year = parseInt(yearObj.value);

  DaysForThisSelection = Days_In_Month(Month, Year);

  CurrentDaysInSelection = dayObj.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      dayObj.options[dayObj.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      NewOption = new Option(dayObj.options.length + 1);
      dayObj.add(NewOption);
    }
  }
    if (dayObj.selectedIndex < 0) dayObj.selectedIndex == 0;
}

//-->