function validateEmail(str){
var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

if(str.match(emailRegEx)){
return true;
}else{
return false;
}
}
function FrontPage_Form1_Validator(theForm)
{
	
  if (theForm.FullName.value == "")
  {
    alert("Please enter a value for the \"Full Name\" field.");
    theForm.FullName.focus();
    return (false);
  }

  if (theForm.FullName.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Full Name\" field.");
    theForm.FullName.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f";
  var checkStr = theForm.FullName.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit and whitespace characters in the \"Full Name\" field.");
    theForm.FullName.focus();
    return (false);
  }

  if (theForm.Email.value == "")
  {
    alert("Please enter a value for the \"E-mail Address\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length < 6)
  {
    alert("Please enter at least 6 characters in the \"E-mail Address\" field.");
    theForm.Email.focus();
    return (false);
  }
  if(!validateEmail(theForm.Email.value)){
  alert('Please enter a valid email address.');
  return (false);
  }
	if (theForm.ConfirmEmailAddress.value==""){
		  alert('Please enter a valid Confirm email address.')
		  theForm.ConfirmEmailAddress.focus();
			return (false);
	}
 if (theForm.Email.value != theForm.ConfirmEmailAddress.value){
          alert('Both e-mail address entries must match.')
		  theForm.ConfirmEmailAddress.focus();
		    return (false);
   }
 if (theForm.PhoneAreaCode.value==""){
		  alert('Please enter a valid Phone Area Code.')
		  theForm.PhoneAreaCode.focus();
			return (false);
	}
	if (theForm.PhoneNumder.value==""){
		  alert('Please enter a valid Phone Numder.')
		  theForm.PhoneNumder.focus();
			return (false);
	}
if(document.getElementById("ArriveDay").value==0){
	alert("Please Select the Arrival Day");
    document.getElementById("ArriveDay").focus();
    return (false);
}
if(document.getElementById("ArriveMonth").value==0){
	alert("Please Select the Arrival Month Day");
    document.getElementById("ArriveMonth").focus();
    return (false);
}
if(document.getElementById("ArriveYear").value==0){
	alert("Please Select the Arrival Year");
    document.getElementById("ArriveYear").focus();
    return (false);
}
if(document.getElementById("DepartDay").value==0){
	alert("Please Select the Departure Day");
    document.getElementById("DepartDay").focus();
    return (false);
}
if(document.getElementById("DepartMonth").value==0){
	alert("Please Select the Departure Month Day");
    document.getElementById("DepartMonth").focus();
    return (false);
}
if(document.getElementById("DepartYear").value==0){
	alert("Please Select the Departure Year Day");
    document.getElementById("DepartYear").focus();
    return (false);
}

  if (theForm.NumberOfAdults.value == "")
  {
    alert("Please enter a value for the \"Number of Adults\" field.");
    theForm.NumberOfAdults.focus();
    return (false);
  }

  if (theForm.NumberOfAdults.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Number of Adults\" field.");
    theForm.NumberOfAdults.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.NumberOfAdults.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"Number of Adults\" field.");
    theForm.NumberOfAdults.focus();
    return (false);
  }

  return (true);
}
