﻿// JScript File
function CheckEmail()
{
var frm=document.form1;
if(frm.txt_Email.value=="")
{
    alert("Email Address cannot be empty");
    frm.txt_Email.focus();
    return(false); 
}
else if(frm.txt_Email.value!="")
{
    var email_id=document.getElementById("txt_Email").value;
	var at,colon; 
	at=email_id.indexOf("@");
	colon=email_id.indexOf(".");
	if(at <=0 || colon<=0 || at+1==colon)
	{
		alert("Invalid Email Id");
		document.getElementById("txt_Email").focus();
    	return(false);
	}
	return true;
}
else
{
    return(false);
}
   
}               


function ValidateEmail(evt)
{
     evt = (evt) ? evt : event;
    var comm_val,len,pos;   
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode :((evt.which) ? evt.which : 0));
    if(charCode==13)
    {
       return(CheckEmail()); 
    }
    return(true);
}
