Calendar_CreateCalendarLayer(0, 0, "");

// -------------------------------

var cur = new Date();
var dtCh= "/";
var minYear= cur.getFullYear();
var maxYear=(cur.getFullYear()+1);

// -------------------------------

function changeLink1(_LINK){
	_LINK.href="http://pts.get2hawaii.com/ots/Index.do?agID="+document.TravelRequestForm.agID.value+"&idxRedirect=PromotionSearch.do";
	}
function changeLink2(_LINK){
	selectForm('http://pts.get2hawaii.com/ots/Index.do?agID='+document.TravelRequestForm.agID.value+'&idxRedirect=ChangeTravelType.do%3FtypeOfTravel%3D3&amp;packageType%3DAIR-HOTEL')
}
function changeLink3(_LINK){
	_LINK.href="http://pts.get2hawaii.com/ots/Index.do?agID="+document.TravelRequestForm.agID.value;
}

// -------------------------------
// TOOL TIP
//Toggle Alt Mandatory notation
//switch layers for different browsers
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

function hidelayer(lay) {
	if (ie4) {
		document.all[lay].style.visibility = "hidden";
	}

	if (ns4) {
		document.layers[lay].visibility = "hide";
	}

	if (ns6) {
		document.getElementById([lay]).style.display = "none";
	}
}

function showlayer(lay) {
	if (ie4) {
		document.all[lay].style.visibility = "visible";
	}

	if (ns4) {
		document.layers[lay].visibility = "show";
	}

	if (ns6) {
		document.getElementById([lay]).style.display = "block";
	}
}
	
// -------------------------------

function selectForm(link) {
	var url = link;

	if ((url != "") && (url != null))
		window.location = url; else
		alert("\nYou must make a selection.");
}

// -------------------------------

function show(object) {
	if (document.getElementById && document.getElementById(object) != null)
		node = document.getElementById(object).style.visibility = 'visible';

	else if (document.layers && document.layers[object] != null)
		document.layers[object].visibility = 'visible';

	else if (document.all)
		document.all[object].style.visibility = 'visible';
}

// -------------------------------

function hide(object) {
	if (document.getElementById && document.getElementById(object) != null)
		node = document.getElementById(object).style.visibility = 'hidden';

	else if (document.layers && document.layers[object] != null)
		document.layers[object].visibility = 'hidden';

	else if (document.all)
		document.all[object].style.visibility = 'hidden';
}
	
function stripCharsInBag(s, bag) {
	var i;
	var returnString = "";

	// Search through string's characters one by one.
	// If character is not in bag, append to returnString.
	for (i = 0; i < s.length; i++)
		{
		var c = s.charAt(i);

		if (bag.indexOf(c) == -1)
			returnString += c;
		}
	return returnString;
}

// -----------------------------------------
function daysInFebruary (year) {
	// February has 29 days in any year evenly divisible by four,
	// EXCEPT for centurial years which are not also divisible by 400.
	return(((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28);
}

// -----------------------------------------
function DaysArray(n) {
	for (var i = 1; i <= n; i++)
		{
		this[i] = 31

		if (i == 4 || i == 6 || i == 9 || i == 11) {
			this[i] = 30
		}

		if (i == 2) {
			this[i] = 29
		}
		}
	return this
}

// -----------------------------------------
function isDate(dtStr) {
	var daysInMonth = DaysArray(12)
	var pos1 = dtStr.indexOf(dtCh)
	var pos2 = dtStr.indexOf(dtCh, pos1 + 1)
	// -----------------------------------------
	// SWITCH VAR TO OUTPUT 'dd/mm/yyyy'
	//var strDay=dtStr.substring(0,pos1)
	//var strMonth=dtStr.substring(pos1+1,pos2)
	// -----------------------------------------
	var strMonth = dtStr.substring(0, pos1)
	var strDay = dtStr.substring(pos1 + 1, pos2)
	var strYear = dtStr.substring(pos2 + 1)

	strYr = strYear

	if (strDay.charAt(0) == "0" && strDay.length > 1)
		strDay = strDay.substring(1)

	if (strMonth.charAt(0) == "0" && strMonth.length > 1)
		strMonth = strMonth.substring(1)

	for (var i = 1; i <= 3; i++)
		{
		if (strYr.charAt(0) == "0" && strYr.length > 1)
			strYr = strYr.substring(1)
		}

	month = parseInt(strMonth)
	day = parseInt(strDay)
	year = parseInt(strYr)

	if (pos1 == -1 || pos2 == -1) {
		// alert("The date format should be : mm/dd/yyyy")
		return false
	}

	if (strMonth.length < 1 || month < 1 || month > 12)	{
		alert("Please enter a valid month")
		return false
	}

	if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day > daysInFebruary(year))
		|| day > daysInMonth[month])	{
		alert("Please enter a valid day")
		return false
	}

	if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear) {
		//	alert("Please enter a valid 4 digit year from "+minYear+" or "+maxYear)
		return false
	}

	if (dtStr.indexOf(dtCh, pos2 + 1) != -1 || isInteger(stripCharsInBag(dtStr, dtCh)) == false) {
		//	alert("Please enter a valid date")
		return false
	}
	return true
}

// -----------------------------------------
// CREATED BY CW - 08/04/2004
function submitForm(object) {
	var strConfirm = '';
	var now = new Date();

	// ---------------------------------------------
	// *** 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) {
		strConfirm += 'Please enter your departure location' + '\n';
	}

	if (!document.TravelRequestForm.to.value) {
		strConfirm += 'Please select your destination location' + '\n';
	}

	// ---------------------------------------------
	// *** CHECK THAT DEP & ARR CITIES ARE DIFFERENT ***
	if (document.TravelRequestForm.from.value && document.TravelRequestForm.to.value)	{

		var Current = document.TravelRequestForm.to.selectedIndex;
		if (document.TravelRequestForm.from.value == document.TravelRequestForm.to.value
			|| document.TravelRequestForm.from.value == document.TravelRequestForm.to.options[Current].text) {
			strConfirm += 'Departing and Arrival cities must be different' + '\n';
		}
	}

	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */
	var depdate = document.TravelRequestForm.itineraryStartDate.value
	var retdate = document.TravelRequestForm.itineraryEndDate.value

	var pos = depdate.indexOf(dtCh, depdate.indexOf(dtCh) + 1)
	var strYear = depdate.substring(pos + 1)

	if (strYear.length == 2) {
		depdate = depdate.substring(0, pos) + '/20' + strYear
	}

	var pos = retdate.indexOf(dtCh, retdate.indexOf(dtCh) + 1)
	var strYear = retdate.substring(pos + 1)

	if (strYear.length == 2) {
		retdate = retdate.substring(0, pos) + '/20' + strYear
	}
	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */


	// --------------------------------------------
	if (!isDate(depdate)) {
		strConfirm += 'Departure Date is not filled in correctly' + '\n';
	}

	// ---------------------------------------------
	if (!isDate(retdate)) {
		strConfirm += 'Return Date is not filled in correctly' + '\n';
	}

	// ---------------------------------------------
	// *** ARE DEP & ARR DATES GREATER THAN TODAY? ***

	if (daysElapsed(depdate, today) <= 0) {
		strConfirm += 'Departure Date should be greater than today' + '\n';
	}

	if (daysElapsed(retdate, today) <= 0) {
		strConfirm += 'Return Date should be greater than today' + '\n';
	}
	// ---------------------------------------------
	// *** IS DEP DATE EARLIER THAN ARR DATE? ***
	// COMMENTED BY JOE - 11/02/2005
	
	// 09-0801 ATR: CHANGE <= TO < ONLY SINCE BOOKING OF RETURN DATE CAN BE SAME DAY
	if (daysElapsed(retdate, depdate) < 0) { 
		strConfirm += 'Return Date should be greater than the Departure Date' + '\n';
	// COMMENTED BY CW - 09/14/2004
	//			strConfirm += 'Departure Date should be greater than today' + '\n';
	}

	// ---------------------------------------------
	// *** ARE DEP & ARR DATES WITHIN 330 DAYS OF TODAY? ***
	if (daysElapsed(date_diff(today), depdate) < 0) {
		strConfirm += 'Please set the Departure Date within 330 days from today' + '\n';
	}

	if (daysElapsed(date_diff(today), retdate) < 0) {
		strConfirm += 'Please set the Return Date within 330 days from today' + '\n';
	}

	// ---------------------------------------------
	// *** FINAL CHECK ***
	if (strConfirm.length > 0) {
		alert(strConfirm);
	} else	{
		if (checkNumOfPassengers())	{
			/* 09-0307 ATR: CHANGE DATE IN FORM BEFORE SUBMITTING INTO GET2 */
			document.TravelRequestForm.itineraryStartDate.value = depdate
			document.TravelRequestForm.itineraryEndDate.value = retdate
			/* -------------------------------------------------------------*/
			document.TravelRequestForm.action = 'http://pts.get2hawaii.com/ots/Index.do';
			document.TravelRequestForm.submit();
		}
	}
}
	
// -----------------------------------------
// CREATED BY CW - 08/04/2004
function submitForm_HC(object) {
	var strConfirm='';
	var now = new Date();

	// ---------------------------------------------
	// *** 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);
	}

	if (!document.TravelRequestForm.to.value) {
		strConfirm += 'Please select an Destination' + '\n';
	}

	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */
	var depdate=document.TravelRequestForm.itineraryStartDate.value
	var retdate=document.TravelRequestForm.itineraryEndDate.value

	var pos=depdate.indexOf(dtCh,depdate.indexOf(dtCh)+1)
	var strYear=depdate.substring(pos+1)		
	if (strYear.length==2) { depdate=depdate.substring(0,pos)+'/20'+strYear }

	var pos=retdate.indexOf(dtCh,retdate.indexOf(dtCh)+1)
	var strYear=retdate.substring(pos+1)		
	if (strYear.length==2) { retdate=retdate.substring(0,pos)+'/20'+strYear }
	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */

	// --------------------------------------------
	if (!isDate(depdate)) {
		strConfirm += 'Departure Date is not filled in correctly' + '\n';
		} 
	// ---------------------------------------------
	if (!isDate(retdate)) {	
		strConfirm += 'Return Date is not filled in correctly' + '\n';
	}
	
	// ---------------------------------------------
	// *** ARE DEP & ARR DATES GREATER THAN TODAY? ***
	if (daysElapsed(depdate, today)<=0) {
		strConfirm += 'Departure Date should be greater than today' + '\n';
	}

	if (daysElapsed(retdate, today)<=0) {
		strConfirm += 'Return Date should be greater than today' + '\n';
		
	}
	// ---------------------------------------------
	// *** ARE DEP & ARR DATES WITHIN 330 DAYS OF TODAY? ***
	if (daysElapsed(date_diff(today), depdate)<0) {
		strConfirm += 'Please set the Departure Date within 330 days from today' + '\n';
	}

	if (daysElapsed(date_diff(today), retdate)<0) {
		strConfirm += 'Please set the Return Date within 330 days from today' + '\n';
	}
	// ---------------------------------------------
	// *** FINAL CHECK ***
	if (strConfirm.length > 0) {
		alert(strConfirm);
	} else {
		if (checkNumOfPassengers()) {
			/* 09-0307 ATR: CHANGE DATE IN FORM BEFORE SUBMITTING INTO GET2 */
			document.TravelRequestForm.itineraryStartDate.value=depdate
			document.TravelRequestForm.itineraryEndDate.value=retdate
			/* -------------------------------------------------------------*/			
			document.TravelRequestForm.action='http://pts.get2hawaii.com/ots/Index.do';
			document.TravelRequestForm.submit();
		}
	}
}


function submitForm_AO(object) {
	var strConfirm='';
	var now = new Date();

	// ---------------------------------------------
	// *** 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 ***
	
	//*** COMMENTED NEW JOE
//	if (!document.TravelRequestForm.from.value && (eval("document.TravelRequestForm.typeOfPackage[4].checked")==false)) {
	if (!document.TravelRequestForm.from.value) {
		strConfirm += 'Please enter your departure location' + '\n';
	}

	if (!document.TravelRequestForm.to.value) {
		strConfirm += 'Please enter your destination location' + '\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 += 'Departure location and Destination location must be different' + '\n';
	}

	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */
	var depdate=document.TravelRequestForm.itineraryStartDate.value
	var retdate=document.TravelRequestForm.itineraryEndDate.value

	var pos=depdate.indexOf(dtCh,depdate.indexOf(dtCh)+1)
	var strYear=depdate.substring(pos+1)		
	if (strYear.length==2) { depdate=depdate.substring(0,pos)+'/20'+strYear }

	var pos=retdate.indexOf(dtCh,retdate.indexOf(dtCh)+1)
	var strYear=retdate.substring(pos+1)		
	if (strYear.length==2) { retdate=retdate.substring(0,pos)+'/20'+strYear }
	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */
	

	// --------------------------------------------
	if (!isDate(depdate)) {
		strConfirm += 'Departure Date is not filled in correctly' + '\n';
		} 
	// ---------------------------------------------
	if (!isDate(retdate)) {	
		strConfirm += 'Return Date is not filled in correctly' + '\n';
	}
	// ---------------------------------------------
	// *** ARE DEP & ARR DATES GREATER THAN TODAY? ***
	if (daysElapsed(depdate, today)<=0) {
		strConfirm += 'Departure Date should be greater than today' + '\n';
	}

	if (daysElapsed(retdate, today)<=0) {
		strConfirm += 'Return Date should be greater than today' + '\n';
	}

	// ---------------------------------------------
	// *** IF DEP DATE AND ARR DATE SAME? CHECK TIME ***		

	if (daysElapsed(depdate, today) == daysElapsed(retdate, today)
		&& (document.TravelRequestForm.departureTime.value==document.TravelRequestForm.returnTime.value)) {			
		strConfirm += 'Return time must be after departure time' + '\n';
	}	
	// ---------------------------------------------
	// *** ARE DEP & ARR DATES WITHIN 330 DAYS OF TODAY? ***
	if (daysElapsed(date_diff(today), depdate)<0) {
		strConfirm += 'Please set the Departure Date within 330 days from today' + '\n';
	}

	if (daysElapsed(date_diff(today), retdate)<0) {
		strConfirm += 'Please set the Return Date within 330 days from today' + '\n';
	}
	// ---------------------------------------------
	// *** FINAL CHECK ***
	if (strConfirm.length > 0) {
		alert(strConfirm);
		
	} else {

	if (checkNumOfPassengers()) {
			/* 09-0307 ATR: CHANGE DATE IN FORM BEFORE SUBMITTING INTO GET2 */
			document.TravelRequestForm.itineraryStartDate.value=depdate
			document.TravelRequestForm.itineraryEndDate.value=retdate
			/* -------------------------------------------------------------*/		
			document.TravelRequestForm.action='http://pts.get2hawaii.com/ots/Index.do';	
			document.TravelRequestForm.submit();
		}
	}
}

function submitForm_AOI(object) {
	var strConfirm='';
	var now = new Date();

	// ---------------------------------------------
	// *** 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 ***
	
	//*** COMMENTED NEW JOE
//	if (!document.TravelRequestForm.from.value && (eval("document.TravelRequestForm.typeOfPackage[4].checked")==false)) {
	if (!document.TravelRequestForm.from.value) {
		strConfirm += 'Please enter your departure location' + '\n';
	}

	if (!document.TravelRequestForm.to.value) {
		strConfirm += 'Please enter your destination location' + '\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 += 'Departure location and Destination location must be different' + '\n';
	}

	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */
	var depdate=document.TravelRequestForm.itineraryStartDate.value
	var retdate=document.TravelRequestForm.itineraryEndDate.value

	var pos=depdate.indexOf(dtCh,depdate.indexOf(dtCh)+1)
	var strYear=depdate.substring(pos+1)		
	if (strYear.length==2) { depdate=depdate.substring(0,pos)+'/20'+strYear }

	var pos=retdate.indexOf(dtCh,retdate.indexOf(dtCh)+1)
	var strYear=retdate.substring(pos+1)		
	if (strYear.length==2) { retdate=retdate.substring(0,pos)+'/20'+strYear }
	/* 09-0306 ATR: CHANGE SHORT YEAR TO LONG YEAR (09 TO 2009) */
	

	// --------------------------------------------
	if (!isDate(depdate)) {
		strConfirm += 'Departure Date is not filled in correctly' + '\n';
		} 
	// ---------------------------------------------
	if (!isDate(retdate)) {	
		strConfirm += 'Return Date is not filled in correctly' + '\n';
	}
	// ---------------------------------------------
	// *** ARE DEP & ARR DATES GREATER THAN TODAY? ***
	if (daysElapsed(depdate, today)<=0) {
		strConfirm += 'Departure Date should be greater than today' + '\n';
	}

	if (daysElapsed(retdate, today)<=0) {
		strConfirm += 'Return Date should be greater than today' + '\n';
	}

	// ---------------------------------------------
	// *** IF DEP DATE AND ARR DATE SAME? CHECK TIME ***		

	if (daysElapsed(depdate, today) == daysElapsed(retdate, today)
		&& (document.TravelRequestForm.departureTime.value==document.TravelRequestForm.returnTime.value)) {			
		strConfirm += 'Return time must be after departure time' + '\n';
	}	
	// ---------------------------------------------
	// *** ARE DEP & ARR DATES WITHIN 330 DAYS OF TODAY? ***
	if (daysElapsed(date_diff(today), depdate)<0) {
		strConfirm += 'Please set the Departure Date within 330 days from today' + '\n';
	}

	if (daysElapsed(date_diff(today), retdate)<0) {
		strConfirm += 'Please set the Return Date within 330 days from today' + '\n';
	}
	// ---------------------------------------------
	// *** FINAL CHECK ***
	if (strConfirm.length > 0) {
		alert(strConfirm);
		
	} else {

	if (checkNumOfPassengers()) {
			/* 09-0307 ATR: CHANGE DATE IN FORM BEFORE SUBMITTING INTO GET2 */
			document.TravelRequestForm.itineraryStartDate.value=depdate
			document.TravelRequestForm.itineraryEndDate.value=retdate
			/* -------------------------------------------------------------*/		
			document.TravelRequestForm.action='http://pts.get2hawaii.com/ots/Index.do';	
			document.TravelRequestForm.submit();
		}
	}
}
	
function submitFormActivities(){
	if(document.TravelRequestForm.activityRegionId.value==""){alert("Please select a destination.");return ;}
	
	if (document.TravelRequestForm.submitAction) document.TravelRequestForm.submitAction.value="";
  if (document.TravelRequestForm.currentDestination) document.TravelRequestForm.currentDestination.value=0;
  if (document.TravelRequestForm.currentComponent) document.TravelRequestForm.currentComponent.value="";
    validateAndSubmit();
	}
	
	
function validateAndSubmit(){
	if (isMultiCity() ){
				 if ( dateCheckerMultiCity() && discountChecker()&& checkNumOfPassengers() ){
							document.TravelRequestForm.submit();
					} else {
							return false;
					}
	} else {
			if (checkFromToBeforeSubmit() &&
					regionIslandChecker() &&
					checkNumOfPassengers() &&
					dateChecker() &&
					discountChecker())
					{
							document.TravelRequestForm.action="http://pts.get2hawaii.com/ots/Index.do?agID="+document.TravelRequestForm.agID.value+"&idxRedirect=SearchActivities.do";
							document.TravelRequestForm.submit();
					} else {
							return false;
					}
			}				
}
    
    
function checkFromToBeforeSubmit(){
	if (includesAir()){
			if ("" ==  document.TravelRequestForm.from0.value ||
			( document.TravelRequestForm.from0.value.length == 1 && document.TravelRequestForm.from0.value.charAt(0) == " " )) {
						alert('Please provide your departure location.');
						return false;
				}
			if ("" ==  document.TravelRequestForm.to0.value ||
			( document.TravelRequestForm.to0.value.length == 1 && document.TravelRequestForm.to0.value.charAt(0) == " " )) {
						alert('Please provide your destination location.');
						return false;
				}
	}
	return true;
}
	
function regionIslandChecker() {
	if(includesHotel()){
		if(document.TravelRequestForm.region) {
	    		var SelectedIsland  = document.TravelRequestForm.to0.value;
    			var SelectedRegion = document.TravelRequestForm.region.options[document.TravelRequestForm.region.selectedIndex].value;
    			if (SelectedIsland == "") {
				    alert('Please select a Destination and Region before submitting the Travel Package Request.');
				    return false;
    			}
    			if (SelectedRegion == "") {
				    alert('Please select a Region before submitting the Travel Package Request.');
				    return false;
    			}
		}
  	}
    return true;
}

function dateChecker() {
    var dtStart = null;
    var dtEnd = null;
    //check invalid date first
    if (chkdate(document.TravelRequestForm.itineraryStartDate)) {
        dtStart = new Date(getDateStr(document.TravelRequestForm.itineraryStartDate.value));
    }
    else {
        alert('Please enter a valid departure date.');
        return false;
    }
    if (chkdate(document.TravelRequestForm.itineraryEndDate)) { //check end date
        dtEnd = new Date( getDateStr(document.TravelRequestForm.itineraryEndDate.value));
    }
    else {
        alert('Please enter a valid return date.');
        return false;
    }
 
    if (isNaN(dtStart)){
        if ( includesAir() ){
            alert('Please enter a valid departure date.');
        }
		else if (includesHotel() ){
            alert('Please enter a valid check-in date for your hotel.');
        }
		else if(includesCar()) {
            alert('Please enter a valid pick-up date for your car.');
        }
		else {
			alert('Please enter a valid date in the From field.');
		}
        return false;
    }
    if (isOneWay() == false && isNaN(dtEnd)){
        if ( includesAir() ){
            alert('Please enter a valid return date.');
        }
		else if (includesHotel() ){
            alert('Please enter a valid check-out date for your hotel.');
        }
		else if(includesCar()) {
            alert('Please enter a valid drop-off date for your car.');
        }
		else {
			alert('Please enter a valid date in the To field.');
		}
        return false;
    }
    if (isOneWay() && (includesHotel() || includesCar()) && isNaN(dtEnd)){
        if (includesHotel() ){
            alert('Please enter a valid check-out date for your hotel.');
        }
        else if(includesCar()) {
            alert('Please enter a valid drop-off date for your car.');
        }
        else {
            alert('Please enter a valid date in the To field.');
        }
        return false;
    }
    if(isOneWay() == false && dtEnd < dtStart){
        if ( includesAir() ){
            alert('Return date must be after departure date.');
        }
		else if (includesHotel() ){
            alert('Check-out date must be after check-in date.');
        }
		else if(includesCar()){
            alert('Drop-off date must be after pick-up date.');
        }
		else {
			alert('The "To" date must be after the "From" date.');
		}
        return false;
   }
    if (isOneWay() && (includesHotel() || includesCar()) && dtEnd < dtStart){
        if (includesHotel() ){
            alert('The hotel check-out date must be after the inbound flight departure date.');
        }
        else if(includesCar()){
            alert('The car drop-off date must be after the inbound flight departure date.');
        }
        else {
            alert('The "To" date must be after the "From" date.');
        }
        return false;
    }
   return true;
}


function discountChecker(){
	if (includesHotel() &&
        document.TravelRequestForm.localDiscount[0].checked=="0" &&
        document.TravelRequestForm.localDiscount[1].checked=="0")
			{
				alert('Please specify if the primary traveler is a Hawaii resident.');
				return false;
			}
	return true;
}