// JavaScript Document
function checkForm()
		{
		
		// -------------------Name field validation-------- 
		if(document.frm.txtName.value == "")
	    {
        	alert(" Please Enter Your Name");
           	document.frm.txtName.focus();
           	return false;
        }
	    var data=document.frm.txtName.value;
		if((data.indexOf ('/') == 0)||(data.indexOf ('.') == 0)||(data.indexOf (' ') == 0)||(data.indexOf (',') == 0)||(data.indexOf ('-') == 0)||(data.indexOf (',') == 0))
  		{
			alert("Please Enter Name as Alphabets");
			document.frm.txtName.focus();
			document.frm.txtName.value="";
			return false;
		}
		if(isNaN(document.frm.txtName.value)==false)
 		{
			alert("Please Enter Name as Alphabets");
			document.frm.txtName.focus();
			document.frm.txtName.value="";
			return false;
   		}
		// -------------------Name field validation-------- 
		// -------------------Email field validation--------

 var emailID=document.frm.txtEmail;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
	}
	

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;				
}

// -------------------Email field validation--------
// -------------------Location field validation-------- 
		if(document.frm.txtloc.value == "")
	    {
        	alert("Please Enter Your Location");
           	document.frm.txtloc.focus();
           	return false;
        }
// -------------------Location field validation--------
// -------------------Subject field validation-------- 
		if(document.frm.txtSubject.value == "")
	    {
        	alert("Please Enter the Subject");
           	document.frm.txtSubject.focus();
           	return false;
        }
// -------------------Subject field validation-------- 
// -------------------Message field validation-------- 
		if(document.frm.txtMessage.value == "")
	    {
        	alert("Please Enter the Message");
           	document.frm.txtMessage.focus();
           	return false;
        }
// -------------------Message field validation-------- 	
		}
