// Javascript for validating email field is correct format and matches confirmation email field.
//
// Author: Rhydd
// Date: 23/08/07 (last revision)

<!--

function isEmail( strValue) {
    var objRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return objRegExp.test(strValue);
}

//-->

<!--

function frm_validate(theForm) {

  if (theForm.email.value == "")
  {
    alert("Please enter an email address.");
    theForm.email.focus();
    return (false);
  }

   if(!isEmail(theForm.email.value))
  {
    alert("Please enter a valid email address");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email2.value == "")
  {
    alert("Please confirm your email address.");
    theForm.email2.focus();
    return (false);
  }

  if (theForm.email.value != theForm.email2.value) {
  alert("Your email addresses do not match. Please confirm you have entered your email address correctly in both fields.") ;
    theForm.email.focus();
    return (false) ;
  }

return true ;
}


//-->