/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}
function callServer() {
	document.apply.submit.value = 'Please waith!';
	document.apply.submit.disabled = true;
	document.getElementById('CheckUser').innerHTML = '&nbsp;';
	document.getElementById("working").innerHTML = '<img src="pic/working.gif" /> Getting info.....';
  // Get the username from the web form
  var username = document.getElementById("username").value;
  //var dimension = document.getElementById("dimension").value;
  // Only go on if there are values for the field
  if ((username == null) || (username == "")) return;
  //if ((dimension == null) || (dimension == "")) return;

  // Build the URL to connect to
  var url = "mods/check_user.php?username=" + escape(username) + "&userinfo=true";
  //var url = "mods/check_user.php?username=" + escape(username) + "&dimension=" + escape(dimension);
  // 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) {
    var response = xmlHttp.responseText;
    document.getElementById('CheckUser').innerHTML = response;
    document.getElementById("working").innerHTML = '&nbsp;';
    document.apply.submit.disabled = false;
    document.apply.submit.value = 'Apply!';
    
  }
}