var xmlHttp

function checkCaptcha(str)
{
	if (str.length < 6)
	{ 
		document.getElementById("status").innerHTML="";
		return;
	}
	
	document.getElementById("captchacode").disabled = "disabled";
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url="http://www.strategyxchange.com/captcha/check.asp";
	url=url+"?query="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateChanged() 
{ 
	var res;
	
	if (xmlHttp.readyState==4)
	{ 
		res = xmlHttp.responseText;	
		document.getElementById("status").innerHTML=res;

		if(res.search("correct") > 0)
		{
			document.getElementById("status").value = "Yes";
			document.getElementById("secure").value = "true";
		}
		else
		{
			document.getElementById("status").value = "No";
			document.getElementById("secure").value = "false";
		}
	}

}

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;

}

//setInterval('ref()',5000);