<!--
//*******************************************
//* Validation and general DHTML functions  *
//* FlightFinderStep1.js					*
//* June 2003								*
//* By Chris Creevy							*
//*******************************************

strDefaultAirport = ""
bitWarnOnce = false

//***********************************************************************************************
//* Description:																				* 
//* This function  sniffs out form elements and forces them to repopulate from the array		*
//* arrQuery which is populated from an ASP variable containing the form data in a string from	*
//* the database.																				*
//***********************************************************************************************


function PrePopulateFields(intPass)	{

	if ((myQuery != ""))	{
	
		arrQuery = myQuery.split("|")

		if (intPass == 1)	{
			intTmpDD = 0
			intTmpMM = 0 
			intTmpYYYY = 0	
			for (intFieldCount = 0; intFieldCount<arrQuery.length; intFieldCount++)	{
				arrQueryField = arrQuery[intFieldCount].split("=")
				strFieldname = arrQueryField[0]
				strFieldValue = arrQueryField[1]
							
				if (strFieldname == "depart_date_MM")	{	intTmpMM = strFieldValue	}	
				if (strFieldname == "depart_date_DD")	{	intTmpDD = strFieldValue	}
				if (strFieldname == "depart_date_YYYY")	{	intTmpYYYY = strFieldValue	}
			}
		}
		
		myForm = document.forms["Step1"]
		myElements = myForm.elements
		
		for (intInpCount=0; intInpCount<myElements.length; intInpCount++)	{
		
			if (myElements[intInpCount]) {
			
				myElement = myElements[intInpCount]
				myElementName = myElement.name
				myElementType = myElement.type
							
				for (intFieldCount = 0; intFieldCount<arrQuery.length; intFieldCount++)	{
					arrQueryField = arrQuery[intFieldCount].split("=")
					strFieldname = arrQueryField[0]
					strFieldValue = arrQueryField[1]
					
					//alert(strFieldname)
					if (myElementName == strFieldname)	{
					
						if (intPass == 2)	{
							//alert("2nd!")
							switch (myElementType)	{
								case "select-one": { 
									//alert(myElementName)
									for(intOpt = 0; intOpt<myElement.options.length; intOpt++)	{
										if ((myElement.options[intOpt].value == strFieldValue)) {
											myElement.selectedIndex = intOpt
											break;
										}

									}
								
									if (myElementName == "destination_country")	{
										populateSelect('destination_country',myElement.value)
									}
			
									if (myElementName == "destination_airport")	{
										strDefaultAirport = strFieldValue
									}
									break
								}
								case "text": { 
									myElement.value = strFieldValue;
									break;
								} 
							}
						} else	{
							//alert("1st!")
							switch (myElementType)	{
								
								case "radio": { 
									//alert("Radio: " + myElementName)
									if (myElement.value == strFieldValue)	{
										myElement.checked = true
									}
									break;
								} 
							
								case "checkbox": {
									if (myElement.value == strFieldValue)	{
										myElement.checked = true
									}
									break;
								}
							
							}
						}				
					}
				}
			} //if element existed end
		}
	}
	
}



function populateSelect(strMySelect,strCountry)	{
	if (strCountry != '')	{
		var myIFrame = document.getElementById("Gofa");
		myIFrame.src = './FlightFinderGofa.asp?mySelect=' + strMySelect + '&Country=' + strCountry
	} else {
		clearSelect()
		populate("","--Select Airport--")	
	}
}

function storeDestAirport(intTmpDestAir,intTmpDestCountry)	{
	//** Record selectedindex of the destination_airport to re-populate
	//** destination fields accordingly if the user leaves and returns to the page via the back button
	document.Step1.FEdestination_airport.value = intTmpDestAir
	
	//** Populate destination for front end purposes **/	
	objDestinationAirport = document.Step1.destination_airport
	objDestination = document.Step1.destination_country
	document.Step1.FEdestination.value = objDestinationAirport.options[intTmpDestAir].text //+ " (" + objDestination.options[intTmpDestCountry].text + ")"
	/**************************************************/
}

function populate(strTxt,strOpt)	{
	//alert(strDefaultAirport)
	strMyElement = document.Step1.destination_airport
	strMyElement.options[i] = new Option(strOpt,strTxt);
	if (strTxt == strDefaultAirport)	{
		strMyElement.options[i].selected = true
	}
	i++
}

function clearSelect()	{
	document.Step1.FEdestination_airport.value = ''
	strMyElement = document.Step1.destination_airport
	while (strMyElement.options.length) strMyElement.options[0] = null;
	i = 0
}

function hideShow(strLayer)	{
	myLayer = document.getElementById(strLayer)
	if (strLayer == 'Layer1') {
		myLayer.style.visibility = 'visible'
		document.getElementById('Layer2').style.visibility = 'hidden'
	} else {
		myLayer.style.visibility = 'visible'
		document.getElementById('Layer1').style.visibility = 'hidden'
	}
}


function changeReturn()
{
	if (document.Step1.return_option[1].checked)
	{
		// Set return date to after the departure date.
		var returnDate = new Date(parseInt(document.Step1.depart_date_YYYY.value, 10), parseInt(document.Step1.depart_date_MM.value, 10)-1, parseInt(document.Step1.depart_date_DD.value, 10) + 7);
		if (returnDate != "NaN")
		{
			document.Step1.return_date_DD.selectedIndex = returnDate.getDate();
			document.Step1.return_date_MM.selectedIndex = returnDate.getMonth() + 1;
			document.Step1.return_date_YYYY.value = returnDate.getFullYear();
			//document.Step1.return_date_YYYY.value = returnDate.getYear();
		}
		

		if( document.Step1.return_time.value != 0 )
		{
			document.Step1.return_time.selectedIndex = 1;
		}
		document.getElementById("secReturnDetails").style.display = "block";

		if (myQuery != "" && bitWarnOnce == false)
		{
			intNewDD = document.Step1.depart_date_DD;
			intNewMM = document.Step1.depart_date_MM;
			intNewYYYY = document.Step1.depart_date_YYYY;

			if (intTmpDD != intNewDD.options[intNewDD.selectedIndex].value || intTmpMM != intNewMM.options[intNewMM.selectedIndex].value || intTmpYYYY != intNewYYYY.options[intNewYYYY.selectedIndex].value)
			{
				alert("You have chosen to amend your departure date, please confirm \n that your return date is correct before proceeding.");
				bitWarnOnce = true;
				document.Step1.return_date_DD.focus();
			}
		}
	}
}

// WR #1419 - Simon Dean - 2005-05-20 
// gets the number of days in the selected month
function returnNumOfDays(intTmpMM, intTmpYYYY)	
{
	// get current year
	var year = parseInt(intTmpYYYY.options[intTmpYYYY.selectedIndex].value);
	// get current month
	var month = parseInt(intTmpMM.selectedIndex) - 1;

	return returnNumOfDays2(year, month);
}

// WR #1419 - Simon Dean - 2005-05-20 
// gets the number of days in the specified month
function returnNumOfDays2(year, month)	
{
	// new method of calculating the number of days in the month.  
	// needed for Mac Opera 
	
	var date = new Date();
	// get the last day of current month
	date.setFullYear(year, month + 1, 0);
	
	// get number of last day in month
	return date.getDate();
}

function checkDate(strDateType)	{
	eval("intTmpDD = document.Step1." + strDateType + "_date_DD")
	eval("intTmpMM = document.Step1." + strDateType + "_date_MM")
	eval("intTmpYYYY = document.Step1." + strDateType + "_date_YYYY")
	
	intNumOfDays = returnNumOfDays(intTmpMM,intTmpYYYY)
	
	if (intTmpDD.options[intTmpDD.selectedIndex].text > intNumOfDays)	{
		intTmpDD.selectedIndex = intNumOfDays
	}
}

function showReturn(strValue)	{
	intDepartDD = document.Step1.depart_date_DD
	intDepartMM = document.Step1.depart_date_MM
	intDepartYYYY = document.Step1.depart_date_YYYY
		
	intReturnDD = document.Step1.return_date_DD
	intReturnMM = document.Step1.return_date_MM
	intReturnYYYY = document.Step1.return_date_YYYY
	
	intNumOfDays = returnNumOfDays(intDepartMM,intDepartYYYY)
	secDisplay = document.getElementById("secReturnDetails")
	if (strValue == 2) {
		if (intDepartDD.options[intDepartDD.selectedIndex].value >= intNumOfDays && intDepartMM.options[intDepartMM.selectedIndex].text == "12")	{
			if (intDepartYYYY.selectedIndex != intDepartYYYY.options.length-1)	{
				intReturnDD.selectedIndex = 1
				intReturnMM.selectedIndex = 1
				intReturnYYYY.selectedIndex = intDepartYYYY.selectedIndex+1
			}
		}
		else if (intDepartDD.options[intDepartDD.selectedIndex].value >= intNumOfDays)	{
			intDepartDD.selectedIndex = intNumOfDays
			intReturnDD.selectedIndex = 1
			intReturnMM.selectedIndex = intDepartMM.selectedIndex+1
			intReturnYYYY.selectedIndex = intDepartYYYY.selectedIndex
		} else	{
			intReturnDD.selectedIndex = intDepartDD.selectedIndex+1
			intReturnMM.selectedIndex = intDepartMM.selectedIndex
			intReturnYYYY.selectedIndex = intDepartYYYY.selectedIndex
		}
		
		if( document.Step1.return_time.value != 0 )
		{
			document.Step1.return_time.selectedIndex = 1;
		}
		secDisplay.style.display = 'block'
		
	}
	if (strValue == 1) {
		document.Step1.return_date_DD.selectedIndex = 0
		document.Step1.return_date_MM.selectedIndex = 0
		document.Step1.return_date_YYYY.selectedIndex = 0
		if( document.Step1.return_time.value != 0 )
		{
			document.Step1.return_time.selectedIndex = 0;
		}
		document.Step1.number_nights.value = ''
		secDisplay.style.display = 'none'
	}
}

function activatePassengers(intParamValue)	{
	intCount = 0
	eval("strPassengerTable = document.getElementById('secPassenger');")		
	eval("strPassengerHeading = document.getElementById('passengerHeading');")		
	intWidth = strPassengerTable.offsetWidth
			
	do {
		if (intParamValue > 1)	{
				intPassengerColumns = intWidth/4 + "px"
			} else {
				intPassengerColumns = intWidth/2 + "px"
			}
		myPassengerTxt = eval("document.getElementById('passengerTxt" + (parseInt(intCount) + 1) + "');")
		myPassengerInp = eval("document.getElementById('passengerInp" + (parseInt(intCount) + 1) + "');")
		if ((parseInt(intCount) + 1) < intParamValue || intParamValue == (parseInt(intCount) + 1))	{
			myPassengerTxt.style.display = 'block'
			myPassengerInp.style.display = 'block'	
							
		} else {
			myPassengerTxt.style.display = 'none'
			myPassengerInp.style.display = 'none'
			
			strCount = (intCount+1).toString()
			if (strCount.length == 1)	{
				eval("document.Step1.passenger_0" + strCount + "_age.value = ''")
			} else {
				eval("document.Step1.passenger_" + strCount + "_age.value = ''")
			}
		}
		
		myPassengerTxt.offsetWidth
		myPassengerInp.offsetWidth
		
		intCount++
	} while(intCount < 9)
	
	if (intParamValue == '')	{
		strPassengerHeading.style.display = 'none'
		strPassengerTable.style.display = 'none'
	} else {
		strMyText = ""
		if (intParamValue == 1)	{
			strMyText = "<span class='Question'>Please enter your age</span>"
		} else if (intParamValue == 2) {
			strMyText = "<span class='Question'>Please give the age of you and the person traveling with you.</span>"
		} else {
			strMyText = "<span class='Question'>Please enter the ages of the passengers traveling in your party</span>"
		}
	
		strPassengerHeading.innerHTML = strMyText
		strPassengerHeading.style.display = 'block'
		strPassengerTable.style.display = 'block'
	}
}
	
function showReturnCalendar()	{
	intMonthStart = document.Step1.depart_date_MM.selectedIndex
	intYearStart = document.Step1.depart_date_YYYY.selectedIndex-1
	//alert(intYearStart)
	myPopup('../Calendar/Calendar.asp?For=return&DepartMonth=' + intMonthStart + "&DepartYear=" + intYearStart,'calendarWin',220,210,'no','no');
}

function doThisFirst()	{
	//*** Get status of various buttons
			
	intMonthStart = document.Step1.depart_date_MM.selectedIndex
	intYearStart = document.Step1.depart_date_YYYY.value
	PrePopulateFields(1)
		
	objJourneyType = document.Step1.return_option
	objNumPassenegers = document.Step1.number_passengers
	
	if (objJourneyType[1].checked)	{
		document.getElementById('secReturnDetails').style.display = 'block';
	} else {
		document.getElementById('secReturnDetails').style.display = 'none';
	}
	
	//strCountry = document.Step1.destination_country.value
	//populateSelect("destination_airport",strCountry)
		
	if (objJourneyType[1].checked == true)	{
		//document.getElementById('secReturnDetails').style.display = 'block';
		//alert("ONE WAY!")
		showReturn(2)
		PrePopulateFields(2)
	} else {
		//document.getElementById('secReturnDetails').style.display = 'none';
		showReturn(1)
		PrePopulateFields(2)
	}
	
	if (objNumPassenegers.selectedIndex != 0)	{
		document.getElementById('secPassenger').style.display = 'block';
		activatePassengers(objNumPassenegers.value)
	} else	{
		document.getElementById('secPassenger').style.display = 'none';
	}

	// Detect Bestbuy from querystring	
	if (intQSCountry != "" && myQuery == "")	{
		populateSelect('destination_country',intQSCountry)
		strDefaultAirport = intQSCode
	}
}

function isLeapYear(intTmpYear) {
    return (intTmpYear % 4 == 0) && 
           ((intTmpYear % 100 != 0) || (intTmpYear % 400 == 0));
  }


function addDays(myDate,myComparison) 
{
	if (myComparison == '')	{
		eval("currentDate = '" + mmServer + "/" + ddServer + "/" + yyServer + "'")
		var now = new Date(currentDate);
		
	} else {
		var now = new Date(myComparison);
	}
	//var then = new Date(myDate.getTime() 
	var intDiff = myDate.getTime() - now.getTime(  );
	return(Math.floor(intDiff / (1000 * 60 * 60 * 24)))
}


//*******************************************************
//* Validation and final pre-population					*
//*														*
//*******************************************************

function submitStepOne()	{
	if (document.Step1.FEdirect_option.checked)	{
		document.Step1.direct_option.value = 1
	} else {
		document.Step1.direct_option.value = 2		
	}
	
	objJourneyType = document.Step1.return_option
	
	intDepartDateDD = document.Step1.depart_date_DD
	intDepartDateMM = document.Step1.depart_date_MM
	intDepartDateYYYY = document.Step1.depart_date_YYYY
	intDepDaysMonth = returnNumOfDays(intDepartDateMM,intDepartDateYYYY)
	intDepartDateYYYY =	intDepartDateYYYY.options[intDepartDateYYYY.selectedIndex].value
	objSelCountry = document.Step1.destination_country
		
	var outGoing = new Date()
	outGoing.setMonth(intDepartDateMM.options[intDepartDateMM.selectedIndex].value-1)
	outGoing.setDate(intDepartDateDD.options[intDepartDateDD.selectedIndex].value)
	outGoing.setYear(intDepartDateYYYY.toString())
	outGoing.setHours("23")
	outGoing.setMinutes("58")
	outGoing.setSeconds("0")
	
	intOutgoingCheck = (addDays(outGoing,''))			// Calculate amount of days from present date
	//intDepartVal = document.Step1.depart_time.options[document.Step1.depart_time.selectedIndex].value
	intDepartVal = document.Step1.depart_time.value;
	
	if (objJourneyType[1].checked)	{
		intReturnDateDD = document.Step1.return_date_DD
		intReturnDateMM = document.Step1.return_date_MM
		intReturnDateYYYY = document.Step1.return_date_YYYY
		intReturnDateYYYY =	intReturnDateYYYY.options[intReturnDateYYYY.selectedIndex].value
		
		var inComing = new Date()
		inComing.setMonth(intReturnDateMM.options[intReturnDateMM.selectedIndex].value-1)
		inComing.setDate(intReturnDateDD.options[intReturnDateDD.selectedIndex].value)
		inComing.setYear(intReturnDateYYYY.toString())
		
		inComing.setHours("23")
		inComing.setMinutes("59")
		inComing.setSeconds("0")
		
		intIncomingCheck = (addDays(inComing,''))			// Calculate amount of days from present date
		intInOutCheck = (addDays(inComing,outGoing))		// Calculate amount of days between outgoing/incoming flight
		//intReturnVal = document.Step1.return_time.options[document.Step1.return_time.selectedIndex].value
		intReturnVal = document.Step1.return_time.value
	}
	
	storeDestAirport(document.Step1.destination_airport.selectedIndex,document.Step1.destination_country.selectedIndex)
	strDestination = document.Step1.FEdestination
	objNumOfPassengers = document.Step1.number_passengers
	
	var selectedDepartureAirportCount = 0;
			
	for (var intAirportCount=1; intAirportCount<=departureAirportCount; intAirportCount++)	
	{
		eval("selectedDepartureAirportCount += (document.Step1.depart_airport_" + intAirportCount + ".selectedIndex > 0) ? 1 : 0;")
	}

	if (selectedDepartureAirportCount == 0)
	{
		alert("You must select at least one airport for your first choice.")
		document.Step1.depart_airport_1.focus()
		return false;
	}
	
	//**** Compare chosen departure airports to avoid duplicates ******	
	for (var intAirportCount=1; intAirportCount<=departureAirportCount; intAirportCount++)	{
		eval("myAirport = document.Step1.depart_airport_" + intAirportCount + ".selectedIndex")
		for (var intCompareCount=1; intCompareCount<=departureAirportCount; intCompareCount++)	{
			eval("myAirportCompare = document.Step1.depart_airport_" + intCompareCount)
			if (intAirportCount != intCompareCount)	{
				if (myAirport == myAirportCompare.selectedIndex && myAirport != 0) {  
					alert("The airport you have chosen for departure airport " + intCompareCount + "\nis the same as departure airport " + intAirportCount + "\n\nPlease select again.") 
					myAirportCompare.focus()
					return false;
				}
				
				if (strDestination.value != "" && strDestination.value == myAirportCompare.options[myAirportCompare.selectedIndex].text)	{
					alert("Your destination airport cannot be the same as your departure airport.") 
					document.Step1.destination_airport.focus()
					return false;
				}
			}
		}
	}
	
	if (document.Step1.destination_country.selectedIndex == 0)	{
		alert("Please select a destination country from the list.")
		document.Step1.destination_country.focus()
		return false;
	}
	
	if (document.Step1.destination_airport.selectedIndex == 0)	{
		alert("Please select a destination airport from the list.")
		document.Step1.destination_airport.focus()
		return false;
	}
	
	if (!(objJourneyType[0].checked) && !(objJourneyType[1].checked))	{
		alert("Please select your journey type.")
		objJourneyType[0].focus()
		return false;
	}
	
	if (intDepartDateDD.selectedIndex == 0)	{
		alert("You must select a day for your departure date.")
		intDepartDD.focus()
		return false;
	}

	if (intDepartDateMM.selectedIndex == 0)	{
		alert("You must select a month for your departure date.")
		intDepartMM.focus()
		return false;
	}
	
	if (intDepartDateYYYY.selectedIndex == 0)	{
		alert("You must select a year for your departure date.")
		intDepartYYYY.focus()
		return false;
	}
	
	if (intOutgoingCheck < 0 || intDepartDateDD.selectedIndex > intDepDaysMonth)	{
		alert("The date you have entered is invalid.\n Please check and amend accordingly.")
		document.Step1.depart_date_DD.focus()
		return false;
	}
	
	if ((!isLeapYear(yyServer) && intOutgoingCheck > 365) || (isLeapYear(yyServer) && intOutgoingCheck > 366))	{
		alert("Your departure date must be within the next 12 months.")
		document.Step1.depart_date_DD.focus()
		return false;
	}
		
	if (objJourneyType[1].checked)	{
		if (intReturnDateDD.selectedIndex == 0)	{
			alert("You must select a day for your return date.")
			intReturnDateDD.focus()
			return false;
		}

		if (intReturnDateMM.selectedIndex == 0)	{
			alert("You must select a month for your return date.")
			intReturnDateMM.focus()
			return false;
		}
	
		if (intReturnDateYYYY.selectedIndex == 0)	{
			alert("You must select a year for your return date.")
			intReturnDateYYYY.focus()
			return false;
		}
		
		if ((!isLeapYear(yyServer) && intIncomingCheck > 365) || (isLeapYear(yyServer) && intIncomingCheck > 366))	{
			alert("Your return date must be within the next 12 months.")
			document.Step1.return_date_DD.focus()
			return false;
		}

		//*** TEMP FIX ***//
		
		dteOutgoing = intDepartDateYYYY + "" + intDepartDateMM.options[intDepartDateMM.selectedIndex].value + "" + intDepartDateDD.options[intDepartDateDD.selectedIndex].value
		dteIncoming = intReturnDateYYYY + "" + intReturnDateMM.options[intReturnDateMM.selectedIndex].value + "" + intReturnDateDD.options[intReturnDateDD.selectedIndex].value

		tmpmmServer = "" + mmServer
		if (tmpmmServer.length != 2)	{
			tmpmmServer = "0" + tmpmmServer
		}
		
		dteToday = yyServer + "" + tmpmmServer + "" + ddServer
		
		intNewInOut = parseInt(dteIncoming - dteOutgoing)
		intNewIn = parseInt(dteIncoming - dteToday)
				
	
		if (intNewIn < 0)	{
			alert("Your return flight must be a valid date.")
			document.Step1.return_date_DD.focus()
			return false
		} 
	

		if (intNewInOut < 0)	{
			alert("Your return flight date cannot be before your departure date.")
			document.Step1.return_date_DD.focus()
			return false;
		}
		//*******************//

		if (document.Step1.return_time.value == "")	{
			alert("Please select the departure time for your return flight.")
			document.Step1.return_time.focus()
			return false;
		}
		
		if (intInOutCheck == 0 && intReturnVal < intDepartVal)	{
			alert("If you are departing and returning on the same day,\n your return time cannot be before the departure time.")
			document.Step1.return_time.focus()
			return false;
		}


		
		intNumNights = document.Step1.number_nights
		
		//if (intNumNights.value == '')	{
			intNumNights.value = intInOutCheck
		//}
		
		if (intNumNights.value < parseInt(intInOutCheck-1) || intNumNights.value > intInOutCheck)	{
			alert("The number of nights you are away must be a valid figure.")
			intNumNights.focus()
			return false
		}
	}
	
	if (objNumOfPassengers.selectedIndex == 0)	{
		alert("Please select the number of passengers who will be traveling")
		objNumOfPassengers.focus()
		return false;
	}
	
	// ****** Pass country into hidden field value for ad targeting ********* //
	strCountry = objSelCountry.options[objSelCountry.selectedIndex].text
	document.Step1.FEcountry.value = strCountry
	//*********************************************************************** //	

	//************************ Passenger logic ****************************** //
	
	intInfant = 0	// less than 2 years old
	intChild = 0	// between 2 to 11 years
	intAdult = 0	// 12 years and above
	
	if (objNumOfPassengers.selectedIndex != 0)	{
		for (var intPassCount=0; intPassCount<objNumOfPassengers.value; intPassCount++)	{
			strPassCount = (intPassCount+1).toString()
			if (strPassCount.length == 2)	{
				eval("myPassenger = document.Step1.passenger_" + (intPassCount+1) +	"_age")
			} else {
				eval("myPassenger = document.Step1.passenger_0" + (intPassCount+1) +	"_age")
			}	
			
			if (myPassenger.value == 0)	{
				alert("The age entered for passenger " + (intPassCount+1) + " is invalid.")
				myPassenger.focus()
				return false;
			
			}
			
			if (!isFieldValidAndFocus(myPassenger, 'numeric', true, true, 'Passenger ' + parseInt(intPassCount + 1)))	{	
				return false;
			}

			if (myPassenger.value < 2)	{	
				intInfant++	
			}	else if (myPassenger.value > 1 && myPassenger.value < 12)	{	
				intChild++	
			}	else	{	
				intAdult++	
			}
		}
	}
	
	if (intInfant > intAdult)	{
		alert("The number of infants must not exceed the number of adults.")
		document.Step1.passenger_01_age.focus()
		return false;
	} else {
		if (intChild != 0 && intAdult == 0)	{
			alert("There must be at least one adult traveling with a party of children.")
			document.Step1.passenger_01_age.focus()
			return false;
		}
	}
	
	if (document.Step1.class_option.selectedIndex == 0)	{
		alert("Please select the class you would like to travel in.")
		document.Step1.class_option.focus()
		return false
	}

	if (objJourneyType[1].checked)	{
		//alert(intDepartVal + " : " + intReturnVal + " : Change time: " + bitChangeTime)
		if (bitChangeTime == true && (intInOutCheck == 0 && intReturnVal == intDepartVal))	{
			var myConfirm = window.confirm("Your return date/time are the same as your departure.\nAre you sure you wish to proceed?")
			if (!myConfirm)	{
				document.Step1.return_time.focus()
				bitChangeTime = false
				return false;			
			} else	{
				bitChangeTime = false
			}
		} 
	}
	
	// email validation if field is on...
	if (document.Step1.email_address != null)
		{
		objUserEmail = document.Step1.email_address
		if (!isFieldValidAndFocus(objUserEmail, 'email', false, true, 'Your email address'))
			{	
			return false;
			}
		return true;
		}
	
	return true;
}


//myFloatyText[0] 
if (departureAirportCount == 1) { 
	myFloatText("Please select your departure airport from the list.");
} else {
	myFloatText("By selecting " + departureAirportCount + " departure airports you will significantly increase your chances of finding the most competitive flight for you.");
}
myFloatText("An infant is usually required to sit on the lap of an adult passenger.");
//-->