﻿// JScript File
function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById(myForm).value)){
return true;
}
alert("Invalid E-mail Address! Please re-enter.")
return false;
}


    function IsValidre(Idies)
    {
        var diffid=Idies.split('#');
        for(var i=0; i< diffid.length;i++)
        {   
            if(document.getElementById("ctl00_c1_"+diffid[i]).value=="")
            {
                alert("Please Fill all Compulsary fields");
                document.getElementById("ctl00_c1_"+diffid[i]).focus();
                return false;
            }
        }
        return true;
    }
    
    function validateEmail(ID)
    {
        
         var email= document.getElementById(ID).value
         if(email=="")
         {
            return true;
         }
	    invalidChars = " /:,;"
	    for(i=0; i<invalidChars.length; i++)
	    {                                          
		    badChar = invalidChars.charAt(i);
		    if(email.indexOf(badChar,0) != -1)
		    {
			    alert("Invalid Mail Address")
			    document.getElementById(ID).focus();
			    return false;
		    }
	    }
	    atPos = email.indexOf("@",1);        
	    if(atPos == -1)
	    {
			alert("Invalid Mail Address")
			document.getElementById(ID).focus();
			return false;
	    }
	    if(email.indexOf("@",atPos+1) != -1)            
	    {    			
	        alert("Invalid Mail Address")
			document.getElementById(ID).focus();
			return false;
                                                     
	    }
	    periodPos = email.indexOf(".",atPos);
	    if (periodPos == -1 || periodPos==atPos+1)
	    {   
	        alert("Invalid Mail Address")
	        document.getElementById(ID).focus();                       
		    return false;
	    }
	    if(periodPos+3 > email.length)
	    {    alert("Invalid Mail Address")
	        document.getElementById(ID).focus();                     
		    return false;
	    }
	    return true;
     }    

