/**
	The functions below are used to show and hide boxes in a form.
	
	The form allows upto 10 rooms to be chosen from a select box.
	When a number is selected, that many boxes of form fields 
	need to be shown to allow the user to fill in details for the room.
	The details for each room allow upto 6 children to be chosen from a select box.
	When a number is selected, that many text fields need to be show to allow the user
	to enter the age of each child in the room.
	
	The room boxes in the form should be called "folding#" where "#" is a number from
	1 to maxUnits.
	The chilren boxes in the forms should be called "folding#_?" where "#" is the room number
	and "?" is a number from 1 to maxChilren.
	
	Dreamweaver, eat my pants.
	
	The functions will only work for browsers that support getElementById 
	(IE 5+, Netscape 6+, Firefox and most modern browsers).
	
	18 July 2006
	
	Added seatUpgradeSelected function for page9_new.htm to calculate the seating extra cost when
	different options are selected.
	
	Added insuranceQtySelected function for insurance_trs.htm to calculate subtotal when a
	quantity of insurance package(s) is(are) selected.
	
	Added a call to "correctHolidayDates" in the hideOnLoad function so that the
	earliest departure and return dates are automatically selected in the date boxes
	
	27 June 2006
	
	Added correctHolidayDates function to make sure that a person cannot select a commence date less than
	15 days from today.  This updates the return date to be at least a day later.
	
	TODO ??? - make the system generate dates dynamically so we have 12 months from this one..
	
	
	08:11 19th Dec 2005
		unitNum = parseInt(obj.id.substr(obj.id.indexOf("_") + 1)); (in the childrenChange function)
	was changed to:
		unitNum = parseInt(obj.id.substr(obj.id.indexOf(".") + 1));
	in order to allow for Travel Options change to the variable name structure from:
		unit1childage_1_1
	to the following with "." instead of "_":
		rep_accom_child_age.1.1
	
	I love those single character change fixes!!
	
	Tested on PC ie6, firefox, OS9 ie5.1, OSx ie 5.2, OSx Firefox,
	
	Toby P
	
	
*/
//Debugging - if this is "true" you get an alert box when you do things...

debug = false;
//debug = true;
//The maximum number of rooms - if you add rooms to the form, then increase this.
var maxUnits = 10;
//The maximum number of children in each room - increase for more children.
var maxChildren = 6;
//The minimum number of days between commence & return dates.
var minDays = 15;
/**
	function: correctHolidayDates
	param:	  nothing
	returns:  nothing.
	does:	  Retrieves values from the commence & return date dropdowns,
	          checks that the return date is minDays after the commence date
	          if not, it will set the values of the return date to this.
	          Does not wrap round to the next year because these values are not
	          in the box...

*/
//****************This is from the date.js but the browsers were unable to find it **********************  	
// Add an amount of time to a date. Negative numbers can be passed to subtract time.
Date.prototype.add = function(interval, number) {
	if (typeof(interval)=="undefined" || interval==null || typeof(number)=="undefined" || number==null) { 
		return this; 
	}
	number = +number;
	if (interval=='y') { // year
		this.setFullYear(this.getFullYear()+number);
	}
	else if (interval=='M') { // Month
		this.setMonth(this.getMonth()+number);
	}
	else if (interval=='d') { // Day
		this.setDate(this.getDate()+number);
	}
	else if (interval=='w') { // Weekday
		var step = (number>0)?1:-1;
		while (number!=0) {
			this.add('d',step);
			while(this.getDay()==0 || this.getDay()==6) { 
				this.add('d',step);
			}
			number -= step;
		}
	}
	else if (interval=='h') { // Hour
		this.setHours(this.getHours() + number);
	}
	else if (interval=='m') { // Minute
		this.setMinutes(this.getMinutes() + number);
	}
	else if (interval=='s') { // Second
		this.setSeconds(this.getSeconds() + number);
	}

	return this;
}
//*****************************************************************************************************************
    // Function to allow one JavaScript file to be included by another.
    // Copyright (C) 2006 www.cryer.co.uk
    function includeJS(js)
    {
      document.write('<script type="text/javascript" src="'
        + js + '"></script>'); 
    }
    includeJS('./js/date.js');



function correctHolidayDates() {
    
    var depMonthFld = document.getElementById("enq_dep_month");
    var depDayFld = document.getElementById("enq_dep_day");
    var retMonthFld = document.getElementById("enq_ret_month");
    var retDayFld = document.getElementById("enq_ret_day");
      //Create String in form d-MMyy i.e. 03-1106 = 3rd November 2006

    var depStr = depDayFld[depDayFld.selectedIndex].value + "-" + depMonthFld[depMonthFld.selectedIndex].value;
    var retStr = retDayFld[retDayFld.selectedIndex].value + "-" + retMonthFld[retMonthFld.selectedIndex].value;
            //alert("depart " + depStr + " return " + retStr);   
    if(true == debug) {
        alert("depart " + depStr + " return " + retStr + " Date Version " + Date.$VERSION);
    }
    if(false == Date.isValid(depStr, "d-MMyy")) {
        alert("invalid date " + depStr);
        return;
    }                              
        //alert("depart " + depStr + " return " + retStr + " Date Version " + Date.$VERSION);
    
    //var res=document.getElementById("result");
    //res.value=depStr+"  "+retStr;   
   
    var depDate = Date.parseString(depStr, "d-MMyy");
    var retDate = Date.parseString(retStr, "d-MMyy");
    
    earliestDepDate = new Date();
    var tmpDate = earliestDepDate.add("d", minDays);//today+15 days
    
    if(true == debug) {
        alert("Chosen Dep " + depDate); 
        alert("Earliest Dep " + tmpDate);
    }
    
    //First set the date to be minDays from today.
    if(true == depDate.isBefore(tmpDate)) {
        depDate = earliestDepDate;//.add("d", minDays);
        if(true == debug) {
            alert("depDate is now " + depDate);
        }
        var depMonth = tmpDate.format("MMyy");
        var depDay = tmpDate.format("d");
        
        //Can't seem to get this working - declared in validation.js
        //I can!!. You didn't declare a link to validations.js in the header. Neil 2/2/07  
        /*      
        setInputValue(retDayFld, retDay);
        setInputValue(retMonthFld, retMonth);
        */
        /*Use this instead..*/
        var o=depDayFld.options;
		for(var i=0;i<o.length;i++){
			if(o[i].value==depDay){o[i].selected=true;}
			else{o[i].selected=false;}
		}
        o=depMonthFld.options;
		for(i=0;i<o.length;i++){
			if(o[i].value==depMonth){o[i].selected=true;}
			else{o[i].selected=false;}
		}  
		
    }   
    //Now make the return date minimum the day after departure.
    tmpDate = depDate.add("d", 1);
    
    if(true == debug) {
        alert("tmp " + tmpDate.getDate() + " " + tmpDate.getMonthName() + " " + tmpDate.getFullYear());
    }
    
    if(true == retDate.isBefore(tmpDate)) {
        
        retDate = tmpDate;
        var retMonth = tmpDate.format("MMyy");
        var retDay = tmpDate.format("d");
        
        //Can't seem to get this working - declared in validation.js
        //I can!!. You didn't declare a link to validations.js in the header. Neil 2/2/07
        /*
        setInputValue(retDayFld, retDay);
        setInputValue(retMonthFld, retMonth);
        */
        /*Use this instead..*/
        var o=retDayFld.options;
		for(var i=0;i<o.length;i++){
			if(o[i].value==retDay){o[i].selected=true;}
			else{o[i].selected=false;}
		}
        o=retMonthFld.options;
		for(i=0;i<o.length;i++){
			if(o[i].value==retMonth){o[i].selected=true;}
			else{o[i].selected=false;}
		}
		
        
        if(true == debug) {
            alert("depart " + retDate.getDate() + " " + retDate.getMonthName() + " " + retDate.getFullYear());
        }
    }
}

/**
	function: unitsChange
	param:	  obj - a select box.
	returns:  nothing.
	does:	  Retrieves the number selected, counts from 
			  1 to maxUnits and gets the name of a "div" that
			  we can hide - the "div" is called "folding#"
			  where "#" is a number.
			  It hides the box, then if the counter is less than
			  or equal to the selected number, it will show the box.

*/

function unitsChange(obj) {
	if(!document.getElementById) {
		return;
	}
	if("units" != obj.id) {
		return;
	}
	var numUnits = obj.options[obj.selectedIndex].value;
	
	if(true == debug) {
		alert("numUnits " + numUnits);
	}
	for(i = 1;i <= maxUnits;i++) {
		var foldingDiv = document.getElementById("folding" + i);
		foldingDiv.style.display = "none";
		if(i <= numUnits) {
			foldingDiv.style.display = "inline";
		}
	}
}


/**
	function: childrenChange
	param:	  obj - a select box.
	returns:  nothing.
	does:	  Retrieves the number selected, counts from 
			  1 to maxChildren and gets the name of a "span" that
			  we can hide - the "span" is called "folding#_?"
			  where "#" is the number of the "units" "div" (above)
			  and "?" is the number of a "span" containing in that "div".
			  It hides the "span", then if the counter is less than
			  or equal to the selected number, it will show that "span".
*/
function childrenChange(obj) {
	if(!document.getElementById) {
		return;
	}
	var numChildren = obj.options[obj.selectedIndex].value;
	
	if(true == debug) {
		alert(obj.id + " value is " + numChildren);
	}
	
	//The following line used "_" but the live Travel Options site uses "."
	//unitNum = parseInt(obj.id.substr(obj.id.indexOf("_") + 1));
	var unitNum = parseInt(obj.id.substr(obj.id.indexOf(".") + 1));
	
	if(isNaN(unitNum)) {
		if(true == debug) {
			alert("unitNum is not a number " + unitNum);
		}
		return
	}
	var str = "folding" + unitNum + "_";
	if(true == debug) {
		alert("str " + str);
	}
	
	for(i = 1;i <= maxChildren;i++) {
		var spanfield = document.getElementById(str + i);
		
		//if you uncomment this you will have to do lots of clicking  - only do it if something is knackered.
		/*if(true == debug) {
			alert("(str) "+ str + "_" + i);
		}
		*/
		
		spanfield.style.display = "none";
		if(i <= numChildren) {
			spanfield.style.display = "inline";		
		}
		
	}
}

/**
	function: 	hideOnLoad
	param:	  	hideChildren - boolean - if the form has "child age" boxes, set to true.
	returns:  	nothing.
	does:	  	loops through the "units" boxes and each of the "children" boxes
				inside a "units" box and hides them all.
				This is because we have to start off with showing all the boxes because
				people may not have javascript so the show / hide thing won't work and
				they need to see everything.
				This function is called after the form with the boxes in.
*/
function hideOnLoad(hideChildren) {
	if(document.getElementById) {
		for(i = 1;i <= maxUnits;i++) {
			if(true == hideChildren) {
			    for(j = 1;j <= maxChildren;j++) {
			    	var foldingChild = document.getElementById("folding" + i + "_" + j);
			    	
			    	
		            //if you uncomment this you will have to do lots of clicking  - only do it if something is knackered.
		            /*if(true == debug) {
		            	alert("(foldingChild) "+ foldingChild + " i " + i + " j " + j);
		            }*/
		        
			    	
			    	foldingChild.style.display = "none";
			    }
			}
			foldingDiv = document.getElementById("folding" + i);
			
			//if you uncomment this you will have to do lots of clicking  - only do it if something is knackered.
		    /*if(true == debug) {
		    	alert("(foldingDiv) "+ foldingDiv + " i " + i);
		    }*/
			
			foldingDiv.style.display = "none";
		}
	}
	
	//Now call the dates function to sort out the earliest departure date
	//correctHolidayDates();
	changeDiv();
}

/*
	function	seatUpgradeSelected
	param		A number used to reference a select box and 2 span elements
	return		nothing
	does		updates the cost fields when someone chooses a seat upgrade
				on the "Seating / Cabin Requirments" page
				The number passed in is used to refer to elements containing the
				selected quantity, the cost per upgrade and the target where the 
				value is output.
*/
function seatUpgradeSelected(num) {
	if(true == debug) {
		alert("seatUpgradeSelected " + num);
	}
	
	//Get the select box
	var selectBox = document.getElementById("enq_av_quantity." + num);
	
	//and quantity
	var selectQty = parseInt(selectBox.options[selectBox.selectedIndex].childNodes[0].nodeValue);
	//if(0 == selectQty || true == isNaN(selectQty)) { //adjusted by Richard 110806 - 16:52
	if(true == isNaN(selectQty) && 0 != selectQty) {
		alert("selectQty isNaN " + selectBox);
		return;	
	}
	
	//Get the corresponding cost field.
	var upgradeCost = parseFloat(document.getElementById("gav_stg_adult_price." + num).childNodes[0].nodeValue);
	
	//Get the placeholder for results
	var upgradeTotal = document.getElementById("gav_stg_avail_text." + num);
	
	//Do the sums
	var total = selectQty * upgradeCost;
	
	if(true == debug) {
		alert("selectQty " + selectQty + " upgradeCost " + upgradeCost + " total " + total);
	}
	
	//Update the placeholder
	upgradeTotal.childNodes[0].nodeValue = total.toFixed(2);
}

/*
	function	insuranceQtySelected
	param		A number used to reference a select box and 2 span elements
	return		nothing
	does		updates the cost fields when someone chooses an insurance package
				on the "Holiday Insurance" page
				The number passed in is used to refer to elements containing the
				selected quantity, the cost per upgrade and the target where the 
				value is output.
*/
function insuranceQtySelected(num) {
	if(true == debug) {
		alert("insuranceQtySelected " + num);
	}
	
	//Get the select box
	var selectBox = document.getElementById("enq_av_quantity." + num);
	
	//and quantity
	var selectQty = parseInt(selectBox.options[selectBox.selectedIndex].childNodes[0].nodeValue);
	//if(false == isNaN(selectQty) && 0 != selectQty) {
	if(false == isNaN(selectQty)) {	
		//Get the corresponding cost field.
		var insuranceCost = parseFloat(document.getElementById("gav_price1." + num).childNodes[0].nodeValue);
		
		//Get the placeholder for results
		var insuranceTotal = document.getElementById("enq_ins_subtotal." + num);
		
		//Do the sums
		var total = selectQty * insuranceCost;
		
		if(true == debug) {
			alert("selectQty " + selectQty + " insuranceCost " + insuranceCost + " total " + total);
		}
	
		//Update the placeholder
		insuranceTotal.childNodes[0].nodeValue = total.toFixed(2);
	}

	//now update the tickbox setting
	updateInsuranceTickBox();
}

/*
	function	updateInsuranceTickBox
	param		nothing
	return		nothing
	does		Loops through each of the select boxes on the "Holiday Insurance"
				page and if all the quantities are set to "0" it will hide the
				paragraph containing the "tick box" for "I Agree to terms & conditions"
*/
function updateInsuranceTickBox() {
	
	//Number of insurance packages returned by our system.
	var numPackages = document.getElementById("numInsurancePackages").value;

	
	var tickBoxPara = document.getElementById("insurance_tick_box");

	//Display the box by default;
	tickBoxPara.style.display = 'block';	

	for(var i = 1;i <= numPackages;i++) {
		//Get the select box
		var selectBox = document.getElementById("enq_av_quantity." + i);
		//and quantity
		var selectQty = parseInt(selectBox.options[selectBox.selectedIndex].childNodes[0].nodeValue);
		
		if(true == debug) {
			alert("selectBox is " + selectBox + " i is " + i + " selected is " + selectQty);
		}
		
		//If the quantity is a non-zero number, we don't hide the box
		if(true != isNaN(selectQty) && 0 != selectQty) {
			return;
		}
	}
	
	//If we got this far we hide the para
	tickBoxPara.style.display = 'none';		
}

/*
	function	insuranceSubmit
	params		none
	return		nothing
	does		returns nothing if insurance box(es) are not ticked
				if they all are then submits form OR if insurance is not selected then
				submits
*/
function validate(form) {
	//Number of insurance packages returned by our system.
	var numPackages = document.getElementById("numInsurancePackages").value;

	for(var i = 1;i <= numPackages;i++) {
		//Get the select box
		var selectBox = document.getElementById("enq_av_quantity." + i);
		//and quantity
		var selectQty = parseInt(selectBox.options[selectBox.selectedIndex].childNodes[0].nodeValue);
		}
	if(!document.add_insurance.booking_cond.checked && 0 != selectQty){
    alert("You must tick the box to agree you have read the Summary of Insurance Cover");
  return false; }
return true;
}

function changeDiv(type) {
	/*if (type == "submit") {
		document.getElementById("loadingdiv").style.display='inline';
		document.getElementById("loadingdiv").style.visibility='visible';
		document.getElementById("loadingimg").innerHTML = "<img src=\"images/loading_circle_07.gif\"><br>Loading... please wait";
	}
	else {
		document.getElementById("loadingdiv").style.display='none';
		document.getElementById("loadingdiv").style.visibility='hidden';
	}*/
}
//***********************************************************************************************
//********************************New Section ***************************************************
//***********************************************************************************************

	var datesDebug=false;
	//var today = new Date(2007,2,30); 
	var today = new Date();
	//alert("Today is "+today);
	var earliestDepart= today.add("d",minDays); //minDays is 15
	var cYear = earliestDepart.getFullYear();	//Year in YYYY format
	//var cYear = 2008;
	var cMonth =earliestDepart.getMonth();		//Month in mm form where Jan=1, Feb=2 etc
	var cDay = earliestDepart.getDate();		//Date in dd form 
	//alert("cDay is "+cDay);
	var earliestRet = earliestDepart.add("d",1);
//****************** Date Data Arrays *************************************** 	
	var Months= new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	var Days = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var CampMonths= new Array("May","June","July","August");
	var CampDays = new Array(31,30,31,31);
	var Camping = false;
//---------------------------Functions----------------------------------------------------------	
	
//***********************************************************************************************
//********************************Called when the page initially loads***************************
//***********************************************************************************************
	function populateDates(camp){
//	alert("Year is : "+cYear+"   Month is : "+cMonth+"  Day is : "+cDay);	
		if(camp == 'true'){
	Camping = true; //camping season dates only
	}
	//alert("Camping is "+Camping);
	//************************Depart Month**********************
	var depMonthBox = document.getElementById("enq_dep_month");	
	populateMonths(depMonthBox,cMonth);//populate options starting with current month
		depMonthBox.options[0].selected=true;//select earliest departure month
	//*****************Depart Date******************************
	var depDateBox=document.getElementById("enq_dep_day");
	if(Camping ==true){cMonth = 4;}
	populateDays(depDateBox,cMonth);
	depDateBox.options[cDay-1].selected=true;//select earliest departure day
		
	if(Camping == false){
	//*****************Return Month*****************************
	var retMonthBox = document.getElementById("enq_ret_month");
	populateMonths(retMonthBox,cMonth);
		retMonthBox.options[0].selected=true;
	//*****************Return Date*****************************
	var retDateBox=document.getElementById("enq_ret_day");
	populateDays(retDateBox,cMonth);
		retDateBox.options[earliestRet.getDate()-1].selected=true;
	//correctHolidayDates();
		}else{
			updateReturnDate();
		}		
	}
//***********************************************************************************************
//********************************Populate just the departure dates******************************
//***********************************************************************************************
	
	function populateDepDates(){
	//**********************Depart Month**************************
	var depMonthBox = document.getElementById("enq_dep_month");	
	populateMonths(depMonthBox,cMonth);//populate options starting with current month
		depMonthBox.options[0].selected=true;//select earliest departure month
	//*********************Depart Date******************************
	var depDateBox=document.getElementById("enq_dep_day");
	populateDays(depDateBox,cMonth);
	depDateBox.options[cDay-1].selected=true;//select earliest departure day
	//correctHolidayDates();
}
//************************************************************************************************	
//******************** Populate the Month options box starting with the current Month*************
//************************************************************************************************
	function populateMonths(dateBox,cM){
	removeOptions(dateBox);	// remove the old options first
	var y = cYear;
	var m = cM;
//	alert("Camping "+Camping);	
	if(false==Camping){
	for (var i=0; i < Months.length;++i){
		m = i+cM;// iteration +currentMonth
		if(m==1 && leap(y)){Days[1]=29;} //if its a leapyear make Feb have 29 days
		if(m>11){m=m-12;y=cYear+1;if(m==1 && leap(y)==1){Days[1]=29;}}//if we go from December to January add 1 to the year				
		dateBox.options[i] = new Option(Months[m]+" "+y,makeDateStr(m,y));
			}
		}else{
	for (var i=0; i < CampMonths.length;++i){
		m = i+4;// iteration +currentMonth
		dateBox.options[i] = new Option(CampMonths[i]+" "+y,makeDateStr(m,y));
			}			
		}
	}
//***********************************************************************************************
//********************************Check if its a leap year **************************************
//***********************************************************************************************
// Returns true if it is.
 	function leap (year) {
		return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 1 : 0;
	}
//***********************************************************************************************
//********************************Populate the days of the month***************************
//***********************************************************************************************

	function populateDays(dateBox,month){
	removeOptions(dateBox);	// remove the old options first
	var st = new String();
	//alert("Month is " + month);	
	for (var i=0; i < Days[month] ;++i){//then set the new ones
		st=(i+1).toString();
		dateBox.options[i] = new Option(st,st);
		}	
	}
//***********************************************************************************************
//********************************Remove any existing Options***************************
//***********************************************************************************************
		
	function removeOptions(dateBox){
		//alert("dataBox length is :"+dateBox.length);
		if(dateBox.length > 0 && dateBox.length != null){
		for (var i=0; i<dateBox.options.length; i++)
		dateBox.options[i] = null;
		}
	}
//***********************************************************************************************
//********************************Create a padded string in the format ss***************************
//***********************************************************************************************

	function pad(s){
		if(s.length <2){s="0"+s;}
		return s;
	}
//***********************************************************************************************
//********************************Create a padded string in the format mmyy***************************
//***********************************************************************************************

	function makeDateStr(m,y){
	var st = new String();
	st=(m+1).toString();	//Month m is 0=Jan, 1=Feb etc
	st = pad(st);			//convert the integer month to a string
	st=st+(y.toString().slice(-2));// add the last two digits of the year
	return st;	
	}
//***********************************************************************************************
//********************************Update the Departure and Return Boxes***************************
//***********************************************************************************************
	
	function updateDays(b,type){
		if(b == "dep_date"){		//departure month has changed so update the the number
									//  of days in the month
		var cM= document.getElementById("enq_dep_month");
		cM=cM.options[cM.options.selectedIndex].value;
		cM= cM.substr(0,2);		//Get the value of the selected option
		populateDays(document.getElementById("enq_dep_day"),cM-1);// set the days to the right number for the month
		if(type == 'single'){	//If there is no return date i.e. a duration box or a micro break of one or two days
			return;
			}
		correctHolidayDates();			
		}
		if((b == "ret_date") || (b == "dep_date")){// Return Month has changed so update the days
		var cM= document.getElementById("enq_ret_month");
		cM=cM.options[cM.options.selectedIndex].value;
		cM= cM.substr(0,2);//Get the value of the return Month
		var retDay=document.getElementById("enq_ret_day");
		//alert("currentMonth = "+cM);
		populateDays(retDay,cM-1);
		correctHolidayDates();
		}
	}
//***********************************************************************************************
//*************Called when there is a duration box instead of a return date**********************
//***********************************************************************************************
	
	function updateReturnDate(){
	var r = document.getElementById('Duration');
	var duration = r.options[r.selectedIndex].value;
	//alert("Duration is "+duration);
	var depMonthFld = document.getElementById("enq_dep_month");
    var depDayFld = document.getElementById("enq_dep_day");
    var depDay = depDayFld[depDayFld.selectedIndex].value;
    var depMonth = depMonthFld[depMonthFld.selectedIndex].value;
      //Create String in form d-MMyy i.e. 03-1106 = 3rd November 2006
    var depStr =  depDay+ "-" +depMonth ;
    //Create a Date object
	var depDate = Date.parseString(depStr, "d-MMyy");
	if(datesDebug){
		//alert("DepDate is :"+depDate);
	}
	//Add Duration days
	var Return = depDate.add("d",duration);	
		//alert("Return is :"+Return);
	var retDayFld = document.getElementById("enq_ret_day");		//Both these are hidden fields in the html form
	var retMonthFld = document.getElementById("enq_ret_month");
	retMonth= Return.format("MMyy");
    retDay = Return.format("d");
	retDayFld.value = retDay;
	retMonthFld.value = retMonth;
	if(datesDebug){
 	//alert("Depart is "+depDay+"  "+depMonth+"  Return is " + retDay + " " + retMonth);	
		}
	}
//***********************************************************************************************
//*************Called to show the departure date**********************
//***********************************************************************************************
	
	function showDepart(){
    var depMonthFld = document.getElementById("enq_dep_month");
    var depDayFld = document.getElementById("enq_dep_day");
    
    var depStr = depDayFld[depDayFld.selectedIndex].value + "-" + depMonthFld[depMonthFld.selectedIndex].value;
       // alert("depart " + depStr);
		
	}

if (document.getElementById('enq_dep_day') != null) {
var t = document.getElementById('enq_dep_day');
	t.setAttribute()
}

function updateTransfersText() {
	if (document.getElementById("enq_requests") != null) {
		var eRequests = document.getElementById("enq_requests");
		
		if (eRequests.checked == 'false') {
			eRequests.value = '';
			eRequests.checked = 'true'
		} else {
			eRequests.value = 'Transfers to/from accommodation not required as making own arrangements';
			eRequests.checked = 'false'
		}
	}
}

function updateCarDetails() {
	//Number of vehicle
	//Either 0 or 1
	var carNumber = document.getElementById("enq_car_qty");
	
	//alert("Vehicle number is : " + carNumber);
	
	if (document.getElementById("vehicledetails") != null) {
		var carDetails = document.getElementById("vehicledetails");
		carDetails.style.display = "none";
		if (carNumber == "1") {
			alert("Car Number is :" + carNumber);
			carDetails.style.display = "block";
		}
	}
}

/*===================================================================
 Author: Matt Kruse
 
 View documentation, examples, and source code at:
     http://www.JavascriptToolbox.com/

 NOTICE: You may use this code for any purpose, commercial or
 private, without any further permission from the author. You may
 remove this notice from your final code if you wish, however it is
 appreciated by the author if at least the web site address is kept.

 This code may NOT be distributed for download from script sites, 
 open source CDs or sites, or any other distribution method. If you
 wish you share this code with others, please direct them to the 
 web site above.
 
 Pleae do not link directly to the .js files on the server above. Copy
 the files to your own server for use with your site or webapp.
 ===================================================================*/
/*
Date functions

These functions are used to parse, format, and manipulate Date objects.
See documentation and examples at http://www.JavascriptToolbox.com/lib/date/

*/
Date.$VERSION = 1.01;

// Utility function to append a 0 to single-digit numbers
Date.LZ = function(x) {return(x<0||x>9?"":"0")+x};
// Full month names. Change this for local month names
Date.monthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
// Month abbreviations. Change this for local month names
Date.monthAbbreviations = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
// Full day names. Change this for local month names
Date.dayNames = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
// Day abbreviations. Change this for local month names
Date.dayAbbreviations = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
// Used for parsing ambiguous dates like 1/2/2000 - default to preferring 'American' format meaning Jan 2.
// Set to false to prefer 'European' format meaning Feb 1
Date.preferAmericanFormat = true;

// If the getFullYear() method is not defined, create it
if (!Date.prototype.getFullYear) { 
	Date.prototype.getFullYear = function() { var yy=this.getYear(); return (yy<1900?yy+1900:yy); } 
} 

// Parse a string and convert it to a Date object.
// If no format is passed, try a list of common formats.
// If string cannot be parsed, return null.
// Avoids regular expressions to be more portable.
Date.parseString = function(val, format) {
	// If no format is specified, try a few common formats
	if (typeof(format)=="undefined" || format==null || format=="") {
		var generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d','MMM-d','d-MMM');
		var monthFirst=new Array('M/d/y','M-d-y','M.d.y','M/d','M-d');
		var dateFirst =new Array('d/M/y','d-M-y','d.M.y','d/M','d-M');
		var checkList=new Array(generalFormats,Date.preferAmericanFormat?monthFirst:dateFirst,Date.preferAmericanFormat?dateFirst:monthFirst);
		for (var i=0; i<checkList.length; i++) {
			var l=checkList[i];
			for (var j=0; j<l.length; j++) {
				var d=Date.parseString(val,l[j]);
				if (d!=null) { 
					return d; 
				}
			}
		}
		return null;
	}

	this.isInteger = function(val) {
		for (var i=0; i < val.length; i++) {
			if ("1234567890".indexOf(val.charAt(i))==-1) { 
				return false; 
			}
		}
		return true;
	};
	this.getInt = function(str,i,minlength,maxlength) {
		for (var x=maxlength; x>=minlength; x--) {
			var token=str.substring(i,i+x);
			if (token.length < minlength) { 
				return null; 
			}
			if (this.isInteger(token)) { 
				return token; 
			}
		}
	return null;
	};
	val=val+"";
	format=format+"";
	var i_val=0;
	var i_format=0;
	var c="";
	var token="";
	var token2="";
	var x,y;
	var year=new Date().getFullYear();
	var month=1;
	var date=1;
	var hh=0;
	var mm=0;
	var ss=0;
	var ampm="";
	while (i_format < format.length) {
		// Get next token from format string
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
		}
		// Extract contents of value based on format token
		if (token=="yyyy" || token=="yy" || token=="y") {
			if (token=="yyyy") { 
				x=4;y=4; 
			}
			if (token=="yy") { 
				x=2;y=2; 
			}
			if (token=="y") { 
				x=2;y=4; 
			}
			year=this.getInt(val,i_val,x,y);
			if (year==null) { 
				return null; 
			}
			i_val += year.length;
			if (year.length==2) {
				if (year > 70) { 
					year=1900+(year-0); 
				}
				else { 
					year=2000+(year-0); 
				}
			}
		}
		else if (token=="MMM" || token=="NNN"){
			month=0;
			var names = (token=="MMM"?(Date.monthNames.concat(Date.monthAbbreviations)):Date.monthAbbreviations);
			for (var i=0; i<names.length; i++) {
				var month_name=names[i];
				if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
					month=(i%12)+1;
					i_val += month_name.length;
					break;
				}
			}
			if ((month < 1)||(month>12)){
				return null;
			}
		}
		else if (token=="EE"||token=="E"){
			var names = (token=="EE"?Date.dayNames:Date.dayAbbreviations);
			for (var i=0; i<names.length; i++) {
				var day_name=names[i];
				if (val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()) {
					i_val += day_name.length;
					break;
				}
			}
		}
		else if (token=="MM"||token=="M") {
			month=this.getInt(val,i_val,token.length,2);
			if(month==null||(month<1)||(month>12)){
				return null;
			}
			i_val+=month.length;
		}
		else if (token=="dd"||token=="d") {
			date=this.getInt(val,i_val,token.length,2);
			if(date==null||(date<1)||(date>31)){
				return null;
			}
			i_val+=date.length;
		}
		else if (token=="hh"||token=="h") {
			hh=this.getInt(val,i_val,token.length,2);
			if(hh==null||(hh<1)||(hh>12)){
				return null;
			}
			i_val+=hh.length;
		}
		else if (token=="HH"||token=="H") {
			hh=this.getInt(val,i_val,token.length,2);
			if(hh==null||(hh<0)||(hh>23)){
				return null;
			}
			i_val+=hh.length;
		}
		else if (token=="KK"||token=="K") {
			hh=this.getInt(val,i_val,token.length,2);
			if(hh==null||(hh<0)||(hh>11)){
				return null;
			}
			i_val+=hh.length;
			hh++;
		}
		else if (token=="kk"||token=="k") {
			hh=this.getInt(val,i_val,token.length,2);
			if(hh==null||(hh<1)||(hh>24)){
				return null;
			}
			i_val+=hh.length;
			hh--;
		}
		else if (token=="mm"||token=="m") {
			mm=this.getInt(val,i_val,token.length,2);
			if(mm==null||(mm<0)||(mm>59)){
				return null;
			}
			i_val+=mm.length;
		}
		else if (token=="ss"||token=="s") {
			ss=this.getInt(val,i_val,token.length,2);
			if(ss==null||(ss<0)||(ss>59)){
				return null;
			}
			i_val+=ss.length;
		}
		else if (token=="a") {
			if (val.substring(i_val,i_val+2).toLowerCase()=="am") {
				ampm="AM";
			}
			else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {
				ampm="PM";
			}
			else {
				return null;
			}
			i_val+=2;
		}
		else {
			if (val.substring(i_val,i_val+token.length)!=token) {
				return null;
			}
			else {
				i_val+=token.length;
			}
		}
	}
	// If there are any trailing characters left in the value, it doesn't match
	if (i_val != val.length) { 
		return null; 
	}
	// Is date valid for month?
	if (month==2) {
		// Check for leap year
		if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
			if (date > 29){ 
				return null; 
			}
		}
		else { 
			if (date > 28) { 
				return null; 
			} 
		}
	}
	if ((month==4)||(month==6)||(month==9)||(month==11)) {
		if (date > 30) { 
			return null; 
		}
	}
	// Correct hours value
	if (hh<12 && ampm=="PM") {
		hh=hh-0+12; 
	}
	else if (hh>11 && ampm=="AM") { 
		hh-=12; 
	}
	return new Date(year,month-1,date,hh,mm,ss);
}

// Check if a date string is valid
Date.isValid = function(val,format) {
	return (Date.parseString(val,format) != null);
}

// Check if a date object is before another date object
Date.prototype.isBefore = function(date2) {
	if (date2==null) { 
		return false; 
	}
	return (this.getTime()<date2.getTime());
}

// Check if a date object is after another date object
Date.prototype.isAfter = function(date2) {
	if (date2==null) { 
		return false; 
	}
	return (this.getTime()>date2.getTime());
}

// Check if two date objects have equal dates and times
Date.prototype.equals = function(date2) {
	if (date2==null) { 
		return false; 
	}
	return (this.getTime()==date2.getTime());
}

// Check if two date objects have equal dates, disregarding times
Date.prototype.equalsIgnoreTime = function(date2) {
	if (date2==null) { 
		return false; 
	}
	var d1 = new Date(this.getTime()).clearTime();
	var d2 = new Date(date2.getTime()).clearTime();
	return (d1.getTime()==d2.getTime());
}

// Format a date into a string using a given format string
Date.prototype.format = function(format) {
	format=format+"";
	var result="";
	var i_format=0;
	var c="";
	var token="";
	var y=this.getYear()+"";
	var M=this.getMonth()+1;
	var d=this.getDate();
	var E=this.getDay();
	var H=this.getHours();
	var m=this.getMinutes();
	var s=this.getSeconds();
	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
	// Convert real date parts into formatted versions
	var value=new Object();
	if (y.length < 4) {
		y=""+(+y+1900);
	}
	value["y"]=""+y;
	value["yyyy"]=y;
	value["yy"]=y.substring(2,4);
	value["M"]=M;
	value["MM"]=Date.LZ(M);
	value["MMM"]=Date.monthNames[M-1];
	value["NNN"]=Date.monthAbbreviations[M-1];
	value["d"]=d;
	value["dd"]=Date.LZ(d);
	value["E"]=Date.dayAbbreviations[E];
	value["EE"]=Date.dayNames[E];
	value["H"]=H;
	value["HH"]=Date.LZ(H);
	if (H==0){
		value["h"]=12;
	}
	else if (H>12){
		value["h"]=H-12;
	}
	else {
		value["h"]=H;
	}
	value["hh"]=Date.LZ(value["h"]);
	value["K"]=value["h"]-1;
	value["k"]=value["H"]+1;
	value["KK"]=Date.LZ(value["K"]);
	value["kk"]=Date.LZ(value["k"]);
	if (H > 11) { 
		value["a"]="PM"; 
	}
	else { 
		value["a"]="AM"; 
	}
	value["m"]=m;
	value["mm"]=Date.LZ(m);
	value["s"]=s;
	value["ss"]=Date.LZ(s);
	while (i_format < format.length) {
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
		}
		if (value[token] != null) { 
			result=result + value[token]; 
		}
		else { 
			result=result + token; 
		}
	}
	return result;
}

// Get the full name of the day for a date
Date.prototype.getDayName = function() { 
	return Date.dayNames[this.getDay()];
}

// Get the abbreviation of the day for a date
Date.prototype.getDayAbbreviation = function() { 
	return Date.dayAbbreviations[this.getDay()];
}

// Get the full name of the month for a date
Date.prototype.getMonthName = function() {
	return Date.monthNames[this.getMonth()];
}

// Get the abbreviation of the month for a date
Date.prototype.getMonthAbbreviation = function() { 
	return Date.monthAbbreviations[this.getMonth()];
}

// Clear all time information in a date object
Date.prototype.clearTime = function() {
  this.setHours(0); 
  this.setMinutes(0);
  this.setSeconds(0); 
  this.setMilliseconds(0);
  return this;
}

// Add an amount of time to a date. Negative numbers can be passed to subtract time.
Date.prototype.add = function(interval, number) {
	if (typeof(interval)=="undefined" || interval==null || typeof(number)=="undefined" || number==null) { 
		return this; 
	}
	number = +number;
	if (interval=='y') { // year
		this.setFullYear(this.getFullYear()+number);
	}
	else if (interval=='M') { // Month
		this.setMonth(this.getMonth()+number);
	}
	else if (interval=='d') { // Day
		this.setDate(this.getDate()+number);
	}
	else if (interval=='w') { // Weekday
		var step = (number>0)?1:-1;
		while (number!=0) {
			this.add('d',step);
			while(this.getDay()==0 || this.getDay()==6) { 
				this.add('d',step);
			}
			number -= step;
		}
	}
	else if (interval=='h') { // Hour
		this.setHours(this.getHours() + number);
	}
	else if (interval=='m') { // Minute
		this.setMinutes(this.getMinutes() + number);
	}
	else if (interval=='s') { // Second
		this.setSeconds(this.getSeconds() + number);
	}
	return this;
}

//Rewrite dep airport select item depending on destination
function showList() {
  var destinationObj = document.getElementById('enq_arr_point');
  var destinationIndex = destinationObj.selectedIndex;
  var destination = destinationObj.options[destinationIndex].value;
  
  if (destination == "JER") {
    //Show departure airports for Jersey
	document.getElementById('depAirport').innerHTML = "<select name=\"enq_dep_point\" id=\"enq_dep_point\" onchange=\"showScheduleGuide();\"><option value=\"LGW\" selected=\"selected\">Please Choose...</option><option value=\"ABZ\">Aberdeen</option><option value=\"BHD\">Belfast City</option><option value=\"BHX\">Birmingham</option><option value=\"BOH\">Bournemouth</option><option value=\"BRS\">Bristol</option><option value=\"CWL\">Cardiff</option><option value=\"DSA\">Doncaster</option><option value=\"DND\">Dundee</option><option value=\"EMA\">East Midlands</option><option value=\"EDI\">Edinburgh</option><option value=\"EXT\">Exeter</option><option value=\"GLA\">Glasgow</option><option value=\"HUY\">Humberside</option><option value=\"IOM\">Isle of Man</option><option value=\"INV\">Inverness</option><option value=\"LPL\">Liverpool</option><option value=\"LGW\">London Gatwick</option><option value=\"LHR\">London Heathrow</option><option value=\"STN\">London Stansted</option><option value=\"LTN\">Luton</option><option value=\"MAN\">Manchester</option><option value=\"NCL\">Newcastle</option><option value=\"NWI\">Norwich</option><option value=\"PLH\">Plymouth</option><option value=\"SOU\">Southampton</option><option value=\"SEN\">Southend</option></select>";
	document.getElementById("schedule-guide").innerHTML = "";
  } else if (destination == "GCI") {
    //Show departure airports for Guernsey
	document.getElementById('depAirport').innerHTML = "<select name=\"enq_dep_point\" id=\"enq_dep_point\" onchange=\"showScheduleGuide();\"><option value=\"LGW\" selected=\"selected\">Please Choose...</option><option value=\"ABZ\">Aberdeen</option><option value=\"BHD\">Belfast City</option><option value=\"BHX\">Birmingham</option><option value=\"BRS\">Bristol</option><option value=\"EMA\">East Midlands</option><option value=\"EDI\">Edinburgh</option><option value=\"EXT\">Exeter</option><option value=\"GLA\">Glasgow</option><option value=\"INV\">Inverness</option><option value=\"JER\">Jersey</option><option value=\"LGW\">London Gatwick</option><option value=\"STN\">London Stansted</option><option value=\"MAN\">Manchester</option><option value=\"NCL\">Newcastle</option><option value=\"NWI\">Norwich</option><option value=\"PLH\">Plymouth</option><option value=\"SOU\">Southampton</option></select>";
	document.getElementById("schedule-guide").innerHTML = "";
  } else if (destination == "-") {
	document.getElementById("schedule-guide").innerHTML = "";
  }
}

function showListFlydrive() {
  var destinationObj = document.getElementById('enq_arr_point');
  var destinationIndex = destinationObj.selectedIndex;
  var destination = destinationObj.options[destinationIndex].value;
  
  if (destination == "JER") {
    //Show departure airports for Jersey
	document.getElementById('depAirport').innerHTML = "<select name=\"enq_dep_point\" id=\"enq_dep_point\" onchange=\"showFlydriveScheduleGuide();\"><option value=\"LGW\" selected=\"selected\">Please Choose...</option><option value=\"ABZ\">Aberdeen</option><option value=\"BHD\">Belfast City</option><option value=\"BHX\">Birmingham</option><option value=\"BOH\">Bournemouth</option><option value=\"BRS\">Bristol</option><option value=\"CWL\">Cardiff</option><option value=\"DSA\">Doncaster</option><option value=\"DND\">Dundee</option><option value=\"EMA\">East Midlands</option><option value=\"EDI\">Edinburgh</option><option value=\"EXT\">Exeter</option><option value=\"GLA\">Glasgow</option><option value=\"PIK\">Glasgow Prestwick</option><option value=\"GCI\">Guernsey</option><option value=\"HUY\">Humberside</option><option value=\"INV\">Inverness</option><option value=\"IOM\">Isle of Man</option><option value=\"LBA\">Leeds Bradford</option><option value=\"LPL\">Liverpool</option><option value=\"LGW\">London Gatwick</option><option value=\"STN\">London Stansted</option><option value=\"LTN\">Luton</option><option value=\"MAN\">Manchester</option><option value=\"NCL\">Newcastle</option><option value=\"NWI\">Norwich</option><option value=\"SOU\">Southampton</option><option value=\"MME\">Teesside</option></select>";
	document.getElementById("schedule-guide").innerHTML = "";
  } else if (destination == "GCI") {
    //Show departure airports for Guernsey
	document.getElementById('depAirport').innerHTML = "<select name=\"enq_dep_point\" id=\"enq_dep_point\" onchange=\"showFlydriveScheduleGuide();\"><option value=\"LGW\" selected=\"selected\">Please Choose...</option><option value=\"ABZ\">Aberdeen</option><option value=\"BHD\">Belfast City</option><option value=\"BHX\">Birmingham</option><option value=\"BRS\">Bristol</option><option value=\"EMA\">East Midlands</option><option value=\"EDI\">Edinburgh</option><option value=\"EXT\">Exeter</option><option value=\"GLA\">Glasgow</option><option value=\"HUY\">Humberside</option><option value=\"INV\">Inverness</option><option value=\"JER\">Jersey</option><option value=\"LGW\">London Gatwick</option><option value=\"STN\">London Stansted</option><option value=\"MAN\">Manchester</option><option value=\"NCL\">Newcastle</option><option value=\"NWI\">Norwich</option><option value=\"SOU\">Southampton</option></select>";
	document.getElementById("schedule-guide").innerHTML = "";
  } else if (destination == "-") {
	document.getElementById("schedule-guide").innerHTML = "";
  }
}

function extraQtySelected(num) {
	if(true == debug) {
		//alert("insuranceQtySelected " + num);
		alert("extraQtySelected " + num);
	}
	
	//Get the select box
	//var selectBox = document.getElementById("enq_av_quantity." + num);
	var selectBox = document.getElementById("enq_extra_quantity." + num);
	
	//and quantity
	var selectQty = parseInt(selectBox.options[selectBox.selectedIndex].childNodes[0].nodeValue);
	//if(false == isNaN(selectQty) && 0 != selectQty) {
	if(false == isNaN(selectQty)) {	
		//Get the corresponding cost field.
		//var insuranceCost = parseFloat(document.getElementById("gav_price1." + num).childNodes[0].nodeValue);
		var extraCost = parseFloat(document.getElementById("extra_price1." + num).childNodes[0].nodeValue);
		
		//Get the placeholder for results
		//var insuranceTotal = document.getElementById("enq_ins_subtotal." + num);
		var extraTotal = document.getElementById("enq_extra_subtotal." + num);
		
		//Do the sums
		//var total = selectQty * insuranceCost;
		var total = selectQty * extraCost;
		
		if(true == debug) {
			//alert("selectQty " + selectQty + " insuranceCost " + insuranceCost + " total " + total);
			alert("selectQty " + selectQty + " extraCost " + extraCost + " total " + total);
		}
	
		//Update the placeholder
		//insuranceTotal.childNodes[0].nodeValue = total.toFixed(2);
		extraTotal.childNodes[0].nodeValue = total.toFixed(2);
	}
}

function showScheduleGuide(airport2,destination2) {
	var destinationObj2 = document.getElementById('enq_arr_point');
	var destinationIndex2 = destinationObj2.selectedIndex;
	var destination2 = destinationObj2.options[destinationIndex2].value;
	
	var airportObj2 = document.getElementById('enq_dep_point');
	var airportIndex2 = airportObj2.selectedIndex;
	var airport2 = airportObj2.options[airportIndex2].value;
	
	if(true == debug) {
		alert("Show schedule guide says this is the destination:" + destination2 + ", and this is the airport: " + airport2);
	}
	
	if (airport2 == "-") {
		document.getElementById("schedule-guide").innerHTML = "";
	}
	if (destination2 == "-") {
		document.getElementById("schedule-guide").innerHTML = "";
	}
	
	if (destination2 == "JER") {
		/*Aberdeen*/if (airport2 == "ABZ") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights. Direct Sat only 22 May to 18 Sep";}
		/*Belfast City*/if (airport2 == "BHD") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights.  Direct Sats only 29 May to 4 Sep.";}
		/*Birmingham*/if (airport2 == "BHX") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Bournemouth*/if (airport2 == "BOH") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Fri, Sat only 29 Mar to 30 Oct";}
		/*Bristol*/if (airport2 == "BRS") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Cardiff*/if (airport2 == "CWL") {document.getElementById("schedule-guide").innerHTML = "Tue, Thu, Sat, Sun 28 Mar to 30 Oct & Wed 26 May to 8 Sep";}
		/*Doncaster*/if (airport2 == "DSA") {document.getElementById("schedule-guide").innerHTML = "Direct Sun to 24 Oct; Tue & Thu 16 Feb to 28 Oct; Sat 3 Apr to 30 Oct";}
		/*Dundee*/if (airport2 == "DND") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 1 May to 18 Sep";}
		/*East Midlands*/if (airport2 == "EMA") {document.getElementById("schedule-guide").innerHTML = "Mon & Fri 4 Jan to 29 Oct; Sat & Sun 13 Feb to 30 Oct. Tue, Wed, Thu 29 Mar to 28 Oct";}
		/*Edinburgh*/if (airport2 == "EDI") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights.  Direct Mon & Fri Jan to Oct; Wed & Sun 28 Mar to 27 Oct;. Tue, Wed, Thu 29 Mar to 28 Oct";}
		/*Exeter*/if (airport2 == "EXT") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Glasgow*/if (airport2 == "GLA") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights. Direct Sat 1 May to 30 Oct, Tue & Thu 18 May to 23 Sep ";}
		/*Glasgow Prestwick*/if (airport2 == "PIK") {document.getElementById("schedule-guide").innerHTML = "Sat only 19 Jun to 18 Sep";}
		/*Guernsey*/if (airport2 == "GCI") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Humberside*/if (airport2 == "HUY") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 1 May to 18 Sep";}
		/*Isle of Man*/if (airport2 == "IOM") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Wed, Fri, Sat, Sun 28 Mar to 30 Oct";}
		/*Inverness*/if (airport2 == "INV") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights";}
		/*Leeds Bradford*/if (airport2 == "LBA") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights.  27 May to 31 Oct direct flights Tue, Thu, Sat & Sun in peak";}
		/*Liverpool*/if (airport2 == "LPL") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Thu, Fri, Sat, Sun Jan to Oct . Also Tue & Wed Jun to Oct";}
		/*London Cityif (airport2 == "LCY") {document.getElementById("schedule-guide").innerHTML = "Mon to - Fri year round";}*/
		/*London Gatwick*/if (airport2 == "LGW") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*London Heathrowif (airport2 == "LHR") {document.getElementById("schedule-guide").innerHTML = "Daily";}*/
		/*London Stansted*/if (airport2 == "STN") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Luton*/if (airport2 == "LTN") {document.getElementById("schedule-guide").innerHTML = "Direct Tue & Thu 9 Feb to 25 Mar. Sun 7 Feb to 24 Oct. Wed, Fri, Sat 31 Mar to 30 Oct";}
		/*Manchester*/if (airport2 == "MAN") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Manstonif (airport2 == "MSE") {document.getElementById("schedule-guide").innerHTML = "Direct Sat Only 1 May to 18 Sep";}*/
		/*Newcastle*/if (airport2 == "NCL") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights. Direct Mon, Wed, Fri, Sun 28 Mar to 30 Oct. Also Sat 1 May to 30 Oct. ";}
		/*Norwich*/if (airport2 == "NWI") {document.getElementById("schedule-guide").innerHTML = "Direct Tue, Thu, Sun 1 Apr to 28 Oct. Also Sat 24 Apr to 18 Sep";}
		/*Plymouth*/if (airport2 == "PLH") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Southampton*/if (airport2 == "SOU") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Southendif (airport2 == "SEN") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 8 May to 25 Sep";}*/
		/*Teeside*/if (airport2 == "MME") {document.getElementById("schedule-guide").innerHTML = "Sat only 22 May to 18 Sep";}
  	}
	if (destination2 == "GCI") {
		/*Aberdeen*/if (airport2 == "ABZ") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights";}
		/*Belfast City*/if (airport2 == "BHD") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights";}
		/*Birmingham*/if (airport2 == "BHX") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Bristol*/if (airport2 == "BRS") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Edinburgh*/if (airport2 == "EDI") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights";}
		/*East Midlands*/if (airport2 == "EMA") {document.getElementById("schedule-guide").innerHTML = "12 Feb - 29 Oct  Mon, Wed, Fri, Sun ";}
		/*Exeter*/if (airport2 == "EXT") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Glasgow*/if (airport2 == "GLA") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights";}
		/*Inverness*/if (airport2 == "INV") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights";}
		/*Jersey*/if (airport2 == "JER") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*London Gatwick*/if (airport2 == "LGW") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Manchester*/if (airport2 == "MAN") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Newcastle*/if (airport2 == "NCL") {document.getElementById("schedule-guide").innerHTML = "Daily non-direct flights";}
		/*Norwich*/if (airport2 == "NWI") {document.getElementById("schedule-guide").innerHTML = "15 May - 18 Sep  Sat only";}
		/*Plymouth*/if (airport2 == "PLH") {document.getElementById("schedule-guide").innerHTML = "Some flights via Jersey (no aircraft change).  Services Sun to Fri with Tue & Thu from 30 Mar.";}
		/*Southampton*/if (airport2 == "SOU") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Stansted*/if (airport2 == "STN") {document.getElementById("schedule-guide").innerHTML = "Daily";}
  	}
	
	
	//var select2 = document.getElementById('enq_dep_point');
    //select2.onchange = airportObj2.options[airportIndex2].value;
	//var select3 = document.getElementById('enq_arr_point');
    //select3.onchange = destinationObj2.options[destinationIndex2].value;
	
	//alert(select2 + ", " + select3);
}

function showFlydriveScheduleGuide(airport2,destination2) {
	var destinationObj2 = document.getElementById('enq_arr_point');
	var destinationIndex2 = destinationObj2.selectedIndex;
	var destination2 = destinationObj2.options[destinationIndex2].value;
	
	var airportObj2 = document.getElementById('enq_dep_point');
	var airportIndex2 = airportObj2.selectedIndex;
	var airport2 = airportObj2.options[airportIndex2].value;
	
	if(true == debug) {
		alert("Show schedule guide says this is the destination:" + destination2 + ", and this is the airport: " + airport2);
	}
	
	if (airport2 == "-") {
		document.getElementById("schedule-guide").innerHTML = "";
	}
	if (destination2 == "-") {
		document.getElementById("schedule-guide").innerHTML = "";
	}
	
	if (destination2 == "JER") {
		/*Aberdeen*/if (airport2 == "ABZ") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 22 May to 18 Sep.  (Also daily non-direct flights - phone to book)";}
		/*Belfast City*/if (airport2 == "BHD") {document.getElementById("schedule-guide").innerHTML = "Direct Sats only 29 May to 4 Sep.  (Also daily non-direct flights - phone to book)";}
		/*Birmingham*/if (airport2 == "BHX") {document.getElementById("schedule-guide").innerHTML = "Direct Flights Daily";}
		/*Bournemouth*/if (airport2 == "BOH") {document.getElementById("schedule-guide").innerHTML = "Mon, Fri, Sat only 29 Mar to 30 Oct 2010";}
		/*Bristol*/if (airport2 == "BRS") {document.getElementById("schedule-guide").innerHTML = "Direct Flights Daily";}
		/*Cardiff*/if (airport2 == "CWL") {document.getElementById("schedule-guide").innerHTML = "Tue, Thu, Sat, Sun 28 Mar to 30 Oct & Wed 26 May to 8 Sep";}
		/*Doncaster*/if (airport2 == "DSA") {document.getElementById("schedule-guide").innerHTML = "Direct Sun to 24 Oct; Tue & Thu 16 Feb to 28 Oct; Sat 3 Apr to 30 Oct";}
		/*Dundee*/if (airport2 == "DND") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 1 May to 18 Sep";}
		/*East Midlands*/if (airport2 == "EMA") {document.getElementById("schedule-guide").innerHTML = "Mon & Fri 4 Jan to 29 Oct; Sat & Sun 13 Feb to 30 Oct.  Tue, Wed, Thu 29 Mar to 28 Oct";}
		/*Exeter*/if (airport2 == "EXT") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Glasgow*/if (airport2 == "GLA") {document.getElementById("schedule-guide").innerHTML = "Direct Sat 1 May to 30 Oct, Tue & Thu 18 May to 23 Sep  (Also daily non-direct flights - phone to book)";}
		/*Guernsey*/if (airport2 == "GCI") {document.getElementById("schedule-guide").innerHTML = "Daily service year round";}
		/*Humberside*/if (airport2 == "HUY") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 1 May to 18 Sep";}
		/*Isle of Man*/if (airport2 == "IOM") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Wed, Fri, Sat, Sun 28 Mar to 30 Oct";}
		/*Inverness*/if (airport2 == "INV") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 19 Jun to 18 Sep.  (Also daily non-direct flights - phone to book)";}
		/*Liverpool*/if (airport2 == "LPL") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Thu, Fri, Sat, Sun Jan to Oct . Also Tue & Wed Jun to Oct";}
		/*London City*/if (airport2 == "LCY") {document.getElementById("schedule-guide").innerHTML = "Mon to - Fri year round";}
		/*London Gatwick*/if (airport2 == "LGW") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*London Heathrowif (airport2 == "LHR") {document.getElementById("schedule-guide").innerHTML = "Daily";}*/
		/*London Stansted*/if (airport2 == "STN") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Luton*/if (airport2 == "LTN") {document.getElementById("schedule-guide").innerHTML = "Direct Tue & Thu 9 Feb to 25 Mar.  Sun 7 Feb to 24 Oct.  Wed, Fri, Sat 31 Mar to 30 Oct";}
		/*Manchester*/if (airport2 == "MAN") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Manston*/if (airport2 == "MSE") {document.getElementById("schedule-guide").innerHTML = "Direct Sat Only 1 May to 18 Sep";}
		/*Newcastle*/if (airport2 == "NCL") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Wed, Fri, Sun 28 Mar to 30 Oct. Also Sat 1 May to 30 Oct. (Also daily non-direct flights - phone to book)";}
		/*Norwich*/if (airport2 == "NWI") {document.getElementById("schedule-guide").innerHTML = "Direct Tue, Thu, Sun 1 Apr to 28 Oct.  Also Sat 24 Apr to 18 Sep";}
		/*Plymouth*/if (airport2 == "PLH") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Southampton*/if (airport2 == "SOU") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Southend*/if (airport2 == "SEN") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 8 May to 25 Sep";}
  	}
	if (destination2 == "GCI") {
		/*Aberdeen*/if (airport2 == "ABZ") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 22 May to 18 Sep.  (Also daily non-direct flights - phone to book)";}
		/*Belfast City*/if (airport2 == "BHD") {document.getElementById("schedule-guide").innerHTML = "Direct Sats only 29 May to 4 Sep.  (Also daily non-direct flights - phone to book)";}
		/*Birmingham*/if (airport2 == "BHX") {document.getElementById("schedule-guide").innerHTML = "Direct Flights Daily";}
		/*Bournemouth*/if (airport2 == "BOH") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Fri, Sat only 29 Mar to 30 Oct";}
		/*Bristol*/if (airport2 == "BRS") {document.getElementById("schedule-guide").innerHTML = "Direct Flights Daily";}
		/*Cardiff*/if (airport2 == "CWL") {document.getElementById("schedule-guide").innerHTML = "Tue, Thu, Sat, Sun 28 Mar to 30 Oct & Wed 26 May to 8 Sep";}
		/*Doncaster*/if (airport2 == "DSA") {document.getElementById("schedule-guide").innerHTML = "Direct Sun to 24 Oct; Tue & Thu 16 Feb to 28 Oct; Sat 3 Apr to 30 Oct";}
		/*Dundee*/if (airport2 == "DND") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 1 May to 18 Sep";}
		/*East Midlands*/if (airport2 == "EMA") {document.getElementById("schedule-guide").innerHTML = "Mon & Fri 4 Jan to 29 Oct; Sat & Sun 13 Feb to 30 Oct.  Tue, Wed, Thu 29 Mar to 28 Oct";}
		/*Edinburgh*/if (airport2 == "EDI") {document.getElementById("schedule-guide").innerHTML = "Direct Mon & Fri Jan to Oct; Wed & Sun 28 Mar to 27 Oct;. Tue, Wed, Thu 29 Mar to 28 Oct (Also daily non-direct flights - phone to book)";}
		/*Exeter*/if (airport2 == "EXT") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Glasgow*/if (airport2 == "GLA") {document.getElementById("schedule-guide").innerHTML = "Direct Sat 1 May to 30 Oct, Tue & Thu 18 May to 23 Sep  (Also daily non-direct flights - phone to book)";}
		/*Jersey*/if (airport2 == "JER") {document.getElementById("schedule-guide").innerHTML = "";}
		/*Humberside*/if (airport2 == "HUY") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 1 May to 18 Sep";}
		/*Isle of Man*/if (airport2 == "IOM") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Wed, Fri, Sat, Sun 28 Mar to 30 Oct";}
		/*Inverness*/if (airport2 == "INV") {document.getElementById("schedule-guide").innerHTML = "Direct Sat only 19 Jun to 18 Sep.  (Also daily non-direct flights - phone to book)";}
		/*Liverpool*/if (airport2 == "LPL") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Thu, Fri, Sat, Sun Jan to Oct . Also Tue & Wed Jun to Oct";}
		/*London City*/if (airport2 == "LCY") {document.getElementById("schedule-guide").innerHTML = "Mon to - Fri year round";}
		/*London Gatwick*/if (airport2 == "LGW") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*London Heathrowif (airport2 == "LHR") {document.getElementById("schedule-guide").innerHTML = "Daily";}*/
		/*London Stansted*/if (airport2 == "STN") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Luton*/if (airport2 == "LTN") {document.getElementById("schedule-guide").innerHTML = "Direct Tue & Thu 9 Feb to 25 Mar.  Sun 7 Feb to 24 Oct.  Wed, Fri, Sat 31 Mar to 30 Oct";}
		/*Manchester*/if (airport2 == "MAN") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Manston*/if (airport2 == "MSE") {document.getElementById("schedule-guide").innerHTML = "Direct Sat Only 1 May to 18 Sep";}
		/*Newcastle*/if (airport2 == "NCL") {document.getElementById("schedule-guide").innerHTML = "Direct Mon, Wed, Fri, Sun 28 Mar to 30 Oct. Also Sat 1 May to 30 Oct. (Also daily non-direct flights - phone to book)";}
		/*Norwich*/if (airport2 == "NWI") {document.getElementById("schedule-guide").innerHTML = "Direct Tue, Thu, Sun 1 Apr to 28 Oct.  Also Sat 24 Apr to 18 Sep";}
		/*Plymouth*/if (airport2 == "PLH") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Southampton*/if (airport2 == "SOU") {document.getElementById("schedule-guide").innerHTML = "Direct flights daily";}
		/*Southend*/if (airport2 == "SEN") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 8 May to 25 Sep";}
  	}
	
	
	//var select2 = document.getElementById('enq_dep_point');
    //select2.onchange = airportObj2.options[airportIndex2].value;
	//var select3 = document.getElementById('enq_arr_point');
    //select3.onchange = destinationObj2.options[destinationIndex2].value;
	
	//alert(select2 + ", " + select3);
}


function showPreselScheduleGuide() {
	
	var airportObj2 = document.getElementById('enq_dep_point');
	var airportIndex2 = airportObj2.selectedIndex;
	var airport2 = airportObj2.options[airportIndex2].value;
	
	if(true == debug) {
		alert("Show schedule guide says this is the destination:" + destination2 + ", and this is the airport: " + airport2);
	}
	
	//if (airport2 == "-") {
	//	document.getElementById("schedule-guide").innerHTML = "";
	//}
	
		/*Aberdeen*/if (airport2 == "ABZ") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 9 May to 19 Sep 09";}
		/*Belfast City*/if (airport2 == "BHD") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sats only up 5 Sep 09";}
		/*Birmingham*/if (airport2 == "BHX") {document.getElementById("schedule-guide").innerHTML = "Direct Flights Daily";}
		/*Bristol*/if (airport2 == "BRS") {document.getElementById("schedule-guide").innerHTML = "Direct Flights Daily";}
		/*Cardiff*/if (airport2 == "CWL") {document.getElementById("schedule-guide").innerHTML = "Tue, Thu, Sat year round & Sun 29 Mar to 12 Sep 09";}
		/*Doncaster*/if (airport2 == "DSA") {document.getElementById("schedule-guide").innerHTML = "Direct flights Tue, Thu, Sun 29 Mar to 22 Oct 09 & Sat 23 May to 26 Sep 09 ";}
		/*Dundee*/if (airport2 == "DND") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 2 May to 19 Sep 09";}
		/*East Midlands*/if (airport2 == "EMA") {document.getElementById("schedule-guide").innerHTML = "Daily except Nov/Feb/Mar when Mon, Wed, Fri, Sun";}
		/*Edinburgh*/if (airport2 == "EDI") {document.getElementById("schedule-guide").innerHTML = "Direct flight 29 Mar to 23 Oct 09";}
		/*Exeter*/if (airport2 == "EXT") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Glasgow*/if (airport2 == "GLA") {document.getElementById("schedule-guide").innerHTML = "Via flight daily & direct flight Sat only 2 May to 24 Oct 09";}
		/*Humberside*/if (airport2 == "HUY") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 2 May to 19 Sep 09";}
		/*Isle of Man*/if (airport2 == "IOM") {document.getElementById("schedule-guide").innerHTML = "Direct flights: Sats only to 19 Sep 09 and Tue/Thu/Sun to 29 Oct 09";}
		/*Inverness*/if (airport2 == "INV") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 2 May to 19 Sep 09";}
		/*Liverpool*/if (airport2 == "LPL") {document.getElementById("schedule-guide").innerHTML = "Daily 30 Mar to 25 Oct 09";}
		/*London City*/if (airport2 == "LCY") {document.getElementById("schedule-guide").innerHTML = "Mon - Fri year round";}
		/*London Gatwick*/if (airport2 == "LGW") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*London Heathrow*/if (airport2 == "LHR") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*London Stansted*/if (airport2 == "STN") {document.getElementById("schedule-guide").innerHTML = "Daily from 1 May 09";}
		/*Luton*/if (airport2 == "LTN") {document.getElementById("schedule-guide").innerHTML = "Daily from 30 Mar to 25 Oct 09";}
		/*Manchester*/if (airport2 == "MAN") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Manston*/if (airport2 == "MSE") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat Only 9 May to 19 Sep 09";}
		/*Newcastle*/if (airport2 == "NCL") {document.getElementById("schedule-guide").innerHTML = "Direct flight daily except Tue/Thu 1 Apr to 24 Oct 09";}
		/*Norwich*/if (airport2 == "NWI") {document.getElementById("schedule-guide").innerHTML = "Direct flight Tue, Thu, Sat 2 May to 26 Sep 09";}
		/*Plymouth*/if (airport2 == "PLH") {document.getElementById("schedule-guide").innerHTML = "Direct flight";}
		/*Southampton*/if (airport2 == "SOU") {document.getElementById("schedule-guide").innerHTML = "Daily";}
		/*Southend*/if (airport2 == "SEN") {document.getElementById("schedule-guide").innerHTML = "Direct flight Sat only 9 May to 19 Sep 09";}
  
}

//Loading circle - fudge for Bill Gate's benefit...
function changeDiv(type) {
	if (type == "submit") {
		document.getElementById("loadingdiv").style.display='inline';
		document.getElementById("loadingdiv").style.visibility='visible';
		timeout()
		//document.getElementById("loadingimg").innerHTML = "<img src=\"http://www.travelcommunications.co.uk/trs/images/loading_circle_07.gif\"><br>Loading.... please wait";	
		//setTimeout('document.images.src="http://www.travelcommunications.co.uk/trs/images/loading_circle_07.gif"', 200);
	} else {
		document.getElementById("loadingdiv").style.display='none';
		document.getElementById("loadingdiv").style.visibility='hidden';
	}
}

function timeout() {
setTimeout("replace()",2);
}

function replace() {
//document.all.repl.innerHTML="<B>New Text</B>";
document.getElementById("loadingimg").innerHTML = "<img src=\"https://www.travelcommunications.co.uk/trs/images/loading_circle_07.gif\"><br>Loading... please wait";	
} 

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
//window.onload = externalLinks;

sfHover = function() {
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
	}
	sfEls[i].onmouseout=function() {
	  this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
	}
  }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function popup(url,size) {
  newwindow=window.open(url,'name',size);
  if (window.focus) {
    newwindow.focus()
  }
  return false;
}


//Run our clever scripts onload
function start() {
  externalLinks();
}
window.onload = start;


function checkform (form)
{
  if (form.email.value == "") {
    alert( "Please enter your email address." );
    form.email.focus();
    return false ;
  }
  if (form.Firstname.value == "") {
    alert( "Please enter your firstname." );
    return false ;
  }
  if (form.Surname.value == "") {
    alert( "Please enter your surname." );
    return false ;
  }
  if (form.Address.value == "") {
    alert( "Please enter your address." );
    return false ;
  }
  return true ;
}

function checkbrochureform (form)
{
  if (form.Initial.value == "") {
    alert( "Please enter your initial." );
    return false ;
  }
  if (form.Surname.value == "") {
    alert( "Please enter your surname." );
    return false ;
  }
  if (form.Address.value == "") {
    alert( "Please enter your address." );
    return false ;
  }
  return true ;
}