function CreateDropOffLocation() {

  var City = document.resform.from_loc.selectedIndex;

  if (City == 2) {
  	var DropOffLocation = new Array;
  	var DepartTrip = new Array;
  	DropOffLocation[0] = new Option("Select a destination location.");
  	DropOffLocation[1] = new Option("");
  	DropOffLocation[2] = new Option("Carpinteria - IHOP", "carp");
  	DropOffLocation[3] = new Option("Santa Barbara - Hotel MarMonte", "sb");
  	DropOffLocation[4] = new Option("Goleta - Thornwood Drive", "tw");
  }
  else if (City > 3) {
    var DropOffLocation = new Array;
    DropOffLocation[0] = new Option("Los Angeles Intl. Airport - LAX", "lax");
  }
  else {
    var DropOffLocation = new Array;
    DropOffLocation[0] = new Option("");
    DropOffLocation[1] = new Option("Select Starting Location First"); 
    document.resform.from_loc.options[0].selected = true;   
  }
  for (i=document.resform.to_loc.options.length; i>0; i--) { 
	document.resform.to_loc.options[i] = null;
  }
  for(i=0; i<DropOffLocation.length; i++) {
	document.resform.to_loc.options[i] = DropOffLocation[i];
  }
  document.resform.to_loc.options[0].selected = true;
}

function check_from_loc() {
	if (document.resform.from_loc.selectedIndex == (0|1|3)) {
		document.resform.from_loc.options[0].selected = true;
	}
}

function check_to_loc() {
	if ((document.resform.from_loc.selectedIndex == 2) && (document.resform.to_loc.selectedIndex == (0|1))) {
		document.resform.to_loc.options[0].selected = true;
	}
}

function check_numbpass() {
	if (document.resform.numbpass.selectedIndex == (0|1)) {
		document.resform.numbpass.options[0].selected = true;
	}
}


function validateresform1() {
		if (document.resform.from_loc.value == "") {
			alert("Please choose a city to depart \"From\".");
			document.resform.from_loc.focus();
			return false;
		}
		if (document.resform.to_loc.value == "") {
			alert("Please choose a city to go \"To.\"");
			document.resform.to_loc.focus();
			return false;
		}
		if (document.resform.numbpass.value == "") {
			alert("Please select the \"Number of Passengers\".");
			document.resform.numbpass.focus();
			return false;
		}	
		if ((!document.resform.owrt[0].checked) && (!document.resform.owrt[1].checked)) {
			alert("Please choose \"One Way\" or \"Round Trip\".");
			return false;
		}
		if ((document.resform.out_date.value == "mm/dd/yyyy")) {
			alert("Please enter a \"Departure Date\".");
			document.resform.out_date.focus();
			return false;	
		}	
		var pattern = /^\d\d\/\d\d\/\d\d\d\d$/i;
		var outdate = document.resform.out_date.value;
		if (!outdate.match(pattern)) {
			alert("Please enter a \"Departure Date\" in the format of mm/dd/yyyy");
			document.resform.out_date.focus();
			return false;
		}

		if ((document.resform.owrt[1].checked) && ( (document.resform.ret_date.value == "") || (document.resform.ret_date.value == "mm/dd/yyyy") ) ) {
			alert("Please enter a \"Return Date\"");
			document.resform.ret_date.focus();
			return false;
		}
		var retdate = document.resform.ret_date.value;
		if ((document.resform.owrt[1].checked) && (!retdate.match(pattern))) {
			alert("Please enter a \"Return Date\" in the format of mm/dd/yyyy");
			document.resform.ret_date.focus();
			return false;
		}
		if (document.resform.numbpass.value == "") {
			alert("Please select the \"Number of Passengers\".");
			document.resform.numbpass.focus();
			return false;
		}	
	return true;
}
