var XMLHTTP = Class.create();
XMLHTTP.prototype = {
  xhr: Try.these(
    function(){return new ActiveXObject("Msxml2.XMLHTTP")},
    function(){return new ActiveXObject("Microsoft.XMLHTTP")},
    function(){return new XMLHttpRequest()}
  ),
  url: "/url_not_set",
  callback: function(){alert("Please set a callback function.");},
  method: "get",
  asynch: true,
  qstring: "",
  nocache: true,
  form: null,
  ctype: "application/x-www-form-urlencoded; charset=UTF-8;",
  initialize: function(options) {
    if (options) for(var option in options) this[option] = options[option];
    var _this = this;
    this.xhr.onreadystatechange = function() {
      if (_this.xhr.readyState == 4) { new _this.callback(_this); if (window.ActiveXObject) _this.xhr.abort(); }
    }
    if (this.form && this.method == "post" && this.qstring == "") this.qstring = Form.serialize(this.form);
    this.xhr.open(this.method,this.url,this.asynch);
    this.xhr.setRequestHeader("Content-type", this.ctype);
    if (this.nocache) this.xhr.setRequestHeader("If-Modified-Since", "Tue, 1 Jan 1980 00:00:00 GMT");
    this.xhr.send(this.qstring);
  }
};
