var RequestOn = false;
var RequestId = '';
var msgAguarde = 'Aguarde !! Buscando informações...';

function Execute(AEvent, ACmd, AId) {
   var ajaxObj;
   RequestOn = true;
   RequestId = AId;

   try {
      // Firefox, Opera 8.0+, Safari...
      ajaxObj=new XMLHttpRequest();
   } catch (e) {
      // Internet Explorer
      try {
         ajaxObj=new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
         try {
            ajaxObj=new ActiveXObject("Microsoft.XMLHTTP");
         } catch (e) {
            alert("Seu navegador não possui suporte ao AJAX!");
            return false;
         }
      }
   }
   ajaxObj.onreadystatechange=function() {
      switch (ajaxObj.readyState) {
        case 1:
          AEvent(msgAguarde, ajaxObj.readyState);
          break;
        case 4:
          RequestOn = false;
          AEvent(ajaxObj.responseText, ajaxObj.readyState);
          RequestId = '';
          break;
      }
   }
//   ajaxObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
   ajaxObj.open("GET","index.php?cmd="+ACmd+":"+AId+"&full=0",true);
   ajaxObj.send(null);
}
