var BookRide_SubmitBusy = false;
var sTagPrefix = 'BookRide_Entry1_';
var BookRide_AllowVendorSelection = 'N';
var BookRide_ShuttleService = 'N';
var BookRide_PageMode = 'NR';
var BookRide_UseProfiles = 'Y';
var BookRide_RideType = 'O';
var BookRide_ShuttleStopValue = '';
var BookRide_ShuttleStopTime = '';
var BookRide_RoundTrip = 'N';
var BookRide_LastRideDateTime = '';
var BookRide_TaxiSite = '';
var BookRide_CountryCode = '';
var BookRide_ValidPaymentMethods = '';
var BookRide_IsDelegate = '';
var BookRide_AllowProfileLocations = '';
var BookRide_RequireCCBillingZipCode = '';
var BookRide_ShowFlightInfo = '';
var BookRide_ShowPrcQuoteForLogin = '';
var BookRide_ShowPrcQuoteForQuickRes = '';
var BookRide_BookingValid = 'Y';
var BookRide_AllowPUDODirections = 'N';
var BookRide_AllowRunType = 'Y';
var BookRide_AllowHourlyRes = 'N';
var BookRide_AllowStops = 'Y';

var BookRide_AllowExtraPassenger = 'Y';

var BookRide_RestrictLocation = 'N';
var BookRide_FlightInfoRequired = 'O';
var BookRide_FlightValid = 'N';
var BookRide_ValidateForDays = 30;
var BookRide_CheckFlightResponse = 'N';
//kng - Military Time Change
var BookRide_TimeSetting = 'C';

function BookRide_Init() {
	var oPageMode = document.getElementById(sTagPrefix + 'txtPageMode');
	var oResNo = document.getElementById(sTagPrefix + 'txtResNo');
	var sResNo;
	var oTable = document.getElementById('BookRide_Table');
	var oTHead = oTable.childNodes[0];
	var oTBody = oTable.childNodes[1];
	var sClassName = '';
	var sHeadingText = '';
	var oButton = document.getElementById('BookRide_btnSubmit');
	var sButtonText = '';
	var oCell = document.getElementById('idBookRideHeaderCell');
	var oRow;
	var sRideType;
	var oDiv;
	var oTemp;
	var sTemp;
	var aTemp;
	var oLabel;
	var sAccountCode;
	var oInput;
	var j;
	var y;
	var z;

	oTemp = document.getElementById(sTagPrefix + 'txtPageSettings');
	sTemp = oTemp.value;
	aTemp = sTemp.split('^');
	BookRide_AllowVendorSelection = aTemp[0];
	BookRide_ShuttleService = aTemp[1];
	BookRide_UseProfiles = aTemp[2];
	BookRide_TaxiSite = aTemp[3];
	BookRide_CountryCode = aTemp[4];
	BookRide_RequireCCBillingZipCode = aTemp[5];
	BookRide_IsDelegate = aTemp[6];
	BookRide_AllowProfileLocations = aTemp[7];
	sAccountCode = aTemp[8];
	BookRide_ShowFlightInfo = aTemp[9];
	BookRide_ShowPrcQuoteForLogin = aTemp[10];
	BookRide_ShowPrcQuoteForQuickRes = aTemp[11];
	BookRide_BookingValid = aTemp[12];
	BookRide_AllowPUDODirections = aTemp[13];
	BookRide_AllowRunType = aTemp[14];
	BookRide_AllowHourlyRes = aTemp[15];
	BookRide_AllowStops = aTemp[16];
	BookRide_RestrictLocation = aTemp[17];
	BookRide_FlightInfoRequired = aTemp[18];
	BookRide_ValidateForDays = aTemp[19];
	BookRide_TimeSetting = aTemp[20];
		
	BookRide_AllowExtraPassenger = aTemp[21];

	if (aTemp[4] == 'Y') {
		SetDisplay('rowCC3', '');
	}
	
	if (BookRide_AllowPUDODirections == 'Y') {
		SetDisplay('rowBRSectionPickupDir', '');
		SetDisplay('rowBRSectionDropoffDir', '');
	}
	else {
		SetDisplay('rowBRSectionPickupDir', 'none');
		SetDisplay('rowBRSectionDropoffDir', 'none');
	}

	if (BookRide_CountryCode == 'CA') {
		oLabel = document.getElementById('BR_PUCityStateZip');
		oLabel.innerHTML = '<b>City/Prov/PostalCode:</b>';
		oLabel = document.getElementById('BR_DOCityStateZip');
		oLabel.innerHTML = '<b>City/Prov/PostalCode:</b>';
	}
	else {
		oLabel = document.getElementById('BR_PUCityStateZip');
		oLabel.innerHTML = '<b>City/State/Zip:</b>';
		oLabel = document.getElementById('BR_DOCityStateZip');
		oLabel.innerHTML = '<b>City/State/Zip:</b>';
	}
	
	if (BookRide_AllowVendorSelection == 'Y') {
		SetDisplay('rowPrefProvider', '');
	}
	else {
		SetDisplay('rowPrefProvider', 'none');
	}
	
	if (BookRide_ShowFlightInfo == 'Y') {
		SetDisplay('btnPUCheckFlight', 'inline');
		SetDisplay('btnDOCheckFlight', 'inline');
	}
	else {
		SetDisplay('btnPUCheckFlight', 'none');
		SetDisplay('btnDOCheckFlight', 'none');
	}
	
	if (BookRide_AllowRunType == 'Y') {
		SetDisplay('rowPrefRunType', 'inline');		
	}
	else {
		SetDisplay('rowPrefRunType', 'none');		
	}

	if (BookRide_AllowHourlyRes == 'N') {
		SetDisplay('BR_JobHours', 'none');		
		SetDisplay('txtDOMinHours', 'none');						
	}
	else {
		SetDisplay('BR_JobHours', 'inline');		
		SetDisplay('txtDOMinHours', 'inline');		
	}

	oRow = document.getElementById('rowBRRideType');
	if (BookRide_ShuttleService == 'N') {
		oRow.className = 'HiddenObject';
	}
	else {
		oRow.className = '';
		if (BookRide_ShuttleService == 'X') {
			SetDisplay('optRideTypeOther', '');
			SetDisplay('lblRideTypeOther', '');
		}
		else {
			SetDisplay('optRideTypeOther', 'none');
			SetDisplay('lblRideTypeOther', 'none');
		}
	}
	
	if (BookRide_TaxiSite == 'Y') {
		SetVisibility('cellPsgrWorkNo', 'hidden');
		SetVisibility('cellPsgrHomeNo', 'hidden');
		//SetVisibility('cellPsgrCellNo', 'hidden');
		SetDisplay('rowPsgrCellNo', 'none');
		SetVisibility('cellPsgrWorkNoLabel', 'hidden');
		SetVisibility('cellPsgrHomeNoLabel', 'hidden');
		SetVisibility('cellPsgrCellNoLabel', 'hidden');
		SetDisplay('rowPsgrVIPFax', 'none');
		SetDisplay('rowPsgrMobile', 'none');
	}
	else {
		SetVisibility('cellPsgrWorkNo', 'visible');
		SetVisibility('cellPsgrHomeNo', 'visible');
		//SetVisibility('cellPsgrCellNo', 'visible');
		SetDisplay('rowPsgrCellNo', '');
		SetVisibility('cellPsgrWorkNoLabel', 'visible');
		SetVisibility('cellPsgrHomeNoLabel', 'visible');
		SetVisibility('cellPsgrCellNoLabel', 'visible');
		if (BookRide_ShuttleService != 'N') {
			SetDisplay('rowPsgrVIPFax', 'none');
			SetDisplay('rowPsgrMobile', 'none');
		}
		else {
			SetDisplay('rowPsgrVIPFax', 'none');
			//SetDisplay('rowPsgrVIPFax', '');
			SetDisplay('rowPsgrMobile', '');
		}
	}
	
	if (BookRide_RestrictLocation == 'Y') {
			SetDisplay('optPUTypeOther', 'none');
			SetDisplay('lblPUTypeOther', 'none');
			SetDisplay('BR_PickupPoint', 'none');
			SetDisplay('txtPULandmarkPointInput', 'none');
			SetDisplay('BR_AirportPUPoint', 'none');
			SetDisplay('txtPUAirportPickupPoint', 'none');
			
			SetDisplay('optDOTypeOther', 'none');
			SetDisplay('lblDOTypeOther', 'none');
			SetDisplay('spanDOTypeAsDir', 'none');			
			SetDisplay('BR_DropoffPoint', 'none');
			SetDisplay('txtDOLandmarkPointInput', 'none');
			SetDisplay('BR_AirportDOPoint', 'none');
			SetDisplay('txtDOAirportPickupPoint', 'none');
	}

	if (BookRide_UseProfiles == 'N') {
		SetDisplay('rowSelectProfileID', 'none');
		SetDisplay('rowSelectPassengerType', 'none');
		SetDisplay('spanPUTypeProfile', 'none');
		SetDisplay('spanDOTypeProfile', 'none');
		for (j=1; j<=5; j++) {
			SetDisplay('spanS' + j + 'TypeProfile', 'none');
		}
		
		if (BookRide_ValidPaymentMethods == 'CC') {
			SetDisplay('rowPaymentType', 'none');
			SetDisplay('tblOtherCreditCard', 'block');
		}
		else {
			SetDisplay('rowPaymentType', '');
		}
		if (BookRide_ShowPrcQuoteForQuickRes != 'Y')
			SetDisplay('tblPaymentEstimate', 'none');
	} 
	else {
		if (BookRide_AllowProfileLocations == 'Y') {
			SetDisplay('spanPUTypeProfile', 'inline');
			SetDisplay('spanDOTypeProfile', 'inline');
			for (j=1; j<=5; j++) {
				SetDisplay('spanS' + j + 'TypeProfile', 'inline');
			}
		}
		else {
			SetDisplay('spanPUTypeProfile', 'none');
			SetDisplay('spanDOTypeProfile', 'none');
			for (j=1; j<=5; j++) {
				SetDisplay('spanS' + j + 'TypeProfile', 'none');
			}
		}
		if (BookRide_IsDelegate == 'Y') {
			SetDisplay('rowSelectProfileID', '');
			SetDisplay('rowSelectPassengerType', 'none');
			//BookRide_ProcessPsgrProfileData('');
			BookRide_CheckAccountCode()
		}
		else {
			SetDisplay('rowSelectProfileID', 'none');
			SetDisplay('rowSelectPassengerType', '');
		}
		if (BookRide_ShowPrcQuoteForLogin != 'Y')
			SetDisplay('tblPaymentEstimate', 'none');
	}

	if (BookRide_RequireCCBillingZipCode == 'Y') {
		SetDisplay('rowCCBillingZipCode', '');
	}
	else {
		SetDisplay('rowCCBillingZipCode', 'none');
	}

	oTemp = document.getElementById(sTagPrefix + 'txtRideType');
	sRideType = oTemp.value;
	switch (sRideType) {
		case 'T':
			BookRide_SelectOption('optRideTypeToAirport');
			break;
		case 'F':
			BookRide_SelectOption('optRideTypeFromAirport');
			break;
		default:
			sRideType = 'O';
			BookRide_SelectOption('optRideTypeOther');
	}
	BookRide_SelectRideType(sRideType);
	if (BookRide_ShuttleService != 'N') {
		BookRide_LoadShuttleStops();
	}
	
	BookRide_PageMode = oPageMode.value;
	sResNo = oResNo.value;
	
	switch (BookRide_PageMode) {
		case 'CR':
			sHeadingText = 'Change Ride';
			if (sResNo != '') {
				sHeadingText += ' #' + sResNo;
			}
			sButtonText = 'Submit Changes'
			break;
		case 'XL':
			sHeadingText = 'Cancel Ride';
			if (sResNo != '') {
				sHeadingText += ' #' + sResNo;
			}
			sButtonText = 'Confirm Cancel'
			//SetInputDisable(true);
			break;
		default:
			BookRide_PageMode = 'NR';
			sHeadingText = 'Book A Ride';
			sButtonText = 'Book Now'
	}
	
	oCell.innerHTML = sHeadingText;
	oButton.value = sButtonText;
	oTable.className = 'BookRide_' + BookRide_PageMode;
	BookRide_SetClassNames();
	
	CCNoInit('txtCCNumberEntry', 'txtCCNumber');

	// kng start
	if (BookRide_TimeSetting == 'M')
	{
		oSelect = document.getElementById('selShFlightTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selPickupTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selPUFlightTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selDOFlightTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selS1FlightTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selS2FlightTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selS3FlightTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selS4FlightTimeHours');
		load_military(oSelect);
		oSelect = document.getElementById('selS5FlightTimeHours');
		load_military(oSelect);

		SetDisplay('selShFlightTimeAMPM', 'none');
		SetDisplay('selPickupTimeAMPM', 'none');
		SetDisplay('selPUFlightTimeAMPM', 'none');
		SetDisplay('selDOFlightTimeAMPM', 'none');
		SetDisplay('selS1FlightTimeAMPM', 'none');
		SetDisplay('selS2FlightTimeAMPM', 'none');
		SetDisplay('selS3FlightTimeAMPM', 'none');
		SetDisplay('selS4FlightTimeAMPM', 'none');
		SetDisplay('selS5FlightTimeAMPM', 'none');
	}
	else
	{
		oSelect = document.getElementById('selShFlightTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selPickupTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selPUFlightTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selDOFlightTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selS1FlightTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selS2FlightTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selS3FlightTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selS4FlightTimeHours');
		load_civilian(oSelect);
		oSelect = document.getElementById('selS5FlightTimeHours');
		load_civilian(oSelect);
				
		SetDisplay('selShFlightTimeAMPM', '');
		SetDisplay('selPickupTimeAMPM', '');
		SetDisplay('selPUFlightTimeAMPM', '');
		SetDisplay('selDOFlightTimeAMPM', '');
		SetDisplay('selS1FlightTimeAMPM', '');
		SetDisplay('selS2FlightTimeAMPM', '');
		SetDisplay('selS3FlightTimeAMPM', '');
		SetDisplay('selS4FlightTimeAMPM', '');
		SetDisplay('selS5FlightTimeAMPM', '');
	}
	// kng end
	
	//PickupDateTime:
	oInput = document.getElementById(sTagPrefix + 'txtPUDate');
	sTemp = oInput.value + '||';
	aTemp = sTemp.split('|');
	SetInputTextValue(sTagPrefix + 'txtPickupDate', aTemp[0]);
	var sTime = aTemp[1];
	
	var sHour;
	var sMins;
	var sAmPm;

	if (sTime.length >= 8) {
	
		sHour = sTime.substr(0, 2);
		sMins = sTime.substr(3, 2);
		sAmPm = sTime.substr(6, 2);
		
			if (BookRide_TimeSetting == 'M')
			{
				if(sAmPm.toUpperCase()=='PM')
				{
					if (sHour.substr(0, 1) == '0') {
						sHour = sHour.substr(1, 1);
					}
					if(sHour!='12') {
						sHour = parseInt(sHour) + 12;
					}
				}
				else {
					if(sHour=='12') {
						sHour = 0;
					}
				}
						
				if(sHour<10)
				{
					sHour = '0' + sHour;
				}
				SetSelectByText('selPickupTimeHours', sHour);
				SetSelectByText('selPickupTimeMins', sMins);
				SetSelectByText('selPickupTimeAMPM', sAmPm);
			}
			else
			{
				SetSelectByText('selPickupTimeHours', sHour);
				SetSelectByText('selPickupTimeMins', sMins);
				SetSelectByText('selPickupTimeAMPM', sAmPm);
			}
		/*
		SetSelectByText('selPickupTimeHours', sTime.substr(0, 2));
		SetSelectByText('selPickupTimeMins', sTime.substr(3, 2));
		SetSelectByText('selPickupTimeAMPM', sTime.substr(6, 2));
		*/
	}	
	if (IsNumeric(aTemp[2]) == true) {
		SetInputTextValue('txtDOMinHours', aTemp[2]);
	}

	BookRide_CompanySelected();
	BookRide_AccountSelected();
	BookRide_ProfileSelected();

	oSelect = document.getElementById(sTagPrefix + 'selPickupLocProfile');
	oInput = document.getElementById('optPUTypeProfile');
	if (oSelect.innerHTML == '') {
		oInput.disabled = true;
	}
	else {
		oInput.disabled = false;
	}

	oSelect = document.getElementById(sTagPrefix + 'selDropoffLocProfile');
	oInput = document.getElementById('optDOTypeProfile');
	if (oSelect.innerHTML == '') {
		oInput.disabled = true;
	}
	else {
		oInput.disabled = false;
	}

	if (BookRide_PageMode == 'NR') {
		BookRide_SetDefaults();
	}
	else {
		BookRide_GetRideData();
	}
	
	oTemp = document.getElementById(sTagPrefix + 'txtUDFData');
	BookRide_ReturnProfileAccountData(oTemp.value);
	
	if (BookRide_BookingValid == 'N') {		
		SetDisplay('rowBookingInvalid', '');
		SetDisplay('BookRide_rowSubmit', 'none');
	}
	SetVisibility('BookRide_Table', 'visible');
}

function load_military(oSelect)
{
	var y;
	y = document.createElement('option');
	y.text='--';
	y.selected=true;
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='00';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='01';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='02';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='03';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='04';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='05';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='06';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='07';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='08';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='09';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='10';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='11';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='12';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='13';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='14';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='15';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='16';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='17';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='18';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='19';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='20';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='21';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='22';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='23';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
}

function load_civilian(oSelect)
{
	var y;
	y = document.createElement('option');
	y.text='--';
	y.selected=true;
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='01';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='02';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='03';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='04';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='05';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='06';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='07';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='08';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='09';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='10';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='11';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
	y = document.createElement('option');
	y.text='12';
	try{oSelect.add(y,null);}catch(ex){oSelect.add(y);} // FireFox or IE
}

function BookRide_CheckAccountCode() {
	var oSelect = document.getElementById(sTagPrefix + 'selAccountCode');
	var oInput = document.getElementById('txtAccountCode');
	var iIndex = oSelect.selectedIndex;
	
	oInput.value = '';
	if (iIndex > -1) {
		var sValue = oSelect.options[oSelect.selectedIndex].value;
		var aValue;
		
		if (sValue.length > 0) {
			aValue = sValue.split("|");
			oInput.value = aValue[0];
		}
	}
}

function BookRide_SetDefaults() {
	var j;
	
	if (BookRide_UseProfiles == 'Y' && BookRide_IsDelegate == 'N') {
		BookRide_SelectOption('optPsgrTypeUser');
		BookRide_SelectPsgrType('U');
	}
	else {
		BookRide_SelectOption('optPsgrTypeOther');
		BookRide_SelectPsgrType('O');		
	}
		BookRide_SelectOption('optPUTypeLandmark');
		BookRide_SelectLocType('P', 'L');
		GetPUPoints('', '');

		BookRide_SelectOption('optDOTypeLandmark');
		BookRide_SelectLocType('D', 'L');
		GetDOPoints('', '');
		
		for (j=1; j<=5; j++) {
			BookRide_SelectOption('optS' + (j) + 'TypeLandmark');
			BookRide_SelectLocType('S' + (j), 'L');
		}
	BookRide_SelectPaymentMethod();
}

function BookRide_GetRideData() {
	var oTextBox;
	var sData = '';
	var aData;
	var sType = 'U';
	var sOption = '';
	var sSelect = '';
	var sInput = '';
	var sValue = '';
	var sDesc = '';
	var sTime = '';
	var i;
	var j;
	var s;
	var oListBox;
	var pData;

	//Passenger Data:
	oTextBox = document.getElementById(sTagPrefix + 'txtPsgrData');
	sData = oTextBox.value + '||||||||||||||||||||||||';
	aData = sData.split('|');
	sType = aData[0];
	switch (sType) {
		case 'U': sOption = 'optPsgrTypeUser'; break;
		case 'D': sOption = 'optPsgrTypePackage'; break;
		default: sOption = 'optPsgrTypeOther'; break;
	}
	BookRide_SelectOption(sOption);
	BookRide_SelectPsgrType(sType);
	if (sType == 'O') {
		SetInputTextValue('txtPsgrFirstName', aData[1]);
		SetInputTextValue('txtPsgrLastName', aData[2]);
		SetInputTextValue('txtPsgrCellPhone', aData[3]);
		SetInputCheckboxValue('chkPriority', (aData[4] == 'A'))
		SetInputTextValue('txtPsgrWorkPhone', aData[5]);
		SetInputTextValue('txtPsgrFax', aData[6]);
		SetInputTextValue('txtPsgrHomePhone', aData[7]);
		SetInputTextValue('txtPsgrEmailAddress', aData[8]);
		SetInputTextValue('txtPsgrMobileEmailAddress', aData[9]);
	}	
		
	//Pickup Data:
	oTextBox = document.getElementById(sTagPrefix + 'txtPUData');
	sData = oTextBox.value + '||||||||||||||||||||||||';
	SetupPickupControls(sData);
		
	//Dropoff Data:
	oTextBox = document.getElementById(sTagPrefix + 'txtDOData');
	sData = oTextBox.value + '|||||||||||||||||||||||||||';
	SetupDropoffControls(sData);
	
	// Stops	
	s=0;
	oTextBox = document.getElementById(sTagPrefix + 'txtStop1Data');
	if (oTextBox.value != ''){		
		SetDisplay('rowBRSectionStop1', '');
		s=s+1;
	}
	else{
		SetDisplay('rowBRSectionStop1', 'none')
	}
	sData = oTextBox.value + '||||||||||||||||||||||||';
	SetupStopControls('1', sData);
	
	oTextBox = document.getElementById(sTagPrefix + 'txtStop2Data');
	if (oTextBox.value != '') {
		SetDisplay('rowBRSectionStop2', '')
		s=s+1;
	}
	else {
		SetDisplay('rowBRSectionStop2', 'none')
	}
	sData = oTextBox.value + '||||||||||||||||||||||||';
	SetupStopControls('2', sData);
	
	oTextBox = document.getElementById(sTagPrefix + 'txtStop3Data');
	if (oTextBox.value != '') {
		SetDisplay('rowBRSectionStop3', '')
		s=s+1;
	}
	else {
		SetDisplay('rowBRSectionStop3', 'none')
	}
	sData = oTextBox.value + '||||||||||||||||||||||||';
	SetupStopControls('3', sData);
	
	oTextBox = document.getElementById(sTagPrefix + 'txtStop4Data');
	if (oTextBox.value != '') {
		SetDisplay('rowBRSectionStop4', '')
		s=s+1;
	}
	else {
		SetDisplay('rowBRSectionStop4', 'none')
	}
	sData = oTextBox.value + '||||||||||||||||||||||||';
	SetupStopControls('4', sData);
	
	oTextBox = document.getElementById(sTagPrefix + 'txtStop5Data');
	if (oTextBox.value != '') {
		SetDisplay('rowBRSectionStop5', '')
		s=s+1;
	}
	else {	
		SetDisplay('rowBRSectionStop5', 'none')
	}
	sData = oTextBox.value + '||||||||||||||||||||||||';
	SetupStopControls('5', sData);
	
	oSelect = document.getElementById('selTotalStops');
	oSelect.selectedIndex = s;	
	
	
	//Extra Passengers
	
	s=0;
	oTextBox = document.getElementById(sTagPrefix + 'txtExtraPassenger');
	var temp=oTextBox.value
	pData=temp.split("|")

	
	var iIndex = pData[10];
	var i;

	for (i=1; i<=5; i++) 
	{
		if (iIndex > 0 && iIndex >=i && BookRide_AllowExtraPassenger  == 'Y') {
			SetDisplay('rowBRSectionExtraPassenger' + (i), '');
		}
		else {
			SetDisplay('rowBRSectionExtraPassenger' + (i), 'none');
		}
	}
	
	var j = pData[10];
	//j = j + 1;
	if (j != null && j >= 1) {
		SetSelectByValue('selTotalPassenger', (j), 0);
		BookRide_AddExtraPassenger();
	}
	
	
	
	SetInputTextValue('txtFirstName1', pData[0]);
	SetInputTextValue('txtLastName1', pData[1]);

	SetInputTextValue('txtFirstName2', pData[2]);
	SetInputTextValue('txtLastName2', pData[3]);

	SetInputTextValue('txtFirstName3', pData[4]);
	SetInputTextValue('txtLastName3', pData[5]);

	SetInputTextValue('txtFirstName4', pData[6]);
	SetInputTextValue('txtLastName4', pData[7]);

	SetInputTextValue('txtFirstName5', pData[8]);
	SetInputTextValue('txtLastName5', pData[9]);

	
	//ExtraServices:
	oTextBox = document.getElementById(sTagPrefix + 'txtExtraServices');
	oListBox = document.getElementById(sTagPrefix + 'selExtraServices');
	sData = oTextBox.value;
	aData = sData.split('|');
	for (j=0; j<oListBox.options.length; j++) {
		oListBox.options[j].selected = false;
	}
	
	if (sData.length > 0) {
		for (i=1; i<aData.length; i++) {
			for (j=0; j<oListBox.options.length; j++) {
				if (oListBox.options[j].value == aData[i]) {
					oListBox.options[j].selected = true;
					break;
				}
			}
		}
	}
		
	//BookRide_ShowPreferences();
	oTextBox = document.getElementById(sTagPrefix + 'txtPrefData');
	sData = oTextBox.value + '|||';
	aData = sData.split('|');
	SetSelectByValue(sTagPrefix + 'selVehicleType', aData[0], 0);
	SetInputTextValue(sTagPrefix + 'txtNumPassengers', aData[1]);
	SetInputCheckboxValue('chkMeetGreet', (aData[2] == 'Y'));
	SetSelectByValue(sTagPrefix + 'selRunType', aData[3], 0);
	SetSelectByValue(sTagPrefix + 'selServiceProvider', aData[4], 0);

	//Payment Data:
	BookRide_SelectPaymentMethod();
	oTextBox = document.getElementById(sTagPrefix + 'txtPaymentData');
	sData = oTextBox.value + '|||||';
	aData = sData.split('|');
	if (aData[0] != '') {
		SetSelectByValue(sTagPrefix + 'selCreditCardType', aData[0], 0);

		SetInputTextValue('txtCCNumberEntry', aData[1]);		
		oTextBox = document.getElementById('txtCCNumberEntry');
		CCNoExit(oTextBox, 'txtCCNumber');	

		SetInputTextValue('txtCCName', aData[3]);
		SetInputTextValue('txtCCCID', aData[4]);	
		SetInputTextValue('txtBillingZipCode', aData[5]);			

		sData = aData[2] + '//';
		aData = sData.split('/');
		SetSelectByText('selCCExpiresMonth', aData[0]);
		SetSelectByText('selCCExpiresYear', aData[2]);		
	}
	BookRide_UpdateCCNumberDesc();

	//General Notes:
	oTextBox = document.getElementById(sTagPrefix + 'txtGenNotes');
	SetInputTextValue('txtGeneralNotes', oTextBox.value);
}

function SetupPickupControls(sData) {
	var aData;
	var sOption;
	var sType;
	var sTime;
	var oSelect;

	aData = sData.split('|');
	sType = aData[1];
	switch (sType) {
		case 'P':
			SetProfileSelectValue(sTagPrefix + 'selPickupLocProfile', aData[0]);
			SetLabelText('lblPickupLocProfileDesc', GetLocationDesc(sData));
			break;
		case 'L':
			sValue = aData[4] + ' (' + aData[11] + ', ' + aData[12] + ')';
			SetInputTextValue('txtPULandmarkInput', sValue);
			SetInputTextValue('txtPULandmarkValue', sData);
			SetLabelText('lblPULandmarkDesc', GetLocationDesc(sData));
			SetInputTextValue('txtPULandmarkPointInput', aData[9]);
			//GetPUPoints(aData[3], aData[9]);
			break;
		case 'A':
			oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
			if (oSelect.options.length == 0) {				
				sValue = aData[16] + ':' + aData[17];
				SetInputTextValue('txtPUAirportValue', sData);			
				SetInputTextValue('txtPUAirportInput', sValue);
			}
			else {
				SetSelectByValue(sTagPrefix + 'selPUAirport', aData[16], 16);
				SetLabelText('lblPUAirportDesc', GetLocationDesc(sData));						
			}

			//SetSelectByValue(sTagPrefix + 'selPUAirport', aData[16], 16);
			//SetLabelText('lblPUAirportDesc', GetLocationDesc(sData));
			//SetSelectByValue(sTagPrefix + 'selPUAirline', aData[18], 0);
						
			sValue = aData[18] + ':' + aData[19];			
			SetInputTextValue('txtPUAirlineValue', aData[18]);
			SetInputTextValue('txtPUAirlineInput', sValue);
			
			SetInputTextValue('txtPUCity', aData[11]);
			SetInputTextValue('txtPUFlightNumber', aData[20]);
			sTime = aData[21];
			if (sTime.length >= 8) {
			
			var sHour = sTime.substr(0, 2);
		var sMins = sTime.substr(3, 2);
		var sAmPm = sTime.substr(6, 2);
	
			if (BookRide_TimeSetting == 'M'){
						if(sAmPm.toUpperCase()=='PM'){
							if (sHour.substr(0, 1) == '0') {
								sHour = sHour.substr(1, 1);
							}
							if(sHour!='12'){
								sHour = parseInt(sHour) + 12;
							}
						}
						else{
							if(sHour=='12'){
								sHour = 0;
							}
						}
						
						if(sHour<10)
						{
							sHour = '0' + sHour;
						}
	
			SetSelectByText('selPUFlightTimeHours', sHour);
			SetSelectByText('selPUFlightTimeMins', sMins);
			SetSelectByText('selPUFlightTimeAMPM', sAmPm);
		}
		else
		{
			SetSelectByText('selPUFlightTimeHours', sHour);
			SetSelectByText('selPUFlightTimeMins', sMins);
			SetSelectByText('selPUFlightTimeAMPM', sAmPm);
		}
			
			/*
				SetSelectByText('selPUFlightTimeHours', sTime.substr(0, 2));
				SetSelectByText('selPUFlightTimeMins', sTime.substr(3, 2));
				SetSelectByText('selPUFlightTimeAMPM', sTime.substr(6, 2));
				*/
			}
			else {
				SetSelectByText('selPUFlightTimeHours', '--');
				SetSelectByText('selPUFlightTimeMins', '--');
				SetSelectByText('selPUFlightTimeAMPM', '--');
			}
			SetSelectByValue('selPUFlightType', aData[22], -1);
			SetInputTextValue('txtPUFlightOrig', aData[24]);
			SetInputTextValue('txtPUAirportPickupPoint', aData[9]);
			BookRide_FlightValid = 'Y';
			break;
		default:
			SetInputTextValue('txtPUAddress1', aData[5] + ' ' + aData[6]);
			SetInputTextValue('txtPUAddress2', aData[7]);
			SetInputTextValue('txtPURoomNo', aData[10]);
			SetInputTextValue('txtPUCity', aData[11]);
			SetInputTextValue('txtPUState', aData[12]);
			SetInputTextValue('txtPUZip', aData[13]);
			SetInputTextValue('txtPUPhone', aData[14]);
	}
	switch (sType) {
		case 'P': sOption = 'optPUTypeProfile'; break;
		case 'L': sOption = 'optPUTypeLandmark'; break;
		case 'A': sOption = 'optPUTypeAirport'; break;
		default: sOption = 'optPUTypeOther'; break;
	}
	BookRide_SelectOption(sOption);
	BookRide_SelectLocType('P', sType);
	
	//Pickup Directions:	
	oTextBox = document.getElementById(sTagPrefix + 'txtPUDir');
	SetInputTextValue('txtPickupDirection', oTextBox.value);
}

function SetupDropoffControls(sData) {
	var aData;
	var sOption;
	var sType;
	var sTime;

	aData = sData.split('|');
	if (aData[1] == 'D') {
		sOption = 'optDOTypeAsDir';
		sType = 'D';
	}
	else {
		sType = aData[1];
		switch (sType) {
			case 'P':
				SetProfileSelectValue(sTagPrefix + 'selDropoffLocProfile', aData[0]);
				SetLabelText('lblDropoffLocProfileDesc', GetLocationDesc(sData));
				break;
			case 'L':
				sValue = aData[4] + ' (' + aData[11] + ', ' + aData[12] + ')';
				SetInputTextValue('txtDOLandmarkInput', sValue);
				SetInputTextValue('txtDOLandmarkValue', sData);
				SetLabelText('lblDOLandmarkDesc', GetLocationDesc(sData));
				SetInputTextValue('txtDOLandmarkPointInput', aData[9]);
				//GetDOPoints(aData[3], aData[9]);
				break;
			case 'A':
				oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
				if (oSelect.options.length == 0) {				
					sValue = aData[16] + ':' + aData[17];
					SetInputTextValue('txtDOAirportValue', sData);
					SetInputTextValue('txtDOAirportInput', sValue);		
				}
				else {
					SetSelectByValue(sTagPrefix + 'selDOAirport', aData[16], 16);
					SetLabelText('lblDOAirportDesc', GetLocationDesc(sData));						
				}

				//SetSelectByValue(sTagPrefix + 'selDOAirport', aData[16], 16);
				//SetLabelText('lblDOAirportDesc', GetLocationDesc(sData));
				//SetSelectByValue(sTagPrefix + 'selDOAirline', aData[18], 0);
									
				sValue = aData[18] + ':' + aData[19];		
				SetInputTextValue('txtDOAirlineValue', aData[18]);		
				SetInputTextValue('txtDOAirlineInput', sValue);
			
				SetInputTextValue('txtDOCity', aData[11]);
				SetInputTextValue('txtDOFlightNumber', aData[20]);
				sTime = aData[21];
				if (sTime.length >= 8) {
				
					var sHour = sTime.substr(0, 2);
					var sMins = sTime.substr(3, 2);
					var sAmPm = sTime.substr(6, 2);
	
						if (BookRide_TimeSetting == 'M'){
							if(sAmPm.toUpperCase()=='PM'){
								if (sHour.substr(0, 1) == '0') {
									sHour = sHour.substr(1, 1);
								}
								if(sHour!='12'){
									sHour = parseInt(sHour) + 12;
								}
							}
							else{
								if(sHour=='12'){
									sHour = 0;
								}
							}
						
							if(sHour<10)
							{
								sHour = '0' + sHour;
							}
	
							SetSelectByText('selDOFlightTimeHours', sHour);
							SetSelectByText('selDOFlightTimeMins', sMins);
							SetSelectByText('selDOFlightTimeAMPM', sAmPm);
						}
						else
						{
							SetSelectByText('selDOFlightTimeHours', sHour);
							SetSelectByText('selDOFlightTimeMins', sMins);
							SetSelectByText('selDOFlightTimeAMPM', sAmPm);
						}
				
					/*
					SetSelectByText('selDOFlightTimeHours', sTime.substr(0, 2));
					SetSelectByText('selDOFlightTimeMins', sTime.substr(3, 2));
					SetSelectByText('selDOFlightTimeAMPM', sTime.substr(6, 2));
					*/
				}
				else {
					SetSelectByText('selDOFlightTimeHours', '--');
					SetSelectByText('selDOFlightTimeMins', '--');
					SetSelectByText('selDOFlightTimeAMPM', '--');
				}
				SetSelectByValue('selDOFlightType', aData[22], -1);
				SetInputTextValue('txtDOFlightDest', aData[24]);
				SetInputTextValue('txtDOAirportDropoffPoint', aData[9]);
				break;
			default:
				SetInputTextValue('txtDOAddress1', aData[5] + ' ' + aData[6]);
				SetInputTextValue('txtDOAddress2', aData[7]);
				SetInputTextValue('txtDORoomNo', aData[10]);
				SetInputTextValue('txtDOCity', aData[11]);
				SetInputTextValue('txtDOState', aData[12]);
				SetInputTextValue('txtDOZip', aData[13]);
				SetInputTextValue('txtDOPhone', aData[14]);
		}
		switch (sType) {
			case 'P': sOption = 'optDOTypeProfile'; break;
			case 'L': sOption = 'optDOTypeLandmark'; break;
			case 'A': sOption = 'optDOTypeAirport'; break;
			default: sOption = 'optDOTypeOther'; break;
		}
	}
	BookRide_SelectOption(sOption);
	BookRide_SelectLocType('D', sType);
	//Dropoff Directions:
	oTextBox = document.getElementById(sTagPrefix + 'txtDODir');
	SetInputTextValue('txtDropoffDirection', oTextBox.value);

}

function SetupStopControls(nStopNo, sData) {
	var aData;
	var sOption;
	var sType;
	var sTime;

	aData = sData.split('|');
	sType = aData[1];
	switch (sType) {
		case 'P':
			SetProfileSelectValue(sTagPrefix + 'selS' + nStopNo + 'LocProfile', aData[0]);
			SetLabelText('lblS' + nStopNo + 'LocProfileDesc', GetLocationDesc(sData));			
			break;
		case 'L':
			sValue = aData[4] + ' (' + aData[11] + ', ' + aData[12] + ')';
			SetInputTextValue('txtS' + nStopNo + 'LandmarkInput', sValue);
			SetInputTextValue('txtS' + nStopNo + 'LandmarkValue', sData);
			SetLabelText('lblS' + nStopNo + 'LandmarkDesc', GetLocationDesc(sData));
			SetInputTextValue('txtS' + nStopNo + 'LandmarkPointInput', aData[9]);
			break;
		case 'A':
			sValue = aData[16] + ':' + aData[17];
			SetInputTextValue('txtS' + nStopNo + 'AirportValue', sData);			
			SetInputTextValue('txtS' + nStopNo + 'AirportInput', sValue);
						
			sValue = aData[18] + ':' + aData[19];			
			SetInputTextValue('txtS' + nStopNo + 'AirlineValue', aData[18]);
			SetInputTextValue('txtS' + nStopNo + 'AirlineInput', sValue);
			
			SetInputTextValue('txtS' + nStopNo + 'City', aData[11]);
			SetInputTextValue('txtS' + nStopNo + 'FlightNumber', aData[20]);
			sTime = aData[21];
			if (sTime.length >= 8) {
				SetSelectByText('selS' + nStopNo + 'FlightTimeHours', sTime.substr(0, 2));
				SetSelectByText('selS' + nStopNo + 'FlightTimeMins', sTime.substr(3, 2));
				SetSelectByText('selS' + nStopNo + 'FlightTimeAMPM', sTime.substr(6, 2));
			}
			else {
				SetSelectByText('selS' + nStopNo + 'FlightTimeHours', '--');
				SetSelectByText('selS' + nStopNo + 'FlightTimeMins', '--');
				SetSelectByText('selS' + nStopNo + 'FlightTimeAMPM', '--');
			}
			SetSelectByValue('selS' + nStopNo + 'FlightType', aData[22], -1);
			SetInputTextValue('txtS' + nStopNo + 'FlightOrig', aData[24]);
			SetInputTextValue('txtS' + nStopNo + 'AirportPickupPoint', aData[9]);
			break;
		default:
			SetInputTextValue('txtS' + nStopNo + 'Address1', aData[5] + ' ' + aData[6]);
			SetInputTextValue('txtS' + nStopNo + 'Address2', aData[7]);
			SetInputTextValue('txtS' + nStopNo + 'RoomNo', aData[10]);
			SetInputTextValue('txtS' + nStopNo + 'City', aData[11]);
			SetInputTextValue('txtS' + nStopNo + 'State', aData[12]);
			SetInputTextValue('txtS' + nStopNo + 'Zip', aData[13]);
			SetInputTextValue('txtS' + nStopNo + 'Phone', aData[14]);
	}
	switch (sType) {
		case 'P': sOption = 'optS' + nStopNo + 'TypeProfile'; break;
		case 'L': sOption = 'optS' + nStopNo + 'TypeLandmark'; break;
		case 'A': sOption = 'optS' + nStopNo + 'TypeAirport'; break;
		default: sOption = 'optS' + nStopNo + 'TypeOther'; break;
	}
	BookRide_SelectOption(sOption);
	BookRide_SelectLocType('S' + nStopNo, sType);
	
}

function BookRide_GetAccountingData(sUDFData) {
	var oData;
	var sData;
	var aData;
	var i;
	var sItem = '';
	var aItem;
	var sItemID = '';
	var sItemLabel = '';
	var sItemValue = '';
	var oText;
	var sUDFRowDisplay1 = 'none';
	var sUDFRowDisplay2 = 'none';
	var sUDFRowDisplay3 = 'none';
	var sUDFRowDisplay4 = 'none';
	var sUDFRowDisplay5 = 'none';
	var sMaxLen;
	var sIsRequired;
	var sEntryMethod;
	var sUDFLabel = '';

	if (sUDFData != null) {
		sData = sUDFData;
	}
	else {
		oData = document.getElementById(sTagPrefix + 'txtUDFData');
		sData = oData.value;
	}
	
	if (sData == '')
		SetDisplay('rowBRSectionAccounting', 'none');
	else 
		SetDisplay('rowBRSectionAccounting', '');		

	//aData = sData.split('~');
	aData = sData.split(String.fromCharCode(206));
	
	for (i=1; i<=5; i++) {
		sItem = aData[i] + '||||';
		aItem = sItem.split('|');
		sItemID = aItem[0];
		sItemLabel = aItem[1];
		sItemValue = aItem[2];
		sMaxLen = aItem[3];
		sIsRequired = aItem[4];
		sEntryMethod = aItem[5];
		sUDFLabel = '';

		switch (sItemID) {
			case 'UDF1':
				SetInputTextValue('txtUDF1', sItemValue);
				if (sItemLabel.length > 0) {
					sUDFRowDisplay1 = '';
					sUDFLabel = sItemLabel + ':&nbsp;';
					if (sIsRequired == 'Y') {
						sUDFLabel = '<b>' + sUDFLabel + '</b>';
					}
				}
				SetLabelText('lblUDF1', sUDFLabel);
				SetInputTextMaxLength('txtUDF1', sMaxLen);
				if (sEntryMethod == 'R'){
					SetInputTextReadOnly('txtUDF1')
				}				
				break;
			case 'UDF2':
				SetInputTextValue('txtUDF2', sItemValue);
				if (sItemLabel.length > 0) {
					sUDFRowDisplay2 = '';
					sUDFLabel = sItemLabel + ':&nbsp;';
					if (sIsRequired == 'Y') {
						sUDFLabel = '<b>' + sUDFLabel + '</b>';
					}
				}
				SetLabelText('lblUDF2', sUDFLabel);
				SetInputTextMaxLength('txtUDF2', sMaxLen);
				if (sEntryMethod == 'R'){
					SetInputTextReadOnly('txtUDF2')
				}
				break;
			case 'UDF3':
				SetInputTextValue('txtUDF3', sItemValue);
				if (sItemLabel.length > 0) {
					sUDFRowDisplay3 = '';
					sUDFLabel = sItemLabel + ':&nbsp;';
					if (sIsRequired == 'Y') {
						sUDFLabel = '<b>' + sUDFLabel + '</b>';
					}
				}
				SetLabelText('lblUDF3', sUDFLabel);
				SetInputTextMaxLength('txtUDF3', sMaxLen);
				if (sEntryMethod == 'R'){
					SetInputTextReadOnly('txtUDF3')
				}
				break;
			case 'UDF4':
				SetInputTextValue('txtUDF4', sItemValue);
				if (sItemLabel.length > 0) {
					sUDFRowDisplay4 = '';
					sUDFLabel = sItemLabel + ':&nbsp;';					
					if (sIsRequired == 'Y') {
						sUDFLabel = '<b>' + sUDFLabel + '</b>';
					}
				}
				SetLabelText('lblUDF4', sUDFLabel);
				SetInputTextMaxLength('txtUDF4', sMaxLen);
				if (sEntryMethod == 'R'){
					SetInputTextReadOnly('txtUDF4')
				}
				break;
			case 'UDF5':
				SetInputTextValue('txtUDF5', sItemValue);
				if (sItemLabel.length > 0) {
					sUDFRowDisplay5 = '';
					sUDFLabel = sItemLabel + ':&nbsp;';
					if (sIsRequired == 'Y') {
						sUDFLabel = '<b>' + sUDFLabel + '</b>';
					}
				}
				SetLabelText('lblUDF5', sUDFLabel);
				SetInputTextMaxLength('txtUDF5', sMaxLen);
				if (sEntryMethod == 'R'){
					SetInputTextReadOnly('txtUDF5')
				}
				break;
		}		
	}
	SetDisplay('rowUDF1', sUDFRowDisplay1);
	SetDisplay('rowUDF2', sUDFRowDisplay2);
	SetDisplay('rowUDF3', sUDFRowDisplay3);
	SetDisplay('rowUDF4', sUDFRowDisplay4);
	SetDisplay('rowUDF5', sUDFRowDisplay5);
	
}

function SetProfileSelectValue(sTagID, sLocationID) {
	var sTest1 = sLocationID + '|';
	var sTest2 = '';
	var sValue = '';
	var oSelect = document.getElementById(sTagID);
	var i;
	var iIndex = -1;
	
	if (oSelect != null) {
		if (oSelect.options.length > 0) {
			for (i=0; i<oSelect.options.length; i++) {
				sValue = oSelect.options[i].innerHTML;
				sTest2 = sValue.substr(0, sValue.length) + '|';
				if (sTest1 == sTest2) {
					iIndex = i;
				}
			}
			if (iIndex > -1) {
				oSelect.selectedIndex = iIndex;
			}
		}
	}
}

function BookRide_SetClassNames() {
	var i;
	var oTag;
	var aTags;

	aTags = document.getElementsByTagName('DIV');
	for (i=0; i<aTags.length; i++) {
		oTag = aTags[i];
		if (oTag.className == 'BookRide_Unk') {
			oTag.className = 'BookRide_' + BookRide_PageMode;
		}
	}

	aTags = document.getElementsByTagName('TH');
	for (i=0; i<aTags.length; i++) {
		oTag = aTags[i];
		if (oTag.className == 'BookRide_Unk') {
			oTag.className = 'BookRide_' + BookRide_PageMode;
		}
	}

	aTags = document.getElementsByTagName('TD');
	for (i=0; i<aTags.length; i++) {
		oTag = aTags[i];
		switch (oTag.className) {
			case 'BookRide_Heading_Unk':
				oTag.className = 'BookRide_Heading_' + BookRide_PageMode;
				break;
			case 'BookRide_Input_Unk':
				oTag.className = 'BookRide_Input_' + BookRide_PageMode;
				break;
		}
	}
}

function BookRide_SelectOption(sOptionID) {
	var oOption = document.getElementById(sOptionID);
	oOption.checked = true;
}

function BookRide_SelectRideType(sRideType) {
	var oSelect;
	var sTemp;
	BookRide_RideType = sRideType;

	if (BookRide_IsDelegate == 'N') {
		SetDisplay('rowBRSectionCompany', 'none');
	}
	else {
		SetDisplay('rowBRSectionCompany', '');
	}

	if (BookRide_ShuttleService != 'N') {
		SetDisplay('rowBRRideType', '');
	}
	else {
		SetDisplay('rowBRRideType', 'none');
	}
	
	sTemp = GetInputTextValue(sTagPrefix + 'txtUDFData');	
	if (sTemp == '')
		SetDisplay('rowBRSectionAccounting', 'none');
	else 
		SetDisplay('rowBRSectionAccounting', '');
			
	SetDisplay('rowBRSectionContactInfo', '');
	SetDisplay('rowBRSectionPassenger', '');
	SetDisplay('rowBRSectionPayment', '');
	SetDisplay('rowBRSectionExtraServices', '');
	SetDisplay('rowBRSectionNotes', '');

	if (sRideType == 'O') {
		SetDisplay('rowBRSectionPassengerCounts', 'none');
		SetDisplay('rowBRSectionShuttleAirport', 'none');
		SetDisplay('rowBRSectionShuttleFlight', 'none');
		SetDisplay('rowBRSectionShuttleStop', 'none');
		
		SetDisplay('rowBRSectionPickupDate', '');
		
		SetDisplay('rowBRSectionPickup', '');			
		SetDisplay('rowSelPUAirport', 'none');		
		SetDisplay('rowTxtPUAirport', 'none');				
		oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
		if (oSelect.options.length == 0) {
			SetDisplay('rowTxtPUAirport', '');
		}
		else {
			SetInputTextValue('txtPUAirportValue', '[SELECTLIST]');
			SetDisplay('rowSelPUAirport', '');
		}
				
		SetDisplay('rowBRSectionDropoff', '');		
		SetDisplay('rowSelDOAirport', 'none');		
		SetDisplay('rowTxtDOAirport', 'none');				
		oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
		if (oSelect.options.length == 0) {
			SetDisplay('rowTxtDOAirport', '');
		}
		else {
			SetInputTextValue('txtDOAirportValue', '[SELECTLIST]');
			SetDisplay('rowSelDOAirport', '');
		}

		if (BookRide_AllowPUDODirections == 'Y') {
			SetDisplay('rowBRSectionPickupDir', '');
			SetDisplay('rowBRSectionDropoffDir', '');
		}
		else {
			SetDisplay('rowBRSectionPickupDir', 'none');
			SetDisplay('rowBRSectionDropoffDir', 'none');
		}
	
		if (BookRide_TaxiSite == 'Y') {
			SetDisplay('rowBRSectionStops', 'none');
		} 
		else {
			SetDisplay('rowBRSectionStops', '');
			BookRide_AddStops();
		}

		if (BookRide_AllowStops == 'Y') {		
			//SetDisplay('rowBRSectionStops', 'inline');	using 'inline' causes issue for FireFox	
			SetDisplay('rowBRSectionStops', '');
		}
		else 
		{		
			SetDisplay('rowBRSectionStops', 'none');				
		}
		
		if (BookRide_AllowExtraPassenger == 'Y') {		
			//SetDisplay('rowBRSectionStops', 'inline');	using 'inline' causes issue for FireFox	
			SetDisplay('rowBRSectionExtraPassenger', '');
		}
		else 
		{		
			SetDisplay('rowBRSectionExtraPassenger', 'none');				
		}

		SetDisplay('rowBRSectionPreferences', '');
		SetDisplay('optPsgrTypePackage', 'none');
		SetDisplay('lblPsgrTypePackage', 'none');

		BookRide_BookNowSetDisabled(false);
	}
	else {
		var oDiv;
		var oCell;
		if (sRideType == 'T') {
			SetLabelText('divShuttleAirportLabel', 'Dropoff Airport');
			SetLabelText('divShuttleFlightLabel', 'Departing Flight');
			oCell = document.getElementById('cellBRSectionShuttleAirportHeading');
			oCell.style.backgroundColor = 'D0EFCB';
			oCell = document.getElementById('cellBRSectionShuttleFlightHeading');
			oCell.style.backgroundColor = 'D0EFCB';
			SetDisplay('BR_ShPUTerminal', 'none');
			SetDisplay('BR_ShDOTerminal', 'inline');
		}
		else {
			SetLabelText('divShuttleAirportLabel', 'Pickup Airport');
			SetLabelText('divShuttleFlightLabel', 'Arriving Flight');
			oCell = document.getElementById('cellBRSectionShuttleAirportHeading');
			oCell.style.backgroundColor = 'F6D9D8';
			oCell = document.getElementById('cellBRSectionShuttleFlightHeading');
			oCell.style.backgroundColor = 'F6D9D8';
			SetDisplay('BR_ShPUTerminal', 'inline');
			SetDisplay('BR_ShDOTerminal', 'none');
		}

		SetDisplay('rowBRSectionPassengerCounts', '');
		SetDisplay('rowBRSectionShuttleAirport', '');
		SetDisplay('rowBRSectionShuttleFlight', '');
		SetDisplay('rowBRSectionShuttleStop', '');

		SetDisplay('rowBRSectionPickupDate', 'none');
		SetDisplay('rowBRSectionPickup', 'none');
		SetDisplay('rowBRSectionDropoff', 'none');
		//SetDisplay('rowBRSectionStops', 'none');
		SetDisplay('rowBRSectionPreferences', 'none');
		SetDisplay('rowBRSectionAccounting', 'none');
		SetDisplay('optPsgrTypePackage', 'inline');
		SetDisplay('lblPsgrTypePackage', 'inline');

		BookRide_BookNowSetDisabled(true);
	}	
	oSelect = document.getElementById(sTagPrefix + 'selExtraServices');
	if (oSelect.options.length == 0) {
		SetDisplay('rowBRSectionExtraServices', 'none');
	}
}

function BookRide_SelectPsgrType(sPsgrType) {
	var sOtherDisplay = 'none';
	var oRow = document.getElementById('rowPassengerOther');
	
	switch (sPsgrType) {
		case 'O': sOtherDisplay = ''; break;
	}
	oRow.style.display = sOtherDisplay;
}

function BookRide_CompanyOnChange() {
	BookRide_CompanySelected()
	BookRide_LookupProfileAccountData('COMP');
}

function BookRide_CompanySelected() {
	var oSelect = document.getElementById(sTagPrefix + 'selCompanyName');
	var oText = document.getElementById('txtCompanyCode');
	var iIndex = -1;
	var sData;
	var aData;

	iIndex = oSelect.selectedIndex;
	if (iIndex > -1) {
		sData = oSelect.options[iIndex].value;
		aData = sData.split('|');
		oText.value = aData[0];
	}
}

function BookRide_SelectAccount(sAccountCode) {
	var oSelect;
	var iIndex;
	var sData;
	var aData;

	oSelect = document.getElementById(sTagPrefix + 'selAccountCode');
	iIndex = -1
	for (i=0; i<oSelect.options.length; i++) {
		sData = oSelect.options[i].value;
		aData = sData.split('|');
		if (aData[0] == sAccountCode) {
			iIndex = i;
		}
	}
	oSelect.selectedIndex = iIndex;	
	BookRide_AccountSelected();
}

function BookRide_AccountOnChange() {
	BookRide_AccountSelected()
	BookRide_LookupProfileAccountData('ACCT');
}

function BookRide_AccountSelected() {
	var oSelect;
	var oText;
	var sData;
	var aData;

	oSelect = document.getElementById(sTagPrefix + 'selAccountCode');
	iIndex = oSelect.selectedIndex;
	if (iIndex > -1) {
		sData = oSelect.options[iIndex].value;
		aData = sData.split('|');
		oText = document.getElementById('txtAccountCode');
		oText.value = aData[0];
	}
}

function BookRide_ProfileOnChange() {
	BookRide_ProfileSelected()
	BookRide_LookupProfileAccountData('PROF');
}

function BookRide_ProfileSelected() {
	var oSelect;
	var iIndex;
	var sData;

	oSelect = document.getElementById(sTagPrefix + 'selProfileID');
	iIndex = oSelect.selectedIndex;
	if (iIndex > 0) {
		sData = oSelect.options[iIndex].value;
	}
	else {
		sData = '||||||||||';
	}
	BookRide_ProcessPsgrProfileData(sData);
}

function BookRide_LoadShuttleStops() {
	var oSelect;
	var oText;
	var iIndex = -1;
	var sAirportData = '';
	var aAirportData;
	var sAirportCode = '';
	var sStopList = '';
	var aStopList;
	var sStop = '';
	var aStop;
	var i = 0;
	var oOption
	
	oSelect = document.getElementById(sTagPrefix + 'selShAirport');
	iIndex = oSelect.selectedIndex;
	if (iIndex > -1) {
		sAirportData = oSelect.options[iIndex].value;
		aAirportData = sAirportData.split('|');
		sAirportCode = aAirportData[16];
	}

	oSelect = document.getElementById('selShuttleStop');
	while (oSelect.options.length > 0) {
		oSelect.removeChild(oSelect.firstChild);
	}
		
	if (sAirportCode.length > 0) {
		oText = document.getElementById(sTagPrefix + 'txtShuttleStopData');
		sStopList = oText.value;
		if (sStopList != '') {
			aStopList = sStopList.split('~');
			if (aStopList.length > 0) {
				for (i=1; i<aStopList.length; i++) {
					sStop = aStopList[i];
					aStop = sStop.split('`');
					if (aStop[0] == sAirportCode) { 
						oOption = document.createElement('OPTION');
						oSelect.options.add(oOption);
						oOption.value = aStop[2];
						oOption.innerHTML = aStop[1];
					}
				}
			} 
		}
	}
	BookRide_ResetShuttleStops();
}

function BookRide_SelectShuttleStop(oInput) {
	if (oInput != null) {
		var sTemp = oInput.value;
		var aTemp = sTemp.split('~');

		BookRide_ShuttleStopValue = aTemp[0];
		BookRide_ShuttleStopTime = aTemp[1];
	}	
}

function BookRide_ResetShuttleStops() {
	if (BookRide_ShuttleService != 'N') {
		BookRide_BookNowSetDisabled(true);
		SetDisplay('idShuttleAvailabilityRow', 'none');
		SetDisplay('idShuttleAvailabilityMsgRow', 'none');
	}
}

function BookRide_SelectLocType(sPUDO, sLocType) {
	var oSelect;
	var nStopNo;

	switch (sPUDO) {
		case 'P':
			SetDisplay('rowPickupLocProfile', 'none');
			SetDisplay('rowPickupLocLandmark', 'none');
			SetDisplay('rowPickupLocAirport', 'none');
			SetDisplay('rowPickupLocOther', 'none');
			switch (sLocType) {
				case 'P': SetDisplay('rowPickupLocProfile', ''); break;
				case 'L': SetDisplay('rowPickupLocLandmark', ''); break;
				case 'A': SetDisplay('rowPickupLocAirport', ''); break;
				case 'O': SetDisplay('rowPickupLocOther', ''); break;
			}			
			if (sLocType == 'A' || sLocType == 'L')
				SetInputTextReadOnly('txtPickupDirection');			
			else
				ResetInputTextReadOnly('txtPickupDirection');
			break;
		case 'D':
			SetDisplay('rowDropoffLocProfile', 'none');
			SetDisplay('rowDropoffLocLandmark', 'none');
			SetDisplay('rowDropoffLocAirport', 'none');
			SetDisplay('rowDropoffLocOther', 'none');
			SetDisplay('rowDropoffLocAsDir', 'none');
			switch (sLocType) {
				case 'P': SetDisplay('rowDropoffLocProfile', ''); break;
				case 'L': SetDisplay('rowDropoffLocLandmark', ''); break;
				case 'A': SetDisplay('rowDropoffLocAirport', ''); break;
				case 'O': SetDisplay('rowDropoffLocOther', ''); break;
				case 'A': SetDisplay('rowDropoffLocAsDir', ''); break;
			}			
			break;
		case 'S1': 
		case 'S2': 
		case 'S3': 
		case 'S4': 
		case 'S5':
			nStopNo = String(sPUDO).substr(1,1);						
			SetDisplay('rowStop' + nStopNo + 'LocProfile', 'none');
			SetDisplay('rowStop' + nStopNo + 'LocLandmark', 'none');
			SetDisplay('rowStop' + nStopNo + 'LocAirport', 'none');
			SetDisplay('rowStop' + nStopNo + 'LocOther', 'none');
			switch (sLocType) {
				case 'P': SetDisplay('rowStop' + nStopNo + 'LocProfile', ''); break;
				case 'L': SetDisplay('rowStop' + nStopNo + 'LocLandmark', ''); break;
				case 'A': SetDisplay('rowStop' + nStopNo + 'LocAirport', ''); break;
				case 'O': SetDisplay('rowStop' + nStopNo + 'LocOther', ''); break;
				default: SetDisplay('rowStop' + nStopNo + 'LocOther', ''); break;
			}
			break;						
	}

	BookRide_SelectLocation(sPUDO, sLocType);
	BookRide_HidePriceQuoteSection();
}

function BookRide_SelectLocation(sPUDO, sLocType) {
	var oSelect;
	var oLabel;
	var nStopNo;
	switch (sPUDO) {
		case 'P':
			oSelect = document.getElementById(sTagPrefix + 'selPickupLocProfile');
			oLabel = document.getElementById('lblPickupLocProfileDesc');			
			break;
		case 'D':
			oSelect = document.getElementById(sTagPrefix + 'selDropoffLocProfile');			
			oLabel = document.getElementById('lblDropoffLocProfileDesc');		
			break;
		case 'S1':
		case 'S2':
		case 'S3':
		case 'S4':
		case 'S5':
			nStopNo = String(sPUDO).substr(1,1);
			oSelect = document.getElementById(sTagPrefix + 'selS' + nStopNo + 'LocProfile');
			oLabel = document.getElementById('lblS' + nStopNo + 'LocProfileDesc');			
			break;
	}	
	BookRide_SetLocDesc(sPUDO, sLocType, oSelect, oLabel); 	
}

function BookRide_SetLocDesc(sPUDO, sLocType, oSelect, oDesc) {
	var iIndex = -1;
	var sData = '';
	var sDesc = '';
	
	switch (sLocType) {
		case 'P':
			iIndex = oSelect.selectedIndex;
			if (iIndex >= 0) {
				sData = oSelect.options[iIndex].value;
				sDesc = GetLocationDesc(sData);
			}
			oDesc.innerHTML = sDesc;
			break;
	}
}

function BookRide_SelectPaymentMethod() {
	var oSelect = document.getElementById(sTagPrefix + 'selPaymentType');
	var iIndex = oSelect.selectedIndex;
	var sOption = '';
	var oTable = document.getElementById('tblCCSource');
	
	if (iIndex > -1) {
		sOption = oSelect.options[iIndex].value;
		sOption = sOption.substr(3, 2); //sOption = sOption.substr(0, 5);		
	}	
	if (sOption == 'CC') { //if (sOption == 'CC|0|') {
		oTable.style.display = 'block';
		BookRide_SelectCCSource();
	}
	else {
		//oTable.style.display = 'none';
		SetDisplay('tblCCSource', 'none');
		SetDisplay('tblOtherCreditCard', 'none');
	}
}

function BookRide_SelectCCSource() {
	var oSelect = document.getElementById(sTagPrefix + 'selCCSource');
	var iIndex = oSelect.selectedIndex;
	var sOption = '';
	var oTable = document.getElementById('tblOtherCreditCard');
	
	if (iIndex > -1) {
		sOption = oSelect.options[iIndex].value;		
		sOption = sOption.substr(0, 2);	//sOption = sOption.substr(0, 5);
	}	
	
	if (sOption == '||') {	//if (sOption == 'CC|0|') {
		//oTable.style.display = 'block';
		if (oSelect.options.length == 1) {
			SetDisplay('tblCCSource', 'none');
			SetDisplay('CCSourceZipcode', 'none');		
			SetDisplay('tblOtherCreditCard', '');
		}	
		else {
			if (iIndex == 0) {
				SetDisplay('CCSourceZipcode', 'none');
				SetDisplay('tblOtherCreditCard', '');
			}
			else {
				SetDisplay('tblCCSource', '');
				SetDisplay('CCSourceZipcode', '');		
				SetDisplay('tblOtherCreditCard', 'none');
			}
		}
	}
	else {
		oTable.style.display = 'none';
		SetDisplay('CCSourceZipcode', '');		
	}
}

function GetRadioButtonGroupValue(sTagName) {
	var sValue = '';
	var aInputs = document.getElementsByName(sTagName);
	var i;
	for (i=0; i<aInputs.length; i++) {
		if (aInputs[i].checked == true) {
			sValue = aInputs[i].value;
		}
	}
	return sValue;
}

function BookRide_SubmitData() {
	var i;
	var sTemp;
	var aTemp;
	var oSelect;
	var oInput;
	var oLabel;
	var aInputs;
	var sMsg = '';
	var sBillNotes1 = '';
	var iPsgrCount = 0
	var sFlightTime = sTemp;
	var sFlightType = '';
	var sPUType;
	var sDOType;
	var iIndex;
	var sPsgrType;
	var iIndex;
	var iTotalStops;
	var iTotalPassenger;
	var sStopType;
	var ampmTT = '';

	if (BookRide_SubmitBusy == false) {
		var oInput;			
		
		SetInputTextValue('Submit_RideType', BookRide_RideType);
		
		CopyInputTextValue(sTagPrefix + 'txtPageMode', 'Submit_TxnType')
		CopyInputTextValue(sTagPrefix + 'txtResNo', 'Submit_ResNo')
		CopyInputTextValue(sTagPrefix + 'txtBookingResNo', 'Submit_BookingResNo')

		sPsgrType = GetRadioButtonGroupValue('PsgrType');
		SetInputTextValue('Submit_PsgrType', sPsgrType);

		CopyInputTextValue('txtPsgrFirstName', 'Submit_PsgrFirstName')
		CopyInputTextValue('txtPsgrLastName', 'Submit_PsgrLastName')
		CopyInputTextValue('txtPsgrHomePhone', 'Submit_PsgrHomePhone')
		CopyInputTextValue('txtPsgrWorkPhone', 'Submit_PsgrWorkPhone')
		CopyInputTextValue('txtPsgrCellPhone', 'Submit_PsgrCellPhone')

		oSelect = document.getElementById('selTotalStops');	
		iTotalStops = oSelect.selectedIndex;	
		SetInputTextValue('Submit_TotalStops', iTotalStops);
				
		oSelect = document.getElementById('selTotalPassenger');	
		iTotalPassenger = oSelect.selectedIndex;	
		SetInputTextValue('Submit_TotalExtraPassenger', iTotalPassenger);
		if (iTotalPassenger  > 0)
		{
			for (i=1; i<=iTotalPassenger; i++) 
			{
				CopyInputTextValue('txtFirstName'+(i),'Submit_E' + (i) + 'PassengerFName');
				CopyInputTextValue('txtLastName'+(i),'Submit_E' + (i) + 'PassengerLName');
			}
		}
		///
		
		oInput = document.getElementById('Submit_PsgrFirstName');

		if (BookRide_UseProfiles == 'Y') {
			CopyInputTextValue('txtPsgrFax', 'Submit_PsgrFaxNumber')
			CopyInputTextValue('txtPsgrMobileEmailAddress', 'Submit_PsgrMobileEmailAddress')
			
			oInput = document.getElementById('chkPriority');
			if (oInput.checked == true) 
				SetInputTextValue('Submit_Priority', 'Y');
			else
				SetInputTextValue('Submit_Priority', 'N');			
		}
		else {
			SetInputTextValue('Submit_PsgrFaxNumber', '');
			SetInputTextValue('Submit_PsgrMobileEmailAddress', '');
			SetInputTextValue('Submit_Priority', 'N');
		}
		CopyInputTextValue('txtPsgrEmailAddress', 'Submit_PsgrEmailAddress')

		CopyInputTextValue(sTagPrefix + 'txtContactName', 'Submit_ContactName');
		CopyInputTextValue(sTagPrefix + 'txtContactPhone', 'Submit_ContactPhoneNo');

		if (BookRide_RideType == 'O') {						
				CopyInputTextValue(sTagPrefix + 'txtPickupDate', 'Submit_PickupDate')

				// kng - Military Time Change
				if (BookRide_TimeSetting == 'M')
				{
				oSelect = document.getElementById('selPickupTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;

				if (sTemp>11)
					{
						ampmTT='PM'
						if(sTemp!='12')
						{
							sTemp = parseInt(sTemp) - 12
						}
					}
				else
					{
						ampmTT='AM'
						if(sTemp=='00')
						{
							sTemp = 12
						}
					}

				oSelect = document.getElementById('selPickupTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;

				oSelect = ampmTT;
				sTemp = sTemp + ' ' + oSelect;			
				}
				else
				{			
				oSelect = document.getElementById('selPickupTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selPickupTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selPickupTimeAMPM');
				sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
				}

				/*
				oSelect = document.getElementById('selPickupTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selPickupTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selPickupTimeAMPM');
				sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
				*/

				SetInputTextValue('Submit_PickupTime', sTemp);			

			sPUType = GetRadioButtonGroupValue('PUType');
			
			SetInputTextValue('Submit_PUType', sPUType);				

			if (BookRide_UseProfiles == 'Y') {
				oSelect = document.getElementById(sTagPrefix + 'selPickupLocProfile');
				iIndex = oSelect.selectedIndex;
				if (iIndex > -1) {
					sTemp = oSelect.options[iIndex].value;
				}
				else {
					sTemp = '';
				}
				SetInputTextValue('Submit_PickupLocProfile', sTemp);

				oSelect = document.getElementById(sTagPrefix + 'selDropoffLocProfile');
				iIndex = oSelect.selectedIndex;
				if (iIndex > -1) {
					sTemp = oSelect.options[iIndex].value;
				}
				else {
					sTemp = '';
				}
				SetInputTextValue('Submit_DropoffLocProfile', sTemp);
				
				for (i=1; i<=iTotalStops; i++) {
					oSelect = document.getElementById(sTagPrefix + 'selS' + (i) + 'LocProfile');
					iIndex = oSelect.selectedIndex;					
					if (iIndex > -1) {
						sTemp = oSelect.options[iIndex].value;
					}
					else {
						sTemp = '';
					}						
					SetInputTextValue('Submit_Stop' + (i) + 'LocProfile', sTemp);
				}
			}
			else {
				SetInputTextValue('Submit_PickupLocProfile', '');
				SetInputTextValue('Submit_DropoffLocProfile', '');
				
				for(i=1; i<=iTotalStops; i++) {					
					SetInputTextValue('Submit_Stop' + (i) + 'LocProfile', '');
				}
			}

			sTemp = '';
			CopyInputTextValue('txtPULandmarkValue', 'Submit_PULandmarkValue')

			if (sPUType == 'L') {
				CopyInputTextValue('txtPULandmarkPointInput', 'Submit_PUAddressOnLocation')
			}
			
			oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
			if (oSelect.options.length == 0) {				
				CopyInputTextValue('txtPUAirportValue', 'Submit_PUAirportValue')
			}
			else {
				SetInputTextValue('Submit_PUAirportValue', oSelect.options[oSelect.selectedIndex].value);
			}

			//CopyInputTextValue('txtPUAirportValue', 'Submit_PUAirportValue')
			
			CopyInputTextValue('txtPUAirlineValue', 'Submit_PUAirlineValue')
			CopyInputTextValue('txtPUFlightNumber', 'Submit_PUFlightNumber')

			// kng - Military Time Change
			if (BookRide_TimeSetting == 'M')
			{
				oSelect = document.getElementById('selPUFlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
					
				if (sTemp>11)
					{
						ampmTT='PM'
						if(sTemp!='12')
						{
							sTemp = parseInt(sTemp) - 12
						}
					}
				else
					{
						ampmTT='AM'
						if(sTemp=='00')
						{
							sTemp = 12
						}
					}
					
				oSelect = document.getElementById('selPUFlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
			
				oSelect = ampmTT;
			
				sTemp = sTemp + ' ' + oSelect;
			}
			else
			{
				oSelect = document.getElementById('selPUFlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selPUFlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selPUFlightTimeAMPM');
				sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
			}
			/*
			oSelect = document.getElementById('selPUFlightTimeHours');
			sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selPUFlightTimeMins');
			sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selPUFlightTimeAMPM');
			sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
			*/
			SetInputTextValue('Submit_PUFlightTime', sTemp);

			oSelect = document.getElementById('selPUFlightType');
			sTemp = oSelect.options[oSelect.selectedIndex].value;
			SetInputTextValue('Submit_PUFlightType', sTemp);

			CopyInputTextValue('txtPUFlightOrig', 'Submit_PUFlightOrig')
			if (sPUType == 'A') {
				if (document.getElementById('txtPUAirlineValue').value == '') {
					alert('Warning: Pickup Airline is not entered');
				}
				CopyInputTextValue('txtPUAirportPickupPoint', 'Submit_PUAddressOnLocation')
			}			
			
			CopyInputTextValue('txtPUAddress1', 'Submit_PUAddress1')
			CopyInputTextValue('txtPUAddress2', 'Submit_PUAddress2')
			CopyInputTextValue('txtPURoomNo', 'Submit_PURoomNo')
			//CopyInputTextValue('txtPUAddressCrossStreets', 'Submit_PUAddressCrossStreets')
			CopyInputTextValue('txtPUCity', 'Submit_PUCity')
			CopyInputTextValue('txtPUState', 'Submit_PUState')			
			CopyInputTextValue('txtPUZip', 'Submit_PUZip')
			CopyInputTextValue('txtPUPhone', 'Submit_PUPhone')
			CopyInputTextValue('txtPickupDirection', 'Submit_PUDirection')

			sDOType = GetRadioButtonGroupValue('DOType');
			SetInputTextValue('Submit_DOType', sDOType);

			sTemp = '';
			CopyInputTextValue('txtDOLandmarkValue', 'Submit_DOLandmarkValue')
			if (sDOType == 'L') {
				CopyInputTextValue('txtDOLandmarkPointInput', 'Submit_DOAddressOnLocation')				
			}

			oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
			if (oSelect.options.length == 0) {				
				CopyInputTextValue('txtDOAirportValue', 'Submit_DOAirportValue')
			}
			else {
				SetInputTextValue('Submit_DOAirportValue', oSelect.options[oSelect.selectedIndex].value);
			}			
			//CopyInputTextValue('txtDOAirportValue', 'Submit_DOAirportValue')
			
			CopyInputTextValue('txtDOAirlineValue', 'Submit_DOAirlineValue')
			CopyInputTextValue('txtDOFlightNumber', 'Submit_DOFlightNumber')

			//kng - Military Time Change
			if (BookRide_TimeSetting == 'M')
			{
			oSelect = document.getElementById('selDOFlightTimeHours');
			sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				if (sTemp>11)
					{
						ampmTT='PM'
						if(sTemp!='12')
						{
							sTemp = parseInt(sTemp) - 12
						}
					}
				else
					{
						ampmTT='AM'
						if(sTemp=='00')
						{
							sTemp = 12
						}
					}
			oSelect = document.getElementById('selDOFlightTimeMins');
			sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
			
			oSelect = ampmTT;
				
			sTemp = sTemp + ' ' + oSelect;
			}
			else
			{
			oSelect = document.getElementById('selDOFlightTimeHours');
			sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selDOFlightTimeMins');
			sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selDOFlightTimeAMPM');
			sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
			}
			/*
			oSelect = document.getElementById('selDOFlightTimeHours');
			sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selDOFlightTimeMins');
			sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selDOFlightTimeAMPM');
			sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
			*/			
			SetInputTextValue('Submit_DOFlightTime', sTemp);

			oSelect = document.getElementById('selDOFlightType');
			sTemp = oSelect.options[oSelect.selectedIndex].value;			
			SetInputTextValue('Submit_DOFlightType', sTemp);

			CopyInputTextValue('txtDOFlightDest', 'Submit_DOFlightDest')
			if (sDOType == 'A') {
				if (document.getElementById('txtDOAirlineValue').value == '') {
					alert('Warning: Dropoff Airline is not entered');
				}
				CopyInputTextValue('txtDOAirportDropoffPoint', 'Submit_DOAddressOnLocation')				
			}
						
			CopyInputTextValue('txtDOAddress1', 'Submit_DOAddress1')
			CopyInputTextValue('txtDOAddress2', 'Submit_DOAddress2')
			CopyInputTextValue('txtDORoomNo', 'Submit_DORoomNo')
			//CopyInputTextValue('txtDOAddressCrossStreets', 'Submit_DOAddressCrossStreets')
			CopyInputTextValue('txtDOCity', 'Submit_DOCity')
			CopyInputTextValue('txtDOState', 'Submit_DOState')			
			CopyInputTextValue('txtDOZip', 'Submit_DOZip')
			CopyInputTextValue('txtDOPhone', 'Submit_DOPhone')
			CopyInputTextValue('txtDropoffDirection', 'Submit_DODirection')
			
			oSelect = document.getElementById('selTotalStops');	
			iTotalStops = oSelect.selectedIndex;
			for (i=1; i<=iTotalStops; i++) {			
				sStopType = GetRadioButtonGroupValue('S' + (i) + 'Type');
				SetInputTextValue('Submit_S' + (i) + 'Type', sStopType);
			
				sTemp = '';
				CopyInputTextValue('txtS' + (i) + 'LandmarkValue', 'Submit_S' + (i) + 'LandmarkValue')

				if (sStopType == 'L') {
					CopyInputTextValue('txtS' + (i) + 'LandmarkPointInput', 'Submit_S' + (i) + 'AddressOnLocation')
				}
				CopyInputTextValue('txtS' + (i) + 'AirportValue', 'Submit_S' + (i) + 'AirportValue')
				CopyInputTextValue('txtS' + (i) + 'AirlineValue', 'Submit_S' + (i) + 'AirlineValue')
				CopyInputTextValue('txtS' + (i) + 'FlightNumber', 'Submit_S' + (i) + 'FlightNumber')

			//kng - Military Time Change
			if (BookRide_TimeSetting == 'M')
			{
				oSelect = document.getElementById('selS' + (i) + 'FlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				if (sTemp>11)
					{
						ampmTT='PM'
						if(sTemp!='12')
						{
							sTemp = parseInt(sTemp) - 12
						}
					}
				else
					{
						ampmTT='AM'
						if(sTemp=='00')
						{
							sTemp = 12
						}
					}
				
				oSelect = document.getElementById('selS' + (i) + 'FlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				
				oSelect = ampmTT;
				
				sTemp = sTemp + ' ' + oSelect;
				SetInputTextValue('Submit_S' + (i) + 'FlightTime', sTemp);
			}
			else
			{
				oSelect = document.getElementById('selS' + (i) + 'FlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selS' + (i) + 'FlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selS' + (i) + 'FlightTimeAMPM');
				sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
				SetInputTextValue('Submit_S' + (i) + 'FlightTime', sTemp);
			}

				oSelect = document.getElementById('selS' + (i) + 'FlightType');
				sTemp = oSelect.options[oSelect.selectedIndex].value;
				SetInputTextValue('Submit_S' + (i) + 'FlightType', sTemp);

				CopyInputTextValue('txtS' + (i) + 'FlightOrig', 'Submit_S' + (i) + 'FlightOrig')
				if (sStopType == 'A') {
					CopyInputTextValue('txtS' + (i) + 'AirportPickupPoint', 'Submit_S' + (i) + 'AddressOnLocation')
				}			
				
				CopyInputTextValue('txtS' + (i) + 'Address1', 'Submit_S' + (i) + 'Address1')
				CopyInputTextValue('txtS' + (i) + 'Address2', 'Submit_S' + (i) + 'Address2')
				CopyInputTextValue('txtS' + (i) + 'RoomNo', 'Submit_S' + (i) + 'RoomNo')
				//CopyInputTextValue('txtS' + (i) + 'AddressCrossStreets', 'Submit_S' + (i) + 'AddressCrossStreets')
				CopyInputTextValue('txtS' + (i) + 'City', 'Submit_S' + (i) + 'City')
				CopyInputTextValue('txtS' + (i) + 'State', 'Submit_S' + (i) + 'State')				
				CopyInputTextValue('txtS' + (i) + 'Zip', 'Submit_S' + (i) + 'Zip')
				CopyInputTextValue('txtS' + (i) + 'Phone', 'Submit_S' + (i) + 'Phone')
			}
		}
		else {
			SetInputTextValue('Submit_RoundTripRide', BookRide_RoundTrip);
			if (BookRide_RoundTrip == 'Y') {
				SetInputTextValue('Submit_LastRideDateTime', BookRide_LastRideDateTime);
			}

			CopyInputTextValue(sTagPrefix + 'txtShFlightDate', 'Submit_PickupDate')
			SetInputTextValue('Submit_PickupTime', BookRide_ShuttleStopTime);

			SetInputTextValue('Submit_PickupLocProfile', '');
			SetInputTextValue('Submit_DropoffLocProfile', '');

			//kng - Military Time Change
			if (BookRide_TimeSetting == 'M')
			{
				oSelect = document.getElementById('selShFlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				if (sTemp>11)
					{
						ampmTT='PM'
						if(sTemp!='12')
						{
							sTemp = parseInt(sTemp) - 12
						}
					}
				else
					{
						ampmTT='AM'
						if(sTemp=='00')
						{
							sTemp = 12
						}
					}
				
				oSelect = document.getElementById('selShFlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				
				oSelect = ampmTT;
				
				sTemp = sTemp + ' ' + oSelect;
				sFlightTime = sTemp;
			}
			else
			{
				oSelect = document.getElementById('selShFlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selShFlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selShFlightTimeAMPM');
				sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
				sFlightTime = sTemp;
			}
			
			/*
			oSelect = document.getElementById('selShFlightTimeHours');
			sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selShFlightTimeMins');
			sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selShFlightTimeAMPM');
			sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
			sFlightTime = sTemp;
			*/

			oSelect = document.getElementById('selShFlightType');
			sFlightType = oSelect.options[oSelect.selectedIndex].value;

			if (BookRide_RideType == 'T') {
				//Shuttle ride to airport
				SetInputTextValue('Submit_PUType', 'L');
				oSelect = document.getElementById('selShuttleStop');
				SetInputTextValue('Submit_PULandmarkValue', oSelect.options[oSelect.selectedIndex].value);

				SetInputTextValue('Submit_DOType', 'A');
				oSelect = document.getElementById(sTagPrefix + 'selShAirport');
				SetInputTextValue('Submit_DOAirportValue', oSelect.options[oSelect.selectedIndex].value);
				oSelect = document.getElementById(sTagPrefix + 'selShAirline');
				SetInputTextValue('Submit_DOAirlineValue', oSelect.options[oSelect.selectedIndex].value);
				CopyInputTextValue('txtShFlightNumber', 'Submit_DOFlightNumber');
				SetInputTextValue('Submit_DOFlightTime', sFlightTime);
				SetInputTextValue('Submit_DOFlightType', sFlightType);
				CopyInputTextValue('txtShTerminal', 'Submit_DOAddressOnLocation');			

				if (BookRide_RoundTrip == 'N') {
					oInput = document.getElementById('Submit_PickupDate');
					BookRide_LastRideDateTime = oInput.value + ' ' + sFlightTime;
				}
			}
			else {
				//Shuttle ride from airport
				SetInputTextValue('Submit_PUType', 'A');
				oSelect = document.getElementById(sTagPrefix + 'selShAirport');
				SetInputTextValue('Submit_PUAirportValue', oSelect.options[oSelect.selectedIndex].value);
				oSelect = document.getElementById(sTagPrefix + 'selShAirline');
				//SetInputTextValue('Submit_PUAirlineValue', oSelect.options[oSelect.selectedIndex].value);
				CopyInputTextValue('txtShFlightNumber', 'Submit_PUFlightNumber')
				SetInputTextValue('Submit_PUFlightTime', sFlightTime);
				SetInputTextValue('Submit_PUFlightType', sFlightType);
				CopyInputTextValue('txtShTerminal', 'Submit_PUAddressOnLocation');			

				SetInputTextValue('Submit_DOType', 'L');
				oSelect = document.getElementById('selShuttleStop');
				SetInputTextValue('Submit_DOLandmarkValue', oSelect.options[oSelect.selectedIndex].value);

				if (BookRide_RoundTrip == 'N') {
					oInput = document.getElementById('Submit_PickupDate');
					BookRide_LastRideDateTime = oInput.value + ' ' + BookRide_ShuttleStopTime;
				}
			}
			
			sBillNotes1 = 'S';

			iPsgrCount = 0;
			oSelect = document.getElementById('selPsgrCountFullFare');
			iPsgrCount += oSelect.selectedIndex;
			sBillNotes1 = sBillNotes1 + '|' + oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selPsgrCountMilitary');
			iPsgrCount += oSelect.selectedIndex;
			sBillNotes1 = sBillNotes1 + '|' + oSelect.options[oSelect.selectedIndex].innerHTML;
			sBillNotes1 = sBillNotes1 + '|0';
			oSelect = document.getElementById('selPsgrCountSenior');
			iPsgrCount += oSelect.selectedIndex;
			sBillNotes1 = sBillNotes1 + '|' + oSelect.options[oSelect.selectedIndex].innerHTML;
			oSelect = document.getElementById('selPsgrCountStudent');
			iPsgrCount += oSelect.selectedIndex;
			sBillNotes1 = sBillNotes1 + '|' + oSelect.options[oSelect.selectedIndex].innerHTML;
							
			if (BookRide_RideType == 'T') {
				sBillNotes1 = sBillNotes1 + '|D';
			}
			else {
				sBillNotes1 = sBillNotes1 + '|A';
			}

			if (BookRide_RideType == 'T') {
				oInput = document.getElementById('Submit_PULandmarkValue');
				sTemp = oInput.value;
			}
			else {
				oInput = document.getElementById('Submit_PUAirportValue');
				sTemp = oInput.value;
			}
			aTemp = sTemp.split('|');
			sBillNotes1 = sBillNotes1 + '|' + aTemp[3];
				
			if (BookRide_RideType == 'T') {
				oInput = document.getElementById('Submit_DOAirportValue');
				sTemp = oInput.value;
			}
			else {
				oInput = document.getElementById('Submit_DOLandmarkValue');
				sTemp = oInput.value;
			}
			aTemp = sTemp.split('|');
			sBillNotes1 = sBillNotes1 + '|' + aTemp[3];

			oInput = document.getElementById('txtBillingZipCode');
			SetInputTextValue('Submit_CCBillingZipCode', oInput.value);
			sBillNotes1 = sBillNotes1 + '|' + oInput.value;

			SetInputTextValue('Submit_BillNotes1', sBillNotes1);
			SetInputTextValue('Submit_BillNotes2', BookRide_ShuttleStopValue);
		}
	
		if (BookRide_IsDelegate == 'Y') {
			CopyInputTextValue(sTagPrefix + 'txtDelegateID', 'Submit_DelegateID');
			CopyInputTextValue('txtAccountCode', 'Submit_AccountCode');
			CopyInputTextValue('txtProfileID', 'Submit_ProfileID')
		}

		CopyInputTextValue('txtDOMinHours', 'Submit_DOMinHours')

		if (BookRide_AllowVendorSelection == 'Y'){
			oSelect = document.getElementById(sTagPrefix + 'selServiceProvider');
			SetInputTextValue('Submit_ServiceProvider', oSelect.options[oSelect.selectedIndex].value);
		}

		oSelect = document.getElementById(sTagPrefix + 'selVehicleType');
		SetInputTextValue('Submit_VehicleType', oSelect.options[oSelect.selectedIndex].value);
		
		if (BookRide_RideType == 'O') {
			CopyInputTextValue(sTagPrefix + 'txtNumPassengers', 'Submit_NumPassengers')
		}
		else {
			SetInputTextValue('Submit_NumPassengers', '' + iPsgrCount);
		}
		
		oInput = document.getElementById('chkMeetGreet');
		if (oInput.checked == true) 
			SetInputTextValue('Submit_MeetGreet', 'Y');
		else
			SetInputTextValue('Submit_MeetGreet', 'N');

		oSelect = document.getElementById(sTagPrefix + 'selPaymentType');
		SetInputTextValue('Submit_PaymentType', oSelect.options[oSelect.selectedIndex].value);
		
		oSelect = document.getElementById(sTagPrefix + 'selCCSource');
		if (oSelect != null) {
			if (oSelect.options.length > 0) {
				SetInputTextValue('Submit_CCSource', oSelect.options[oSelect.selectedIndex].value);
								
				CopyInputTextValue('SourceBillingZipCode', 'Submit_CCBillingZipCode')
				
				if (GetInputTextValue('SourceSecurityCode') != '') 
					CopyInputTextValue('SourceSecurityCode', 'Submit_CCCID')
			}
		}		

		oSelect = document.getElementById(sTagPrefix + 'selCreditCardType');
		SetInputTextValue('Submit_CreditCardType', oSelect.options[oSelect.selectedIndex].value);
		
		oSelect = document.getElementById('selCCExpiresMonth');
		sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
		oSelect = document.getElementById('selCCExpiresYear');
		sTemp = sTemp + '/01/' + oSelect.options[oSelect.selectedIndex].innerHTML;
		SetInputTextValue('Submit_CCExpires', sTemp);

		CopyInputTextValue('txtCCNumber', 'Submit_CCNumber')
		CopyInputTextValue('txtCCName', 'Submit_CCName')
		if (GetInputTextValue('txtBillingZipCode') != '') // Only for quickres
			CopyInputTextValue('txtBillingZipCode', 'Submit_CCBillingZipCode')
		
		if (GetInputTextValue('txtCCCID') != '') // Only for quickres
			CopyInputTextValue('txtCCCID', 'Submit_CCCID')

		SetInputTextValue('Submit_UDF1Value', BookRide_GetUDFValue('txtUDF1', 'selUDF1'));
		SetInputTextValue('Submit_UDF2Value', BookRide_GetUDFValue('txtUDF2', 'selUDF2'));
		SetInputTextValue('Submit_UDF3Value', BookRide_GetUDFValue('txtUDF3', 'selUDF3'));
		SetInputTextValue('Submit_UDF4Value', BookRide_GetUDFValue('txtUDF4', 'selUDF4'));
		SetInputTextValue('Submit_UDF5Value', BookRide_GetUDFValue('txtUDF5', 'selUDF5'));

		oLabel = document.getElementById('lblUDF1');
		SetInputTextValue('Submit_UDF1Label', StripBoldTags(oLabel.innerHTML));
		oLabel = document.getElementById('lblUDF2');
		SetInputTextValue('Submit_UDF2Label', StripBoldTags(oLabel.innerHTML));
		oLabel = document.getElementById('lblUDF3');
		SetInputTextValue('Submit_UDF3Label', StripBoldTags(oLabel.innerHTML));
		oLabel = document.getElementById('lblUDF4');
		SetInputTextValue('Submit_UDF4Label', StripBoldTags(oLabel.innerHTML));
		oLabel = document.getElementById('lblUDF5');
		 ('Submit_UDF5Label', StripBoldTags(oLabel.innerHTML));
		
		sTemp = '';
		oSelect = document.getElementById(sTagPrefix + 'selExtraServices');
		for (i=0; i<oSelect.options.length; i++) {
			if (oSelect.options[i].selected == true) {
				sTemp = sTemp + '|' + oSelect.options[i].value;
			}
		}
		SetInputTextValue('Submit_ExtraServices', sTemp);
		
		oSelect = document.getElementById(sTagPrefix + 'selRunType');
		SetInputTextValue('Submit_RunType', oSelect.options[oSelect.selectedIndex].value);
		
		CopyInputTextValue('txtGeneralNotes', 'Submit_GeneralNotes')		
				
		if (sPUType == 'A' && BookRide_FlightInfoRequired == 'V' && BookRide_FlightValid == 'N'){			
			if (GetInputTextValue(sTagPrefix + 'txtPickupDate') != '') {
				var dt1 = new Date(GetInputTextValue(sTagPrefix + 'txtPickupDate'))
				if ( ( (dt1 - new Date()) / 86400000) <= BookRide_ValidateForDays) {			
					if (GetInputTextValue('txtPUFlightNumber').substr(0, 1) != 'N') {
						alert('Please click on "Check Flight" and make sure Flight is Valid');				
						return;			
					}		
				}
			}									
		}

		switch (GetTxnType()) {
			case 'CR': sMsg = 'Submitting changes. Please wait...'; break;
			case 'XL': sMsg = 'Submitting cancel request. Please wait...'; break;
			default: sMsg = 'Submitting ride. Please wait...';
		}
		BookRide_SetMsg('idMsgTableSubmit', 'idMsgCellSubmit', sMsg, 'I');
		BookRide_SubmitBusy = true;


		var frmSubmit = document.getElementById('BookRide_frmSubmit');
		frmSubmit.target = 'BookRide_ifrSubmit';
		frmSubmit.action = 'SubmitRide.aspx';					
		frmSubmit.submit();
	}
}

function StripBoldTags(sText) {
	var sNewText = sText
	var sPrefix;
	
	if (sText.length > 6) {
		sPrefix = sText.substr(0, 3);
		if ((sPrefix == '<b>') || (sPrefix == '<B>')) {
			sNewText = sText.substr(3, sText.length - 7);
		}
	} 

	return sNewText;
}

function GetUDFLabel(sText) {
	if (sText.length > 0) {
		var iPos = sText.indexOf(':');
		return sText.substr(0, iPos);
	}
	else {
		return '';
	}
}

function BookRide_ReturnResult(sResult) {
	var sMsg = '';
	var oButton1 = document.getElementById('BookRide_btnSubmit');
	var oButton2 = document.getElementById('BookRide_btnClose');
	var aResult;
	var i;
	var sTxnType = '';
		
	BookRide_SubmitBusy = false;
	BookRide_ClearErrorLabels();
	
	aResult = sResult.split("|");
	
	if (aResult[0] == 'ERROR') {
		if (aResult.length > 2) {
			for (i=2; i<aResult.length; i++) {
				BookRide_SetErrorLabel(aResult[i]);
			}
		}
		BookRide_SetMsg('idMsgTableSubmit', 'idMsgCellSubmit', aResult[1], 'E');
	}
	else {
		SetDisplay('rowBRRideType', 'none');
		SetDisplay('rowBRSectionCompany', 'none');
		SetDisplay('rowBRSectionContactInfo', 'none');
		SetDisplay('rowBRSectionPassenger', 'none');
		SetDisplay('rowBRSectionPassengerCounts', 'none');
		SetDisplay('rowBRSectionShuttleAirport', 'none');
		SetDisplay('rowBRSectionShuttleFlight', 'none');
		SetDisplay('rowBRSectionShuttleStop', 'none');
		SetDisplay('rowBRSectionExtraServices', 'none');
		SetDisplay('rowBRSectionPickupDate', 'none');
		SetDisplay('rowBRSectionPickup', 'none');
		SetDisplay('rowBRSectionPickupDir', 'none');
		SetDisplay('rowBRSectionDropoff', 'none');
		SetDisplay('rowBRSectionDropoffDir', 'none');
		
		SetDisplay('rowBRSectionExtraPassenger', 'none');							
		SetDisplay('rowBRSectionExtraPassenger1', 'none');
		SetDisplay('rowBRSectionExtraPassenger2', 'none');
		SetDisplay('rowBRSectionExtraPassenger3', 'none');
		SetDisplay('rowBRSectionExtraPassenger4', 'none');
		SetDisplay('rowBRSectionExtraPassenger5', 'none');
				
		SetDisplay('rowBRSectionStops', 'none');							
		SetDisplay('rowBRSectionStop1', 'none');
		SetDisplay('rowBRSectionStop2', 'none');
		SetDisplay('rowBRSectionStop3', 'none');
		SetDisplay('rowBRSectionStop4', 'none');
		SetDisplay('rowBRSectionStop5', 'none');

		SetDisplay('rowBRSectionPreferences', 'none');
		SetDisplay('rowBRSectionPayment', 'none');
		SetDisplay('rowBRSectionAccounting', 'none');
		SetDisplay('rowBRSectionNotes', 'none');
		
		if (BookRide_RoundTrip == 'Y') {
			SetDisplay('BookRide_btnRoundTrip', 'none');
		}
		else {
			if (BookRide_TaxiSite == 'Y') {
				SetDisplay('BookRide_btnRoundTrip', 'none');
			}
			else {
				SetDisplay('BookRide_btnRoundTrip', '');
			}
		}

		sTxnType = GetTxnType();
		switch (sTxnType) {
			case 'CR':
				sMsg = 'Changes have been submitted.'; 
				BookRide_SetMsg('idMsgTableChangeResult', 'idMsgCellChangeResult', sMsg, 'S');
				BookRide_ShowResultRow('BookRide_rowChangeResult');
				break;
			case 'XL': 
				sMsg = 'Cancel request has been submitted.'; 
				BookRide_SetMsg('idMsgTableChangeResult', 'idMsgCellChangeResult', sMsg, 'S');
				BookRide_ShowResultRow('BookRide_rowChangeResult');
				break;
			default: 
				//sMsg = '<font size="+1">Your ride has been booked. Your confirmation number is <b>' + aResult[1] + '</b>.</font>';
				sMsg = aResult[2];
				BookRide_SetMsg('idMsgTableBookResult', 'idMsgCellBookResult', sMsg, 'S');
				BookRide_ShowResultRow('BookRide_rowBookResult');
		}
		
		var oCell = document.getElementById('idRideDetailBodyCell');
		RideDetails_Show('', aResult[1], '', oCell);
		
		SetDisplay('rowRideDetailPrint', '');
	}
}

function BookRide_ClearErrorLabels() {
	var i;	
	var oLabel;
	var aLabels;

	aLabels = document.getElementsByTagName('LABEL');
	for(i=0; i<aLabels.length; i++ ) {
		oLabel = aLabels[i];
		if (oLabel.className == 'FieldLabelError') {
			oLabel.className = 'FieldLabel';
		}
	}
}

function BookRide_SetErrorLabel(sID) {
	var oLabel = document.getElementById(sID);

	if (oLabel != null) {
		oLabel.className = 'FieldLabelError';
	}
}

function BookRide_CheckMsg() {
	var oInput = document.getElementById(sTagPrefix + 'txtMsg');
	var sMsg = '';

	if (oInput != null) {
		sMsg = oInput.value;
	}
	if (sMsg.length > 0) {
		BookRide_SetMsg('idMsgTableSubmit', 'idMsgCellSubmit', sMsg, 'E');
	}
}

function BookRide_SetMsg(sTableID, sCellID, sMsg, sType) {
	var oTable = document.getElementById(sTableID);
	var oCell = document.getElementById(sCellID);	
	oCell.innerHTML = sMsg;	
	
	switch (sType) {
		case 'I':
			oTable.className = 'BookRide_BookInfoMsg';
			break;
		case 'S':
			oTable.className = 'BookRide_BookSuccessMsg';
			break;
		case 'E':
			oTable.className = 'ErrorMsg';
			break;
		default:
			oTable.className = 'BlankMsg';
			break;
	}
}

function BookRide_ShowResultRow(sRowID) {
	var oRow = document.getElementById(sRowID);
	
	if (oRow.style.display == 'none') {
		SetDisplay('BookRide_rowSubmit', 'none');
		SetDisplay('BookRide_rowBookResult', 'none');
		SetDisplay('BookRide_rowChangeResult', 'none');

		SetDisplay(sRowID, '');
	}
}

function ShowPopUpCalendar(sID, sFormat) {
	var oCtl = document.getElementById(sTagPrefix + sID);
	popUpCalendar(oCtl,	oCtl, sFormat);
	BookRide_ResetShuttleStops();
 }

function BookRide_UpdateCCNumberDesc() {
	var oText = document.getElementById('txtCCNumber');
	var sText = oText.value;
	var sLabel = '';
	
	if (sText.length == 0) {
		sLabel = '';
	}
	else {
		sLabel = 'Card number ends with ' + sText.substr(sText.length - 4, 4)
	}
	
	SetLabelText('lblCCNumberDesc', sLabel);
}

function GetTxnType() {
	var oText = document.getElementById(sTagPrefix + 'txtPageMode');
	return oText.value;
}

function ShowHelp(oTag) {
	var oHelp = document.getElementById('idBookRideDynamicHelp');
	var sHTML = '';
	var sTemp = '';
	var sID = '';
	
	sTemp = oTag.id;
	sID = sTemp.substr(sTagPrefix.length);
	
	switch (sID) {
		case 'txtPickupTime': sHTML = 'Format = "HH:MM"'; break;
	}

	if (sHTML != '') {
		oHelp.innerHTML = sHTML;
		oHelp.style.display = 'block';
	}
}

function HideHelp() {
	var oHelp = document.getElementById('idBookRideDynamicHelp');
	oHelp.style.display = 'none';
}

function SetInputDisable(bDisable) {
	var i;	
	var oTag;
	var bChecked;
	var aTags;

	aTags = document.getElementsByTagName('INPUT');
	for (i=0; i<aTags.length; i++) {
		oTag = aSelects[i];
		if (oTag.type != 'button') {
			oTag.disabled = bDisable;
		}
	}

	aTags = document.getElementsByTagName('SELECT');
	for (i=0; i<aTags.length; i++) {
		oTag = aSelects[i];
		oTag.disabled = bDisable;
	}
	
	oTag = document.getElementById('idPickupDateLink');
	if (bDisable == true) {
		oTag.style.visibility = 'hidden';
	}
	else {
		oTag.style.visibility = 'visible';
	}
}

function BookRide_ClickNewRide() {
	var oCell = document.getElementById('idRideDetailBodyCell');
	oCell.innerHTML = '';
	SetDisplay('rowRideDetailPrint', 'none');

	if (BookRide_UseProfiles == 'N') {
		window.location = 'QuickRes.aspx';
	}
	else {
		window.location = 'BookRide.aspx';
	}
}

function BookRide_ClickRoundTrip() {
	var sRideType = BookRide_RideType;
	var oInput;
	var oSelect;
	var aData;
	var iIndex;

	var oCell = document.getElementById('idRideDetailBodyCell');
	oCell.innerHTML = '';
	SetDisplay('rowRideDetailPrint', 'none');
	
	BookRide_RoundTrip = 'Y';
	if (sRideType == 'O') {
		var sPUData;
		var sDOData;
		var sPUDir;
		var sDODir;
		var sType;
		var i;
		var sTemp;
		var aTemp;
		var sData;
		var nStops;
		var nStopCnt;
		var sData1='';
		var sData2='';
		var sData3='';
		var sData4='';
		var sData5='';

		SetInputTextValue(sTagPrefix + 'txtPickupDate', '');
		SetSelectByText('selPickupTimeHours', '--');
		SetSelectByText('selPickupTimeMins', '--');
		SetSelectByText('selPickupTimeAMPM', '--');

		sType = GetRadioButtonGroupValue('PUType');
		switch (sType) {
			case 'P':
				oSelect = document.getElementById(sTagPrefix + 'selPickupLocProfile');
				sPUData = oSelect.options[oSelect.selectedIndex].value;
				break;
			case 'L':
				oInput = document.getElementById('txtPULandmarkValue');
				sTemp = oInput.value;
				if (sTemp.length > 0) {
					aData = sTemp.split('|');
					oInput = document.getElementById('txtPULandmarkPointInput');
					sTemp = oInput.value;
					aData[9] = sTemp;
					
					sData = '';
					for (i=0; i<aData.length; i++) {
						sData = sData + '|' + aData[i];
					}
					sPUData = sData.substr(1);
				}
				else {
					sTemp = '|L|||||||||||||||||||||||||';
				}
				break;
			case 'A':
				oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
				if (oSelect.options.length == 0) {				
					oInput = document.getElementById('txtPUAirportValue');
					sTemp = oInput.value;
				}
				else {					
					sTemp = oSelect.options[oSelect.selectedIndex].value;
				}
				//oInput = document.getElementById('txtPUAirportValue');
				//sTemp = oInput.value;
				
				aData = sTemp.split('|');
				oInput = document.getElementById('txtPUAirlineValue');
				sTemp = oInput.value;
				aTemp = sTemp.split('|');
				if (aTemp.length > 1) {
					aData[18] = aTemp[0];
					aData[19] = aTemp[1];
				}
				else {
					aData[18] = '';
					aData[19] = '';				
				}
				aData[21] = '--:-- --';
				oSelect = document.getElementById('selPUFlightType');
				sTemp = oSelect.options[oSelect.selectedIndex].value;
				aData[22] = sTemp;
				sData = '';
				for (i=0; i<aData.length; i++) {
					sData = sData + '|' + aData[i];
				}
				sPUData = sData.substr(1);
				break;
			default:
				sTemp = '|O|||||||||||||||||||||||||';
				aData = sTemp.split('|');
				oInput = document.getElementById('txtPUAddress1');
				sTemp = oInput.value;
				aTemp = sTemp.split(' ');
				aData[5] = aTemp[0];
				if (aTemp.length > 1) {
					sTemp = aTemp[1];
					for (i=2; i<aTemp.length; i++) {
						sTemp = sTemp + ' ' + aTemp[i];
					}
				}
				else {
					sTemp = '';
				}
				aData[6] = sTemp;
				oInput = document.getElementById('txtPUAddress2');
				aData[7] = oInput.value;
				oInput = document.getElementById('txtPURoomNo');
				aData[10] = oInput.value;
				oInput = document.getElementById('txtPUCity');
				aData[11] = oInput.value;
				oInput = document.getElementById('txtPUState');
				aData[12] = oInput.value;
				oInput = document.getElementById('txtPUZip');
				aData[13] = oInput.value;
				oInput = document.getElementById('txtPUPhone');
				aData[14] = oInput.value;
				sData = '';
				for (i=0; i<aData.length; i++) {
					sData = sData + '|' + aData[i];
				}
				sPUData = sData.substr(1);
		}		
		sPUDir = GetInputTextValue('txtDropoffDirection');		

		sType = GetRadioButtonGroupValue('DOType');
		switch (sType) {
			case 'P':
				oSelect = document.getElementById(sTagPrefix + 'selDropoffLocProfile');
				sDOData = oSelect.options[oSelect.selectedIndex].value;
				break;
			case 'L':
				oInput = document.getElementById('txtDOLandmarkValue');
				sTemp = oInput.value;
				if (sTemp.length > 0) {
					aData = sTemp.split('|');
					oInput = document.getElementById('txtDOLandmarkPointInput');
					sTemp = oInput.value;
					aData[9] = sTemp;
					
					sData = '';
					for (i=0; i<aData.length; i++) {
						sData = sData + '|' + aData[i];
					}
					sDOData = sData.substr(1);
				}
				else {
					sTemp = '|L|||||||||||||||||||||||||';
				}
				break;
			case 'A':							
				oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
				if (oSelect.options.length == 0) {				
					oInput = document.getElementById('txtDOAirportValue');
					sTemp = oInput.value;
				}
				else {					
					sTemp = oSelect.options[oSelect.selectedIndex].value;
				}
			
				//oInput = document.getElementById('txtDOAirportValue');
				//sTemp = oInput.value;
				
				aData = sTemp.split('|');
				oInput = document.getElementById('txtDOAirlineValue');
				sTemp = oInput.value;				
				aTemp = sTemp.split('|');
				if (aTemp.length > 1) {
					aData[18] = aTemp[0];
					aData[19] = aTemp[1];
				}
				else {
					aData[18] = '';
					aData[19] = '';
				}
				aData[21] = '--:-- --';
				oSelect = document.getElementById('selDOFlightType');
				sTemp = oSelect.options[oSelect.selectedIndex].value;
				aData[22] = sTemp;
				sData = '';
				for (i=0; i<aData.length; i++) {
					sData = sData + '|' + aData[i];
				}
				sDOData = sData.substr(1);
				break;
			case 'D':
				sDOData = '|O|||||||||||||||||||||||||';
				break
			default:
				sTemp = '|O|||||||||||||||||||||||||';
				aData = sTemp.split('|');
				oInput = document.getElementById('txtDOAddress1');
				sTemp = oInput.value;
				aTemp = sTemp.split(' ');
				aData[5] = aTemp[0];
				if (aTemp.length > 1) {
					sTemp = aTemp[1];
					for (i=2; i<aTemp.length; i++) {
						sTemp = sTemp + ' ' + aTemp[i];
					}
				}
				else {
					sTemp = '';
				}
				aData[6] = sTemp;
				oInput = document.getElementById('txtDOAddress2');
				aData[7] = oInput.value;
				oInput = document.getElementById('txtDORoomNo');
				aData[10] = oInput.value;
				oInput = document.getElementById('txtDOCity');
				aData[11] = oInput.value;
				oInput = document.getElementById('txtDOState');
				aData[12] = oInput.value;
				oInput = document.getElementById('txtDOZip');
				aData[13] = oInput.value;
				oInput = document.getElementById('txtDOPhone');
				aData[14] = oInput.value;
				sData = '';
				for (i=0; i<aData.length; i++) {
					sData = sData + '|' + aData[i];
				}
				sDOData = sData.substr(1);
		}
		sDODir = GetInputTextValue('txtPickupDirection');		
		
		oSelect = document.getElementById('selTotalStops');	
		nTotalStops = oSelect.selectedIndex;	
		for (nStopCnt=1; nStopCnt<=nTotalStops; nStopCnt++) {
			sType = GetRadioButtonGroupValue('S' + (nStopCnt) + 'Type');
			switch (sType) {
				case 'P':
					oSelect = document.getElementById(sTagPrefix + 'selS' + (nStopCnt) + 'LocProfile');
					sData = '|' + oSelect.options[oSelect.selectedIndex].value;
					break;
				case 'L':
					oInput = document.getElementById('txtS' + (nStopCnt) + 'LandmarkValue');
					sTemp = oInput.value;
					if (sTemp.length > 0) {
						aData = sTemp.split('|');
						oInput = document.getElementById('txtS' + (nStopCnt) + 'LandmarkPointInput');
						sTemp = oInput.value;
						aData[9] = sTemp;
						
						sData = '';
						for (i=0; i<aData.length; i++) {
							sData = sData + '|' + aData[i];
						}						
					}
					else {
						sData = '|L|||||||||||||||||||||||||';
					}
					break;
				case 'A':
					oInput = document.getElementById('txtS' + (nStopCnt) + 'AirportValue');
					sTemp = oInput.value;
					
					aData = sTemp.split('|');
					oInput = document.getElementById('txtS' + (nStopCnt) + 'AirlineValue');
					sTemp = oInput.value;
					aTemp = sTemp.split('|');
					aData[18] = aTemp[0];
					aData[19] = aTemp[1];
					aData[21] = '--:-- --';
					oSelect = document.getElementById('selS' + (nStopCnt) + 'FlightType');
					sTemp = oSelect.options[oSelect.selectedIndex].value;
					aData[22] = sTemp;
					sData = '';
					for (i=0; i<aData.length; i++) {
						sData = sData + '|' + aData[i];
					}					
					break;
				default:
					sTemp = '|O|||||||||||||||||||||||||';
					aData = sTemp.split('|');
					oInput = document.getElementById('txtS' + (nStopCnt) + 'Address1');
					sTemp = oInput.value;
					aTemp = sTemp.split(' ');
					aData[5] = aTemp[0];
					if (aTemp.length > 1) {
						sTemp = aTemp[1];
						for (i=2; i<aTemp.length; i++) {
							sTemp = sTemp + ' ' + aTemp[i];
						}
					}
					else {
						sTemp = '';
					}
					aData[6] = sTemp;
					oInput = document.getElementById('txtS' + (nStopCnt) + 'Address2');
					aData[7] = oInput.value;
					oInput = document.getElementById('txtS' + (nStopCnt) + 'City');
					aData[11] = oInput.value;
					oInput = document.getElementById('txtS' + (nStopCnt) + 'State');
					aData[12] = oInput.value;
					oInput = document.getElementById('txtS' + (nStopCnt) + 'Zip');
					aData[13] = oInput.value;
					sData = '';
					for (i=0; i<aData.length; i++) {
						sData = sData + '|' + aData[i];
					}
					break;
			}			
				switch (nTotalStops - nStopCnt + 1) {
					case 1:
						sData1 = sData.substr(1);	
						break;
					case 2:
						sData2 = sData.substr(1);	
						break;
					case 3:
						sData3 = sData.substr(1);	
						break;
					case 4:
						sData4 = sData.substr(1);	
						break;
					case 5:
						sData5 = sData.substr(1);	
						break;
				}							
		}

		SetupPickupControls(sDOData);
		SetupDropoffControls(sPUData);
		SetInputTextValue('txtPickupDirection', sPUDir) 
		SetInputTextValue('txtDropoffDirection', sDODir) 
								
		SetupStopControls('1', sData1);
		SetupStopControls('2', sData2);
		SetupStopControls('3', sData3);
		SetupStopControls('4', sData4);
		SetupStopControls('5', sData5);
	}
	else {
		if (sRideType == 'T') {
			sRideType = 'F';
			BookRide_SelectOption('optRideTypeFromAirport');
		}
		else {
			sRideType = 'T';
			BookRide_SelectOption('optRideTypeToAirport');
		}
		BookRide_ResetShuttleStops();
		oInput = document.getElementById('txtShFlightNumber');
		oInput.value = '';
	}
	
	BookRide_SetMsg('idMsgTableSubmit', 'idMsgCellSubmit', '', '');
	BookRide_SetMsg('idMsgTableBookResult', 'idMsgCellBookResult', '', '');
	BookRide_SetMsg('idMsgTableChangeResult', 'idMsgCellChangeResult', '', '');
	BookRide_SelectRideType(sRideType);
	SetDisplay('BookRide_rowSubmit', '');
	SetDisplay('BookRide_rowBookResult', 'none');
	SetDisplay('BookRide_rowChangeResult', 'none');
}

function BookRide_ClickSameAs() {
	var sRideType = BookRide_RideType;
	var oInput;
	var oSelect;
	var sType;
	var i;
	var sTemp;
	var aTemp;
	var sData;

	BookRide_RoundTrip = 'N';

	var oCell = document.getElementById('idRideDetailBodyCell');
	oCell.innerHTML = '';
	SetDisplay('rowRideDetailPrint', 'none');

	sType = GetRadioButtonGroupValue('PUType');
	if (sType == 'A') {
		//SetSelectByText('selPUFlightTimeHours', '--');
		//SetSelectByText('selPUFlightTimeMins', '--');
		//SetSelectByText('selPUFlightTimeAMPM', '--');
	}
	sType = GetRadioButtonGroupValue('DOType');
	if (sType == 'A') {
		//SetSelectByText('selDOFlightTimeHours', '--');
		//SetSelectByText('selDOFlightTimeMins', '--');
		//SetSelectByText('selDOFlightTimeAMPM', '--');
	}

	BookRide_SetMsg('idMsgTableSubmit', 'idMsgCellSubmit', '', '');
	BookRide_SetMsg('idMsgTableBookResult', 'idMsgCellBookResult', '', '');
	BookRide_SetMsg('idMsgTableChangeResult', 'idMsgCellChangeResult', '', '');
	BookRide_SelectRideType(sRideType);
	SetDisplay('BookRide_rowSubmit', '');
	SetDisplay('BookRide_rowBookResult', 'none');
	SetDisplay('BookRide_rowChangeResult', 'none');
	BookRide_BookNowSetDisabled(false);
}

function BookRide_ClosePage() {
	if (BookRide_UseProfiles == 'Y') {
		window.close();
	}
	else {
		window.location = 'Dashboard.aspx';
	}
}

function BookRide_CheckShuttleAvailability() {
	var oInput;
	var oSelect;
	var sTemp;
	var aTemp;
	var iIndex = -1;
	var sLandmarkID;
	var iCount = 0;
	var oTable;
	var oCell;
	var ampmTT = '';

	BookRide_BookNowSetDisabled(true);
	SetDisplay('idShuttleAvailabilityRow', 'none');

	oTable = document.getElementById('idMsgTableShuttle');
	oTable.className = 'BookRide_BookInfoMsg';
	oCell = document.getElementById('idMsgCellShuttle');
	oCell.innerHTML = 'Checking for available shuttles...';
	SetDisplay('idShuttleAvailabilityMsgRow', '');
	
	oSelect = document.getElementById('selPsgrCountFullFare');
	SetInputTextValue('SubmitSh_NumFullFare', oSelect.selectedIndex);
	oSelect = document.getElementById('selPsgrCountMilitary');
	SetInputTextValue('SubmitSh_NumMilitary', oSelect.selectedIndex);
	oSelect = document.getElementById('selPsgrCountSenior');
	SetInputTextValue('SubmitSh_NumSenior', oSelect.selectedIndex);
	oSelect = document.getElementById('selPsgrCountStudent');
	SetInputTextValue('SubmitSh_NumStudent', oSelect.selectedIndex);

	oInput = document.getElementById('optRideTypeToAirport');
	if (oInput.checked == true) {
		SetInputTextValue('SubmitSh_RideType', 'T');
	}
	else {
		SetInputTextValue('SubmitSh_RideType', 'F');
	}
	SetInputTextValue('SubmitSh_RoundTripRide', BookRide_RoundTrip);

	oSelect = document.getElementById(sTagPrefix + 'selShAirport');
	iIndex = oSelect.selectedIndex;
	if (iIndex > -1) {
		sTemp = oSelect.options[oSelect.selectedIndex].value;
		aTemp = sTemp.split('|');
		sLandmarkID = aTemp[3];
	}
	else {
		sLandmarkID = '';
	}
	SetInputTextValue('SubmitSh_AirportLandmarkID', sLandmarkID);

	oSelect = document.getElementById('selShuttleStop');
	iIndex = oSelect.selectedIndex;
	if (iIndex > -1) {
		sTemp = oSelect.options[oSelect.selectedIndex].value;
		aTemp = sTemp.split('|');
		sLandmarkID = aTemp[3];
	}
	else {
		sLandmarkID = '';
	}
	SetInputTextValue('SubmitSh_StopLandmarkID', sLandmarkID);

	oSelect = document.getElementById('selShFlightType');
	sTemp = oSelect.options[oSelect.selectedIndex].value;
	SetInputTextValue('SubmitSh_FlightType', sTemp);

	oInput = document.getElementById(sTagPrefix + 'txtShFlightDate');
	sTemp = oInput.value;
	if (sTemp == '') {
		alert('Please enter a Flight Date.');
	}
	else {
		// kng - Military Time Change
		if (BookRide_TimeSetting == 'M')
			{
				oSelect = document.getElementById('selShFlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				if (sTemp>11)
					{
						ampmTT='PM'
						if(sTemp!='12')
						{
							sTemp = parseInt(sTemp) - 12
						}
					}
				else
					{
						ampmTT='AM'
						if(sTemp=='00')
						{
							sTemp = 12
						}
					}
				
				oSelect = document.getElementById('selShFlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				
				oSelect = ampmTT;
				
				sTemp = sTemp + ' ' + oSelect;
			}
			else
			{
				oSelect = document.getElementById('selShFlightTimeHours');
				sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selShFlightTimeMins');
				sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
				oSelect = document.getElementById('selShFlightTimeAMPM');
				sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
			}
	/*
		oSelect = document.getElementById('selShFlightTimeHours');
		sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
		oSelect = document.getElementById('selShFlightTimeMins');
		sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
		oSelect = document.getElementById('selShFlightTimeAMPM');
		sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
	*/	
		
		SetInputTextValue('SubmitSh_FlightDateTime', sTemp);
		
		var frmSubmit = document.getElementById('BookRide_frmSubmitShuttle');
		frmSubmit.target = 'BookRide_ifrSubmitShuttle';
		frmSubmit.action = 'BookRide_Shuttle.aspx';					
		frmSubmit.submit();	
	}	
}

function BookRide_ReturnShuttleAvailability(sResponse) {
	var aResponse;
	var sInput;
	var aInput;
	var oRow;
	var oCell;
	var i;
	var oInput;
	var aInput;
	var oLabel;
	var oBR;
	var oFareCell;
	var sCellHTML = '';

	aResponse = sResponse.split('^');
	if (aResponse[0] != 'ERROR') {
		oRow = document.getElementById('idShuttleAvailabilityMsgRow');
		oRow.style.display = 'none';

		oRow = document.getElementById('idShuttleAvailabilityRow');
		oCell = document.getElementById('idShuttleAvailabilityCell');
		
		while (oCell.childNodes.length > 0) {
			oCell.removeChild(oCell.firstChild);
		}
		
		if (aResponse.length < 2) {
			oRow = document.getElementById('idShuttleAvailabilityMsgRow');
			oCell = document.getElementById('idMsgCellShuttle');
			oCell.innerHTML = 'No Shuttles Available';
			SetDisplay('idShuttleAvailabilityMsgRow', '');
		} 
		else {
			oFareCell = document.getElementById('idShuttleFareCell');
			oFareCell.innerHTML = aResponse[0];
			
			BookRide_BookNowSetDisabled(false);
			
			for (i=1; i<aResponse.length; i++) {
				sInput = aResponse[i];
				aInput = sInput.split('~');
				
				sCellHTML = sCellHTML + '<INPUT name="ShuttleRun" type="radio" tabindex="132" onClick="javascript:BookRide_SelectShuttleStop(this);"';
				sCellHTML = sCellHTML + ' value="' + aInput[0] + '~' + aInput[1] + '"';
				if (i == 1) {
					sCellHTML = sCellHTML + ' checked';
				}
				sCellHTML = sCellHTML + '>';

				sCellHTML = sCellHTML + '<label class="FieldLabel">' + aInput[2] + '</label><br>';
				
				
				//oInput = document.createElement('<INPUT name="ShuttleRun" onClick="javascript:BookRide_SelectShuttleStop(this);">');
				//oInput.type = 'radio';
				//oCell.appendChild(oInput);
				//oInput.value = aInput[0] + '~' + aInput[1];
				//if (i == 1) {
				//	oInput.checked = true;
				//	BookRide_SelectShuttleStop(oInput)
				//}
				
				//oLabel = document.createElement('LABEL');
				//oCell.appendChild(oLabel);
				//oLabel.innerHTML = aInput[2];
				//oLabel.className = 'FieldLabel';
				
				//oBR = document.createElement('BR');
				//oCell.appendChild(oBR);
			}

			oCell.innerHTML = sCellHTML;
			SetDisplay('idShuttleAvailabilityRow', '');
			
			aInput = document.getElementsByName('ShuttleRun');
			if (aInput.length > 0) {
				oInput = aInput[0];
				BookRide_SelectShuttleStop(oInput)
			}
		}
	}
	else {
		oRow = document.getElementById('idShuttleAvailabilityMsgRow');
		oCell = document.getElementById('idMsgCellShuttle');
		oCell.innerHTML = aResponse[1];
		SetDisplay('idShuttleAvailabilityMsgRow', '');
	}

	oRow.style.display = '';
}

function BookRide_BookNowSetDisabled(bDisabled) {
	var oInput = document.getElementById('BookRide_btnSubmit');
	oInput.disabled = bDisabled;
}

function BookRide_ClearExtraServices() {
	var oList = document.getElementById(sTagPrefix + 'selExtraServices');
	var i;
	
	for (i=0; i<oList.options.length; i++) {
		oList.options[i].selected = false;
	}
}

function BookRide_SubmitPageForm() {
	var oForm = document.getElementById('frmPage');
	oForm.submit();
}

function BookRide_LookupProfileAccountData(sMode) {
	var oSelect;
	var iIndex;
	var sData;
	var aData;
	
	SetInputTextValue('Lookup_Mode', sMode);

	CopyInputTextValue(sTagPrefix + 'txtDelegateID', 'Lookup_DelegateID')
	CopyInputTextValue('txtCompanyCode', 'Lookup_CompanyCode')
	
	oSelect = document.getElementById(sTagPrefix + 'selAccountCode');
	iIndex = oSelect.selectedIndex;
	if (iIndex == -1) {
		SetInputTextValue('Lookup_AccountCode', '')
		SetInputTextValue('Lookup_AllowAllProfiles', 'N')
	}
	else {
		sData = oSelect.options[iIndex].value;
		aData = sData.split('|');
		SetInputTextValue('Lookup_AccountCode', aData[0]);
		SetInputTextValue('Lookup_AllowAllProfiles', aData[2]);
	}

	oSelect = document.getElementById(sTagPrefix + 'selProfileID');
	iIndex = oSelect.selectedIndex;
	if (iIndex < 0) {
		SetInputTextValue('Lookup_ProfileID', '')
	}
	else {
		sData = oSelect.options[iIndex].value;
		aData = sData.split('|');
		SetInputTextValue('Lookup_ProfileID', aData[0]);
	}

	if (sMode == 'PUPOINT'){
		CopyInputTextValue('txtPULandmarkValue', 'Lookup_LandmarkID');
		CopyInputTextValue('txtPULandmarkPointValue', 'Lookup_DefaultValue');		
	}

	if (sMode == 'DOPOINT'){
		CopyInputTextValue('txtDOLandmarkValue', 'Lookup_LandmarkID');
		CopyInputTextValue('txtDOLandmarkPointValue', 'Lookup_DefaultValue');		
	}
	
	if (sMode == 'PUAIRPPOINT'){
		oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
		if (oSelect.options.length == 0) {				
			CopyInputTextValue('txtPUAirportValue', 'Lookup_AirportCode')
		}
		else {
			SetInputTextValue('Lookup_AirportCode', oSelect.options[oSelect.selectedIndex].value);
		}		
	}
	
	if (sMode == 'DOAIRPPOINT') {
		oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
		if (oSelect.options.length == 0) {				
			CopyInputTextValue('txtDOAirportValue', 'Lookup_AirportCode')
		}
		else {
			SetInputTextValue('Lookup_AirportCode', oSelect.options[oSelect.selectedIndex].value);
		}			
	}

	var frmSubmit = document.getElementById('BookRide_frmLookup');
	frmSubmit.target = 'BookRide_ifrLookup';
	frmSubmit.action = 'BookRide_Lookup.aspx';					
	frmSubmit.submit();	
}


/*function BookRide_LookupProfileAccountData(sMode) {
	var oSelect;
	var iIndex;
	var sData;
	var aData;
	
	SetInputTextValue('Lookup_Mode', sMode);

	CopyInputTextValue(sTagPrefix + 'txtDelegateID', 'Lookup_DelegateID')
	CopyInputTextValue('txtCompanyCode', 'Lookup_CompanyCode')
	
	oSelect = document.getElementById(sTagPrefix + 'selAccountCode');
	iIndex = oSelect.selectedIndex;
	if (iIndex == -1) {
		SetInputTextValue('Lookup_AccountCode', '')
		SetInputTextValue('Lookup_AllowAllProfiles', 'N')
	}
	else {
		sData = oSelect.options[iIndex].value;
		aData = sData.split('|');
		SetInputTextValue('Lookup_AccountCode', aData[0]);
		SetInputTextValue('Lookup_AllowAllProfiles', aData[2]);
	}

	oSelect = document.getElementById(sTagPrefix + 'selProfileID');
	iIndex = oSelect.selectedIndex;
	if (iIndex < 1) {
		SetInputTextValue('Lookup_ProfileID', '')
	}
	else {
		sData = oSelect.options[iIndex].value;
		aData = sData.split('|');
		SetInputTextValue('Lookup_ProfileID', aData[0]);
	}

	if (sMode == 'PUPOINT'){
		CopyInputTextValue('txtPULandmarkValue', 'Lookup_LandmarkID');
		CopyInputTextValue('txtPULandmarkPointValue', 'Lookup_DefaultValue');		
	}

	if (sMode == 'DOPOINT'){
		CopyInputTextValue('txtDOLandmarkValue', 'Lookup_LandmarkID');
		CopyInputTextValue('txtDOLandmarkPointValue', 'Lookup_DefaultValue');		
	}
	
	if (sMode == 'PUAIRPPOINT'){
		oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
		if (oSelect.options.length == 0) {				
			CopyInputTextValue('txtPUAirportValue', 'Lookup_AirportCode')
		}
		else {
			SetInputTextValue('Lookup_AirportCode', oSelect.options[oSelect.selectedIndex].value);
		}		
	}
	
	if (sMode == 'DOAIRPPOINT') {
		oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
		if (oSelect.options.length == 0) {				
			CopyInputTextValue('txtDOAirportValue', 'Lookup_AirportCode')
		}
		else {
			SetInputTextValue('Lookup_AirportCode', oSelect.options[oSelect.selectedIndex].value);
		}			
	}

	var frmSubmit = document.getElementById('BookRide_frmLookup');
	frmSubmit.target = 'BookRide_ifrLookup';
	frmSubmit.action = 'BookRide_Lookup.aspx';					
	frmSubmit.submit();	
}*/





function BookRide_ReturnProfileAccountData(sResponse) {
	var aResponse;
	var i;
	var sSection;
	var aSection;
	var sSectionID;
	var oSelect;
	var sSelect;
	var oInput;
	
	if (sResponse.length > 0) {		
		aResponse = sResponse.split(String.fromCharCode(204));
		for (i=1; i<aResponse.length; i++) {
			sSection = aResponse[i];			
			//aSection = sSection.split('^');
			aSection = sSection.split(String.fromCharCode(205));
			sSectionID = aSection[0];						
			
			switch (sSectionID) {
				case 'ACCT':
					oSelect = document.getElementById(sTagPrefix + 'selAccountCode');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					BookRide_AccountSelected();
					break;
				case 'PROF':
					oSelect = document.getElementById(sTagPrefix + 'selProfileID');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					BookRide_ProfileSelected();
					break;
				case 'PLOC':
					oSelect = document.getElementById(sTagPrefix + 'selPickupLocProfile');
					oInput = document.getElementById('optPUTypeProfile');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					if (aSection.length > 2) {
						oInput.disabled = false;
						BookRide_SelectLocation('P', 'P')
					}
					else {
						if (oInput.checked == true) {
							BookRide_SelectOption('optPUTypeLandmark');
							BookRide_SelectLocType('P', 'L')
						}
						oInput.disabled = true;
					}

					oSelect = document.getElementById(sTagPrefix + 'selDropoffLocProfile');
					oInput = document.getElementById('optDOTypeProfile');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					if (aSection.length > 2) {
						oInput.disabled = false;
						BookRide_SelectLocation('D', 'P')
					}
					else {
						if (oInput.checked == true) {
							BookRide_SelectOption('optDOTypeLandmark');
							BookRide_SelectLocType('D', 'L')
						}
						oInput.disabled = true;
					}
					
					oSelect = document.getElementById(sTagPrefix + 'selS1LocProfile');
					oInput = document.getElementById('optS1TypeProfile');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					if (aSection.length > 2) {
						oInput.disabled = false;
						BookRide_SelectLocation('S1', 'P')
					}
					else {
						if (oInput.checked == true) {
							BookRide_SelectOption('optS1TypeLandmark');
							BookRide_SelectLocType('S1', 'L')
						}
						oInput.disabled = true;
					}
					
					oSelect = document.getElementById(sTagPrefix + 'selS2LocProfile');
					oInput = document.getElementById('optS2TypeProfile');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					if (aSection.length > 2) {
						oInput.disabled = false;
						BookRide_SelectLocation('S2', 'P')
					}
					else {
						if (oInput.checked == true) {
							BookRide_SelectOption('optS2TypeLandmark');
							BookRide_SelectLocType('S2', 'L')
						}
						oInput.disabled = true;
					}

					oSelect = document.getElementById(sTagPrefix + 'selS3LocProfile');
					oInput = document.getElementById('optS3TypeProfile');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					if (aSection.length > 2) {
						oInput.disabled = false;
						BookRide_SelectLocation('S3', 'P')
					}
					else {
						if (oInput.checked == true) {
							BookRide_SelectOption('optS3TypeLandmark');
							BookRide_SelectLocType('S3', 'L')
						}
						oInput.disabled = true;
					}

					oSelect = document.getElementById(sTagPrefix + 'selS4LocProfile');
					oInput = document.getElementById('optS4TypeProfile');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					if (aSection.length > 2) {
						oInput.disabled = false;
						BookRide_SelectLocation('S4', 'P')
					}
					else {
						if (oInput.checked == true) {
							BookRide_SelectOption('optS4TypeLandmark');
							BookRide_SelectLocType('S4', 'L')
						}
						oInput.disabled = true;
					}
					
					oSelect = document.getElementById(sTagPrefix + 'selS5LocProfile');
					oInput = document.getElementById('optS5TypeProfile');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					if (aSection.length > 2) {
						oInput.disabled = false;
						BookRide_SelectLocation('S5', 'P')
					}
					else {
						if (oInput.checked == true) {
							BookRide_SelectOption('optS5TypeLandmark');
							BookRide_SelectLocType('S5', 'L')
						}
						oInput.disabled = true;
					}
					break;
				case 'VEH':
					SetSelectByValue(sTagPrefix + 'selVehicleType', aSection[1], 0);
					break;
				case 'CCLIST':
					oSelect = document.getElementById(sTagPrefix + 'selCCSource');
					BookRide_UpdateSelectOptions(oSelect, aSection);
				case 'PYMT':
					oSelect = document.getElementById(sTagPrefix + 'selPaymentType');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					BookRide_SelectPaymentMethod();
					break;
				case 'UDF':								
					BookRide_GetAccountingData(aSection[1]);
					break;
				case 'UDFVal1':
					BookRide_InitUDFValue('txtUDF1', 'selUDF1', aSection);
					break;
				case 'UDFVal2':
					BookRide_InitUDFValue('txtUDF2', 'selUDF2', aSection);
					break;
				case 'UDFVal3':
					BookRide_InitUDFValue('txtUDF3', 'selUDF3', aSection);
					break;
				case 'UDFVal4':									
					BookRide_InitUDFValue('txtUDF4', 'selUDF4', aSection);
					break;
				case 'UDFVal5':
					BookRide_InitUDFValue('txtUDF5', 'selUDF5', aSection);
					break;
				case 'PUPOINT':
					SetInputTextValue('txtPickupDirection', aSection[3])
					SetInputTextValue('txtPULandmarkPointValue', aSection[2])					
					SetInputTextValue('txtPULandmarkPointInput', aSection[2])
					break;				
					/*
					oSelect = document.getElementById(sTagPrefix + 'selPUPointLandmark');
					BookRide_UpdateSelectOptions(oSelect, aSection);
					
					if (oSelect.options.length == 0) {
						SetDisplay('rowPUPoint', 'none');
					}
					else {
						SetDisplay('rowPUPoint', '');
					}
					*/
					break;
				case 'DOPOINT':
					SetInputTextValue('txtDropoffDirection', aSection[3])									
					SetInputTextValue('txtDOLandmarkPointInput', aSection[2])
					SetInputTextValue('txtDOLandmarkPointValue', aSection[2])					
					break;
				case 'PUAIRPPOINT':					
					SetInputTextValue('txtPickupDirection', aSection[3])
					SetInputTextValue('txtPUAirportPickupPoint', aSection[2])
					break;
				case 'DOAIRPPOINT':					
					SetInputTextValue('txtDropoffDirection', aSection[3])					
					SetInputTextValue('txtDOAirportDropoffPoint', aSection[2])
					break;
				case 'ERROR':
					break;
			}
		}		
	}
}

function BookRide_InitUDFValue(sTextID, sSelectID, aData) {
	var oSelect = document.getElementById(sSelectID);
	var oText = document.getElementById(sTextID);

	SetDisplay(sTextID, 'none');
	SetDisplay(sSelectID, 'inline');
	oText.value = '[SELECTLIST]';
	BookRide_UpdateSelectOptions(oSelect, aData);
}

function BookRide_GetUDFValue(sTextID, sSelectID) {
	var oText = document.getElementById(sTextID);
	var sValue = oText.value;

	if (sValue == '[SELECTLIST]') {
		var oSelect = document.getElementById(sSelectID);
		var iIndex = oSelect.selectedIndex;
		if (iIndex > 0) {
			sValue = oSelect.options[iIndex].value;
		}
		else {
			sValue = '';
		}
	}
	
	return sValue;
}

function BookRide_UpdateSelectOptions(oSelect, aData) {
	var iSelectedIndex = -1;
	var sOption;
	var aOption;
	var oOption;
	var i;

	if (oSelect != null) {
		while (oSelect.options.length > 0) {
			oSelect.removeChild(oSelect.firstChild);
		}	

		if (aData.length > 2) {
			iSelectedIndex = parseInt(aData[1]);
			for (i=2; i<aData.length; i++) {
				sOption = aData[i];				
				//aOption = sOption.split('~');
				aOption = sOption.split(String.fromCharCode(206));
				oOption = document.createElement('OPTION');
				oSelect.options.add(oOption);
				oOption.value = aOption[0];
				oOption.innerHTML = aOption[1];
			}
		}
		
		if ((oSelect.options.length == 0) || (iSelectedIndex == -1)) {
			oSelect.selectedIndex = -1;
		}
		else {
			oSelect.selectedIndex = iSelectedIndex;
		}
	}
}

function BookRide_ProcessPsgrProfileData(sData) {
	var aData;
	
	if (sData.length == 0) {
		sData = '|||||||||||';
		SetDisplay('idProfileResult', 'inline');
	}
	else {
		SetDisplay('idProfileResult', 'none');
	}

	aData = sData.split('|');

	SetInputTextValue('txtProfileID', aData[0]);
	SetInputTextValue('txtPsgrFirstName', aData[1]);
	SetInputTextValue('txtPsgrLastName', aData[2]);
	if (aData[3] == 'Y') {
		SetInputCheckboxValue('chkPriority', true);
	}
	else {
		SetInputCheckboxValue('chkPriority', false);
	}
	SetInputTextValue('txtPsgrHomePhone', aData[5]);
	SetInputTextValue('txtPsgrWorkPhone', aData[6]);
	SetInputTextValue('txtPsgrFax', aData[7]);
	SetInputTextValue('txtPsgrCellPhone', aData[8]);
	SetInputTextValue('txtPsgrEmailAddress', aData[9]);
	SetInputTextValue('txtPsgrMobileEmailAddress', aData[10]);
}

function BookRide_ClearProfileResult() {
	SetDisplay('idProfileResult', 'none');
	return false;
}

function GetPUPoints(sLandmarkID, sDefaultValue) {
	SetInputTextValue('Lookup_Mode', 'PUPoint');
	SetInputTextValue('Lookup_LandmarkID', sLandmarkID);
	SetInputTextValue('Lookup_DefaultValue', sDefaultValue);

	if (sLandmarkID == '') {
		SetDisplay('rowPUPoint', 'none');
	}
	else {
		var frmSubmit = document.getElementById('BookRide_frmLookup');
		frmSubmit.target = 'BookRide_ifrLookupPUPoint';
		frmSubmit.action = 'BookRide_Lookup.aspx';					
		frmSubmit.submit();	
	}
}

function GetDOPoints(sLandmarkID, sDefaultValue) {
	SetInputTextValue('Lookup_Mode', 'DOPoint');
	SetInputTextValue('Lookup_LandmarkID', sLandmarkID);
	SetInputTextValue('Lookup_DefaultValue', sDefaultValue);

	if (sLandmarkID == '') {
		SetDisplay('rowDOPoint', 'none');
	}
	else {
		var frmSubmit = document.getElementById('BookRide_frmLookup');
		frmSubmit.target = 'BookRide_ifrLookupDOPoint';
		frmSubmit.action = 'BookRide_Lookup.aspx';					
		frmSubmit.submit();	
	}
}

function ShowPsgrCountDisclaimer() {
	alert("Military, Airline employees and Seniors should present ID's at the time of checking-in to receive discounts. Failure to present ID will result in full charge.");
}

function BookRide_CheckFlight(sArriveDepart) {
	var sAirportCodeID = '';
	var sAirlineCodeID = '';
	var sFlightNumberID = '';
	var sAirportCode = '';
	var sAirlineCode = '';
	var sFlightNumber = '';
	var sFlightDate = '';
	var oSelect;
	var iIndex;
	var sOption = '';
	var aOption;
	
	switch(sArriveDepart) {
		case 'A':
			oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
			if (oSelect.options.length == 0) {		
				//sAirportCodeID = 'txtPUAirportValue';		
				sOption = document.getElementById('txtPUAirportValue').value;
				aOption = sOption.split('|');
				sAirportCode = aOption[16];	
			}
			else {
				//sAirportCodeID = sTagPrefix + 'selPUAirport';				
				iIndex = oSelect.selectedIndex;
				sOption = oSelect.options[iIndex].value;
				aOption = sOption.split('|');
				sAirportCode = aOption[16];
			}		
			//sAirportCodeID = 'txtPUAirportValue';
	 		sAirlineCodeID = 'txtPUAirlineValue';
			sFlightNumberID = 'txtPUFlightNumber';
			break;
		case 'D':
			oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
			if (oSelect.options.length == 0) {		
				//sAirportCodeID = 'txtDOAirportValue';		
				sOption = document.getElementById('txtDOAirportValue').value;
				aOption = sOption.split('|');
				sAirportCode = aOption[16];					
			}
			else {
				//sAirportCodeID = sTagPrefix + 'selDOAirport';				
				iIndex = oSelect.selectedIndex;
				sOption = oSelect.options[iIndex].value;
				aOption = sOption.split('|');
				sAirportCode = aOption[16];				
			}					
			//sAirportCodeID = 'txtDOAirportValue';
			sAirlineCodeID = 'txtDOAirlineValue';
			sFlightNumberID = 'txtDOFlightNumber';
			break;
	}	

/*	
	if (sAirportCodeID != '') {
		sOption = document.getElementById(sAirportCodeID).value;
		aOption = sOption.split('|');
		sAirportCode = aOption[16];		
	}
*/
	if (sAirlineCodeID != '') {
		sOption = document.getElementById(sAirlineCodeID).value;		
		aOption = sOption.split('|');
		sAirlineCode = aOption[0];		
	}

	if (sFlightNumberID != '') {
		sFlightNumber = GetInputTextValue(sFlightNumberID);
	}
	sFlightDate = GetInputTextValue(sTagPrefix + 'txtPickupDate');

	SetInputTextValue('SubmitFlight_AirportCode', sAirportCode);
	SetInputTextValue('SubmitFlight_AirlineCode', sAirlineCode);
	SetInputTextValue('SubmitFlight_FlightNumber', sFlightNumber);
	SetInputTextValue('SubmitFlight_FlightDate', sFlightDate);
	SetInputTextValue('SubmitFlight_ArriveDepart', sArriveDepart);

	var frmSubmit = document.getElementById('BookRide_frmSubmitFlight');
	frmSubmit.target = 'BookRide_ifrSubmitFlight';
	frmSubmit.action = 'FlightLookup.aspx';					
	frmSubmit.submit();	
}

function BookRide_ReturnFlightInfo(sResult) {
	var aResult;
	var sOption;
	var aOption;
	var i;
	var sCode = '';
	var sTime = '';
	var sOrig = '';
	var sValue = '';
	var sArrDep = '';
	var sHour = '';
	var sMins = '';
	var sAmPm = '';
	var sType = 'D';

	BookRide_CheckFlightResponse = 'Y';
	
	if (sResult != '') {
		aResult = sResult.split('|');
		for (i=0; i<aResult.length; i++) {
			sOption = aResult[i];
			aOption = sOption.split('^');
			
			sCode = aOption[0];
			sValue = aOption[1];
			
			switch (sCode) {
				case 'ERROR':
					alert(sValue);
					break;
				case 'ARRDEP':
					sArrDep = sValue;
					break;
				case 'ORIG':
					sOrig = sValue;
					break;
				case 'TYPE':
					sType = sValue;
					break;
				case 'TIME':
					sTime = sValue;
					if (sTime.length == 8) {
						sHour = sTime.substr(0, 2);
						sMins = sTime.substr(3, 2);
						sAmPm = sTime.substr(6, 2);
					}
					break;
			}
		}

		switch (sArrDep) {
			case 'A':
				SetInputTextValue('txtPUFlightOrig', sOrig);
				SetSelectByValue('selPUFlightType', sType, -1);
				
					if (BookRide_TimeSetting == 'M')
					{
						if(sAmPm.toUpperCase()=='PM')
						{
							if (sHour.substr(0, 1) == '0') {
								sHour = sHour.substr(1, 1);
							}
							if(sHour!='12')
							{
								sHour = parseInt(sHour) + 12;
							}
						}
						else
						{
							if(sHour=='12')
							{
								sHour = 0;
							}
						}
						
						if(sHour<10)
						{
							sHour = '0' + sHour;
						}
					
						SetSelectByText('selPUFlightTimeHours', sHour);
						SetSelectByText('selPUFlightTimeMins', sMins);
						SetSelectByText('selPUFlightTimeAMPM', sAmPm);
					}
					else
					{
						SetSelectByText('selPUFlightTimeHours', sHour);
						SetSelectByText('selPUFlightTimeMins', sMins);
						SetSelectByText('selPUFlightTimeAMPM', sAmPm);
						/*
						SetSelectByText('selPUFlightTimeHours', sHour);
						SetSelectByText('selPUFlightTimeMins', sMins);
						SetSelectByText('selPUFlightTimeAMPM', sAmPm);
						*/
					}
				
				if (GetSelectText('selPickupTimeHours') == '--' && GetSelectText('selPickupTimeMins') == '--' && GetSelectText('selPickupTimeAMPM') == '--'){
				
					//kng - Military Time Change				
					if (BookRide_TimeSetting == 'M')
					{				
						if(sAmPm.toUpperCase()=='PM')
						{
							if (sHour.substr(0, 1) == '0') {
								sHour = sHour.substr(1, 1);
							}
							if(sHour!='12')
							{
								sHour = parseInt(sHour) + 12;
							}
						}
						else
						{
							if(sHour=='12')
							{
								sHour = 0;
							}
						}
						
						if(sHour<10)
						{
							sHour = '0' + sHour;
						}
												
						SetSelectByText('selPickupTimeHours', sHour);
						SetSelectByText('selPickupTimeMins', sMins);
						SetSelectByText('selPickupTimeAMPM', sAmPm);
					}
					else{
						SetSelectByText('selPickupTimeHours', sHour);
						SetSelectByText('selPickupTimeMins', sMins);
						SetSelectByText('selPickupTimeAMPM', sAmPm);
					}
				}
				BookRide_FlightValid = 'Y';				
				break;
			case 'D':
				SetInputTextValue('txtDOFlightDest', sOrig);
				SetSelectByValue('selDOFlightType', sType, -1);
				
					if (BookRide_TimeSetting == 'M')
					{
						if(sAmPm.toUpperCase()=='PM')
						{
							if (sHour.substr(0, 1) == '0') {
								sHour = sHour.substr(1, 1);
							}
							if(sHour!='12')
							{
								sHour = parseInt(sHour) + 12;
							}
						}
						else
						{
							if(sHour=='12')
							{
								sHour = 0;
							}
						}
						
						if(sHour<10)
						{
							sHour = '0' + sHour;
						}
					
						SetSelectByText('selDOFlightTimeHours', sHour);
						SetSelectByText('selDOFlightTimeMins', sMins);
						SetSelectByText('selDOFlightTimeAMPM', sAmPm);
					}
					else
					{
						SetSelectByText('selDOFlightTimeHours', sHour);
						SetSelectByText('selDOFlightTimeMins', sMins);
						SetSelectByText('selDOFlightTimeAMPM', sAmPm);
					/*
						SetSelectByText('selDOFlightTimeHours', sHour);
						SetSelectByText('selDOFlightTimeMins', sMins);
						SetSelectByText('selDOFlightTimeAMPM', sAmPm);
					*/
					}

				break;
		}
	}
}

function BookRide_CheckRateEstimate(sCallType) {
	var sTemp = '';
	var sPUType = '';
	var sDOType = '';
	
	var oSelect;
	var iIndex;	
	var i;
	var iTotalStops;
	var ampmTT = '';
	
	SetInputTextValue('SubmitRateEstimate_PrcCallType', sCallType);
	
	if (BookRide_IsDelegate == 'Y') {		
		CopyInputTextValue('txtAccountCode', 'SubmitRateEstimate_AccountCode');	
	}		
	
	CopyInputTextValue(sTagPrefix + 'txtPickupDate', 'SubmitRateEstimate_PickupDate')

	// kng - Military Time Change
	if (BookRide_TimeSetting == 'M')
		{
		oSelect = document.getElementById('selPickupTimeHours');
		sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
				if (sTemp>11)
					{
						ampmTT='PM'
						if(sTemp!='12')
						{
							sTemp = parseInt(sTemp) - 12
						}
					}
				else
					{
						ampmTT='AM'
						if(sTemp=='00')
						{
							sTemp = 12
						}
					}
					
		oSelect = document.getElementById('selPickupTimeMins');
		sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
		
		oSelect = ampmTT;
		sTemp = sTemp + ' ' + oSelect;			
		}
	else
	{			
		oSelect = document.getElementById('selPickupTimeHours');
		sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
		oSelect = document.getElementById('selPickupTimeMins');
		sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
		oSelect = document.getElementById('selPickupTimeAMPM');
		sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
	}
	/*
	oSelect = document.getElementById('selPickupTimeHours');
	sTemp = oSelect.options[oSelect.selectedIndex].innerHTML;
	oSelect = document.getElementById('selPickupTimeMins');
	sTemp = sTemp + ':' + oSelect.options[oSelect.selectedIndex].innerHTML;
	oSelect = document.getElementById('selPickupTimeAMPM');
	sTemp = sTemp + ' ' + oSelect.options[oSelect.selectedIndex].innerHTML;
	*/
	SetInputTextValue('SubmitRateEstimate_PickupTime', sTemp);

	oSelect = document.getElementById(sTagPrefix + 'selRunType');
	SetInputTextValue('SubmitRateEstimate_RunType', oSelect.options[oSelect.selectedIndex].value);
		
	oSelect = document.getElementById(sTagPrefix + 'selVehicleType');
	SetInputTextValue('SubmitRateEstimate_VehicleType', oSelect.options[oSelect.selectedIndex].value);
	
	oSelect = document.getElementById(sTagPrefix + 'selPaymentType');
	SetInputTextValue('SubmitRateEstimate_PaymentType', oSelect.options[oSelect.selectedIndex].value);

	oSelect = document.getElementById('selTotalStops');	
	iTotalStops = oSelect.selectedIndex;	
	
	SetInputTextValue('SubmitRateEstimate_TotalStops', iTotalStops);	
	
	if (BookRide_RideType == 'O') {		
		sPUType = GetRadioButtonGroupValue('PUType');
		SetInputTextValue('SubmitRateEstimate_PUType', sPUType);

		if (BookRide_UseProfiles == 'Y') {
			oSelect = document.getElementById(sTagPrefix + 'selPickupLocProfile');
			iIndex = oSelect.selectedIndex;
			if (iIndex > -1) {
				sTemp = oSelect.options[iIndex].value;
			}
			else {
				sTemp = '';
			}
			SetInputTextValue('SubmitRateEstimate_PickupLocProfile', sTemp);

			oSelect = document.getElementById(sTagPrefix + 'selDropoffLocProfile');
			iIndex = oSelect.selectedIndex;
			if (iIndex > -1) {
				sTemp = oSelect.options[iIndex].value;
			}
			else {
				sTemp = '';
			}
			SetInputTextValue('SubmitRateEstimate_DropoffLocProfile', sTemp);
			
			for (i=1; i<=iTotalStops; i++) {
				oSelect = document.getElementById(sTagPrefix + 'selS' + (i) + 'LocProfile');
				iIndex = oSelect.selectedIndex;
				if (iIndex > -1) {
					sTemp = oSelect.options[iIndex].value;
				}
				else {
					sTemp = '';
				}
				SetInputTextValue('SubmitRateEstimate_Stop' + (i) + 'LocProfile', sTemp);
			}
		}
		else {
			SetInputTextValue('SubmitRateEstimate_PickupLocProfile', '');
			SetInputTextValue('SubmitRateEstimate_DropoffLocProfile', '');
			
			for (i=1; i<=iTotalStops; i++) {
				SetInputTextValue('SubmitRateEstimate_Stop' + (i) + 'LocProfile', '');
			}			
		}

		sTemp = '';
		CopyInputTextValue('txtPULandmarkValue', 'SubmitRateEstimate_PULandmarkValue')
		
		oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
		if (oSelect.options.length == 0) {			
			CopyInputTextValue('txtPUAirportValue', 'SubmitRateEstimate_PUAirportValue')
		}
		else {
			SetInputTextValue('SubmitRateEstimate_PUAirportValue', oSelect.options[oSelect.selectedIndex].value);
		}				
		//oSelect = document.getElementById(sTagPrefix + 'selPUAirport');
		//SetInputTextValue('SubmitRateEstimate_PUAirportValue', oSelect.options[oSelect.selectedIndex].value);
		
		//CopyInputTextValue('txtPUAirportValue', 'SubmitRateEstimate_PUAirportValue')
		CopyInputTextValue('txtPUZip', 'SubmitRateEstimate_PUZip')
		CopyInputTextValue('txtPUState', 'SubmitRateEstimate_PUState')

		sDOType = GetRadioButtonGroupValue('DOType');
		SetInputTextValue('SubmitRateEstimate_DOType', sDOType);

		sTemp = '';
		CopyInputTextValue('txtDOLandmarkValue', 'SubmitRateEstimate_DOLandmarkValue')

		oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
		if (oSelect.options.length == 0) {			
			CopyInputTextValue('txtDOAirportValue', 'SubmitRateEstimate_DOAirportValue')
		}
		else {
			SetInputTextValue('SubmitRateEstimate_DOAirportValue', oSelect.options[oSelect.selectedIndex].value);
		}				
		//oSelect = document.getElementById(sTagPrefix + 'selDOAirport');
		//SetInputTextValue('SubmitRateEstimate_DOAirportValue', oSelect.options[oSelect.selectedIndex].value);
		
		//CopyInputTextValue('txtDOAirportValue', 'SubmitRateEstimate_DOAirportValue')
		CopyInputTextValue('txtDOZip', 'SubmitRateEstimate_DOZip')	
		CopyInputTextValue('txtDOState', 'SubmitRateEstimate_DOState')	
		
		for (i=1; i<=iTotalStops; i++) {
			CopyInputTextValue('txtS' + (i) + 'LandmarkValue', 'SubmitRateEstimate_S' + (i) + 'LandmarkValue')
			CopyInputTextValue('txtS' + (i) + 'AirportValue', 'SubmitRateEstimate_S' + (i) + 'AirportValue')
			CopyInputTextValue('txtS' + (i) + 'Zip', 'SubmitRateEstimate_S' + (i) + 'Zip')
			CopyInputTextValue('txtS' + (i) + 'State', 'SubmitRateEstimate_S' + (i) + 'State')			
			SetInputTextValue('SubmitRateEstimate_S' + (i) + 'Type', GetRadioButtonGroupValue('S' + (i) + 'Type'));		
		}
	}
	
	oInput = document.getElementById('chkMeetGreet');
	if (oInput.checked == true) 
		SetInputTextValue('SubmitRateEstimate_MeetGreet', 'Y');
	else
		SetInputTextValue('SubmitRateEstimate_MeetGreet', 'N');

	sTemp = '';
	oSelect = document.getElementById(sTagPrefix + 'selExtraServices');
	for (i=0; i<oSelect.options.length; i++) {
		if (oSelect.options[i].selected == true) {
			sTemp = sTemp + '|' + oSelect.options[i].value;
		}
	}
	SetInputTextValue('SubmitRateEstimate_ExtraSvcs', sTemp);	
	CopyInputTextValue('txtDOMinHours', 'SubmitRateEstimate_JobHours')
	CopyInputTextValue(sTagPrefix + 'txtNumPassengers', 'SubmitRateEstimate_TotalPax')
	
	var frmSubmit = document.getElementById('BookRide_frmSubmitRateEstimate');
	frmSubmit.target = 'BookRide_ifrSubmitRateEstimate';
	frmSubmit.action = 'PrcQuoteLookup.aspx';					
	frmSubmit.submit();	
}

function BookRide_ReturnVehRateInfo(sResult) {		
	var aResult;
	var sOption;
	var aOption;
	var i;
	var sTemp1;
	
	SetLabelText("lblMinHoursForVehicle", "")
	if (sResult != '') {
		aResult = sResult.split('|');
		
		for (i=0; i<aResult.length; i++) {
			sOption = aResult[i];
			aOption = sOption.split('^');
			
			sCode = aOption[0];
			sValue = aOption[1];

			switch (sCode) {
				case 'ERROR':
				break;
				case 'VEHHOURS':
						sTemp1 = GetInputTextValue('txtDOMinHours');		
						if (IsNumeric(sTemp1) == true && IsNumeric(sValue) == true) {
							if (sTemp1 <= sValue)
								SetInputTextValue('txtDOMinHours', sValue)
						}
					SetLabelText("lblMinHoursForVehicle", "(Min " + sValue + " hrs)")
				break;
			}
		}	
	}
}

function BookRide_ReturnRateEstimateInfo(sResult) {
	var aResult;
	var sOption;
	var aOption;
	var i;
	
	if (sResult != '') {
		aResult = sResult.split('|');
		
		for (i=0; i<aResult.length; i++) {
			sOption = aResult[i];
			aOption = sOption.split('^');
			
			sCode = aOption[0];
			sValue = aOption[1];

			switch (sCode) {
				case 'ERROR':
					alert(sValue);
					SetLabelText("divPaymentLabel", 'Payment')
					SetDisplay('rowBRSectionRateEstimateSep', 'none');
					SetDisplay('rowBRSectionRateEstimate', 'none');
					SetDisplay('tdPrcQuoteDisclaimer', 'none');	
					return;
				case 'NORATEFOUND':
						SetDisplay('rowBRSectionRateEstimateSep', 'none');
						SetDisplay('tdPrcQuoteDisclaimer', 'none');
						SetDisplay('tdPrcQuoteNotFound', '');																
						return;				
				case 'BASE':													
					if (sValue != '$0.00'){					
						SetLabelText("lblBaseCharge", sValue)	
						SetDisplay('tdPrcQuoteNotFound', 'none');										
					}
					else{
						//SetLabelText("lblBaseCharge", sValue + '  *')	
						SetDisplay('rowBRSectionRateEstimateSep', 'none');
						SetDisplay('tdPrcQuoteDisclaimer', 'none');
						SetDisplay('tdPrcQuoteNotFound', '');																
						return;
					}
					break;
				case 'SVCS':
					SetLabelText("lblExtraSvcCharge", sValue)
					break;
				case 'GRAT':
					SetLabelText("lblGratuity", sValue)
					break;
				case 'OTHER':
					SetLabelText("lblOtherCharges", sValue)
					break;
				case 'DISC':
					if (sValue != '$0.00'){
						SetLabelText("lblDiscount", sValue)
						SetDisplay('rowBRSectionDiscount', '');
					}
					else{
						SetDisplay('rowBRSectionDiscount', 'none');
					}
					break;
				case 'TOTAL':
					SetLabelText("lblTotalCharges", sValue)
					break;
			}
		}	
		//SetDisplay('tblOtherCreditCard', '');
		SetDisplay('tdPrcQuoteDisclaimer', '');
		SetLabelText('divPaymentLabel', 'Payment/<br>Price Quote')
		SetDisplay('rowBRSectionRateEstimateSep', '');
		SetDisplay('rowBRSectionRateEstimate', '');		
	}
	else{
		SetLabelText("divPaymentLabel", 'Payment')
		SetDisplay('rowBRSectionRateEstimateSep', 'none');
		SetDisplay('rowBRSectionRateEstimate', 'none');
		SetDisplay('tdPrcQuoteDisclaimer', 'none');		
	}
}

function BookRide_HidePriceQuoteSection() {
	SetLabelText("divPaymentLabel", 'Payment')
	SetDisplay('rowBRSectionRateEstimateSep', 'none');
	SetDisplay('rowBRSectionRateEstimate', 'none');
	SetDisplay('tdPrcQuoteDisclaimer', 'none');
	SetDisplay('tdPrcQuoteNotFound', 'none');
}

function BookRide_GetSelectOption(sOptionID) {
	var bValue = false;
	var oOption = document.getElementById(sOptionID);
	if (oOption != null) {
		bValue = oOption.checked;
	}
	return bValue;
}

function BookRide_AddStops(){
	var oSelect = document.getElementById('selTotalStops');	
	var iIndex = oSelect.selectedIndex;	
	var i;

	for (i=1; i<=5; i++) {
		if (iIndex > 0 && iIndex >=i && BookRide_AllowStops  == 'Y') {
			SetDisplay('rowBRSectionStop' + (i), '');
		}
		else {
			SetDisplay('rowBRSectionStop' + (i), 'none');
		}
	}
}

function BookRide_DeleteStop(nStopNo){
	var i;
	for (i=1; i<=4; i++) {
		if (i >= nStopNo) {						
			if (BookRide_GetSelectOption('optS' + (i+1) + 'TypeLandmark') == true)
				BookRide_SelectOption('optS' + (i) + 'TypeLandmark');
			if (BookRide_GetSelectOption('optS' + (i+1) + 'TypeAirport') == true)
				BookRide_SelectOption('optS' + (i) + 'TypeAirport');
			if (BookRide_GetSelectOption('optS' + (i+1) + 'TypeOther') == true)
				BookRide_SelectOption('optS' + (i) + 'TypeOther');		
			if (BookRide_UseProfiles == 'Y' && BookRide_AllowProfileLocations == 'Y'){
				if (BookRide_GetSelectOption('optS' + (i+1) + 'TypeProfile') == true) {
					BookRide_SelectOption('optS' + (i) + 'TypeProfile', BookRide_GetSelectOption('optS' + (i+1) + 'TypeProfile'));
					SetSelectByValue(sTagPrefix + 'selS' + (i) + 'LocProfile', GetSelectValue(sTagPrefix + 'selS' + (i+1) + 'LocProfile'), -1)				
					SetLabelText('lblS' + (i) + 'LocProfileDesc', GetLabelText('lblS' + (i+1) + 'LocProfileDesc'));
				}
			}			
				
			BookRide_SelectLocType('S' + (i),  GetRadioButtonGroupValue('S' + (i+1) + 'Type'))
			
			CopyInputTextValue('txtS' + (i+1) + 'LandmarkValue', 'txtS' + (i) + 'LandmarkValue');
			CopyInputTextValue('txtS' + (i+1) + 'LandmarkInput', 'txtS' + (i) + 'LandmarkInput');
			CopyInputTextValue('txtS' + (i+1) + 'LandmarkPointValue', 'txtS' + (i) + 'LandmarkPointValue');
			CopyInputTextValue('txtS' + (i+1) + 'LandmarkPointInput', 'txtS' + (i) + 'LandmarkPointInput');							
			SetLabelText('lblS' + (i) + 'LandmarkDesc', GetLabelText('lblS' + (i+1) + 'LandmarkDesc'));
			SetLabelText('lblS' + (i) + 'LandmarkPointDesc', GetLabelText('lblS' + (i+1) + 'LandmarkPointDesc'));

			CopyInputTextValue('txtS' + (i+1) + 'AirportValue', 'txtS' + (i) + 'AirportValue');
			CopyInputTextValue('txtS' + (i+1) + 'AirportInput', 'txtS' + (i) + 'AirportInput');
			CopyInputTextValue('txtS' + (i+1) + 'AirlineValue', 'txtS' + (i) + 'AirlineValue');
			CopyInputTextValue('txtS' + (i+1) + 'AirlineInput', 'txtS' + (i) + 'AirlineInput');
			CopyInputTextValue('txtS' + (i+1) + 'FlightNumber', 'txtS' + (i) + 'FlightNumber');
			CopyInputTextValue('txtS' + (i+1) + 'FlightOrig', 'txtS' + (i) + 'FlightOrig');
			CopyInputTextValue('txtS' + (i+1) + 'AirportPickupPoint', 'txtS' + (i) + 'AirportPickupPoint');
			
			SetSelectByValue('selS' + (i+1) + 'FlightTimeHours', GetSelectValue('selS' + (i) + 'FlightTimeHours'), -1)
			SetSelectByValue('selS' + (i+1) + 'FlightTimeMins', GetSelectValue('selS' + (i) + 'FlightTimeMins'), -1)
			SetSelectByValue('selS' + (i+1) + 'FlightTimeAMPM', GetSelectValue('selS' + (i) + 'FlightTimeAMPM'), -1)
			SetSelectByValue('selS' + (i+1) + 'FlightType', GetSelectValue('selS' + (i) + 'FlightType'), -1)
			
			CopyInputTextValue('txtS' + (i+1) + 'Address1', 'txtS' + (i) + 'Address1');
			CopyInputTextValue('txtS' + (i+1) + 'Address2', 'txtS' + (i) + 'Address2');
			CopyInputTextValue('txtS' + (i+1) + 'RoomNo', 'txtS' + (i) + 'RoomNo');
			CopyInputTextValue('txtS' + (i+1) + 'City', 'txtS' + (i) + 'City');
			CopyInputTextValue('txtS' + (i+1) + 'State', 'txtS' + (i) + 'State');
			CopyInputTextValue('txtS' + (i+1) + 'Zip', 'txtS' + (i) + 'Zip');
			
		}
	}	

	var j = GetSelectValue('selTotalStops')	
	if (j != null && j >= 1) {
		SetSelectByValue('selTotalStops', (j-1), 0);
		BookRide_AddStops();
	}
}

function BookRide_AddExtraPassenger(){
	var oSelect = document.getElementById('selTotalPassenger');	
	var iIndex = oSelect.selectedIndex;	
	var i;

	for (i=1; i<=5; i++) {
		if (iIndex > 0 && iIndex >=i && BookRide_AllowExtraPassenger  == 'Y') {
			SetDisplay('rowBRSectionExtraPassenger' + (i), '');
		}
		else {
			SetDisplay('rowBRSectionExtraPassenger' + (i), 'none');
		}
	}
}

function BookRide_DeleteExtraPassenger(nPassengerNo){
	var i;
	if (nPassengerNo > 0 && nPassengerNo >=i && BookRide_AllowExtraPassenger  == 'Y') {
			SetDisplay('rowBRSectionExtraPassenger' + (nPassengerNo), '');
		}
		else {
			SetDisplay('rowBRSectionExtraPassenger' + (nPassengerNo), 'none');
		}
	
	var j = GetSelectValue('selTotalPassenger')	
	if (j != null && j >= 1) {
		SetSelectByValue('selTotalPassenger', (j-1), 0);
		BookRide_AddExtraPassenger();
	}
}

function IsNumOfHoursValid(){
	var sTemp = GetInputTextValue('txtDOMinHours');		
	if (IsNumeric(sTemp) != true) {
		alert('Please enter valid # of Hours');		
	}
}

function BookRide_SetDisclaimerText(sDisclaimer) {
	var oTd;
	if (sDisclaimer != '') {	
		oTd = document.getElementById(sTagPrefix + 'cellBookingDisclaimerText');
		if (oTd != null)
			oTd.innerHTML = sDisclaimer;				
	}
}


function MaxLen(strObj,strLength){

	var obj;
	obj=document.getElementById(strObj);
		if (obj.value.length > strLength){	
			obj.value="";
			alert("Maximum"+ strLength + "Char Allowed....");
		    obj.focus();
			return true;
		}
	return false;
}