var xmlHttp = false;
var xmlHttplog = false;
var finished = false;

init();
function init(){

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
/*  xmlHttp = new XMLHttpRequest();
	}
}
*/


    xmlHttp = new XMLHttpRequest(); //Mozilla, Safari ...
 } else if (window.ActiveXObject) {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); //IE
 } else {
    //Display our error message
    alert("Your browser doesn't support the XmlHttpRequest object.");
 }
}

function callServer() {

if (xmlHttp.readyState!=0){
xmlHttp.onreadystatechange = function() {};
xmlHttp.abort();
xmlHttp = false;
init();
}

document.getElementById("captcha_result").innerHTML='';

  // Build the URL to connect to
  var url = "spamcheck.php?word="+document.myform.word.value;

  // Open a connection to the server
  xmlHttp.open("GET", url, true);

  // Setup a function for the server to run when it's done
  xmlHttp.onreadystatechange = updatePage;

  // Send the request
  xmlHttp.send(null);
}


function updatePage() {
  if (xmlHttp.readyState == 4) {
    response = xmlHttp.responseText;
    reponse = response+'';
    if (response==1){
    document.getElementById("captcha_result").innerHTML = '<b><font color="green">OK</font></b>';

	 document.getElementById("otherworld_link").innerHTML ='';
  }
  else{
  	 document.getElementById("captcha_result").innerHTML = '<b><font color="red">R&eacute;ponse incorrecte</font></b>';

  	  }
  }

}