function validate(thisform)
{
	with (thisform)
	{
		if (emptyvalidation(fn,"oops! You forgot to fill in your Name")==false) 
		{
			fn.focus();
			return false;
		}
		
		if (emptyvalidation(tag1,"oops! You forgot to fill in your Phone Number")==false) 
		
		{
			tag1.focus();
			return false;
		}
		
		if (emptyvalidation(email,"oops! You forgot to fill in your Email Address")==false) 
		{
			email.focus();
			return false;
		}
		
		if(emailvalidation(email,"oops! You have entered an invalid Email Address")==false)
		{
			email.select();
			email.focus();
			return false;
		}
		
		if (emptyvalidation(tag2,"oops! You forgot to fill in your Comments")==false) 
		{
			tag2.focus();
			return false;
		}	
		//if(userdigit.value=="verification code as shown above")userdigit.value="";
		if(emptyvalidation(tag3,"oops! You forgot to fill Verification word")==false) 
		{
		tag3.focus();
		return false;
		}	
		//runAjax('check_captcha','process_mail.php',thisform.userdigit.value);
		//return false;
		if((thisform.tag3.value != "smile") && (thisform.tag3.value != "SMILE"))
		{
		alert ("Please enter 'smile' into the human test");
		tag3.focus();
		return false;
		}	
		thisform.submit();
	}
	//thisform.submit();
}
function captcha_refresh()
{
document.getElementById("button_div").src='button.php?'+Math.random();
return false;
}

<!--Ajax for checking the captcha code ends here -->

		var xmlHttp
		function runAjax(field,argurl,argVal)
		{
		xmlHttp=GetXmlHttpObject()
					if (xmlHttp==null)
					{
					alert ("Browser does not support HTTP Request")
					return
					} 
		var url=argurl
		url=url+"?userdigit="+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.contact_form.submit();
				}
				else
				{
					captcha_refresh();
					alert("Woops! You have entered an invalid Verification code");
					//document.contact_form.userdigit.value="Invalid Verification Code";
				    document.contact_form.userdigit.focus();
					document.contact_form.userdigit.select();
					return false;
				}
		} 
	} 

	function GetXmlHttpObject()
	{ 
	var objXMLHttp=null
					if (window.XMLHttpRequest)
					{
						objXMLHttp=new XMLHttpRequest()
					}
					else if (window.ActiveXObject)
					{
						objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
					}
		return objXMLHttp
	}
