source: trunk/web/addons/job_monarch/lib/extjs-2/ext-core-debug.js @ 647

Last change on this file since 647 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 171.3 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9
10Ext.DomHelper = function(){
11    var tempTableEl = null;
12    var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;
13    var tableRe = /^table|tbody|tr|td$/i;
14
15    // build as innerHTML where available
16    var createHtml = function(o){
17        if(typeof o == 'string'){
18            return o;
19        }
20        var b = "";
21        if (Ext.isArray(o)) {
22            for (var i = 0, l = o.length; i < l; i++) {
23                b += createHtml(o[i]);
24            }
25            return b;
26        }
27        if(!o.tag){
28            o.tag = "div";
29        }
30        b += "<" + o.tag;
31        for(var attr in o){
32            if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;
33            if(attr == "style"){
34                var s = o["style"];
35                if(typeof s == "function"){
36                    s = s.call();
37                }
38                if(typeof s == "string"){
39                    b += ' style="' + s + '"';
40                }else if(typeof s == "object"){
41                    b += ' style="';
42                    for(var key in s){
43                        if(typeof s[key] != "function"){
44                            b += key + ":" + s[key] + ";";
45                        }
46                    }
47                    b += '"';
48                }
49            }else{
50                if(attr == "cls"){
51                    b += ' class="' + o["cls"] + '"';
52                }else if(attr == "htmlFor"){
53                    b += ' for="' + o["htmlFor"] + '"';
54                }else{
55                    b += " " + attr + '="' + o[attr] + '"';
56                }
57            }
58        }
59        if(emptyTags.test(o.tag)){
60            b += "/>";
61        }else{
62            b += ">";
63            var cn = o.children || o.cn;
64            if(cn){
65                b += createHtml(cn);
66            } else if(o.html){
67                b += o.html;
68            }
69            b += "</" + o.tag + ">";
70        }
71        return b;
72    };
73
74    // build as dom
75   
76    var createDom = function(o, parentNode){
77        var el;
78        if (Ext.isArray(o)) {                       // Allow Arrays of siblings to be inserted
79            el = document.createDocumentFragment(); // in one shot using a DocumentFragment
80            for(var i = 0, l = o.length; i < l; i++) {
81                createDom(o[i], el);
82            }
83        } else if (typeof o == "string") {         // Allow a string as a child spec.
84            el = document.createTextNode(o);
85        } else {
86            el = document.createElement(o.tag||'div');
87            var useSet = !!el.setAttribute; // In IE some elements don't have setAttribute
88            for(var attr in o){
89                if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;
90                if(attr=="cls"){
91                    el.className = o["cls"];
92                }else{
93                    if(useSet) el.setAttribute(attr, o[attr]);
94                    else el[attr] = o[attr];
95                }
96            }
97            Ext.DomHelper.applyStyles(el, o.style);
98            var cn = o.children || o.cn;
99            if(cn){
100                createDom(cn, el);
101            } else if(o.html){
102                el.innerHTML = o.html;
103            }
104        }
105        if(parentNode){
106           parentNode.appendChild(el);
107        }
108        return el;
109    };
110
111    var ieTable = function(depth, s, h, e){
112        tempTableEl.innerHTML = [s, h, e].join('');
113        var i = -1, el = tempTableEl;
114        while(++i < depth){
115            el = el.firstChild;
116        }
117        return el;
118    };
119
120    // kill repeat to save bytes
121    var ts = '<table>',
122        te = '</table>',
123        tbs = ts+'<tbody>',
124        tbe = '</tbody>'+te,
125        trs = tbs + '<tr>',
126        tre = '</tr>'+tbe;
127
128   
129    var insertIntoTable = function(tag, where, el, html){
130        if(!tempTableEl){
131            tempTableEl = document.createElement('div');
132        }
133        var node;
134        var before = null;
135        if(tag == 'td'){
136            if(where == 'afterbegin' || where == 'beforeend'){ // INTO a TD
137                return;
138            }
139            if(where == 'beforebegin'){
140                before = el;
141                el = el.parentNode;
142            } else{
143                before = el.nextSibling;
144                el = el.parentNode;
145            }
146            node = ieTable(4, trs, html, tre);
147        }
148        else if(tag == 'tr'){
149            if(where == 'beforebegin'){
150                before = el;
151                el = el.parentNode;
152                node = ieTable(3, tbs, html, tbe);
153            } else if(where == 'afterend'){
154                before = el.nextSibling;
155                el = el.parentNode;
156                node = ieTable(3, tbs, html, tbe);
157            } else{ // INTO a TR
158                if(where == 'afterbegin'){
159                    before = el.firstChild;
160                }
161                node = ieTable(4, trs, html, tre);
162            }
163        } else if(tag == 'tbody'){
164            if(where == 'beforebegin'){
165                before = el;
166                el = el.parentNode;
167                node = ieTable(2, ts, html, te);
168            } else if(where == 'afterend'){
169                before = el.nextSibling;
170                el = el.parentNode;
171                node = ieTable(2, ts, html, te);
172            } else{
173                if(where == 'afterbegin'){
174                    before = el.firstChild;
175                }
176                node = ieTable(3, tbs, html, tbe);
177            }
178        } else{ // TABLE
179            if(where == 'beforebegin' || where == 'afterend'){ // OUTSIDE the table
180                return;
181            }
182            if(where == 'afterbegin'){
183                before = el.firstChild;
184            }
185            node = ieTable(2, ts, html, te);
186        }
187        el.insertBefore(node, before);
188        return node;
189    };
190
191
192    return {
193   
194    useDom : false,
195
196   
197    markup : function(o){
198        return createHtml(o);
199    },
200
201   
202    applyStyles : function(el, styles){
203        if(styles){
204           el = Ext.fly(el);
205           if(typeof styles == "string"){
206               var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
207               var matches;
208               while ((matches = re.exec(styles)) != null){
209                   el.setStyle(matches[1], matches[2]);
210               }
211           }else if (typeof styles == "object"){
212               for (var style in styles){
213                  el.setStyle(style, styles[style]);
214               }
215           }else if (typeof styles == "function"){
216                Ext.DomHelper.applyStyles(el, styles.call());
217           }
218        }
219    },
220
221   
222    insertHtml : function(where, el, html){
223        where = where.toLowerCase();
224        if(el.insertAdjacentHTML){
225            if(tableRe.test(el.tagName)){
226                var rs;
227                if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){
228                    return rs;
229                }
230            }
231            switch(where){
232                case "beforebegin":
233                    el.insertAdjacentHTML('BeforeBegin', html);
234                    return el.previousSibling;
235                case "afterbegin":
236                    el.insertAdjacentHTML('AfterBegin', html);
237                    return el.firstChild;
238                case "beforeend":
239                    el.insertAdjacentHTML('BeforeEnd', html);
240                    return el.lastChild;
241                case "afterend":
242                    el.insertAdjacentHTML('AfterEnd', html);
243                    return el.nextSibling;
244            }
245            throw 'Illegal insertion point -> "' + where + '"';
246        }
247        var range = el.ownerDocument.createRange();
248        var frag;
249        switch(where){
250             case "beforebegin":
251                range.setStartBefore(el);
252                frag = range.createContextualFragment(html);
253                el.parentNode.insertBefore(frag, el);
254                return el.previousSibling;
255             case "afterbegin":
256                if(el.firstChild){
257                    range.setStartBefore(el.firstChild);
258                    frag = range.createContextualFragment(html);
259                    el.insertBefore(frag, el.firstChild);
260                    return el.firstChild;
261                }else{
262                    el.innerHTML = html;
263                    return el.firstChild;
264                }
265            case "beforeend":
266                if(el.lastChild){
267                    range.setStartAfter(el.lastChild);
268                    frag = range.createContextualFragment(html);
269                    el.appendChild(frag);
270                    return el.lastChild;
271                }else{
272                    el.innerHTML = html;
273                    return el.lastChild;
274                }
275            case "afterend":
276                range.setStartAfter(el);
277                frag = range.createContextualFragment(html);
278                el.parentNode.insertBefore(frag, el.nextSibling);
279                return el.nextSibling;
280            }
281            throw 'Illegal insertion point -> "' + where + '"';
282    },
283
284   
285    insertBefore : function(el, o, returnElement){
286        return this.doInsert(el, o, returnElement, "beforeBegin");
287    },
288
289   
290    insertAfter : function(el, o, returnElement){
291        return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");
292    },
293
294   
295    insertFirst : function(el, o, returnElement){
296        return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");
297    },
298
299    // private
300    doInsert : function(el, o, returnElement, pos, sibling){
301        el = Ext.getDom(el);
302        var newNode;
303        if(this.useDom){
304            newNode = createDom(o, null);
305            (sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);
306        }else{
307            var html = createHtml(o);
308            newNode = this.insertHtml(pos, el, html);
309        }
310        return returnElement ? Ext.get(newNode, true) : newNode;
311    },
312
313   
314    append : function(el, o, returnElement){
315        el = Ext.getDom(el);
316        var newNode;
317        if(this.useDom){
318            newNode = createDom(o, null);
319            el.appendChild(newNode);
320        }else{
321            var html = createHtml(o);
322            newNode = this.insertHtml("beforeEnd", el, html);
323        }
324        return returnElement ? Ext.get(newNode, true) : newNode;
325    },
326
327   
328    overwrite : function(el, o, returnElement){
329        el = Ext.getDom(el);
330        el.innerHTML = createHtml(o);
331        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
332    },
333
334   
335    createTemplate : function(o){
336        var html = createHtml(o);
337        return new Ext.Template(html);
338    }
339    };
340}();
341
342
343Ext.Template = function(html){
344    var a = arguments;
345    if(Ext.isArray(html)){
346        html = html.join("");
347    }else if(a.length > 1){
348        var buf = [];
349        for(var i = 0, len = a.length; i < len; i++){
350            if(typeof a[i] == 'object'){
351                Ext.apply(this, a[i]);
352            }else{
353                buf[buf.length] = a[i];
354            }
355        }
356        html = buf.join('');
357    }
358   
359    this.html = html;
360    if(this.compiled){
361        this.compile();
362    }
363};
364Ext.Template.prototype = {
365   
366    applyTemplate : function(values){
367        if(this.compiled){
368            return this.compiled(values);
369        }
370        var useF = this.disableFormats !== true;
371        var fm = Ext.util.Format, tpl = this;
372        var fn = function(m, name, format, args){
373            if(format && useF){
374                if(format.substr(0, 5) == "this."){
375                    return tpl.call(format.substr(5), values[name], values);
376                }else{
377                    if(args){
378                        // quoted values are required for strings in compiled templates,
379                        // but for non compiled we need to strip them
380                        // quoted reversed for jsmin
381                        var re = /^\s*['"](.*)["']\s*$/;
382                        args = args.split(',');
383                        for(var i = 0, len = args.length; i < len; i++){
384                            args[i] = args[i].replace(re, "$1");
385                        }
386                        args = [values[name]].concat(args);
387                    }else{
388                        args = [values[name]];
389                    }
390                    return fm[format].apply(fm, args);
391                }
392            }else{
393                return values[name] !== undefined ? values[name] : "";
394            }
395        };
396        return this.html.replace(this.re, fn);
397    },
398
399   
400    set : function(html, compile){
401        this.html = html;
402        this.compiled = null;
403        if(compile){
404            this.compile();
405        }
406        return this;
407    },
408
409   
410    disableFormats : false,
411
412   
413    re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
414
415   
416    compile : function(){
417        var fm = Ext.util.Format;
418        var useF = this.disableFormats !== true;
419        var sep = Ext.isGecko ? "+" : ",";
420        var fn = function(m, name, format, args){
421            if(format && useF){
422                args = args ? ',' + args : "";
423                if(format.substr(0, 5) != "this."){
424                    format = "fm." + format + '(';
425                }else{
426                    format = 'this.call("'+ format.substr(5) + '", ';
427                    args = ", values";
428                }
429            }else{
430                args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
431            }
432            return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
433        };
434        var body;
435        // branched to use + in gecko and [].join() in others
436        if(Ext.isGecko){
437            body = "this.compiled = function(values){ return '" +
438                   this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
439                    "';};";
440        }else{
441            body = ["this.compiled = function(values){ return ['"];
442            body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
443            body.push("'].join('');};");
444            body = body.join('');
445        }
446        eval(body);
447        return this;
448    },
449
450    // private function used to call members
451    call : function(fnName, value, allValues){
452        return this[fnName](value, allValues);
453    },
454
455   
456    insertFirst: function(el, values, returnElement){
457        return this.doInsert('afterBegin', el, values, returnElement);
458    },
459
460   
461    insertBefore: function(el, values, returnElement){
462        return this.doInsert('beforeBegin', el, values, returnElement);
463    },
464
465   
466    insertAfter : function(el, values, returnElement){
467        return this.doInsert('afterEnd', el, values, returnElement);
468    },
469
470   
471    append : function(el, values, returnElement){
472        return this.doInsert('beforeEnd', el, values, returnElement);
473    },
474
475    doInsert : function(where, el, values, returnEl){
476        el = Ext.getDom(el);
477        var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
478        return returnEl ? Ext.get(newNode, true) : newNode;
479    },
480
481   
482    overwrite : function(el, values, returnElement){
483        el = Ext.getDom(el);
484        el.innerHTML = this.applyTemplate(values);
485        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
486    }
487};
488
489Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
490
491// backwards compat
492Ext.DomHelper.Template = Ext.Template;
493
494
495Ext.Template.from = function(el, config){
496    el = Ext.getDom(el);
497    return new Ext.Template(el.value || el.innerHTML, config || '');
498};
499
500
501Ext.DomQuery = function(){
502    var cache = {}, simpleCache = {}, valueCache = {};
503    var nonSpace = /\S/;
504    var trimRe = /^\s+|\s+$/g;
505    var tplRe = /\{(\d+)\}/g;
506    var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
507    var tagTokenRe = /^(#)?([\w-\*]+)/;
508    var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
509
510    function child(p, index){
511        var i = 0;
512        var n = p.firstChild;
513        while(n){
514            if(n.nodeType == 1){
515               if(++i == index){
516                   return n;
517               }
518            }
519            n = n.nextSibling;
520        }
521        return null;
522    };
523
524    function next(n){
525        while((n = n.nextSibling) && n.nodeType != 1);
526        return n;
527    };
528
529    function prev(n){
530        while((n = n.previousSibling) && n.nodeType != 1);
531        return n;
532    };
533
534    function children(d){
535        var n = d.firstChild, ni = -1;
536            while(n){
537                var nx = n.nextSibling;
538                if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
539                    d.removeChild(n);
540                }else{
541                    n.nodeIndex = ++ni;
542                }
543                n = nx;
544            }
545            return this;
546        };
547
548    function byClassName(c, a, v){
549        if(!v){
550            return c;
551        }
552        var r = [], ri = -1, cn;
553        for(var i = 0, ci; ci = c[i]; i++){
554            if((' '+ci.className+' ').indexOf(v) != -1){
555                r[++ri] = ci;
556            }
557        }
558        return r;
559    };
560
561    function attrValue(n, attr){
562        if(!n.tagName && typeof n.length != "undefined"){
563            n = n[0];
564        }
565        if(!n){
566            return null;
567        }
568        if(attr == "for"){
569            return n.htmlFor;
570        }
571        if(attr == "class" || attr == "className"){
572            return n.className;
573        }
574        return n.getAttribute(attr) || n[attr];
575
576    };
577
578    function getNodes(ns, mode, tagName){
579        var result = [], ri = -1, cs;
580        if(!ns){
581            return result;
582        }
583        tagName = tagName || "*";
584        if(typeof ns.getElementsByTagName != "undefined"){
585            ns = [ns];
586        }
587        if(!mode){
588            for(var i = 0, ni; ni = ns[i]; i++){
589                cs = ni.getElementsByTagName(tagName);
590                for(var j = 0, ci; ci = cs[j]; j++){
591                    result[++ri] = ci;
592                }
593            }
594        }else if(mode == "/" || mode == ">"){
595            var utag = tagName.toUpperCase();
596            for(var i = 0, ni, cn; ni = ns[i]; i++){
597                cn = ni.children || ni.childNodes;
598                for(var j = 0, cj; cj = cn[j]; j++){
599                    if(cj.nodeName == utag || cj.nodeName == tagName  || tagName == '*'){
600                        result[++ri] = cj;
601                    }
602                }
603            }
604        }else if(mode == "+"){
605            var utag = tagName.toUpperCase();
606            for(var i = 0, n; n = ns[i]; i++){
607                while((n = n.nextSibling) && n.nodeType != 1);
608                if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
609                    result[++ri] = n;
610                }
611            }
612        }else if(mode == "~"){
613            for(var i = 0, n; n = ns[i]; i++){
614                while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
615                if(n){
616                    result[++ri] = n;
617                }
618            }
619        }
620        return result;
621    };
622
623    function concat(a, b){
624        if(b.slice){
625            return a.concat(b);
626        }
627        for(var i = 0, l = b.length; i < l; i++){
628            a[a.length] = b[i];
629        }
630        return a;
631    }
632
633    function byTag(cs, tagName){
634        if(cs.tagName || cs == document){
635            cs = [cs];
636        }
637        if(!tagName){
638            return cs;
639        }
640        var r = [], ri = -1;
641        tagName = tagName.toLowerCase();
642        for(var i = 0, ci; ci = cs[i]; i++){
643            if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
644                r[++ri] = ci;
645            }
646        }
647        return r;
648    };
649
650    function byId(cs, attr, id){
651        if(cs.tagName || cs == document){
652            cs = [cs];
653        }
654        if(!id){
655            return cs;
656        }
657        var r = [], ri = -1;
658        for(var i = 0,ci; ci = cs[i]; i++){
659            if(ci && ci.id == id){
660                r[++ri] = ci;
661                return r;
662            }
663        }
664        return r;
665    };
666
667    function byAttribute(cs, attr, value, op, custom){
668        var r = [], ri = -1, st = custom=="{";
669        var f = Ext.DomQuery.operators[op];
670        for(var i = 0, ci; ci = cs[i]; i++){
671            var a;
672            if(st){
673                a = Ext.DomQuery.getStyle(ci, attr);
674            }
675            else if(attr == "class" || attr == "className"){
676                a = ci.className;
677            }else if(attr == "for"){
678                a = ci.htmlFor;
679            }else if(attr == "href"){
680                a = ci.getAttribute("href", 2);
681            }else{
682                a = ci.getAttribute(attr);
683            }
684            if((f && f(a, value)) || (!f && a)){
685                r[++ri] = ci;
686            }
687        }
688        return r;
689    };
690
691    function byPseudo(cs, name, value){
692        return Ext.DomQuery.pseudos[name](cs, value);
693    };
694
695    // This is for IE MSXML which does not support expandos.
696    // IE runs the same speed using setAttribute, however FF slows way down
697    // and Safari completely fails so they need to continue to use expandos.
698    var isIE = window.ActiveXObject ? true : false;
699
700    // this eval is stop the compressor from
701    // renaming the variable to something shorter
702    eval("var batch = 30803;");
703
704    var key = 30803;
705
706    function nodupIEXml(cs){
707        var d = ++key;
708        cs[0].setAttribute("_nodup", d);
709        var r = [cs[0]];
710        for(var i = 1, len = cs.length; i < len; i++){
711            var c = cs[i];
712            if(!c.getAttribute("_nodup") != d){
713                c.setAttribute("_nodup", d);
714                r[r.length] = c;
715            }
716        }
717        for(var i = 0, len = cs.length; i < len; i++){
718            cs[i].removeAttribute("_nodup");
719        }
720        return r;
721    }
722
723    function nodup(cs){
724        if(!cs){
725            return [];
726        }
727        var len = cs.length, c, i, r = cs, cj, ri = -1;
728        if(!len || typeof cs.nodeType != "undefined" || len == 1){
729            return cs;
730        }
731        if(isIE && typeof cs[0].selectSingleNode != "undefined"){
732            return nodupIEXml(cs);
733        }
734        var d = ++key;
735        cs[0]._nodup = d;
736        for(i = 1; c = cs[i]; i++){
737            if(c._nodup != d){
738                c._nodup = d;
739            }else{
740                r = [];
741                for(var j = 0; j < i; j++){
742                    r[++ri] = cs[j];
743                }
744                for(j = i+1; cj = cs[j]; j++){
745                    if(cj._nodup != d){
746                        cj._nodup = d;
747                        r[++ri] = cj;
748                    }
749                }
750                return r;
751            }
752        }
753        return r;
754    }
755
756    function quickDiffIEXml(c1, c2){
757        var d = ++key;
758        for(var i = 0, len = c1.length; i < len; i++){
759            c1[i].setAttribute("_qdiff", d);
760        }
761        var r = [];
762        for(var i = 0, len = c2.length; i < len; i++){
763            if(c2[i].getAttribute("_qdiff") != d){
764                r[r.length] = c2[i];
765            }
766        }
767        for(var i = 0, len = c1.length; i < len; i++){
768           c1[i].removeAttribute("_qdiff");
769        }
770        return r;
771    }
772
773    function quickDiff(c1, c2){
774        var len1 = c1.length;
775        if(!len1){
776            return c2;
777        }
778        if(isIE && c1[0].selectSingleNode){
779            return quickDiffIEXml(c1, c2);
780        }
781        var d = ++key;
782        for(var i = 0; i < len1; i++){
783            c1[i]._qdiff = d;
784        }
785        var r = [];
786        for(var i = 0, len = c2.length; i < len; i++){
787            if(c2[i]._qdiff != d){
788                r[r.length] = c2[i];
789            }
790        }
791        return r;
792    }
793
794    function quickId(ns, mode, root, id){
795        if(ns == root){
796           var d = root.ownerDocument || root;
797           return d.getElementById(id);
798        }
799        ns = getNodes(ns, mode, "*");
800        return byId(ns, null, id);
801    }
802
803    return {
804        getStyle : function(el, name){
805            return Ext.fly(el).getStyle(name);
806        },
807       
808        compile : function(path, type){
809            type = type || "select";
810
811            var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
812            var q = path, mode, lq;
813            var tk = Ext.DomQuery.matchers;
814            var tklen = tk.length;
815            var mm;
816
817            // accept leading mode switch
818            var lmode = q.match(modeRe);
819            if(lmode && lmode[1]){
820                fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
821                q = q.replace(lmode[1], "");
822            }
823            // strip leading slashes
824            while(path.substr(0, 1)=="/"){
825                path = path.substr(1);
826            }
827
828            while(q && lq != q){
829                lq = q;
830                var tm = q.match(tagTokenRe);
831                if(type == "select"){
832                    if(tm){
833                        if(tm[1] == "#"){
834                            fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
835                        }else{
836                            fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
837                        }
838                        q = q.replace(tm[0], "");
839                    }else if(q.substr(0, 1) != '@'){
840                        fn[fn.length] = 'n = getNodes(n, mode, "*");';
841                    }
842                }else{
843                    if(tm){
844                        if(tm[1] == "#"){
845                            fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
846                        }else{
847                            fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
848                        }
849                        q = q.replace(tm[0], "");
850                    }
851                }
852                while(!(mm = q.match(modeRe))){
853                    var matched = false;
854                    for(var j = 0; j < tklen; j++){
855                        var t = tk[j];
856                        var m = q.match(t.re);
857                        if(m){
858                            fn[fn.length] = t.select.replace(tplRe, function(x, i){
859                                                    return m[i];
860                                                });
861                            q = q.replace(m[0], "");
862                            matched = true;
863                            break;
864                        }
865                    }
866                    // prevent infinite loop on bad selector
867                    if(!matched){
868                        throw 'Error parsing selector, parsing failed at "' + q + '"';
869                    }
870                }
871                if(mm[1]){
872                    fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
873                    q = q.replace(mm[1], "");
874                }
875            }
876            fn[fn.length] = "return nodup(n);\n}";
877            eval(fn.join(""));
878            return f;
879        },
880
881       
882        select : function(path, root, type){
883            if(!root || root == document){
884                root = document;
885            }
886            if(typeof root == "string"){
887                root = document.getElementById(root);
888            }
889            var paths = path.split(",");
890            var results = [];
891            for(var i = 0, len = paths.length; i < len; i++){
892                var p = paths[i].replace(trimRe, "");
893                if(!cache[p]){
894                    cache[p] = Ext.DomQuery.compile(p);
895                    if(!cache[p]){
896                        throw p + " is not a valid selector";
897                    }
898                }
899                var result = cache[p](root);
900                if(result && result != document){
901                    results = results.concat(result);
902                }
903            }
904            if(paths.length > 1){
905                return nodup(results);
906            }
907            return results;
908        },
909
910       
911        selectNode : function(path, root){
912            return Ext.DomQuery.select(path, root)[0];
913        },
914
915       
916        selectValue : function(path, root, defaultValue){
917            path = path.replace(trimRe, "");
918            if(!valueCache[path]){
919                valueCache[path] = Ext.DomQuery.compile(path, "select");
920            }
921            var n = valueCache[path](root);
922            n = n[0] ? n[0] : n;
923            var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
924            return ((v === null||v === undefined||v==='') ? defaultValue : v);
925        },
926
927       
928        selectNumber : function(path, root, defaultValue){
929            var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
930            return parseFloat(v);
931        },
932
933       
934        is : function(el, ss){
935            if(typeof el == "string"){
936                el = document.getElementById(el);
937            }
938            var isArray = Ext.isArray(el);
939            var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
940            return isArray ? (result.length == el.length) : (result.length > 0);
941        },
942
943       
944        filter : function(els, ss, nonMatches){
945            ss = ss.replace(trimRe, "");
946            if(!simpleCache[ss]){
947                simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
948            }
949            var result = simpleCache[ss](els);
950            return nonMatches ? quickDiff(result, els) : result;
951        },
952
953       
954        matchers : [{
955                re: /^\.([\w-]+)/,
956                select: 'n = byClassName(n, null, " {1} ");'
957            }, {
958                re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
959                select: 'n = byPseudo(n, "{1}", "{2}");'
960            },{
961                re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
962                select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
963            }, {
964                re: /^#([\w-]+)/,
965                select: 'n = byId(n, null, "{1}");'
966            },{
967                re: /^@([\w-]+)/,
968                select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
969            }
970        ],
971
972       
973        operators : {
974            "=" : function(a, v){
975                return a == v;
976            },
977            "!=" : function(a, v){
978                return a != v;
979            },
980            "^=" : function(a, v){
981                return a && a.substr(0, v.length) == v;
982            },
983            "$=" : function(a, v){
984                return a && a.substr(a.length-v.length) == v;
985            },
986            "*=" : function(a, v){
987                return a && a.indexOf(v) !== -1;
988            },
989            "%=" : function(a, v){
990                return (a % v) == 0;
991            },
992            "|=" : function(a, v){
993                return a && (a == v || a.substr(0, v.length+1) == v+'-');
994            },
995            "~=" : function(a, v){
996                return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
997            }
998        },
999
1000       
1001        pseudos : {
1002            "first-child" : function(c){
1003                var r = [], ri = -1, n;
1004                for(var i = 0, ci; ci = n = c[i]; i++){
1005                    while((n = n.previousSibling) && n.nodeType != 1);
1006                    if(!n){
1007                        r[++ri] = ci;
1008                    }
1009                }
1010                return r;
1011            },
1012
1013            "last-child" : function(c){
1014                var r = [], ri = -1, n;
1015                for(var i = 0, ci; ci = n = c[i]; i++){
1016                    while((n = n.nextSibling) && n.nodeType != 1);
1017                    if(!n){
1018                        r[++ri] = ci;
1019                    }
1020                }
1021                return r;
1022            },
1023
1024            "nth-child" : function(c, a) {
1025                var r = [], ri = -1;
1026                var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
1027                var f = (m[1] || 1) - 0, l = m[2] - 0;
1028                for(var i = 0, n; n = c[i]; i++){
1029                    var pn = n.parentNode;
1030                    if (batch != pn._batch) {
1031                        var j = 0;
1032                        for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
1033                            if(cn.nodeType == 1){
1034                               cn.nodeIndex = ++j;
1035                            }
1036                        }
1037                        pn._batch = batch;
1038                    }
1039                    if (f == 1) {
1040                        if (l == 0 || n.nodeIndex == l){
1041                            r[++ri] = n;
1042                        }
1043                    } else if ((n.nodeIndex + l) % f == 0){
1044                        r[++ri] = n;
1045                    }
1046                }
1047
1048                return r;
1049            },
1050
1051            "only-child" : function(c){
1052                var r = [], ri = -1;;
1053                for(var i = 0, ci; ci = c[i]; i++){
1054                    if(!prev(ci) && !next(ci)){
1055                        r[++ri] = ci;
1056                    }
1057                }
1058                return r;
1059            },
1060
1061            "empty" : function(c){
1062                var r = [], ri = -1;
1063                for(var i = 0, ci; ci = c[i]; i++){
1064                    var cns = ci.childNodes, j = 0, cn, empty = true;
1065                    while(cn = cns[j]){
1066                        ++j;
1067                        if(cn.nodeType == 1 || cn.nodeType == 3){
1068                            empty = false;
1069                            break;
1070                        }
1071                    }
1072                    if(empty){
1073                        r[++ri] = ci;
1074                    }
1075                }
1076                return r;
1077            },
1078
1079            "contains" : function(c, v){
1080                var r = [], ri = -1;
1081                for(var i = 0, ci; ci = c[i]; i++){
1082                    if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
1083                        r[++ri] = ci;
1084                    }
1085                }
1086                return r;
1087            },
1088
1089            "nodeValue" : function(c, v){
1090                var r = [], ri = -1;
1091                for(var i = 0, ci; ci = c[i]; i++){
1092                    if(ci.firstChild && ci.firstChild.nodeValue == v){
1093                        r[++ri] = ci;
1094                    }
1095                }
1096                return r;
1097            },
1098
1099            "checked" : function(c){
1100                var r = [], ri = -1;
1101                for(var i = 0, ci; ci = c[i]; i++){
1102                    if(ci.checked == true){
1103                        r[++ri] = ci;
1104                    }
1105                }
1106                return r;
1107            },
1108
1109            "not" : function(c, ss){
1110                return Ext.DomQuery.filter(c, ss, true);
1111            },
1112
1113            "any" : function(c, selectors){
1114                var ss = selectors.split('|');
1115                var r = [], ri = -1, s;
1116                for(var i = 0, ci; ci = c[i]; i++){
1117                    for(var j = 0; s = ss[j]; j++){
1118                        if(Ext.DomQuery.is(ci, s)){
1119                            r[++ri] = ci;
1120                            break;
1121                        }
1122                    }
1123                }
1124                return r;
1125            },
1126
1127            "odd" : function(c){
1128                return this["nth-child"](c, "odd");
1129            },
1130
1131            "even" : function(c){
1132                return this["nth-child"](c, "even");
1133            },
1134
1135            "nth" : function(c, a){
1136                return c[a-1] || [];
1137            },
1138
1139            "first" : function(c){
1140                return c[0] || [];
1141            },
1142
1143            "last" : function(c){
1144                return c[c.length-1] || [];
1145            },
1146
1147            "has" : function(c, ss){
1148                var s = Ext.DomQuery.select;
1149                var r = [], ri = -1;
1150                for(var i = 0, ci; ci = c[i]; i++){
1151                    if(s(ss, ci).length > 0){
1152                        r[++ri] = ci;
1153                    }
1154                }
1155                return r;
1156            },
1157
1158            "next" : function(c, ss){
1159                var is = Ext.DomQuery.is;
1160                var r = [], ri = -1;
1161                for(var i = 0, ci; ci = c[i]; i++){
1162                    var n = next(ci);
1163                    if(n && is(n, ss)){
1164                        r[++ri] = ci;
1165                    }
1166                }
1167                return r;
1168            },
1169
1170            "prev" : function(c, ss){
1171                var is = Ext.DomQuery.is;
1172                var r = [], ri = -1;
1173                for(var i = 0, ci; ci = c[i]; i++){
1174                    var n = prev(ci);
1175                    if(n && is(n, ss)){
1176                        r[++ri] = ci;
1177                    }
1178                }
1179                return r;
1180            }
1181        }
1182    };
1183}();
1184
1185
1186Ext.query = Ext.DomQuery.select;
1187
1188
1189Ext.util.Observable = function(){
1190   
1191    if(this.listeners){
1192        this.on(this.listeners);
1193        delete this.listeners;
1194    }
1195};
1196Ext.util.Observable.prototype = {
1197   
1198    fireEvent : function(){
1199        if(this.eventsSuspended !== true){
1200            var ce = this.events[arguments[0].toLowerCase()];
1201            if(typeof ce == "object"){
1202                return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));
1203            }
1204        }
1205        return true;
1206    },
1207
1208    // private
1209    filterOptRe : /^(?:scope|delay|buffer|single)$/,
1210
1211   
1212    addListener : function(eventName, fn, scope, o){
1213        if(typeof eventName == "object"){
1214            o = eventName;
1215            for(var e in o){
1216                if(this.filterOptRe.test(e)){
1217                    continue;
1218                }
1219                if(typeof o[e] == "function"){
1220                    // shared options
1221                    this.addListener(e, o[e], o.scope,  o);
1222                }else{
1223                    // individual options
1224                    this.addListener(e, o[e].fn, o[e].scope, o[e]);
1225                }
1226            }
1227            return;
1228        }
1229        o = (!o || typeof o == "boolean") ? {} : o;
1230        eventName = eventName.toLowerCase();
1231        var ce = this.events[eventName] || true;
1232        if(typeof ce == "boolean"){
1233            ce = new Ext.util.Event(this, eventName);
1234            this.events[eventName] = ce;
1235        }
1236        ce.addListener(fn, scope, o);
1237    },
1238
1239   
1240    removeListener : function(eventName, fn, scope){
1241        var ce = this.events[eventName.toLowerCase()];
1242        if(typeof ce == "object"){
1243            ce.removeListener(fn, scope);
1244        }
1245    },
1246
1247   
1248    purgeListeners : function(){
1249        for(var evt in this.events){
1250            if(typeof this.events[evt] == "object"){
1251                 this.events[evt].clearListeners();
1252            }
1253        }
1254    },
1255
1256   
1257    relayEvents : function(o, events){
1258        var createHandler = function(ename){
1259            return function(){
1260                return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
1261            };
1262        };
1263        for(var i = 0, len = events.length; i < len; i++){
1264            var ename = events[i];
1265            if(!this.events[ename]){ this.events[ename] = true; };
1266            o.on(ename, createHandler(ename), this);
1267        }
1268    },
1269
1270   
1271    addEvents : function(o){
1272        if(!this.events){
1273            this.events = {};
1274        }
1275        if(typeof o == 'string'){
1276            for(var i = 0, a = arguments, v; v = a[i]; i++){
1277                if(!this.events[a[i]]){
1278                    this.events[a[i]] = true;
1279                }
1280            }
1281        }else{
1282            Ext.applyIf(this.events, o);
1283        }
1284    },
1285
1286   
1287    hasListener : function(eventName){
1288        var e = this.events[eventName];
1289        return typeof e == "object" && e.listeners.length > 0;
1290    },
1291
1292   
1293    suspendEvents : function(){
1294        this.eventsSuspended = true;
1295    },
1296
1297   
1298    resumeEvents : function(){
1299        this.eventsSuspended = false;
1300    },
1301
1302    // these are considered experimental
1303    // allows for easier interceptor and sequences, including cancelling and overwriting the return value of the call
1304    // private
1305    getMethodEvent : function(method){
1306        if(!this.methodEvents){
1307            this.methodEvents = {};
1308        }
1309        var e = this.methodEvents[method];
1310        if(!e){
1311            e = {};
1312            this.methodEvents[method] = e;
1313
1314            e.originalFn = this[method];
1315            e.methodName = method;
1316            e.before = [];
1317            e.after = [];
1318
1319
1320            var returnValue, v, cancel;
1321            var obj = this;
1322
1323            var makeCall = function(fn, scope, args){
1324                if((v = fn.apply(scope || obj, args)) !== undefined){
1325                    if(typeof v === 'object'){
1326                        if(v.returnValue !== undefined){
1327                            returnValue = v.returnValue;
1328                        }else{
1329                            returnValue = v;
1330                        }
1331                        if(v.cancel === true){
1332                            cancel = true;
1333                        }
1334                    }else if(v === false){
1335                        cancel = true;
1336                    }else {
1337                        returnValue = v;
1338                    }
1339                }
1340            }
1341
1342            this[method] = function(){
1343                returnValue = v = undefined; cancel = false;
1344                var args = Array.prototype.slice.call(arguments, 0);
1345                for(var i = 0, len = e.before.length; i < len; i++){
1346                    makeCall(e.before[i].fn, e.before[i].scope, args);
1347                    if(cancel){
1348                        return returnValue;
1349                    }
1350                }
1351
1352                if((v = e.originalFn.apply(obj, args)) !== undefined){
1353                    returnValue = v;
1354                }
1355
1356                for(var i = 0, len = e.after.length; i < len; i++){
1357                    makeCall(e.after[i].fn, e.after[i].scope, args);
1358                    if(cancel){
1359                        return returnValue;
1360                    }
1361                }
1362                return returnValue;
1363            };
1364        }
1365        return e;
1366    },
1367
1368    // adds an "interceptor" called before the original method
1369    beforeMethod : function(method, fn, scope){
1370        var e = this.getMethodEvent(method);
1371        e.before.push({fn: fn, scope: scope});
1372    },
1373
1374    // adds a "sequence" called after the original method
1375    afterMethod : function(method, fn, scope){
1376        var e = this.getMethodEvent(method);
1377        e.after.push({fn: fn, scope: scope});
1378    },
1379
1380    removeMethodListener : function(method, fn, scope){
1381        var e = this.getMethodEvent(method);
1382        for(var i = 0, len = e.before.length; i < len; i++){
1383            if(e.before[i].fn == fn && e.before[i].scope == scope){
1384                e.before.splice(i, 1);
1385                return;
1386            }
1387        }
1388        for(var i = 0, len = e.after.length; i < len; i++){
1389            if(e.after[i].fn == fn && e.after[i].scope == scope){
1390                e.after.splice(i, 1);
1391                return;
1392            }
1393        }
1394    }
1395};
1396
1397Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
1398
1399Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
1400
1401
1402Ext.util.Observable.capture = function(o, fn, scope){
1403    o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
1404};
1405
1406
1407Ext.util.Observable.releaseCapture = function(o){
1408    o.fireEvent = Ext.util.Observable.prototype.fireEvent;
1409};
1410
1411(function(){
1412
1413    var createBuffered = function(h, o, scope){
1414        var task = new Ext.util.DelayedTask();
1415        return function(){
1416            task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
1417        };
1418    };
1419
1420    var createSingle = function(h, e, fn, scope){
1421        return function(){
1422            e.removeListener(fn, scope);
1423            return h.apply(scope, arguments);
1424        };
1425    };
1426
1427    var createDelayed = function(h, o, scope){
1428        return function(){
1429            var args = Array.prototype.slice.call(arguments, 0);
1430            setTimeout(function(){
1431                h.apply(scope, args);
1432            }, o.delay || 10);
1433        };
1434    };
1435
1436    Ext.util.Event = function(obj, name){
1437        this.name = name;
1438        this.obj = obj;
1439        this.listeners = [];
1440    };
1441
1442    Ext.util.Event.prototype = {
1443        addListener : function(fn, scope, options){
1444            scope = scope || this.obj;
1445            if(!this.isListening(fn, scope)){
1446                var l = this.createListener(fn, scope, options);
1447                if(!this.firing){
1448                    this.listeners.push(l);
1449                }else{ // if we are currently firing this event, don't disturb the listener loop
1450                    this.listeners = this.listeners.slice(0);
1451                    this.listeners.push(l);
1452                }
1453            }
1454        },
1455
1456        createListener : function(fn, scope, o){
1457            o = o || {};
1458            scope = scope || this.obj;
1459            var l = {fn: fn, scope: scope, options: o};
1460            var h = fn;
1461            if(o.delay){
1462                h = createDelayed(h, o, scope);
1463            }
1464            if(o.single){
1465                h = createSingle(h, this, fn, scope);
1466            }
1467            if(o.buffer){
1468                h = createBuffered(h, o, scope);
1469            }
1470            l.fireFn = h;
1471            return l;
1472        },
1473
1474        findListener : function(fn, scope){
1475            scope = scope || this.obj;
1476            var ls = this.listeners;
1477            for(var i = 0, len = ls.length; i < len; i++){
1478                var l = ls[i];
1479                if(l.fn == fn && l.scope == scope){
1480                    return i;
1481                }
1482            }
1483            return -1;
1484        },
1485
1486        isListening : function(fn, scope){
1487            return this.findListener(fn, scope) != -1;
1488        },
1489
1490        removeListener : function(fn, scope){
1491            var index;
1492            if((index = this.findListener(fn, scope)) != -1){
1493                if(!this.firing){
1494                    this.listeners.splice(index, 1);
1495                }else{
1496                    this.listeners = this.listeners.slice(0);
1497                    this.listeners.splice(index, 1);
1498                }
1499                return true;
1500            }
1501            return false;
1502        },
1503
1504        clearListeners : function(){
1505            this.listeners = [];
1506        },
1507
1508        fire : function(){
1509            var ls = this.listeners, scope, len = ls.length;
1510            if(len > 0){
1511                this.firing = true;
1512                var args = Array.prototype.slice.call(arguments, 0);
1513                for(var i = 0; i < len; i++){
1514                    var l = ls[i];
1515                    if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
1516                        this.firing = false;
1517                        return false;
1518                    }
1519                }
1520                this.firing = false;
1521            }
1522            return true;
1523        }
1524    };
1525})();
1526
1527Ext.EventManager = function(){
1528    var docReadyEvent, docReadyProcId, docReadyState = false;
1529    var resizeEvent, resizeTask, textEvent, textSize;
1530    var E = Ext.lib.Event;
1531    var D = Ext.lib.Dom;
1532    // fix parser confusion
1533    var xname = 'Ex' + 't';
1534
1535    var elHash = {};
1536
1537    var addListener = function(el, ename, fn, wrap, scope){
1538        var id = Ext.id(el);
1539        if(!elHash[id]){
1540            elHash[id] = {};
1541        }
1542        var es = elHash[id];
1543        if(!es[ename]){
1544            es[ename] = [];
1545        }
1546        var ls = es[ename];
1547        ls.push({
1548            id: id,
1549            ename: ename,
1550            fn: fn,
1551            wrap: wrap,
1552            scope: scope
1553        });
1554
1555         E.on(el, ename, wrap);
1556
1557        if(ename == "mousewheel" && el.addEventListener){ // workaround for jQuery
1558            el.addEventListener("DOMMouseScroll", wrap, false);
1559            E.on(window, 'unload', function(){
1560                el.removeEventListener("DOMMouseScroll", wrap, false);
1561            });
1562        }
1563        if(ename == "mousedown" && el == document){ // fix stopped mousedowns on the document
1564            Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);
1565        }
1566    }
1567
1568    var removeListener = function(el, ename, fn, scope){
1569        el = Ext.getDom(el);
1570
1571        var id = Ext.id(el), es = elHash[id], wrap;
1572        if(es){
1573            var ls = es[ename], l;
1574            if(ls){
1575                for(var i = 0, len = ls.length; i < len; i++){
1576                    l = ls[i];
1577                    if(l.fn == fn && (!scope || l.scope == scope)){
1578                        wrap = l.wrap;
1579                        E.un(el, ename, wrap);
1580                        ls.splice(i, 1);
1581                        break;
1582                    }
1583                }
1584            }
1585        }
1586        if(ename == "mousewheel" && el.addEventListener && wrap){
1587            el.removeEventListener("DOMMouseScroll", wrap, false);
1588        }
1589        if(ename == "mousedown" && el == document && wrap){ // fix stopped mousedowns on the document
1590            Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
1591        }
1592    }
1593
1594    var removeAll = function(el){
1595        el = Ext.getDom(el);
1596        var id = Ext.id(el), es = elHash[id], ls;
1597        if(es){
1598            for(var ename in es){
1599                if(es.hasOwnProperty(ename)){
1600                    ls = es[ename];
1601                    for(var i = 0, len = ls.length; i < len; i++){
1602                        E.un(el, ename, ls[i].wrap);
1603                        ls[i] = null;
1604                    }
1605                }
1606                es[ename] = null;
1607            }
1608            delete elHash[id];
1609        }
1610    }
1611
1612
1613    var fireDocReady = function(){
1614        if(!docReadyState){
1615            docReadyState = true;
1616            Ext.isReady = true;
1617            if(docReadyProcId){
1618                clearInterval(docReadyProcId);
1619            }
1620            if(Ext.isGecko || Ext.isOpera) {
1621                document.removeEventListener("DOMContentLoaded", fireDocReady, false);
1622            }
1623            if(Ext.isIE){
1624                var defer = document.getElementById("ie-deferred-loader");
1625                if(defer){
1626                    defer.onreadystatechange = null;
1627                    defer.parentNode.removeChild(defer);
1628                }
1629            }
1630            if(docReadyEvent){
1631                docReadyEvent.fire();
1632                docReadyEvent.clearListeners();
1633            }
1634        }
1635    };
1636
1637    var initDocReady = function(){
1638        docReadyEvent = new Ext.util.Event();
1639        if(Ext.isGecko || Ext.isOpera) {
1640            document.addEventListener("DOMContentLoaded", fireDocReady, false);
1641        }else if(Ext.isIE){
1642            document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");
1643            var defer = document.getElementById("ie-deferred-loader");
1644            defer.onreadystatechange = function(){
1645                if(this.readyState == "complete"){
1646                    fireDocReady();
1647                }
1648            };
1649        }else if(Ext.isSafari){
1650            docReadyProcId = setInterval(function(){
1651                var rs = document.readyState;
1652                if(rs == "complete") {
1653                    fireDocReady();
1654                 }
1655            }, 10);
1656        }
1657        // no matter what, make sure it fires on load
1658        E.on(window, "load", fireDocReady);
1659    };
1660
1661    var createBuffered = function(h, o){
1662        var task = new Ext.util.DelayedTask(h);
1663        return function(e){
1664            // create new event object impl so new events don't wipe out properties
1665            e = new Ext.EventObjectImpl(e);
1666            task.delay(o.buffer, h, null, [e]);
1667        };
1668    };
1669
1670    var createSingle = function(h, el, ename, fn, scope){
1671        return function(e){
1672            Ext.EventManager.removeListener(el, ename, fn, scope);
1673            h(e);
1674        };
1675    };
1676
1677    var createDelayed = function(h, o){
1678        return function(e){
1679            // create new event object impl so new events don't wipe out properties
1680            e = new Ext.EventObjectImpl(e);
1681            setTimeout(function(){
1682                h(e);
1683            }, o.delay || 10);
1684        };
1685    };
1686
1687    var listen = function(element, ename, opt, fn, scope){
1688        var o = (!opt || typeof opt == "boolean") ? {} : opt;
1689        fn = fn || o.fn; scope = scope || o.scope;
1690        var el = Ext.getDom(element);
1691        if(!el){
1692            throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
1693        }
1694        var h = function(e){
1695            // prevent errors while unload occurring
1696            if(!window[xname]){
1697                return;
1698            }
1699            e = Ext.EventObject.setEvent(e);
1700            var t;
1701            if(o.delegate){
1702                t = e.getTarget(o.delegate, el);
1703                if(!t){
1704                    return;
1705                }
1706            }else{
1707                t = e.target;
1708            }
1709            if(o.stopEvent === true){
1710                e.stopEvent();
1711            }
1712            if(o.preventDefault === true){
1713               e.preventDefault();
1714            }
1715            if(o.stopPropagation === true){
1716                e.stopPropagation();
1717            }
1718
1719            if(o.normalized === false){
1720                e = e.browserEvent;
1721            }
1722
1723            fn.call(scope || el, e, t, o);
1724        };
1725        if(o.delay){
1726            h = createDelayed(h, o);
1727        }
1728        if(o.single){
1729            h = createSingle(h, el, ename, fn, scope);
1730        }
1731        if(o.buffer){
1732            h = createBuffered(h, o);
1733        }
1734
1735        addListener(el, ename, fn, h, scope);
1736        return h;
1737    };
1738
1739    var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
1740    var pub = {
1741
1742   
1743        addListener : function(element, eventName, fn, scope, options){
1744            if(typeof eventName == "object"){
1745                var o = eventName;
1746                for(var e in o){
1747                    if(propRe.test(e)){
1748                        continue;
1749                    }
1750                    if(typeof o[e] == "function"){
1751                        // shared options
1752                        listen(element, e, o, o[e], o.scope);
1753                    }else{
1754                        // individual options
1755                        listen(element, e, o[e]);
1756                    }
1757                }
1758                return;
1759            }
1760            return listen(element, eventName, options, fn, scope);
1761        },
1762
1763       
1764        removeListener : function(element, eventName, fn, scope){
1765            return removeListener(element, eventName, fn, scope);
1766        },
1767
1768       
1769        removeAll : function(element){
1770            return removeAll(element);
1771        },
1772
1773       
1774        onDocumentReady : function(fn, scope, options){
1775            if(docReadyState){ // if it already fired
1776                docReadyEvent.addListener(fn, scope, options);
1777                docReadyEvent.fire();
1778                docReadyEvent.clearListeners();
1779                return;
1780            }
1781            if(!docReadyEvent){
1782                initDocReady();
1783            }
1784            options = options || {};
1785            if(!options.delay){
1786                options.delay = 1;
1787            }
1788            docReadyEvent.addListener(fn, scope, options);
1789        },
1790       
1791        // private
1792        doResizeEvent: function(){
1793            resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1794        },
1795
1796       
1797        onWindowResize : function(fn, scope, options){
1798            if(!resizeEvent){
1799                resizeEvent = new Ext.util.Event();
1800                resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);
1801                E.on(window, "resize", this.fireWindowResize, this);
1802            }
1803            resizeEvent.addListener(fn, scope, options);
1804        },
1805
1806        // exposed only to allow manual firing
1807        fireWindowResize : function(){
1808            if(resizeEvent){
1809                if((Ext.isIE||Ext.isAir) && resizeTask){
1810                    resizeTask.delay(50);
1811                }else{
1812                    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1813                }
1814            }
1815        },
1816
1817       
1818        onTextResize : function(fn, scope, options){
1819            if(!textEvent){
1820                textEvent = new Ext.util.Event();
1821                var textEl = new Ext.Element(document.createElement('div'));
1822                textEl.dom.className = 'x-text-resize';
1823                textEl.dom.innerHTML = 'X';
1824                textEl.appendTo(document.body);
1825                textSize = textEl.dom.offsetHeight;
1826                setInterval(function(){
1827                    if(textEl.dom.offsetHeight != textSize){
1828                        textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
1829                    }
1830                }, this.textResizeInterval);
1831            }
1832            textEvent.addListener(fn, scope, options);
1833        },
1834
1835       
1836        removeResizeListener : function(fn, scope){
1837            if(resizeEvent){
1838                resizeEvent.removeListener(fn, scope);
1839            }
1840        },
1841
1842        // private
1843        fireResize : function(){
1844            if(resizeEvent){
1845                resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1846            }
1847        },
1848       
1849        ieDeferSrc : false,
1850       
1851        textResizeInterval : 50
1852    };
1853     
1854    pub.on = pub.addListener;
1855   
1856    pub.un = pub.removeListener;
1857
1858    pub.stoppedMouseDownEvent = new Ext.util.Event();
1859    return pub;
1860}();
1861
1862Ext.onReady = Ext.EventManager.onDocumentReady;
1863
1864
1865// Initialize doc classes
1866(function(){
1867    var initExtCss = function(){
1868        // find the body element
1869        var bd = document.body || document.getElementsByTagName('body')[0];
1870        if(!bd){ return false; }
1871        var cls = [' ',
1872                Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))
1873                : Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')
1874                : Ext.isOpera ? "ext-opera"
1875                : Ext.isSafari ? "ext-safari"
1876                : Ext.isChrome ? "ext-chrome" : ""];
1877
1878        if(Ext.isMac){
1879            cls.push("ext-mac");
1880        }
1881        if(Ext.isLinux){
1882            cls.push("ext-linux");
1883        }
1884        if(Ext.isBorderBox){
1885            cls.push('ext-border-box');
1886        }
1887        if(Ext.isStrict){ // add to the parent to allow for selectors like ".ext-strict .ext-ie"
1888            var p = bd.parentNode;
1889            if(p){
1890                p.className += ' ext-strict';
1891            }
1892        }
1893        bd.className += cls.join(' ');
1894        return true;
1895    }
1896
1897    if(!initExtCss()){
1898        Ext.onReady(initExtCss);
1899    }
1900})();
1901
1902
1903Ext.EventObject = function(){
1904
1905    var E = Ext.lib.Event;
1906
1907    // safari keypress events for special keys return bad keycodes
1908    var safariKeys = {
1909        3 : 13, // enter
1910        63234 : 37, // left
1911        63235 : 39, // right
1912        63232 : 38, // up
1913        63233 : 40, // down
1914        63276 : 33, // page up
1915        63277 : 34, // page down
1916        63272 : 46, // delete
1917        63273 : 36, // home
1918        63275 : 35  // end
1919    };
1920
1921    // normalize button clicks
1922    var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
1923                (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
1924
1925    Ext.EventObjectImpl = function(e){
1926        if(e){
1927            this.setEvent(e.browserEvent || e);
1928        }
1929    };
1930
1931    Ext.EventObjectImpl.prototype = {
1932       
1933        browserEvent : null,
1934       
1935        button : -1,
1936       
1937        shiftKey : false,
1938       
1939        ctrlKey : false,
1940       
1941        altKey : false,
1942
1943       
1944        BACKSPACE: 8,
1945       
1946        TAB: 9,
1947       
1948        NUM_CENTER: 12,
1949       
1950        ENTER: 13,
1951       
1952        RETURN: 13,
1953       
1954        SHIFT: 16,
1955       
1956        CTRL: 17,
1957        CONTROL : 17, // legacy
1958       
1959        ALT: 18,
1960       
1961        PAUSE: 19,
1962       
1963        CAPS_LOCK: 20,
1964       
1965        ESC: 27,
1966       
1967        SPACE: 32,
1968       
1969        PAGE_UP: 33,
1970        PAGEUP : 33, // legacy
1971       
1972        PAGE_DOWN: 34,
1973        PAGEDOWN : 34, // legacy
1974       
1975        END: 35,
1976       
1977        HOME: 36,
1978       
1979        LEFT: 37,
1980       
1981        UP: 38,
1982       
1983        RIGHT: 39,
1984       
1985        DOWN: 40,
1986       
1987        PRINT_SCREEN: 44,
1988       
1989        INSERT: 45,
1990       
1991        DELETE: 46,
1992       
1993        ZERO: 48,
1994       
1995        ONE: 49,
1996       
1997        TWO: 50,
1998       
1999        THREE: 51,
2000       
2001        FOUR: 52,
2002       
2003        FIVE: 53,
2004       
2005        SIX: 54,
2006       
2007        SEVEN: 55,
2008       
2009        EIGHT: 56,
2010       
2011        NINE: 57,
2012       
2013        A: 65,
2014       
2015        B: 66,
2016       
2017        C: 67,
2018       
2019        D: 68,
2020       
2021        E: 69,
2022       
2023        F: 70,
2024       
2025        G: 71,
2026       
2027        H: 72,
2028       
2029        I: 73,
2030       
2031        J: 74,
2032       
2033        K: 75,
2034       
2035        L: 76,
2036       
2037        M: 77,
2038       
2039        N: 78,
2040       
2041        O: 79,
2042       
2043        P: 80,
2044       
2045        Q: 81,
2046       
2047        R: 82,
2048       
2049        S: 83,
2050       
2051        T: 84,
2052       
2053        U: 85,
2054       
2055        V: 86,
2056       
2057        W: 87,
2058       
2059        X: 88,
2060       
2061        Y: 89,
2062       
2063        Z: 90,
2064       
2065        CONTEXT_MENU: 93,
2066       
2067        NUM_ZERO: 96,
2068       
2069        NUM_ONE: 97,
2070       
2071        NUM_TWO: 98,
2072       
2073        NUM_THREE: 99,
2074       
2075        NUM_FOUR: 100,
2076       
2077        NUM_FIVE: 101,
2078       
2079        NUM_SIX: 102,
2080       
2081        NUM_SEVEN: 103,
2082       
2083        NUM_EIGHT: 104,
2084       
2085        NUM_NINE: 105,
2086       
2087        NUM_MULTIPLY: 106,
2088       
2089        NUM_PLUS: 107,
2090       
2091        NUM_MINUS: 109,
2092       
2093        NUM_PERIOD: 110,
2094       
2095        NUM_DIVISION: 111,
2096       
2097        F1: 112,
2098       
2099        F2: 113,
2100       
2101        F3: 114,
2102       
2103        F4: 115,
2104       
2105        F5: 116,
2106       
2107        F6: 117,
2108       
2109        F7: 118,
2110       
2111        F8: 119,
2112       
2113        F9: 120,
2114       
2115        F10: 121,
2116       
2117        F11: 122,
2118       
2119        F12: 123,
2120
2121           
2122        setEvent : function(e){
2123            if(e == this || (e && e.browserEvent)){ // already wrapped
2124                return e;
2125            }
2126            this.browserEvent = e;
2127            if(e){
2128                // normalize buttons
2129                this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
2130                if(e.type == 'click' && this.button == -1){
2131                    this.button = 0;
2132                }
2133                this.type = e.type;
2134                this.shiftKey = e.shiftKey;
2135                // mac metaKey behaves like ctrlKey
2136                this.ctrlKey = e.ctrlKey || e.metaKey;
2137                this.altKey = e.altKey;
2138                // in getKey these will be normalized for the mac
2139                this.keyCode = e.keyCode;
2140                this.charCode = e.charCode;
2141                // cache the target for the delayed and or buffered events
2142                this.target = E.getTarget(e);
2143                // same for XY
2144                this.xy = E.getXY(e);
2145            }else{
2146                this.button = -1;
2147                this.shiftKey = false;
2148                this.ctrlKey = false;
2149                this.altKey = false;
2150                this.keyCode = 0;
2151                this.charCode = 0;
2152                this.target = null;
2153                this.xy = [0, 0];
2154            }
2155            return this;
2156        },
2157
2158       
2159        stopEvent : function(){
2160            if(this.browserEvent){
2161                if(this.browserEvent.type == 'mousedown'){
2162                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
2163                }
2164                E.stopEvent(this.browserEvent);
2165            }
2166        },
2167
2168       
2169        preventDefault : function(){
2170            if(this.browserEvent){
2171                E.preventDefault(this.browserEvent);
2172            }
2173        },
2174
2175       
2176        isNavKeyPress : function(){
2177            var k = this.keyCode;
2178            k = Ext.isSafari ? (safariKeys[k] || k) : k;
2179            return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
2180        },
2181
2182        isSpecialKey : function(){
2183            var k = this.keyCode;
2184            return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13  || k == 40 || k == 27 ||
2185            (k == 16) || (k == 17) ||
2186            (k >= 18 && k <= 20) ||
2187            (k >= 33 && k <= 35) ||
2188            (k >= 36 && k <= 39) ||
2189            (k >= 44 && k <= 45);
2190        },
2191
2192       
2193        stopPropagation : function(){
2194            if(this.browserEvent){
2195                if(this.browserEvent.type == 'mousedown'){
2196                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
2197                }
2198                E.stopPropagation(this.browserEvent);
2199            }
2200        },
2201
2202       
2203        getCharCode : function(){
2204            return this.charCode || this.keyCode;
2205        },
2206
2207       
2208        getKey : function(){
2209            var k = this.keyCode || this.charCode;
2210            return Ext.isSafari ? (safariKeys[k] || k) : k;
2211        },
2212
2213       
2214        getPageX : function(){
2215            return this.xy[0];
2216        },
2217
2218       
2219        getPageY : function(){
2220            return this.xy[1];
2221        },
2222
2223       
2224        getTime : function(){
2225            if(this.browserEvent){
2226                return E.getTime(this.browserEvent);
2227            }
2228            return null;
2229        },
2230
2231       
2232        getXY : function(){
2233            return this.xy;
2234        },
2235
2236       
2237        getTarget : function(selector, maxDepth, returnEl){
2238            return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
2239        },
2240
2241       
2242        getRelatedTarget : function(){
2243            if(this.browserEvent){
2244                return E.getRelatedTarget(this.browserEvent);
2245            }
2246            return null;
2247        },
2248
2249       
2250        getWheelDelta : function(){
2251            var e = this.browserEvent;
2252            var delta = 0;
2253            if(e.wheelDelta){ 
2254                delta = e.wheelDelta/120;
2255            }else if(e.detail){ 
2256                delta = -e.detail/3;
2257            }
2258            return delta;
2259        },
2260
2261       
2262        hasModifier : function(){
2263            return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;
2264        },
2265
2266       
2267        within : function(el, related, allowEl){
2268            var t = this[related ? "getRelatedTarget" : "getTarget"]();
2269            return t && ((allowEl ? (t === Ext.getDom(el)) : false) || Ext.fly(el).contains(t));
2270        },
2271
2272        getPoint : function(){
2273            return new Ext.lib.Point(this.xy[0], this.xy[1]);
2274        }
2275    };
2276
2277    return new Ext.EventObjectImpl();
2278}();
2279
2280(function(){
2281var D = Ext.lib.Dom;
2282var E = Ext.lib.Event;
2283var A = Ext.lib.Anim;
2284
2285// local style camelizing for speed
2286var propCache = {};
2287var camelRe = /(-[a-z])/gi;
2288var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
2289var view = document.defaultView;
2290
2291Ext.Element = function(element, forceNew){
2292    var dom = typeof element == "string" ?
2293            document.getElementById(element) : element;
2294    if(!dom){ // invalid id/element
2295        return null;
2296    }
2297    var id = dom.id;
2298    if(forceNew !== true && id && Ext.Element.cache[id]){ // element object already exists
2299        return Ext.Element.cache[id];
2300    }
2301
2302   
2303    this.dom = dom;
2304
2305   
2306    this.id = id || Ext.id(dom);
2307};
2308
2309var El = Ext.Element;
2310
2311El.prototype = {
2312   
2313    originalDisplay : "",
2314
2315    visibilityMode : 1,
2316   
2317    defaultUnit : "px",
2318   
2319    setVisibilityMode : function(visMode){
2320        this.visibilityMode = visMode;
2321        return this;
2322    },
2323   
2324    enableDisplayMode : function(display){
2325        this.setVisibilityMode(El.DISPLAY);
2326        if(typeof display != "undefined") this.originalDisplay = display;
2327        return this;
2328    },
2329
2330   
2331    findParent : function(simpleSelector, maxDepth, returnEl){
2332        var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
2333        maxDepth = maxDepth || 50;
2334        if(typeof maxDepth != "number"){
2335            stopEl = Ext.getDom(maxDepth);
2336            maxDepth = 10;
2337        }
2338        while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
2339            if(dq.is(p, simpleSelector)){
2340                return returnEl ? Ext.get(p) : p;
2341            }
2342            depth++;
2343            p = p.parentNode;
2344        }
2345        return null;
2346    },
2347
2348
2349   
2350    findParentNode : function(simpleSelector, maxDepth, returnEl){
2351        var p = Ext.fly(this.dom.parentNode, '_internal');
2352        return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
2353    },
2354
2355   
2356    up : function(simpleSelector, maxDepth){
2357        return this.findParentNode(simpleSelector, maxDepth, true);
2358    },
2359
2360
2361
2362   
2363    is : function(simpleSelector){
2364        return Ext.DomQuery.is(this.dom, simpleSelector);
2365    },
2366
2367   
2368    animate : function(args, duration, onComplete, easing, animType){
2369        this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
2370        return this;
2371    },
2372
2373   
2374    anim : function(args, opt, animType, defaultDur, defaultEase, cb){
2375        animType = animType || 'run';
2376        opt = opt || {};
2377        var anim = Ext.lib.Anim[animType](
2378            this.dom, args,
2379            (opt.duration || defaultDur) || .35,
2380            (opt.easing || defaultEase) || 'easeOut',
2381            function(){
2382                Ext.callback(cb, this);
2383                Ext.callback(opt.callback, opt.scope || this, [this, opt]);
2384            },
2385            this
2386        );
2387        opt.anim = anim;
2388        return anim;
2389    },
2390
2391    // private legacy anim prep
2392    preanim : function(a, i){
2393        return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
2394    },
2395
2396   
2397    clean : function(forceReclean){
2398        if(this.isCleaned && forceReclean !== true){
2399            return this;
2400        }
2401        var ns = /\S/;
2402        var d = this.dom, n = d.firstChild, ni = -1;
2403            while(n){
2404                var nx = n.nextSibling;
2405                if(n.nodeType == 3 && !ns.test(n.nodeValue)){
2406                    d.removeChild(n);
2407                }else{
2408                    n.nodeIndex = ++ni;
2409                }
2410                n = nx;
2411            }
2412            this.isCleaned = true;
2413            return this;
2414        },
2415
2416   
2417    scrollIntoView : function(container, hscroll){
2418        var c = Ext.getDom(container) || Ext.getBody().dom;
2419        var el = this.dom;
2420
2421        var o = this.getOffsetsTo(c),
2422            l = o[0] + c.scrollLeft,
2423            t = o[1] + c.scrollTop,
2424            b = t+el.offsetHeight,
2425            r = l+el.offsetWidth;
2426
2427        var ch = c.clientHeight;
2428        var ct = parseInt(c.scrollTop, 10);
2429        var cl = parseInt(c.scrollLeft, 10);
2430        var cb = ct + ch;
2431        var cr = cl + c.clientWidth;
2432
2433        if(el.offsetHeight > ch || t < ct){
2434                c.scrollTop = t;
2435        }else if(b > cb){
2436            c.scrollTop = b-ch;
2437        }
2438        c.scrollTop = c.scrollTop; // corrects IE, other browsers will ignore
2439
2440        if(hscroll !== false){
2441                        if(el.offsetWidth > c.clientWidth || l < cl){
2442                c.scrollLeft = l;
2443            }else if(r > cr){
2444                c.scrollLeft = r-c.clientWidth;
2445            }
2446            c.scrollLeft = c.scrollLeft;
2447        }
2448        return this;
2449    },
2450
2451    // private
2452    scrollChildIntoView : function(child, hscroll){
2453        Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
2454    },
2455
2456   
2457    autoHeight : function(animate, duration, onComplete, easing){
2458        var oldHeight = this.getHeight();
2459        this.clip();
2460        this.setHeight(1); // force clipping
2461        setTimeout(function(){
2462            var height = parseInt(this.dom.scrollHeight, 10); // parseInt for Safari
2463            if(!animate){
2464                this.setHeight(height);
2465                this.unclip();
2466                if(typeof onComplete == "function"){
2467                    onComplete();
2468                }
2469            }else{
2470                this.setHeight(oldHeight); // restore original height
2471                this.setHeight(height, animate, duration, function(){
2472                    this.unclip();
2473                    if(typeof onComplete == "function") onComplete();
2474                }.createDelegate(this), easing);
2475            }
2476        }.createDelegate(this), 0);
2477        return this;
2478    },
2479
2480   
2481    contains : function(el){
2482        if(!el){return false;}
2483        return D.isAncestor(this.dom, el.dom ? el.dom : el);
2484    },
2485
2486   
2487    isVisible : function(deep) {
2488        var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
2489        if(deep !== true || !vis){
2490            return vis;
2491        }
2492        var p = this.dom.parentNode;
2493        while(p && p.tagName.toLowerCase() != "body"){
2494            if(!Ext.fly(p, '_isVisible').isVisible()){
2495                return false;
2496            }
2497            p = p.parentNode;
2498        }
2499        return true;
2500    },
2501
2502   
2503    select : function(selector, unique){
2504        return El.select(selector, unique, this.dom);
2505    },
2506
2507   
2508    query : function(selector){
2509        return Ext.DomQuery.select(selector, this.dom);
2510    },
2511
2512   
2513    child : function(selector, returnDom){
2514        var n = Ext.DomQuery.selectNode(selector, this.dom);
2515        return returnDom ? n : Ext.get(n);
2516    },
2517
2518   
2519    down : function(selector, returnDom){
2520        var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
2521        return returnDom ? n : Ext.get(n);
2522    },
2523
2524   
2525    initDD : function(group, config, overrides){
2526        var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
2527        return Ext.apply(dd, overrides);
2528    },
2529
2530   
2531    initDDProxy : function(group, config, overrides){
2532        var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
2533        return Ext.apply(dd, overrides);
2534    },
2535
2536   
2537    initDDTarget : function(group, config, overrides){
2538        var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
2539        return Ext.apply(dd, overrides);
2540    },
2541
2542   
2543     setVisible : function(visible, animate){
2544        if(!animate || !A){
2545            if(this.visibilityMode == El.DISPLAY){
2546                this.setDisplayed(visible);
2547            }else{
2548                this.fixDisplay();
2549                this.dom.style.visibility = visible ? "visible" : "hidden";
2550            }
2551        }else{
2552            // closure for composites
2553            var dom = this.dom;
2554            var visMode = this.visibilityMode;
2555            if(visible){
2556                this.setOpacity(.01);
2557                this.setVisible(true);
2558            }
2559            this.anim({opacity: { to: (visible?1:0) }},
2560                  this.preanim(arguments, 1),
2561                  null, .35, 'easeIn', function(){
2562                     if(!visible){
2563                         if(visMode == El.DISPLAY){
2564                             dom.style.display = "none";
2565                         }else{
2566                             dom.style.visibility = "hidden";
2567                         }
2568                         Ext.get(dom).setOpacity(1);
2569                     }
2570                 });
2571        }
2572        return this;
2573    },
2574
2575   
2576    isDisplayed : function() {
2577        return this.getStyle("display") != "none";
2578    },
2579
2580   
2581    toggle : function(animate){
2582        this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
2583        return this;
2584    },
2585
2586   
2587    setDisplayed : function(value) {
2588        if(typeof value == "boolean"){
2589           value = value ? this.originalDisplay : "none";
2590        }
2591        this.setStyle("display", value);
2592        return this;
2593    },
2594
2595   
2596    focus : function() {
2597        try{
2598            this.dom.focus();
2599        }catch(e){}
2600        return this;
2601    },
2602
2603   
2604    blur : function() {
2605        try{
2606            this.dom.blur();
2607        }catch(e){}
2608        return this;
2609    },
2610
2611   
2612    addClass : function(className){
2613        if(Ext.isArray(className)){
2614            for(var i = 0, len = className.length; i < len; i++) {
2615                this.addClass(className[i]);
2616            }
2617        }else{
2618            if(className && !this.hasClass(className)){
2619                this.dom.className = this.dom.className + " " + className;
2620            }
2621        }
2622        return this;
2623    },
2624
2625   
2626    radioClass : function(className){
2627        var siblings = this.dom.parentNode.childNodes;
2628        for(var i = 0; i < siblings.length; i++) {
2629                var s = siblings[i];
2630                if(s.nodeType == 1){
2631                    Ext.get(s).removeClass(className);
2632                }
2633        }
2634        this.addClass(className);
2635        return this;
2636    },
2637
2638   
2639    removeClass : function(className){
2640        if(!className || !this.dom.className){
2641            return this;
2642        }
2643        if(Ext.isArray(className)){
2644            for(var i = 0, len = className.length; i < len; i++) {
2645                this.removeClass(className[i]);
2646            }
2647        }else{
2648            if(this.hasClass(className)){
2649                var re = this.classReCache[className];
2650                if (!re) {
2651                   re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
2652                   this.classReCache[className] = re;
2653                }
2654                this.dom.className =
2655                    this.dom.className.replace(re, " ");
2656            }
2657        }
2658        return this;
2659    },
2660
2661    // private
2662    classReCache: {},
2663
2664   
2665    toggleClass : function(className){
2666        if(this.hasClass(className)){
2667            this.removeClass(className);
2668        }else{
2669            this.addClass(className);
2670        }
2671        return this;
2672    },
2673
2674   
2675    hasClass : function(className){
2676        return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
2677    },
2678
2679   
2680    replaceClass : function(oldClassName, newClassName){
2681        this.removeClass(oldClassName);
2682        this.addClass(newClassName);
2683        return this;
2684    },
2685
2686   
2687    getStyles : function(){
2688        var a = arguments, len = a.length, r = {};
2689        for(var i = 0; i < len; i++){
2690            r[a[i]] = this.getStyle(a[i]);
2691        }
2692        return r;
2693    },
2694
2695   
2696    getStyle : function(){
2697        return view && view.getComputedStyle ?
2698            function(prop){
2699                var el = this.dom, v, cs, camel;
2700                if(prop == 'float'){
2701                    prop = "cssFloat";
2702                }
2703                if(v = el.style[prop]){
2704                    return v;
2705                }
2706                if(cs = view.getComputedStyle(el, "")){
2707                    if(!(camel = propCache[prop])){
2708                        camel = propCache[prop] = prop.replace(camelRe, camelFn);
2709                    }
2710                    return cs[camel];
2711                }
2712                return null;
2713            } :
2714            function(prop){
2715                var el = this.dom, v, cs, camel;
2716                if(prop == 'opacity'){
2717                    if(typeof el.style.filter == 'string'){
2718                        var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
2719                        if(m){
2720                            var fv = parseFloat(m[1]);
2721                            if(!isNaN(fv)){
2722                                return fv ? fv / 100 : 0;
2723                            }
2724                        }
2725                    }
2726                    return 1;
2727                }else if(prop == 'float'){
2728                    prop = "styleFloat";
2729                }
2730                if(!(camel = propCache[prop])){
2731                    camel = propCache[prop] = prop.replace(camelRe, camelFn);
2732                }
2733                if(v = el.style[camel]){
2734                    return v;
2735                }
2736                if(cs = el.currentStyle){
2737                    return cs[camel];
2738                }
2739                return null;
2740            };
2741    }(),
2742
2743   
2744    setStyle : function(prop, value){
2745        if(typeof prop == "string"){
2746            var camel;
2747            if(!(camel = propCache[prop])){
2748                camel = propCache[prop] = prop.replace(camelRe, camelFn);
2749            }
2750            if(camel == 'opacity') {
2751                this.setOpacity(value);
2752            }else{
2753                this.dom.style[camel] = value;
2754            }
2755        }else{
2756            for(var style in prop){
2757                if(typeof prop[style] != "function"){
2758                   this.setStyle(style, prop[style]);
2759                }
2760            }
2761        }
2762        return this;
2763    },
2764
2765   
2766    applyStyles : function(style){
2767        Ext.DomHelper.applyStyles(this.dom, style);
2768        return this;
2769    },
2770
2771   
2772    getX : function(){
2773        return D.getX(this.dom);
2774    },
2775
2776   
2777    getY : function(){
2778        return D.getY(this.dom);
2779    },
2780
2781   
2782    getXY : function(){
2783        return D.getXY(this.dom);
2784    },
2785
2786   
2787    getOffsetsTo : function(el){
2788        var o = this.getXY();
2789        var e = Ext.fly(el, '_internal').getXY();
2790        return [o[0]-e[0],o[1]-e[1]];
2791    },
2792
2793   
2794    setX : function(x, animate){
2795        if(!animate || !A){
2796            D.setX(this.dom, x);
2797        }else{
2798            this.setXY([x, this.getY()], this.preanim(arguments, 1));
2799        }
2800        return this;
2801    },
2802
2803   
2804    setY : function(y, animate){
2805        if(!animate || !A){
2806            D.setY(this.dom, y);
2807        }else{
2808            this.setXY([this.getX(), y], this.preanim(arguments, 1));
2809        }
2810        return this;
2811    },
2812
2813   
2814    setLeft : function(left){
2815        this.setStyle("left", this.addUnits(left));
2816        return this;
2817    },
2818
2819   
2820    setTop : function(top){
2821        this.setStyle("top", this.addUnits(top));
2822        return this;
2823    },
2824
2825   
2826    setRight : function(right){
2827        this.setStyle("right", this.addUnits(right));
2828        return this;
2829    },
2830
2831   
2832    setBottom : function(bottom){
2833        this.setStyle("bottom", this.addUnits(bottom));
2834        return this;
2835    },
2836
2837   
2838    setXY : function(pos, animate){
2839        if(!animate || !A){
2840            D.setXY(this.dom, pos);
2841        }else{
2842            this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
2843        }
2844        return this;
2845    },
2846
2847   
2848    setLocation : function(x, y, animate){
2849        this.setXY([x, y], this.preanim(arguments, 2));
2850        return this;
2851    },
2852
2853   
2854    moveTo : function(x, y, animate){
2855        this.setXY([x, y], this.preanim(arguments, 2));
2856        return this;
2857    },
2858
2859   
2860    getRegion : function(){
2861        return D.getRegion(this.dom);
2862    },
2863
2864   
2865    getHeight : function(contentHeight){
2866        var h = this.dom.offsetHeight || 0;
2867        h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
2868        return h < 0 ? 0 : h;
2869    },
2870
2871   
2872    getWidth : function(contentWidth){
2873        var w = this.dom.offsetWidth || 0;
2874        w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
2875        return w < 0 ? 0 : w;
2876    },
2877
2878   
2879    getComputedHeight : function(){
2880        var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
2881        if(!h){
2882            h = parseInt(this.getStyle('height'), 10) || 0;
2883            if(!this.isBorderBox()){
2884                h += this.getFrameWidth('tb');
2885            }
2886        }
2887        return h;
2888    },
2889
2890   
2891    getComputedWidth : function(){
2892        var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
2893        if(!w){
2894            w = parseInt(this.getStyle('width'), 10) || 0;
2895            if(!this.isBorderBox()){
2896                w += this.getFrameWidth('lr');
2897            }
2898        }
2899        return w;
2900    },
2901
2902   
2903    getSize : function(contentSize){
2904        return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
2905    },
2906
2907    getStyleSize : function(){
2908        var w, h, d = this.dom, s = d.style;
2909        if(s.width && s.width != 'auto'){
2910            w = parseInt(s.width, 10);
2911            if(Ext.isBorderBox){
2912               w -= this.getFrameWidth('lr');
2913            }
2914        }
2915        if(s.height && s.height != 'auto'){
2916            h = parseInt(s.height, 10);
2917            if(Ext.isBorderBox){
2918               h -= this.getFrameWidth('tb');
2919            }
2920        }
2921        return {width: w || this.getWidth(true), height: h || this.getHeight(true)};
2922
2923    },
2924
2925   
2926    getViewSize : function(){
2927        var d = this.dom, doc = document, aw = 0, ah = 0;
2928        if(d == doc || d == doc.body){
2929            return {width : D.getViewWidth(), height: D.getViewHeight()};
2930        }else{
2931            return {
2932                width : d.clientWidth,
2933                height: d.clientHeight
2934            };
2935        }
2936    },
2937
2938   
2939    getValue : function(asNumber){
2940        return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
2941    },
2942
2943    // private
2944    adjustWidth : function(width){
2945        if(typeof width == "number"){
2946            if(this.autoBoxAdjust && !this.isBorderBox()){
2947               width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
2948            }
2949            if(width < 0){
2950                width = 0;
2951            }
2952        }
2953        return width;
2954    },
2955
2956    // private
2957    adjustHeight : function(height){
2958        if(typeof height == "number"){
2959           if(this.autoBoxAdjust && !this.isBorderBox()){
2960               height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
2961           }
2962           if(height < 0){
2963               height = 0;
2964           }
2965        }
2966        return height;
2967    },
2968
2969   
2970    setWidth : function(width, animate){
2971        width = this.adjustWidth(width);
2972        if(!animate || !A){
2973            this.dom.style.width = this.addUnits(width);
2974        }else{
2975            this.anim({width: {to: width}}, this.preanim(arguments, 1));
2976        }
2977        return this;
2978    },
2979
2980   
2981     setHeight : function(height, animate){
2982        height = this.adjustHeight(height);
2983        if(!animate || !A){
2984            this.dom.style.height = this.addUnits(height);
2985        }else{
2986            this.anim({height: {to: height}}, this.preanim(arguments, 1));
2987        }
2988        return this;
2989    },
2990
2991   
2992     setSize : function(width, height, animate){
2993        if(typeof width == "object"){ // in case of object from getSize()
2994            height = width.height; width = width.width;
2995        }
2996        width = this.adjustWidth(width); height = this.adjustHeight(height);
2997        if(!animate || !A){
2998            this.dom.style.width = this.addUnits(width);
2999            this.dom.style.height = this.addUnits(height);
3000        }else{
3001            this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
3002        }
3003        return this;
3004    },
3005
3006   
3007    setBounds : function(x, y, width, height, animate){
3008        if(!animate || !A){
3009            this.setSize(width, height);
3010            this.setLocation(x, y);
3011        }else{
3012            width = this.adjustWidth(width); height = this.adjustHeight(height);
3013            this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
3014                          this.preanim(arguments, 4), 'motion');
3015        }
3016        return this;
3017    },
3018
3019   
3020    setRegion : function(region, animate){
3021        this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
3022        return this;
3023    },
3024
3025   
3026    addListener : function(eventName, fn, scope, options){
3027        Ext.EventManager.on(this.dom,  eventName, fn, scope || this, options);
3028    },
3029
3030   
3031    removeListener : function(eventName, fn, scope){
3032        Ext.EventManager.removeListener(this.dom,  eventName, fn, scope || this);
3033        return this;
3034    },
3035
3036   
3037    removeAllListeners : function(){
3038        Ext.EventManager.removeAll(this.dom);
3039        return this;
3040    },
3041
3042   
3043    relayEvent : function(eventName, observable){
3044        this.on(eventName, function(e){
3045            observable.fireEvent(eventName, e);
3046        });
3047    },
3048
3049   
3050     setOpacity : function(opacity, animate){
3051        if(!animate || !A){
3052            var s = this.dom.style;
3053            if(Ext.isIE){
3054                s.zoom = 1;
3055                s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
3056                           (opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");
3057            }else{
3058                s.opacity = opacity;
3059            }
3060        }else{
3061            this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
3062        }
3063        return this;
3064    },
3065
3066   
3067    getLeft : function(local){
3068        if(!local){
3069            return this.getX();
3070        }else{
3071            return parseInt(this.getStyle("left"), 10) || 0;
3072        }
3073    },
3074
3075   
3076    getRight : function(local){
3077        if(!local){
3078            return this.getX() + this.getWidth();
3079        }else{
3080            return (this.getLeft(true) + this.getWidth()) || 0;
3081        }
3082    },
3083
3084   
3085    getTop : function(local) {
3086        if(!local){
3087            return this.getY();
3088        }else{
3089            return parseInt(this.getStyle("top"), 10) || 0;
3090        }
3091    },
3092
3093   
3094    getBottom : function(local){
3095        if(!local){
3096            return this.getY() + this.getHeight();
3097        }else{
3098            return (this.getTop(true) + this.getHeight()) || 0;
3099        }
3100    },
3101
3102   
3103    position : function(pos, zIndex, x, y){
3104        if(!pos){
3105           if(this.getStyle('position') == 'static'){
3106               this.setStyle('position', 'relative');
3107           }
3108        }else{
3109            this.setStyle("position", pos);
3110        }
3111        if(zIndex){
3112            this.setStyle("z-index", zIndex);
3113        }
3114        if(x !== undefined && y !== undefined){
3115            this.setXY([x, y]);
3116        }else if(x !== undefined){
3117            this.setX(x);
3118        }else if(y !== undefined){
3119            this.setY(y);
3120        }
3121    },
3122
3123   
3124    clearPositioning : function(value){
3125        value = value ||'';
3126        this.setStyle({
3127            "left": value,
3128            "right": value,
3129            "top": value,
3130            "bottom": value,
3131            "z-index": "",
3132            "position" : "static"
3133        });
3134        return this;
3135    },
3136
3137   
3138    getPositioning : function(){
3139        var l = this.getStyle("left");
3140        var t = this.getStyle("top");
3141        return {
3142            "position" : this.getStyle("position"),
3143            "left" : l,
3144            "right" : l ? "" : this.getStyle("right"),
3145            "top" : t,
3146            "bottom" : t ? "" : this.getStyle("bottom"),
3147            "z-index" : this.getStyle("z-index")
3148        };
3149    },
3150
3151   
3152    getBorderWidth : function(side){
3153        return this.addStyles(side, El.borders);
3154    },
3155
3156   
3157    getPadding : function(side){
3158        return this.addStyles(side, El.paddings);
3159    },
3160
3161   
3162    setPositioning : function(pc){
3163        this.applyStyles(pc);
3164        if(pc.right == "auto"){
3165            this.dom.style.right = "";
3166        }
3167        if(pc.bottom == "auto"){
3168            this.dom.style.bottom = "";
3169        }
3170        return this;
3171    },
3172
3173    // private
3174    fixDisplay : function(){
3175        if(this.getStyle("display") == "none"){
3176            this.setStyle("visibility", "hidden");
3177            this.setStyle("display", this.originalDisplay); // first try reverting to default
3178            if(this.getStyle("display") == "none"){ // if that fails, default to block
3179                this.setStyle("display", "block");
3180            }
3181        }
3182    },
3183
3184    // private
3185        setOverflow : function(v){
3186        if(v=='auto' && Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
3187                this.dom.style.overflow = 'hidden';
3188                (function(){this.dom.style.overflow = 'auto';}).defer(1, this);
3189        }else{
3190                this.dom.style.overflow = v;
3191        }
3192        },
3193
3194   
3195     setLeftTop : function(left, top){
3196        this.dom.style.left = this.addUnits(left);
3197        this.dom.style.top = this.addUnits(top);
3198        return this;
3199    },
3200
3201   
3202     move : function(direction, distance, animate){
3203        var xy = this.getXY();
3204        direction = direction.toLowerCase();
3205        switch(direction){
3206            case "l":
3207            case "left":
3208                this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
3209                break;
3210           case "r":
3211           case "right":
3212                this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
3213                break;
3214           case "t":
3215           case "top":
3216           case "up":
3217                this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
3218                break;
3219           case "b":
3220           case "bottom":
3221           case "down":
3222                this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
3223                break;
3224        }
3225        return this;
3226    },
3227
3228   
3229    clip : function(){
3230        if(!this.isClipped){
3231           this.isClipped = true;
3232           this.originalClip = {
3233               "o": this.getStyle("overflow"),
3234               "x": this.getStyle("overflow-x"),
3235               "y": this.getStyle("overflow-y")
3236           };
3237           this.setStyle("overflow", "hidden");
3238           this.setStyle("overflow-x", "hidden");
3239           this.setStyle("overflow-y", "hidden");
3240        }
3241        return this;
3242    },
3243
3244   
3245    unclip : function(){
3246        if(this.isClipped){
3247            this.isClipped = false;
3248            var o = this.originalClip;
3249            if(o.o){this.setStyle("overflow", o.o);}
3250            if(o.x){this.setStyle("overflow-x", o.x);}
3251            if(o.y){this.setStyle("overflow-y", o.y);}
3252        }
3253        return this;
3254    },
3255
3256
3257   
3258    getAnchorXY : function(anchor, local, s){
3259        //Passing a different size is useful for pre-calculating anchors,
3260        //especially for anchored animations that change the el size.
3261
3262        var w, h, vp = false;
3263        if(!s){
3264            var d = this.dom;
3265            if(d == document.body || d == document){
3266                vp = true;
3267                w = D.getViewWidth(); h = D.getViewHeight();
3268            }else{
3269                w = this.getWidth(); h = this.getHeight();
3270            }
3271        }else{
3272            w = s.width;  h = s.height;
3273        }
3274        var x = 0, y = 0, r = Math.round;
3275        switch((anchor || "tl").toLowerCase()){
3276            case "c":
3277                x = r(w*.5);
3278                y = r(h*.5);
3279            break;
3280            case "t":
3281                x = r(w*.5);
3282                y = 0;
3283            break;
3284            case "l":
3285                x = 0;
3286                y = r(h*.5);
3287            break;
3288            case "r":
3289                x = w;
3290                y = r(h*.5);
3291            break;
3292            case "b":
3293                x = r(w*.5);
3294                y = h;
3295            break;
3296            case "tl":
3297                x = 0;
3298                y = 0;
3299            break;
3300            case "bl":
3301                x = 0;
3302                y = h;
3303            break;
3304            case "br":
3305                x = w;
3306                y = h;
3307            break;
3308            case "tr":
3309                x = w;
3310                y = 0;
3311            break;
3312        }
3313        if(local === true){
3314            return [x, y];
3315        }
3316        if(vp){
3317            var sc = this.getScroll();
3318            return [x + sc.left, y + sc.top];
3319        }
3320        //Add the element's offset xy
3321        var o = this.getXY();
3322        return [x+o[0], y+o[1]];
3323    },
3324
3325   
3326    getAlignToXY : function(el, p, o){
3327        el = Ext.get(el);
3328        if(!el || !el.dom){
3329            throw "Element.alignToXY with an element that doesn't exist";
3330        }
3331        var d = this.dom;
3332        var c = false; //constrain to viewport
3333        var p1 = "", p2 = "";
3334        o = o || [0,0];
3335
3336        if(!p){
3337            p = "tl-bl";
3338        }else if(p == "?"){
3339            p = "tl-bl?";
3340        }else if(p.indexOf("-") == -1){
3341            p = "tl-" + p;
3342        }
3343        p = p.toLowerCase();
3344        var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
3345        if(!m){
3346           throw "Element.alignTo with an invalid alignment " + p;
3347        }
3348        p1 = m[1]; p2 = m[2]; c = !!m[3];
3349
3350        //Subtract the aligned el's internal xy from the target's offset xy
3351        //plus custom offset to get the aligned el's new offset xy
3352        var a1 = this.getAnchorXY(p1, true);
3353        var a2 = el.getAnchorXY(p2, false);
3354
3355        var x = a2[0] - a1[0] + o[0];
3356        var y = a2[1] - a1[1] + o[1];
3357
3358        if(c){
3359            //constrain the aligned el to viewport if necessary
3360            var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
3361            // 5px of margin for ie
3362            var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
3363
3364            //If we are at a viewport boundary and the aligned el is anchored on a target border that is
3365            //perpendicular to the vp border, allow the aligned el to slide on that border,
3366            //otherwise swap the aligned el to the opposite border of the target.
3367            var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
3368           var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
3369           var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
3370           var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
3371
3372           var doc = document;
3373           var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
3374           var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
3375
3376           if((x+w) > dw + scrollX){
3377                x = swapX ? r.left-w : dw+scrollX-w;
3378            }
3379           if(x < scrollX){
3380               x = swapX ? r.right : scrollX;
3381           }
3382           if((y+h) > dh + scrollY){
3383                y = swapY ? r.top-h : dh+scrollY-h;
3384            }
3385           if (y < scrollY){
3386               y = swapY ? r.bottom : scrollY;
3387           }
3388        }
3389        return [x,y];
3390    },
3391
3392    // private
3393    getConstrainToXY : function(){
3394        var os = {top:0, left:0, bottom:0, right: 0};
3395
3396        return function(el, local, offsets, proposedXY){
3397            el = Ext.get(el);
3398            offsets = offsets ? Ext.applyIf(offsets, os) : os;
3399
3400            var vw, vh, vx = 0, vy = 0;
3401            if(el.dom == document.body || el.dom == document){
3402                vw = Ext.lib.Dom.getViewWidth();
3403                vh = Ext.lib.Dom.getViewHeight();
3404            }else{
3405                vw = el.dom.clientWidth;
3406                vh = el.dom.clientHeight;
3407                if(!local){
3408                    var vxy = el.getXY();
3409                    vx = vxy[0];
3410                    vy = vxy[1];
3411                }
3412            }
3413
3414            var s = el.getScroll();
3415
3416            vx += offsets.left + s.left;
3417            vy += offsets.top + s.top;
3418
3419            vw -= offsets.right;
3420            vh -= offsets.bottom;
3421
3422            var vr = vx+vw;
3423            var vb = vy+vh;
3424
3425            var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
3426            var x = xy[0], y = xy[1];
3427            var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
3428
3429            // only move it if it needs it
3430            var moved = false;
3431
3432            // first validate right/bottom
3433            if((x + w) > vr){
3434                x = vr - w;
3435                moved = true;
3436            }
3437            if((y + h) > vb){
3438                y = vb - h;
3439                moved = true;
3440            }
3441            // then make sure top/left isn't negative
3442            if(x < vx){
3443                x = vx;
3444                moved = true;
3445            }
3446            if(y < vy){
3447                y = vy;
3448                moved = true;
3449            }
3450            return moved ? [x, y] : false;
3451        };
3452    }(),
3453
3454    // private
3455    adjustForConstraints : function(xy, parent, offsets){
3456        return this.getConstrainToXY(parent || document, false, offsets, xy) ||  xy;
3457    },
3458
3459   
3460    alignTo : function(element, position, offsets, animate){
3461        var xy = this.getAlignToXY(element, position, offsets);
3462        this.setXY(xy, this.preanim(arguments, 3));
3463        return this;
3464    },
3465
3466   
3467    anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
3468        var action = function(){
3469            this.alignTo(el, alignment, offsets, animate);
3470            Ext.callback(callback, this);
3471        };
3472        Ext.EventManager.onWindowResize(action, this);
3473        var tm = typeof monitorScroll;
3474        if(tm != 'undefined'){
3475            Ext.EventManager.on(window, 'scroll', action, this,
3476                {buffer: tm == 'number' ? monitorScroll : 50});
3477        }
3478        action.call(this); // align immediately
3479        return this;
3480    },
3481   
3482    clearOpacity : function(){
3483        if (window.ActiveXObject) {
3484            if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
3485                this.dom.style.filter = "";
3486            }
3487        } else {
3488            this.dom.style.opacity = "";
3489            this.dom.style["-moz-opacity"] = "";
3490            this.dom.style["-khtml-opacity"] = "";
3491        }
3492        return this;
3493    },
3494
3495   
3496    hide : function(animate){
3497        this.setVisible(false, this.preanim(arguments, 0));
3498        return this;
3499    },
3500
3501   
3502    show : function(animate){
3503        this.setVisible(true, this.preanim(arguments, 0));
3504        return this;
3505    },
3506
3507   
3508    addUnits : function(size){
3509        return Ext.Element.addUnits(size, this.defaultUnit);
3510    },
3511
3512   
3513    update : function(html, loadScripts, callback){
3514        if(typeof html == "undefined"){
3515            html = "";
3516        }
3517        if(loadScripts !== true){
3518            this.dom.innerHTML = html;
3519            if(typeof callback == "function"){
3520                callback();
3521            }
3522            return this;
3523        }
3524        var id = Ext.id();
3525        var dom = this.dom;
3526
3527        html += '<span id="' + id + '"></span>';
3528
3529        E.onAvailable(id, function(){
3530            var hd = document.getElementsByTagName("head")[0];
3531            var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
3532            var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
3533            var typeRe = /\stype=([\'\"])(.*?)\1/i;
3534
3535            var match;
3536            while(match = re.exec(html)){
3537                var attrs = match[1];
3538                var srcMatch = attrs ? attrs.match(srcRe) : false;
3539                if(srcMatch && srcMatch[2]){
3540                   var s = document.createElement("script");
3541                   s.src = srcMatch[2];
3542                   var typeMatch = attrs.match(typeRe);
3543                   if(typeMatch && typeMatch[2]){
3544                       s.type = typeMatch[2];
3545                   }
3546                   hd.appendChild(s);
3547                }else if(match[2] && match[2].length > 0){
3548                    if(window.execScript) {
3549                       window.execScript(match[2]);
3550                    } else {
3551                       window.eval(match[2]);
3552                    }
3553                }
3554            }
3555            var el = document.getElementById(id);
3556            if(el){Ext.removeNode(el);}
3557            if(typeof callback == "function"){
3558                callback();
3559            }
3560        });
3561        dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
3562        return this;
3563    },
3564
3565   
3566    load : function(){
3567        var um = this.getUpdater();
3568        um.update.apply(um, arguments);
3569        return this;
3570    },
3571
3572   
3573    getUpdater : function(){
3574        if(!this.updateManager){
3575            this.updateManager = new Ext.Updater(this);
3576        }
3577        return this.updateManager;
3578    },
3579
3580   
3581    unselectable : function(){
3582        this.dom.unselectable = "on";
3583        this.swallowEvent("selectstart", true);
3584        this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
3585        this.addClass("x-unselectable");
3586        return this;
3587    },
3588
3589   
3590    getCenterXY : function(){
3591        return this.getAlignToXY(document, 'c-c');
3592    },
3593
3594   
3595    center : function(centerIn){
3596        this.alignTo(centerIn || document, 'c-c');
3597        return this;
3598    },
3599
3600   
3601    isBorderBox : function(){
3602        return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;
3603    },
3604
3605   
3606    getBox : function(contentBox, local){
3607        var xy;
3608        if(!local){
3609            xy = this.getXY();
3610        }else{
3611            var left = parseInt(this.getStyle("left"), 10) || 0;
3612            var top = parseInt(this.getStyle("top"), 10) || 0;
3613            xy = [left, top];
3614        }
3615        var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
3616        if(!contentBox){
3617            bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
3618        }else{
3619            var l = this.getBorderWidth("l")+this.getPadding("l");
3620            var r = this.getBorderWidth("r")+this.getPadding("r");
3621            var t = this.getBorderWidth("t")+this.getPadding("t");
3622            var b = this.getBorderWidth("b")+this.getPadding("b");
3623            bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};
3624        }
3625        bx.right = bx.x + bx.width;
3626        bx.bottom = bx.y + bx.height;
3627        return bx;
3628    },
3629
3630   
3631    getFrameWidth : function(sides, onlyContentBox){
3632        return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
3633    },
3634
3635   
3636    setBox : function(box, adjust, animate){
3637        var w = box.width, h = box.height;
3638        if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
3639           w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
3640           h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
3641        }
3642        this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
3643        return this;
3644    },
3645
3646   
3647     repaint : function(){
3648        var dom = this.dom;
3649        this.addClass("x-repaint");
3650        setTimeout(function(){
3651            Ext.get(dom).removeClass("x-repaint");
3652        }, 1);
3653        return this;
3654    },
3655
3656   
3657    getMargins : function(side){
3658        if(!side){
3659            return {
3660                top: parseInt(this.getStyle("margin-top"), 10) || 0,
3661                left: parseInt(this.getStyle("margin-left"), 10) || 0,
3662                bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
3663                right: parseInt(this.getStyle("margin-right"), 10) || 0
3664            };
3665        }else{
3666            return this.addStyles(side, El.margins);
3667         }
3668    },
3669
3670    // private
3671    addStyles : function(sides, styles){
3672        var val = 0, v, w;
3673        for(var i = 0, len = sides.length; i < len; i++){
3674            v = this.getStyle(styles[sides.charAt(i)]);
3675            if(v){
3676                 w = parseInt(v, 10);
3677                 if(w){ val += (w >= 0 ? w : -1 * w); }
3678            }
3679        }
3680        return val;
3681    },
3682
3683   
3684    createProxy : function(config, renderTo, matchBox){
3685        config = typeof config == "object" ?
3686            config : {tag : "div", cls: config};
3687
3688        var proxy;
3689        if(renderTo){
3690            proxy = Ext.DomHelper.append(renderTo, config, true);
3691        }else {
3692            proxy = Ext.DomHelper.insertBefore(this.dom, config, true);
3693        }
3694        if(matchBox){
3695           proxy.setBox(this.getBox());
3696        }
3697        return proxy;
3698    },
3699
3700   
3701    mask : function(msg, msgCls){
3702        if(this.getStyle("position") == "static"){
3703            this.addClass("x-masked-relative");
3704        }
3705        if(this._maskMsg){
3706            this._maskMsg.remove();
3707        }
3708        if(this._mask){
3709            this._mask.remove();
3710        }
3711
3712        this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);
3713
3714        this.addClass("x-masked");
3715        this._mask.setDisplayed(true);
3716        if(typeof msg == 'string'){
3717            this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);
3718            var mm = this._maskMsg;
3719            mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";
3720            mm.dom.firstChild.innerHTML = msg;
3721            mm.setDisplayed(true);
3722            mm.center(this);
3723        }
3724        if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ // ie will not expand full height automatically
3725            this._mask.setSize(this.getWidth(), this.getHeight());
3726        }
3727        return this._mask;
3728    },
3729
3730   
3731    unmask : function(){
3732        if(this._mask){
3733            if(this._maskMsg){
3734                this._maskMsg.remove();
3735                delete this._maskMsg;
3736            }
3737            this._mask.remove();
3738            delete this._mask;
3739        }
3740        this.removeClass(["x-masked", "x-masked-relative"]);
3741    },
3742
3743   
3744    isMasked : function(){
3745        return this._mask && this._mask.isVisible();
3746    },
3747
3748   
3749    createShim : function(){
3750        var el = document.createElement('iframe');
3751        el.frameBorder = '0';
3752        el.className = 'ext-shim';
3753        if(Ext.isIE && Ext.isSecure){
3754            el.src = Ext.SSL_SECURE_URL;
3755        }
3756        var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
3757        shim.autoBoxAdjust = false;
3758        return shim;
3759    },
3760
3761   
3762    remove : function(){
3763        Ext.removeNode(this.dom);
3764        delete El.cache[this.dom.id];
3765    },
3766
3767   
3768    hover : function(overFn, outFn, scope){
3769        var preOverFn = function(e){
3770            if(!e.within(this, true)){
3771                overFn.apply(scope || this, arguments);
3772            }
3773        };
3774        var preOutFn = function(e){
3775            if(!e.within(this, true)){
3776                outFn.apply(scope || this, arguments);
3777            }
3778        };
3779        this.on("mouseover", preOverFn, this.dom);
3780        this.on("mouseout", preOutFn, this.dom);
3781        return this;
3782    },
3783
3784   
3785    addClassOnOver : function(className){
3786        this.hover(
3787            function(){
3788                Ext.fly(this, '_internal').addClass(className);
3789            },
3790            function(){
3791                Ext.fly(this, '_internal').removeClass(className);
3792            }
3793        );
3794        return this;
3795    },
3796
3797   
3798    addClassOnFocus : function(className){
3799        this.on("focus", function(){
3800            Ext.fly(this, '_internal').addClass(className);
3801        }, this.dom);
3802        this.on("blur", function(){
3803            Ext.fly(this, '_internal').removeClass(className);
3804        }, this.dom);
3805        return this;
3806    },
3807   
3808    addClassOnClick : function(className){
3809        var dom = this.dom;
3810        this.on("mousedown", function(){
3811            Ext.fly(dom, '_internal').addClass(className);
3812            var d = Ext.getDoc();
3813            var fn = function(){
3814                Ext.fly(dom, '_internal').removeClass(className);
3815                d.removeListener("mouseup", fn);
3816            };
3817            d.on("mouseup", fn);
3818        });
3819        return this;
3820    },
3821
3822   
3823    swallowEvent : function(eventName, preventDefault){
3824        var fn = function(e){
3825            e.stopPropagation();
3826            if(preventDefault){
3827                e.preventDefault();
3828            }
3829        };
3830        if(Ext.isArray(eventName)){
3831            for(var i = 0, len = eventName.length; i < len; i++){
3832                 this.on(eventName[i], fn);
3833            }
3834            return this;
3835        }
3836        this.on(eventName, fn);
3837        return this;
3838    },
3839
3840   
3841    parent : function(selector, returnDom){
3842        return this.matchNode('parentNode', 'parentNode', selector, returnDom);
3843    },
3844
3845     
3846    next : function(selector, returnDom){
3847        return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
3848    },
3849
3850   
3851    prev : function(selector, returnDom){
3852        return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
3853    },
3854
3855
3856   
3857    first : function(selector, returnDom){
3858        return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
3859    },
3860
3861   
3862    last : function(selector, returnDom){
3863        return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
3864    },
3865
3866    matchNode : function(dir, start, selector, returnDom){
3867        var n = this.dom[start];
3868        while(n){
3869            if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){
3870                return !returnDom ? Ext.get(n) : n;
3871            }
3872            n = n[dir];
3873        }
3874        return null;
3875    },
3876
3877   
3878    appendChild: function(el){
3879        el = Ext.get(el);
3880        el.appendTo(this);
3881        return this;
3882    },
3883
3884   
3885    createChild: function(config, insertBefore, returnDom){
3886        config = config || {tag:'div'};
3887        if(insertBefore){
3888            return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
3889        }
3890        return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config,  returnDom !== true);
3891    },
3892
3893   
3894    appendTo: function(el){
3895        el = Ext.getDom(el);
3896        el.appendChild(this.dom);
3897        return this;
3898    },
3899
3900   
3901    insertBefore: function(el){
3902        el = Ext.getDom(el);
3903        el.parentNode.insertBefore(this.dom, el);
3904        return this;
3905    },
3906
3907   
3908    insertAfter: function(el){
3909        el = Ext.getDom(el);
3910        el.parentNode.insertBefore(this.dom, el.nextSibling);
3911        return this;
3912    },
3913
3914   
3915    insertFirst: function(el, returnDom){
3916        el = el || {};
3917        if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config
3918            return this.createChild(el, this.dom.firstChild, returnDom);
3919        }else{
3920            el = Ext.getDom(el);
3921            this.dom.insertBefore(el, this.dom.firstChild);
3922            return !returnDom ? Ext.get(el) : el;
3923        }
3924    },
3925
3926   
3927    insertSibling: function(el, where, returnDom){
3928        var rt;
3929        if(Ext.isArray(el)){
3930            for(var i = 0, len = el.length; i < len; i++){
3931                rt = this.insertSibling(el[i], where, returnDom);
3932            }
3933            return rt;
3934        }
3935        where = where ? where.toLowerCase() : 'before';
3936        el = el || {};
3937        var refNode = where == 'before' ? this.dom : this.dom.nextSibling;
3938
3939        if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config
3940            if(where == 'after' && !this.dom.nextSibling){
3941                rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);
3942            }else{
3943                rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
3944            }
3945
3946        }else{
3947            rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);
3948            if(!returnDom){
3949                rt = Ext.get(rt);
3950            }
3951        }
3952        return rt;
3953    },
3954
3955   
3956    wrap: function(config, returnDom){
3957        if(!config){
3958            config = {tag: "div"};
3959        }
3960        var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);
3961        newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
3962        return newEl;
3963    },
3964
3965   
3966    replace: function(el){
3967        el = Ext.get(el);
3968        this.insertBefore(el);
3969        el.remove();
3970        return this;
3971    },
3972
3973   
3974    replaceWith: function(el){
3975        if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config
3976            el = this.insertSibling(el, 'before');
3977        }else{
3978            el = Ext.getDom(el);
3979            this.dom.parentNode.insertBefore(el, this.dom);
3980        }
3981        El.uncache(this.id);
3982        Ext.removeNode(this.dom);
3983        this.dom = el;
3984        this.id = Ext.id(el);
3985        El.cache[this.id] = this;
3986        return this;
3987    },
3988
3989   
3990    insertHtml : function(where, html, returnEl){
3991        var el = Ext.DomHelper.insertHtml(where, this.dom, html);
3992        return returnEl ? Ext.get(el) : el;
3993    },
3994
3995   
3996    set : function(o, useSet){
3997        var el = this.dom;
3998        useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
3999        for(var attr in o){
4000            if(attr == "style" || typeof o[attr] == "function") continue;
4001            if(attr=="cls"){
4002                el.className = o["cls"];
4003            }else if(o.hasOwnProperty(attr)){
4004                if(useSet) el.setAttribute(attr, o[attr]);
4005                else el[attr] = o[attr];
4006            }
4007        }
4008        if(o.style){
4009            Ext.DomHelper.applyStyles(el, o.style);
4010        }
4011        return this;
4012    },
4013
4014   
4015    addKeyListener : function(key, fn, scope){
4016        var config;
4017        if(typeof key != "object" || Ext.isArray(key)){
4018            config = {
4019                key: key,
4020                fn: fn,
4021                scope: scope
4022            };
4023        }else{
4024            config = {
4025                key : key.key,
4026                shift : key.shift,
4027                ctrl : key.ctrl,
4028                alt : key.alt,
4029                fn: fn,
4030                scope: scope
4031            };
4032        }
4033        return new Ext.KeyMap(this, config);
4034    },
4035
4036   
4037    addKeyMap : function(config){
4038        return new Ext.KeyMap(this, config);
4039    },
4040
4041   
4042     isScrollable : function(){
4043        var dom = this.dom;
4044        return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
4045    },
4046
4047   
4048    scrollTo : function(side, value, animate){
4049        var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
4050        if(!animate || !A){
4051            this.dom[prop] = value;
4052        }else{
4053            var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
4054            this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
4055        }
4056        return this;
4057    },
4058
4059   
4060     scroll : function(direction, distance, animate){
4061         if(!this.isScrollable()){
4062             return;
4063         }
4064         var el = this.dom;
4065         var l = el.scrollLeft, t = el.scrollTop;
4066         var w = el.scrollWidth, h = el.scrollHeight;
4067         var cw = el.clientWidth, ch = el.clientHeight;
4068         direction = direction.toLowerCase();
4069         var scrolled = false;
4070         var a = this.preanim(arguments, 2);
4071         switch(direction){
4072             case "l":
4073             case "left":
4074                 if(w - l > cw){
4075                     var v = Math.min(l + distance, w-cw);
4076                     this.scrollTo("left", v, a);
4077                     scrolled = true;
4078                 }
4079                 break;
4080            case "r":
4081            case "right":
4082                 if(l > 0){
4083                     var v = Math.max(l - distance, 0);
4084                     this.scrollTo("left", v, a);
4085                     scrolled = true;
4086                 }
4087                 break;
4088            case "t":
4089            case "top":
4090            case "up":
4091                 if(t > 0){
4092                     var v = Math.max(t - distance, 0);
4093                     this.scrollTo("top", v, a);
4094                     scrolled = true;
4095                 }
4096                 break;
4097            case "b":
4098            case "bottom":
4099            case "down":
4100                 if(h - t > ch){
4101                     var v = Math.min(t + distance, h-ch);
4102                     this.scrollTo("top", v, a);
4103                     scrolled = true;
4104                 }
4105                 break;
4106         }
4107         return scrolled;
4108    },
4109
4110   
4111    translatePoints : function(x, y){
4112        if(typeof x == 'object' || Ext.isArray(x)){
4113            y = x[1]; x = x[0];
4114        }
4115        var p = this.getStyle('position');
4116        var o = this.getXY();
4117
4118        var l = parseInt(this.getStyle('left'), 10);
4119        var t = parseInt(this.getStyle('top'), 10);
4120
4121        if(isNaN(l)){
4122            l = (p == "relative") ? 0 : this.dom.offsetLeft;
4123        }
4124        if(isNaN(t)){
4125            t = (p == "relative") ? 0 : this.dom.offsetTop;
4126        }
4127
4128        return {left: (x - o[0] + l), top: (y - o[1] + t)};
4129    },
4130
4131   
4132    getScroll : function(){
4133        var d = this.dom, doc = document;
4134        if(d == doc || d == doc.body){
4135            var l, t;
4136            if(Ext.isIE && Ext.isStrict){
4137                l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);
4138                t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);
4139            }else{
4140                l = window.pageXOffset || (doc.body.scrollLeft || 0);
4141                t = window.pageYOffset || (doc.body.scrollTop || 0);
4142            }
4143            return {left: l, top: t};
4144        }else{
4145            return {left: d.scrollLeft, top: d.scrollTop};
4146        }
4147    },
4148
4149   
4150    getColor : function(attr, defaultValue, prefix){
4151        var v = this.getStyle(attr);
4152        if(!v || v == "transparent" || v == "inherit") {
4153            return defaultValue;
4154        }
4155        var color = typeof prefix == "undefined" ? "#" : prefix;
4156        if(v.substr(0, 4) == "rgb("){
4157            var rvs = v.slice(4, v.length -1).split(",");
4158            for(var i = 0; i < 3; i++){
4159                var h = parseInt(rvs[i]);
4160                var s = h.toString(16);
4161                if(h < 16){
4162                    s = "0" + s;
4163                }
4164                color += s;
4165            }
4166        } else {
4167            if(v.substr(0, 1) == "#"){
4168                if(v.length == 4) {
4169                    for(var i = 1; i < 4; i++){
4170                        var c = v.charAt(i);
4171                        color +=  c + c;
4172                    }
4173                }else if(v.length == 7){
4174                    color += v.substr(1);
4175                }
4176            }
4177        }
4178        return(color.length > 5 ? color.toLowerCase() : defaultValue);
4179    },
4180
4181   
4182    boxWrap : function(cls){
4183        cls = cls || 'x-box';
4184        var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
4185        el.child('.'+cls+'-mc').dom.appendChild(this.dom);
4186        return el;
4187    },
4188
4189   
4190    getAttributeNS : Ext.isIE ? function(ns, name){
4191        var d = this.dom;
4192        var type = typeof d[ns+":"+name];
4193        if(type != 'undefined' && type != 'unknown'){
4194            return d[ns+":"+name];
4195        }
4196        return d[name];
4197    } : function(ns, name){
4198        var d = this.dom;
4199        return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
4200    },
4201
4202   
4203    getTextWidth : function(text, min, max){
4204        return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);
4205    }
4206};
4207
4208var ep = El.prototype;
4209
4210
4211ep.on = ep.addListener;
4212    // backwards compat
4213ep.mon = ep.addListener;
4214
4215ep.getUpdateManager = ep.getUpdater;
4216
4217
4218ep.un = ep.removeListener;
4219
4220
4221ep.autoBoxAdjust = true;
4222
4223// private
4224El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
4225
4226// private
4227El.addUnits = function(v, defaultUnit){
4228    if(v === "" || v == "auto"){
4229        return v;
4230    }
4231    if(v === undefined){
4232        return '';
4233    }
4234    if(typeof v == "number" || !El.unitPattern.test(v)){
4235        return v + (defaultUnit || 'px');
4236    }
4237    return v;
4238};
4239
4240// special markup used throughout Ext when box wrapping elements
4241El.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
4242
4243El.VISIBILITY = 1;
4244
4245El.DISPLAY = 2;
4246
4247El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
4248El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
4249El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
4250
4251
4252
4253
4254El.cache = {};
4255
4256var docEl;
4257
4258
4259El.get = function(el){
4260    var ex, elm, id;
4261    if(!el){ return null; }
4262    if(typeof el == "string"){ // element id
4263        if(!(elm = document.getElementById(el))){
4264            return null;
4265        }
4266        if(ex = El.cache[el]){
4267            ex.dom = elm;
4268        }else{
4269            ex = El.cache[el] = new El(elm);
4270        }
4271        return ex;
4272    }else if(el.tagName){ // dom element
4273        if(!(id = el.id)){
4274            id = Ext.id(el);
4275        }
4276        if(ex = El.cache[id]){
4277            ex.dom = el;
4278        }else{
4279            ex = El.cache[id] = new El(el);
4280        }
4281        return ex;
4282    }else if(el instanceof El){
4283        if(el != docEl){
4284            el.dom = document.getElementById(el.id) || el.dom; // refresh dom element in case no longer valid,
4285                                                          // catch case where it hasn't been appended
4286            El.cache[el.id] = el; // in case it was created directly with Element(), let's cache it
4287        }
4288        return el;
4289    }else if(el.isComposite){
4290        return el;
4291    }else if(Ext.isArray(el)){
4292        return El.select(el);
4293    }else if(el == document){
4294        // create a bogus element object representing the document object
4295        if(!docEl){
4296            var f = function(){};
4297            f.prototype = El.prototype;
4298            docEl = new f();
4299            docEl.dom = document;
4300        }
4301        return docEl;
4302    }
4303    return null;
4304};
4305
4306// private
4307El.uncache = function(el){
4308    for(var i = 0, a = arguments, len = a.length; i < len; i++) {
4309        if(a[i]){
4310            delete El.cache[a[i].id || a[i]];
4311        }
4312    }
4313};
4314
4315// private
4316// Garbage collection - uncache elements/purge listeners on orphaned elements
4317// so we don't hold a reference and cause the browser to retain them
4318El.garbageCollect = function(){
4319    if(!Ext.enableGarbageCollector){
4320        clearInterval(El.collectorThread);
4321        return;
4322    }
4323    for(var eid in El.cache){
4324        var el = El.cache[eid], d = el.dom;
4325        // -------------------------------------------------------
4326        // Determining what is garbage:
4327        // -------------------------------------------------------
4328        // !d
4329        // dom node is null, definitely garbage
4330        // -------------------------------------------------------
4331        // !d.parentNode
4332        // no parentNode == direct orphan, definitely garbage
4333        // -------------------------------------------------------
4334        // !d.offsetParent && !document.getElementById(eid)
4335        // display none elements have no offsetParent so we will
4336        // also try to look it up by it's id. However, check
4337        // offsetParent first so we don't do unneeded lookups.
4338        // This enables collection of elements that are not orphans
4339        // directly, but somewhere up the line they have an orphan
4340        // parent.
4341        // -------------------------------------------------------
4342        if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
4343            delete El.cache[eid];
4344            if(d && Ext.enableListenerCollection){
4345                Ext.EventManager.removeAll(d);
4346            }
4347        }
4348    }
4349}
4350El.collectorThreadId = setInterval(El.garbageCollect, 30000);
4351
4352var flyFn = function(){};
4353flyFn.prototype = El.prototype;
4354var _cls = new flyFn();
4355
4356// dom is optional
4357El.Flyweight = function(dom){
4358    this.dom = dom;
4359};
4360
4361El.Flyweight.prototype = _cls;
4362El.Flyweight.prototype.isFlyweight = true;
4363
4364El._flyweights = {};
4365
4366El.fly = function(el, named){
4367    named = named || '_global';
4368    el = Ext.getDom(el);
4369    if(!el){
4370        return null;
4371    }
4372    if(!El._flyweights[named]){
4373        El._flyweights[named] = new El.Flyweight();
4374    }
4375    El._flyweights[named].dom = el;
4376    return El._flyweights[named];
4377};
4378
4379
4380Ext.get = El.get;
4381
4382Ext.fly = El.fly;
4383
4384// speedy lookup for elements never to box adjust
4385var noBoxAdjust = Ext.isStrict ? {
4386    select:1
4387} : {
4388    input:1, select:1, textarea:1
4389};
4390if(Ext.isIE || Ext.isGecko){
4391    noBoxAdjust['button'] = 1;
4392}
4393
4394
4395Ext.EventManager.on(window, 'unload', function(){
4396    delete El.cache;
4397    delete El._flyweights;
4398});
4399})();
4400
4401//Notifies Element that fx methods are available
4402Ext.enableFx = true;
4403
4404
4405Ext.Fx = {
4406       
4407    slideIn : function(anchor, o){
4408        var el = this.getFxEl();
4409        o = o || {};
4410
4411        el.queueFx(o, function(){
4412
4413            anchor = anchor || "t";
4414
4415            // fix display to visibility
4416            this.fixDisplay();
4417
4418            // restore values after effect
4419            var r = this.getFxRestore();
4420            var b = this.getBox();
4421            // fixed size for slide
4422            this.setSize(b);
4423
4424            // wrap if needed
4425            var wrap = this.fxWrap(r.pos, o, "hidden");
4426
4427            var st = this.dom.style;
4428            st.visibility = "visible";
4429            st.position = "absolute";
4430
4431            // clear out temp styles after slide and unwrap
4432            var after = function(){
4433                el.fxUnwrap(wrap, r.pos, o);
4434                st.width = r.width;
4435                st.height = r.height;
4436                el.afterFx(o);
4437            };
4438            // time to calc the positions
4439            var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
4440
4441            switch(anchor.toLowerCase()){
4442                case "t":
4443                    wrap.setSize(b.width, 0);
4444                    st.left = st.bottom = "0";
4445                    a = {height: bh};
4446                break;
4447                case "l":
4448                    wrap.setSize(0, b.height);
4449                    st.right = st.top = "0";
4450                    a = {width: bw};
4451                break;
4452                case "r":
4453                    wrap.setSize(0, b.height);
4454                    wrap.setX(b.right);
4455                    st.left = st.top = "0";
4456                    a = {width: bw, points: pt};
4457                break;
4458                case "b":
4459                    wrap.setSize(b.width, 0);
4460                    wrap.setY(b.bottom);
4461                    st.left = st.top = "0";
4462                    a = {height: bh, points: pt};
4463                break;
4464                case "tl":
4465                    wrap.setSize(0, 0);
4466                    st.right = st.bottom = "0";
4467                    a = {width: bw, height: bh};
4468                break;
4469                case "bl":
4470                    wrap.setSize(0, 0);
4471                    wrap.setY(b.y+b.height);
4472                    st.right = st.top = "0";
4473                    a = {width: bw, height: bh, points: pt};
4474                break;
4475                case "br":
4476                    wrap.setSize(0, 0);
4477                    wrap.setXY([b.right, b.bottom]);
4478                    st.left = st.top = "0";
4479                    a = {width: bw, height: bh, points: pt};
4480                break;
4481                case "tr":
4482                    wrap.setSize(0, 0);
4483                    wrap.setX(b.x+b.width);
4484                    st.left = st.bottom = "0";
4485                    a = {width: bw, height: bh, points: pt};
4486                break;
4487            }
4488            this.dom.style.visibility = "visible";
4489            wrap.show();
4490
4491            arguments.callee.anim = wrap.fxanim(a,
4492                o,
4493                'motion',
4494                .5,
4495                'easeOut', after);
4496        });
4497        return this;
4498    },
4499   
4500       
4501    slideOut : function(anchor, o){
4502        var el = this.getFxEl();
4503        o = o || {};
4504
4505        el.queueFx(o, function(){
4506
4507            anchor = anchor || "t";
4508
4509            // restore values after effect
4510            var r = this.getFxRestore();
4511           
4512            var b = this.getBox();
4513            // fixed size for slide
4514            this.setSize(b);
4515
4516            // wrap if needed
4517            var wrap = this.fxWrap(r.pos, o, "visible");
4518
4519            var st = this.dom.style;
4520            st.visibility = "visible";
4521            st.position = "absolute";
4522
4523            wrap.setSize(b);
4524
4525            var after = function(){
4526                if(o.useDisplay){
4527                    el.setDisplayed(false);
4528                }else{
4529                    el.hide();
4530                }
4531
4532                el.fxUnwrap(wrap, r.pos, o);
4533
4534                st.width = r.width;
4535                st.height = r.height;
4536
4537                el.afterFx(o);
4538            };
4539
4540            var a, zero = {to: 0};
4541            switch(anchor.toLowerCase()){
4542                case "t":
4543                    st.left = st.bottom = "0";
4544                    a = {height: zero};
4545                break;
4546                case "l":
4547                    st.right = st.top = "0";
4548                    a = {width: zero};
4549                break;
4550                case "r":
4551                    st.left = st.top = "0";
4552                    a = {width: zero, points: {to:[b.right, b.y]}};
4553                break;
4554                case "b":
4555                    st.left = st.top = "0";
4556                    a = {height: zero, points: {to:[b.x, b.bottom]}};
4557                break;
4558                case "tl":
4559                    st.right = st.bottom = "0";
4560                    a = {width: zero, height: zero};
4561                break;
4562                case "bl":
4563                    st.right = st.top = "0";
4564                    a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
4565                break;
4566                case "br":
4567                    st.left = st.top = "0";
4568                    a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
4569                break;
4570                case "tr":
4571                    st.left = st.bottom = "0";
4572                    a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
4573                break;
4574            }
4575
4576            arguments.callee.anim = wrap.fxanim(a,
4577                o,
4578                'motion',
4579                .5,
4580                "easeOut", after);
4581        });
4582        return this;
4583    },
4584
4585       
4586    puff : function(o){
4587        var el = this.getFxEl();
4588        o = o || {};
4589
4590        el.queueFx(o, function(){
4591            this.clearOpacity();
4592            this.show();
4593
4594            // restore values after effect
4595            var r = this.getFxRestore();
4596            var st = this.dom.style;
4597
4598            var after = function(){
4599                if(o.useDisplay){
4600                    el.setDisplayed(false);
4601                }else{
4602                    el.hide();
4603                }
4604
4605                el.clearOpacity();
4606
4607                el.setPositioning(r.pos);
4608                st.width = r.width;
4609                st.height = r.height;
4610                st.fontSize = '';
4611                el.afterFx(o);
4612            };
4613
4614            var width = this.getWidth();
4615            var height = this.getHeight();
4616
4617            arguments.callee.anim = this.fxanim({
4618                    width : {to: this.adjustWidth(width * 2)},
4619                    height : {to: this.adjustHeight(height * 2)},
4620                    points : {by: [-(width * .5), -(height * .5)]},
4621                    opacity : {to: 0},
4622                    fontSize: {to:200, unit: "%"}
4623                },
4624                o,
4625                'motion',
4626                .5,
4627                "easeOut", after);
4628        });
4629        return this;
4630    },
4631
4632       
4633    switchOff : function(o){
4634        var el = this.getFxEl();
4635        o = o || {};
4636
4637        el.queueFx(o, function(){
4638            this.clearOpacity();
4639            this.clip();
4640
4641            // restore values after effect
4642            var r = this.getFxRestore();
4643            var st = this.dom.style;
4644
4645            var after = function(){
4646                if(o.useDisplay){
4647                    el.setDisplayed(false);
4648                }else{
4649                    el.hide();
4650                }
4651
4652                el.clearOpacity();
4653                el.setPositioning(r.pos);
4654                st.width = r.width;
4655                st.height = r.height;
4656
4657                el.afterFx(o);
4658            };
4659
4660            this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
4661                this.clearOpacity();
4662                (function(){
4663                    this.fxanim({
4664                        height:{to:1},
4665                        points:{by:[0, this.getHeight() * .5]}
4666                    }, o, 'motion', 0.3, 'easeIn', after);
4667                }).defer(100, this);
4668            });
4669        });
4670        return this;
4671    },
4672
4673       
4674    highlight : function(color, o){
4675        var el = this.getFxEl();
4676        o = o || {};
4677
4678        el.queueFx(o, function(){
4679            color = color || "ffff9c";
4680            var attr = o.attr || "backgroundColor";
4681
4682            this.clearOpacity();
4683            this.show();
4684
4685            var origColor = this.getColor(attr);
4686            var restoreColor = this.dom.style[attr];
4687            var endColor = (o.endColor || origColor) || "ffffff";
4688
4689            var after = function(){
4690                el.dom.style[attr] = restoreColor;
4691                el.afterFx(o);
4692            };
4693
4694            var a = {};
4695            a[attr] = {from: color, to: endColor};
4696            arguments.callee.anim = this.fxanim(a,
4697                o,
4698                'color',
4699                1,
4700                'easeIn', after);
4701        });
4702        return this;
4703    },
4704
4705   
4706    frame : function(color, count, o){
4707        var el = this.getFxEl();
4708        o = o || {};
4709
4710        el.queueFx(o, function(){
4711            color = color || "#C3DAF9";
4712            if(color.length == 6){
4713                color = "#" + color;
4714            }
4715            count = count || 1;
4716            var duration = o.duration || 1;
4717            this.show();
4718
4719            var b = this.getBox();
4720            var animFn = function(){
4721                var proxy = Ext.getBody().createChild({
4722                     style:{
4723                        visbility:"hidden",
4724                        position:"absolute",
4725                        "z-index":"35000", // yee haw
4726                        border:"0px solid " + color
4727                     }
4728                  });
4729                var scale = Ext.isBorderBox ? 2 : 1;
4730                proxy.animate({
4731                    top:{from:b.y, to:b.y - 20},
4732                    left:{from:b.x, to:b.x - 20},
4733                    borderWidth:{from:0, to:10},
4734                    opacity:{from:1, to:0},
4735                    height:{from:b.height, to:(b.height + (20*scale))},
4736                    width:{from:b.width, to:(b.width + (20*scale))}
4737                }, duration, function(){
4738                    proxy.remove();
4739                    if(--count > 0){
4740                         animFn();
4741                    }else{
4742                        el.afterFx(o);
4743                    }
4744                });
4745            };
4746            animFn.call(this);
4747        });
4748        return this;
4749    },
4750
4751   
4752    pause : function(seconds){
4753        var el = this.getFxEl();
4754        var o = {};
4755
4756        el.queueFx(o, function(){
4757            setTimeout(function(){
4758                el.afterFx(o);
4759            }, seconds * 1000);
4760        });
4761        return this;
4762    },
4763
4764   
4765    fadeIn : function(o){
4766        var el = this.getFxEl();
4767        o = o || {};
4768        el.queueFx(o, function(){
4769            this.setOpacity(0);
4770            this.fixDisplay();
4771            this.dom.style.visibility = 'visible';
4772            var to = o.endOpacity || 1;
4773            arguments.callee.anim = this.fxanim({opacity:{to:to}},
4774                o, null, .5, "easeOut", function(){
4775                if(to == 1){
4776                    this.clearOpacity();
4777                }
4778                el.afterFx(o);
4779            });
4780        });
4781        return this;
4782    },
4783
4784   
4785    fadeOut : function(o){
4786        var el = this.getFxEl();
4787        o = o || {};
4788        el.queueFx(o, function(){
4789            var to = o.endOpacity || 0;
4790            arguments.callee.anim = this.fxanim({opacity:{to:to}},
4791                o, null, .5, "easeOut", function(){
4792                if(to === 0){
4793                    if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){
4794                         this.dom.style.display = "none";
4795                    }else{
4796                         this.dom.style.visibility = "hidden";
4797                    }
4798                    this.clearOpacity();
4799                }
4800                el.afterFx(o);
4801            });
4802        });
4803        return this;
4804    },
4805
4806   
4807    scale : function(w, h, o){
4808        this.shift(Ext.apply({}, o, {
4809            width: w,
4810            height: h
4811        }));
4812        return this;
4813    },
4814
4815   
4816    shift : function(o){
4817        var el = this.getFxEl();
4818        o = o || {};
4819        el.queueFx(o, function(){
4820            var a = {}, w = o.width, h = o.height, x = o.x, y = o.y,  op = o.opacity;
4821            if(w !== undefined){
4822                a.width = {to: this.adjustWidth(w)};
4823            }
4824            if(h !== undefined){
4825                a.height = {to: this.adjustHeight(h)};
4826            }
4827            if(o.left !== undefined){
4828                a.left = {to: o.left};
4829            }
4830            if(o.top !== undefined){
4831                a.top = {to: o.top};
4832            }
4833            if(o.right !== undefined){
4834                a.right = {to: o.right};
4835            }
4836            if(o.bottom !== undefined){
4837                a.bottom = {to: o.bottom};
4838            }
4839            if(x !== undefined || y !== undefined){
4840                a.points = {to: [
4841                    x !== undefined ? x : this.getX(),
4842                    y !== undefined ? y : this.getY()
4843                ]};
4844            }
4845            if(op !== undefined){
4846                a.opacity = {to: op};
4847            }
4848            if(o.xy !== undefined){
4849                a.points = {to: o.xy};
4850            }
4851            arguments.callee.anim = this.fxanim(a,
4852                o, 'motion', .35, "easeOut", function(){
4853                el.afterFx(o);
4854            });
4855        });
4856        return this;
4857    },
4858
4859       
4860    ghost : function(anchor, o){
4861        var el = this.getFxEl();
4862        o = o || {};
4863
4864        el.queueFx(o, function(){
4865            anchor = anchor || "b";
4866
4867            // restore values after effect
4868            var r = this.getFxRestore();
4869            var w = this.getWidth(),
4870                h = this.getHeight();
4871
4872            var st = this.dom.style;
4873
4874            var after = function(){
4875                if(o.useDisplay){
4876                    el.setDisplayed(false);
4877                }else{
4878                    el.hide();
4879                }
4880
4881                el.clearOpacity();
4882                el.setPositioning(r.pos);
4883                st.width = r.width;
4884                st.height = r.height;
4885
4886                el.afterFx(o);
4887            };
4888
4889            var a = {opacity: {to: 0}, points: {}}, pt = a.points;
4890            switch(anchor.toLowerCase()){
4891                case "t":
4892                    pt.by = [0, -h];
4893                break;
4894                case "l":
4895                    pt.by = [-w, 0];
4896                break;
4897                case "r":
4898                    pt.by = [w, 0];
4899                break;
4900                case "b":
4901                    pt.by = [0, h];
4902                break;
4903                case "tl":
4904                    pt.by = [-w, -h];
4905                break;
4906                case "bl":
4907                    pt.by = [-w, h];
4908                break;
4909                case "br":
4910                    pt.by = [w, h];
4911                break;
4912                case "tr":
4913                    pt.by = [w, -h];
4914                break;
4915            }
4916
4917            arguments.callee.anim = this.fxanim(a,
4918                o,
4919                'motion',
4920                .5,
4921                "easeOut", after);
4922        });
4923        return this;
4924    },
4925
4926       
4927    syncFx : function(){
4928        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4929            block : false,
4930            concurrent : true,
4931            stopFx : false
4932        });
4933        return this;
4934    },
4935
4936       
4937    sequenceFx : function(){
4938        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4939            block : false,
4940            concurrent : false,
4941            stopFx : false
4942        });
4943        return this;
4944    },
4945
4946       
4947    nextFx : function(){
4948        var ef = this.fxQueue[0];
4949        if(ef){
4950            ef.call(this);
4951        }
4952    },
4953
4954       
4955    hasActiveFx : function(){
4956        return this.fxQueue && this.fxQueue[0];
4957    },
4958
4959       
4960    stopFx : function(){
4961        if(this.hasActiveFx()){
4962            var cur = this.fxQueue[0];
4963            if(cur && cur.anim && cur.anim.isAnimated()){
4964                this.fxQueue = [cur]; // clear out others
4965                cur.anim.stop(true);
4966            }
4967        }
4968        return this;
4969    },
4970
4971       
4972    beforeFx : function(o){
4973        if(this.hasActiveFx() && !o.concurrent){
4974           if(o.stopFx){
4975               this.stopFx();
4976               return true;
4977           }
4978           return false;
4979        }
4980        return true;
4981    },
4982
4983       
4984    hasFxBlock : function(){
4985        var q = this.fxQueue;
4986        return q && q[0] && q[0].block;
4987    },
4988
4989       
4990    queueFx : function(o, fn){
4991        if(!this.fxQueue){
4992            this.fxQueue = [];
4993        }
4994        if(!this.hasFxBlock()){
4995            Ext.applyIf(o, this.fxDefaults);
4996            if(!o.concurrent){
4997                var run = this.beforeFx(o);
4998                fn.block = o.block;
4999                this.fxQueue.push(fn);
5000                if(run){
5001                    this.nextFx();
5002                }
5003            }else{
5004                fn.call(this);
5005            }
5006        }
5007        return this;
5008    },
5009
5010       
5011    fxWrap : function(pos, o, vis){
5012        var wrap;
5013        if(!o.wrap || !(wrap = Ext.get(o.wrap))){
5014            var wrapXY;
5015            if(o.fixPosition){
5016                wrapXY = this.getXY();
5017            }
5018            var div = document.createElement("div");
5019            div.style.visibility = vis;
5020            wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
5021            wrap.setPositioning(pos);
5022            if(wrap.getStyle("position") == "static"){
5023                wrap.position("relative");
5024            }
5025            this.clearPositioning('auto');
5026            wrap.clip();
5027            wrap.dom.appendChild(this.dom);
5028            if(wrapXY){
5029                wrap.setXY(wrapXY);
5030            }
5031        }
5032        return wrap;
5033    },
5034
5035       
5036    fxUnwrap : function(wrap, pos, o){
5037        this.clearPositioning();
5038        this.setPositioning(pos);
5039        if(!o.wrap){
5040            wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
5041            wrap.remove();
5042        }
5043    },
5044
5045       
5046    getFxRestore : function(){
5047        var st = this.dom.style;
5048        return {pos: this.getPositioning(), width: st.width, height : st.height};
5049    },
5050
5051       
5052    afterFx : function(o){
5053        if(o.afterStyle){
5054            this.applyStyles(o.afterStyle);
5055        }
5056        if(o.afterCls){
5057            this.addClass(o.afterCls);
5058        }
5059        if(o.remove === true){
5060            this.remove();
5061        }
5062        Ext.callback(o.callback, o.scope, [this]);
5063        if(!o.concurrent){
5064            this.fxQueue.shift();
5065            this.nextFx();
5066        }
5067    },
5068
5069       
5070    getFxEl : function(){ // support for composite element fx
5071        return Ext.get(this.dom);
5072    },
5073
5074       
5075    fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
5076        animType = animType || 'run';
5077        opt = opt || {};
5078        var anim = Ext.lib.Anim[animType](
5079            this.dom, args,
5080            (opt.duration || defaultDur) || .35,
5081            (opt.easing || defaultEase) || 'easeOut',
5082            function(){
5083                Ext.callback(cb, this);
5084            },
5085            this
5086        );
5087        opt.anim = anim;
5088        return anim;
5089    }
5090};
5091
5092// backwords compat
5093Ext.Fx.resize = Ext.Fx.scale;
5094
5095//When included, Ext.Fx is automatically applied to Element so that all basic
5096//effects are available directly via the Element API
5097Ext.apply(Ext.Element.prototype, Ext.Fx);
5098
5099
5100Ext.CompositeElement = function(els){
5101    this.elements = [];
5102    this.addElements(els);
5103};
5104Ext.CompositeElement.prototype = {
5105    isComposite: true,
5106    addElements : function(els){
5107        if(!els) return this;
5108        if(typeof els == "string"){
5109            els = Ext.Element.selectorFunction(els);
5110        }
5111        var yels = this.elements;
5112        var index = yels.length-1;
5113        for(var i = 0, len = els.length; i < len; i++) {
5114                yels[++index] = Ext.get(els[i]);
5115        }
5116        return this;
5117    },
5118
5119   
5120    fill : function(els){
5121        this.elements = [];
5122        this.add(els);
5123        return this;
5124    },
5125
5126   
5127    filter : function(selector){
5128        var els = [];
5129        this.each(function(el){
5130            if(el.is(selector)){
5131                els[els.length] = el.dom;
5132            }
5133        });
5134        this.fill(els);
5135        return this;
5136    },
5137
5138    invoke : function(fn, args){
5139        var els = this.elements;
5140        for(var i = 0, len = els.length; i < len; i++) {
5141                Ext.Element.prototype[fn].apply(els[i], args);
5142        }
5143        return this;
5144    },
5145   
5146    add : function(els){
5147        if(typeof els == "string"){
5148            this.addElements(Ext.Element.selectorFunction(els));
5149        }else if(els.length !== undefined){
5150            this.addElements(els);
5151        }else{
5152            this.addElements([els]);
5153        }
5154        return this;
5155    },
5156   
5157    each : function(fn, scope){
5158        var els = this.elements;
5159        for(var i = 0, len = els.length; i < len; i++){
5160            if(fn.call(scope || els[i], els[i], this, i) === false) {
5161                break;
5162            }
5163        }
5164        return this;
5165    },
5166
5167   
5168    item : function(index){
5169        return this.elements[index] || null;
5170    },
5171
5172   
5173    first : function(){
5174        return this.item(0);
5175    },
5176
5177   
5178    last : function(){
5179        return this.item(this.elements.length-1);
5180    },
5181
5182   
5183    getCount : function(){
5184        return this.elements.length;
5185    },
5186
5187   
5188    contains : function(el){
5189        return this.indexOf(el) !== -1;
5190    },
5191
5192   
5193    indexOf : function(el){
5194        return this.elements.indexOf(Ext.get(el));
5195    },
5196
5197
5198   
5199    removeElement : function(el, removeDom){
5200        if(Ext.isArray(el)){
5201            for(var i = 0, len = el.length; i < len; i++){
5202                this.removeElement(el[i]);
5203            }
5204            return this;
5205        }
5206        var index = typeof el == 'number' ? el : this.indexOf(el);
5207        if(index !== -1 && this.elements[index]){
5208            if(removeDom){
5209                var d = this.elements[index];
5210                if(d.dom){
5211                    d.remove();
5212                }else{
5213                    Ext.removeNode(d);
5214                }
5215            }
5216            this.elements.splice(index, 1);
5217        }
5218        return this;
5219    },
5220
5221   
5222    replaceElement : function(el, replacement, domReplace){
5223        var index = typeof el == 'number' ? el : this.indexOf(el);
5224        if(index !== -1){
5225            if(domReplace){
5226                this.elements[index].replaceWith(replacement);
5227            }else{
5228                this.elements.splice(index, 1, Ext.get(replacement))
5229            }
5230        }
5231        return this;
5232    },
5233
5234   
5235    clear : function(){
5236        this.elements = [];
5237    }
5238};
5239(function(){
5240Ext.CompositeElement.createCall = function(proto, fnName){
5241    if(!proto[fnName]){
5242        proto[fnName] = function(){
5243            return this.invoke(fnName, arguments);
5244        };
5245    }
5246};
5247for(var fnName in Ext.Element.prototype){
5248    if(typeof Ext.Element.prototype[fnName] == "function"){
5249        Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
5250    }
5251};
5252})();
5253
5254
5255Ext.CompositeElementLite = function(els){
5256    Ext.CompositeElementLite.superclass.constructor.call(this, els);
5257    this.el = new Ext.Element.Flyweight();
5258};
5259Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
5260    addElements : function(els){
5261        if(els){
5262            if(Ext.isArray(els)){
5263                this.elements = this.elements.concat(els);
5264            }else{
5265                var yels = this.elements;
5266                var index = yels.length-1;
5267                for(var i = 0, len = els.length; i < len; i++) {
5268                    yels[++index] = els[i];
5269                }
5270            }
5271        }
5272        return this;
5273    },
5274    invoke : function(fn, args){
5275        var els = this.elements;
5276        var el = this.el;
5277        for(var i = 0, len = els.length; i < len; i++) {
5278            el.dom = els[i];
5279                Ext.Element.prototype[fn].apply(el, args);
5280        }
5281        return this;
5282    },
5283   
5284    item : function(index){
5285        if(!this.elements[index]){
5286            return null;
5287        }
5288        this.el.dom = this.elements[index];
5289        return this.el;
5290    },
5291
5292    // fixes scope with flyweight
5293    addListener : function(eventName, handler, scope, opt){
5294        var els = this.elements;
5295        for(var i = 0, len = els.length; i < len; i++) {
5296            Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
5297        }
5298        return this;
5299    },
5300
5301   
5302    each : function(fn, scope){
5303        var els = this.elements;
5304        var el = this.el;
5305        for(var i = 0, len = els.length; i < len; i++){
5306            el.dom = els[i];
5307                if(fn.call(scope || el, el, this, i) === false){
5308                break;
5309            }
5310        }
5311        return this;
5312    },
5313
5314    indexOf : function(el){
5315        return this.elements.indexOf(Ext.getDom(el));
5316    },
5317
5318    replaceElement : function(el, replacement, domReplace){
5319        var index = typeof el == 'number' ? el : this.indexOf(el);
5320        if(index !== -1){
5321            replacement = Ext.getDom(replacement);
5322            if(domReplace){
5323                var d = this.elements[index];
5324                d.parentNode.insertBefore(replacement, d);
5325                Ext.removeNode(d);
5326            }
5327            this.elements.splice(index, 1, replacement);
5328        }
5329        return this;
5330    }
5331});
5332Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
5333if(Ext.DomQuery){
5334    Ext.Element.selectorFunction = Ext.DomQuery.select;
5335}
5336
5337Ext.Element.select = function(selector, unique, root){
5338    var els;
5339    if(typeof selector == "string"){
5340        els = Ext.Element.selectorFunction(selector, root);
5341    }else if(selector.length !== undefined){
5342        els = selector;
5343    }else{
5344        throw "Invalid selector";
5345    }
5346    if(unique === true){
5347        return new Ext.CompositeElement(els);
5348    }else{
5349        return new Ext.CompositeElementLite(els);
5350    }
5351};
5352
5353Ext.select = Ext.Element.select;
5354
5355Ext.data.Connection = function(config){
5356    Ext.apply(this, config);
5357    this.addEvents(
5358       
5359        "beforerequest",
5360       
5361        "requestcomplete",
5362       
5363        "requestexception"
5364    );
5365    Ext.data.Connection.superclass.constructor.call(this);
5366};
5367
5368Ext.extend(Ext.data.Connection, Ext.util.Observable, {
5369   
5370   
5371   
5372   
5373   
5374    timeout : 30000,
5375   
5376    autoAbort:false,
5377
5378   
5379    disableCaching: true,
5380   
5381   
5382    disableCachingParam: '_dc',
5383   
5384
5385   
5386    request : function(o){
5387        if(this.fireEvent("beforerequest", this, o) !== false){
5388            var p = o.params;
5389
5390            if(typeof p == "function"){
5391                p = p.call(o.scope||window, o);
5392            }
5393            if(typeof p == "object"){
5394                p = Ext.urlEncode(p);
5395            }
5396            if(this.extraParams){
5397                var extras = Ext.urlEncode(this.extraParams);
5398                p = p ? (p + '&' + extras) : extras;
5399            }
5400
5401            var url = o.url || this.url;
5402            if(typeof url == 'function'){
5403                url = url.call(o.scope||window, o);
5404            }
5405
5406            if(o.form){
5407                var form = Ext.getDom(o.form);
5408                url = url || form.action;
5409
5410                var enctype = form.getAttribute("enctype");
5411                if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
5412                    return this.doFormUpload(o, p, url);
5413                }
5414                var f = Ext.lib.Ajax.serializeForm(form);
5415                p = p ? (p + '&' + f) : f;
5416            }
5417
5418            var hs = o.headers;
5419            if(this.defaultHeaders){
5420                hs = Ext.apply(hs || {}, this.defaultHeaders);
5421                if(!o.headers){
5422                    o.headers = hs;
5423                }
5424            }
5425
5426            var cb = {
5427                success: this.handleResponse,
5428                failure: this.handleFailure,
5429                scope: this,
5430                argument: {options: o},
5431                timeout : o.timeout || this.timeout
5432            };
5433
5434            var method = o.method||this.method||((p || o.xmlData || o.jsonData) ? "POST" : "GET");
5435
5436            if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
5437                var dcp = o.disableCachingParam || this.disableCachingParam;
5438                url += (url.indexOf('?') != -1 ? '&' : '?') + dcp + '=' + (new Date().getTime());
5439            }
5440
5441            if(typeof o.autoAbort == 'boolean'){ // options gets top priority
5442                if(o.autoAbort){
5443                    this.abort();
5444                }
5445            }else if(this.autoAbort !== false){
5446                this.abort();
5447            }
5448            if((method == 'GET' || o.xmlData || o.jsonData) && p){
5449                url += (url.indexOf('?') != -1 ? '&' : '?') + p;
5450                p = '';
5451            }
5452            this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
5453            return this.transId;
5454        }else{
5455            Ext.callback(o.callback, o.scope, [o, null, null]);
5456            return null;
5457        }
5458    },
5459
5460   
5461    isLoading : function(transId){
5462        if(transId){
5463            return Ext.lib.Ajax.isCallInProgress(transId);
5464        }else{
5465            return this.transId ? true : false;
5466        }
5467    },
5468
5469   
5470    abort : function(transId){
5471        if(transId || this.isLoading()){
5472            Ext.lib.Ajax.abort(transId || this.transId);
5473        }
5474    },
5475
5476    // private
5477    handleResponse : function(response){
5478        this.transId = false;
5479        var options = response.argument.options;
5480        response.argument = options ? options.argument : null;
5481        this.fireEvent("requestcomplete", this, response, options);
5482        Ext.callback(options.success, options.scope, [response, options]);
5483        Ext.callback(options.callback, options.scope, [options, true, response]);
5484    },
5485
5486    // private
5487    handleFailure : function(response, e){
5488        this.transId = false;
5489        var options = response.argument.options;
5490        response.argument = options ? options.argument : null;
5491        this.fireEvent("requestexception", this, response, options, e);
5492        Ext.callback(options.failure, options.scope, [response, options]);
5493        Ext.callback(options.callback, options.scope, [options, false, response]);
5494    },
5495
5496    // private
5497    doFormUpload : function(o, ps, url){
5498        var id = Ext.id();
5499        var frame = document.createElement('iframe');
5500        frame.id = id;
5501        frame.name = id;
5502        frame.className = 'x-hidden';
5503        if(Ext.isIE){
5504            frame.src = Ext.SSL_SECURE_URL;
5505        }
5506        document.body.appendChild(frame);
5507
5508        if(Ext.isIE){
5509           document.frames[id].name = id;
5510        }
5511
5512        var form = Ext.getDom(o.form);
5513        form.target = id;
5514        form.method = 'POST';
5515        form.enctype = form.encoding = 'multipart/form-data';
5516        if(url){
5517            form.action = url;
5518        }
5519
5520        var hiddens, hd;
5521        if(ps){ // add dynamic params
5522            hiddens = [];
5523            ps = Ext.urlDecode(ps, false);
5524            for(var k in ps){
5525                if(ps.hasOwnProperty(k)){
5526                    hd = document.createElement('input');
5527                    hd.type = 'hidden';
5528                    hd.name = k;
5529                    hd.value = ps[k];
5530                    form.appendChild(hd);
5531                    hiddens.push(hd);
5532                }
5533            }
5534        }
5535
5536        function cb(){
5537            var r = {  // bogus response object
5538                responseText : '',
5539                responseXML : null
5540            };
5541
5542            r.argument = o ? o.argument : null;
5543
5544            try { //
5545                var doc;
5546                if(Ext.isIE){
5547                    doc = frame.contentWindow.document;
5548                }else {
5549                    doc = (frame.contentDocument || window.frames[id].document);
5550                }
5551                if(doc && doc.body){
5552                    r.responseText = doc.body.innerHTML;
5553                }
5554                if(doc && doc.XMLDocument){
5555                    r.responseXML = doc.XMLDocument;
5556                }else {
5557                    r.responseXML = doc;
5558                }
5559            }
5560            catch(e) {
5561                // ignore
5562            }
5563
5564            Ext.EventManager.removeListener(frame, 'load', cb, this);
5565
5566            this.fireEvent("requestcomplete", this, r, o);
5567
5568            Ext.callback(o.success, o.scope, [r, o]);
5569            Ext.callback(o.callback, o.scope, [o, true, r]);
5570
5571            setTimeout(function(){Ext.removeNode(frame);}, 100);
5572        }
5573
5574        Ext.EventManager.on(frame, 'load', cb, this);
5575        form.submit();
5576
5577        if(hiddens){ // remove dynamic params
5578            for(var i = 0, len = hiddens.length; i < len; i++){
5579                Ext.removeNode(hiddens[i]);
5580            }
5581        }
5582    }
5583});
5584
5585
5586Ext.Ajax = new Ext.data.Connection({
5587   
5588   
5589   
5590   
5591   
5592   
5593
5594   
5595
5596   
5597   
5598   
5599   
5600   
5601   
5602
5603   
5604    autoAbort : false,
5605
5606   
5607    serializeForm : function(form){
5608        return Ext.lib.Ajax.serializeForm(form);
5609    }
5610});
5611
5612Ext.Updater = Ext.extend(Ext.util.Observable, {
5613    constructor: function(el, forceNew){
5614        el = Ext.get(el);
5615        if(!forceNew && el.updateManager){
5616            return el.updateManager;
5617        }
5618       
5619        this.el = el;
5620       
5621        this.defaultUrl = null;
5622
5623        this.addEvents(
5624           
5625            "beforeupdate",
5626           
5627            "update",
5628           
5629            "failure"
5630        );
5631        var d = Ext.Updater.defaults;
5632       
5633        this.sslBlankUrl = d.sslBlankUrl;
5634       
5635        this.disableCaching = d.disableCaching;
5636       
5637        this.indicatorText = d.indicatorText;
5638       
5639        this.showLoadIndicator = d.showLoadIndicator;
5640       
5641        this.timeout = d.timeout;
5642       
5643        this.loadScripts = d.loadScripts;
5644       
5645        this.transaction = null;
5646       
5647        this.refreshDelegate = this.refresh.createDelegate(this);
5648       
5649        this.updateDelegate = this.update.createDelegate(this);
5650       
5651        this.formUpdateDelegate = this.formUpdate.createDelegate(this);
5652
5653        if(!this.renderer){
5654         
5655        this.renderer = this.getDefaultRenderer();
5656        }
5657        Ext.Updater.superclass.constructor.call(this);
5658    },
5659   
5660    getDefaultRenderer: function() {
5661        return new Ext.Updater.BasicRenderer();
5662    },
5663   
5664    getEl : function(){
5665        return this.el;
5666    },
5667
5668   
5669    update : function(url, params, callback, discardUrl){
5670        if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
5671            var cfg, callerScope;
5672            if(typeof url == "object"){ // must be config object
5673                cfg = url;
5674                url = cfg.url;
5675                params = params || cfg.params;
5676                callback = callback || cfg.callback;
5677                discardUrl = discardUrl || cfg.discardUrl;
5678                callerScope = cfg.scope;
5679                if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
5680                if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
5681                if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
5682                if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
5683            }
5684            this.showLoading();
5685
5686            if(!discardUrl){
5687                this.defaultUrl = url;
5688            }
5689            if(typeof url == "function"){
5690                url = url.call(this);
5691            }
5692
5693            var o = Ext.apply({}, {
5694                url : url,
5695                params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,
5696                success: this.processSuccess,
5697                failure: this.processFailure,
5698                scope: this,
5699                callback: undefined,
5700                timeout: (this.timeout*1000),
5701                disableCaching: this.disableCaching,
5702                argument: {
5703                    "options": cfg,
5704                    "url": url,
5705                    "form": null,
5706                    "callback": callback,
5707                    "scope": callerScope || window,
5708                    "params": params
5709                }
5710            }, cfg);
5711
5712            this.transaction = Ext.Ajax.request(o);
5713        }
5714    },
5715
5716   
5717    formUpdate : function(form, url, reset, callback){
5718        if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
5719            if(typeof url == "function"){
5720                url = url.call(this);
5721            }
5722            form = Ext.getDom(form)
5723            this.transaction = Ext.Ajax.request({
5724                form: form,
5725                url:url,
5726                success: this.processSuccess,
5727                failure: this.processFailure,
5728                scope: this,
5729                timeout: (this.timeout*1000),
5730                argument: {
5731                    "url": url,
5732                    "form": form,
5733                    "callback": callback,
5734                    "reset": reset
5735                }
5736            });
5737            this.showLoading.defer(1, this);
5738        }
5739    },
5740
5741   
5742    refresh : function(callback){
5743        if(this.defaultUrl == null){
5744            return;
5745        }
5746        this.update(this.defaultUrl, null, callback, true);
5747    },
5748
5749   
5750    startAutoRefresh : function(interval, url, params, callback, refreshNow){
5751        if(refreshNow){
5752            this.update(url || this.defaultUrl, params, callback, true);
5753        }
5754        if(this.autoRefreshProcId){
5755            clearInterval(this.autoRefreshProcId);
5756        }
5757        this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
5758    },
5759
5760   
5761     stopAutoRefresh : function(){
5762        if(this.autoRefreshProcId){
5763            clearInterval(this.autoRefreshProcId);
5764            delete this.autoRefreshProcId;
5765        }
5766    },
5767
5768   
5769    isAutoRefreshing : function(){
5770       return this.autoRefreshProcId ? true : false;
5771    },
5772
5773   
5774    showLoading : function(){
5775        if(this.showLoadIndicator){
5776            this.el.update(this.indicatorText);
5777        }
5778    },
5779
5780    // private
5781    processSuccess : function(response){
5782        this.transaction = null;
5783        if(response.argument.form && response.argument.reset){
5784            try{ // put in try/catch since some older FF releases had problems with this
5785                response.argument.form.reset();
5786            }catch(e){}
5787        }
5788        if(this.loadScripts){
5789            this.renderer.render(this.el, response, this,
5790                this.updateComplete.createDelegate(this, [response]));
5791        }else{
5792            this.renderer.render(this.el, response, this);
5793            this.updateComplete(response);
5794        }
5795    },
5796
5797    // private
5798    updateComplete : function(response){
5799        this.fireEvent("update", this.el, response);
5800        if(typeof response.argument.callback == "function"){
5801            response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);
5802        }
5803    },
5804
5805    // private
5806    processFailure : function(response){
5807        this.transaction = null;
5808        this.fireEvent("failure", this.el, response);
5809        if(typeof response.argument.callback == "function"){
5810            response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);
5811        }
5812    },
5813
5814   
5815    setRenderer : function(renderer){
5816        this.renderer = renderer;
5817    },
5818
5819   
5820    getRenderer : function(){
5821       return this.renderer;
5822    },
5823
5824   
5825    setDefaultUrl : function(defaultUrl){
5826        this.defaultUrl = defaultUrl;
5827    },
5828
5829   
5830    abort : function(){
5831        if(this.transaction){
5832            Ext.Ajax.abort(this.transaction);
5833        }
5834    },
5835
5836   
5837    isUpdating : function(){
5838        if(this.transaction){
5839            return Ext.Ajax.isLoading(this.transaction);
5840        }
5841        return false;
5842    }
5843});
5844
5845
5846   Ext.Updater.defaults = {
5847       
5848         timeout : 30,
5849         
5850        loadScripts : false,
5851       
5852        sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
5853       
5854        disableCaching : false,
5855       
5856        showLoadIndicator : true,
5857       
5858        indicatorText : '<div class="loading-indicator">Loading...</div>'
5859   };
5860
5861
5862Ext.Updater.updateElement = function(el, url, params, options){
5863    var um = Ext.get(el).getUpdater();
5864    Ext.apply(um, options);
5865    um.update(url, params, options ? options.callback : null);
5866};
5867
5868Ext.Updater.BasicRenderer = function(){};
5869
5870Ext.Updater.BasicRenderer.prototype = {
5871   
5872     render : function(el, response, updateManager, callback){
5873        el.update(response.responseText, updateManager.loadScripts, callback);
5874    }
5875};
5876
5877Ext.UpdateManager = Ext.Updater;
5878
5879
5880Ext.util.DelayedTask = function(fn, scope, args){
5881    var id = null, d, t;
5882
5883    var call = function(){
5884        var now = new Date().getTime();
5885        if(now - t >= d){
5886            clearInterval(id);
5887            id = null;
5888            fn.apply(scope, args || []);
5889        }
5890    };
5891   
5892    this.delay = function(delay, newFn, newScope, newArgs){
5893        if(id && delay != d){
5894            this.cancel();
5895        }
5896        d = delay;
5897        t = new Date().getTime();
5898        fn = newFn || fn;
5899        scope = newScope || scope;
5900        args = newArgs || args;
5901        if(!id){
5902            id = setInterval(call, d);
5903        }
5904    };
5905
5906   
5907    this.cancel = function(){
5908        if(id){
5909            clearInterval(id);
5910            id = null;
5911        }
5912    };
5913};
Note: See TracBrowser for help on using the repository browser.