/* $Id: is_email_address.js,v 1.1 2003/06/11 19:54:50 nstephen Exp $
 *
 * Author:  Graham Cebulskie
 *
 * Compatibility:  JavaScript 1.2+ (because of dependent functions)
 *
 * is_email_address(x)
 *
 * returns true if x is a valid email address (RFC 822, RFC 1035)
 * returns false otherwise
 *
 */

function is_email_address(x) {

  var a = x.split('@');
    if(a.length == 2 && a[0].length < 65 && a[1].length < 65) {
      if(is_local_part(a[0]) && (is_domain_name(a[1]) || is_domain_literal(a[1])) && (a[0].length < 65) && (a[1].length < 65)) {
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  return false;
}

