/**
 * JsHttpRequest & Prototype integration module.
 * Include this file just after the JsHttpRequest and Prototype inclusion.
 *
 * @license LGPL
 * @author Dmitry Koterov, http://en.dklab.ru/lib/JsHttpRequest/
 * @version 5.x $Id$
 */

Ajax.Request.prototype._jshr_request = Ajax.Request.prototype.request;
Ajax.Request.prototype.request = function(url) {
    // Support for whole form & form element sending.
    var parameters = this.options.parameters;
    this.options.parameters = {};
    this.transport._jshr_send = this.transport.send;
    this.transport.send = function(body) {
        return this._jshr_send(body || parameters);
    }
    this._jshr_request(url);
}

Ajax.getTransport = function() {
    return new JsHttpRequest();
}

//Ajax.Request.prototype.evalResponse = Prototype.emptyFunction;
Ajax.Request.prototype.evalResponse = function() {
        try {
                var js = this.transport.responseJS;
                if (typeof js == 'object') { js = $H(js).toArray().join(''); }
                return js.evalScripts.bind(js).defer();
        } catch (e) {
                this.dispatchException(e);
        }
}