function setCurrentDate() {  // changes the date selector menus to the current date  var currentDate = new Date();		  document.initialqueryForm.InYear.selectedIndex = 0;  document.initialqueryForm.InMonth.selectedIndex = currentDate.getMonth();  setDays();    document.initialqueryForm.InDay.selectedIndex = currentDate.getDate() - 1;  setDays(); // to set the day in for codes  set_tomorrow(currentDate.getDate(),currentDate.getMonth(),currentDate.getYear());  setDays();}function setDays() {  var y = document.initialqueryForm.InYear.options[document.initialqueryForm.InYear.selectedIndex].value;  var m = document.initialqueryForm.InMonth.selectedIndex;  var d = document.initialqueryForm.InDay.selectedIndex + 1;//	datecode_in = (y*10000 + (m+1)*100 + d*1);	datecode_in = get_datecode(y,m,d);	document.initialqueryForm.datecode_in.value = datecode_in;	dow_in = Math.round((((datecode_in-1)/7) - Math.floor((datecode_in-1)/7)) * 7);	dow_in_name = day_of_week(dow_in);	document.initialqueryForm.dow_in.value = dow_in_name;		days = DaysInMonth(m,y)  // if (days in new month > current days) then we must add the extra days  if (days > document.initialqueryForm.InDay.length) {    for (i = document.initialqueryForm.InDay.length; i < days; i++) {      document.initialqueryForm.InDay.length = days;      document.initialqueryForm.InDay.options[i].text = i + 1;      document.initialqueryForm.InDay.options[i].value = i + 1;    }  }  	//	if (days in new month < current days) then we must delete the extra days	if (days < document.initialqueryForm.InDay.length)		{		document.initialqueryForm.InDay.length = days;//		next two lines deleted because selecting a "30" month set date to 30		//		d = days;//		document.initialqueryForm.InDay.selectedIndex = days-1;		}	current_datecode_in = document.initialqueryForm.datecode_in.value;	current_datecode_out = document.initialqueryForm.datecode_out.value;		if (current_datecode_out < current_datecode_in)		set_tomorrow(d,m,y);		setDays_out();	}function set_tomorrow(NowDay,NowMonth,NowYear)	{	CurrentDate = new Date();	CurrentYear = CurrentDate.getYear();	if (CurrentYear < 2000) CurrentYear = CurrentYear + 1900;	if (NowYear < 2000) NowYear = NowYear + 1900;	TomorrowDay = NowDay + 1;	TomorrowMonth = NowMonth;	TomorrowYear = NowYear;//	YearIndex = 0;	YearIndex = NowYear - CurrentYear;	if (TomorrowDay > DaysInMonth(TomorrowMonth, TomorrowYear))//	if (TomorrowDay > 31)		{		TomorrowDay = 1;		TomorrowMonth = TomorrowMonth +1;		if (TomorrowMonth > 11)			{			TomorrowMonth = 0;			TomorrowYear = TomorrowYear + 1;			YearIndex = YearIndex + 1;			}		}				  document.initialqueryForm.OutYear.selectedIndex = YearIndex;	  document.initialqueryForm.OutMonth.selectedIndex = TomorrowMonth;	  setDays_out();  	  document.initialqueryForm.OutDay.selectedIndex = TomorrowDay - 1;  	}function setDays_out() {  var y = document.initialqueryForm.OutYear.options[document.initialqueryForm.OutYear.selectedIndex].value;  var m = document.initialqueryForm.OutMonth.selectedIndex;  var d = document.initialqueryForm.OutDay.selectedIndex + 1;//	datecode_out = (y*10000 +(m+1)*100 + d*1);		var datecode_out = get_datecode(y,m,d);		days = DaysInMonth(m,y)  // if (days in new month > current days) then we must add the extra days  if (days > document.initialqueryForm.OutDay.length) {    for (i = document.initialqueryForm.OutDay.length; i < days; i++) {      document.initialqueryForm.OutDay.length = days;      document.initialqueryForm.OutDay.options[i].text = i + 1;      document.initialqueryForm.OutDay.options[i].value = i + 1;    }  }	//	if (days in new month < current days) then we must delete the extra days	if (days < document.initialqueryForm.OutDay.length)		{		document.initialqueryForm.OutDay.length = days;//		next line deleted because selecting a "30" month set date to 30		//		document.initialqueryForm.OutDay.selectedIndex = days-1;		}	document.initialqueryForm.datecode_out.value = datecode_out;	dow_out = Math.round((((datecode_out-1)/7) - Math.floor((datecode_out-1)/7)) * 7);	dow_out_name = day_of_week(dow_out);	document.initialqueryForm.dow_out.value = dow_out_name;		datecode_out = get_datecode(y,m,d);	datecode_in = document.initialqueryForm.datecode_in.value;	nights_to_stay = datecode_out - datecode_in;	document.initialqueryForm.nights_to_stay.value = nights_to_stay;}//function for returning how many days there are in a month including leap yearsfunction DaysInMonth(WhichMonth, WhichYear)	{	  var DaysthisMonth = 31;	  if (WhichMonth == 3 || WhichMonth == 5 || WhichMonth == 8 || WhichMonth == 10) DaysthisMonth = 30;	  if (WhichMonth == 1 && (WhichYear/4) != Math.floor(WhichYear/4))	DaysthisMonth = 28;	  if (WhichMonth == 1 && (WhichYear/4) == Math.floor(WhichYear/4))	DaysthisMonth = 29;	  return DaysthisMonth;	}function day_of_week(daynum)	{	dayname = "";	if ( daynum == 0 ) dayname = "Sun";	if ( daynum == 1 ) dayname = "Mon";	if ( daynum == 2 ) dayname = "Tue";	if ( daynum == 3 ) dayname = "Wed";	if ( daynum == 4 ) dayname = "Thu";	if ( daynum == 5 ) dayname = "Fri";	if ( daynum == 6 ) dayname = "Sat";	return(dayname);	}	function get_datecode(y,m,d)	{	// 1st Jan 2000 is day 1	var years_elapsed = y-2000;	var leap_years_elapsed = Math.floor((years_elapsed - 1)/4); // 2000 was not a leap year, does not include this year.	var datecode = years_elapsed * 365 + leap_years_elapsed; // brings it yp to the end of last year	// count through the months	var monthcount = 0;	while ( monthcount < m) // count the months up to now		{		datecode = datecode + DaysInMonth(monthcount,y);		monthcount ++;		}	datecode = datecode + d; // add the days this month	return (datecode);	}