

function checkEmail(obj) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(obj.value))
	{
		return (true)
	}
	alert("Invalid E-mail Address. Please re-enter.")
	return (false)
}

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function EmailValidator(obj)
{

 // if (obj.value == "")
  //{
  //  alert("Please enter a value for the \"email\" field.");
  //  obj.focus();
  //  return (false);
 // }

  if (!isEmailAddr(obj.value))
  {
   alert("Please enter a complete email address in the form: name@domain (ex. name@site.com or name@provider.net)");
    //obj.focus();
    return (false);
  }
   
  //if (obj.value.length < 3)
  //{
  //  alert("Please enter at least 3 characters for your email address.");
   // obj.focus();
   // return (false);
 // }
  if (!checkEmail(obj))
  {
    obj.focus();
    return (false);
  }
  
  return (true);
}

  