var objXmlHttp; 


function verify() 
{ 
	var challenge,form_response; 
	challenge = document.getElementById("recaptcha_challenge_field").value; 
	form_response = document.getElementById("recaptcha_response_field").value; 
	
	
	objXmlHttp=GetXmlHttpObject(); 
	if (objXmlHttp==null) 
	{ 
	  document.getElementById("errorLabel").innerHTML = "Your browser does not support AJAX which is required to use this page."; 
	
	} 


	var captchaString; 
	captchaString   = "?challenge=" + challenge; 
	captchaString   += "&response=" + form_response; 

	//This is to overcome the challenge of creating an http 
	//XML object from a host different than ours 
	//My new page only requires the challenge and the response as it has the private key and remote IP address from another file 

	var url = "/eregister/includes/confirmcaptcha.asp"; 
	url     +=      captchaString; 

	objXmlHttp.open("GET",url,false); 
	objXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded" ); 
	objXmlHttp.send(null); 
	objXmlHttp.onreadystatechange=MystateChanged; 
	var CaptchaResult = objXmlHttp.responseText; 
	// Get the error label element to fill it out with the message 	returned from reCaptcha! 
	
	if(CaptchaResult.match("true") != null) 
		{ 
		        return true; 
		} 
	else 
		{ 
				alert('Incorrect answer');
		        return false; 
		} 
} 


function MystateChanged() 
{ 
} 


function GetXmlHttpObject() 
{ 
	var xmlHttp=null; 
	try 
	  { 
	  // Firefox, Opera 8.0+, Safari 
	  xmlHttp=new XMLHttpRequest(); 
	  } 
	catch (e) 
	  { 
	  // Internet Explorer 
		  try 
		    { 
		    xmlHttp=new ActiveXObject("Msxml2.ServerXMLHTTP"); 
		    } 
		  catch (e) 
		    { 
		    xmlHttp=new ActiveXObject("Microsoft.ServerXMLHTTP"); 
		    } 
	  } 
	return xmlHttp; 
} 

function reloadRecaptcha() 
{ 
        Recaptcha.reload(); 
} 

