  var request;  // a global XMLHTTPRequest ref

  // define response code constants
  var OK = 100, WARNING = 200, ERROR = 300, SEVERE = 400;

  // provide a cross-browser XMLHTTPRequest object
	if (typeof XMLHttpRequest == "undefined" && window.ActiveXObject)
	{
	  function XMLHttpRequest()
	  {
			var arrSignatures = ["MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
			                     "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];

			for (var i = 0; i < arrSignatures.length; i++)
			{
		    try
		    {
					var oRequest = new ActiveXObject(arrSignatures[i]);
					return oRequest;
		    }
		    catch (oError) {}
			}

			throw new Error("No XMLHTTPRequest facility");
	  }
	}

	function onResponse()
	{
	  // a simple general callback function
	  if (request.readyState == 4) // the response has fully arrived
	  {
	    if (request.status == 200) // HTTP status is OK
	    {
	      // read the response
        var result   = request.responseXML.getElementsByTagName("result")[0];
        var code     = result.getAttribute("code");
        var msg      = result.getAttribute("msg");

	      // view it
//        java.lang.System.out.println("response: " + code + " - " + msg);
//        alert("HTTP status is " + request.status + " (" + request.statusText + ")");
//	      alert("code: " + code + " msg: " + msg);
	    }
	  }
	}
