	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 email address")
		   document.f1.email.value="";
			document.f1.email.focus();
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid email address")
		   document.f1.email.value="";
			document.f1.email.focus();
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid email address")
			document.f1.email.value="";
			document.f1.email.focus();
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid email address")
			document.f1.email.value="";
			document.f1.email.focus();
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid email address")
			document.f1.email.value="";
			document.f1.email.focus();
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid email address")
			document.f1.email.value="";
			document.f1.email.focus();
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1)
		 {
		    alert("Invalid email address")
			document.f1.email.value="";
			document.f1.email.focus();
		    return false
		 }
return true;	
}
	
	
	function validate()
	{
	if(document.f1.firstname.value=="")
	{
	alert("Enter the First Name");
	 document.f1.firstname.focus();
	 return false;
	 }
	if(document.f1.lastname.value=="")
	{
	alert("Enter the Last Name");
	 document.f1.lastname.focus();
	 return false;
	 }
	 
	if(document.f1.phoneno.value=="")
	{
	alert("Enter Phone Number ");
	document.f1.phoneno.focus();
	return false;
	}
	 if(isNaN(document.f1.phoneno.value))
	{
	alert("Please Enter Numaericals for Phone number")
	document.f1.phoneno.value="";
	document.f1.phoneno.focus()
	return false;	
	}
	
	if(document.f1.email.value=="")
	{
	alert("Enter email Address");
	document.f1.email.focus();
	return false;
	}
	if (document.f1.email.value!="")
	{
		if(!echeck(document.f1.email.value))
		{
		document.f1.email.focus();
		return false;
		}
	}
	if(document.f1.comments.value=="")
	{
	alert("Enter the comments");
	 document.f1.comments.focus();
	 return false;
	 }
 
	 return true;
	 }
