<!-- Begin
//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
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 to change the available days in a months
function ChangeOptionDays(formname, which)
{
  DaysObject  = eval("document." + formname + "." + which + "d");
  MonthObject = eval("document." + formname + "." + which + "m");
  YearObject  = eval("document." + formname + "." + which + "y");

  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 to set options to today
function SetToToday(formname, which, yearFrom)
{
  DaysObject = eval("document." + formname + "." + which + "d");
  MonthObject = eval("document." + formname + "." + which + "m");
  YearObject = eval("document." + formname + "." + which + "y");

  YearObject[NowYear-yearFrom].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(formname,which);

  DaysObject[NowDay-1].selected = true;
}

//function to set options to given date
function SetToDate(formname, which, dd, mm, yyyy, yearFrom)
{
  DaysObject = eval("document." + formname + "." + which + "d");
  MonthObject = eval("document." + formname + "." + which + "m");
  YearObject = eval("document." + formname + "." + which + "y");

  YearObject[yyyy-yearFrom].selected = true;
  MonthObject[mm].selected = true;

  ChangeOptionDays(formname,which);

  DaysObject[dd-1].selected = true;
}

function WriteYearOptions(yearFrom, yearTill, yearselected)
{
  line = "";
  if (yearTill>=yearFrom) 
  {
	  for (i=yearFrom; i<=yearTill; i++)
	  {
	  	selected='';
	  	if (i==yearselected || (yearselected==0 && i==NowYear)) selected='selected';
	    	line += "<OPTION value=" + i + " " + selected + ">" + i;	  	
	  }
  }
  return line;
}

function WriteHourOptions(selected)
{
  line = "";
  for (i=0; i<=23; i++)
  {
	selected='';
	if (i==selected) selected='selected';
	line += "<OPTION value=" + i + " " + selected + ">" + i;	  	
  }
  return line;
}

function WriteMinuteOptions(selected)
{
  line = "";
  for (i=0; i<=59; i++)
  {
	selected='';
	if (i==selected) selected='selected';
	if (i<10)  line += "<OPTION value=" + i + " " + selected + ">0" + i;
	else       line += "<OPTION value=" + i + " " + selected + ">" + i;	  	
  }
  return line;
}
//  End -->