Upgrade to ExtJS 3.2.1 - Released 04/27/2010
[extjs.git] / adapter / ext / ext-base-debug.js
1
2
3 window.undefined = window.undefined;
4
5
6
7 Ext = {
8     
9     version : '3.2.1',
10     versionDetail : {
11         major: 3,
12         minor: 2,
13         patch: 1
14     }
15 };
16
17
18 Ext.apply = function(o, c, defaults){
19     
20     if(defaults){
21         Ext.apply(o, defaults);
22     }
23     if(o && c && typeof c == 'object'){
24         for(var p in c){
25             o[p] = c[p];
26         }
27     }
28     return o;
29 };
30
31 (function(){
32     var idSeed = 0,
33         toString = Object.prototype.toString,
34         ua = navigator.userAgent.toLowerCase(),
35         check = function(r){
36             return r.test(ua);
37         },
38         DOC = document,
39         isStrict = DOC.compatMode == "CSS1Compat",
40         isOpera = check(/opera/),
41         isChrome = check(/\bchrome\b/),
42         isWebKit = check(/webkit/),
43         isSafari = !isChrome && check(/safari/),
44         isSafari2 = isSafari && check(/applewebkit\/4/), 
45         isSafari3 = isSafari && check(/version\/3/),
46         isSafari4 = isSafari && check(/version\/4/),
47         isIE = !isOpera && check(/msie/),
48         isIE7 = isIE && check(/msie 7/),
49         isIE8 = isIE && check(/msie 8/),
50         isIE6 = isIE && !isIE7 && !isIE8,
51         isGecko = !isWebKit && check(/gecko/),
52         isGecko2 = isGecko && check(/rv:1\.8/),
53         isGecko3 = isGecko && check(/rv:1\.9/),
54         isBorderBox = isIE && !isStrict,
55         isWindows = check(/windows|win32/),
56         isMac = check(/macintosh|mac os x/),
57         isAir = check(/adobeair/),
58         isLinux = check(/linux/),
59         isSecure = /^https/i.test(window.location.protocol);
60
61     
62     if(isIE6){
63         try{
64             DOC.execCommand("BackgroundImageCache", false, true);
65         }catch(e){}
66     }
67
68     Ext.apply(Ext, {
69         
70         SSL_SECURE_URL : isSecure && isIE ? 'javascript:""' : 'about:blank',
71         
72         isStrict : isStrict,
73         
74         isSecure : isSecure,
75         
76         isReady : false,
77
78         
79
80         
81         enableGarbageCollector : true,
82
83         
84         enableListenerCollection : false,
85
86         
87         enableNestedListenerRemoval : false,
88
89         
90         USE_NATIVE_JSON : false,
91
92         
93         applyIf : function(o, c){
94             if(o){
95                 for(var p in c){
96                     if(!Ext.isDefined(o[p])){
97                         o[p] = c[p];
98                     }
99                 }
100             }
101             return o;
102         },
103
104         
105         id : function(el, prefix){
106             el = Ext.getDom(el, true) || {};
107             if (!el.id) {
108                 el.id = (prefix || "ext-gen") + (++idSeed);
109             }
110             return el.id;
111         },
112
113         
114         extend : function(){
115             
116             var io = function(o){
117                 for(var m in o){
118                     this[m] = o[m];
119                 }
120             };
121             var oc = Object.prototype.constructor;
122
123             return function(sb, sp, overrides){
124                 if(typeof sp == 'object'){
125                     overrides = sp;
126                     sp = sb;
127                     sb = overrides.constructor != oc ? overrides.constructor : function(){sp.apply(this, arguments);};
128                 }
129                 var F = function(){},
130                     sbp,
131                     spp = sp.prototype;
132
133                 F.prototype = spp;
134                 sbp = sb.prototype = new F();
135                 sbp.constructor=sb;
136                 sb.superclass=spp;
137                 if(spp.constructor == oc){
138                     spp.constructor=sp;
139                 }
140                 sb.override = function(o){
141                     Ext.override(sb, o);
142                 };
143                 sbp.superclass = sbp.supr = (function(){
144                     return spp;
145                 });
146                 sbp.override = io;
147                 Ext.override(sb, overrides);
148                 sb.extend = function(o){return Ext.extend(sb, o);};
149                 return sb;
150             };
151         }(),
152
153         
154         override : function(origclass, overrides){
155             if(overrides){
156                 var p = origclass.prototype;
157                 Ext.apply(p, overrides);
158                 if(Ext.isIE && overrides.hasOwnProperty('toString')){
159                     p.toString = overrides.toString;
160                 }
161             }
162         },
163
164         
165         namespace : function(){
166             var o, d;
167             Ext.each(arguments, function(v) {
168                 d = v.split(".");
169                 o = window[d[0]] = window[d[0]] || {};
170                 Ext.each(d.slice(1), function(v2){
171                     o = o[v2] = o[v2] || {};
172                 });
173             });
174             return o;
175         },
176
177         
178         urlEncode : function(o, pre){
179             var empty,
180                 buf = [],
181                 e = encodeURIComponent;
182
183             Ext.iterate(o, function(key, item){
184                 empty = Ext.isEmpty(item);
185                 Ext.each(empty ? key : item, function(val){
186                     buf.push('&', e(key), '=', (!Ext.isEmpty(val) && (val != key || !empty)) ? (Ext.isDate(val) ? Ext.encode(val).replace(/"/g, '') : e(val)) : '');
187                 });
188             });
189             if(!pre){
190                 buf.shift();
191                 pre = '';
192             }
193             return pre + buf.join('');
194         },
195
196         
197         urlDecode : function(string, overwrite){
198             if(Ext.isEmpty(string)){
199                 return {};
200             }
201             var obj = {},
202                 pairs = string.split('&'),
203                 d = decodeURIComponent,
204                 name,
205                 value;
206             Ext.each(pairs, function(pair) {
207                 pair = pair.split('=');
208                 name = d(pair[0]);
209                 value = d(pair[1]);
210                 obj[name] = overwrite || !obj[name] ? value :
211                             [].concat(obj[name]).concat(value);
212             });
213             return obj;
214         },
215
216         
217         urlAppend : function(url, s){
218             if(!Ext.isEmpty(s)){
219                 return url + (url.indexOf('?') === -1 ? '?' : '&') + s;
220             }
221             return url;
222         },
223
224         
225          toArray : function(){
226              return isIE ?
227                  function(a, i, j, res){
228                      res = [];
229                      for(var x = 0, len = a.length; x < len; x++) {
230                          res.push(a[x]);
231                      }
232                      return res.slice(i || 0, j || res.length);
233                  } :
234                  function(a, i, j){
235                      return Array.prototype.slice.call(a, i || 0, j || a.length);
236                  }
237          }(),
238
239         isIterable : function(v){
240             
241             if(Ext.isArray(v) || v.callee){
242                 return true;
243             }
244             
245             if(/NodeList|HTMLCollection/.test(toString.call(v))){
246                 return true;
247             }
248             
249             
250             return ((typeof v.nextNode != 'undefined' || v.item) && Ext.isNumber(v.length));
251         },
252
253         
254         each : function(array, fn, scope){
255             if(Ext.isEmpty(array, true)){
256                 return;
257             }
258             if(!Ext.isIterable(array) || Ext.isPrimitive(array)){
259                 array = [array];
260             }
261             for(var i = 0, len = array.length; i < len; i++){
262                 if(fn.call(scope || array[i], array[i], i, array) === false){
263                     return i;
264                 };
265             }
266         },
267
268         
269         iterate : function(obj, fn, scope){
270             if(Ext.isEmpty(obj)){
271                 return;
272             }
273             if(Ext.isIterable(obj)){
274                 Ext.each(obj, fn, scope);
275                 return;
276             }else if(typeof obj == 'object'){
277                 for(var prop in obj){
278                     if(obj.hasOwnProperty(prop)){
279                         if(fn.call(scope || obj, prop, obj[prop], obj) === false){
280                             return;
281                         };
282                     }
283                 }
284             }
285         },
286
287         
288         getDom : function(el, strict){
289             if(!el || !DOC){
290                 return null;
291             }
292             if (el.dom){
293                 return el.dom;
294             } else {
295                 if (typeof el == 'string') {
296                     var e = DOC.getElementById(el);
297                     
298                     
299                     if (e && isIE && strict) {
300                         if (el == e.getAttribute('id')) {
301                             return e;
302                         } else {
303                             return null;
304                         }
305                     }
306                     return e;
307                 } else {
308                     return el;
309                 }
310             }
311         },
312
313         
314         getBody : function(){
315             return Ext.get(DOC.body || DOC.documentElement);
316         },
317
318         
319         
320         removeNode : isIE && !isIE8 ? function(){
321             var d;
322             return function(n){
323                 if(n && n.tagName != 'BODY'){
324                     (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
325                     d = d || DOC.createElement('div');
326                     d.appendChild(n);
327                     d.innerHTML = '';
328                     delete Ext.elCache[n.id];
329                 }
330             }
331         }() : function(n){
332             if(n && n.parentNode && n.tagName != 'BODY'){
333                 (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
334                 n.parentNode.removeChild(n);
335                 delete Ext.elCache[n.id];
336             }
337         },
338
339         
340         isEmpty : function(v, allowBlank){
341             return v === null || v === undefined || ((Ext.isArray(v) && !v.length)) || (!allowBlank ? v === '' : false);
342         },
343
344         
345         isArray : function(v){
346             return toString.apply(v) === '[object Array]';
347         },
348
349         
350         isDate : function(v){
351             return toString.apply(v) === '[object Date]';
352         },
353
354         
355         isObject : function(v){
356             return !!v && Object.prototype.toString.call(v) === '[object Object]';
357         },
358
359         
360         isPrimitive : function(v){
361             return Ext.isString(v) || Ext.isNumber(v) || Ext.isBoolean(v);
362         },
363
364         
365         isFunction : function(v){
366             return toString.apply(v) === '[object Function]';
367         },
368
369         
370         isNumber : function(v){
371             return typeof v === 'number' && isFinite(v);
372         },
373
374         
375         isString : function(v){
376             return typeof v === 'string';
377         },
378
379         
380         isBoolean : function(v){
381             return typeof v === 'boolean';
382         },
383
384         
385         isElement : function(v) {
386             return v ? !!v.tagName : false;
387         },
388
389         
390         isDefined : function(v){
391             return typeof v !== 'undefined';
392         },
393
394         
395         isOpera : isOpera,
396         
397         isWebKit : isWebKit,
398         
399         isChrome : isChrome,
400         
401         isSafari : isSafari,
402         
403         isSafari3 : isSafari3,
404         
405         isSafari4 : isSafari4,
406         
407         isSafari2 : isSafari2,
408         
409         isIE : isIE,
410         
411         isIE6 : isIE6,
412         
413         isIE7 : isIE7,
414         
415         isIE8 : isIE8,
416         
417         isGecko : isGecko,
418         
419         isGecko2 : isGecko2,
420         
421         isGecko3 : isGecko3,
422         
423         isBorderBox : isBorderBox,
424         
425         isLinux : isLinux,
426         
427         isWindows : isWindows,
428         
429         isMac : isMac,
430         
431         isAir : isAir
432     });
433
434     
435     Ext.ns = Ext.namespace;
436 })();
437
438 Ext.ns("Ext.util", "Ext.lib", "Ext.data");
439
440 Ext.elCache = {};
441
442
443 Ext.apply(Function.prototype, {
444      
445     createInterceptor : function(fcn, scope){
446         var method = this;
447         return !Ext.isFunction(fcn) ?
448                 this :
449                 function() {
450                     var me = this,
451                         args = arguments;
452                     fcn.target = me;
453                     fcn.method = method;
454                     return (fcn.apply(scope || me || window, args) !== false) ?
455                             method.apply(me || window, args) :
456                             null;
457                 };
458     },
459
460      
461     createCallback : function(){
462         
463         var args = arguments,
464             method = this;
465         return function() {
466             return method.apply(window, args);
467         };
468     },
469
470     
471     createDelegate : function(obj, args, appendArgs){
472         var method = this;
473         return function() {
474             var callArgs = args || arguments;
475             if (appendArgs === true){
476                 callArgs = Array.prototype.slice.call(arguments, 0);
477                 callArgs = callArgs.concat(args);
478             }else if (Ext.isNumber(appendArgs)){
479                 callArgs = Array.prototype.slice.call(arguments, 0); 
480                 var applyArgs = [appendArgs, 0].concat(args); 
481                 Array.prototype.splice.apply(callArgs, applyArgs); 
482             }
483             return method.apply(obj || window, callArgs);
484         };
485     },
486
487     
488     defer : function(millis, obj, args, appendArgs){
489         var fn = this.createDelegate(obj, args, appendArgs);
490         if(millis > 0){
491             return setTimeout(fn, millis);
492         }
493         fn();
494         return 0;
495     }
496 });
497
498
499 Ext.applyIf(String, {
500     
501     format : function(format){
502         var args = Ext.toArray(arguments, 1);
503         return format.replace(/\{(\d+)\}/g, function(m, i){
504             return args[i];
505         });
506     }
507 });
508
509
510 Ext.applyIf(Array.prototype, {
511     
512     indexOf : function(o, from){
513         var len = this.length;
514         from = from || 0;
515         from += (from < 0) ? len : 0;
516         for (; from < len; ++from){
517             if(this[from] === o){
518                 return from;
519             }
520         }
521         return -1;
522     },
523
524     
525     remove : function(o){
526         var index = this.indexOf(o);
527         if(index != -1){
528             this.splice(index, 1);
529         }
530         return this;
531     }
532 });
533
534
535 Ext.ns("Ext.grid", "Ext.list", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu",
536        "Ext.state", "Ext.layout", "Ext.app", "Ext.ux", "Ext.chart", "Ext.direct");
537     
538
539 Ext.apply(Ext, function(){
540     var E = Ext,
541         idSeed = 0,
542         scrollWidth = null;
543
544     return {
545         
546         emptyFn : function(){},
547
548         
549         BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ?
550                             'http:/' + '/www.extjs.com/s.gif' :
551                             'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
552
553         extendX : function(supr, fn){
554             return Ext.extend(supr, fn(supr.prototype));
555         },
556
557         
558         getDoc : function(){
559             return Ext.get(document);
560         },
561
562         
563         num : function(v, defaultValue){
564             v = Number(Ext.isEmpty(v) || Ext.isArray(v) || typeof v == 'boolean' || (typeof v == 'string' && v.trim().length == 0) ? NaN : v);
565             return isNaN(v) ? defaultValue : v;
566         },
567
568         
569         value : function(v, defaultValue, allowBlank){
570             return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
571         },
572
573         
574         escapeRe : function(s) {
575             return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");
576         },
577
578         sequence : function(o, name, fn, scope){
579             o[name] = o[name].createSequence(fn, scope);
580         },
581
582         
583         addBehaviors : function(o){
584             if(!Ext.isReady){
585                 Ext.onReady(function(){
586                     Ext.addBehaviors(o);
587                 });
588             } else {
589                 var cache = {}, 
590                     parts,
591                     b,
592                     s;
593                 for (b in o) {
594                     if ((parts = b.split('@'))[1]) { 
595                         s = parts[0];
596                         if(!cache[s]){
597                             cache[s] = Ext.select(s);
598                         }
599                         cache[s].on(parts[1], o[b]);
600                     }
601                 }
602                 cache = null;
603             }
604         },
605
606         
607         getScrollBarWidth: function(force){
608             if(!Ext.isReady){
609                 return 0;
610             }
611
612             if(force === true || scrollWidth === null){
613                     
614                 var div = Ext.getBody().createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
615                     child = div.child('div', true);
616                 var w1 = child.offsetWidth;
617                 div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
618                 var w2 = child.offsetWidth;
619                 div.remove();
620                 
621                 scrollWidth = w1 - w2 + 2;
622             }
623             return scrollWidth;
624         },
625
626
627         
628         combine : function(){
629             var as = arguments, l = as.length, r = [];
630             for(var i = 0; i < l; i++){
631                 var a = as[i];
632                 if(Ext.isArray(a)){
633                     r = r.concat(a);
634                 }else if(a.length !== undefined && !a.substr){
635                     r = r.concat(Array.prototype.slice.call(a, 0));
636                 }else{
637                     r.push(a);
638                 }
639             }
640             return r;
641         },
642
643         
644         copyTo : function(dest, source, names){
645             if(typeof names == 'string'){
646                 names = names.split(/[,;\s]/);
647             }
648             Ext.each(names, function(name){
649                 if(source.hasOwnProperty(name)){
650                     dest[name] = source[name];
651                 }
652             }, this);
653             return dest;
654         },
655
656         
657         destroy : function(){
658             Ext.each(arguments, function(arg){
659                 if(arg){
660                     if(Ext.isArray(arg)){
661                         this.destroy.apply(this, arg);
662                     }else if(typeof arg.destroy == 'function'){
663                         arg.destroy();
664                     }else if(arg.dom){
665                         arg.remove();
666                     }
667                 }
668             }, this);
669         },
670
671         
672         destroyMembers : function(o, arg1, arg2, etc){
673             for(var i = 1, a = arguments, len = a.length; i < len; i++) {
674                 Ext.destroy(o[a[i]]);
675                 delete o[a[i]];
676             }
677         },
678
679         
680         clean : function(arr){
681             var ret = [];
682             Ext.each(arr, function(v){
683                 if(!!v){
684                     ret.push(v);
685                 }
686             });
687             return ret;
688         },
689
690         
691         unique : function(arr){
692             var ret = [],
693                 collect = {};
694
695             Ext.each(arr, function(v) {
696                 if(!collect[v]){
697                     ret.push(v);
698                 }
699                 collect[v] = true;
700             });
701             return ret;
702         },
703
704         
705         flatten : function(arr){
706             var worker = [];
707             function rFlatten(a) {
708                 Ext.each(a, function(v) {
709                     if(Ext.isArray(v)){
710                         rFlatten(v);
711                     }else{
712                         worker.push(v);
713                     }
714                 });
715                 return worker;
716             }
717             return rFlatten(arr);
718         },
719
720         
721         min : function(arr, comp){
722             var ret = arr[0];
723             comp = comp || function(a,b){ return a < b ? -1 : 1; };
724             Ext.each(arr, function(v) {
725                 ret = comp(ret, v) == -1 ? ret : v;
726             });
727             return ret;
728         },
729
730         
731         max : function(arr, comp){
732             var ret = arr[0];
733             comp = comp || function(a,b){ return a > b ? 1 : -1; };
734             Ext.each(arr, function(v) {
735                 ret = comp(ret, v) == 1 ? ret : v;
736             });
737             return ret;
738         },
739
740         
741         mean : function(arr){
742            return arr.length > 0 ? Ext.sum(arr) / arr.length : undefined;
743         },
744
745         
746         sum : function(arr){
747            var ret = 0;
748            Ext.each(arr, function(v) {
749                ret += v;
750            });
751            return ret;
752         },
753
754         
755         partition : function(arr, truth){
756             var ret = [[],[]];
757             Ext.each(arr, function(v, i, a) {
758                 ret[ (truth && truth(v, i, a)) || (!truth && v) ? 0 : 1].push(v);
759             });
760             return ret;
761         },
762
763         
764         invoke : function(arr, methodName){
765             var ret = [],
766                 args = Array.prototype.slice.call(arguments, 2);
767             Ext.each(arr, function(v,i) {
768                 if (v && typeof v[methodName] == 'function') {
769                     ret.push(v[methodName].apply(v, args));
770                 } else {
771                     ret.push(undefined);
772                 }
773             });
774             return ret;
775         },
776
777         
778         pluck : function(arr, prop){
779             var ret = [];
780             Ext.each(arr, function(v) {
781                 ret.push( v[prop] );
782             });
783             return ret;
784         },
785
786         
787         zip : function(){
788             var parts = Ext.partition(arguments, function( val ){ return typeof val != 'function'; }),
789                 arrs = parts[0],
790                 fn = parts[1][0],
791                 len = Ext.max(Ext.pluck(arrs, "length")),
792                 ret = [];
793
794             for (var i = 0; i < len; i++) {
795                 ret[i] = [];
796                 if(fn){
797                     ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
798                 }else{
799                     for (var j = 0, aLen = arrs.length; j < aLen; j++){
800                         ret[i].push( arrs[j][i] );
801                     }
802                 }
803             }
804             return ret;
805         },
806
807         
808         getCmp : function(id){
809             return Ext.ComponentMgr.get(id);
810         },
811
812         
813         useShims: E.isIE6 || (E.isMac && E.isGecko2),
814
815         
816         
817         type : function(o){
818             if(o === undefined || o === null){
819                 return false;
820             }
821             if(o.htmlElement){
822                 return 'element';
823             }
824             var t = typeof o;
825             if(t == 'object' && o.nodeName) {
826                 switch(o.nodeType) {
827                     case 1: return 'element';
828                     case 3: return (/\S/).test(o.nodeValue) ? 'textnode' : 'whitespace';
829                 }
830             }
831             if(t == 'object' || t == 'function') {
832                 switch(o.constructor) {
833                     case Array: return 'array';
834                     case RegExp: return 'regexp';
835                     case Date: return 'date';
836                 }
837                 if(typeof o.length == 'number' && typeof o.item == 'function') {
838                     return 'nodelist';
839                 }
840             }
841             return t;
842         },
843
844         intercept : function(o, name, fn, scope){
845             o[name] = o[name].createInterceptor(fn, scope);
846         },
847
848         
849         callback : function(cb, scope, args, delay){
850             if(typeof cb == 'function'){
851                 if(delay){
852                     cb.defer(delay, scope, args || []);
853                 }else{
854                     cb.apply(scope, args || []);
855                 }
856             }
857         }
858     };
859 }());
860
861
862 Ext.apply(Function.prototype, {
863     
864     createSequence : function(fcn, scope){
865         var method = this;
866         return (typeof fcn != 'function') ?
867                 this :
868                 function(){
869                     var retval = method.apply(this || window, arguments);
870                     fcn.apply(scope || this || window, arguments);
871                     return retval;
872                 };
873     }
874 });
875
876
877
878 Ext.applyIf(String, {
879
880     
881     escape : function(string) {
882         return string.replace(/('|\\)/g, "\\$1");
883     },
884
885     
886     leftPad : function (val, size, ch) {
887         var result = String(val);
888         if(!ch) {
889             ch = " ";
890         }
891         while (result.length < size) {
892             result = ch + result;
893         }
894         return result;
895     }
896 });
897
898
899 String.prototype.toggle = function(value, other){
900     return this == value ? other : value;
901 };
902
903
904 String.prototype.trim = function(){
905     var re = /^\s+|\s+$/g;
906     return function(){ return this.replace(re, ""); };
907 }();
908
909
910
911 Date.prototype.getElapsed = function(date) {
912     return Math.abs((date || new Date()).getTime()-this.getTime());
913 };
914
915
916
917 Ext.applyIf(Number.prototype, {
918     
919     constrain : function(min, max){
920         return Math.min(Math.max(this, min), max);
921     }
922 });
923
924 Ext.util.TaskRunner = function(interval){
925     interval = interval || 10;
926     var tasks = [], 
927         removeQueue = [],
928         id = 0,
929         running = false,
930
931         
932         stopThread = function(){
933                 running = false;
934                 clearInterval(id);
935                 id = 0;
936             },
937
938         
939         startThread = function(){
940                 if(!running){
941                     running = true;
942                     id = setInterval(runTasks, interval);
943                 }
944             },
945
946         
947         removeTask = function(t){
948                 removeQueue.push(t);
949                 if(t.onStop){
950                     t.onStop.apply(t.scope || t);
951                 }
952             },
953             
954         
955         runTasks = function(){
956                 var rqLen = removeQueue.length,
957                         now = new Date().getTime();                                             
958             
959                 if(rqLen > 0){
960                     for(var i = 0; i < rqLen; i++){
961                         tasks.remove(removeQueue[i]);
962                     }
963                     removeQueue = [];
964                     if(tasks.length < 1){
965                         stopThread();
966                         return;
967                     }
968                 }               
969                 for(var i = 0, t, itime, rt, len = tasks.length; i < len; ++i){
970                     t = tasks[i];
971                     itime = now - t.taskRunTime;
972                     if(t.interval <= itime){
973                         rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
974                         t.taskRunTime = now;
975                         if(rt === false || t.taskRunCount === t.repeat){
976                             removeTask(t);
977                             return;
978                         }
979                     }
980                     if(t.duration && t.duration <= (now - t.taskStartTime)){
981                         removeTask(t);
982                     }
983                 }
984             };
985
986     
987     this.start = function(task){
988         tasks.push(task);
989         task.taskStartTime = new Date().getTime();
990         task.taskRunTime = 0;
991         task.taskRunCount = 0;
992         startThread();
993         return task;
994     };
995
996     
997     this.stop = function(task){
998         removeTask(task);
999         return task;
1000     };
1001
1002     
1003     this.stopAll = function(){
1004         stopThread();
1005         for(var i = 0, len = tasks.length; i < len; i++){
1006             if(tasks[i].onStop){
1007                 tasks[i].onStop();
1008             }
1009         }
1010         tasks = [];
1011         removeQueue = [];
1012     };
1013 };
1014
1015
1016 Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
1017         var libFlyweight;
1018         
1019         function fly(el) {
1020         if (!libFlyweight) {
1021             libFlyweight = new Ext.Element.Flyweight();
1022         }
1023         libFlyweight.dom = el;
1024         return libFlyweight;
1025     }
1026     
1027     (function(){
1028         var doc = document,
1029                 isCSS1 = doc.compatMode == "CSS1Compat",
1030                 MAX = Math.max,         
1031         ROUND = Math.round,
1032                 PARSEINT = parseInt;
1033                 
1034         Ext.lib.Dom = {
1035             isAncestor : function(p, c) {
1036                     var ret = false;
1037                         
1038                         p = Ext.getDom(p);
1039                         c = Ext.getDom(c);
1040                         if (p && c) {
1041                                 if (p.contains) {
1042                                         return p.contains(c);
1043                                 } else if (p.compareDocumentPosition) {
1044                                         return !!(p.compareDocumentPosition(c) & 16);
1045                                 } else {
1046                                         while (c = c.parentNode) {
1047                                                 ret = c == p || ret;                                    
1048                                         }
1049                                 }                   
1050                         }       
1051                         return ret;
1052                 },
1053                 
1054         getViewWidth : function(full) {
1055             return full ? this.getDocumentWidth() : this.getViewportWidth();
1056         },
1057
1058         getViewHeight : function(full) {
1059             return full ? this.getDocumentHeight() : this.getViewportHeight();
1060         },
1061
1062         getDocumentHeight: function() {            
1063             return MAX(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, this.getViewportHeight());
1064         },
1065
1066         getDocumentWidth: function() {            
1067             return MAX(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, this.getViewportWidth());
1068         },
1069
1070         getViewportHeight: function(){
1071                 return Ext.isIE ? 
1072                            (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
1073                            self.innerHeight;
1074         },
1075
1076         getViewportWidth : function() {
1077                 return !Ext.isStrict && !Ext.isOpera ? doc.body.clientWidth :
1078                            Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
1079         },
1080         
1081         getY : function(el) {
1082             return this.getXY(el)[1];
1083         },
1084
1085         getX : function(el) {
1086             return this.getXY(el)[0];
1087         },
1088
1089         getXY : function(el) {
1090             var p, 
1091                 pe, 
1092                 b,
1093                 bt, 
1094                 bl,     
1095                 dbd,            
1096                 x = 0,
1097                 y = 0, 
1098                 scroll,
1099                 hasAbsolute, 
1100                 bd = (doc.body || doc.documentElement),
1101                 ret = [0,0];
1102                 
1103             el = Ext.getDom(el);
1104
1105             if(el != bd){
1106                     if (el.getBoundingClientRect) {
1107                         b = el.getBoundingClientRect();
1108                         scroll = fly(document).getScroll();
1109                         ret = [ROUND(b.left + scroll.left), ROUND(b.top + scroll.top)];
1110                     } else {  
1111                             p = el;             
1112                             hasAbsolute = fly(el).isStyle("position", "absolute");
1113                 
1114                             while (p) {
1115                                     pe = fly(p);                
1116                                 x += p.offsetLeft;
1117                                 y += p.offsetTop;
1118                 
1119                                 hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");
1120                                                 
1121                                 if (Ext.isGecko) {                                  
1122                                     y += bt = PARSEINT(pe.getStyle("borderTopWidth"), 10) || 0;
1123                                     x += bl = PARSEINT(pe.getStyle("borderLeftWidth"), 10) || 0;        
1124                 
1125                                     if (p != el && !pe.isStyle('overflow','visible')) {
1126                                         x += bl;
1127                                         y += bt;
1128                                     }
1129                                 }
1130                                 p = p.offsetParent;
1131                             }
1132                 
1133                             if (Ext.isSafari && hasAbsolute) {
1134                                 x -= bd.offsetLeft;
1135                                 y -= bd.offsetTop;
1136                             }
1137                 
1138                             if (Ext.isGecko && !hasAbsolute) {
1139                                 dbd = fly(bd);
1140                                 x += PARSEINT(dbd.getStyle("borderLeftWidth"), 10) || 0;
1141                                 y += PARSEINT(dbd.getStyle("borderTopWidth"), 10) || 0;
1142                             }
1143                 
1144                             p = el.parentNode;
1145                             while (p && p != bd) {
1146                                 if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {
1147                                     x -= p.scrollLeft;
1148                                     y -= p.scrollTop;
1149                                 }
1150                                 p = p.parentNode;
1151                             }
1152                             ret = [x,y];
1153                     }
1154                 }
1155             return ret
1156         },
1157
1158         setXY : function(el, xy) {
1159             (el = Ext.fly(el, '_setXY')).position();
1160             
1161             var pts = el.translatePoints(xy),
1162                 style = el.dom.style,
1163                 pos;                    
1164             
1165             for (pos in pts) {              
1166                     if(!isNaN(pts[pos])) style[pos] = pts[pos] + "px"
1167             }
1168         },
1169
1170         setX : function(el, x) {
1171             this.setXY(el, [x, false]);
1172         },
1173
1174         setY : function(el, y) {
1175             this.setXY(el, [false, y]);
1176         }
1177     };
1178 })();Ext.lib.Dom.getRegion = function(el) {
1179     return Ext.lib.Region.getRegion(el);
1180 };Ext.lib.Event = function() {
1181     var loadComplete = false,
1182         unloadListeners = {},
1183         retryCount = 0,
1184         onAvailStack = [],
1185         _interval,
1186         locked = false,
1187         win = window,
1188         doc = document,
1189
1190         
1191         POLL_RETRYS = 200,
1192         POLL_INTERVAL = 20,
1193         EL = 0,
1194         TYPE = 0,
1195         FN = 1,
1196         WFN = 2,
1197         OBJ = 2,
1198         ADJ_SCOPE = 3,
1199         SCROLLLEFT = 'scrollLeft',
1200         SCROLLTOP = 'scrollTop',
1201         UNLOAD = 'unload',
1202         MOUSEOVER = 'mouseover',
1203         MOUSEOUT = 'mouseout',
1204         
1205         doAdd = function() {
1206             var ret;
1207             if (win.addEventListener) {
1208                 ret = function(el, eventName, fn, capture) {
1209                     if (eventName == 'mouseenter') {
1210                         fn = fn.createInterceptor(checkRelatedTarget);
1211                         el.addEventListener(MOUSEOVER, fn, (capture));
1212                     } else if (eventName == 'mouseleave') {
1213                         fn = fn.createInterceptor(checkRelatedTarget);
1214                         el.addEventListener(MOUSEOUT, fn, (capture));
1215                     } else {
1216                         el.addEventListener(eventName, fn, (capture));
1217                     }
1218                     return fn;
1219                 };
1220             } else if (win.attachEvent) {
1221                 ret = function(el, eventName, fn, capture) {
1222                     el.attachEvent("on" + eventName, fn);
1223                     return fn;
1224                 };
1225             } else {
1226                 ret = function(){};
1227             }
1228             return ret;
1229         }(),
1230         
1231         doRemove = function(){
1232             var ret;
1233             if (win.removeEventListener) {
1234                 ret = function (el, eventName, fn, capture) {
1235                     if (eventName == 'mouseenter') {
1236                         eventName = MOUSEOVER;
1237                     } else if (eventName == 'mouseleave') {
1238                         eventName = MOUSEOUT;
1239                     }
1240                     el.removeEventListener(eventName, fn, (capture));
1241                 };
1242             } else if (win.detachEvent) {
1243                 ret = function (el, eventName, fn) {
1244                     el.detachEvent("on" + eventName, fn);
1245                 };
1246             } else {
1247                 ret = function(){};
1248             }
1249             return ret;
1250         }();
1251
1252     function checkRelatedTarget(e) {
1253         return !elContains(e.currentTarget, pub.getRelatedTarget(e));
1254     }
1255
1256     function elContains(parent, child) {
1257        if(parent && parent.firstChild){
1258          while(child) {
1259             if(child === parent) {
1260                 return true;
1261             }
1262             child = child.parentNode;
1263             if(child && (child.nodeType != 1)) {
1264                 child = null;
1265             }
1266           }
1267         }
1268         return false;
1269     }
1270
1271     
1272     function _tryPreloadAttach() {
1273         var ret = false,
1274             notAvail = [],
1275             element, i, v, override,
1276             tryAgain = !loadComplete || (retryCount > 0);
1277
1278         if(!locked){
1279             locked = true;
1280             
1281             for(i = 0; i < onAvailStack.length; ++i){
1282                 v = onAvailStack[i];
1283                 if(v && (element = doc.getElementById(v.id))){
1284                     if(!v.checkReady || loadComplete || element.nextSibling || (doc && doc.body)) {
1285                         override = v.override;
1286                         element = override ? (override === true ? v.obj : override) : element;
1287                         v.fn.call(element, v.obj);
1288                         onAvailStack.remove(v);
1289                         --i;
1290                     }else{
1291                         notAvail.push(v);
1292                     }
1293                 }
1294             }
1295
1296             retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;
1297
1298             if (tryAgain) {
1299                 startInterval();
1300             } else {
1301                 clearInterval(_interval);
1302                 _interval = null;
1303             }
1304             ret = !(locked = false);
1305         }
1306         return ret;
1307     }
1308
1309     
1310     function startInterval() {
1311         if(!_interval){
1312             var callback = function() {
1313                 _tryPreloadAttach();
1314             };
1315             _interval = setInterval(callback, POLL_INTERVAL);
1316         }
1317     }
1318
1319     
1320     function getScroll() {
1321         var dd = doc.documentElement,
1322             db = doc.body;
1323         if(dd && (dd[SCROLLTOP] || dd[SCROLLLEFT])){
1324             return [dd[SCROLLLEFT], dd[SCROLLTOP]];
1325         }else if(db){
1326             return [db[SCROLLLEFT], db[SCROLLTOP]];
1327         }else{
1328             return [0, 0];
1329         }
1330     }
1331
1332     
1333     function getPageCoord (ev, xy) {
1334         ev = ev.browserEvent || ev;
1335         var coord  = ev['page' + xy];
1336         if (!coord && coord !== 0) {
1337             coord = ev['client' + xy] || 0;
1338
1339             if (Ext.isIE) {
1340                 coord += getScroll()[xy == "X" ? 0 : 1];
1341             }
1342         }
1343
1344         return coord;
1345     }
1346
1347     var pub =  {
1348         extAdapter: true,
1349         onAvailable : function(p_id, p_fn, p_obj, p_override) {
1350             onAvailStack.push({
1351                 id:         p_id,
1352                 fn:         p_fn,
1353                 obj:        p_obj,
1354                 override:   p_override,
1355                 checkReady: false });
1356
1357             retryCount = POLL_RETRYS;
1358             startInterval();
1359         },
1360
1361         
1362         addListener: function(el, eventName, fn) {
1363             el = Ext.getDom(el);
1364             if (el && fn) {
1365                 if (eventName == UNLOAD) {
1366                     if (unloadListeners[el.id] === undefined) {
1367                         unloadListeners[el.id] = [];
1368                     }
1369                     unloadListeners[el.id].push([eventName, fn]);
1370                     return fn;
1371                 }
1372                 return doAdd(el, eventName, fn, false);
1373             }
1374             return false;
1375         },
1376
1377         
1378         removeListener: function(el, eventName, fn) {
1379             el = Ext.getDom(el);
1380             var i, len, li, lis;
1381             if (el && fn) {
1382                 if(eventName == UNLOAD){
1383                     if((lis = unloadListeners[el.id]) !== undefined){
1384                         for(i = 0, len = lis.length; i < len; i++){
1385                             if((li = lis[i]) && li[TYPE] == eventName && li[FN] == fn){
1386                                 unloadListeners[el.id].splice(i, 1);
1387                             }
1388                         }
1389                     }
1390                     return;
1391                 }
1392                 doRemove(el, eventName, fn, false);
1393             }
1394         },
1395
1396         getTarget : function(ev) {
1397             ev = ev.browserEvent || ev;
1398             return this.resolveTextNode(ev.target || ev.srcElement);
1399         },
1400
1401         resolveTextNode : Ext.isGecko ? function(node){
1402             if(!node){
1403                 return;
1404             }
1405             
1406             var s = HTMLElement.prototype.toString.call(node);
1407             if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
1408                 return;
1409             }
1410             return node.nodeType == 3 ? node.parentNode : node;
1411         } : function(node){
1412             return node && node.nodeType == 3 ? node.parentNode : node;
1413         },
1414
1415         getRelatedTarget : function(ev) {
1416             ev = ev.browserEvent || ev;
1417             return this.resolveTextNode(ev.relatedTarget ||
1418                     (ev.type == MOUSEOUT ? ev.toElement :
1419                      ev.type == MOUSEOVER ? ev.fromElement : null));
1420         },
1421
1422         getPageX : function(ev) {
1423             return getPageCoord(ev, "X");
1424         },
1425
1426         getPageY : function(ev) {
1427             return getPageCoord(ev, "Y");
1428         },
1429
1430
1431         getXY : function(ev) {
1432             return [this.getPageX(ev), this.getPageY(ev)];
1433         },
1434
1435         stopEvent : function(ev) {
1436             this.stopPropagation(ev);
1437             this.preventDefault(ev);
1438         },
1439
1440         stopPropagation : function(ev) {
1441             ev = ev.browserEvent || ev;
1442             if (ev.stopPropagation) {
1443                 ev.stopPropagation();
1444             } else {
1445                 ev.cancelBubble = true;
1446             }
1447         },
1448
1449         preventDefault : function(ev) {
1450             ev = ev.browserEvent || ev;
1451             if (ev.preventDefault) {
1452                 ev.preventDefault();
1453             } else {
1454                 ev.returnValue = false;
1455             }
1456         },
1457
1458         getEvent : function(e) {
1459             e = e || win.event;
1460             if (!e) {
1461                 var c = this.getEvent.caller;
1462                 while (c) {
1463                     e = c.arguments[0];
1464                     if (e && Event == e.constructor) {
1465                         break;
1466                     }
1467                     c = c.caller;
1468                 }
1469             }
1470             return e;
1471         },
1472
1473         getCharCode : function(ev) {
1474             ev = ev.browserEvent || ev;
1475             return ev.charCode || ev.keyCode || 0;
1476         },
1477
1478         
1479         
1480         getListeners : function(el, eventName) {
1481             Ext.EventManager.getListeners(el, eventName);
1482         },
1483
1484         
1485         purgeElement : function(el, recurse, eventName) {
1486             Ext.EventManager.purgeElement(el, recurse, eventName);
1487         },
1488
1489         _load : function(e) {
1490             loadComplete = true;
1491             var EU = Ext.lib.Event;
1492             if (Ext.isIE && e !== true) {
1493         
1494         
1495                 doRemove(win, "load", arguments.callee);
1496             }
1497         },
1498
1499         _unload : function(e) {
1500              var EU = Ext.lib.Event,
1501                 i, j, l, v, ul, id, len, index, scope;
1502
1503
1504             for (id in unloadListeners) {
1505                 ul = unloadListeners[id];
1506                 for (i = 0, len = ul.length; i < len; i++) {
1507                     v = ul[i];
1508                     if (v) {
1509                         try{
1510                             scope = v[ADJ_SCOPE] ? (v[ADJ_SCOPE] === true ? v[OBJ] : v[ADJ_SCOPE]) :  win;
1511                             v[FN].call(scope, EU.getEvent(e), v[OBJ]);
1512                         }catch(ex){}
1513                     }
1514                 }
1515             };
1516
1517             Ext.EventManager._unload();
1518
1519             doRemove(win, UNLOAD, EU._unload);
1520         }
1521     };
1522
1523     
1524     pub.on = pub.addListener;
1525     pub.un = pub.removeListener;
1526     if (doc && doc.body) {
1527         pub._load(true);
1528     } else {
1529         doAdd(win, "load", pub._load);
1530     }
1531     doAdd(win, UNLOAD, pub._unload);
1532     _tryPreloadAttach();
1533
1534     return pub;
1535 }();
1536
1537 Ext.lib.Ajax = function() {
1538     var activeX = ['MSXML2.XMLHTTP.3.0',
1539                    'MSXML2.XMLHTTP',
1540                    'Microsoft.XMLHTTP'],
1541         CONTENTTYPE = 'Content-Type';
1542
1543     
1544     function setHeader(o) {
1545         var conn = o.conn,
1546             prop;
1547
1548         function setTheHeaders(conn, headers){
1549             for (prop in headers) {
1550                 if (headers.hasOwnProperty(prop)) {
1551                     conn.setRequestHeader(prop, headers[prop]);
1552                 }
1553             }
1554         }
1555
1556         if (pub.defaultHeaders) {
1557             setTheHeaders(conn, pub.defaultHeaders);
1558         }
1559
1560         if (pub.headers) {
1561             setTheHeaders(conn, pub.headers);
1562             delete pub.headers;
1563         }
1564     }
1565
1566     
1567     function createExceptionObject(tId, callbackArg, isAbort, isTimeout) {
1568         return {
1569             tId : tId,
1570             status : isAbort ? -1 : 0,
1571             statusText : isAbort ? 'transaction aborted' : 'communication failure',
1572             isAbort: isAbort,
1573             isTimeout: isTimeout,
1574             argument : callbackArg
1575         };
1576     }
1577
1578     
1579     function initHeader(label, value) {
1580         (pub.headers = pub.headers || {})[label] = value;
1581     }
1582
1583     
1584     function createResponseObject(o, callbackArg) {
1585         var headerObj = {},
1586             headerStr,
1587             conn = o.conn,
1588             t,
1589             s,
1590             
1591             isBrokenStatus = conn.status == 1223;
1592
1593         try {
1594             headerStr = o.conn.getAllResponseHeaders();
1595             Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
1596                 t = v.indexOf(':');
1597                 if(t >= 0){
1598                     s = v.substr(0, t).toLowerCase();
1599                     if(v.charAt(t + 1) == ' '){
1600                         ++t;
1601                     }
1602                     headerObj[s] = v.substr(t + 1);
1603                 }
1604             });
1605         } catch(e) {}
1606
1607         return {
1608             tId : o.tId,
1609             
1610             status : isBrokenStatus ? 204 : conn.status,
1611             statusText : isBrokenStatus ? 'No Content' : conn.statusText,
1612             getResponseHeader : function(header){return headerObj[header.toLowerCase()];},
1613             getAllResponseHeaders : function(){return headerStr},
1614             responseText : conn.responseText,
1615             responseXML : conn.responseXML,
1616             argument : callbackArg
1617         };
1618     }
1619
1620     
1621     function releaseObject(o) {
1622         if (o.tId) {
1623             pub.conn[o.tId] = null;
1624         }
1625         o.conn = null;
1626         o = null;
1627     }
1628
1629     
1630     function handleTransactionResponse(o, callback, isAbort, isTimeout) {
1631         if (!callback) {
1632             releaseObject(o);
1633             return;
1634         }
1635
1636         var httpStatus, responseObject;
1637
1638         try {
1639             if (o.conn.status !== undefined && o.conn.status != 0) {
1640                 httpStatus = o.conn.status;
1641             }
1642             else {
1643                 httpStatus = 13030;
1644             }
1645         }
1646         catch(e) {
1647             httpStatus = 13030;
1648         }
1649
1650         if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) {
1651             responseObject = createResponseObject(o, callback.argument);
1652             if (callback.success) {
1653                 if (!callback.scope) {
1654                     callback.success(responseObject);
1655                 }
1656                 else {
1657                     callback.success.apply(callback.scope, [responseObject]);
1658                 }
1659             }
1660         }
1661         else {
1662             switch (httpStatus) {
1663                 case 12002:
1664                 case 12029:
1665                 case 12030:
1666                 case 12031:
1667                 case 12152:
1668                 case 13030:
1669                     responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout);
1670                     if (callback.failure) {
1671                         if (!callback.scope) {
1672                             callback.failure(responseObject);
1673                         }
1674                         else {
1675                             callback.failure.apply(callback.scope, [responseObject]);
1676                         }
1677                     }
1678                     break;
1679                 default:
1680                     responseObject = createResponseObject(o, callback.argument);
1681                     if (callback.failure) {
1682                         if (!callback.scope) {
1683                             callback.failure(responseObject);
1684                         }
1685                         else {
1686                             callback.failure.apply(callback.scope, [responseObject]);
1687                         }
1688                     }
1689             }
1690         }
1691
1692         releaseObject(o);
1693         responseObject = null;
1694     }
1695
1696     
1697     function handleReadyState(o, callback){
1698     callback = callback || {};
1699         var conn = o.conn,
1700             tId = o.tId,
1701             poll = pub.poll,
1702             cbTimeout = callback.timeout || null;
1703
1704         if (cbTimeout) {
1705             pub.conn[tId] = conn;
1706             pub.timeout[tId] = setTimeout(function() {
1707                 pub.abort(o, callback, true);
1708             }, cbTimeout);
1709         }
1710
1711         poll[tId] = setInterval(
1712             function() {
1713                 if (conn && conn.readyState == 4) {
1714                     clearInterval(poll[tId]);
1715                     poll[tId] = null;
1716
1717                     if (cbTimeout) {
1718                         clearTimeout(pub.timeout[tId]);
1719                         pub.timeout[tId] = null;
1720                     }
1721
1722                     handleTransactionResponse(o, callback);
1723                 }
1724             },
1725             pub.pollInterval);
1726     }
1727
1728     
1729     function asyncRequest(method, uri, callback, postData) {
1730         var o = getConnectionObject() || null;
1731
1732         if (o) {
1733             o.conn.open(method, uri, true);
1734
1735             if (pub.useDefaultXhrHeader) {
1736                 initHeader('X-Requested-With', pub.defaultXhrHeader);
1737             }
1738
1739             if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers[CONTENTTYPE])){
1740                 initHeader(CONTENTTYPE, pub.defaultPostHeader);
1741             }
1742
1743             if (pub.defaultHeaders || pub.headers) {
1744                 setHeader(o);
1745             }
1746
1747             handleReadyState(o, callback);
1748             o.conn.send(postData || null);
1749         }
1750         return o;
1751     }
1752
1753     
1754     function getConnectionObject() {
1755         var o;
1756
1757         try {
1758             if (o = createXhrObject(pub.transactionId)) {
1759                 pub.transactionId++;
1760             }
1761         } catch(e) {
1762         } finally {
1763             return o;
1764         }
1765     }
1766
1767     
1768     function createXhrObject(transactionId) {
1769         var http;
1770
1771         try {
1772             http = new XMLHttpRequest();
1773         } catch(e) {
1774             for (var i = 0; i < activeX.length; ++i) {
1775                 try {
1776                     http = new ActiveXObject(activeX[i]);
1777                     break;
1778                 } catch(e) {}
1779             }
1780         } finally {
1781             return {conn : http, tId : transactionId};
1782         }
1783     }
1784
1785     var pub = {
1786         request : function(method, uri, cb, data, options) {
1787             if(options){
1788                 var me = this,
1789                     xmlData = options.xmlData,
1790                     jsonData = options.jsonData,
1791                     hs;
1792
1793                 Ext.applyIf(me, options);
1794
1795                 if(xmlData || jsonData){
1796                     hs = me.headers;
1797                     if(!hs || !hs[CONTENTTYPE]){
1798                         initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');
1799                     }
1800                     data = xmlData || (!Ext.isPrimitive(jsonData) ? Ext.encode(jsonData) : jsonData);
1801                 }
1802             }
1803             return asyncRequest(method || options.method || "POST", uri, cb, data);
1804         },
1805
1806         serializeForm : function(form) {
1807             var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
1808                 hasSubmit = false,
1809                 encoder = encodeURIComponent,
1810                 element,
1811                 options,
1812                 name,
1813                 val,
1814                 data = '',
1815                 type;
1816
1817             Ext.each(fElements, function(element) {
1818                 name = element.name;
1819                 type = element.type;
1820
1821                 if (!element.disabled && name){
1822                     if(/select-(one|multiple)/i.test(type)) {
1823                         Ext.each(element.options, function(opt) {
1824                             if (opt.selected) {
1825                                 data += String.format("{0}={1}&", encoder(name), encoder((opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttribute('value') !== null) ? opt.value : opt.text));
1826                             }
1827                         });
1828                     } else if(!/file|undefined|reset|button/i.test(type)) {
1829                             if(!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)){
1830
1831                                 data += encoder(name) + '=' + encoder(element.value) + '&';
1832                                 hasSubmit = /submit/i.test(type);
1833                             }
1834                     }
1835                 }
1836             });
1837             return data.substr(0, data.length - 1);
1838         },
1839
1840         useDefaultHeader : true,
1841         defaultPostHeader : 'application/x-www-form-urlencoded; charset=UTF-8',
1842         useDefaultXhrHeader : true,
1843         defaultXhrHeader : 'XMLHttpRequest',
1844         poll : {},
1845         timeout : {},
1846         conn: {},
1847         pollInterval : 50,
1848         transactionId : 0,
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877         abort : function(o, callback, isTimeout) {
1878             var me = this,
1879                 tId = o.tId,
1880                 isAbort = false;
1881
1882             if (me.isCallInProgress(o)) {
1883                 o.conn.abort();
1884                 clearInterval(me.poll[tId]);
1885                 me.poll[tId] = null;
1886                 clearTimeout(pub.timeout[tId]);
1887                 me.timeout[tId] = null;
1888
1889                 handleTransactionResponse(o, callback, (isAbort = true), isTimeout);
1890             }
1891             return isAbort;
1892         },
1893
1894         isCallInProgress : function(o) {
1895             
1896             return o.conn && !{0:true,4:true}[o.conn.readyState];
1897         }
1898     };
1899     return pub;
1900 }();    Ext.lib.Region = function(t, r, b, l) {
1901                 var me = this;
1902         me.top = t;
1903         me[1] = t;
1904         me.right = r;
1905         me.bottom = b;
1906         me.left = l;
1907         me[0] = l;
1908     };
1909
1910     Ext.lib.Region.prototype = {
1911         contains : function(region) {
1912                 var me = this;
1913             return ( region.left >= me.left &&
1914                      region.right <= me.right &&
1915                      region.top >= me.top &&
1916                      region.bottom <= me.bottom );
1917
1918         },
1919
1920         getArea : function() {
1921                 var me = this;
1922             return ( (me.bottom - me.top) * (me.right - me.left) );
1923         },
1924
1925         intersect : function(region) {
1926             var me = this,
1927                 t = Math.max(me.top, region.top),
1928                 r = Math.min(me.right, region.right),
1929                 b = Math.min(me.bottom, region.bottom),
1930                 l = Math.max(me.left, region.left);
1931
1932             if (b >= t && r >= l) {
1933                 return new Ext.lib.Region(t, r, b, l);
1934             }
1935         },
1936         
1937         union : function(region) {
1938                 var me = this,
1939                 t = Math.min(me.top, region.top),
1940                 r = Math.max(me.right, region.right),
1941                 b = Math.max(me.bottom, region.bottom),
1942                 l = Math.min(me.left, region.left);
1943
1944             return new Ext.lib.Region(t, r, b, l);
1945         },
1946
1947         constrainTo : function(r) {
1948                 var me = this;
1949             me.top = me.top.constrain(r.top, r.bottom);
1950             me.bottom = me.bottom.constrain(r.top, r.bottom);
1951             me.left = me.left.constrain(r.left, r.right);
1952             me.right = me.right.constrain(r.left, r.right);
1953             return me;
1954         },
1955
1956         adjust : function(t, l, b, r) {
1957                 var me = this;
1958             me.top += t;
1959             me.left += l;
1960             me.right += r;
1961             me.bottom += b;
1962             return me;
1963         }
1964     };
1965
1966     Ext.lib.Region.getRegion = function(el) {
1967         var p = Ext.lib.Dom.getXY(el),
1968                 t = p[1],
1969                 r = p[0] + el.offsetWidth,
1970                 b = p[1] + el.offsetHeight,
1971                 l = p[0];
1972
1973         return new Ext.lib.Region(t, r, b, l);
1974     };  Ext.lib.Point = function(x, y) {
1975         if (Ext.isArray(x)) {
1976             y = x[1];
1977             x = x[0];
1978         }
1979         var me = this;
1980         me.x = me.right = me.left = me[0] = x;
1981         me.y = me.top = me.bottom = me[1] = y;
1982     };
1983
1984     Ext.lib.Point.prototype = new Ext.lib.Region();
1985 (function(){
1986     var EXTLIB = Ext.lib,
1987         noNegatives = /width|height|opacity|padding/i,
1988         offsetAttribute = /^((width|height)|(top|left))$/,
1989         defaultUnit = /width|height|top$|bottom$|left$|right$/i,
1990         offsetUnit =  /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i,
1991         isset = function(v){
1992             return typeof v !== 'undefined';
1993         },
1994         now = function(){
1995             return new Date();
1996         };
1997
1998     EXTLIB.Anim = {
1999         motion : function(el, args, duration, easing, cb, scope) {
2000             return this.run(el, args, duration, easing, cb, scope, Ext.lib.Motion);
2001         },
2002
2003         run : function(el, args, duration, easing, cb, scope, type) {
2004             type = type || Ext.lib.AnimBase;
2005             if (typeof easing == "string") {
2006                 easing = Ext.lib.Easing[easing];
2007             }
2008             var anim = new type(el, args, duration, easing);
2009             anim.animateX(function() {
2010                 if(Ext.isFunction(cb)){
2011                     cb.call(scope);
2012                 }
2013             });
2014             return anim;
2015         }
2016     };
2017
2018     EXTLIB.AnimBase = function(el, attributes, duration, method) {
2019         if (el) {
2020             this.init(el, attributes, duration, method);
2021         }
2022     };
2023
2024     EXTLIB.AnimBase.prototype = {
2025         doMethod: function(attr, start, end) {
2026             var me = this;
2027             return me.method(me.curFrame, start, end - start, me.totalFrames);
2028         },
2029
2030
2031         setAttr: function(attr, val, unit) {
2032             if (noNegatives.test(attr) && val < 0) {
2033                 val = 0;
2034             }
2035             Ext.fly(this.el, '_anim').setStyle(attr, val + unit);
2036         },
2037
2038
2039         getAttr: function(attr) {
2040             var el = Ext.fly(this.el),
2041                 val = el.getStyle(attr),
2042                 a = offsetAttribute.exec(attr) || [];
2043
2044             if (val !== 'auto' && !offsetUnit.test(val)) {
2045                 return parseFloat(val);
2046             }
2047
2048             return (!!(a[2]) || (el.getStyle('position') == 'absolute' && !!(a[3]))) ? el.dom['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)] : 0;
2049         },
2050
2051
2052         getDefaultUnit: function(attr) {
2053             return defaultUnit.test(attr) ? 'px' : '';
2054         },
2055
2056         animateX : function(callback, scope) {
2057             var me = this,
2058                 f = function() {
2059                 me.onComplete.removeListener(f);
2060                 if (Ext.isFunction(callback)) {
2061                     callback.call(scope || me, me);
2062                 }
2063             };
2064             me.onComplete.addListener(f, me);
2065             me.animate();
2066         },
2067
2068
2069         setRunAttr: function(attr) {
2070             var me = this,
2071                 a = this.attributes[attr],
2072                 to = a.to,
2073                 by = a.by,
2074                 from = a.from,
2075                 unit = a.unit,
2076                 ra = (this.runAttrs[attr] = {}),
2077                 end;
2078
2079             if (!isset(to) && !isset(by)){
2080                 return false;
2081             }
2082
2083             var start = isset(from) ? from : me.getAttr(attr);
2084             if (isset(to)) {
2085                 end = to;
2086             }else if(isset(by)) {
2087                 if (Ext.isArray(start)){
2088                     end = [];
2089                     for(var i=0,len=start.length; i<len; i++) {
2090                         end[i] = start[i] + by[i];
2091                     }
2092                 }else{
2093                     end = start + by;
2094                 }
2095             }
2096
2097             Ext.apply(ra, {
2098                 start: start,
2099                 end: end,
2100                 unit: isset(unit) ? unit : me.getDefaultUnit(attr)
2101             });
2102         },
2103
2104
2105         init: function(el, attributes, duration, method) {
2106             var me = this,
2107                 actualFrames = 0,
2108                 mgr = EXTLIB.AnimMgr;
2109
2110             Ext.apply(me, {
2111                 isAnimated: false,
2112                 startTime: null,
2113                 el: Ext.getDom(el),
2114                 attributes: attributes || {},
2115                 duration: duration || 1,
2116                 method: method || EXTLIB.Easing.easeNone,
2117                 useSec: true,
2118                 curFrame: 0,
2119                 totalFrames: mgr.fps,
2120                 runAttrs: {},
2121                 animate: function(){
2122                     var me = this,
2123                         d = me.duration;
2124
2125                     if(me.isAnimated){
2126                         return false;
2127                     }
2128
2129                     me.curFrame = 0;
2130                     me.totalFrames = me.useSec ? Math.ceil(mgr.fps * d) : d;
2131                     mgr.registerElement(me);
2132                 },
2133
2134                 stop: function(finish){
2135                     var me = this;
2136
2137                     if(finish){
2138                         me.curFrame = me.totalFrames;
2139                         me._onTween.fire();
2140                     }
2141                     mgr.stop(me);
2142                 }
2143             });
2144
2145             var onStart = function(){
2146                 var me = this,
2147                     attr;
2148
2149                 me.onStart.fire();
2150                 me.runAttrs = {};
2151                 for(attr in this.attributes){
2152                     this.setRunAttr(attr);
2153                 }
2154
2155                 me.isAnimated = true;
2156                 me.startTime = now();
2157                 actualFrames = 0;
2158             };
2159
2160
2161             var onTween = function(){
2162                 var me = this;
2163
2164                 me.onTween.fire({
2165                     duration: now() - me.startTime,
2166                     curFrame: me.curFrame
2167                 });
2168
2169                 var ra = me.runAttrs;
2170                 for (var attr in ra) {
2171                     this.setAttr(attr, me.doMethod(attr, ra[attr].start, ra[attr].end), ra[attr].unit);
2172                 }
2173
2174                 ++actualFrames;
2175             };
2176
2177             var onComplete = function() {
2178                 var me = this,
2179                     actual = (now() - me.startTime) / 1000,
2180                     data = {
2181                         duration: actual,
2182                         frames: actualFrames,
2183                         fps: actualFrames / actual
2184                     };
2185
2186                 me.isAnimated = false;
2187                 actualFrames = 0;
2188                 me.onComplete.fire(data);
2189             };
2190
2191             me.onStart = new Ext.util.Event(me);
2192             me.onTween = new Ext.util.Event(me);
2193             me.onComplete = new Ext.util.Event(me);
2194             (me._onStart = new Ext.util.Event(me)).addListener(onStart);
2195             (me._onTween = new Ext.util.Event(me)).addListener(onTween);
2196             (me._onComplete = new Ext.util.Event(me)).addListener(onComplete);
2197         }
2198     };
2199
2200
2201     Ext.lib.AnimMgr = new function() {
2202         var me = this,
2203             thread = null,
2204             queue = [],
2205             tweenCount = 0;
2206
2207
2208         Ext.apply(me, {
2209             fps: 1000,
2210             delay: 1,
2211             registerElement: function(tween){
2212                 queue.push(tween);
2213                 ++tweenCount;
2214                 tween._onStart.fire();
2215                 me.start();
2216             },
2217
2218             unRegister: function(tween, index){
2219                 tween._onComplete.fire();
2220                 index = index || getIndex(tween);
2221                 if (index != -1) {
2222                     queue.splice(index, 1);
2223                 }
2224
2225                 if (--tweenCount <= 0) {
2226                     me.stop();
2227                 }
2228             },
2229
2230             start: function(){
2231                 if(thread === null){
2232                     thread = setInterval(me.run, me.delay);
2233                 }
2234             },
2235
2236             stop: function(tween){
2237                 if(!tween){
2238                     clearInterval(thread);
2239                     for(var i = 0, len = queue.length; i < len; ++i){
2240                         if(queue[0].isAnimated){
2241                             me.unRegister(queue[0], 0);
2242                         }
2243                     }
2244
2245                     queue = [];
2246                     thread = null;
2247                     tweenCount = 0;
2248                 }else{
2249                     me.unRegister(tween);
2250                 }
2251             },
2252
2253             run: function(){
2254                 var tf, i, len, tween;
2255                 for(i = 0, len = queue.length; i<len; i++) {
2256                     tween = queue[i];
2257                     if(tween && tween.isAnimated){
2258                         tf = tween.totalFrames;
2259                         if(tween.curFrame < tf || tf === null){
2260                             ++tween.curFrame;
2261                             if(tween.useSec){
2262                                 correctFrame(tween);
2263                             }
2264                             tween._onTween.fire();
2265                         }else{
2266                             me.stop(tween);
2267                         }
2268                     }
2269                 }
2270             }
2271         });
2272
2273         var getIndex = function(anim) {
2274             var i, len;
2275             for(i = 0, len = queue.length; i<len; i++) {
2276                 if(queue[i] === anim) {
2277                     return i;
2278                 }
2279             }
2280             return -1;
2281         };
2282
2283         var correctFrame = function(tween) {
2284             var frames = tween.totalFrames,
2285                 frame = tween.curFrame,
2286                 duration = tween.duration,
2287                 expected = (frame * duration * 1000 / frames),
2288                 elapsed = (now() - tween.startTime),
2289                 tweak = 0;
2290
2291             if(elapsed < duration * 1000){
2292                 tweak = Math.round((elapsed / expected - 1) * frame);
2293             }else{
2294                 tweak = frames - (frame + 1);
2295             }
2296             if(tweak > 0 && isFinite(tweak)){
2297                 if(tween.curFrame + tweak >= frames){
2298                     tweak = frames - (frame + 1);
2299                 }
2300                 tween.curFrame += tweak;
2301             }
2302         };
2303     };
2304
2305     EXTLIB.Bezier = new function() {
2306
2307         this.getPosition = function(points, t) {
2308             var n = points.length,
2309                 tmp = [],
2310                 c = 1 - t,
2311                 i,
2312                 j;
2313
2314             for (i = 0; i < n; ++i) {
2315                 tmp[i] = [points[i][0], points[i][1]];
2316             }
2317
2318             for (j = 1; j < n; ++j) {
2319                 for (i = 0; i < n - j; ++i) {
2320                     tmp[i][0] = c * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
2321                     tmp[i][1] = c * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
2322                 }
2323             }
2324
2325             return [ tmp[0][0], tmp[0][1] ];
2326
2327         };
2328     };
2329
2330
2331     EXTLIB.Easing = {
2332         easeNone: function (t, b, c, d) {
2333             return c * t / d + b;
2334         },
2335
2336
2337         easeIn: function (t, b, c, d) {
2338             return c * (t /= d) * t + b;
2339         },
2340
2341
2342         easeOut: function (t, b, c, d) {
2343             return -c * (t /= d) * (t - 2) + b;
2344         }
2345     };
2346
2347     (function() {
2348         EXTLIB.Motion = function(el, attributes, duration, method) {
2349             if (el) {
2350                 EXTLIB.Motion.superclass.constructor.call(this, el, attributes, duration, method);
2351             }
2352         };
2353
2354         Ext.extend(EXTLIB.Motion, Ext.lib.AnimBase);
2355
2356         var superclass = EXTLIB.Motion.superclass,
2357             proto = EXTLIB.Motion.prototype,
2358             pointsRe = /^points$/i;
2359
2360         Ext.apply(EXTLIB.Motion.prototype, {
2361             setAttr: function(attr, val, unit){
2362                 var me = this,
2363                     setAttr = superclass.setAttr;
2364
2365                 if (pointsRe.test(attr)) {
2366                     unit = unit || 'px';
2367                     setAttr.call(me, 'left', val[0], unit);
2368                     setAttr.call(me, 'top', val[1], unit);
2369                 } else {
2370                     setAttr.call(me, attr, val, unit);
2371                 }
2372             },
2373
2374             getAttr: function(attr){
2375                 var me = this,
2376                     getAttr = superclass.getAttr;
2377
2378                 return pointsRe.test(attr) ? [getAttr.call(me, 'left'), getAttr.call(me, 'top')] : getAttr.call(me, attr);
2379             },
2380
2381             doMethod: function(attr, start, end){
2382                 var me = this;
2383
2384                 return pointsRe.test(attr)
2385                         ? EXTLIB.Bezier.getPosition(me.runAttrs[attr], me.method(me.curFrame, 0, 100, me.totalFrames) / 100)
2386                         : superclass.doMethod.call(me, attr, start, end);
2387             },
2388
2389             setRunAttr: function(attr){
2390                 if(pointsRe.test(attr)){
2391
2392                     var me = this,
2393                         el = this.el,
2394                         points = this.attributes.points,
2395                         control = points.control || [],
2396                         from = points.from,
2397                         to = points.to,
2398                         by = points.by,
2399                         DOM = EXTLIB.Dom,
2400                         start,
2401                         i,
2402                         end,
2403                         len,
2404                         ra;
2405
2406
2407                     if(control.length > 0 && !Ext.isArray(control[0])){
2408                         control = [control];
2409                     }else{
2410                         
2411                     }
2412
2413                     Ext.fly(el, '_anim').position();
2414                     DOM.setXY(el, isset(from) ? from : DOM.getXY(el));
2415                     start = me.getAttr('points');
2416
2417
2418                     if(isset(to)){
2419                         end = translateValues.call(me, to, start);
2420                         for (i = 0,len = control.length; i < len; ++i) {
2421                             control[i] = translateValues.call(me, control[i], start);
2422                         }
2423                     } else if (isset(by)) {
2424                         end = [start[0] + by[0], start[1] + by[1]];
2425
2426                         for (i = 0,len = control.length; i < len; ++i) {
2427                             control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
2428                         }
2429                     }
2430
2431                     ra = this.runAttrs[attr] = [start];
2432                     if (control.length > 0) {
2433                         ra = ra.concat(control);
2434                     }
2435
2436                     ra[ra.length] = end;
2437                 }else{
2438                     superclass.setRunAttr.call(this, attr);
2439                 }
2440             }
2441         });
2442
2443         var translateValues = function(val, start) {
2444             var pageXY = EXTLIB.Dom.getXY(this.el);
2445             return [val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1]];
2446         };
2447     })();
2448 })();
2449 (function(){
2450     
2451     var abs = Math.abs,
2452         pi = Math.PI,
2453         asin = Math.asin,
2454         pow = Math.pow,
2455         sin = Math.sin,
2456         EXTLIB = Ext.lib;
2457
2458     Ext.apply(EXTLIB.Easing, {
2459
2460         easeBoth: function (t, b, c, d) {
2461             return ((t /= d / 2) < 1)  ?  c / 2 * t * t + b  :  -c / 2 * ((--t) * (t - 2) - 1) + b;
2462         },
2463
2464         easeInStrong: function (t, b, c, d) {
2465             return c * (t /= d) * t * t * t + b;
2466         },
2467
2468         easeOutStrong: function (t, b, c, d) {
2469             return -c * ((t = t / d - 1) * t * t * t - 1) + b;
2470         },
2471
2472         easeBothStrong: function (t, b, c, d) {
2473             return ((t /= d / 2) < 1)  ?  c / 2 * t * t * t * t + b  :  -c / 2 * ((t -= 2) * t * t * t - 2) + b;
2474         },
2475
2476         elasticIn: function (t, b, c, d, a, p) {
2477             if (t == 0 || (t /= d) == 1) {
2478                 return t == 0 ? b : b + c;
2479             }
2480             p = p || (d * .3);
2481
2482             var s;
2483             if (a >= abs(c)) {
2484                 s = p / (2 * pi) * asin(c / a);
2485             } else {
2486                 a = c;
2487                 s = p / 4;
2488             }
2489
2490             return -(a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b;
2491
2492         },
2493
2494         elasticOut: function (t, b, c, d, a, p) {
2495             if (t == 0 || (t /= d) == 1) {
2496                 return t == 0 ? b : b + c;
2497             }
2498             p = p || (d * .3);
2499
2500             var s;
2501             if (a >= abs(c)) {
2502                 s = p / (2 * pi) * asin(c / a);
2503             } else {
2504                 a = c;
2505                 s = p / 4;
2506             }
2507
2508             return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b;
2509         },
2510
2511         elasticBoth: function (t, b, c, d, a, p) {
2512             if (t == 0 || (t /= d / 2) == 2) {
2513                 return t == 0 ? b : b + c;
2514             }
2515
2516             p = p || (d * (.3 * 1.5));
2517
2518             var s;
2519             if (a >= abs(c)) {
2520                 s = p / (2 * pi) * asin(c / a);
2521             } else {
2522                 a = c;
2523                 s = p / 4;
2524             }
2525
2526             return t < 1 ?
2527                     -.5 * (a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b :
2528                     a * pow(2, -10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p) * .5 + c + b;
2529         },
2530
2531         backIn: function (t, b, c, d, s) {
2532             s = s ||  1.70158;
2533             return c * (t /= d) * t * ((s + 1) * t - s) + b;
2534         },
2535
2536
2537         backOut: function (t, b, c, d, s) {
2538             if (!s) {
2539                 s = 1.70158;
2540             }
2541             return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
2542         },
2543
2544
2545         backBoth: function (t, b, c, d, s) {
2546             s = s || 1.70158;
2547
2548             return ((t /= d / 2 ) < 1) ?
2549                     c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b :
2550                     c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
2551         },
2552
2553
2554         bounceIn: function (t, b, c, d) {
2555             return c - EXTLIB.Easing.bounceOut(d - t, 0, c, d) + b;
2556         },
2557
2558
2559         bounceOut: function (t, b, c, d) {
2560         if ((t /= d) < (1 / 2.75)) {
2561                 return c * (7.5625 * t * t) + b;
2562             } else if (t < (2 / 2.75)) {
2563                 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
2564             } else if (t < (2.5 / 2.75)) {
2565                 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
2566             }
2567             return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
2568         },
2569
2570
2571         bounceBoth: function (t, b, c, d) {
2572             return (t < d / 2) ?
2573                     EXTLIB.Easing.bounceIn(t * 2, 0, c, d) * .5 + b :
2574                     EXTLIB.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
2575         }
2576     });
2577 })();
2578
2579 (function() {
2580     var EXTLIB = Ext.lib;
2581     
2582     EXTLIB.Anim.color = function(el, args, duration, easing, cb, scope) {
2583         return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.ColorAnim);
2584     }
2585
2586     EXTLIB.ColorAnim = function(el, attributes, duration, method) {
2587         EXTLIB.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
2588     };
2589
2590     Ext.extend(EXTLIB.ColorAnim, EXTLIB.AnimBase);
2591
2592     var superclass = EXTLIB.ColorAnim.superclass,
2593         colorRE = /color$/i,
2594         transparentRE = /^transparent|rgba\(0, 0, 0, 0\)$/,
2595         rgbRE = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,
2596         hexRE= /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
2597         hex3RE = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i,
2598         isset = function(v){
2599             return typeof v !== 'undefined';
2600         };
2601
2602     
2603     function parseColor(s) {
2604         var pi = parseInt,
2605             base,
2606             out = null,
2607             c;
2608
2609         if (s.length == 3) {
2610             return s;
2611         }
2612
2613         Ext.each([hexRE, rgbRE, hex3RE], function(re, idx){
2614             base = (idx % 2 == 0) ? 16 : 10;
2615             c = re.exec(s);
2616             if(c && c.length == 4){
2617                 out = [pi(c[1], base), pi(c[2], base), pi(c[3], base)];
2618                 return false;
2619             }
2620         });
2621         return out;
2622     }
2623
2624     Ext.apply(EXTLIB.ColorAnim.prototype, {
2625         getAttr : function(attr) {
2626             var me = this,
2627                 el = me.el,
2628                 val;
2629             if(colorRE.test(attr)){
2630                 while(el && transparentRE.test(val = Ext.fly(el).getStyle(attr))){
2631                     el = el.parentNode;
2632                     val = "fff";
2633                 }
2634             }else{
2635                 val = superclass.getAttr.call(me, attr);
2636             }
2637             return val;
2638         },
2639
2640         doMethod : function(attr, start, end) {
2641             var me = this,
2642                 val,
2643                 floor = Math.floor,
2644                 i,
2645                 len,
2646                 v;
2647
2648             if(colorRE.test(attr)){
2649                 val = [];
2650                 end = end || [];
2651
2652                 for(i = 0, len = start.length; i < len; i++) {
2653                     v = start[i];
2654                     val[i] = superclass.doMethod.call(me, attr, v, end[i]);
2655                 }
2656                 val = 'rgb(' + floor(val[0]) + ',' + floor(val[1]) + ',' + floor(val[2]) + ')';
2657             }else{
2658                 val = superclass.doMethod.call(me, attr, start, end);
2659             }
2660             return val;
2661         },
2662
2663         setRunAttr : function(attr) {
2664             var me = this,
2665                 a = me.attributes[attr],
2666                 to = a.to,
2667                 by = a.by,
2668                 ra;
2669
2670             superclass.setRunAttr.call(me, attr);
2671             ra = me.runAttrs[attr];
2672             if(colorRE.test(attr)){
2673                 var start = parseColor(ra.start),
2674                     end = parseColor(ra.end);
2675
2676                 if(!isset(to) && isset(by)){
2677                     end = parseColor(by);
2678                     for(var i=0,len=start.length; i<len; i++) {
2679                         end[i] = start[i] + end[i];
2680                     }
2681                 }
2682                 ra.start = start;
2683                 ra.end = end;
2684             }
2685         }
2686     });
2687 })();
2688
2689
2690 (function() {
2691     
2692     var EXTLIB = Ext.lib;
2693     EXTLIB.Anim.scroll = function(el, args, duration, easing, cb, scope) {
2694         return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.Scroll);
2695     };
2696
2697     EXTLIB.Scroll = function(el, attributes, duration, method) {
2698         if(el){
2699             EXTLIB.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
2700         }
2701     };
2702
2703     Ext.extend(EXTLIB.Scroll, EXTLIB.ColorAnim);
2704
2705     var superclass = EXTLIB.Scroll.superclass,
2706         SCROLL = 'scroll';
2707
2708     Ext.apply(EXTLIB.Scroll.prototype, {
2709
2710         doMethod : function(attr, start, end) {
2711             var val,
2712                 me = this,
2713                 curFrame = me.curFrame,
2714                 totalFrames = me.totalFrames;
2715
2716             if(attr == SCROLL){
2717                 val = [me.method(curFrame, start[0], end[0] - start[0], totalFrames),
2718                        me.method(curFrame, start[1], end[1] - start[1], totalFrames)];
2719             }else{
2720                 val = superclass.doMethod.call(me, attr, start, end);
2721             }
2722             return val;
2723         },
2724
2725         getAttr : function(attr) {
2726             var me = this;
2727
2728             if (attr == SCROLL) {
2729                 return [me.el.scrollLeft, me.el.scrollTop];
2730             }else{
2731                 return superclass.getAttr.call(me, attr);
2732             }
2733         },
2734
2735         setAttr : function(attr, val, unit) {
2736             var me = this;
2737
2738             if(attr == SCROLL){
2739                 me.el.scrollLeft = val[0];
2740                 me.el.scrollTop = val[1];
2741             }else{
2742                 superclass.setAttr.call(me, attr, val, unit);
2743             }
2744         }
2745     });
2746 })();   
2747         if(Ext.isIE) {
2748         function fnCleanUp() {
2749             var p = Function.prototype;
2750             delete p.createSequence;
2751             delete p.defer;
2752             delete p.createDelegate;
2753             delete p.createCallback;
2754             delete p.createInterceptor;
2755
2756             window.detachEvent("onunload", fnCleanUp);
2757         }
2758         window.attachEvent("onunload", fnCleanUp);
2759     }
2760 })();