var regexEmail  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,7})+$/;

function validateContact() {
    
  // Init error string
  var strError = '';
  
  // Test for a name
  if (!$('#txtName').val().length) {
    strError += "You did not enter your name.\n";
  }
  
  // Test for an email address
  if (!$('#txtEmailAddress').val().length || !regexEmail.test($('#txtEmailAddress').val())) {
    strError += "You did not enter a valid email address.\n";
  }
  
  // Test for a message
  if (!$('#txtMessage').val().length) {
    strError += "You did not enter a message.\n";
  }
  
  // Check if we errored
  if (strError.length) {
    strError = "Sorry, there was a problem. Please take note of the messages below\n\n" + strError;
    alert(strError);    
    return false;
  }

  // Submit the form
  return true;
}

