function check1()
{

	if (document.sub.fromEmail.value=="")
	{
		alert("Please enter your Email")
		document.sub.fromEmail.focus()
		return false
	}
	if(val(document.sub.fromEmail)!=true)
		return false

}


<!-- START EMAIL CODE -->
function e(s) 
{
	rex=true;
	if (window.RegExp) 
	{
		st="a";ex=new RegExp(st);
		if (st.match(ex)) 
		{
			r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			b=(!r1.test(s)&&r2.test(s));
		} 
		else 
		{
			rex=false;
		}
	} 
	else 
	{
		rex=false;
	}
	if(!rex) b=(s.indexOf("@")>0&&s.indexOf(".")>0&&s!=""&&s!="enter e-mail");
		return (b);
}

function f(h) 
{
	document.sub.fromEmail.focus();
}

function val(fld) 
{
	s=fld.value;
	if(e(s)) 
	{
		return true;
	} 
	else 
	{
		alert("You have not entered a valid email address.");
		f(fld);
		return false;
	}
}









<!-- Changes:  Sandeep V. Tamhankar (stamhankar@hotmail.com) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- http://javascript.internet.com/forms/check-email.html -->


function emailCheck (emailStr) {

var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>4) {
   // the address must end in a two letter or three letter word.
   alert("The address must end in a three or four letter extension, or two letter country.")
   return false
}

if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}

return true;
}

