	//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(Which){
		DaysObject = eval("document.check_form." + Which + "Day");
		MonthObject = eval("document.check_form." + Which + "Month");
		YearObject = eval("document.check_form." + 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 to set options to today
	function SetToToday(Which){
		DaysObject = eval("document.check_form." + Which + "Day");
		MonthObject = eval("document.check_form." + Which + "Month");
		YearObject = eval("document.check_form." + Which + "Year");

		YearObject[0].selected = true;
		MonthObject[NowMonth].selected = true;

		ChangeOptionDays(Which);

		DaysObject[NowDay-1].selected = true;
	}

	//function to set options to tomorrow
	function SetToTomorrow(Which){
		DaysObject = eval("document.check_form." + Which + "Day");
		MonthObject = eval("document.check_form." + Which + "Month");
		YearObject = eval("document.check_form." + Which + "Year");


		Tomorrow = new Date();
		Tomorrow.setDate(Tomorrow.getDate()+1);
		TomorrowDay = Tomorrow.getDate();
		TomorrowMonth = Tomorrow.getMonth();
		TomorrowYear = Tomorrow.getYear();

		YearObject[0].selected = true;
		MonthObject[TomorrowMonth].selected = true;
		ChangeOptionDays(Which);
		DaysObject[TomorrowDay-1].selected = true;
	}

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

	function validate_availability(){
		fromDay = document.check_form.fromDay.value;
		fromMonth = document.check_form.fromMonth.value;
		fromYear = document.check_form.fromYear.value;
		toDay = document.check_form.toDay.value;
		toMonth = document.check_form.toMonth.value;
		toYear = document.check_form.toYear.value;
		
		fromDate = new Date(fromMonth+" "+fromDay+", "+fromYear);
		toDate = new Date(toMonth+" "+toDay+", "+toYear);
		CurrentDate = new Date();
		CurrentDay = CurrentDate.getDate();
		CurrentMonth = CurrentDate.getMonth()+1;
		CurrentYear = CurrentDate.getFullYear();
		Today = new Date(CurrentMonth+" "+CurrentDay+", "+CurrentYear);

		if (fromDate<Today){
			alert('You have a selected the starting day from the past.');
			return false;
		}
		else{
			difference = toDate-fromDate;
			days = Math.round(difference/(1000*60*60*24));
			if (days<=0){
				alert('There must be at least one day difference between dates.');
				return false;
			}
			else{
				return true;
			}
		}
	}
