var xmlHttp


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}// JavaScript Document

function checkCaptcha(str)
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="checkcaptcha.php"
url=url+"?check=captcha&q="+str
url=url+"&sid="+Math.random()
//alert(url)
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 var value=xmlHttp.responseText
 //alert(value)
 if(value=="false")
 {
 document.getElementById("errorcaptcha").innerHTML='Wrong Verification Code!'
 return false
 }
else if(value=="empty")
 {
 document.getElementById("errorcaptcha").innerHTML='Enter Verification Code!'
 return false
 }
 else
 {
	document.getElementById("frmcontact").submit();
 }
//  
 } 
}
}

function frmcontactcheck()
{
	
	if(document.frmcontact.name.value=="")
	{
		alert("Please enter your name!");
		document.frmcontact.name.focus();
		return false;
	}
	if(document.frmcontact.email.value=="")
	{
		alert("Please enter your email!");
		document.frmcontact.email.focus();
		return false;
	}
	var goodEmail = document.frmcontact.email.value.match(/\b(^(\S+@).+((\.com)|(\.coop)|(\.name)|(\.aero)|(\.museum)|(\.pro)|(\.net)|(\.info)|(\.edu)|(\.biz)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	if (!goodEmail){
		alert("Invalid Email Address!")
		document.frmcontact.email.focus();
		return false;
   	}
	if(document.frmcontact.contactno.value=="")
	{
		alert("Please enter your contact no!");
		document.frmcontact.contactno.focus();
		return false;
	}
	if(document.frmcontact.message.value=="")
	{
		alert("Please enter your message!");
		document.frmcontact.message.focus();
		return false;
	}
	checkCaptcha(document.frmcontact.verif_box.value);
	return false;
}