Asynchronous = function (caller) {
  this._xmlhttp = factory.FactoryXMLHttpRequest();
  this._caller = caller;
}

Asynchronous.prototype.makeGetRequest = function(url) {
  var instance = this;
  this._xmlhttp.open('GET', url, true);
  this._xmlhttp.onreadystatechange = function() {
    switch(instance._xmlhttp.readyState) {
      case 1:
        instance.loading();
        break;
      case 2:
        instance.loaded();
        break;
      case 3:
        instance.interactive();
        break;
      case 4:
        instance.complete(instance._xmlhttp.status,
        instance._xmlhttp.statusText,
        instance._xmlhttp.responseText, instance._xmlhttp.responseXML, instance._caller);
        break;
      }
    }
    this._xmlhttp.send(null);
}

Asynchronous.prototype.makePostRequest = function(url, data) {
  var instance = this;
  this._xmlhttp.open('POST', url, true);
  this._xmlhttp.onreadystatechange = function() {
    switch(instance._xmlhttp.readyState) {
      case 1:
        instance.loading();
        break;
      case 2:
        instance.loaded();
        break;
      case 3:
        instance.interactive();
        break;
      case 4:
        instance.complete(instance._xmlhttp.status,
        instance._xmlhttp.statusText,
        instance._xmlhttp.responseText, instance._xmlhttp.responseXML, instance._caller);
        break;
      }
    }
  this._xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
  this._xmlhttp.send(data);
}

Asynchronous.prototype.loading = function() {
}
Asynchronous.prototype.loaded = function() {
}
Asynchronous.prototype.interactive = function() {
}
Asynchronous.prototype.complete = function(status, statusText, responseText, responseHTML, caller) {
}
