//set todays date
Now      = new Date();
NowDay   = Now.getDate();
NowMonth = Now.getMonth();
NowYear  = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//*****************************************
function daysinmonth(WhichMonth, WhichYear)
//*****************************************
{
var DaysInMonth = 31;
if (WhichMonth == 'Apr' || WhichMonth == 'Jun' || WhichMonth == 'Sep' || WhichMonth == 'Nov') DaysInMonth = 30;
if (WhichMonth == 'Feb' && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
if (WhichMonth == 'Feb' && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
return DaysInMonth;
}

//******************************
function changeoptiondays(Which)
//******************************
//function to change the available days in a months
{
DaysObject  = eval('document.Form1.' + Which + 'Day');
MonthObject = eval('document.Form1.' + Which + 'Month');
YearObject  = eval('document.Form1.' + Which + 'Year');
Month = MonthObject[MonthObject.selectedIndex].text;
Year  = YearObject[YearObject.selectedIndex].text;
DaysForThisselection   = DaysInMonth(Month, Year);
CurrentDaysInselection = DaysObject.length;
if (CurrentDaysInselection > DaysForThisselection)
  {
  for (i=0; i<(CurrentDaysInselection-DaysForThisselection); i++)
    {
    DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
if (DaysForThisselection > CurrentDaysInselection)
  {
  for (i=0; i<(DaysForThisselection-CurrentDaysInselection); i++)
    {
    Newoption = new option(DaysObject.options.length + 1);
    DaysObject.add(Newoption);
    }
  }
if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}
//************************
function settotoday(Which)
//************************
//function to set options to today
{
DaysObject  = eval('document.Form1.' + Which + 'Day');
MonthObject = eval('document.Form1.' + Which + 'Month');
YearObject  = eval('document.Form1.' + Which + 'Year');
YearObject[0].selected = true;
MonthObject[NowMonth].selected = true;
changeoptiondays(Which);
DaysObject[NowDay-1].selected = true;
}

//***********************************
function writeyearoptions(YearsAhead)
//***********************************
//function to write option years plus x
{
line = '';
for (i=0; i<YearsAhead; i++)
  {
  line += '<option>';
  line += NowYear + i;
  }
return line;
}

