// JavaScript Document

 function trimStr(str)
  {
     str=(str).replace( /^\s*/, "" );
     str=(str).replace( /\s*$/, "" );
     return str;
  }

 function checkContact()
 {
    var frm=document.frmcontact;
		   
	if(trimStr(frm.name.value)=="")
	 {
	     alert("Please enter your Name");
		 frm.firstname.focus();
		 return false;
	 }
	 
	if(trimStr(frm.email.value)=="")
	  { 	  
	     alert("Please enter your Email Address");
		 frm.email.focus();
		 return false;
	  }
	if(trimStr(frm.email.value)!="")
	  {
	     var dotpos=frm.email.value.indexOf('.');
		 var amppos=frm.email.value.indexOf('@');
		 var lastpos=frm.email.value.length;
		 
		 if(dotpos<1 | amppos<1 | lastpos==amppos | lastpos==dotpos)
		  {
		    alert("Error in your Email Address");
			frm.email.focus();
		    return false;
	      }   		
	  }
	
	if(frm.phone.value=="")
	 {
	     alert("Please enter your Phone No.");
		 frm.phone.focus();
		 return false;
	 }  
	
	if(trimStr(frm.location.value)=="")
	 {
	     alert("Please enter your Plot Location");
		 frm.location.focus();
		 return false;
	 }
	 
	 if(trimStr(frm.name2.value)=="")
	 {
	     alert("Please enter Name of Contact Person");
		 frm.name2.focus();
		 return false;
	 }
	 
	if(frm.phone2.value=="")
	 {
	     alert("Please enter Phone No. of Contact Person");
		 frm.phone2.focus();
		 return false;
	 }
	 
	 if(trimStr(frm.message.value)=="")
	 {
	     alert("Please enter your Message");
		 frm.message.focus();
		 return false;
	 }
 }

