var notify="Please enter a correct form of email 'sample@sample.com'"

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(notify)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		    alert(notify)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		     alert(notify)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		  alert(notify)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(notify)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		 alert(notify)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		     alert(notify)
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
//if(document.eform.varEmail.value==""){alert("Please enter Name")}

	var emailID=document.eform.varEmail
	var ename=document.eform.varName
	var esubject=document.eform.varSubj
	var emsg=document.eform.varMsg
	
		if ((ename.value==null)||(ename.value=="")){
		   alert("Please enter your name!")
		ename.focus()
		return false
	}
	
		if (echeck(emailID.value)==false){
		//emailID.value=""
		 // alert(notify)
		emailID.focus()
		return false
	}
	/*
	if ((emailID.value==null)||(emailID.value=="")){
		   alert(notify)
		emailID.focus()
		return false
	}*/
	
			if ((esubject.value==null)||(esubject.value=="")){
		   alert("Please enter subject!")
		esubject.focus()
		return false
	}
	

			if ((emsg.value==null)||(emsg.value=="")){
		   alert("Please drop some lines in message box!")
		emsg.focus()
		return false
	}
	
	

	return true
 }
