// JavaScript Document

function isEmailAddr (s){ 
	var rv = false
	if ((s == null) || (s.length == 0)) 
       rv = false;
  else {
		var reEmail =/([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		//reEmail = /.+\@.+\..+$/
		
		rv = reEmail.test(s)
    }
	if(rv){
	return rv
	}else{
		return false
	}
}
 
 function validation(theForm){
  if (theForm.firstname.value == ""){
    alert("Please enter your first name.");
    theForm.firstname.focus();
    return (false);
  }
  if (theForm.surname.value == ""){
    alert("Please enter your surname.");
    theForm.surname.focus();
    return (false);
  }
 
  if (!isEmailAddr(theForm.email.value)){
    alert("Please enter a complete email address in the form: yourname@yourdomain.com");
    theForm.email.focus();
    return (false);
  }
  if (theForm.address.value == " "){
    alert("Please enter your mailing address.");
    theForm.address.focus();
    return (false);
  }
  if (theForm.phone.value == ""){
    alert("Please enter your phone.");
    theForm.phone.focus();
    return (false);
  }
  if (!theForm.GroupID[0].checked && !theForm.GroupID[1].checked && !theForm.GroupID[2].checked && !theForm.GroupID[3].checked && !theForm.GroupID[4].checked && !theForm.GroupID[5].checked){
    alert("Please select at least one area you are interested in.");
    theForm.GroupID[0].focus();
    return (false);
  }
return true
}



function validationEnquiry(theForm){
  if (theForm.name.value == ""){
    alert("Please enter your name.");
    theForm.name.focus();
    return (false);
  }
  if (theForm.contact_phone.value == ""){
    alert("Please enter your contact phone number.");
    theForm.contact_phone.focus();
    return (false);
  }
  if (theForm.mobile.value == ""){
    alert("Please enter your mobile phone number.");
    theForm.mobile.focus();
    return (false);
  }
  if (!isEmailAddr(theForm.email.value)){
    alert("Please enter a complete email address in the form: yourname@yourdomain.com");
    theForm.email.focus();
    return (false);
  }
  if (theForm.dates_of_event.value == ""){
    alert("Please enter the dates of event.");
    theForm.dates_of_event.focus();
    return (false);
  }
  if (theForm.duration_of_bookings.value == ""){
    alert("Please enter the duration of bookings.");
    theForm.duration_of_bookings.focus();
    return (false);
  }
  if (theForm.venues_interested_in.value == ""){
    alert("Please enter the venues interested in.");
    theForm.venues_interested_in.focus();
    return (false);
  }

return true
}
