AlkAjax.prototype.constructor = AlkAjax;
function AlkAjax(name, onreadystate, methodSend, url, data)
{
  if ( parseInt(methodSend)==methodSend ){
    var tabMethod = new Array("GET", "POST");
    methodSend = tabMethod[methodSend];
  }
  this.name = name;
  this.onreadystate = onreadystate;
  this.methodSend = methodSend;
  this.url = url;
  this.data = data;
  
  var xhr = GetXMLHttpRequest();
  xhr.onreadystatechange = function()
  {
    if ( xhr.readyState == 4 ){//ready
      if ( xhr.status == 200 ){// ok
        eval(onreadystate+"(xhr.responseText)");
      }
    }
  };
  
  xhr.open(this.methodSend, this.url);
  xhr.send(this.data);
}
AlkAjax.prototype.onreadystatechange = function()
{
  if ( this.xhr.readyState == 4 ){//ready
    if ( this.xhr.status == 200 ){// ok
      this.onreadystate(this.xhr.responseText);
    }
  }
}

function GetXMLHttpRequest(){  
  var xhr = null; 
     
  if (window.XMLHttpRequest) // Firefox 
    xhr = new XMLHttpRequest(); 
  else if (window.ActiveXObject) // Internet Explorer 
    xhr = new ActiveXObject("Microsoft.XMLHTTP"); 
  else { // XMLHttpRequest non supporté par le navigateur 
    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
    return null; 
  } 
  return xhr;
}