﻿function trim(str)
{
  return str.replace(/^\s+|\s+$/g, '');
}

// --------------------------------------------
// validateEmail
// Validate if e-mail address
// Returns true if so (and also if could not be executed because of old browser)
// --------------------------------------------
function checkEmail(address)
{
  var tfld = trim(address);  // value of field with whitespace trimmed off
  var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/  ;
  if (!email.test(tfld)) {
    
    return false;
  }

  return true;
}
