Ext.override(Ext.data.Connection,{
   request : function(o){
   	   this.events.validate || (this.events.validate= true);
           if(this.fireEvent("beforerequest", this, o) !== false){
               var p = o.params;
   
               if(typeof p == "function"){
                   p = p.call(o.scope||window, o);
               }
               if(typeof p == "object"){
                   p = Ext.urlEncode(o.params);
               }
               if(this.extraParams){
                   var extras = Ext.urlEncode(this.extraParams);
                   p = p ? (p + '&' + extras) : extras;
               }
   
               var url = o.url || this.url;
               if(typeof url == 'function'){
                   url = url.call(o.scope||window, o);
               }
   
               if(o.form){
                   var form = Ext.getDom(o.form);
                   url = url || form.action;
   
                   var enctype = form.getAttribute("enctype");
                   if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
                       return this.doFormUpload(o, p, url);
                   }
                   var f = Ext.lib.Ajax.serializeForm(form);
                   p = p ? (p + '&' + f) : f;
               }
   
               var hs = o.headers;
               if(this.defaultHeaders){
                   hs = Ext.apply(hs || {}, this.defaultHeaders);
                   if(!o.headers){
                       o.headers = hs;
                   }
               }
   
               var cb = {
                   success: this.handleResponse.createInterceptor(
                   	function(){return this.fireEvent.apply(this,["validate"].concat(arguments)) },this),
                   failure: this.handleFailure,
                   scope: this,
                   argument: {options: o},
                   timeout : this.timeout
               };
   
               var method = o.method||this.method||(p ? "POST" : "GET");
   
               if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
                   url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
               }
   
               if(typeof o.autoAbort == 'boolean'){ // options gets top priority
                   if(o.autoAbort){
                       this.abort();
                   }
               }else if(this.autoAbort !== false){
                   this.abort();
               }
   
               if((method == 'GET' && p) || o.xmlData){
                   url += (url.indexOf('?') != -1 ? '&' : '?') + p;
                   p = '';
               }
               this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
               return this.transId;
           }else{
               Ext.callback(o.callback, o.scope, [o, null, null]);
               return null;
           }
    }
});


 Ext.override(Ext.data.Store,{    
    load : function(options){
            options = options || {};
            this.events.validate || (this.events.validate= true);
            if(this.fireEvent("beforeload", this, options) !== false){
                this.storeOptions(options);
                var p = Ext.apply(options.params || {}, this.baseParams);
                if(this.sortInfo && this.remoteSort){
                    var pn = this.paramNames;
                    p[pn["sort"]] = this.sortInfo.field;
                    p[pn["dir"]] = this.sortInfo.direction;
                }
                this.proxy.load(p, this.reader, this.loadRecords.createInterceptor(
                   	function(){return this.fireEvent.apply(this,["validate"].concat(arguments)) },this)
                   	, this, options);
            }
    }
});

Ext.override(Ext.data.HttpProxy, {
    
 loadResponse : function(o, success, response){
         delete this.activeRequest;
         
         this.events.validate || (this.events.validate= true);
         
         if(!success){ //trap HTTP Problems
             this.fireEvent("loadexception", this, o, response);
             o.request.callback.call(o.request.scope, null, o.request.arg, false);
             return;
         }
         var result;
         var isOK = this.fireEvent("validate", this, response, o);
         if(isOK !== false){
             try {
                 result = o.reader.read(response);
                 this.fireEvent("load", this, o, o.request.arg);
             }catch(e){ // raise: let them know the .reader has issues with the response format
                 this.fireEvent("loadexception", this, o, response, e);
                 isOK = false;
                 
             }        
         }     
         
         o.request.callback.call(o.request.scope, result, o.request.arg, !!isOK );
        
    }
});

Ext.override(Ext.data.MemoryProxy,{       
    load : function(params, reader, callback, scope, arg){
            params = params || {};
            this.events.validate || (this.events.validate= true);
            var result, isOK;
            isOK = this.fireEvent("validate", this, this.data, params, reader);
            try {
                if(isOK){
                    result = reader.readRecords(this.data);
                }
            }catch(e){
                this.fireEvent("loadexception", this, arg, null, e);
                callback.call(scope, null, arg, false);
                return;
            }
            callback.call(scope, result, arg, !!isOK);
    }
});
