function formValidationContact(thisform)
{
	var phone1element =  document.getElementById("phone1");
	var phone2element =  document.getElementById("phone2");
	with (thisform)
	{
			
		if(emptyvalidation(fname,"Woops! You forgot to fill in your  first name")==false) 
		{
			fname.focus();
			return false;
		}if(emptyvalidation(lname,"Woops! You forgot to fill in your last name")==false) 
		{
			lname.focus();
			return false;
		}
		if(emptyvalidation(phone,"Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!")==false) 
		{
			phone.focus();
			return false;
		}
		  else
		 {
		      
				 for(var i=0;i<phone.value.length;i++)
				  {
					  if(!isDigit(phone.value.charAt(i)))
					  {
						alert("Woops! Phone number cannot contain characters");
						phone.select();
						return false;
					  }
				  }
				
		 }
		  if(phone.value.length<3)
		 {
		   alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");	
		   phone.focus();
		   return false;
		 }
		
			if(phone1element.value == "" )
			{
				alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");
				phone1element.focus();
				return false;
			}
			  else
		 {
		      
				 for(var i=0;i<phone1element.value.length;i++)
				  {
					  if(!isDigit(phone1element.value.charAt(i)))
					  {
						alert("Woops! Phone number cannot contain characters");
						phone1element.select();
						return false;
					  }
				  }
				
		 }
		  if(phone1element.value.length<3)
		 {
		   alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");	
		   phone1element.focus();
		   return false;
		 }

		if(phone2element.value == "" )
			{
				alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");
				phone2element.focus();
				return false;
			}
		  else
		 {
		      
				 for(var i=0;i<phone2element.value.length;i++)
				  {
					  if(!isDigit(phone2element.value.charAt(i)))
					  {
						alert("Woops! Phone number cannot contain characters");
						phone2element.select();
						return false;
					  }
				  }
				
		 }
		  if(phone2element.value.length<4)
		 {
		   alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");	
		   phone2element.focus();
		   return false;
		 }	

		if(emptyvalidation(email,"Woops! You forgot to fill in your email address")==false) 
		{
			email.focus();
			return false;
		}
		if(emailvalidation(email,"Invalid email address")==false)
		{
			email.select();
			email.focus();
			return false;
		}
		if(emptyvalidation(address,"Woops! You forgot to fill in your address")==false) 
		{
			address.focus();
			return false;
		}
		if(emptyvalidation(city,"Woops! You forgot to fill in your city")==false) 
		{
			city.focus();
			return false;
		}
		if(emptyvalidation(province,"Woops! You forgot to select in your province")==false) 
		{
			province.focus();
			return false;
		}
		if(emptyvalidation(pin,"Woops! You forgot to fill in your zipcode")==false) 
		{
			pin.focus();
			return false;
		}
	/*	if(emptyvalidation(reachme,"Please select reach me")==false) 
		{
			reachme.focus();
			return false;
		}
		if(emptyvalidation(customerType,"Please select customer type")==false) 
		{
			customerType.focus();
			return false;
		}*/
		if(thisform.formsubmit.value=="Y")
		{
			alert("Please wait while the form is getting submitted");
			return false;
		}
		else
		{
			thisform.formsubmit.value="Y";
			document.getElementById("button_show_hide").innerHTML='<img src="images/loading.gif" alt="" />';
			runAjax('check_captcha','process_mail.php','sendmail');
			return false;
		}
		
	}
	return true;
}
<!--Ajax for checking the captcha code starts here -->

var xmlHttp

function runAjax(field,argurl,argVal)
{
//document.getElementById("check_captcha").innerHTML=" Loading...";
xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)

{

alert ("Browser does not support HTTP Request")

return

} 

var url=argurl

url=url+"?verify_digit="+argVal
url=url+"&sid="+Math.random()
if(field=='check_captcha')
xmlHttp.onreadystatechange=check_captcha;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}

function check_captcha() 

{ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

	{ 

			

			if(xmlHttp.responseText=="yes")

			{
					document.form2.submit();
					return true;

				

			}
			else
			{
				
					document.form2.submit();
					return true;
				
			}

			

			

	} 

}

function GetXmlHttpObject()

{ 

	var objXMLHttp=null

if (window.XMLHttpRequest)

{

	objXMLHttp=new XMLHttpRequest()

}

else if (window.ActiveXObject)

{

	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")

}

	return objXMLHttp

}

<!--Ajax for checking the captcha code ends here -->
function isDigit(num)
{
	 if(num.length>1)
	   {
		return false;
	   }
    var string="1234567890";

	 if(string.indexOf(num)!=-1)
	  {
	   return true;
	  }
 return false;
}

