<!--
	function loadScript() {
		// *********************************************
		// ADDED BY CW - 06/28/2004; UPDATED BY CW - 08/17/2004
		var now = new Date();
		var startDate = new Date();
		newDate = new Date(now.getTime() + (3*24*60*60*1000));
		// ---------------------------------------------
		if ((newDate.getMonth()+1)<10) {
			startMonth = "0" + (newDate.getMonth()+1);
		} else {
			startMonth = (newDate.getMonth()+1);
		}
		// ---------------------------------------------
		startDate = startMonth + "/" +  newDate.getDate() + "/" + newDate.getFullYear();
		document.TravelRequestForm.itineraryStartDate.value = startDate;
//alert("startDate = " + startDate);
		// ---------------------------------------------
		newDate = new Date(now.getTime() + (10*24*60*60*1000));
		// ---------------------------------------------
		if ((newDate.getMonth()+1)<10) {
			startMonth = "0" + (newDate.getMonth()+1);
		} else {
			startMonth = (newDate.getMonth()+1);
		}
		// ---------------------------------------------
		endDate = startMonth + "/" +  newDate.getDate() + "/" + newDate.getFullYear();
//		endDate = (newDate.getMonth()+1) + "/" +  newDate.getDate() + "/" + newDate.getFullYear();
		document.TravelRequestForm.itineraryEndDate.value = endDate;
//alert("endDate = " + endDate);
		// *********************************************
	}

	// CREATED BY CW - 08/04/2004 FOR INDEX.PHP
	function sendOff(object) {
		var strConfirm='';
		var now = new Date();
		// ---------------------------------------------
		// *** SET LOCALDISCOUNT TO 0/1 ***
		if (eval("document.TravelRequestForm.localDiscount[0].checked")==true
			&& eval("document.TravelRequestForm.localDiscount[1].checked")==false
		) {
			// HI RESIDENT = YES
			document.TravelRequestForm.localDiscount.value = 1;
		} else if (eval("document.TravelRequestForm.localDiscount[0].checked")==false
			&& eval("document.TravelRequestForm.localDiscount[1].checked")==true
		) {
			// HI RESIDENT = NO
			document.TravelRequestForm.localDiscount.value = 0;
		} else {
			document.TravelRequestForm.localDiscount.value = 0;
		}
//alert("document.TravelRequestForm.localDiscount.value = " + document.TravelRequestForm.localDiscount.value);
		// ---------------------------------------------
		// *** CREATE TODAY'S DATE BASED ON BROWSER TYPE ***
		if (navigator.appName == 'Microsoft Internet Explorer') {
			var today = parseInt(now.getMonth()+1, 10) + '/' + now.getDate() + '/' + parseInt(now.getYear(), 10);
		} else if (navigator.appName == 'Netscape') {
			var today = parseInt(now.getMonth()+1, 10) + '/' + now.getDate() + '/' + parseInt(now.getYear()+1900, 10);
		} else {
			var today = parseInt(now.getMonth()+1, 10) + '/' + now.getDate() + '/' + parseInt(now.getYear()+1900, 10);
		}
		// ---------------------------------------------
		// *** CHECK THAT DEP & ARR CITIES HAVE VALUES ENTERED ***
//			if (!document.TravelRequestForm.from.value && (eval("document.TravelRequestForm.typeOfPackage[4].checked")==false)) {
		if (!document.TravelRequestForm.from.value) {
			strConfirm += 'Please select a Departure City' + '\n';
		}

		if (!document.TravelRequestForm.to.value) {
			strConfirm += 'Please select an Arrival City' + '\n';
		}
		// ---------------------------------------------
		// *** CHECK THAT DEP & ARR CITIES ARE DIFFERENT ***
		if (
			document.TravelRequestForm.from.value
			&& document.TravelRequestForm.to.value
			&& (document.TravelRequestForm.from.value==document.TravelRequestForm.to.value)
		) {
			strConfirm += 'Departing and Arrival cities must be different' + '\n';
		}
		// ---------------------------------------------
		// *** VALID DEP & ARR DATES? ***
		if (!checkdate(document.TravelRequestForm.itineraryStartDate)) {
			strConfirm += 'Departure Date is not filled in correctly' + '\n';
		}

		if (!checkdate(document.TravelRequestForm.itineraryEndDate)) {
			strConfirm += 'Arrival Date is not filled in correctly' + '\n';
		}
		// ---------------------------------------------
		// *** ARE DEP & ARR DATES GREATER THAN TODAY? ***
		if (daysElapsed(document.TravelRequestForm.itineraryStartDate.value, today)<=0) {
			strConfirm += 'Departure Date should be greater than today' + '\n';
		}

		if (daysElapsed(document.TravelRequestForm.itineraryEndDate.value, today)<=0) {
			strConfirm += 'Arrival Date should be greater than today' + '\n';
		}
		// ---------------------------------------------
		// *** IS DEP DATE EARLIER THAN ARR DATE? ***
		// COMMENTED BY CW - 09/14/2004
/*
		if (daysElapsed(document.TravelRequestForm.itineraryEndDate.value, document.TravelRequestForm.itineraryStartDate.value)<=0) {
			strConfirm += 'Arrival Date should be greater than the Departure Date' + '\n';
		}
*/
		// ---------------------------------------------
		// *** ARE DEP & ARR DATES WITHIN 330 DAYS OF TODAY? ***
		if (daysElapsed(date_diff(today), document.TravelRequestForm.itineraryStartDate.value)<0) {
			strConfirm += 'Please set the Departure Date within 330 days from today' + '\n';
		}

		if (daysElapsed(date_diff(today), document.TravelRequestForm.itineraryEndDate.value)<0) {
			strConfirm += 'Please set the Arrival Date within 330 days from today' + '\n';
		}
		// ---------------------------------------------
		// *** FINAL CHECK ***
		if (strConfirm.length > 0) {
			alert(strConfirm);
		} else {

			if (
				regionIslandChecker() &&
				checkInfantsVersusAdults() &&
				checkNumOfPassengers() &&
				dateChecker()
			) {
				document.TravelRequestForm.action='http://pts.get2hawaii.com/ots/Index.do';
				document.TravelRequestForm.submit();
			}
		}
	}

	// CREATED BY CW - 08/04/2004
	function date_diff(val) {
		// GET THE DATE 330 DAYS FROM TODAY
    		var date330 = "";
    		// parse val for month, day, year
		var dateArray = val.split('/');
		// ---------------------------------------------
		strDate = new Date(dateArray[2],parseInt(dateArray[0],10)-1,dateArray[1]);
		// ---------------------------------------------
		// figure out day, month, year 330 days from today
		date330 = new Date(strDate.getTime() + (330 * 86400000));
		// ---------------------------------------------
		if (navigator.appName == 'Microsoft Internet Explorer') {
			var tmpYear = parseInt(date330.getYear(), 10);
		} else if (navigator.appName == 'Netscape') {
			var tmpYear = parseInt(date330.getYear()+1900, 10);
		} else {
			var tmpYear = parseInt(date330.getYear()+1900, 10);
		}
		// ---------------------------------------------
		// return value
		return (parseInt(date330.getMonth()+1, 10))
			+ '/'
			+ date330.getDate()
			+ '/'
			+ tmpYear
//			+ (parseInt(date330.getYear()+1900, 10));
	}

	// CREATED BY CW - 08/04/2004
	function daysElapsed(date1, date2) {
		// CALL FUNCTION BY: daysElapsed(FormValue, 330Days)
		// ---------------------------------------------
		var dateArray1 = date1.split('/');
		var dateArray2 = date2.split('/');
		// ---------------------------------------------
		date1 = new Date(dateArray1[2],parseInt(dateArray1[0],10)-1,dateArray1[1]);
		date2 = new Date(dateArray2[2],parseInt(dateArray2[0],10)-1,dateArray2[1]);
		// ---------------------------------------------
		var difference =
			Date.UTC(y2k(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0)
			- Date.UTC(y2k(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0);
		// ---------------------------------------------
		return difference/1000/60/60/24;
	}

	// CREATED BY CW - 08/04/2004
	function y2k(number) {
		return (number < 1000) ? number + 1900 : number;
	}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v4.0
	var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);

	if (app.indexOf('Netscape') != -1) {
		if (version >= NSvers) {
			if (NSpass>0) newURL=(NSpass==1)?URL:altURL;
		} else {
			if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;
		}
	} else if (app.indexOf('Microsoft') != -1) {
		if (version >= IEvers || verStr.indexOf(IEvers) != -1) {
			if (IEpass>0) newURL=(IEpass==1)?URL:altURL;
		} else {
			if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;
		}
	} else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
	if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false;
	}
}

function MM_reloadPage(init) { //reloads the window if Nav4 resized
	if (init==true) with (navigator) {
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
		}
	} else
		if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

function MM_findObj(n, d) { //v4.0
	var p,i,x;
	if (!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}

	if (!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n);
	return x;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

function changeto(highlightcolor) {
	source=event.srcElement
	if (source.tagName=="TR"||source.tagName=="TABLE")
	return
	while(source.tagName!="TABLE")
	source=source.parentElement
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
	source.style.backgroundColor=highlightcolor
}

function changeback(originalcolor) {
	if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
	return
	if (event.toElement!=source)
	source.style.backgroundColor=originalcolor
}

// Start Datefield validation code
var DepartDate = "";
var ReturnDate = "";

function InitSaveVariables(fieldDepartDate,fieldReturnDate) {
	DepartDate = fieldDepartDate.value;
	ReturnDate = fieldReturnDate.value;
}

/*
	Compare the value stored in fieldDepartDate with that stored in fieldReturndate and,
	if the former is greater than the latter, set the value stored in fieldReturnDate
	to be the same as that for fieldDepartDate plus 1 day. NY - 06/25/2002.
*/
	INTERISLAND_STAY_DAYS = 1;
	INBOUND_STAY_DAYS = 7;
	OUTBOUND_STAY_DAYS = 7;
	INTERISLAND_PACKAGE_ATTR = 1;
	INBOUND_PACKAGE_ATTR = 2;
	OUTBOUND_PACKAGE_ATTR = 3;

function DepartChecker(fieldDepartDate,fieldReturnDate) {
	var leeDay;

	// alert("test");
	dtDepart = new Date(fieldDepartDate.value);
	dtReturn = new Date(fieldReturnDate.value);

	day = dtDepart.getDate();
	month = dtDepart.getMonth();
	year = dtDepart.getFullYear();

	leeDay = INBOUND_STAY_DAYS;

/*	// COMMENTED OUT BY JOE
	if(document.forms[0].packageAttrStr.value==INBOUND_PACKAGE_ATTR) {
		leeDay = INBOUND_STAY_DAYS;
	} else if(document.forms[0].packageAttrStr.value==OUTBOUND_PACKAGE_ATTR) {
		leeDay = OUTBOUND_STAY_DAYS;
	} else {
		leeDay = INTERISLAND_STAY_DAYS;
	}
*/
	//alert("leeday=" + leeDay + " packageAttrStr=" + document.forms[0].packageAttrStr.value);
	for(var i=1; i<=leeDay; i++) {
		day++;
	}

	oldDepart = new Date(fieldDepartDate.value);
	oldDepart.setDate(day);
	newDepart = (oldDepart.getMonth() + 1) + "/" + oldDepart.getDate() + "/" + oldDepart.getFullYear();

	if (dtDepart > dtReturn) {
		fieldReturnDate.value = newDepart;
	}
}

/* See the above routine */
function ReturnChecker(fieldDepartDate,fieldReturnDate) {
	dtDepart=new Date(fieldDepartDate.value);
	dtReturn=new Date(fieldReturnDate.value);
/*
	// This code allows for the validation scheme to automatically
	// place the Departure Date one day before the Return Date.
	// It has been commented out for now. NY - 06/25/2002.

	day = dtReturn.getDate();
	month = dtReturn.getMonth();
	year = dtReturn.getYear();
	dtReturn.setDate(day - 1);
	newReturn = (dtReturn.getMonth() + 1) + "/" + dtReturn.getDate() + "/" + dtReturn.getYear();

	if (dtReturn < dtDepart) {
		fieldDepartDate.value = newReturn;
	}
*/

	if (dtReturn < dtDepart) {
		fieldDepartDate.value = fieldReturnDate.value;
	}
}
// End Datefield validation code

//Return true if a hotel is included, false otherwise
function includesHotel() {
	if (
		document.TravelRequestForm.typeOfPackage[0].checked=="1" ||
		document.TravelRequestForm.typeOfPackage[2].checked=="1"
	) {
		return true;
	}
		return false;
}


//check if this is an interisland package. "1" is for interisland defined in PackageTravelRequestPdt.
/*function isInterislandPkg() {
	return (document.TravelRequestForm.packageAttrStr.value=="1");
}
*/
// Return false if there are more infants than adults specified
// Return false if there are more children than adults specified
function checkInfantsVersusAdults() {
	var nAdults=new Number(document.TravelRequestForm.numberOfAdults.value);
	var nInfants=new Number(document.TravelRequestForm.numberOfInfants.value);

	if (nAdults < nInfants) {
		alert("The number of infants must not be greater than the number of adults traveling");
		return false;
	}
	return true;
}


// Return false if the number of passengers is greater than 7
// Return false if the number of adults is less than 1
function checkNumOfPassengers() {
	var nAdults=new Number(document.TravelRequestForm.numberOfAdults.value);
	var nChildren=new Number(document.TravelRequestForm.numberOfChildren.value);

	if (nAdults + nChildren > 7) {
		alert("The total number of passengers must not be greater than 7.");
		return false;
	}

	if (nAdults < 1) {
		alert("There must be at least 1 adult traveler in the party.");
		return false;
	}
	return true;
}

/*
	Checks to see if the Kama'aina button has been pressed,if not - forward back to
	departure page.
*/
function discountChecker() {
	//if (includesHotel() && // revised 051404
	if (
	document.TravelRequestForm.localDiscount[0].checked=="0" &&
 document.TravelRequestForm.localDiscount[1].checked=="0"
	) {
		alert("Please make sure that you specify if you are a Hawaii resident.");
		return false;
	}
	return true;
}

//Erland Added + Nikolas Updated + Nikolas Fixed.

function dateChecker() {
	//if it is multiIsland, dont allow for 1 day.
 if (
 document.TravelRequestForm.typeOfPackage.value == "fullPackage" ||
	document.TravelRequestForm.typeOfPackage.value == "AIR-CAR-HOTEL"
	) {

		if (
		isInterislandPkg() &&
 	document.TravelRequestForm.typeOfTour[0].checked=="0" &&
 	document.TravelRequestForm.typeOfTour[1].checked=="1"
 	) {
			dtStart = new Date(document.TravelRequestForm.itineraryStartDate.value);
			dtEnd = new Date(document.TravelRequestForm.itineraryEndDate.value);
			endDay = new Date((dtEnd.getMonth() + 1) + "/" + dtEnd.getDate() + "/" + dtEnd.getFullYear());
			startDay = new Date((dtStart.getMonth() + 1) + "/" + (dtStart.getDate()+ 2) + "/" + dtStart.getFullYear());

			if(endDay < startDay) {
				alert("Please make sure that the number of days you specify for this Multi-Island trip exceeds 1 day of travel.");
				return false;
			} else {
				return true;
			}
		}
	}
	return true;
}

//Erland Added
function regionIslandChecker() {
	if (includesHotel()) {
		var SelectedIsland = getHawaiianIslandByAirportCode(document.TravelRequestForm.to.value);
		var SelectedRegion = document.TravelRequestForm.region.options[document.TravelRequestForm.region.selectedIndex].value;

		if (SelectedIsland == "") {
			alert('Please select an Island Destination and Island Region before submitting the Travel Package Request.');
			return false;
		}

		if (SelectedRegion == "") {
			alert('Please select an Island Region before submitting the Travel Package Request.');
			return false;
		}
	}
	return true;
}

/*
	* This function only applied to hawaiian island. Since there is no map in javascipt, use
	* comparing island one by one though it is inefficient.
	* <option value="HNL">Honolulu, Oahu (HNL)</option>
	* <option value="LIH">Lihue, Kauai (LIH)</option>
	* <option value="OGG">Kahului, Maui (OGG)</option>
	* <option value="KOA">Kona, Hawaii (KOA)</option>
	* <option value="ITO">Hilo, Hawaii (ITO)</option>
	* <option value="LNY">Lanai City, Lanai (LNY)</option>
	* <option value="MKK">Hoolehua, Molokai (MKK)</option>
*/
function getHawaiianIslandByAirportCode(code) {
	switch (code) {
		case "HNL":
			return "Oahu";
			break;
		case "LIH":
			return "Kauai";
			break;
		case "OGG":
			return "Maui";
			break;
		case "KOA":
			return "Hawaii/Big Island";
			break;
		case "ITO":
			return "Hawaii/Big Island";
			break;
		case "LNY":
			return "Lanai";
			break;
		case "MKK":
			return "Molokai";
			break;
		default:
			alert ( "Airport code " + code + " is not Supported");
			return ("Not Supported");
			break;
	}
/* COMMENTED BY CW - 08/03/2004
	if (code == "HNL") {
		return "Oahu";
	}else if (code == "LIH") {
		return "Kauai";
	}else if (code == "OGG") {
		return "Maui";
	}else if (code == "KOA") {
		return "Hawaii/Big Island";
	}else if (code == "ITO") {
		return "Hawaii/Big Island";
	}else if (code == "LNY") {
		return "Lanai";
	}else if (code == "MKK") {
		return "Molokai";
	}else {
		alert ( "Airport code " + code + " is not Supported");
		return ("Not Supported");
	}
*/
}

// This function is called when the submit image or link is clicked. The validations done here should
// really be done in supporting Java code, but in the interest of time we added them here.
function submitForm() {
	if (
	regionIslandChecker() &&
	checkInfantsVersusAdults() &&
	checkNumOfPassengers() &&
	dateChecker()
//	&& discountChecker() // COMMENTED BY CW - 8/16/2004
	) {
		document.TravelRequestForm.submit();
	}
}

function submitForm1() {
	if (
	regionIslandChecker() &&
	checkNumOfPassengers() &&
	dateChecker()
//	&& discountChecker() // COMMENTED BY CW - 8/16/2004
	) {
		document.TravelRequestForm.submit();
	}
}
//-->