function AjaxObject()
{
     XHR = this.CreateXMLHttpRequest();
}

AjaxObject.prototype = 
{ 
    //Adding Method named "MyMethod" 
     CreateXMLHttpRequest: function()
     {
          var XHR = null;
     
          // informazioni sul nome del browser
          var browserUtente = navigator.userAgent.toUpperCase();
          
          
          // browser standard con supporto nativo
          // non importa il tipo di browser
          if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
          XHR = new XMLHttpRequest();
          
          // browser Internet Explorer
          // è necessario filtrare la versione 4
          else if(
          window.ActiveXObject &&
          browserUtente.indexOf("MSIE 4") < 0
          ) {
          
          // la versione 6 di IE ha un nome differente
          // per il tipo di oggetto ActiveX
          if(browserUtente.indexOf("MSIE 5") < 0)
          XHR = new ActiveXObject("Msxml2.XMLHTTP");
          
          // le versioni 5 e 5.5 invece sfruttano lo stesso nome
          else
          XHR = new ActiveXObject("Microsoft.XMLHTTP");
          }
          
          return XHR;
     
     },
 
     SendRequest : function(url, callbackComplete) 
     {
          if (!XHR)
          {    
               return;
          }
          
         // impostazione richiesta asincrona in GET
         // del file specificato
         XHR.open("GET", url, true);
     
         // rimozione dell'header "connection" come "keep alive"
         XHR.setRequestHeader("connection", "close");
     
         // impostazione controllo e stato della richiesta
         XHR.onreadystatechange = function() 
         {
            if(XHR.readyState === 4) 
            {
                 if(XHR.status == 200)
                 {
                   callbackComplete(XHR.responseXML,XHR.responseText);
                 }
                 else
                 {
                   //alert("Operazione fallita, errore numero " + XHR.status);
                 }
            }
         }
     
         // invio richiesta
         XHR.send(null);
     },
 
    //Adding property named "MyProperty" 
     XHR : null
}

 