// create object AJAX
function createObjectHttp() {
   var xmlhttp = false;
   try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch(e) {
      try {
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e) {
         xmlhttp = false;
      }
   }

   if(!xmlhttp && document.createElement){
      xmlhttp = new XMLHttpRequest();
   }

   return xmlhttp;
}

// result URL from AJAX
function resultUrl(Url, Operation) {

   var notCatch = Math.floor(Math.random() * 10000);
   Url += "&notCatch=" + notCatch;

   xmlhttp = createObjectHttp();
   xmlhttp.open(Operation, Url, false);

   if( Operation == "POST" ) {
      xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   }

   xmlhttp.send(null);

   /*
   Make sure that the transaction has finished. The XMLHttpRequest object
   has a property called readyState with several states:
   0: Uninitialized
   1: Loading
   2: Loaded
   3: Interactive
   4: Finished
   */

   if( xmlhttp.readyState == 4 ) {
      if( xmlhttp.status == 200 )
         return xmlhttp.responseText;
      else
         return false;
   }
   else
      return false;
}
