function checkForm() {
	var city		= document.SearchForm.city.value;
	var country		= document.SearchForm.country.options[document.SearchForm.country.selectedIndex].value;
	var state		= document.SearchForm.state.options[document.SearchForm.state.selectedIndex].value;
	var arriveDay	= document.SearchForm.arriveDay.options[document.SearchForm.arriveDay.selectedIndex].value;
	var arriveMonth = document.SearchForm.arriveMonth.options[document.SearchForm.arriveMonth.selectedIndex].value;
	var arriveYear	= document.SearchForm.arriveYear.options[document.SearchForm.arriveYear.selectedIndex].value;
	var bookDate	= arriveMonth + '/' + arriveDay + '/' + arriveYear
	hideAllErrors();
	// make sure that there is a city
	if (city == "") { 
		document.getElementById("errorCity").style.visibility = "visible";
		document.getElementById("city").select();
		document.getElementById("city").focus();
  		return false;
		}
	// Make sure that the country is selected
	if (country == "-1") {
		document.getElementById("errorCountry").style.visibility = "visible";
  		document.getElementById("country").focus();
  		return false;
    	}
	// If the country is the US then make sure that the state is selected
	if (country == "US") {
		if(state == "") {
			alert("Please select a state");
			}
		}
	// Make sure that it is a valid date
	if (isDate(bookDate,'M/d/y')==false) {
		document.getElementById("errorDate").style.visibility = "visible";
		return false;
		}
	// Make sure that the date is in the future
	if (isDate(bookDate,'M/d/y')==true) {
		var jsDate		= new Date(arriveYear,arriveMonth-1,arriveDay);
		var td			= new Date();
		var hasPast		= false;
		if(jsDate.getFullYear() < td.getFullYear()) {
			hasPast = true;
			}
		else {
			if ((jsDate.getMonth < td.getMonth()) && (jsDate.getFullYear() == td.getFullYear())) {
				hasPast = true;
				}
			else{
				if ( (jsDate.getDate() < td.getDate()) && (jsDate.getMonth() == td.getMonth()) && (jsDate.getFullYear() == td.getFullYear()) ) {
					hasPast = true;
					}
				}
			}
		if(hasPast) {
			document.getElementById("errorDate").innerHTML		= "Select a date in the future";
			document.getElementById("errorDate").style.visibility	= "visible";
			return false;
			}
		}
	return true;
	};

function hideAllErrors() {
	document.getElementById("errorCity").style.visibility		= "hidden";
	document.getElementById("errorCountry").style.visibility	= "hidden";
	document.getElementById("errorDate").style.visibility		= "hidden";
	document.getElementById("errorDate").innerHTML				= "Invalid Date";
	};

function populate(inForm) {
	var temp		= 0;
	var today		= new Date();
	var day			= today.getDate();
	var month		= today.getMonth();
	var year		= today.getFullYear();
	var setDefault = false;
	// set default
	if(inForm.arriveDay.selectedIndex == 0 && inForm.arriveYear.selectedIndex == 0 && inForm.arriveMonth.selectedIndex == 0) {
		setDefault = true;
		}
	// populate out the days dropdown
	for (var i=0; i <31 ; i++)
		{
		var x= String(i+1);
		inForm.arriveDay.options[i] = new Option(x,x);
		}
	for (var i=0; i <31 ; i++)
		{
		var d=0;
		d=inForm.arriveDay.options[i].value;
		if(d==day && setDefault == true){	
			inForm.arriveDay.options[i].selected=true;
			break;}
		}
	for (var i=0,j=year; i <2 ; i++, j++)
		{
		var y= String(j);
		inForm.arriveYear.options[i] = new Option(y,y);	
		}	
	for (var i=0;i<12;i++)
		{
		if(i==month && setDefault == true){
			inForm.arriveMonth.options[i].selected=true;
			break;
			}
		}
	};