PageRenderTime 129ms CodeModel.GetById 11ms app.highlight 103ms RepoModel.GetById 2ms app.codeStats 0ms

/source/Plug-in/ext/ext-core-debug.js

http://prosporous.googlecode.com/
JavaScript | 2229 lines | 1857 code | 365 blank | 7 comment | 609 complexity | 7b1fa621de361992b8dcd0e87e1a91b4 MD5 | raw file
   1/*
   2 * Ext JS Library 2.2
   3 * Copyright(c) 2006-2008, 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        var createHtml = function(o){
  16        if(typeof o == 'string'){
  17            return o;
  18        }
  19        var b = "";
  20        if (Ext.isArray(o)) {
  21            for (var i = 0, l = o.length; i < l; i++) {
  22                b += createHtml(o[i]);
  23            }
  24            return b;
  25        }
  26        if(!o.tag){
  27            o.tag = "div";
  28        }
  29        b += "<" + o.tag;
  30        for(var attr in o){
  31            if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;
  32            if(attr == "style"){
  33                var s = o["style"];
  34                if(typeof s == "function"){
  35                    s = s.call();
  36                }
  37                if(typeof s == "string"){
  38                    b += ' style="' + s + '"';
  39                }else if(typeof s == "object"){
  40                    b += ' style="';
  41                    for(var key in s){
  42                        if(typeof s[key] != "function"){
  43                            b += key + ":" + s[key] + ";";
  44                        }
  45                    }
  46                    b += '"';
  47                }
  48            }else{
  49                if(attr == "cls"){
  50                    b += ' class="' + o["cls"] + '"';
  51                }else if(attr == "htmlFor"){
  52                    b += ' for="' + o["htmlFor"] + '"';
  53                }else{
  54                    b += " " + attr + '="' + o[attr] + '"';
  55                }
  56            }
  57        }
  58        if(emptyTags.test(o.tag)){
  59            b += "/>";
  60        }else{
  61            b += ">";
  62            var cn = o.children || o.cn;
  63            if(cn){
  64                b += createHtml(cn);
  65            } else if(o.html){
  66                b += o.html;
  67            }
  68            b += "</" + o.tag + ">";
  69        }
  70        return b;
  71    };
  72
  73        
  74    var createDom = function(o, parentNode){
  75        var el;
  76        if (Ext.isArray(o)) {                                   el = document.createDocumentFragment();             for(var i = 0, l = o.length; i < l; i++) {
  77                createDom(o[i], el);
  78            }
  79        } else if (typeof o == "string") {                     el = document.createTextNode(o);
  80        } else {
  81            el = document.createElement(o.tag||'div');
  82            var useSet = !!el.setAttribute;             for(var attr in o){
  83                if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;
  84                if(attr=="cls"){
  85                    el.className = o["cls"];
  86                }else{
  87                    if(useSet) el.setAttribute(attr, o[attr]);
  88                    else el[attr] = o[attr];
  89                }
  90            }
  91            Ext.DomHelper.applyStyles(el, o.style);
  92            var cn = o.children || o.cn;
  93            if(cn){
  94                createDom(cn, el);
  95            } else if(o.html){
  96                el.innerHTML = o.html;
  97            }
  98        }
  99        if(parentNode){
 100           parentNode.appendChild(el);
 101        }
 102        return el;
 103    };
 104
 105    var ieTable = function(depth, s, h, e){
 106        tempTableEl.innerHTML = [s, h, e].join('');
 107        var i = -1, el = tempTableEl;
 108        while(++i < depth){
 109            el = el.firstChild;
 110        }
 111        return el;
 112    };
 113
 114        var ts = '<table>',
 115        te = '</table>',
 116        tbs = ts+'<tbody>',
 117        tbe = '</tbody>'+te,
 118        trs = tbs + '<tr>',
 119        tre = '</tr>'+tbe;
 120
 121    
 122    var insertIntoTable = function(tag, where, el, html){
 123        if(!tempTableEl){
 124            tempTableEl = document.createElement('div');
 125        }
 126        var node;
 127        var before = null;
 128        if(tag == 'td'){
 129            if(where == 'afterbegin' || where == 'beforeend'){                 return;
 130            }
 131            if(where == 'beforebegin'){
 132                before = el;
 133                el = el.parentNode;
 134            } else{
 135                before = el.nextSibling;
 136                el = el.parentNode;
 137            }
 138            node = ieTable(4, trs, html, tre);
 139        }
 140        else if(tag == 'tr'){
 141            if(where == 'beforebegin'){
 142                before = el;
 143                el = el.parentNode;
 144                node = ieTable(3, tbs, html, tbe);
 145            } else if(where == 'afterend'){
 146                before = el.nextSibling;
 147                el = el.parentNode;
 148                node = ieTable(3, tbs, html, tbe);
 149            } else{                 if(where == 'afterbegin'){
 150                    before = el.firstChild;
 151                }
 152                node = ieTable(4, trs, html, tre);
 153            }
 154        } else if(tag == 'tbody'){
 155            if(where == 'beforebegin'){
 156                before = el;
 157                el = el.parentNode;
 158                node = ieTable(2, ts, html, te);
 159            } else if(where == 'afterend'){
 160                before = el.nextSibling;
 161                el = el.parentNode;
 162                node = ieTable(2, ts, html, te);
 163            } else{
 164                if(where == 'afterbegin'){
 165                    before = el.firstChild;
 166                }
 167                node = ieTable(3, tbs, html, tbe);
 168            }
 169        } else{             if(where == 'beforebegin' || where == 'afterend'){                 return;
 170            }
 171            if(where == 'afterbegin'){
 172                before = el.firstChild;
 173            }
 174            node = ieTable(2, ts, html, te);
 175        }
 176        el.insertBefore(node, before);
 177        return node;
 178    };
 179
 180
 181    return {
 182    
 183    useDom : false,
 184
 185    
 186    markup : function(o){
 187        return createHtml(o);
 188    },
 189
 190    
 191    applyStyles : function(el, styles){
 192        if(styles){
 193           el = Ext.fly(el);
 194           if(typeof styles == "string"){
 195               var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
 196               var matches;
 197               while ((matches = re.exec(styles)) != null){
 198                   el.setStyle(matches[1], matches[2]);
 199               }
 200           }else if (typeof styles == "object"){
 201               for (var style in styles){
 202                  el.setStyle(style, styles[style]);
 203               }
 204           }else if (typeof styles == "function"){
 205                Ext.DomHelper.applyStyles(el, styles.call());
 206           }
 207        }
 208    },
 209
 210    
 211    insertHtml : function(where, el, html){
 212        where = where.toLowerCase();
 213        if(el.insertAdjacentHTML){
 214            if(tableRe.test(el.tagName)){
 215                var rs;
 216                if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){
 217                    return rs;
 218                }
 219            }
 220            switch(where){
 221                case "beforebegin":
 222                    el.insertAdjacentHTML('BeforeBegin', html);
 223                    return el.previousSibling;
 224                case "afterbegin":
 225                    el.insertAdjacentHTML('AfterBegin', html);
 226                    return el.firstChild;
 227                case "beforeend":
 228                    el.insertAdjacentHTML('BeforeEnd', html);
 229                    return el.lastChild;
 230                case "afterend":
 231                    el.insertAdjacentHTML('AfterEnd', html);
 232                    return el.nextSibling;
 233            }
 234            throw 'Illegal insertion point -> "' + where + '"';
 235        }
 236        var range = el.ownerDocument.createRange();
 237        var frag;
 238        switch(where){
 239             case "beforebegin":
 240                range.setStartBefore(el);
 241                frag = range.createContextualFragment(html);
 242                el.parentNode.insertBefore(frag, el);
 243                return el.previousSibling;
 244             case "afterbegin":
 245                if(el.firstChild){
 246                    range.setStartBefore(el.firstChild);
 247                    frag = range.createContextualFragment(html);
 248                    el.insertBefore(frag, el.firstChild);
 249                    return el.firstChild;
 250                }else{
 251                    el.innerHTML = html;
 252                    return el.firstChild;
 253                }
 254            case "beforeend":
 255                if(el.lastChild){
 256                    range.setStartAfter(el.lastChild);
 257                    frag = range.createContextualFragment(html);
 258                    el.appendChild(frag);
 259                    return el.lastChild;
 260                }else{
 261                    el.innerHTML = html;
 262                    return el.lastChild;
 263                }
 264            case "afterend":
 265                range.setStartAfter(el);
 266                frag = range.createContextualFragment(html);
 267                el.parentNode.insertBefore(frag, el.nextSibling);
 268                return el.nextSibling;
 269            }
 270            throw 'Illegal insertion point -> "' + where + '"';
 271    },
 272
 273    
 274    insertBefore : function(el, o, returnElement){
 275        return this.doInsert(el, o, returnElement, "beforeBegin");
 276    },
 277
 278    
 279    insertAfter : function(el, o, returnElement){
 280        return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");
 281    },
 282
 283    
 284    insertFirst : function(el, o, returnElement){
 285        return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");
 286    },
 287
 288        doInsert : function(el, o, returnElement, pos, sibling){
 289        el = Ext.getDom(el);
 290        var newNode;
 291        if(this.useDom){
 292            newNode = createDom(o, null);
 293            (sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);
 294        }else{
 295            var html = createHtml(o);
 296            newNode = this.insertHtml(pos, el, html);
 297        }
 298        return returnElement ? Ext.get(newNode, true) : newNode;
 299    },
 300
 301    
 302    append : function(el, o, returnElement){
 303        el = Ext.getDom(el);
 304        var newNode;
 305        if(this.useDom){
 306            newNode = createDom(o, null);
 307            el.appendChild(newNode);
 308        }else{
 309            var html = createHtml(o);
 310            newNode = this.insertHtml("beforeEnd", el, html);
 311        }
 312        return returnElement ? Ext.get(newNode, true) : newNode;
 313    },
 314
 315    
 316    overwrite : function(el, o, returnElement){
 317        el = Ext.getDom(el);
 318        el.innerHTML = createHtml(o);
 319        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
 320    },
 321
 322    
 323    createTemplate : function(o){
 324        var html = createHtml(o);
 325        return new Ext.Template(html);
 326    }
 327    };
 328}();
 329
 330
 331Ext.Template = function(html){
 332    var a = arguments;
 333    if(Ext.isArray(html)){
 334        html = html.join("");
 335    }else if(a.length > 1){
 336        var buf = [];
 337        for(var i = 0, len = a.length; i < len; i++){
 338            if(typeof a[i] == 'object'){
 339                Ext.apply(this, a[i]);
 340            }else{
 341                buf[buf.length] = a[i];
 342            }
 343        }
 344        html = buf.join('');
 345    }
 346    
 347    this.html = html;
 348    if(this.compiled){
 349        this.compile();
 350    }
 351};
 352Ext.Template.prototype = {
 353    
 354    applyTemplate : function(values){
 355        if(this.compiled){
 356            return this.compiled(values);
 357        }
 358        var useF = this.disableFormats !== true;
 359        var fm = Ext.util.Format, tpl = this;
 360        var fn = function(m, name, format, args){
 361            if(format && useF){
 362                if(format.substr(0, 5) == "this."){
 363                    return tpl.call(format.substr(5), values[name], values);
 364                }else{
 365                    if(args){
 366                                                                                                var re = /^\s*['"](.*)["']\s*$/;
 367                        args = args.split(',');
 368                        for(var i = 0, len = args.length; i < len; i++){
 369                            args[i] = args[i].replace(re, "$1");
 370                        }
 371                        args = [values[name]].concat(args);
 372                    }else{
 373                        args = [values[name]];
 374                    }
 375                    return fm[format].apply(fm, args);
 376                }
 377            }else{
 378                return values[name] !== undefined ? values[name] : "";
 379            }
 380        };
 381        return this.html.replace(this.re, fn);
 382    },
 383
 384    
 385    set : function(html, compile){
 386        this.html = html;
 387        this.compiled = null;
 388        if(compile){
 389            this.compile();
 390        }
 391        return this;
 392    },
 393
 394    
 395    disableFormats : false,
 396
 397    
 398    re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
 399
 400    
 401    compile : function(){
 402        var fm = Ext.util.Format;
 403        var useF = this.disableFormats !== true;
 404        var sep = Ext.isGecko ? "+" : ",";
 405        var fn = function(m, name, format, args){
 406            if(format && useF){
 407                args = args ? ',' + args : "";
 408                if(format.substr(0, 5) != "this."){
 409                    format = "fm." + format + '(';
 410                }else{
 411                    format = 'this.call("'+ format.substr(5) + '", ';
 412                    args = ", values";
 413                }
 414            }else{
 415                args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
 416            }
 417            return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
 418        };
 419        var body;
 420                if(Ext.isGecko){
 421            body = "this.compiled = function(values){ return '" +
 422                   this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
 423                    "';};";
 424        }else{
 425            body = ["this.compiled = function(values){ return ['"];
 426            body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
 427            body.push("'].join('');};");
 428            body = body.join('');
 429        }
 430        eval(body);
 431        return this;
 432    },
 433
 434        call : function(fnName, value, allValues){
 435        return this[fnName](value, allValues);
 436    },
 437
 438    
 439    insertFirst: function(el, values, returnElement){
 440        return this.doInsert('afterBegin', el, values, returnElement);
 441    },
 442
 443    
 444    insertBefore: function(el, values, returnElement){
 445        return this.doInsert('beforeBegin', el, values, returnElement);
 446    },
 447
 448    
 449    insertAfter : function(el, values, returnElement){
 450        return this.doInsert('afterEnd', el, values, returnElement);
 451    },
 452
 453    
 454    append : function(el, values, returnElement){
 455        return this.doInsert('beforeEnd', el, values, returnElement);
 456    },
 457
 458    doInsert : function(where, el, values, returnEl){
 459        el = Ext.getDom(el);
 460        var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
 461        return returnEl ? Ext.get(newNode, true) : newNode;
 462    },
 463
 464    
 465    overwrite : function(el, values, returnElement){
 466        el = Ext.getDom(el);
 467        el.innerHTML = this.applyTemplate(values);
 468        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
 469    }
 470};
 471
 472Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
 473
 474Ext.DomHelper.Template = Ext.Template;
 475
 476
 477Ext.Template.from = function(el, config){
 478    el = Ext.getDom(el);
 479    return new Ext.Template(el.value || el.innerHTML, config || '');
 480};
 481
 482
 483Ext.DomQuery = function(){
 484    var cache = {}, simpleCache = {}, valueCache = {};
 485    var nonSpace = /\S/;
 486    var trimRe = /^\s+|\s+$/g;
 487    var tplRe = /\{(\d+)\}/g;
 488    var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
 489    var tagTokenRe = /^(#)?([\w-\*]+)/;
 490    var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
 491
 492    function child(p, index){
 493        var i = 0;
 494        var n = p.firstChild;
 495        while(n){
 496            if(n.nodeType == 1){
 497               if(++i == index){
 498                   return n;
 499               }
 500            }
 501            n = n.nextSibling;
 502        }
 503        return null;
 504    };
 505
 506    function next(n){
 507        while((n = n.nextSibling) && n.nodeType != 1);
 508        return n;
 509    };
 510
 511    function prev(n){
 512        while((n = n.previousSibling) && n.nodeType != 1);
 513        return n;
 514    };
 515
 516    function children(d){
 517        var n = d.firstChild, ni = -1;
 518 	    while(n){
 519 	        var nx = n.nextSibling;
 520 	        if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
 521 	            d.removeChild(n);
 522 	        }else{
 523 	            n.nodeIndex = ++ni;
 524 	        }
 525 	        n = nx;
 526 	    }
 527 	    return this;
 528 	};
 529
 530    function byClassName(c, a, v){
 531        if(!v){
 532            return c;
 533        }
 534        var r = [], ri = -1, cn;
 535        for(var i = 0, ci; ci = c[i]; i++){
 536            if((' '+ci.className+' ').indexOf(v) != -1){
 537                r[++ri] = ci;
 538            }
 539        }
 540        return r;
 541    };
 542
 543    function attrValue(n, attr){
 544        if(!n.tagName && typeof n.length != "undefined"){
 545            n = n[0];
 546        }
 547        if(!n){
 548            return null;
 549        }
 550        if(attr == "for"){
 551            return n.htmlFor;
 552        }
 553        if(attr == "class" || attr == "className"){
 554            return n.className;
 555        }
 556        return n.getAttribute(attr) || n[attr];
 557
 558    };
 559
 560    function getNodes(ns, mode, tagName){
 561        var result = [], ri = -1, cs;
 562        if(!ns){
 563            return result;
 564        }
 565        tagName = tagName || "*";
 566        if(typeof ns.getElementsByTagName != "undefined"){
 567            ns = [ns];
 568        }
 569        if(!mode){
 570            for(var i = 0, ni; ni = ns[i]; i++){
 571                cs = ni.getElementsByTagName(tagName);
 572                for(var j = 0, ci; ci = cs[j]; j++){
 573                    result[++ri] = ci;
 574                }
 575            }
 576        }else if(mode == "/" || mode == ">"){
 577            var utag = tagName.toUpperCase();
 578            for(var i = 0, ni, cn; ni = ns[i]; i++){
 579                cn = ni.children || ni.childNodes;
 580                for(var j = 0, cj; cj = cn[j]; j++){
 581                    if(cj.nodeName == utag || cj.nodeName == tagName  || tagName == '*'){
 582                        result[++ri] = cj;
 583                    }
 584                }
 585            }
 586        }else if(mode == "+"){
 587            var utag = tagName.toUpperCase();
 588            for(var i = 0, n; n = ns[i]; i++){
 589                while((n = n.nextSibling) && n.nodeType != 1);
 590                if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
 591                    result[++ri] = n;
 592                }
 593            }
 594        }else if(mode == "~"){
 595            for(var i = 0, n; n = ns[i]; i++){
 596                while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
 597                if(n){
 598                    result[++ri] = n;
 599                }
 600            }
 601        }
 602        return result;
 603    };
 604
 605    function concat(a, b){
 606        if(b.slice){
 607            return a.concat(b);
 608        }
 609        for(var i = 0, l = b.length; i < l; i++){
 610            a[a.length] = b[i];
 611        }
 612        return a;
 613    }
 614
 615    function byTag(cs, tagName){
 616        if(cs.tagName || cs == document){
 617            cs = [cs];
 618        }
 619        if(!tagName){
 620            return cs;
 621        }
 622        var r = [], ri = -1;
 623        tagName = tagName.toLowerCase();
 624        for(var i = 0, ci; ci = cs[i]; i++){
 625            if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
 626                r[++ri] = ci;
 627            }
 628        }
 629        return r;
 630    };
 631
 632    function byId(cs, attr, id){
 633        if(cs.tagName || cs == document){
 634            cs = [cs];
 635        }
 636        if(!id){
 637            return cs;
 638        }
 639        var r = [], ri = -1;
 640        for(var i = 0,ci; ci = cs[i]; i++){
 641            if(ci && ci.id == id){
 642                r[++ri] = ci;
 643                return r;
 644            }
 645        }
 646        return r;
 647    };
 648
 649    function byAttribute(cs, attr, value, op, custom){
 650        var r = [], ri = -1, st = custom=="{";
 651        var f = Ext.DomQuery.operators[op];
 652        for(var i = 0, ci; ci = cs[i]; i++){
 653            var a;
 654            if(st){
 655                a = Ext.DomQuery.getStyle(ci, attr);
 656            }
 657            else if(attr == "class" || attr == "className"){
 658                a = ci.className;
 659            }else if(attr == "for"){
 660                a = ci.htmlFor;
 661            }else if(attr == "href"){
 662                a = ci.getAttribute("href", 2);
 663            }else{
 664                a = ci.getAttribute(attr);
 665            }
 666            if((f && f(a, value)) || (!f && a)){
 667                r[++ri] = ci;
 668            }
 669        }
 670        return r;
 671    };
 672
 673    function byPseudo(cs, name, value){
 674        return Ext.DomQuery.pseudos[name](cs, value);
 675    };
 676
 677    
 678    
 679    
 680    var isIE = window.ActiveXObject ? true : false;
 681
 682    
 683    
 684    eval("var batch = 30803;");
 685
 686    var key = 30803;
 687
 688    function nodupIEXml(cs){
 689        var d = ++key;
 690        cs[0].setAttribute("_nodup", d);
 691        var r = [cs[0]];
 692        for(var i = 1, len = cs.length; i < len; i++){
 693            var c = cs[i];
 694            if(!c.getAttribute("_nodup") != d){
 695                c.setAttribute("_nodup", d);
 696                r[r.length] = c;
 697            }
 698        }
 699        for(var i = 0, len = cs.length; i < len; i++){
 700            cs[i].removeAttribute("_nodup");
 701        }
 702        return r;
 703    }
 704
 705    function nodup(cs){
 706        if(!cs){
 707            return [];
 708        }
 709        var len = cs.length, c, i, r = cs, cj, ri = -1;
 710        if(!len || typeof cs.nodeType != "undefined" || len == 1){
 711            return cs;
 712        }
 713        if(isIE && typeof cs[0].selectSingleNode != "undefined"){
 714            return nodupIEXml(cs);
 715        }
 716        var d = ++key;
 717        cs[0]._nodup = d;
 718        for(i = 1; c = cs[i]; i++){
 719            if(c._nodup != d){
 720                c._nodup = d;
 721            }else{
 722                r = [];
 723                for(var j = 0; j < i; j++){
 724                    r[++ri] = cs[j];
 725                }
 726                for(j = i+1; cj = cs[j]; j++){
 727                    if(cj._nodup != d){
 728                        cj._nodup = d;
 729                        r[++ri] = cj;
 730                    }
 731                }
 732                return r;
 733            }
 734        }
 735        return r;
 736    }
 737
 738    function quickDiffIEXml(c1, c2){
 739        var d = ++key;
 740        for(var i = 0, len = c1.length; i < len; i++){
 741            c1[i].setAttribute("_qdiff", d);
 742        }
 743        var r = [];
 744        for(var i = 0, len = c2.length; i < len; i++){
 745            if(c2[i].getAttribute("_qdiff") != d){
 746                r[r.length] = c2[i];
 747            }
 748        }
 749        for(var i = 0, len = c1.length; i < len; i++){
 750           c1[i].removeAttribute("_qdiff");
 751        }
 752        return r;
 753    }
 754
 755    function quickDiff(c1, c2){
 756        var len1 = c1.length;
 757        if(!len1){
 758            return c2;
 759        }
 760        if(isIE && c1[0].selectSingleNode){
 761            return quickDiffIEXml(c1, c2);
 762        }
 763        var d = ++key;
 764        for(var i = 0; i < len1; i++){
 765            c1[i]._qdiff = d;
 766        }
 767        var r = [];
 768        for(var i = 0, len = c2.length; i < len; i++){
 769            if(c2[i]._qdiff != d){
 770                r[r.length] = c2[i];
 771            }
 772        }
 773        return r;
 774    }
 775
 776    function quickId(ns, mode, root, id){
 777        if(ns == root){
 778           var d = root.ownerDocument || root;
 779           return d.getElementById(id);
 780        }
 781        ns = getNodes(ns, mode, "*");
 782        return byId(ns, null, id);
 783    }
 784
 785    return {
 786        getStyle : function(el, name){
 787            return Ext.fly(el).getStyle(name);
 788        },
 789        
 790        compile : function(path, type){
 791            type = type || "select";
 792
 793            var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
 794            var q = path, mode, lq;
 795            var tk = Ext.DomQuery.matchers;
 796            var tklen = tk.length;
 797            var mm;
 798
 799            
 800            var lmode = q.match(modeRe);
 801            if(lmode && lmode[1]){
 802                fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
 803                q = q.replace(lmode[1], "");
 804            }
 805            
 806            while(path.substr(0, 1)=="/"){
 807                path = path.substr(1);
 808            }
 809
 810            while(q && lq != q){
 811                lq = q;
 812                var tm = q.match(tagTokenRe);
 813                if(type == "select"){
 814                    if(tm){
 815                        if(tm[1] == "#"){
 816                            fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
 817                        }else{
 818                            fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
 819                        }
 820                        q = q.replace(tm[0], "");
 821                    }else if(q.substr(0, 1) != '@'){
 822                        fn[fn.length] = 'n = getNodes(n, mode, "*");';
 823                    }
 824                }else{
 825                    if(tm){
 826                        if(tm[1] == "#"){
 827                            fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
 828                        }else{
 829                            fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
 830                        }
 831                        q = q.replace(tm[0], "");
 832                    }
 833                }
 834                while(!(mm = q.match(modeRe))){
 835                    var matched = false;
 836                    for(var j = 0; j < tklen; j++){
 837                        var t = tk[j];
 838                        var m = q.match(t.re);
 839                        if(m){
 840                            fn[fn.length] = t.select.replace(tplRe, function(x, i){
 841                                                    return m[i];
 842                                                });
 843                            q = q.replace(m[0], "");
 844                            matched = true;
 845                            break;
 846                        }
 847                    }
 848                    
 849                    if(!matched){
 850                        throw 'Error parsing selector, parsing failed at "' + q + '"';
 851                    }
 852                }
 853                if(mm[1]){
 854                    fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
 855                    q = q.replace(mm[1], "");
 856                }
 857            }
 858            fn[fn.length] = "return nodup(n);\n}";
 859            eval(fn.join(""));
 860            return f;
 861        },
 862
 863        
 864        select : function(path, root, type){
 865            if(!root || root == document){
 866                root = document;
 867            }
 868            if(typeof root == "string"){
 869                root = document.getElementById(root);
 870            }
 871            var paths = path.split(",");
 872            var results = [];
 873            for(var i = 0, len = paths.length; i < len; i++){
 874                var p = paths[i].replace(trimRe, "");
 875                if(!cache[p]){
 876                    cache[p] = Ext.DomQuery.compile(p);
 877                    if(!cache[p]){
 878                        throw p + " is not a valid selector";
 879                    }
 880                }
 881                var result = cache[p](root);
 882                if(result && result != document){
 883                    results = results.concat(result);
 884                }
 885            }
 886            if(paths.length > 1){
 887                return nodup(results);
 888            }
 889            return results;
 890        },
 891
 892        
 893        selectNode : function(path, root){
 894            return Ext.DomQuery.select(path, root)[0];
 895        },
 896
 897        
 898        selectValue : function(path, root, defaultValue){
 899            path = path.replace(trimRe, "");
 900            if(!valueCache[path]){
 901                valueCache[path] = Ext.DomQuery.compile(path, "select");
 902            }
 903            var n = valueCache[path](root);
 904            n = n[0] ? n[0] : n;
 905            var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
 906            return ((v === null||v === undefined||v==='') ? defaultValue : v);
 907        },
 908
 909        
 910        selectNumber : function(path, root, defaultValue){
 911            var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
 912            return parseFloat(v);
 913        },
 914
 915        
 916        is : function(el, ss){
 917            if(typeof el == "string"){
 918                el = document.getElementById(el);
 919            }
 920            var isArray = Ext.isArray(el);
 921            var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
 922            return isArray ? (result.length == el.length) : (result.length > 0);
 923        },
 924
 925        
 926        filter : function(els, ss, nonMatches){
 927            ss = ss.replace(trimRe, "");
 928            if(!simpleCache[ss]){
 929                simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
 930            }
 931            var result = simpleCache[ss](els);
 932            return nonMatches ? quickDiff(result, els) : result;
 933        },
 934
 935        
 936        matchers : [{
 937                re: /^\.([\w-]+)/,
 938                select: 'n = byClassName(n, null, " {1} ");'
 939            }, {
 940                re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
 941                select: 'n = byPseudo(n, "{1}", "{2}");'
 942            },{
 943                re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
 944                select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
 945            }, {
 946                re: /^#([\w-]+)/,
 947                select: 'n = byId(n, null, "{1}");'
 948            },{
 949                re: /^@([\w-]+)/,
 950                select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
 951            }
 952        ],
 953
 954        
 955        operators : {
 956            "=" : function(a, v){
 957                return a == v;
 958            },
 959            "!=" : function(a, v){
 960                return a != v;
 961            },
 962            "^=" : function(a, v){
 963                return a && a.substr(0, v.length) == v;
 964            },
 965            "$=" : function(a, v){
 966                return a && a.substr(a.length-v.length) == v;
 967            },
 968            "*=" : function(a, v){
 969                return a && a.indexOf(v) !== -1;
 970            },
 971            "%=" : function(a, v){
 972                return (a % v) == 0;
 973            },
 974            "|=" : function(a, v){
 975                return a && (a == v || a.substr(0, v.length+1) == v+'-');
 976            },
 977            "~=" : function(a, v){
 978                return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
 979            }
 980        },
 981
 982        
 983        pseudos : {
 984            "first-child" : function(c){
 985                var r = [], ri = -1, n;
 986                for(var i = 0, ci; ci = n = c[i]; i++){
 987                    while((n = n.previousSibling) && n.nodeType != 1);
 988                    if(!n){
 989                        r[++ri] = ci;
 990                    }
 991                }
 992                return r;
 993            },
 994
 995            "last-child" : function(c){
 996                var r = [], ri = -1, n;
 997                for(var i = 0, ci; ci = n = c[i]; i++){
 998                    while((n = n.nextSibling) && n.nodeType != 1);
 999                    if(!n){
1000                        r[++ri] = ci;
1001                    }
1002                }
1003                return r;
1004            },
1005
1006            "nth-child" : function(c, a) {
1007                var r = [], ri = -1;
1008                var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
1009                var f = (m[1] || 1) - 0, l = m[2] - 0;
1010                for(var i = 0, n; n = c[i]; i++){
1011                    var pn = n.parentNode;
1012                    if (batch != pn._batch) {
1013                        var j = 0;
1014                        for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
1015                            if(cn.nodeType == 1){
1016                               cn.nodeIndex = ++j;
1017                            }
1018                        }
1019                        pn._batch = batch;
1020                    }
1021                    if (f == 1) {
1022                        if (l == 0 || n.nodeIndex == l){
1023                            r[++ri] = n;
1024                        }
1025                    } else if ((n.nodeIndex + l) % f == 0){
1026                        r[++ri] = n;
1027                    }
1028                }
1029
1030                return r;
1031            },
1032
1033            "only-child" : function(c){
1034                var r = [], ri = -1;;
1035                for(var i = 0, ci; ci = c[i]; i++){
1036                    if(!prev(ci) && !next(ci)){
1037                        r[++ri] = ci;
1038                    }
1039                }
1040                return r;
1041            },
1042
1043            "empty" : function(c){
1044                var r = [], ri = -1;
1045                for(var i = 0, ci; ci = c[i]; i++){
1046                    var cns = ci.childNodes, j = 0, cn, empty = true;
1047                    while(cn = cns[j]){
1048                        ++j;
1049                        if(cn.nodeType == 1 || cn.nodeType == 3){
1050                            empty = false;
1051                            break;
1052                        }
1053                    }
1054                    if(empty){
1055                        r[++ri] = ci;
1056                    }
1057                }
1058                return r;
1059            },
1060
1061            "contains" : function(c, v){
1062                var r = [], ri = -1;
1063                for(var i = 0, ci; ci = c[i]; i++){
1064                    if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
1065                        r[++ri] = ci;
1066                    }
1067                }
1068                return r;
1069            },
1070
1071            "nodeValue" : function(c, v){
1072                var r = [], ri = -1;
1073                for(var i = 0, ci; ci = c[i]; i++){
1074                    if(ci.firstChild && ci.firstChild.nodeValue == v){
1075                        r[++ri] = ci;
1076                    }
1077                }
1078                return r;
1079            },
1080
1081            "checked" : function(c){
1082                var r = [], ri = -1;
1083                for(var i = 0, ci; ci = c[i]; i++){
1084                    if(ci.checked == true){
1085                        r[++ri] = ci;
1086                    }
1087                }
1088                return r;
1089            },
1090
1091            "not" : function(c, ss){
1092                return Ext.DomQuery.filter(c, ss, true);
1093            },
1094
1095            "any" : function(c, selectors){
1096                var ss = selectors.split('|');
1097                var r = [], ri = -1, s;
1098                for(var i = 0, ci; ci = c[i]; i++){
1099                    for(var j = 0; s = ss[j]; j++){
1100                        if(Ext.DomQuery.is(ci, s)){
1101                            r[++ri] = ci;
1102                            break;
1103                        }
1104                    }
1105                }
1106                return r;
1107            },
1108
1109            "odd" : function(c){
1110                return this["nth-child"](c, "odd");
1111            },
1112
1113            "even" : function(c){
1114                return this["nth-child"](c, "even");
1115            },
1116
1117            "nth" : function(c, a){
1118                return c[a-1] || [];
1119            },
1120
1121            "first" : function(c){
1122                return c[0] || [];
1123            },
1124
1125            "last" : function(c){
1126                return c[c.length-1] || [];
1127            },
1128
1129            "has" : function(c, ss){
1130                var s = Ext.DomQuery.select;
1131                var r = [], ri = -1;
1132                for(var i = 0, ci; ci = c[i]; i++){
1133                    if(s(ss, ci).length > 0){
1134                        r[++ri] = ci;
1135                    }
1136                }
1137                return r;
1138            },
1139
1140            "next" : function(c, ss){
1141                var is = Ext.DomQuery.is;
1142                var r = [], ri = -1;
1143                for(var i = 0, ci; ci = c[i]; i++){
1144                    var n = next(ci);
1145                    if(n && is(n, ss)){
1146                        r[++ri] = ci;
1147                    }
1148                }
1149                return r;
1150            },
1151
1152            "prev" : function(c, ss){
1153                var is = Ext.DomQuery.is;
1154                var r = [], ri = -1;
1155                for(var i = 0, ci; ci = c[i]; i++){
1156                    var n = prev(ci);
1157                    if(n && is(n, ss)){
1158                        r[++ri] = ci;
1159                    }
1160                }
1161                return r;
1162            }
1163        }
1164    };
1165}();
1166
1167
1168Ext.query = Ext.DomQuery.select;
1169
1170
1171Ext.util.Observable = function(){
1172    
1173    if(this.listeners){
1174        this.on(this.listeners);
1175        delete this.listeners;
1176    }
1177};
1178Ext.util.Observable.prototype = {
1179    
1180    fireEvent : function(){
1181        if(this.eventsSuspended !== true){
1182            var ce = this.events[arguments[0].toLowerCase()];
1183            if(typeof ce == "object"){
1184                return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));
1185            }
1186        }
1187        return true;
1188    },
1189
1190        filterOptRe : /^(?:scope|delay|buffer|single)$/,
1191
1192    
1193    addListener : function(eventName, fn, scope, o){
1194        if(typeof eventName == "object"){
1195            o = eventName;
1196            for(var e in o){
1197                if(this.filterOptRe.test(e)){
1198                    continue;
1199                }
1200                if(typeof o[e] == "function"){
1201                                        this.addListener(e, o[e], o.scope,  o);
1202                }else{
1203                                        this.addListener(e, o[e].fn, o[e].scope, o[e]);
1204                }
1205            }
1206            return;
1207        }
1208        o = (!o || typeof o == "boolean") ? {} : o;
1209        eventName = eventName.toLowerCase();
1210        var ce = this.events[eventName] || true;
1211        if(typeof ce == "boolean"){
1212            ce = new Ext.util.Event(this, eventName);
1213            this.events[eventName] = ce;
1214        }
1215        ce.addListener(fn, scope, o);
1216    },
1217
1218    
1219    removeListener : function(eventName, fn, scope){
1220        var ce = this.events[eventName.toLowerCase()];
1221        if(typeof ce == "object"){
1222            ce.removeListener(fn, scope);
1223        }
1224    },
1225
1226    
1227    purgeListeners : function(){
1228        for(var evt in this.events){
1229            if(typeof this.events[evt] == "object"){
1230                 this.events[evt].clearListeners();
1231            }
1232        }
1233    },
1234
1235    
1236    relayEvents : function(o, events){
1237        var createHandler = function(ename){
1238            return function(){
1239                return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
1240            };
1241        };
1242        for(var i = 0, len = events.length; i < len; i++){
1243            var ename = events[i];
1244            if(!this.events[ename]){ this.events[ename] = true; };
1245            o.on(ename, createHandler(ename), this);
1246        }
1247    },
1248
1249    
1250    addEvents : function(o){
1251        if(!this.events){
1252            this.events = {};
1253        }
1254        if(typeof o == 'string'){
1255            for(var i = 0, a = arguments, v; v = a[i]; i++){
1256                if(!this.events[a[i]]){
1257                    this.events[a[i]] = true;
1258                }
1259            }
1260        }else{
1261            Ext.applyIf(this.events, o);
1262        }
1263    },
1264
1265    
1266    hasListener : function(eventName){
1267        var e = this.events[eventName];
1268        return typeof e == "object" && e.listeners.length > 0;
1269    },
1270
1271    
1272    suspendEvents : function(){
1273        this.eventsSuspended = true;
1274    },
1275
1276    
1277    resumeEvents : function(){
1278        this.eventsSuspended = false;
1279    },
1280
1281                getMethodEvent : function(method){
1282        if(!this.methodEvents){
1283            this.methodEvents = {};
1284        }
1285        var e = this.methodEvents[method];
1286        if(!e){
1287            e = {};
1288            this.methodEvents[method] = e;
1289
1290            e.originalFn = this[method];
1291            e.methodName = method;
1292            e.before = [];
1293            e.after = [];
1294
1295
1296            var returnValue, v, cancel;
1297            var obj = this;
1298
1299            var makeCall = function(fn, scope, args){
1300                if((v = fn.apply(scope || obj, args)) !== undefined){
1301                    if(typeof v === 'object'){
1302                        if(v.returnValue !== undefined){
1303                            returnValue = v.returnValue;
1304                        }else{
1305                            returnValue = v;
1306                        }
1307                        if(v.cancel === true){
1308                            cancel = true;
1309                        }
1310                    }else if(v === false){
1311                        cancel = true;
1312                    }else {
1313                        returnValue = v;
1314                    }
1315                }
1316            }
1317
1318            this[method] = function(){
1319                returnValue = v = undefined; cancel = false;
1320                var args = Array.prototype.slice.call(arguments, 0);
1321                for(var i = 0, len = e.before.length; i < len; i++){
1322                    makeCall(e.before[i].fn, e.before[i].scope, args);
1323                    if(cancel){
1324                        return returnValue;
1325                    }
1326                }
1327
1328                if((v = e.originalFn.apply(obj, args)) !== undefined){
1329                    returnValue = v;
1330                }
1331
1332                for(var i = 0, len = e.after.length; i < len; i++){
1333                    makeCall(e.after[i].fn, e.after[i].scope, args);
1334                    if(cancel){
1335                        return returnValue;
1336                    }
1337                }
1338                return returnValue;
1339            };
1340        }
1341        return e;
1342    },
1343
1344        beforeMethod : function(method, fn, scope){
1345        var e = this.getMethodEvent(method);
1346        e.before.push({fn: fn, scope: scope});
1347    },
1348
1349        afterMethod : function(method, fn, scope){
1350        var e = this.getMethodEvent(method);
1351        e.after.push({fn: fn, scope: scope});
1352    },
1353
1354    removeMethodListener : function(method, fn, scope){
1355        var e = this.getMethodEvent(method);
1356        for(var i = 0, len = e.before.length; i < len; i++){
1357            if(e.before[i].fn == fn && e.before[i].scope == scope){
1358                e.before.splice(i, 1);
1359                return;
1360            }
1361        }
1362        for(var i = 0, len = e.after.length; i < len; i++){
1363            if(e.after[i].fn == fn && e.after[i].scope == scope){
1364                e.after.splice(i, 1);
1365                return;
1366            }
1367        }
1368    }
1369};
1370
1371Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
1372
1373Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
1374
1375
1376Ext.util.Observable.capture = function(o, fn, scope){
1377    o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
1378};
1379
1380
1381Ext.util.Observable.releaseCapture = function(o){
1382    o.fireEvent = Ext.util.Observable.prototype.fireEvent;
1383};
1384
1385(function(){
1386
1387    var createBuffered = function(h, o, scope){
1388        var task = new Ext.util.DelayedTask();
1389        return function(){
1390            task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
1391        };
1392    };
1393
1394    var createSingle = function(h, e, fn, scope){
1395        return function(){
1396            e.removeListener(fn, scope);
1397            return h.apply(scope, arguments);
1398        };
1399    };
1400
1401    var createDelayed = function(h, o, scope){
1402        return function(){
1403            var args = Array.prototype.slice.call(arguments, 0);
1404            setTimeout(function(){
1405                h.apply(scope, args);
1406            }, o.delay || 10);
1407        };
1408    };
1409
1410    Ext.util.Event = function(obj, name){
1411        this.name = name;
1412        this.obj = obj;
1413        this.listeners = [];
1414    };
1415
1416    Ext.util.Event.prototype = {
1417        addListener : function(fn, scope, options){
1418            scope = scope || this.obj;
1419            if(!this.isListening(fn, scope)){
1420                var l = this.createListener(fn, scope, options);
1421                if(!this.firing){
1422                    this.listeners.push(l);
1423                }else{                     this.listeners = this.listeners.slice(0);
1424                    this.listeners.push(l);
1425                }
1426            }
1427        },
1428
1429        createListener : function(fn, scope, o){
1430            o = o || {};
1431            scope = scope || this.obj;
1432            var l = {fn: fn, scope: scope, options: o};
1433            var h = fn;
1434            if(o.delay){
1435                h = createDelayed(h, o, scope);
1436            }
1437            if(o.single){
1438                h = createSingle(h, this, fn, scope);
1439            }
1440            if(o.buffer){
1441                h = createBuffered(h, o, scope);
1442            }
1443            l.fireFn = h;
1444            return l;
1445        },
1446
1447        findListener : function(fn, scope){
1448            scope = scope || this.obj;
1449            var ls = this.listeners;
1450            for(var i = 0, len = ls.length; i < len; i++){
1451                var l = ls[i];
1452                if(l.fn == fn && l.scope == scope){
1453                    return i;
1454                }
1455            }
1456            return -1;
1457        },
1458
1459        isListening : function(fn, scope){
1460            return this.findListener(fn, scope) != -1;
1461        },
1462
1463        removeListener : function(fn, scope){
1464            var index;
1465            if((index = this.findListener(fn, scope)) != -1){
1466                if(!this.firing){
1467                    this.listeners.splice(index, 1);
1468                }else{
1469                    this.listeners = this.listeners.slice(0);
1470                    this.listeners.splice(index, 1);
1471                }
1472                return true;
1473            }
1474            return false;
1475        },
1476
1477        clearListeners : function(){
1478            this.listeners = [];
1479        },
1480
1481        fire : function(){
1482            var ls = this.listeners, scope, len = ls.length;
1483            if(len > 0){
1484                this.firing = true;
1485                var args = Array.prototype.slice.call(arguments, 0);
1486                for(var i = 0; i < len; i++){
1487                    var l = ls[i];
1488                    if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
1489                        this.firing = false;
1490                        return false;
1491                    }
1492                }
1493                this.firing = false;
1494            }
1495            return true;
1496        }
1497    };
1498})();
1499
1500Ext.EventManager = function(){
1501    var docReadyEvent, docReadyProcId, docReadyState = false;
1502    var resizeEvent, resizeTask, textEvent, textSize;
1503    var E = Ext.lib.Event;
1504    var D = Ext.lib.Dom;
1505        var xname = 'Ex' + 't';
1506
1507    var elHash = {};
1508
1509    var addListener = function(el, ename, fn, wrap, scope){
1510        var id = Ext.id(el);
1511        if(!elHash[id]){
1512            elHash[id] = {};
1513        }
1514        var es = elHash[id];
1515        if(!es[ename]){
1516            es[ename] = [];
1517        }
1518        var ls = es[ename];
1519        ls.push({
1520            id: id,
1521            ename: ename,
1522            fn: fn,
1523            wrap: wrap,
1524            scope: scope
1525        });
1526
1527         E.on(el, ename, wrap);
1528
1529        if(ename == "mousewheel" && el.addEventListener){             el.addEventListener("DOMMouseScroll", wrap, false);
1530            E.on(window, 'unload', function(){
1531                el.removeEventListener("DOMMouseScroll", wrap, false);
1532            });
1533        }
1534        if(ename == "mousedown" && el == document){             Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);
1535        }
1536    }
1537
1538    var removeListener = function(el, ename, fn, scope){
1539        el = Ext.getDom(el);
1540        var id = Ext.id(el), es = elHash[id], wrap;
1541        if(es){
1542            var ls = es[ename], l;
1543            if(ls){
1544                for(var i = 0, len = ls.length; i < len; i++){
1545                    l = ls[i];
1546                    if(l.fn == fn && (!scope || l.scope == scope)){
1547                        wrap = l.wrap;
1548                        E.un(el, ename, wrap);
1549                        ls.splice(i, 1);
1550                        break;
1551                    }
1552                }
1553            }
1554        }
1555        if(ename == "mousewheel" && el.addEventListener && wrap){
1556            el.removeEventListener("DOMMouseScroll", wrap, false);
1557        }
1558        if(ename == "mousedown" && el == document && wrap){             Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
1559        }
1560    }
1561
1562    var removeAll = function(el){
1563        el = Ext.getDom(el);
1564        var id = Ext.id(el), es = elHash[id], ls;
1565        if(es){
1566            for(var ename in es){
1567                if(es.hasOwnProperty(ename)){
1568                    ls = es[ename];
1569                    for(var i = 0, len = ls.length; i < len; i++){
1570                        E.un(el, ename, ls[i].wrap);
1571                        ls[i] = null;
1572                    }
1573                }
1574                es[ename] = null;
1575            }
1576            delete elHash[id];
1577        }
1578    }
1579
1580     var fireDocReady = function(){
1581        if(!docReadyState){
1582            docReadyState = Ext.isReady = true;
1583            if(Ext.isGecko || Ext.isOpera) {
1584                document.removeEventListener("DOMContentLoaded", fireDocReady, false);
1585            }
1586        }
1587        if(docReadyProcId){
1588            clearInterval(docReadyProcId);
1589            docReadyProcId = null;
1590        }
1591        if(docReadyEvent){
1592            docReadyEvent.fire();
1593            docReadyEvent.clearListeners();
1594       }
1595    };
1596
1597    var initDocReady = function(){
1598        docReadyEvent = new Ext.util.Event();
1599
1600        if(Ext.isReady){
1601            return;
1602        }
1603
1604                E.on(window, 'load', fireDocReady);
1605
1606        if(Ext.isGecko || Ext.isOpera) {
1607            document.addEventListener('DOMContentLoaded', fireDocReady, false);
1608        }
1609        else if(Ext.isIE){
1610            docReadyProcId = setInterval(function(){
1611                try{
1612                                        Ext.isReady || (document.documentElement.doScroll('left'));
1613                }catch(e){
1614                    return;
1615                }
1616                fireDocReady();              }, 5);
1617
1618			document.onreadystatechange = function(){
1619				if(document.readyState == 'complete'){
1620					document.onreadystatechange = null;
1621					fireDocReady();
1622				}
1623            };
1624        }
1625        else if(Ext.isSafari){
1626            docReadyProcId = setInterval(function(){
1627                var rs = document.readyState;
1628                if(rs == 'complete') {
1629                    fireDocReady();
1630                 }
1631            }, 10);
1632        }
1633    };
1634
1635    var createBuffered = function(h, o){
1636        var task = new Ext.util.DelayedTask(h);
1637        return function(e){
1638                        e = new Ext.EventObjectImpl(e);
1639            task.delay(o.buffer, h, null, [e]);
1640        };
1641    };
1642
1643    var createSingle = function(h, el, ename, fn, scope){
1644        return function(e){
1645            Ext.EventManager.removeListener(el, ename, fn, scope);
1646            h(e);
1647        };
1648    };
1649
1650    var createDelayed = function(h, o){
1651        return function(e){
1652                        e = new Ext.EventObjectImpl(e);
1653            setTimeout(function(){
1654                h(e);
1655            }, o.delay || 10);
1656        };
1657    };
1658
1659    var listen = function(element, ename, opt, fn, scope){
1660        var o = (!opt || typeof opt == "boolean") ? {} : opt;
1661        fn = fn || o.fn; scope = scope || o.scope;
1662        var el = Ext.getDom(element);
1663        if(!el){
1664            throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
1665        }
1666        var h = function(e){
1667                        if(!window[xname]){
1668                return;
1669            }
1670            e = Ext.EventObject.setEvent(e);
1671            var t;
1672            if(o.delegate){
1673                t = e.getTarget(o.delegate, el);
1674                if(!t){
1675                    return;
1676                }
1677            }else{
1678                t = e.target;
1679            }
1680            if(o.stopEvent === true){
1681                e.stopEvent();
1682            }
1683            if(o.preventDefault === true){
1684               e.preventDefault();
1685            }
1686            if(o.stopPropagation === true){
1687                e.stopPropagation();
1688            }
1689
1690            if(o.normalized === false){
1691                e = e.browserEvent;
1692            }
1693
1694            fn.call(scope || el, e, t, o);
1695        };
1696        if(o.delay){
1697            h = createDelayed(h, o);
1698        }
1699        if(o.single){
1700            h = createSingle(h, el, ename, fn, scope);
1701        }
1702        if(o.buffer){
1703            h = createBuffered(h, o);
1704        }
1705
1706        addListener(el, ename, fn, h, scope);
1707        return h;
1708    };
1709
1710    var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
1711    var pub = {
1712
1713    
1714        addListener : function(element, eventName, fn, scope, options){
1715            if(typeof eventName == "object"){
1716                var o = eventName;
1717                for(var e in o){
1718                    if(propRe.test(e)){
1719                        continue;
1720                    }
1721                    if(typeof o[e] == "function"){
1722                                                listen(element, e, o, o[e], o.scope);
1723                    }else{
1724                                                listen(element, e, o[e]);
1725                    }
1726                }
1727                return;
1728            }
1729            return listen(element, eventName, options, fn, scope);
1730        },
1731
1732        
1733        removeListener : function(element, eventName, fn, scope){
1734            return removeListener(element, eventName, fn, scope);
1735        },
1736
1737        
1738        removeAll : function(element){
1739            return removeAll(element);
1740        },
1741
1742        
1743         onDocumentReady : function(fn, scope, options){
1744			if(!docReadyEvent){
1745                initDocReady();
1746			}
1747			if(docReadyState || Ext.isReady){ 				options || (options = {});
1748				fn.defer(options.delay||0, scope);
1749			}else{
1750				docReadyEvent.addListener(fn, scope, options);
1751			}
1752        },
1753
1754        
1755        onWindowResize : function(fn, scope, options){
1756            if(!resizeEvent){
1757                resizeEvent = new Ext.util.Event();
1758                resizeTask = new Ext.util.DelayedTask(function(){
1759                    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1760                });
1761                E.on(window, "resize", this.fireWindowResize, this);
1762            }
1763            resizeEvent.addListener(fn, scope, options);
1764        },
1765
1766                fireWindowResize : function(){
1767            if(resizeEvent){
1768                if((Ext.isIE||Ext.isAir) && resizeTask){
1769                    resizeTask.delay(50);
1770                }else{
1771                    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1772                }
1773            }
1774        },
1775
1776        
1777        onTextResize : function(fn, scope, options){
1778            if(!textEvent){
1779                textEvent = new Ext.util.Event();
1780                var textEl = new Ext.Element(document.createElement('div'));
1781                textEl.dom.className = 'x-text-resize';
1782                textEl.dom.innerHTML = 'X';
1783                textEl.appendTo(document.body);
1784                textSize = textEl.dom.offsetHeight;
1785                setInterval(function(){
1786                    if(textEl.dom.offsetHeight != textSize){
1787                        textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
1788                    }
1789                }, this.textResizeInterval);
1790            }
1791            textEvent.addListener(fn, scope, options);
1792        },
1793
1794        
1795        removeResizeListener : function(fn, scope){
1796            if(resizeEvent){
1797                resizeEvent.removeListener(fn, scope);
1798            }
1799        },
1800
1801                fireResize : function(){
1802            if(resizeEvent){
1803                resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1804            }
1805        },
1806        
1807        ieDeferSrc : false,
1808        
1809        textResizeInterval : 50
1810    };
1811     
1812    pub.on = pub.addListener;
1813    
1814    pub.un = pub.removeListener;
1815
1816    pub.stoppedMouseDownEvent = new Ext.util.Event();
1817    return pub;
1818}();
1819
1820Ext.onReady = Ext.EventManager.onDocumentReady;
1821
1822
1823(function(){
1824    var initExtCss = function(){
1825                var bd = document.body || document.getElementsByTagName('body')[0];
1826        if(!bd){ return false; }
1827        var cls = [' ',
1828                Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7')
1829                : Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')
1830                : Ext.isOpera ? "ext-opera"
1831                : Ext.isSafari ? "ext-safari" : ""];
1832
1833        if(Ext.isMac){
1834            cls.push("ext-mac");
1835        }
1836        if(Ext.isLinux){
1837            cls.push("ext-linux");
1838        }
1839        if(Ext.isBorderBox){
1840            cls.push('ext-border-box');
1841        }
1842        if(Ext.isStrict){             var p = bd.parentNode;
1843            if(p){
1844                p.className += ' ext-strict';
1845            }
1846        }
1847        bd.className += cls.join(' ');
1848        return true;
1849    }
1850
1851    if(!initExtCss()){
1852        Ext.onReady(initExtCss);
1853    }
1854})();
1855
1856
1857Ext.EventObject = function(){
1858
1859    var E = Ext.lib.Event;
1860
1861        var safariKeys = {
1862        3 : 13,         63234 : 37,         63235 : 39,         63232 : 38,         63233 : 40,         63276 : 33,         63277 : 34,         63272 : 46,         63273 : 36,         63275 : 35      };
1863
1864        var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
1865                (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
1866
1867    Ext.EventObjectImpl = function(e){
1868        if(e){
1869            this.setEvent(e.browserEvent || e);
1870        }
1871    };
1872
1873    Ext.EventObjectImpl.prototype = {
1874        
1875        browserEvent : null,
1876        
1877        button : -1,
1878        
1879        shiftKey : false,
1880        
1881        ctrlKey : false,
1882        
1883        altKey : false,
1884
1885        
1886        BACKSPACE: 8,
1887        
1888        TAB: 9,
1889        
1890        NUM_CENTER: 12,
1891        
1892        ENTER: 13,
1893        
1894        RETURN: 13,
1895        
1896        SHIFT: 16,
1897        
1898        CTRL: 17,
1899        CONTROL : 17,         
1900        ALT: 18,
1901        
1902        PAUSE: 19,
1903        
1904        CAPS_LOCK: 20,
1905        
1906        ESC: 27,
1907        
1908        SPACE: 32,
1909        
1910        PAGE_UP: 33,
1911        PAGEUP : 33,         
1912        PAGE_DOWN: 34,
1913        PAGEDOWN : 34,         
1914        END: 35,
1915        
1916        HOME: 36,
1917        
1918        LEFT: 37,
1919        
1920        UP: 38,
1921        
1922        RIGHT: 39,
1923        
1924        DOWN: 40,
1925        
1926        PRINT_SCREEN: 44,
1927        
1928        INSERT: 45,
1929        
1930        DELETE: 46,
1931        
1932        ZERO: 48,
1933        
1934        ONE: 49,
1935        
1936        TWO: 50,
1937        
1938        THREE: 51,
1939        
1940        FOUR: 52,
1941        
1942        FIVE: 53,
1943        
1944        SIX: 54,
1945        
1946        SEVEN: 55,
1947        
1948        EIGHT: 56,
1949        
1950        NINE: 57,
1951        
1952        A: 65,
1953        
1954        B: 66,
1955        
1956        C: 67,
1957        
1958        D: 68,
1959        
1960        E: 69,
1961        
1962        F: 70,
1963        
1964        G: 71,
1965        
1966        H: 72,
1967        
1968        I: 73,
1969        
1970        J: 74,
1971        
1972        K: 75,
1973        
1974        L: 76,
1975        
1976        M: 77,
1977        
1978        N: 78,
1979        
1980        O: 79,
1981        
1982        P: 80,
1983        
1984        Q: 81,
1985        
1986        R: 82,
1987        
1988        S: 83,
1989        
1990        T: 84,
1991        
1992        U: 85,
1993        
1994        V: 86,
1995        
1996        W: 87,
1997        
1998        X: 88,
1999        
2000        Y: 89,
2001        
2002        Z: 90,
2003        
2004        CONTEXT_MENU: 93,
2005        
2006        NUM_ZERO: 96,
2007        
2008        NUM_ONE: 97,
2009        
2010        NUM_TWO: 98,
2011        
2012        NUM_THREE: 99,
2013        
2014        NUM_FOUR: 100,
2015        
2016        NUM_FIVE: 101,
2017        
2018        NUM_SIX: 102,
2019        
2020        NUM_SEVEN: 103,
2021        
2022        NUM_EIGHT: 104,
2023        
2024        NUM_NINE: 105,
2025        
2026        NUM_MULTIPLY: 106,
2027        
2028        NUM_PLUS: 107,
2029        
2030        NUM_MINUS: 109,
2031        
2032        NUM_PERIOD: 110,
2033        
2034        NUM_DIVISION: 111,
2035        
2036        F1: 112,
2037        
2038        F2: 113,
2039        
2040        F3: 114,
2041        
2042        F4: 115,
2043        
2044        F5: 116,
2045        
2046        F6: 117,
2047        
2048        F7: 118,
2049        
2050        F8: 119,
2051        
2052        F9: 120,
2053        
2054        F10: 121,
2055        
2056        F11: 122,
2057        
2058        F12: 123,
2059
2060           
2061        setEvent : function(e){
2062            if(e == this || (e && e.browserEvent)){                 return e;
2063            }
2064            this.browserEvent = e;
2065            if(e){
2066                                this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
2067                if(e.type == 'click' && this.button == -1){
2068                    this.button = 0;
2069                }
2070                this.type = e.type;
2071                this.shiftKey = e.shiftKey;
2072                                this.ctrlKey = e.ctrlKey || e.metaKey;
2073                this.altKey = e.altKey;
2074                                this.keyCode = e.keyCode;
2075                this.charCode = e.charCode;
2076                                this.target = E.getTarget(e);
2077                                this.xy = E.getXY(e);
2078            }else{
2079                this.button = -1;
2080                this.shiftKey = false;
2081                this.ctrlKey = false;
2082                this.altKey = false;
2083                this.keyCode = 0;
2084                this.charCode = 0;
2085                this.target = null;
2086                this.xy = [0, 0];
2087            }
2088            return this;
2089        },
2090
2091        
2092        stopEvent : function(){
2093            if(this.browserEvent){
2094                if(this.browserEvent.type == 'mousedown'){
2095                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
2096                }
2097                E.stopEvent(this.browserEvent);
2098            }
2099        },
2100
2101        
2102        preventDefault : function(){
2103            if(this.browserEvent){
2104                E.preventDefault(this.browserEvent);
2105            }
2106        },
2107
2108        
2109        isNavKeyPress : function(){
2110            var k = this.keyCode;
2111            k = Ext.isSafari ? (safariKeys[k] || k) : k;
2112            return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
2113        },
2114
2115        isSpecialKey : function(){
2116            var k = this.keyCode;
2117            return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13  || k == 40 || k == 27 ||
2118            (k == 16) || (k == 17) ||
2119            (k >= 18 && k <= 20) ||
2120            (k >= 33 && k <= 35) ||
2121            (k >= 36 && k <= 39) ||
2122            (k >= 44 && k <= 45);
2123        },
2124
2125        
2126        stopPropagation : function(){
2127            if(this.browserEvent){
2128                if(this.browserEvent.type == 'mousedown'){
2129                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
2130                }
2131                E.stopPropagation(this.browserEvent);
2132            }
2133        },
2134
2135        
2136        getCharCode : function(){
2137            return this.charCode || this.keyCode;
2138        },
2139
2140        
2141        getKey : function(){
2142            var k = this.keyCode || this.charCode;
2143            return Ext.isSafari ? (safariKeys[k] || k) : k;
2144        },
2145
2146        
2147        getPageX : function(){
2148            return this.xy[0];
2149        },
2150
2151        
2152        getPageY : function(){
2153            return this.xy[1];
2154        },
2155
2156        
2157        getTime : function(){
2158            if(this.browserEvent){
2159                return E.getTime(this.browserEvent);
2160            }
2161            return null;
2162        },
2163
2164        
2165        getXY : function(){
2166            return this.xy;
2167        },
2168
2169        
2170        getTarget : function(selector, maxDepth, returnEl){
2171            return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
2172        },
2173
2174        
2175        getRelatedTarget : function(){
2176            if(this.browserEvent){
2177                return E.getRelatedTarget(this.browserEvent);
2178            }
2179            return null;
2180        },
2181
2182        
2183        getWheelDelta : function(){
2184            var e = this.browserEvent;
2185            var delta = 0;
2186            if(e.wheelDelta){ 
2187                delta = e.wheelDelta/120;
2188            }else if(e.detail){ 
2189                delta = -e.detail/3;
2190            }
2191            return delta;
2192        },
2193
2194        
2195        hasModifier : function(){
2196            return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;
2197        },
2198
2199        
2200        within : function(el, related){
2201            var t = this[related ? "getRelatedTarget" : "getTarget"]();
2202            return t && Ext.fly(el).contains(t);
2203        },
2204
2205        getPoint : function(){
2206            return new Ext.lib.Point(this.xy[0], this.xy[1]);
2207        }
2208    };
2209
2210    return new Ext.EventObjectImpl();
2211}();
2212
2213(function(){
2214var D = Ext.lib.Dom;
2215var E = Ext.lib.Event;
2216var A = Ext.lib.Anim;
2217
2218var propCache = {};
2219var camelRe = /(-[a-z])/gi;
2220var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
2221var view = document.defaultView;
2222
2223Ext.Element = function(element, forceNew){
2224    var dom = typeof element == "string" ?
2225            document.getElementById(element) : element;
2226    if(!dom){         return null;
2227    }
2228    var id = dom.id;
2229    if(forceNew !== true && id && Ext.Element.cache[id]){