<!--//--><![CDATA[//><!--

/*
var vehiclePopulation = new Array(4);
vehiclePopulation[0] = new Array(1);
vehiclePopulation[1] = new Array(3);
vehiclePopulation[2] = new Array(3);
vehiclePopulation[3] = new Array(2);

vehiclePopulation[0][0] = "Ford LTD Stretch,null";
vehiclePopulation[1][0] = "BMW 7 Series,BMW 750Li (silver)";
vehiclePopulation[1][1] = "BMW 7 Series,BMW 740Li (silver)";
vehiclePopulation[1][2] = "BMW 7 Series,BMW 740Li (white)";
vehiclePopulation[2][0] = "Mercedes Benz S Class 2007,Mercedes Benz S Class 2007 (silver)";
vehiclePopulation[2][1] = "Mercedes Benz S Class 2007,Mercedes Benz S Class 2007 (black)";
vehiclePopulation[2][2] = "Mercedes Benz S Class -,Mercedes Benz S Class (black) model";
vehiclePopulation[3][0] = "Holden Caprice,Holden Caprice 2007 (blue)";
vehiclePopulation[3][1] = "Holden Caprice,Holden Caprice (grey)";
*/

function SendForm(formType){

	var intErrors = 0;
	var strErrors = "Sorry, your " + formType + " request could not be sent for the following reasons:\n\n";
        
	SetFieldBackgroundColour(formType);

	if (formType == 'booking')
	{
		if(Trim(document.frm.QuoteNumber.value).length > 0) 
		{
			if(ValidQuoteNum() == false){
				intErrors++;
				strErrors+= intErrors +") Quote number must start with I and be followed by 4-5 digits\n";
			}
		}
	}

        if ((Trim(document.frm.txtTitle.value).length == 0) || (Trim(document.frm.txtFirstName.value).length == 0) || (Trim(document.frm.txtLastName.value).length == 0))
        {
		intErrors++;  
		strErrors+= intErrors +") Please enter your title, first & last names\n";
		      
	        if(Trim(document.frm.txtTitle.value).length == 0){		        
		        document.frm.txtTitle.style.backgroundColor = "#eeeeee";
	        }
        		
	        if(Trim(document.frm.txtFirstName.value).length == 0){
		        document.frm.txtFirstName.style.backgroundColor = "#eeeeee";
	        }
        	
	        if(Trim(document.frm.txtLastName.value).length == 0){
		        document.frm.txtLastName.style.backgroundColor = "#eeeeee";
	        }
	}

	/* Phone, Email & Fax are only mandatory depending on the contact method chosen */
	/* June 2010 - Rose requested that the phone # is always mandatory */
	//if(document.frm.selContactMethod.options[document.frm.selContactMethod.selectedIndex].value == "Phone"){
		if(Trim(document.frm.txtPhone.value).length == 0){
			intErrors++;
			strErrors+= intErrors +") Please enter your phone number\n";
			document.frm.txtPhone.style.backgroundColor = "#eeeeee";
		}
	//}
	//else
	if(document.frm.selContactMethod.options[document.frm.selContactMethod.selectedIndex].value == "Email"){
		if(!IsValidEmail(document.frm.txtEmail.value)){
			intErrors++;
			strErrors+= intErrors +") Please enter a valid email address\n";
			document.frm.txtEmail.style.backgroundColor = "#eeeeee";
		}
	}
	else
	if(document.frm.selContactMethod.options[document.frm.selContactMethod.selectedIndex].value == "Fax"){
		if(Trim(document.frm.txtFax.value).length == 0){
			intErrors++;
			strErrors+= intErrors +") Please enter your fax number\n";
			document.frm.txtFax.style.backgroundColor = "#eeeeee";
		}
	}
	
        /*
	if (formType == 'quote')
	{		
		if(Trim(document.frm.txtStreetAddress.value).length == 0){
			intErrors++;
			strErrors+= intErrors +") Please enter your street address\n";
			document.frm.txtStreetAddress.style.backgroundColor = "#eeeeee";
		}
		
		if(Trim(document.frm.txtCity.value).length == 0){
			intErrors++;
			strErrors+= intErrors +") Please enter your city\n";
			document.frm.txtCity.style.backgroundColor = "#eeeeee";
		}

		if(document.frm.selState.options[document.frm.selState.selectedIndex].value == ""){
			intErrors++;
			strErrors+= intErrors +") Please select a state\n";
			document.frm.selState.style.backgroundColor = "#eeeeee";
		}
		
		if(Trim(document.frm.txtPostcode.value).length == 0){
			intErrors++;
			strErrors+= intErrors +") Please enter your postcode\n";
			document.frm.txtPostcode.style.backgroundColor = "#eeeeee";
		}
	}
	*/
	
	if ((document.frm.pu_airport.value == "other") && (Trim(document.frm.pu_suburb.value).length == 0))
	{
	        intErrors++;
	        strErrors+= intErrors +") Please enter your pickup suburb\n";		
	        document.frm.pu_suburb.style.backgroundColor = "#eeeeee";
	}		        
		
	if(Trim(document.frm.pu_state.value).length == 0){
		intErrors++;
		strErrors+= intErrors +") Please enter your pickup state\n";
		document.frm.pu_state.style.backgroundColor = "#eeeeee";
	}	

	if(!IsDate(document.frm.PU_DD.options[document.frm.PU_DD.selectedIndex].value + "/" +
			document.frm.PU_MM.options[document.frm.PU_MM.selectedIndex].value + "/" +
			document.frm.PU_YY.options[document.frm.PU_YY.selectedIndex].value))
	{
		intErrors++;
		strErrors+= intErrors +") Please select a valid pickup date\n";
		document.frm.PU_DD.style.backgroundColor = "#eeeeee";
		document.frm.PU_MM.style.backgroundColor = "#eeeeee";
		document.frm.PU_YY.style.backgroundColor = "#eeeeee";
	}
	else if (CheckDate(false) < 0)
	{
		intErrors++;
		strErrors+= intErrors +") Pickup date / time must not be less than the current date / time\n";
	}	
	
	if ((document.frm.do_airport.value == "other") && (Trim(document.frm.do_suburb.value).length == 0))
	{
	        intErrors++;
	        strErrors+= intErrors +") Please enter your dropoff suburb\n";		
	        document.frm.do_suburb.style.backgroundColor = "#eeeeee";
	}	

	if(document.frm.return_required.checked)
	{
	        if ((document.frm.ret_pu_airport.value == "other") && (Trim(document.frm.ret_pu_suburb.value).length == 0))
	        {
	                intErrors++;
	                strErrors+= intErrors +") Please enter your return pickup suburb\n";		
	                document.frm.ret_pu_suburb.style.backgroundColor = "#eeeeee";
	        }
		
		if(!IsDate(document.frm.ret_PU_DD.options[document.frm.ret_PU_DD.selectedIndex].value + "/" +
				document.frm.ret_PU_MM.options[document.frm.ret_PU_MM.selectedIndex].value + "/" +
				document.frm.ret_PU_YY.options[document.frm.ret_PU_YY.selectedIndex].value))
		{
			intErrors++;
			strErrors+= intErrors +") Please select a valid return pickup date\n";
			document.frm.ret_PU_DD.style.backgroundColor = "#eeeeee";
			document.frm.ret_PU_MM.style.backgroundColor = "#eeeeee";
			document.frm.ret_PU_YY.style.backgroundColor = "#eeeeee";
		}
		else if (CheckDate(true) < 0)
		{
			intErrors++;
			strErrors+= intErrors +") Return Pickup date / time must not be less than the Pickup date / time\n";
		}
		
	        if ((document.frm.ret_do_airport.value == "other") && (Trim(document.frm.ret_do_suburb.value).length == 0))
	        {
	                intErrors++;
	                strErrors+= intErrors +") Please enter your return dropoff suburb\n";		
	                document.frm.ret_do_suburb.style.backgroundColor = "#eeeeee";
	        }		
	}
	
        // Ensure that a vehicle is selected	
        var veh_selected = false;
        // Ignore 1st value, as it is "Select vehicle(s) required from choices below..."
        for (var i=1; (i < document.frm.selVehicle.length) && (veh_selected == false); i++)
        {
                if (document.frm.selVehicle[i].selected)
                        veh_selected = true;
        }

        if (veh_selected == false)
	{
		intErrors++;
		strErrors+= intErrors +") Please select at least one vehicle\n";
                for (var i=0; i < document.frm.selVehicle.length; i++)
                        document.frm.selVehicle[i].style.backgroundColor = "#eeeeee";		
	}
	else
	        // Ensure that the 1st item does not remain selected if other selections are made
	        document.frm.selVehicle[0].selected = false;
	        
	/* Hours required is necessary when occasion is wedding */
	// alert(document.frm.selOccasion.value);
	if(document.frm.selOccasion.value == "Wedding")
	{
		if(Trim(document.frm.txtHoursRequired.value).length == 0)
		{
			intErrors++;
			strErrors+= intErrors +") Please enter number of hours wedding transport is required\n";
			document.frm.txtHoursRequired.style.backgroundColor = "#eeeeee";
		}
	}	        	

	//if (formType == 'quote')
	//{
		if(document.frm.selReferral.options[document.frm.selReferral.selectedIndex].value == "notselected")
		{
			intErrors++;
			strErrors+= intErrors +") Please indicate how you heard about us\n";
			document.frm.selReferral.style.backgroundColor = "#eeeeee";
		} 
		else 
		{
			if(document.frm.selReferral.options[document.frm.selReferral.selectedIndex].value == "other" && Trim(document.frm.txtReferral.value).length == 0){
				intErrors++;
				strErrors+= intErrors +") Please specify how you heard about us\n";
				document.frm.txtReferral.style.backgroundColor = "#eeeeee";
			}
		}
	//}

	if (formType == 'booking')
	{
		if(Trim(document.frm.txtCardNo.value).length > 0) 
		{
			if(ValidCreditCardNum(document.frm.txtCardNo.value) == false){
				intErrors++;
				strErrors+= intErrors +") Invalid card number\n";
			}
		}
		if(Trim(document.frm.txtCardIDNumber.value).length > 0) 
		{
			if(ValidCVVNum(document.frm.txtCardIDNumber.value) == false){
				intErrors++;
				strErrors+= intErrors +") CVV number must be 3-4 digits \n";
			}
		}
	}

	if (ScriptTags(formType)) {
		var openScriptTag="\<\%";
		intErrors++;
		strErrors+= intErrors +") The string " + openScriptTag + " must not be present in any input data\n";
	}

	if(0 == intErrors)
	{        	        
                if (WarnVehicleAvail() & WarnAirportSel())
                {
                        document.frm.IsPostBack.value = "1";
                        document.frm.submit();
                }
                //else
                //        alert("form will NOT be submitted");		        
	} 
	else 
	{
		alert(strErrors);
	}	
}

function WarnVehicleAvail()
{
// Vehicles only available for hire in NSW
nswArray = new Array(2);
//nswArray[0] = "Chrysler 300C Stretch";
//nswArray[1] = "Chrysler 300C Sedan";
nswArray[0] = "Sports/Topless";
nswArray[1] = "BCI 30 Seater Coach";
nswArray[2] = "Pkg";

        //alert(document.frm.pu_state.value);
        retVal = true;
        /* ACT code to be completed
        if (document.frm.pu_state.value == "ACT")
        {
                // Vehicle type
                for (var i=0; (i < document.frm.selVehicle.length) && (retVal == true); i++)  
                        if (document.frm.selVehicle[i].selected) 
                        {
                                if (document.frm.selVehicle[i].value.indexOf("Pkg") > 0)
                                document.frm.selOccasion.value
                                {                                        
                                        if (nswArray[j] == "Pkg")
                                                strVehicle = "Wedding packages are"
                                        else
                                                strVehicle = "The " + nswArray[j] + " is";
                                                
                                        if (confirm(strVehicle + " only available in Sydney or Canberra - do you want to continue?"))
                                                retVal = true;
                                        else
                                                retVal = false;
                                }
                        }
        }
        else 
        */
        //alert(document.frm.pu_state.value);             
        if ((document.frm.pu_state.value != "NSW") && (document.frm.pu_state.value != "ACT"))
        {
                // Vehicle type
                for (var i=0; (i < document.frm.selVehicle.length) && (retVal == true); i++)  
                        if (document.frm.selVehicle[i].selected) 
                        for (var j=0; (j < nswArray.length) && (retVal == true); j++)
                        {
                                strVehicle = "";
                                if (document.frm.selVehicle[i].value.indexOf(nswArray[j]) > 0)
                                {                                    
                                        if (nswArray[j] == "Pkg")
                                                strVehicle = "Wedding packages are only available in Sydney or Canberra - do you want to continue?"
                                        else
                                        if (nswArray[j] == "Sports/Topless")
                                                strVehicle = "Sports/Topless vehicles are only available in Sydney (all occasions) or Canberra (weddings only) - do you want to continue?"                                                 
                                        /*        
                                        else
                                        if ((document.frm.pu_state.value == "QLD") && (document.frm.selVehicle[i].value.indexOf("Chrysler") > 0))
                                        {
                                                strVehicle = "The " + nswArray[j] + " will be available in Brisbane / Gold Coast from February 2009 - do you want to continue?";
                                                //strVehicle = "The " + nswArray[j] + " is only available in Sydney or Canberra - do you want to continue?";
                                        } 
                                        */                                       
                                        else
                                        if (nswArray[j] == "BCI 30 Seater Coach")
                                                strVehicle = "The " + nswArray[j] + " is only available in Sydney - do you want to continue?";
                                         
                                        if (strVehicle.length > 0)
                                        {        
                                                if (confirm(strVehicle))
                                                        retVal = true;
                                                else
                                                        retVal = false;
                                        }
                                }
                        }
        }
        return (retVal);
}

function WarnAirportSel()
{
        retVal = true;
	if (((document.frm.pu_airport.value != "other") && (Trim(document.frm.pu_addr_line_1.value).length > 0)) ||
	    ((document.frm.do_airport.value != "other") && (Trim(document.frm.do_addr_line_1.value).length > 0)) ||
	    ((document.frm.ret_pu_airport.value != "other") && (Trim(document.frm.ret_pu_addr_line_1.value).length > 0)) ||
	    ((document.frm.ret_do_airport.value != "other") && (Trim(document.frm.ret_do_addr_line_1.value).length > 0)))
	{
                if (confirm("\"Address line 1\" will be ignored when an airport is selected - do you want to continue?"))
                        retVal = true;
                else
                        retVal = false; 
	} 
	return (retVal);      
}

function InformAirport()
{
        retVal = true;
	if (((document.frm.pu_airport.value != "other") && (Trim(document.frm.pu_state.value) = "NSW")) ||
	    ((document.frm.do_airport.value != "other") && (Trim(document.frm.do_addr_line_1.value).length > 0)) ||
	    ((document.frm.ret_pu_airport.value != "other") && (Trim(document.frm.ret_pu_addr_line_1.value).length > 0)) ||
	    ((document.frm.ret_do_airport.value != "other") && (Trim(document.frm.ret_do_addr_line_1.value).length > 0)))
	{
                if (confirm("\"Address line 1\" will be ignored when an airport is selected - do you want to continue?"))
                        retVal = true;
                else
                        retVal = false; 
	} 
	return (retVal); 
	
	document.frm.pu_state     
}

function SendForm_scb(formType, route_num)
{
	var intErrors = 0;
	var strErrors = "Sorry, your " + formType + " request could not be sent for the following reasons:\n\n";

        SetFieldBackgroundColour_scb();
 
        // Must select at least one pickup point and time (to casino, from casino)      
	if((document.frm.pickup_point_1b.value == "No selection") && (document.frm.pickup_point_2b.value == "No selection"))
	{
	        intErrors++;
	        strErrors+= intErrors +") Please select a pickup point/time to casino (step 1) and/or from casino (step 2)\n";
        }
        
	// Check that return pickup time > pickup time
	if (!CheckTimes_scb())
	{
		intErrors++;
		strErrors+= intErrors +") Return time from casino needs to be later than departure time to casino\n";
	}        
  
        // Check for a valid date      
	if(!IsDate(document.frm.PU_DD.options[document.frm.PU_DD.selectedIndex].value + "/" +
		document.frm.PU_MM.options[document.frm.PU_MM.selectedIndex].value + "/" +
		document.frm.PU_YY.options[document.frm.PU_YY.selectedIndex].value))
	{
		intErrors++;
		strErrors+= intErrors +") Please select a valid date of travel\n";
		document.frm.PU_DD.style.backgroundColor = "#eeeeee";
		document.frm.PU_MM.style.backgroundColor = "#eeeeee";
		document.frm.PU_YY.style.backgroundColor = "#eeeeee";
	}
	// Check that booking is made at least one day prior
	else if (!CheckDate_scb(route_num))
	{
		intErrors++;
		strErrors+= intErrors +") Online bookings must be made at least one day prior to your date of travel (otherwise phone bookings are accepted)\n";
		document.frm.PU_DD.style.backgroundColor = "#eeeeee";
		document.frm.PU_MM.style.backgroundColor = "#eeeeee";
		document.frm.PU_YY.style.backgroundColor = "#eeeeee";		
	}
	
	if(Trim(document.frm.number_of_persons.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter number of passengers\n";
		document.frm.number_of_persons.style.backgroundColor = "#eeeeee";
        }
        
	if(Trim(document.frm.passenger_name.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter passenger name\n";
		document.frm.passenger_name.style.backgroundColor = "#eeeeee";
        }
        /*
        15/07/2008 - Mobile no longer mandatory after a customer complaint
	if(Trim(document.frm.passenger_mobile.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter passenger mobile\n";
		document.frm.passenger_mobile.style.backgroundColor = "#eeeeee";
        } 
        */
        
	if(Trim(document.frm.email.value).length > 0)
	if(!IsValidEmail(document.frm.email.value))
	{
		intErrors++;
		strErrors+= intErrors +") Please enter a valid email address\n";
	}

        // All credit card details are mandatory
    
        var rad_val = "";
        for (var i=0; i < document.frm.radCardType.length; i++)
        {
                if (document.frm.radCardType[i].checked)
                {
                        rad_val = document.frm.radCardType[i].value;
                }
        }
        if (rad_val == "")
	{
		intErrors++;
		strErrors+= intErrors +") Please select your card type\n";
                for (var i=0; i < document.frm.radCardType.length; i++)
                        document.frm.radCardType[i].style.backgroundColor = "#eeeeee";		
	}

	if(Trim(document.frm.txtCardHolderName.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter cardholder name\n";
		document.frm.txtCardHolderName.style.backgroundColor = "#eeeeee";
        } 
    
	if(Trim(document.frm.txtCardNo.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter card number\n";
		document.frm.txtCardNo.style.backgroundColor = "#eeeeee";
        } 
        else if(ValidCreditCardNum(document.frm.txtCardNo.value) == false)
        {
		intErrors++;
		strErrors+= intErrors +") Invalid card number\n";
		document.frm.txtCardNo.style.backgroundColor = "#eeeeee";		
	}

	if(Trim(document.frm.txtCardIDNumber.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter card CVV number\n";
		document.frm.txtCardIDNumber.style.backgroundColor = "#eeeeee";
        }
        else if(ValidCVVNum(document.frm.txtCardIDNumber.value) == false)
        {
		intErrors++;
		strErrors+= intErrors +") Card CVV number must be 3-4 digits \n";
		document.frm.txtCardIDNumber.style.backgroundColor = "#eeeeee";		
	}

        if (ValidExpiryDate(document.frm.CE_MM.value, document.frm.CE_YY.value) == false)
        {
		intErrors++;
		strErrors+= intErrors +") Please select a valid card expiry date \n";
		document.frm.CE_MM.style.backgroundColor = "#eeeeee";
		document.frm.CE_YY.style.backgroundColor = "#eeeeee";	
	}        
        
 	if (ScriptTags_scb()) {
		var openScriptTag="\<\%";
		intErrors++;
		strErrors+= intErrors +") The string " + openScriptTag + " must not be present in any input data\n";
	}
	
	if(0 == intErrors)
	{
                if (WarnPassAge())
                {
                        document.frm.IsPostBack.value = "1";
                        document.frm.submit();
                }		
	} 
	else 
	{
		alert(strErrors);
	}
}

function WarnPassAge()
{
        if (confirm("All passengers on the Star Express service must be at least 18 years of age - do you want to continue with this booking?"))
                retVal = true;
        else
                retVal = false; 
	return (retVal);      
}

function SendForm_tours(formType)
{
        //alert("In SendForm_tours");

	var intErrors = 0;
	var strErrors = "Sorry, your " + formType + " request could not be sent for the following reasons:\n\n";
        
	SetFieldBackgroundColour_sdt();

	if(Trim(document.frm.selVehicle.value).length == 0){
		intErrors++;
		strErrors+= intErrors +") Please select a vehicle\n";
		document.frm.selVehicle.style.backgroundColor = "#eeeeee";
	}
		
	if(Trim(document.frm.selTour.value).length == 0){
		intErrors++;
		strErrors+= intErrors +") Please select a tour\n";
		document.frm.selTour.style.backgroundColor = "#eeeeee";
	}

	if(!IsDate(document.frm.PU_DD.options[document.frm.PU_DD.selectedIndex].value + "/" +
			document.frm.PU_MM.options[document.frm.PU_MM.selectedIndex].value + "/" +
			document.frm.PU_YY.options[document.frm.PU_YY.selectedIndex].value))
	{
		intErrors++;
		strErrors+= intErrors +") Please select a valid pickup date\n";
		document.frm.PU_DD.style.backgroundColor = "#eeeeee";
		document.frm.PU_MM.style.backgroundColor = "#eeeeee";
		document.frm.PU_YY.style.backgroundColor = "#eeeeee";
	}
	// Check that booking is made at least one day prior
	else if (!CheckDate_scb())
	{
		intErrors++;
		strErrors+= intErrors +") Online bookings must be made at least one day prior to your date of travel (otherwise phone bookings are accepted)\n";
		document.frm.PU_DD.style.backgroundColor = "#eeeeee";
		document.frm.PU_MM.style.backgroundColor = "#eeeeee";
		document.frm.PU_YY.style.backgroundColor = "#eeeeee";		
	}	
	
	if(Trim(document.frm.PU_T_HH.value).length == 0){
	        intErrors++;
	        strErrors+= intErrors +") Please select a valid pickup time\n";
	        document.frm.PU_T_HH.style.backgroundColor = "#eeeeee";
	}
	
	// Passenger details
	if(Trim(document.frm.passenger_name.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter passenger name\n";
		document.frm.passenger_name.style.backgroundColor = "#eeeeee";
        }
        
	if(Trim(document.frm.passenger_phone.value).length == 0) 
        {
		intErrors++;
		strErrors+= intErrors +") Please enter passenger phone\n";
		document.frm.passenger_phone.style.backgroundColor = "#eeeeee";
        } 
         
	if(Trim(document.frm.email.value).length > 0)
	if(!IsValidEmail(document.frm.email.value))
	{
		intErrors++;
		strErrors+= intErrors +") Please enter a valid email address\n";
	}	
        
        // Credit card details
	if(Trim(document.frm.txtCardNo.value).length > 0) 
	{
		if(ValidCreditCardNum(document.frm.txtCardNo.value) == false){
			intErrors++;
			strErrors+= intErrors +") Invalid card number\n";
		}
	}
	if(Trim(document.frm.txtCardIDNumber.value).length > 0) 
	{
		if(ValidCVVNum(document.frm.txtCardIDNumber.value) == false){
			intErrors++;
			strErrors+= intErrors +") CVV number must be 3-4 digits \n";
		}
	}

        // Referral
	if(document.frm.selReferral.options[document.frm.selReferral.selectedIndex].value == "notselected")
	{
		intErrors++;
		strErrors+= intErrors +") Please indicate how you heard about us\n";
		document.frm.selReferral.style.backgroundColor = "#eeeeee";
	} 
	else 
	{
		if(document.frm.selReferral.options[document.frm.selReferral.selectedIndex].value == "other" && Trim(document.frm.txtReferral.value).length == 0){
			intErrors++;
			strErrors+= intErrors +") Please specify how you heard about us\n";
			document.frm.txtReferral.style.backgroundColor = "#eeeeee";
		}
	}	

	if (ScriptTags_sct()) {
		var openScriptTag="\<\%";
		intErrors++;
		strErrors+= intErrors +") The string " + openScriptTag + " must not be present in any input data\n";
	}
	
	if(0 == intErrors){
		document.frm.IsPostBack.value = "1";
		document.frm.submit();
		//alert("OK");
	} else {
		alert(strErrors);
	}       
}

function SetFieldBackgroundColour(formType)
{
        /*
	if (formType == 'quote')
	{		
		document.frm.txtStreetAddress.style.backgroundColor = "#ffffff";
		document.frm.txtCity.style.backgroundColor = "#ffffff";
		document.frm.selState.style.backgroundColor = "#ffffff";
		document.frm.txtPostcode.style.backgroundColor = "#ffffff";
		document.frm.selReferral.style.backgroundColor = "#ffffff";
	}
	*/

	document.frm.txtTitle.style.backgroundColor = "#ffffff";
	document.frm.txtFirstName.style.backgroundColor = "#ffffff";
	document.frm.txtLastName.style.backgroundColor = "#ffffff";
	document.frm.txtPhone.style.backgroundColor = "#ffffff";
	document.frm.txtEmail.style.backgroundColor = "#ffffff";
	document.frm.txtFax.style.backgroundColor = "#ffffff";
	document.frm.pu_suburb.style.backgroundColor = "#ffffff";
	document.frm.do_suburb.style.backgroundColor = "#ffffff";
	document.frm.pu_state.style.backgroundColor = "#ffffff";
	document.frm.PU_DD.style.backgroundColor = "#ffffff";
	document.frm.PU_MM.style.backgroundColor = "#ffffff";
	document.frm.PU_YY.style.backgroundColor = "#ffffff";
	document.frm.ret_pu_suburb.style.backgroundColor = "#ffffff";
	document.frm.ret_do_suburb.style.backgroundColor = "#ffffff";	
	document.frm.ret_PU_DD.style.backgroundColor = "#ffffff";
	document.frm.ret_PU_MM.style.backgroundColor = "#ffffff";
	document.frm.ret_PU_YY.style.backgroundColor = "#ffffff";
	// Vehicle type
        for (var i=0; i < document.frm.selVehicle.length; i++)
                document.frm.selVehicle[i].style.backgroundColor = "#ffffff";	
        document.frm.txtHoursRequired.style.backgroundColor = "#ffffff";
}

function SetFieldBackgroundColour_scb()
{
        // Pickup date
	document.frm.PU_DD.style.backgroundColor = "#ffffff";
	document.frm.PU_MM.style.backgroundColor = "#ffffff";
	document.frm.PU_YY.style.backgroundColor = "#ffffff";
	
	// Passenger details
	document.frm.number_of_persons.style.backgroundColor = "#ffffff";
	document.frm.passenger_name.style.backgroundColor = "#ffffff";
	//document.frm.passenger_mobile.style.backgroundColor = "#ffffff";
	
	// Credit card details
        for (var i=0; i < document.frm.radCardType.length; i++)
                document.frm.radCardType[i].style.backgroundColor = "#ffffff";
	document.frm.txtCardHolderName.style.backgroundColor = "#ffffff";
	document.frm.txtCardNo.style.backgroundColor = "#ffffff";
	document.frm.txtCardIDNumber.style.backgroundColor = "#ffffff";	
	document.frm.CE_MM.style.backgroundColor = "#ffffff";	
	document.frm.CE_YY.style.backgroundColor = "#ffffff";				
}

function SetFieldBackgroundColour_sdt()
{
        document.frm.selVehicle.style.backgroundColor = "#ffffff";
        document.frm.selTour.style.backgroundColor = "#ffffff";
        document.frm.selReferral.style.backgroundColor = "#ffffff";        
        
        // Pickup time
	document.frm.PU_DD.style.backgroundColor = "#ffffff";
	document.frm.PU_MM.style.backgroundColor = "#ffffff";
	document.frm.PU_YY.style.backgroundColor = "#ffffff";
	document.frm.PU_T_HH.style.backgroundColor = "#ffffff";
	
	// Passenger details
	document.frm.passenger_name.style.backgroundColor = "#ffffff";
	document.frm.passenger_phone.style.backgroundColor = "#ffffff";	   		
}

function ScriptTags(formType)
{
// Check for opening script tag anywhere in fields where text in inputted (not selected)
	var scriptTags = false;
	var re=/^(.|\n)*(\<\%)(.|\n)*$/

	/*
	if (formType == 'quote')
	{	
		if ((re.test(Trim(document.frm.txtStreetAddress.value))) ||
			(re.test(Trim(document.frm.txtCity.value))) ||
			(re.test(Trim(document.frm.txtPostcode.value))) ||
			(re.test(Trim(document.frm.txtReferral.value))))
			scriptTags = true;
	}
	else 
	*/
	if (formType == 'booking')
	{	
		if ((re.test(Trim(document.frm.number_of_persons.value))) ||
			(re.test(Trim(document.frm.passenger_name.value))) ||
			(re.test(Trim(document.frm.passenger_mobile.value))) ||
			(re.test(Trim(document.frm.txtCardHolderName.value))))
			scriptTags = true;
	}
	    
	if ((re.test(Trim(document.frm.txtTitle.value))) ||
	    (re.test(Trim(document.frm.txtFirstName.value))) ||
	    (re.test(Trim(document.frm.txtLastName.value))) ||
	    (re.test(Trim(document.frm.txtCompanyName.value))) ||
	    (re.test(Trim(document.frm.txtEmail.value))) ||
	    (re.test(Trim(document.frm.txtPhone.value))) ||
	    (re.test(Trim(document.frm.txtFax.value))) ||
	    (re.test(Trim(document.frm.flight_number.value))) ||
	    (re.test(Trim(document.frm.pu_addr_line_1.value))) ||
	    (re.test(Trim(document.frm.pu_addr_line_2.value))) ||
	    (re.test(Trim(document.frm.pu_suburb.value))) ||
	    (re.test(Trim(document.frm.do_addr_line_1.value))) ||
	    (re.test(Trim(document.frm.do_addr_line_2.value))) ||
	    (re.test(Trim(document.frm.do_suburb.value))) ||
	    (re.test(Trim(document.frm.ret_pu_addr_line_1.value))) ||
	    (re.test(Trim(document.frm.ret_pu_addr_line_2.value))) ||
	    (re.test(Trim(document.frm.ret_pu_suburb.value))) ||
	    (re.test(Trim(document.frm.ret_do_addr_line_1.value))) ||
	    (re.test(Trim(document.frm.ret_do_addr_line_2.value))) ||
	    (re.test(Trim(document.frm.ret_do_suburb.value))) ||
	    (re.test(Trim(document.frm.extra_info.value))) ||
	    (re.test(Trim(document.frm.txtHoursRequired.value))) ||	    
	    (re.test(Trim(document.frm.txtSpecialRequests.value))))
	    scriptTags = true;
	    
	return scriptTags;
}

function ScriptTags_scb()
{
// Check for opening script tag anywhere in fields where text in inputted (not selected)
	var scriptTags = false;
	var re=/^(.|\n)*(\<\%)(.|\n)*$/
	
	if ((re.test(Trim(document.frm.number_of_persons.value))) ||
		(re.test(Trim(document.frm.passenger_name.value))) ||
		(re.test(Trim(document.frm.passenger_mobile.value))) ||		
		(re.test(Trim(document.frm.email.value))))
		scriptTags = true;
	    
	return scriptTags;
}

function ScriptTags_sct()
{
// Check for opening script tag anywhere in fields where text in inputted (not selected)
	var scriptTags = false;
	var re=/^(.|\n)*(\<\%)(.|\n)*$/
	
	if ((re.test(Trim(document.frm.pu_addr_line_1.value))) ||
		(re.test(Trim(document.frm.pu_addr_line_2.value))) ||
		(re.test(Trim(document.frm.pu_suburb.value))) ||
		(re.test(Trim(document.frm.txtCardHolderName.value))) ||
		(re.test(Trim(document.frm.number_of_persons.value))) ||							
		(re.test(Trim(document.frm.passenger_name.value))) ||
		(re.test(Trim(document.frm.passenger_phone.value))) ||	
		(re.test(Trim(document.frm.email.value))) ||			
		(re.test(Trim(document.frm.txtSpecialRequests.value))))
		scriptTags = true;
	    
	return scriptTags;
}

function ShowHideOther(field)
{
	// Show or hide 'other' field for referral / occasion required
	if (field == 'rf')
	{
		var objSpan = document.getElementById("ReferralOther");
	
		if(document.frm.selReferral.options[document.frm.selReferral.selectedIndex].value == "other"){
			objSpan.style.visibility = "visible";
		} else {
			objSpan.style.visibility = "hidden";
		}
	}
	else if (field == 'oc')
	{
		var objSpan = document.getElementById("OccasionOther");
	
		if(document.frm.selOccasion.options[document.frm.selOccasion.selectedIndex].value == "other"){
			objSpan.style.visibility = "visible";
		} else {
			objSpan.style.visibility = "hidden";
			//alert(document.frm.pu_airport.options[document.frm.pu_airport.selectedIndex].value);
			//if((document.frm.selOccasion.options[document.frm.selOccasion.selectedIndex].value == "Airport Transfer") & ((document.frm.pu_state.value == "NSW") | (document.frm.do_state.value == "NSW")))
			//        alert("test");
		}
		Set_Occasion_Mandatory_field();
	}
	objSpan = null;
}

function Set_Contact_Mandatory_field()
{
        // June 2010 - Rose requested that the phone number is mandatory regardless of the preferred contact method selected
	//document.frm.txtPhone.style.backgroundColor = "#ffffff";
	document.frm.txtEmail.style.backgroundColor = "#ffffff";
	document.frm.txtFax.style.backgroundColor   = "#ffffff";
	
	//if(document.frm.selContactMethod.options[document.frm.selContactMethod.selectedIndex].value == "Phone"){
	//	document.frm.txtPhone.style.backgroundColor = "#eeeeee";
	//}
	//else
	if(document.frm.selContactMethod.options[document.frm.selContactMethod.selectedIndex].value == "Email"){
		document.frm.txtEmail.style.backgroundColor = "#eeeeee";
	}
	else
	if(document.frm.selContactMethod.options[document.frm.selContactMethod.selectedIndex].value == "Fax"){
		document.frm.txtFax.style.backgroundColor = "#eeeeee";
	}
}

function Process_Airport_Selection(val1, val2, val3)
{
/*
        if (journey == "pu")
        {
                val1 = document.frm.pu_suburb;
                val2 = document.frm.pu_airport;
                val3 = document.frm.pu_state;
        }
        else
        if (journey == "do")
        {
                val1 = document.frm.do_suburb;
                val2 = document.frm.do_airport;
                val3 = document.frm.do_state;
        } 
        else 
        if (journey == "ret_pu")
        {
                val1 = document.frm.ret_pu_suburb;
                val2 = document.frm.ret_pu_airport;
                val3 = document.frm.ret_pu_state;
        }  
        else
        if (journey == "ret_do")
        {
                val1 = document.frm.ret_do_suburb;
                val2 = document.frm.ret_do_airport;
                val3 = document.frm.ret_do_state;
        } 
*/                           
                
        val1.style.backgroundColor = "#ffffff"; 
        //alert("1");       

	if(val2.value == "other"){
		val1.style.backgroundColor = "#eeeeee";
		//alert("2");
	}
        else
        for (var i=1; i < val3.length; i++)
        {
                //alert("3");
                if (val2.value.indexOf(val3[i].value) > 0)
                {
                        //alert(document.frm.pu_state[i].value);
                        val3[i].selected = true;
                        val3.style.backgroundColor = "#ffffff";
                }                
        }                	
}

function Set_Confirmation_Mandatory_field()
{
	document.frm.txtEmail.style.backgroundColor = "#ffffff";
	document.frm.txtFax.style.backgroundColor   = "#ffffff";

	if(document.frm.confirmation.options[document.frm.confirmation.selectedIndex].value == "Email"){
		document.frm.txtEmail.style.backgroundColor = "#eeeeee";
	}
	else
	if(document.frm.confirmation.options[document.frm.confirmation.selectedIndex].value == "Fax"){
		document.frm.txtFax.style.backgroundColor = "#eeeeee";
	}
}

function Set_Occasion_Mandatory_field()
{
	document.frm.txtHoursRequired.style.backgroundColor = "#ffffff";

	if(document.frm.selOccasion.value == "Wedding"){
		document.frm.txtHoursRequired.style.backgroundColor = "#eeeeee";
	}
}

function ToggleDivision(e, division)
{
	var objSpan = document.getElementById(division);
	// if e is null, then no object checking is required to make a division visible i.e. wedding packages
	if ((e == null) || (e.checked))
	{
		objSpan.style.display = "block";
		if (division == "return-details")
		{
			// Ensure that pickup date is marked as mandatory
			document.frm.ret_PU_DD.style.backgroundColor = "#eeeeee";
			document.frm.ret_PU_MM.style.backgroundColor = "#eeeeee";
			document.frm.ret_PU_YY.style.backgroundColor = "#eeeeee";
		}
	}
	else
		objSpan.style.display = "none";
}

function PopulateAddress(e, airport_a, addr_a1, addr_a2, sub_a, state_a, airport_b, addr_b1, addr_b2, sub_b, state_b)
{
        //alert(document.getElementById(airport_a).value);
        //alert(document.getElementById(airport_b).value);
	if (e.checked)
	{
		if (document.getElementById(airport_a))	
		{
			document.getElementById(airport_b).value = document.getElementById(airport_a).value;
		}
		document.getElementById(addr_b1).value = document.getElementById(addr_a1).value;
		if (document.getElementById(addr_a2))	
			document.getElementById(addr_b2).value = document.getElementById(addr_a2).value;		
		document.getElementById(sub_b).value = document.getElementById(sub_a).value;
		document.getElementById(state_b).value = document.getElementById(state_a).value;
	}
	else
	{
		document.getElementById(airport_b).value = "other";	
		document.getElementById(addr_b1).value = "";
		document.getElementById(addr_b2).value = "";		
		document.getElementById(sub_b).value = "";
		document.getElementById(state_b).value = "";
	}
}

function PopulateAddress2(e, airport_a, addr_a1, addr_a2, sub_a, state_a, airport_b, addr_b1, addr_b2, sub_b, state_b)
{
	if (e.checked)
	{
		airport_b.value = airport_a.value;
		addr_b1.value = addr_a1.value;
		addr_b2.value = addr_a2.value;		
		sub_b.value = sub_a.value;
		state_b.value = state_a.value;
		
		sub_b.style.backgroundColor = "#ffffff";
	}
	else
	{
		airport_b.value = "other";	
		addr_b1.value = "";
		addr_b2.value = "";		
		sub_b.value = "";
		state_b.value = "";
	}
}

function CheckDate(return_required)
{
// This function will check that pickup date > current date and return pickup date > pickup date

	// Get current date / time
	var today = new Date();
	difference = 0;

	// Calculate pickup date / time value
	yr = document.frm.PU_YY.value; mth = document.frm.PU_MM.value - 1; day = document.frm.PU_DD.value;
	if (document.frm.PU_T_HH.value == "")
		hr_24 = today.getHours();
	else
	{
		if (document.frm.am_pm[0].checked && Number(document.frm.PU_T_HH.value == 12))
		// 12 am 
			hr_24 = 0;
		else
		if (document.frm.am_pm[0].checked || Number(document.frm.PU_T_HH.value == 12))
		// 1 am to 12 pm
			hr_24 = Number(document.frm.PU_T_HH.value);
		else
		// 1 pm to 11 pm
			hr_24 = Number(document.frm.PU_T_HH.value) + 12;
	}
	if (document.frm.PU_T_MM.value == "")
		mins = today.getMinutes();
	else
		mins = document.frm.PU_T_MM.value

	// Pickup date / time must be greater than current date / time
	var pu_date = new Date(yr, mth, day, hr_24, mins); 
	var current = new Date(today.getFullYear(), today.getMonth(), today.getDate(), today.getHours(), today.getMinutes()); 
	//alert(yr + ", " + today.getFullYear()); alert(mth + ", " + today.getMonth()); alert(day + ", " + today.getDate()); alert(hr_24 + ", " + today.getHours()); alert(mins + ", " + today.getMinutes());

	if (return_required == true) // return journey
	{
		// Calculate return pickup date / time value
		ryr = document.frm.ret_PU_YY.value; rmth = document.frm.ret_PU_MM.value - 1; rday = document.frm.ret_PU_DD.value;
		if (document.frm.ret_PU_T_HH.value == "")
			rhr_24 = today.getHours();
		else
		{
			//alert(document.frm.ret_am_pm[0].checked);
			if (document.frm.ret_am_pm[0].checked && Number(document.frm.ret_PU_T_HH.value == 12))
			// 12 am 
				rhr_24 = 0;
			else
			if (document.frm.ret_am_pm[0].checked || Number(document.frm.ret_PU_T_HH.value == 12))
			// 1 am to 12 pm
				rhr_24 = Number(document.frm.ret_PU_T_HH.value);
			else
			// 1 pm to 11 pm
				rhr_24 = Number(document.frm.ret_PU_T_HH.value) + 12;
		}
		if (document.frm.ret_PU_T_MM.value == "")
			rmins = today.getMinutes();
		else
			rmins = document.frm.ret_PU_T_MM.value

		var ret_pu_date = new Date(ryr, rmth, rday, rhr_24, rmins);    

		difference = ret_pu_date - pu_date;
		//alert("Difference return: " + difference);
		return (difference);
	}
	else
	{
		difference = pu_date - current;
		//alert("Difference: " + difference);	
		return (difference);
	}
}

function CheckDate_scb(route_num)
{
// This function will check that pickup date is one day ahead

	// Calculate pickup date
	yr = document.frm.PU_YY.value; mth = document.frm.PU_MM.value - 1; day = document.frm.PU_DD.value;
	var pu_date = new Date(yr, mth, day, 0, 0); 
	
	// Calculate current date
	var today = new Date();
        var current = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0); 

        // Route operation for new timetable: 22nd October (changed from 15th October)
        //var route_avail_new_tt = new Date(2007, 09, 22, 0, 0); // 22nd October start operating (month is 0 based)

	difference = pu_date - current;
        //alert("Difference: " + difference);	
        if (difference < 86400000)  // 1 day
                return(false)
        else
                return(true);	
}

function CheckTimes_scb()
{
// This function will check that return pickup date > pickup date

        times_OK = true;
	if ((document.frm.departing_1.value != "") && (document.frm.departing_2.value != ""))
	{
	        hr_24 = Number(document.frm.departing_1.value.split(":")[0]);
                mins = Number(document.frm.departing_1.value.split(":")[1]);
        	        
	        rhr_24 = Number(document.frm.departing_2.value.split(":")[0]);
	        //alert("rhr_24: " + rhr_24);
		rmins = Number(document.frm.departing_2.value.split(":")[1]);
		//alert("rmins: " + rmins);

                pu_time = new Date(0, 0, 0, hr_24, mins); 
	        var ret_pu_time = new Date(0, 0, 0, rhr_24, rmins);    

	        difference = ret_pu_time - pu_time;
	        if (difference <= 0)
	                times_OK = false;
	}
	return(times_OK);
}

function ValidQuoteNum()
{
// Check for a valid quote number ('I' followed by 4-5 digits)
	var valid = true;
	var re=/^I\d{4,5}$/

	quote_num = document.frm.QuoteNumber.value.toUpperCase();
	if (quote_num.indexOf("I") < 0)
		quote_num = "I" + quote_num;

	if (!re.test(quote_num))
		valid = false;
	else
		document.frm.QuoteNumber.value = quote_num;
	    
	return valid;
}

function ValidCreditCardNum(cardNumber) 
{ 
// Firstly check that credit card # is between 13 and 16 digits
	var re=/^\d{13,16}$/

	if (!re.test(Trim(cardNumber)))
		return(false);

// Check for a Valid credit card (Luhn algorithm: see site http://www.expertrating.com/courseware/JavaScriptCourse/JavaScript-Forms-9.asp)
	var ccn = new Array(cardNumber.length); 
	var n = 0,sum = 0; 

	for(n = 0; n < cardNumber.length; ++n) 
		ccn[n] = parseInt (cardNumber.charAt(n)); 

	for(n = ccn.length -2; n >= 0; n-=2) 
	{
		ccn[n] *= 2; 
		if(ccn[n] > 9) 
			ccn[n]-=9; 
	}

	for(n = 0; n < ccn.length; ++n) 
		sum += ccn[n]; 
	//alert("Sum: " + sum);

	return(((sum%10)==0)?true : false);
}

function ValidCVVNum(cvvNumber) 
{ 
// Check that CVV # is between 3 and 4 digits
	var valid = true;
	var re=/^\d{3,4}$/

	if (!re.test(Trim(cvvNumber)))
		valid = false;

	return valid;
}

function ValidExpiryDate(exp_mth, exp_yr) 
{ 
	today = new Date();	
	yr = 20 + exp_yr; mth = exp_mth - 1;
	exp_date = new Date(yr, mth, 0, 0, 0); 
	current = new Date(today.getFullYear(), today.getMonth(), 0, 0, 0); 
	difference = exp_date - current;
	return((difference >= 0)?true : false);
}

function VehiclePassed(veh)
{       
	// Pre-populates form with vehicle selected from a fleet photo gallery

	//Session vars - try later
	//Response.Write "test2: " & Session("colleen")
	//Session.Contents.Remove("colleen")
	//Response.Write "test3: " & Session("colleen")

        if (veh != "")
        {
                //alert(veh);         
	        veh1 = veh.split(",")[0]
	        if (veh.split(",")[1])
	                veh2 = veh.split(",")[1].split(":")[0]
	        else
	                veh2 = "";
	        //alert(veh1);
	        //alert(veh2);
	        //alert(<% =Session("colleen") %>); Doesn't work

	        for (var x = 1; x < document.frm.selVehicle.length; x++)
	        {
		        if (document.frm.selVehicle[x].value.indexOf(veh1) >= 0) 
		        {  
			        document.frm.selVehicle[0].selected = false;		
			        document.frm.selVehicle[x].selected = true;
			        break;
		        }
	        }

	        if (veh2.length > 0)
		        document.frm.txtSpecialRequests.value = "(Gallery selection): " + veh2;

/*
Feb 2008 - Possibly implement this code later
Issues with multiple vehicle selections on the booking form, which may not all be a wedding package

                if (veh1.indexOf("Package") == 0)
                {
                        document.frm.selOccasion.value = "Wedding";
                        ToggleDivision(null, 'wedding_package');
                        PopulateWeddingPrices(veh1);
                }
*/                		        
	}	
}

/*
function CheckForWeddingPackageSelection()
{
Change this code to allow vehicle selected to be checked - only if there is one (or multiple?) wedding package selected should you display the pricing information, as this will handle the majority of cases

        // Ignore 1st value, as it is "Select vehicle(s) required from choices below..."
        for (var i=1; (i < document.frm.selVehicle.length) && (veh_selected == false); i++)
        {
                if (document.frm.selVehicle[i].selected)
                        veh_selected = true;
        }

        if (veh.indexOf("Package") == 0)
        {
                document.frm.selOccasion.value = "Wedding";
                ToggleDivision(null, 'wedding_package');
                PopulateWeddingPrices(veh);
        }
}
*/

function PopulateWeddingPrices(veh)
{ 
        if (veh1.indexOf("Package 1G") == 0)
        {
                full_package_cost = 2700;

        }
        else
        if (veh1.indexOf("Package 1") == 0)
        {
                full_package_cost = 2500;
        } 
        
        discounted_full_package_cost = full_package_cost - (full_package_cost * .05);
        document.frm.wp_cost.value = formatNumber(full_package_cost,2,',','.','$','','-','');
        document.frm.wp_cost_d.value = formatNumber(discounted_full_package_cost,2,',','.','$','','-','');        
}

function TourDetailsPassed(tour)
{
	// Pre-populates form with vehicle / tour selected from tour page
	//alert("in TourDetailsPassed");
	//alert(tour);

        if (tour != "")
        {	
	        vehicle = tour.split(";")[0];
	        //alert("vehicle: " + vehicle); 
	        	        
	        tour_details = tour.split(";")[1];
	        if (tour_details != "")
	        {
	                tour_type = tour_details.split(",")[0];
	                //alert("tour type: " + tour_type);
	        }
	}

        // Pre-populate with vehicle selection	
        if (vehicle != "")
        {
                //alert("array length: " + document.frm.selVehicle.length);
	        for (var x = 1; x < document.frm.selVehicle.length; x++)
	        {
		        if (document.frm.selVehicle[x].value.indexOf(vehicle) >= 0) 
		        {  
			        document.frm.selVehicle[0].selected = false;		
			        document.frm.selVehicle[x].selected = true;
			        break;
		        }
	        }
	}
	
        // Pre-populate with tour type	
        if (tour_type != "")
        {
                //alert("array length: " + document.frm.selTour.length);
	        for (var x = 1; x < document.frm.selTour.length; x++)
	        {
		        if (document.frm.selTour[x].value.indexOf(tour_type) >= 0) 
		        {  
			        document.frm.selTour[0].selected = false;		
			        document.frm.selTour[x].selected = true;
			        break;
		        }
	        }
	}	
        //alert("end TourDetailsPassed");
        setDefaultStartTime(); 
}

function setDefaultStartTime()
{
	if (document.frm.selTour.selectedIndex != 0)
	{
	        // Pre-populate with default tour pickup hour
	        tour_start_hour = defaultStartTime[document.frm.selTour.selectedIndex - 1].split(":")[0];
	        for (var x = 1; x < document.frm.PU_T_HH.length; x++)
	        {
		        if (document.frm.PU_T_HH[x].value.indexOf(tour_start_hour) >= 0) 
		        {  
			        document.frm.PU_T_HH[0].selected = false;		
			        document.frm.PU_T_HH[x].selected = true;
			        break;
		        }
	        } 
	        
	        // Pre-populate with default tour pickup mins
	        tour_start_mins = defaultStartTime[document.frm.selTour.selectedIndex - 1].split(":")[1];
	        for (var x = 0; x < document.frm.PU_T_MM.length; x++)
	        {
		        if (document.frm.PU_T_MM[x].value.indexOf(tour_start_mins) >= 0) 
		        {  
			        document.frm.PU_T_MM[0].selected = false;		
			        document.frm.PU_T_MM[x].selected = true;
			        break;
		        }
	        }	        
	}
        //alert("end setDefaultStartTime");        	
	calculateTourCost();				
}

function calculateTourCost()
{
	if ((document.frm.selTour.selectedIndex != 0) && (document.frm.selVehicle.selectedIndex != 0))
	{
	        full_tour_cost = tourPrices[document.frm.selTour.selectedIndex - 1][document.frm.selVehicle.selectedIndex - 1];
	        discounted_tour_cost = full_tour_cost - (full_tour_cost * .05);
	        document.frm.tour_cost.value = formatNumber(full_tour_cost,2,',','.','$','','-','');
	        document.frm.tour_cost_d.value = formatNumber(discounted_tour_cost,2,',','.','$','','-','');
	        //alert(document.frm.selVehicle.selectedIndex);
	}
	else
	{
	        document.frm.tour_cost.value = "unknown";
	        document.frm.tour_cost_d.value = "unknown";	
	}
	//alert("end calculateTourCost"); 
}

// number formatting function
// copyright Stephen Chapman 24th March 2006, 10th February 2007
// permission to use this function is granted provided
// that this copyright notice is retained intact

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0');y.splice(z, 0, pnt); while (z > 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}

function test33()
{
	//alert("test");
}

//--><!]]>