
// This is variable for storing callback function
var ae_cb = null;
 
// this is a simple function-shortcut
// to avoid using lengthy document.getElementById
function ae$(a) { return document.getElementById(a); }
 
// This is a main ae_prompt function
// it saves function callback 
// and sets up dialog
function ae_prompt(cb, q, a) {
	ae_cb = cb;
	ae$('aep_t').innerHTML = document.domain + ' question:';
	ae$('aep_prompt').innerHTML = q;


	ae$('aep_text').value = a;
	ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = '';
	ae$('aep_text').focus();
	ae$('aep_text').select();
}
 
// This function is called when user presses OK(m=0) or Cancel(m=1) button
// in the dialog. You should not call this function directly.
function ae_clk(m) {
	// hide dialog layers 
	ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = 'none';
	if (!m)  
		ae_cb(null);  // user pressed cancel, call callback with null
	else
		ae_cb(ae$('aep_text').value); // user pressed OK 
}



//var gmoves=5;

function gamehandleHttpResponse() {
  if (gamehttp.readyState == 4) {
    alert(gamehttp.responseText);
  }
}


var highname="";
function hw2(n) {


  var url = "/blog/score.php?";
  var number = Math.floor(Math.random()*65536);


highname=n;

  gamehttp.open("GET", url + "&moves="+gmoves+"&name="+highname.substr(0,5)+"&random="+number, true);
  gamehttp.onreadystatechange = gamehandleHttpResponse;
  gamehttp.send(null);

reinit();

}



function gameRequestInformation() {
 
ae_prompt( hw2, 'Quel est votre pseudo (4 caracteres max) pour etre dans les scores ?', 'ANON');

}

function gameRequestInformationscores() {
 
  var url = "/blog/score.php?";
  var number = Math.floor(Math.random()*65536);
  gamehttp.open("GET", url + "random="+number, true);
  gamehttp.onreadystatechange = gamehandleHttpResponse;
  gamehttp.send(null);

}

function gamegetHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

var gamehttp = gamegetHTTPObject(); 

function scores() {
//gameRequestInformationscores();
}


function ok()
{
  gamehttp.open("GET", url + "&moves="+gmoves+"&name="+highname.substr(0,5)+"&random="+number, true);
  gamehttp.onreadystatechange = gamehandleHttpResponse;
  gamehttp.send(null);
}


