//
//Tomorrow.setFullYear(Now.getFullYear(),Now.getMonth(),Now.getDay()+1);
//Tomorrow = new Date();
//Tomorrow = new Date(Tomorrow.getFullYear(),Tomorrow.getMonth(),Tomorrow.getDay()+1);
Tomorrow = new Date(new Date - 0 + 86400000);

TomorrowDay = Tomorrow.getDate();
TomorrowMonth = Tomorrow.getMonth();
TomorrowYear = Tomorrow.getYear();

if (TomorrowYear < 2000) TomorrowYear += 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 chinp()
{
  Which = 'FirstSelect';
  DaysObject = eval("document.weform.inp2");
  MonthObject = eval("document.weform.starteq");
  YearObject = eval("document.weform.card");

  Month = MonthObject[MonthObject.selectedIndex].value;
  Year = YearObject[YearObject.selectedIndex].value;

  DaysForThisSelection = DaysInMonth(Month, Year);
//  alert(DaysForThisSelection);
  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.options.length + 1);
	  DaysObject.options[DaysObject.options.length] = NewOption;
	  //DaysObject.add(NewOption);
	  //DaysObject.options[CurrentDaysInSelection + i] = new Option(DaysObject.options.length + 1,DaysObject.options.length + 1);
	  //NewOption.value = CurrentDaysInSelection + i + 1;	
      
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

function SetToToday()
{
  if (!document.weform || !document.weform.starteq)return;
  DaysObject = document.weform.inp2;
  MonthObject = document.weform.starteq;
  YearObject = document.weform.card;

//  alert(YearObject[2007]);
//  YearObject[TomorrowYear].selected = true;
  YearObject.value = TomorrowYear;
  MonthObject[TomorrowMonth].selected = true;

  chinp();

  DaysObject[TomorrowDay-1].selected = true;
}
