function checkWholeForm(myForm) 
{
	var formOk=true;
    var why = "";
	why += checkName(quotebooking.Name.value);
	why += checkEmail(quotebooking.Email.value);
	why += checkPHNumber(quotebooking.PHNumber.value);	
	why += checkOrigin(quotebooking.Origin.value);
	why += checkDestination(quotebooking.Destination.value);
	why += checkPassengers(quotebooking.Passengers.value);
	why += checkTypeOfLimo(quotebooking.TypeOfLimo.value);
	why += checkConditions(quotebooking.Conditions.checked);

    if (why != "") 
	{
       alert(why);
       formOk=false;
    }
	else
	{
	   formOk=true;
	}
	 if (formOk==true)
	 {
	  document.quotebooking.submit()
	 }
	 return formOk;

}




// email

function checkEmail (strng) 
{
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}
else
{
    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;    
}

// check first name
function checkName (strng) 
{
var error="";
if (strng == "") 
{
   error = "You didn't enter a Name.\n";
}
return error; 
}

// check date of birth
function checkOrigin (strng) 
{
var error="";
if (strng == "") 
{
   error = "You didn't enter an Origin.\n";
}
return error; 
}

// check address
function checkDestination (strng) 
{
var error="";
if (strng == "") 
{
   error = "You didn't enter a Destination.\n";
}
return error; 
}

// check city
function checkPassengers (strng) 
{
var error="";
if (strng == "") 
{
   error = "You didn't enter how many Passengers.\n";
}
else
{
if (isNaN(parseInt(strng))) 
{
       error = "Passengers needs to be a numeric value. \n";
  
    }
}
return error; 
}

// check city
function checkTypeOfLimo (strng) 
{
var error="";
if (strng == "") 
{
   error = "You didn't enter a Seat Configuration.\n";
}
return error; 
}

// phone number - strip out delimiters and check for 10 digits

function checkPHNumber (strng) 
{
var error = "";
if (strng == "") 
{
   error = "You didn't enter a phone number.\n";
}
else
{

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;
}

// exactly one radio button is chosen

function checkConditions(checkvalue) {
var error = "";
	if ( checkvalue == false )
    {
        error = "You must agree to the terms and conditions.\n";
    }

return error;
}