// JavaScript Document
function initialiseAJAX(){
	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;
}

function validateString(){
	xmlHttp = initialiseAJAX();
	value = document.getElementById("captcha_value").value;
	if(xmlHttp != null){
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState==4){
				if(xmlHttp.responseText == 'true'){
					captcha_approved = true;
					document.getElementById("captcha_check").style.display = 'none';
					document.getElementById("captcha_result").innerHTML = '<font color="green">Validation Approved.</font>';
				}
				else{
					captcha_approved = false;
					document.getElementById("captcha_value").value = '';
					document.getElementById("captcha_result").innerHTML = '<font color="red">Validation Failed. Try Again.</font>';
				}
			}
		}
		xmlHttp.open("GET", "/admin/captcha_check.php?v="+value, true);
		xmlHttp.send(null);
	}
}