function checkBookingForm(booking) {
	var why = "";

//		why += isEmpty(booking.title.value, "TITLE");
//		if (why != "") {
//			alert(why);
//			booking.title.focus();
//			return false;
//		}
		why += isEmpty(booking.fname.value, "FIRST NAME");
		if (why != "") {
			alert(why);
			booking.fname.focus();
			return false;
		}
		why += isEmpty(booking.lname.value, "LAST NAME");
		if (why != "") {
			alert(why);
			booking.lname.focus();
			return false;
		}
		why += isEmpty(booking.address.value, "STREET");
		if (why != "") {
			alert(why);
			booking.address.focus();
			return false;
		}
		why += isEmpty(booking.city.value, "CITY");
		if (why != "") {
			alert(why);
			booking.city.focus();
			return false;
		}
		why += checkDropdown(booking.country.value, "COUNTRY");
		if (why != "") {
		alert(why);
		booking.country.focus();
		return false;
		}
		why += isEmpty(booking.tel.value, "TELEPHONE");
		if (why != "") {
			alert(why);
			booking.tel.focus();
			return false;
		}
		why += checkEmail(booking.email.value, "EMAIL ADDRESS");
		if (why != "") {
		alert(why);
		booking.email.focus();
		return false;
		}
		why += isEmpty(booking.from.value, "INTENDED TRAVEL DATES FROM");
		if (why != "") {
			alert(why);
			booking.from.focus();
			return false;
		}
		why += isEmpty(booking.to.value, "INTENDED TRAVEL DATES TO");
		if (why != "") {
			alert(why);
			booking.to.focus();
			return false;
		}
		why += isEmpty(booking.adults.value, "NUMBER OF ADULTS");
		if (why != "") {
			alert(why);
			booking.adults.focus();
			return false;
		}
		why += isEmpty(booking.children.value, "NUMBER OF CHILDREN");
		if (why != "") {
			alert(why);
			booking.children.focus();
			return false;
		}
		if (document.booking.privacy.checked) {
				var checkvalueA = booking.privacy.value;
		} 
    why += checkCheckBoxA(checkvalueA);
		 if (why != "") {
       alert(why);
			 document.booking.privacy.focus();
       return false;
    }

	return true;
}


function checkCheckBoxA(checkvalueA) {
var error = "";
   if (!(checkvalueA)) {
       error = "DO YOU AGREEE WITH OUR TERMS AND CONDITIONS\n";
    }
return error;
}


function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}


// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a phone number.\n";
}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The phone number contains illegal characters.";
  
    }
    if (!(stripped.length == 10)) {
	error = "The phone number is the wrong length. Make sure you included an area code.\n";
    } 
return error;
}

// non-empty textbox

function isEmpty(strng, fldName) {
var error = "";
  if (strng.length == 0) {
     error = "The " + fldName + " field has not been filled in.\n"
  }
return error;	  
}

// valid selector from dropdown list

function checkDropdown(choice, fldName) {
var error = "";
    if (choice == 0) {
    error = "You didn't choose an option from the " + fldName + " drop-down list.\n";
    }    
return error;
}


