
// Cria variável de solicitação XML
var myRequest = false;

// Declara a função que MOSTRA o call Ajax.
function displayAjax(myURL) {
     // Limpa myRequest
     myRequest = false;
     // For browsers: Safari, Firefox, etc. use one XML model
     if (window.XMLHttpRequest) {
          myRequest = new XMLHttpRequest();
          if (myRequest.overrideMimeType) {
               myRequest.overrideMimeType('text/xml');
          }
			   
     } else if (window.ActiveXObject) {
          // For browsers: IE, version 6 and before, use another model
          try {
               myRequest = new ActiveXObject("Msxml2.XMLHTTP");
          } catch (e) {
               try {
                    myRequest = new ActiveXObject("Microsoft.XMLHTTP");
               } catch (e) {}
          }
     }
     // Confirma que o request é válido.
     if (!myRequest) {
          alert('Error: Cannot create XMLHTTP object');
          return false;
     }
     
     // Link to display function activated when result returned
     myRequest.onreadystatechange = displayReturn;
     // Open the URL request
     myRequest.open('GET', myURL, true);
     // Send request
     myRequest.send(null);
}
function displayReturn() {
     // Check to make sure result came through, 4=complete
     if (myRequest.readyState == 4) {
          // Check HTTP status code
          if (myRequest.status == 200) {
               // Display the responseText
			   grayOut(true, false, myRequest.responseText);
          } else {
               alert('There was a problem with the request.');
			   //alert(myRequest.status);
          }
     }
}
