// JavaScript Document
function validateFormEmailFriend(thisform,action)

{
	with (thisform)

	{
			if (emptyvalidation(recipname,"Please enter recipient name")==false) 

			{
            recipname.select();
			recipname.focus();

			return false;

			}
					
			if (emptyvalidation(email2,"Please fill Recipient Email Address")==false) 
			{
				email2.select();
				email2.focus();
				return false;
			}
			
			if(emailvalidation(email2)==false)
			{
				alert("You have entered an invalid Email Address");
				email2.select();
				email2.focus();
				return false;
			}
			
			
			if (emptyvalidation(yourname,"Please enter your name")==false) 

			{

			yourname.focus();

			return false;

			}
			if(emptyvalidation(email1,"Please fill your Email Address")==false)
			{
			    email1.select();
				email1.focus();
				return false;
			}
			   if(emailvalidation(email1)==false)
			{
				alert("You have entered an invalid Email Address");
				email1.select();
				email1.focus();
				return false;
			}
		
		    //thisform.hidRedirect.value=action;

			thisform.submit();

	}

	return true;
}
function validateForm(thisforms,action)

{
	with (thisforms)

	{
			if (emptyvalidation(fname,"Please fill in your Name.")==false) 
			{
            fname.select();
			fname.focus();
			return false;
			}
			if (emptyvalidation(email,"Please fill in your Email Address.")==false) 
			{
				email.select();
				email.focus();
				return false;
			}
			if(emailvalidation(email)==false)
			{
				alert("Sorry, you have entered an invalid Email Address.");
				email.select();
				email.focus();
				return false;
			}
			if (emptyvalidation(phone,"Please enter your Phone Number.")==false) 
			{
			phone.select();
			phone.focus();
			return false;
			}
			if(emptyvalidation(comments,"Please fill in your Comments.")==false)
			{
			    comments.select();
				comments.focus();
				return false;
			}
			if (userdigit.value==userdigit.defaultValue)
			{
			userdigit.value="";	
			}
			if(emptyvalidation(userdigit,"Please fill your answer for Security.")==false)
			{
			userdigit.focus();
			return false;
			}
			runAjax('check_captcha','process_mail.php',thisforms.userdigit.value);
			return false;

	}

	//return true;
}
 <!--Ajax for checking the captcha code starts 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.getElementById("submitchk_id").style.display = "none";
				document.getElementById('loading').style.display = "block";
				document.contactus.submit();
			}
			else
			{
				getCaptcha('button.php');
				alert("Your answer mismatches.");
				document.contactus.userdigit.focus();
				document.contactus.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
}
<!--Ajax for checking the captcha code ends here -->
