
/**
 * DHTML email validation script. Courtesy of SmartWebby.com 

(http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || 

str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 

|| str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || 

str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){

if(document.form2.txtname.value.length<=0 )
{
		alert("Please enter Name");
		document.form2.txtname.focus();
		document.form2.txtname.select();
		return false;
}
if(document.form2.txtemail.value.length<=0 )
{
		alert("Please enter Email");
		document.form2.txtemail.focus();
		document.form2.txtemail.select();
		return false;
}
if(document.form2.txtContNo.value.length<=0)
{
		alert("Please enter Contact number");
		document.form2.txtContNo.focus();
		document.form2.txtContNo.select();
		return false;
}

	var emailID=document.form2.txtemail.value;
	
	if ((emailID==null)||(emailID=="")){
		alert("Please Enter your Email ID")
		document.form2.txtemail.focus()
		return false
	}
	if (echeck(emailID)==false){
		document.form2.txtemail.value=""
		document.form2.txtemail.focus()
		return false
	}
	return true
 }


