var ajaxreq=false, ajaxCallback;

function ajaxRequest(filename) {
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  ajaxreq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    ajaxreq = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    ajaxreq = false;
  }
}
@end @*/
if (!ajaxreq && typeof XMLHttpRequest != 'undefined') {
  ajaxreq = new XMLHttpRequest();
}

ajaxreq.open("GET",filename, true);
ajaxreq.onreadystatechange = ajaxResponse;
ajaxreq.send(null);
}

function ajaxResponse() {
  if (ajaxreq.readyState!=4) return;
  if (ajaxreq.status == 200) {  
    if (ajaxCallback) ajaxCallback();
  } else if (request.status == 404)
         alert("Request URL does not exist");
       else
          alert("Error: status code is " + request.status);    
    return true;
}
