/* 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(urlfrom) {
  // Get the city and state from the web form
  var tid = document.getElementById("tid").value;
  // Only go on if there are values for both fields
  if ((tid == null) || (tid == "")) return;
  urlto = urlfrom + "&tid=" + escape(tid); 
  // Open a connection to the server
  xmlHttp.open("GET", urlto, 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) {
     if (xmlHttp.status == 200) {
         var response = xmlHttp.responseText;
         document.getElementById("question").value = response;
     } else {
        alert("status is " + xmlHttp.status);
     }
  }
}

