var xmlHttp
function ref(str)
{
  document.getElementById("refpic").innerHTML="<img src='http://www.strategyrunner.com/new/Content/Functions/Captcha/imagecreate.php?sid="+Math.random()+"'>";
  return;
}

function Check(str)
{
if (str.length<5)
  { 
  document.getElementById("status").innerHTML="";
  return;
  }

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="http://www.strategyrunner.com/new/Content/Functions/Captcha/check.php";
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";
		else
			document.getElementById("status").value = "No";

	}

}

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);
