Subversion Repositories eFlore/Applications.cel

Rev

Rev 2108 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2108 mathias 1
/*
2
 * Ext JS Library 2.0.2
3
 * Copyright(c) 2006-2008, Ext JS, LLC.
4
 * licensing@extjs.com
5
 *
6
 * http://extjs.com/license
7
 */
8
 
9
 
10
Ext.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
 
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
 
75
 
76
    var createDom = function(o, parentNode){
77
        var el;
78
        if (Ext.isArray(o)) {
79
            el = document.createDocumentFragment();
80
            for(var i = 0, l = o.length; i < l; i++) {
81
                createDom(o[i], el);
82
            }
83
        } else if (typeof o == "string)") {
84
            el = document.createTextNode(o);
85
        } else {
86
            el = document.createElement(o.tag||'div');
87
            var useSet = !!el.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
 
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'){
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{
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{
179
            if(where == 'beforebegin' || where == 'afterend'){
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
 
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
 
343
Ext.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
};
364
Ext.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
 
379
 
380
 
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
 
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
 
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
 
489
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
490
 
491
 
492
Ext.DomHelper.Template = Ext.Template;
493
 
494
 
495
Ext.Template.from = function(el, config){
496
    el = Ext.getDom(el);
497
    return new Ext.Template(el.value || el.innerHTML, config || '');
498
};
499
 
500
 
501
Ext.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
 
696
 
697
 
698
    var isIE = window.ActiveXObject ? true : false;
699
 
700
 
701
 
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
 
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
 
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
 
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
 
1186
Ext.query = Ext.DomQuery.select;
1187
 
1188
 
1189
Ext.util.Observable = function(){
1190
 
1191
    if(this.listeners){
1192
        this.on(this.listeners);
1193
        delete this.listeners;
1194
    }
1195
};
1196
Ext.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
        filterOptRe : /^(?:scope|delay|buffer|single)$/,
1209
 
1210
 
1211
    addListener : function(eventName, fn, scope, o){
1212
        if(typeof eventName == "object"){
1213
            o = eventName;
1214
            for(var e in o){
1215
                if(this.filterOptRe.test(e)){
1216
                    continue;
1217
                }
1218
                if(typeof o[e] == "function"){
1219
                                        this.addListener(e, o[e], o.scope,  o);
1220
                }else{
1221
                                        this.addListener(e, o[e].fn, o[e].scope, o[e]);
1222
                }
1223
            }
1224
            return;
1225
        }
1226
        o = (!o || typeof o == "boolean") ? {} : o;
1227
        eventName = eventName.toLowerCase();
1228
        var ce = this.events[eventName] || true;
1229
        if(typeof ce == "boolean"){
1230
            ce = new Ext.util.Event(this, eventName);
1231
            this.events[eventName] = ce;
1232
        }
1233
        ce.addListener(fn, scope, o);
1234
    },
1235
 
1236
 
1237
    removeListener : function(eventName, fn, scope){
1238
        var ce = this.events[eventName.toLowerCase()];
1239
        if(typeof ce == "object"){
1240
            ce.removeListener(fn, scope);
1241
        }
1242
    },
1243
 
1244
 
1245
    purgeListeners : function(){
1246
        for(var evt in this.events){
1247
            if(typeof this.events[evt] == "object"){
1248
                 this.events[evt].clearListeners();
1249
            }
1250
        }
1251
    },
1252
 
1253
    relayEvents : function(o, events){
1254
        var createHandler = function(ename){
1255
            return function(){
1256
                return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
1257
            };
1258
        };
1259
        for(var i = 0, len = events.length; i < len; i++){
1260
            var ename = events[i];
1261
            if(!this.events[ename]){ this.events[ename] = true; };
1262
            o.on(ename, createHandler(ename), this);
1263
        }
1264
    },
1265
 
1266
 
1267
    addEvents : function(o){
1268
        if(!this.events){
1269
            this.events = {};
1270
        }
1271
        if(typeof o == 'string'){
1272
            for(var i = 0, a = arguments, v; v = a[i]; i++){
1273
                if(!this.events[a[i]]){
1274
                    o[a[i]] = true;
1275
                }
1276
            }
1277
        }else{
1278
            Ext.applyIf(this.events, o);
1279
        }
1280
    },
1281
 
1282
 
1283
    hasListener : function(eventName){
1284
        var e = this.events[eventName];
1285
        return typeof e == "object" && e.listeners.length > 0;
1286
    },
1287
 
1288
 
1289
    suspendEvents : function(){
1290
        this.eventsSuspended = true;
1291
    },
1292
 
1293
 
1294
    resumeEvents : function(){
1295
        this.eventsSuspended = false;
1296
    },
1297
 
1298
                getMethodEvent : function(method){
1299
        if(!this.methodEvents){
1300
            this.methodEvents = {};
1301
        }
1302
        var e = this.methodEvents[method];
1303
        if(!e){
1304
            e = {};
1305
            this.methodEvents[method] = e;
1306
 
1307
            e.originalFn = this[method];
1308
            e.methodName = method;
1309
            e.before = [];
1310
            e.after = [];
1311
 
1312
 
1313
            var returnValue, v, cancel;
1314
            var obj = this;
1315
 
1316
            var makeCall = function(fn, scope, args){
1317
                if((v = fn.apply(scope || obj, args)) !== undefined){
1318
                    if(typeof v === 'object'){
1319
                        if(v.returnValue !== undefined){
1320
                            returnValue = v.returnValue;
1321
                        }else{
1322
                            returnValue = v;
1323
                        }
1324
                        if(v.cancel === true){
1325
                            cancel = true;
1326
                        }
1327
                    }else if(v === false){
1328
                        cancel = true;
1329
                    }else {
1330
                        returnValue = v;
1331
                    }
1332
                }
1333
            }
1334
 
1335
            this[method] = function(){
1336
                returnValue = v = undefined; cancel = false;
1337
                var args = Array.prototype.slice.call(arguments, 0);
1338
                for(var i = 0, len = e.before.length; i < len; i++){
1339
                    makeCall(e.before[i].fn, e.before[i].scope, args);
1340
                    if(cancel){
1341
                        return returnValue;
1342
                    }
1343
                }
1344
 
1345
                if((v = e.originalFn.apply(obj, args)) !== undefined){
1346
                    returnValue = v;
1347
                }
1348
 
1349
                for(var i = 0, len = e.after.length; i < len; i++){
1350
                    makeCall(e.after[i].fn, e.after[i].scope, args);
1351
                    if(cancel){
1352
                        return returnValue;
1353
                    }
1354
                }
1355
                return returnValue;
1356
            };
1357
        }
1358
        return e;
1359
    },
1360
 
1361
        beforeMethod : function(method, fn, scope){
1362
        var e = this.getMethodEvent(method);
1363
        e.before.push({fn: fn, scope: scope});
1364
    },
1365
 
1366
        afterMethod : function(method, fn, scope){
1367
        var e = this.getMethodEvent(method);
1368
        e.after.push({fn: fn, scope: scope});
1369
    },
1370
 
1371
    removeMethodListener : function(method, fn, scope){
1372
        var e = this.getMethodEvent(method);
1373
        for(var i = 0, len = e.before.length; i < len; i++){
1374
            if(e.before[i].fn == fn && e.before[i].scope == scope){
1375
                e.before.splice(i, 1);
1376
                return;
1377
            }
1378
        }
1379
        for(var i = 0, len = e.after.length; i < len; i++){
1380
            if(e.after[i].fn == fn && e.after[i].scope == scope){
1381
                e.after.splice(i, 1);
1382
                return;
1383
            }
1384
        }
1385
    }
1386
};
1387
 
1388
Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
1389
 
1390
Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
1391
 
1392
 
1393
Ext.util.Observable.capture = function(o, fn, scope){
1394
    o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
1395
};
1396
 
1397
 
1398
Ext.util.Observable.releaseCapture = function(o){
1399
    o.fireEvent = Ext.util.Observable.prototype.fireEvent;
1400
};
1401
 
1402
(function(){
1403
 
1404
    var createBuffered = function(h, o, scope){
1405
        var task = new Ext.util.DelayedTask();
1406
        return function(){
1407
            task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
1408
        };
1409
    };
1410
 
1411
    var createSingle = function(h, e, fn, scope){
1412
        return function(){
1413
            e.removeListener(fn, scope);
1414
            return h.apply(scope, arguments);
1415
        };
1416
    };
1417
 
1418
    var createDelayed = function(h, o, scope){
1419
        return function(){
1420
            var args = Array.prototype.slice.call(arguments, 0);
1421
            setTimeout(function(){
1422
                h.apply(scope, args);
1423
            }, o.delay || 10);
1424
        };
1425
    };
1426
 
1427
    Ext.util.Event = function(obj, name){
1428
        this.name = name;
1429
        this.obj = obj;
1430
        this.listeners = [];
1431
    };
1432
 
1433
    Ext.util.Event.prototype = {
1434
        addListener : function(fn, scope, options){
1435
            scope = scope || this.obj;
1436
            if(!this.isListening(fn, scope)){
1437
                var l = this.createListener(fn, scope, options);
1438
                if(!this.firing){
1439
                    this.listeners.push(l);
1440
                }else{                     this.listeners = this.listeners.slice(0);
1441
                    this.listeners.push(l);
1442
                }
1443
            }
1444
        },
1445
 
1446
        createListener : function(fn, scope, o){
1447
            o = o || {};
1448
            scope = scope || this.obj;
1449
            var l = {fn: fn, scope: scope, options: o};
1450
            var h = fn;
1451
            if(o.delay){
1452
                h = createDelayed(h, o, scope);
1453
            }
1454
            if(o.single){
1455
                h = createSingle(h, this, fn, scope);
1456
            }
1457
            if(o.buffer){
1458
                h = createBuffered(h, o, scope);
1459
            }
1460
            l.fireFn = h;
1461
            return l;
1462
        },
1463
 
1464
        findListener : function(fn, scope){
1465
            scope = scope || this.obj;
1466
            var ls = this.listeners;
1467
            for(var i = 0, len = ls.length; i < len; i++){
1468
                var l = ls[i];
1469
                if(l.fn == fn && l.scope == scope){
1470
                    return i;
1471
                }
1472
            }
1473
            return -1;
1474
        },
1475
 
1476
        isListening : function(fn, scope){
1477
            return this.findListener(fn, scope) != -1;
1478
        },
1479
 
1480
        removeListener : function(fn, scope){
1481
            var index;
1482
            if((index = this.findListener(fn, scope)) != -1){
1483
                if(!this.firing){
1484
                    this.listeners.splice(index, 1);
1485
                }else{
1486
                    this.listeners = this.listeners.slice(0);
1487
                    this.listeners.splice(index, 1);
1488
                }
1489
                return true;
1490
            }
1491
            return false;
1492
        },
1493
 
1494
        clearListeners : function(){
1495
            this.listeners = [];
1496
        },
1497
 
1498
        fire : function(){
1499
            var ls = this.listeners, scope, len = ls.length;
1500
            if(len > 0){
1501
                this.firing = true;
1502
                var args = Array.prototype.slice.call(arguments, 0);
1503
                for(var i = 0; i < len; i++){
1504
                    var l = ls[i];
1505
                    if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
1506
                        this.firing = false;
1507
                        return false;
1508
                    }
1509
                }
1510
                this.firing = false;
1511
            }
1512
            return true;
1513
        }
1514
    };
1515
})();
1516
 
1517
Ext.EventManager = function(){
1518
    var docReadyEvent, docReadyProcId, docReadyState = false;
1519
    var resizeEvent, resizeTask, textEvent, textSize;
1520
    var E = Ext.lib.Event;
1521
    var D = Ext.lib.Dom;
1522
 
1523
 
1524
    var fireDocReady = function(){
1525
        if(!docReadyState){
1526
            docReadyState = true;
1527
            Ext.isReady = true;
1528
            if(docReadyProcId){
1529
                clearInterval(docReadyProcId);
1530
            }
1531
            if(Ext.isGecko || Ext.isOpera) {
1532
                document.removeEventListener("DOMContentLoaded", fireDocReady, false);
1533
            }
1534
            if(Ext.isIE){
1535
                var defer = document.getElementById("ie-deferred-loader");
1536
                if(defer){
1537
                    defer.onreadystatechange = null;
1538
                    defer.parentNode.removeChild(defer);
1539
                }
1540
            }
1541
            if(docReadyEvent){
1542
                docReadyEvent.fire();
1543
                docReadyEvent.clearListeners();
1544
            }
1545
        }
1546
    };
1547
 
1548
    var initDocReady = function(){
1549
        docReadyEvent = new Ext.util.Event();
1550
        if(Ext.isGecko || Ext.isOpera) {
1551
            document.addEventListener("DOMContentLoaded", fireDocReady, false);
1552
        }else if(Ext.isIE){
1553
            document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");
1554
            var defer = document.getElementById("ie-deferred-loader");
1555
            defer.onreadystatechange = function(){
1556
                if(this.readyState == "complete"){
1557
                    fireDocReady();
1558
                }
1559
            };
1560
        }else if(Ext.isSafari){
1561
            docReadyProcId = setInterval(function(){
1562
                var rs = document.readyState;
1563
                if(rs == "complete") {
1564
                    fireDocReady();
1565
                 }
1566
            }, 10);
1567
        }
1568
 
1569
        E.on(window, "load", fireDocReady);
1570
    };
1571
 
1572
    var createBuffered = function(h, o){
1573
        var task = new Ext.util.DelayedTask(h);
1574
        return function(e){
1575
 
1576
            e = new Ext.EventObjectImpl(e);
1577
            task.delay(o.buffer, h, null, [e]);
1578
        };
1579
    };
1580
 
1581
    var createSingle = function(h, el, ename, fn){
1582
        return function(e){
1583
            Ext.EventManager.removeListener(el, ename, fn);
1584
            h(e);
1585
        };
1586
    };
1587
 
1588
    var createDelayed = function(h, o){
1589
        return function(e){
1590
 
1591
            e = new Ext.EventObjectImpl(e);
1592
            setTimeout(function(){
1593
                h(e);
1594
            }, o.delay || 10);
1595
        };
1596
    };
1597
 
1598
    var listen = function(element, ename, opt, fn, scope){
1599
        var o = (!opt || typeof opt == "boolean") ? {} : opt;
1600
        fn = fn || o.fn; scope = scope || o.scope;
1601
        var el = Ext.getDom(element);
1602
        if(!el){
1603
            throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
1604
        }
1605
        var h = function(e){
1606
            e = Ext.EventObject.setEvent(e);
1607
            var t;
1608
            if(o.delegate){
1609
                t = e.getTarget(o.delegate, el);
1610
                if(!t){
1611
                    return;
1612
                }
1613
            }else{
1614
                t = e.target;
1615
            }
1616
            if(o.stopEvent === true){
1617
                e.stopEvent();
1618
            }
1619
            if(o.preventDefault === true){
1620
               e.preventDefault();
1621
            }
1622
            if(o.stopPropagation === true){
1623
                e.stopPropagation();
1624
            }
1625
 
1626
            if(o.normalized === false){
1627
                e = e.browserEvent;
1628
            }
1629
 
1630
            fn.call(scope || el, e, t, o);
1631
        };
1632
        if(o.delay){
1633
            h = createDelayed(h, o);
1634
        }
1635
        if(o.single){
1636
            h = createSingle(h, el, ename, fn);
1637
        }
1638
        if(o.buffer){
1639
            h = createBuffered(h, o);
1640
        }
1641
        fn._handlers = fn._handlers || [];
1642
        fn._handlers.push([Ext.id(el), ename, h]);
1643
 
1644
        E.on(el, ename, h);
1645
        if(ename == "mousewheel" && el.addEventListener){
1646
            el.addEventListener("DOMMouseScroll", h, false);
1647
            E.on(window, 'unload', function(){
1648
                el.removeEventListener("DOMMouseScroll", h, false);
1649
            });
1650
        }
1651
        if(ename == "mousedown" && el == document){
1652
            Ext.EventManager.stoppedMouseDownEvent.addListener(h);
1653
        }
1654
        return h;
1655
    };
1656
 
1657
    var stopListening = function(el, ename, fn){
1658
        var id = Ext.id(el), hds = fn._handlers, hd = fn;
1659
        if(hds){
1660
            for(var i = 0, len = hds.length; i < len; i++){
1661
                var h = hds[i];
1662
                if(h[0] == id && h[1] == ename){
1663
                    hd = h[2];
1664
                    hds.splice(i, 1);
1665
                    break;
1666
                }
1667
            }
1668
        }
1669
        E.un(el, ename, hd);
1670
        el = Ext.getDom(el);
1671
        if(ename == "mousewheel" && el.addEventListener){
1672
            el.removeEventListener("DOMMouseScroll", hd, false);
1673
        }
1674
        if(ename == "mousedown" && el == document){
1675
            Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);
1676
        }
1677
    };
1678
 
1679
    var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
1680
    var pub = {
1681
 
1682
 
1683
        addListener : function(element, eventName, fn, scope, options){
1684
            if(typeof eventName == "object"){
1685
                var o = eventName;
1686
                for(var e in o){
1687
                    if(propRe.test(e)){
1688
                        continue;
1689
                    }
1690
                    if(typeof o[e] == "function"){
1691
 
1692
                        listen(element, e, o, o[e], o.scope);
1693
                    }else{
1694
 
1695
                        listen(element, e, o[e]);
1696
                    }
1697
                }
1698
                return;
1699
            }
1700
            return listen(element, eventName, options, fn, scope);
1701
        },
1702
 
1703
 
1704
        removeListener : function(element, eventName, fn){
1705
            return stopListening(element, eventName, fn);
1706
        },
1707
 
1708
 
1709
        onDocumentReady : function(fn, scope, options){
1710
            if(docReadyState){
1711
                docReadyEvent.addListener(fn, scope, options);
1712
                docReadyEvent.fire();
1713
                docReadyEvent.clearListeners();
1714
                return;
1715
            }
1716
            if(!docReadyEvent){
1717
                initDocReady();
1718
            }
1719
            docReadyEvent.addListener(fn, scope, options);
1720
        },
1721
 
1722
 
1723
        onWindowResize : function(fn, scope, options){
1724
            if(!resizeEvent){
1725
                resizeEvent = new Ext.util.Event();
1726
                resizeTask = new Ext.util.DelayedTask(function(){
1727
                    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1728
                });
1729
                E.on(window, "resize", this.fireWindowResize, this);
1730
            }
1731
            resizeEvent.addListener(fn, scope, options);
1732
        },
1733
 
1734
 
1735
        fireWindowResize : function(){
1736
            if(resizeEvent){
1737
                if((Ext.isIE||Ext.isAir) && resizeTask){
1738
                    resizeTask.delay(50);
1739
                }else{
1740
                    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1741
                }
1742
            }
1743
        },
1744
 
1745
 
1746
        onTextResize : function(fn, scope, options){
1747
            if(!textEvent){
1748
                textEvent = new Ext.util.Event();
1749
                var textEl = new Ext.Element(document.createElement('div'));
1750
                textEl.dom.className = 'x-text-resize';
1751
                textEl.dom.innerHTML = 'X';
1752
                textEl.appendTo(document.body);
1753
                textSize = textEl.dom.offsetHeight;
1754
                setInterval(function(){
1755
                    if(textEl.dom.offsetHeight != textSize){
1756
                        textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
1757
                    }
1758
                }, this.textResizeInterval);
1759
            }
1760
            textEvent.addListener(fn, scope, options);
1761
        },
1762
 
1763
 
1764
        removeResizeListener : function(fn, scope){
1765
            if(resizeEvent){
1766
                resizeEvent.removeListener(fn, scope);
1767
            }
1768
        },
1769
 
1770
 
1771
        fireResize : function(){
1772
            if(resizeEvent){
1773
                resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
1774
            }
1775
        },
1776
 
1777
        ieDeferSrc : false,
1778
 
1779
        textResizeInterval : 50
1780
    };
1781
 
1782
    pub.on = pub.addListener;
1783
 
1784
    pub.un = pub.removeListener;
1785
 
1786
    pub.stoppedMouseDownEvent = new Ext.util.Event();
1787
    return pub;
1788
}();
1789
 
1790
Ext.onReady = Ext.EventManager.onDocumentReady;
1791
 
1792
Ext.onReady(function(){
1793
    var bd = Ext.getBody();
1794
    if(!bd){ return; }
1795
 
1796
    var cls = [
1797
            Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7')
1798
            : Ext.isGecko ? "ext-gecko"
1799
            : Ext.isOpera ? "ext-opera"
1800
            : Ext.isSafari ? "ext-safari" : ""];
1801
 
1802
    if(Ext.isMac){
1803
        cls.push("ext-mac");
1804
    }
1805
    if(Ext.isLinux){
1806
        cls.push("ext-linux");
1807
    }
1808
    if(Ext.isBorderBox){
1809
        cls.push('ext-border-box');
1810
    }
1811
    if(Ext.isStrict){
1812
        var p = bd.dom.parentNode;
1813
        if(p){
1814
            p.className += ' ext-strict';
1815
        }
1816
    }
1817
    bd.addClass(cls.join(' '));
1818
});
1819
 
1820
 
1821
Ext.EventObject = function(){
1822
 
1823
    var E = Ext.lib.Event;
1824
 
1825
 
1826
    var safariKeys = {
1827
        63234 : 37,
1828
        63235 : 39,
1829
        63232 : 38,
1830
        63233 : 40,
1831
        63276 : 33,
1832
        63277 : 34,
1833
        63272 : 46,
1834
        63273 : 36,
1835
        63275 : 35
1836
    };
1837
 
1838
 
1839
    var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
1840
                (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
1841
 
1842
    Ext.EventObjectImpl = function(e){
1843
        if(e){
1844
            this.setEvent(e.browserEvent || e);
1845
        }
1846
    };
1847
    Ext.EventObjectImpl.prototype = {
1848
 
1849
        browserEvent : null,
1850
 
1851
        button : -1,
1852
 
1853
        shiftKey : false,
1854
 
1855
        ctrlKey : false,
1856
 
1857
        altKey : false,
1858
 
1859
 
1860
        BACKSPACE : 8,
1861
 
1862
        TAB : 9,
1863
 
1864
        RETURN : 13,
1865
 
1866
        ENTER : 13,
1867
 
1868
        SHIFT : 16,
1869
 
1870
        CONTROL : 17,
1871
 
1872
        ESC : 27,
1873
 
1874
        SPACE : 32,
1875
 
1876
        PAGEUP : 33,
1877
 
1878
        PAGEDOWN : 34,
1879
 
1880
        END : 35,
1881
 
1882
        HOME : 36,
1883
 
1884
        LEFT : 37,
1885
 
1886
        UP : 38,
1887
 
1888
        RIGHT : 39,
1889
 
1890
        DOWN : 40,
1891
 
1892
        DELETE : 46,
1893
 
1894
        F5 : 116,
1895
 
1896
 
1897
        setEvent : function(e){
1898
            if(e == this || (e && e.browserEvent)){
1899
                return e;
1900
            }
1901
            this.browserEvent = e;
1902
            if(e){
1903
 
1904
                this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
1905
                if(e.type == 'click' && this.button == -1){
1906
                    this.button = 0;
1907
                }
1908
                this.type = e.type;
1909
                this.shiftKey = e.shiftKey;
1910
 
1911
                this.ctrlKey = e.ctrlKey || e.metaKey;
1912
                this.altKey = e.altKey;
1913
 
1914
                this.keyCode = e.keyCode;
1915
                this.charCode = e.charCode;
1916
 
1917
                this.target = E.getTarget(e);
1918
 
1919
                this.xy = E.getXY(e);
1920
            }else{
1921
                this.button = -1;
1922
                this.shiftKey = false;
1923
                this.ctrlKey = false;
1924
                this.altKey = false;
1925
                this.keyCode = 0;
1926
                this.charCode =0;
1927
                this.target = null;
1928
                this.xy = [0, 0];
1929
            }
1930
            return this;
1931
        },
1932
 
1933
 
1934
        stopEvent : function(){
1935
            if(this.browserEvent){
1936
                if(this.browserEvent.type == 'mousedown'){
1937
                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
1938
                }
1939
                E.stopEvent(this.browserEvent);
1940
            }
1941
        },
1942
 
1943
 
1944
        preventDefault : function(){
1945
            if(this.browserEvent){
1946
                E.preventDefault(this.browserEvent);
1947
            }
1948
        },
1949
 
1950
 
1951
        isNavKeyPress : function(){
1952
            var k = this.keyCode;
1953
            k = Ext.isSafari ? (safariKeys[k] || k) : k;
1954
            return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
1955
        },
1956
 
1957
        isSpecialKey : function(){
1958
            var k = this.keyCode;
1959
            return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13  || k == 40 || k == 27 ||
1960
            (k == 16) || (k == 17) ||
1961
            (k >= 18 && k <= 20) ||
1962
            (k >= 33 && k <= 35) ||
1963
            (k >= 36 && k <= 39) ||
1964
            (k >= 44 && k <= 45);
1965
        },
1966
 
1967
        stopPropagation : function(){
1968
            if(this.browserEvent){
1969
                if(this.browserEvent.type == 'mousedown'){
1970
                    Ext.EventManager.stoppedMouseDownEvent.fire(this);
1971
                }
1972
                E.stopPropagation(this.browserEvent);
1973
            }
1974
        },
1975
 
1976
 
1977
        getCharCode : function(){
1978
            return this.charCode || this.keyCode;
1979
        },
1980
 
1981
 
1982
        getKey : function(){
1983
            var k = this.keyCode || this.charCode;
1984
            return Ext.isSafari ? (safariKeys[k] || k) : k;
1985
        },
1986
 
1987
 
1988
        getPageX : function(){
1989
            return this.xy[0];
1990
        },
1991
 
1992
 
1993
        getPageY : function(){
1994
            return this.xy[1];
1995
        },
1996
 
1997
 
1998
        getTime : function(){
1999
            if(this.browserEvent){
2000
                return E.getTime(this.browserEvent);
2001
            }
2002
            return null;
2003
        },
2004
 
2005
 
2006
        getXY : function(){
2007
            return this.xy;
2008
        },
2009
 
2010
 
2011
        getTarget : function(selector, maxDepth, returnEl){
2012
        	var t = Ext.get(this.target);
2013
            return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target);
2014
        },
2015
 
2016
 
2017
        getRelatedTarget : function(){
2018
            if(this.browserEvent){
2019
                return E.getRelatedTarget(this.browserEvent);
2020
            }
2021
            return null;
2022
        },
2023
 
2024
 
2025
        getWheelDelta : function(){
2026
            var e = this.browserEvent;
2027
            var delta = 0;
2028
            if(e.wheelDelta){
2029
                delta = e.wheelDelta/120;
2030
            }else if(e.detail){
2031
                delta = -e.detail/3;
2032
            }
2033
            return delta;
2034
        },
2035
 
2036
 
2037
        hasModifier : function(){
2038
            return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;
2039
        },
2040
 
2041
 
2042
        within : function(el, related){
2043
            var t = this[related ? "getRelatedTarget" : "getTarget"]();
2044
            return t && Ext.fly(el).contains(t);
2045
        },
2046
 
2047
        getPoint : function(){
2048
            return new Ext.lib.Point(this.xy[0], this.xy[1]);
2049
        }
2050
    };
2051
 
2052
    return new Ext.EventObjectImpl();
2053
}();
2054
 
2055
(function(){
2056
var D = Ext.lib.Dom;
2057
var E = Ext.lib.Event;
2058
var A = Ext.lib.Anim;
2059
 
2060
var propCache = {};
2061
var camelRe = /(-[a-z])/gi;
2062
var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
2063
var view = document.defaultView;
2064
 
2065
Ext.Element = function(element, forceNew){
2066
    var dom = typeof element == "string" ?
2067
            document.getElementById(element) : element;
2068
    if(!dom){         return null;
2069
    }
2070
    var id = dom.id;
2071
    if(forceNew !== true && id && Ext.Element.cache[id]){         return Ext.Element.cache[id];
2072
    }
2073
 
2074
 
2075
    this.dom = dom;
2076
 
2077
 
2078
    this.id = id || Ext.id(dom);
2079
};
2080
 
2081
var El = Ext.Element;
2082
 
2083
El.prototype = {
2084
 
2085
    originalDisplay : "",
2086
 
2087
    visibilityMode : 1,
2088
 
2089
    defaultUnit : "px",
2090
 
2091
    setVisibilityMode : function(visMode){
2092
        this.visibilityMode = visMode;
2093
        return this;
2094
    },
2095
 
2096
    enableDisplayMode : function(display){
2097
        this.setVisibilityMode(El.DISPLAY);
2098
        if(typeof display != "undefined") this.originalDisplay = display;
2099
        return this;
2100
    },
2101
 
2102
 
2103
    findParent : function(simpleSelector, maxDepth, returnEl){
2104
        var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
2105
        maxDepth = maxDepth || 50;
2106
        if(typeof maxDepth != "number"){
2107
            stopEl = Ext.getDom(maxDepth);
2108
            maxDepth = 10;
2109
        }
2110
        while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
2111
            if(dq.is(p, simpleSelector)){
2112
                return returnEl ? Ext.get(p) : p;
2113
            }
2114
            depth++;
2115
            p = p.parentNode;
2116
        }
2117
        return null;
2118
    },
2119
 
2120
 
2121
 
2122
    findParentNode : function(simpleSelector, maxDepth, returnEl){
2123
        var p = Ext.fly(this.dom.parentNode, '_internal');
2124
        return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
2125
    },
2126
 
2127
 
2128
    up : function(simpleSelector, maxDepth){
2129
        return this.findParentNode(simpleSelector, maxDepth, true);
2130
    },
2131
 
2132
 
2133
 
2134
 
2135
    is : function(simpleSelector){
2136
        return Ext.DomQuery.is(this.dom, simpleSelector);
2137
    },
2138
 
2139
 
2140
    animate : function(args, duration, onComplete, easing, animType){
2141
        this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
2142
        return this;
2143
    },
2144
 
2145
 
2146
    anim : function(args, opt, animType, defaultDur, defaultEase, cb){
2147
        animType = animType || 'run';
2148
        opt = opt || {};
2149
        var anim = Ext.lib.Anim[animType](
2150
            this.dom, args,
2151
            (opt.duration || defaultDur) || .35,
2152
            (opt.easing || defaultEase) || 'easeOut',
2153
            function(){
2154
                Ext.callback(cb, this);
2155
                Ext.callback(opt.callback, opt.scope || this, [this, opt]);
2156
            },
2157
            this
2158
        );
2159
        opt.anim = anim;
2160
        return anim;
2161
    },
2162
 
2163
        preanim : function(a, i){
2164
        return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
2165
    },
2166
 
2167
 
2168
    clean : function(forceReclean){
2169
        if(this.isCleaned && forceReclean !== true){
2170
            return this;
2171
        }
2172
        var ns = /\S/;
2173
        var d = this.dom, n = d.firstChild, ni = -1;
2174
 	    while(n){
2175
 	        var nx = n.nextSibling;
2176
 	        if(n.nodeType == 3 && !ns.test(n.nodeValue)){
2177
 	            d.removeChild(n);
2178
 	        }else{
2179
 	            n.nodeIndex = ++ni;
2180
 	        }
2181
 	        n = nx;
2182
 	    }
2183
 	    this.isCleaned = true;
2184
 	    return this;
2185
 	},
2186
 
2187
 
2188
    scrollIntoView : function(container, hscroll){
2189
        var c = Ext.getDom(container) || Ext.getBody().dom;
2190
        var el = this.dom;
2191
 
2192
        var o = this.getOffsetsTo(c),
2193
            l = o[0] + c.scrollLeft,
2194
            t = o[1] + c.scrollTop,
2195
            b = t+el.offsetHeight,
2196
            r = l+el.offsetWidth;
2197
 
2198
        var ch = c.clientHeight;
2199
        var ct = parseInt(c.scrollTop, 10);
2200
        var cl = parseInt(c.scrollLeft, 10);
2201
        var cb = ct + ch;
2202
        var cr = cl + c.clientWidth;
2203
 
2204
        if(el.offsetHeight > ch || t < ct){
2205
        	c.scrollTop = t;
2206
        }else if(b > cb){
2207
            c.scrollTop = b-ch;
2208
        }
2209
        c.scrollTop = c.scrollTop;
2210
        if(hscroll !== false){
2211
			if(el.offsetWidth > c.clientWidth || l < cl){
2212
                c.scrollLeft = l;
2213
            }else if(r > cr){
2214
                c.scrollLeft = r-c.clientWidth;
2215
            }
2216
            c.scrollLeft = c.scrollLeft;
2217
        }
2218
        return this;
2219
    },
2220
 
2221
        scrollChildIntoView : function(child, hscroll){
2222
        Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
2223
    },
2224
 
2225
 
2226
    autoHeight : function(animate, duration, onComplete, easing){
2227
        var oldHeight = this.getHeight();
2228
        this.clip();
2229
        this.setHeight(1);         setTimeout(function(){
2230
            var height = parseInt(this.dom.scrollHeight, 10);             if(!animate){
2231
                this.setHeight(height);
2232
                this.unclip();
2233
                if(typeof onComplete == "function"){
2234
                    onComplete();
2235
                }
2236
            }else{
2237
                this.setHeight(oldHeight);                 this.setHeight(height, animate, duration, function(){
2238
                    this.unclip();
2239
                    if(typeof onComplete == "function") onComplete();
2240
                }.createDelegate(this), easing);
2241
            }
2242
        }.createDelegate(this), 0);
2243
        return this;
2244
    },
2245
 
2246
 
2247
    contains : function(el){
2248
        if(!el){return false;}
2249
        return D.isAncestor(this.dom, el.dom ? el.dom : el);
2250
    },
2251
 
2252
 
2253
    isVisible : function(deep) {
2254
        var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
2255
        if(deep !== true || !vis){
2256
            return vis;
2257
        }
2258
        var p = this.dom.parentNode;
2259
        while(p && p.tagName.toLowerCase() != "body"){
2260
            if(!Ext.fly(p, '_isVisible').isVisible()){
2261
                return false;
2262
            }
2263
            p = p.parentNode;
2264
        }
2265
        return true;
2266
    },
2267
 
2268
 
2269
    select : function(selector, unique){
2270
        return El.select(selector, unique, this.dom);
2271
    },
2272
 
2273
 
2274
    query : function(selector, unique){
2275
        return Ext.DomQuery.select(selector, this.dom);
2276
    },
2277
 
2278
 
2279
    child : function(selector, returnDom){
2280
        var n = Ext.DomQuery.selectNode(selector, this.dom);
2281
        return returnDom ? n : Ext.get(n);
2282
    },
2283
 
2284
 
2285
    down : function(selector, returnDom){
2286
        var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
2287
        return returnDom ? n : Ext.get(n);
2288
    },
2289
 
2290
 
2291
    initDD : function(group, config, overrides){
2292
        var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
2293
        return Ext.apply(dd, overrides);
2294
    },
2295
 
2296
 
2297
    initDDProxy : function(group, config, overrides){
2298
        var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
2299
        return Ext.apply(dd, overrides);
2300
    },
2301
 
2302
 
2303
    initDDTarget : function(group, config, overrides){
2304
        var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
2305
        return Ext.apply(dd, overrides);
2306
    },
2307
 
2308
 
2309
     setVisible : function(visible, animate){
2310
        if(!animate || !A){
2311
            if(this.visibilityMode == El.DISPLAY){
2312
                this.setDisplayed(visible);
2313
            }else{
2314
                this.fixDisplay();
2315
                this.dom.style.visibility = visible ? "visible" : "hidden";
2316
            }
2317
        }else{
2318
                        var dom = this.dom;
2319
            var visMode = this.visibilityMode;
2320
            if(visible){
2321
                this.setOpacity(.01);
2322
                this.setVisible(true);
2323
            }
2324
            this.anim({opacity: { to: (visible?1:0) }},
2325
                  this.preanim(arguments, 1),
2326
                  null, .35, 'easeIn', function(){
2327
                     if(!visible){
2328
                         if(visMode == El.DISPLAY){
2329
                             dom.style.display = "none";
2330
                         }else{
2331
                             dom.style.visibility = "hidden";
2332
                         }
2333
                         Ext.get(dom).setOpacity(1);
2334
                     }
2335
                 });
2336
        }
2337
        return this;
2338
    },
2339
 
2340
 
2341
    isDisplayed : function() {
2342
        return this.getStyle("display") != "none";
2343
    },
2344
 
2345
 
2346
    toggle : function(animate){
2347
        this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
2348
        return this;
2349
    },
2350
 
2351
 
2352
    setDisplayed : function(value) {
2353
        if(typeof value == "boolean"){
2354
           value = value ? this.originalDisplay : "none";
2355
        }
2356
        this.setStyle("display", value);
2357
        return this;
2358
    },
2359
 
2360
 
2361
    focus : function() {
2362
        try{
2363
            this.dom.focus();
2364
        }catch(e){}
2365
        return this;
2366
    },
2367
 
2368
 
2369
    blur : function() {
2370
        try{
2371
            this.dom.blur();
2372
        }catch(e){}
2373
        return this;
2374
    },
2375
 
2376
 
2377
    addClass : function(className){
2378
        if(Ext.isArray(className)){
2379
            for(var i = 0, len = className.length; i < len; i++) {
2380
            	this.addClass(className[i]);
2381
            }
2382
        }else{
2383
            if(className && !this.hasClass(className)){
2384
                this.dom.className = this.dom.className + " " + className;
2385
            }
2386
        }
2387
        return this;
2388
    },
2389
 
2390
 
2391
    radioClass : function(className){
2392
        var siblings = this.dom.parentNode.childNodes;
2393
        for(var i = 0; i < siblings.length; i++) {
2394
        	var s = siblings[i];
2395
        	if(s.nodeType == 1){
2396
        	    Ext.get(s).removeClass(className);
2397
        	}
2398
        }
2399
        this.addClass(className);
2400
        return this;
2401
    },
2402
 
2403
 
2404
    removeClass : function(className){
2405
        if(!className || !this.dom.className){
2406
            return this;
2407
        }
2408
        if(Ext.isArray(className)){
2409
            for(var i = 0, len = className.length; i < len; i++) {
2410
            	this.removeClass(className[i]);
2411
            }
2412
        }else{
2413
            if(this.hasClass(className)){
2414
                var re = this.classReCache[className];
2415
                if (!re) {
2416
                   re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
2417
                   this.classReCache[className] = re;
2418
                }
2419
                this.dom.className =
2420
                    this.dom.className.replace(re, " ");
2421
            }
2422
        }
2423
        return this;
2424
    },
2425
 
2426
        classReCache: {},
2427
 
2428
 
2429
    toggleClass : function(className){
2430
        if(this.hasClass(className)){
2431
            this.removeClass(className);
2432
        }else{
2433
            this.addClass(className);
2434
        }
2435
        return this;
2436
    },
2437
 
2438
 
2439
    hasClass : function(className){
2440
        return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
2441
    },
2442
 
2443
 
2444
    replaceClass : function(oldClassName, newClassName){
2445
        this.removeClass(oldClassName);
2446
        this.addClass(newClassName);
2447
        return this;
2448
    },
2449
 
2450
 
2451
    getStyles : function(){
2452
        var a = arguments, len = a.length, r = {};
2453
        for(var i = 0; i < len; i++){
2454
            r[a[i]] = this.getStyle(a[i]);
2455
        }
2456
        return r;
2457
    },
2458
 
2459
 
2460
    getStyle : function(){
2461
        return view && view.getComputedStyle ?
2462
            function(prop){
2463
                var el = this.dom, v, cs, camel;
2464
                if(prop == 'float'){
2465
                    prop = "cssFloat";
2466
                }
2467
                if(v = el.style[prop]){
2468
                    return v;
2469
                }
2470
                if(cs = view.getComputedStyle(el, "")){
2471
                    if(!(camel = propCache[prop])){
2472
                        camel = propCache[prop] = prop.replace(camelRe, camelFn);
2473
                    }
2474
                    return cs[camel];
2475
                }
2476
                return null;
2477
            } :
2478
            function(prop){
2479
                var el = this.dom, v, cs, camel;
2480
                if(prop == 'opacity'){
2481
                    if(typeof el.style.filter == 'string'){
2482
                        var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
2483
                        if(m){
2484
                            var fv = parseFloat(m[1]);
2485
                            if(!isNaN(fv)){
2486
                                return fv ? fv / 100 : 0;
2487
                            }
2488
                        }
2489
                    }
2490
                    return 1;
2491
                }else if(prop == 'float'){
2492
                    prop = "styleFloat";
2493
                }
2494
                if(!(camel = propCache[prop])){
2495
                    camel = propCache[prop] = prop.replace(camelRe, camelFn);
2496
                }
2497
                if(v = el.style[camel]){
2498
                    return v;
2499
                }
2500
                if(cs = el.currentStyle){
2501
                    return cs[camel];
2502
                }
2503
                return null;
2504
            };
2505
    }(),
2506
 
2507
 
2508
    setStyle : function(prop, value){
2509
        if(typeof prop == "string"){
2510
            var camel;
2511
            if(!(camel = propCache[prop])){
2512
                camel = propCache[prop] = prop.replace(camelRe, camelFn);
2513
            }
2514
            if(camel == 'opacity') {
2515
                this.setOpacity(value);
2516
            }else{
2517
                this.dom.style[camel] = value;
2518
            }
2519
        }else{
2520
            for(var style in prop){
2521
                if(typeof prop[style] != "function"){
2522
                   this.setStyle(style, prop[style]);
2523
                }
2524
            }
2525
        }
2526
        return this;
2527
    },
2528
 
2529
 
2530
    applyStyles : function(style){
2531
        Ext.DomHelper.applyStyles(this.dom, style);
2532
        return this;
2533
    },
2534
 
2535
 
2536
    getX : function(){
2537
        return D.getX(this.dom);
2538
    },
2539
 
2540
 
2541
    getY : function(){
2542
        return D.getY(this.dom);
2543
    },
2544
 
2545
 
2546
    getXY : function(){
2547
        return D.getXY(this.dom);
2548
    },
2549
 
2550
 
2551
    getOffsetsTo : function(el){
2552
        var o = this.getXY();
2553
        var e = Ext.fly(el, '_internal').getXY();
2554
        return [o[0]-e[0],o[1]-e[1]];
2555
    },
2556
 
2557
 
2558
    setX : function(x, animate){
2559
        if(!animate || !A){
2560
            D.setX(this.dom, x);
2561
        }else{
2562
            this.setXY([x, this.getY()], this.preanim(arguments, 1));
2563
        }
2564
        return this;
2565
    },
2566
 
2567
 
2568
    setY : function(y, animate){
2569
        if(!animate || !A){
2570
            D.setY(this.dom, y);
2571
        }else{
2572
            this.setXY([this.getX(), y], this.preanim(arguments, 1));
2573
        }
2574
        return this;
2575
    },
2576
 
2577
 
2578
    setLeft : function(left){
2579
        this.setStyle("left", this.addUnits(left));
2580
        return this;
2581
    },
2582
 
2583
 
2584
    setTop : function(top){
2585
        this.setStyle("top", this.addUnits(top));
2586
        return this;
2587
    },
2588
 
2589
 
2590
    setRight : function(right){
2591
        this.setStyle("right", this.addUnits(right));
2592
        return this;
2593
    },
2594
 
2595
 
2596
    setBottom : function(bottom){
2597
        this.setStyle("bottom", this.addUnits(bottom));
2598
        return this;
2599
    },
2600
 
2601
 
2602
    setXY : function(pos, animate){
2603
        if(!animate || !A){
2604
            D.setXY(this.dom, pos);
2605
        }else{
2606
            this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
2607
        }
2608
        return this;
2609
    },
2610
 
2611
 
2612
    setLocation : function(x, y, animate){
2613
        this.setXY([x, y], this.preanim(arguments, 2));
2614
        return this;
2615
    },
2616
 
2617
 
2618
    moveTo : function(x, y, animate){
2619
        this.setXY([x, y], this.preanim(arguments, 2));
2620
        return this;
2621
    },
2622
 
2623
 
2624
    getRegion : function(){
2625
        return D.getRegion(this.dom);
2626
    },
2627
 
2628
 
2629
    getHeight : function(contentHeight){
2630
        var h = this.dom.offsetHeight || 0;
2631
        h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
2632
        return h < 0 ? 0 : h;
2633
    },
2634
 
2635
 
2636
    getWidth : function(contentWidth){
2637
        var w = this.dom.offsetWidth || 0;
2638
        w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
2639
        return w < 0 ? 0 : w;
2640
    },
2641
 
2642
 
2643
    getComputedHeight : function(){
2644
        var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
2645
        if(!h){
2646
            h = parseInt(this.getStyle('height'), 10) || 0;
2647
            if(!this.isBorderBox()){
2648
                h += this.getFrameWidth('tb');
2649
            }
2650
        }
2651
        return h;
2652
    },
2653
 
2654
 
2655
    getComputedWidth : function(){
2656
        var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
2657
        if(!w){
2658
            w = parseInt(this.getStyle('width'), 10) || 0;
2659
            if(!this.isBorderBox()){
2660
                w += this.getFrameWidth('lr');
2661
            }
2662
        }
2663
        return w;
2664
    },
2665
 
2666
 
2667
    getSize : function(contentSize){
2668
        return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
2669
    },
2670
 
2671
    getStyleSize : function(){
2672
        var w, h, d = this.dom, s = d.style;
2673
        if(s.width && s.width != 'auto'){
2674
            w = parseInt(s.width, 10);
2675
            if(Ext.isBorderBox){
2676
               w -= this.getFrameWidth('lr');
2677
            }
2678
        }
2679
        if(s.height && s.height != 'auto'){
2680
            h = parseInt(s.height, 10);
2681
            if(Ext.isBorderBox){
2682
               h -= this.getFrameWidth('tb');
2683
            }
2684
        }
2685
        return {width: w || this.getWidth(true), height: h || this.getHeight(true)};
2686
 
2687
    },
2688
 
2689
 
2690
    getViewSize : function(){
2691
        var d = this.dom, doc = document, aw = 0, ah = 0;
2692
        if(d == doc || d == doc.body){
2693
            return {width : D.getViewWidth(), height: D.getViewHeight()};
2694
        }else{
2695
            return {
2696
                width : d.clientWidth,
2697
                height: d.clientHeight
2698
            };
2699
        }
2700
    },
2701
 
2702
 
2703
    getValue : function(asNumber){
2704
        return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
2705
    },
2706
 
2707
        adjustWidth : function(width){
2708
        if(typeof width == "number"){
2709
            if(this.autoBoxAdjust && !this.isBorderBox()){
2710
               width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
2711
            }
2712
            if(width < 0){
2713
                width = 0;
2714
            }
2715
        }
2716
        return width;
2717
    },
2718
 
2719
        adjustHeight : function(height){
2720
        if(typeof height == "number"){
2721
           if(this.autoBoxAdjust && !this.isBorderBox()){
2722
               height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
2723
           }
2724
           if(height < 0){
2725
               height = 0;
2726
           }
2727
        }
2728
        return height;
2729
    },
2730
 
2731
 
2732
    setWidth : function(width, animate){
2733
        width = this.adjustWidth(width);
2734
        if(!animate || !A){
2735
            this.dom.style.width = this.addUnits(width);
2736
        }else{
2737
            this.anim({width: {to: width}}, this.preanim(arguments, 1));
2738
        }
2739
        return this;
2740
    },
2741
 
2742
 
2743
     setHeight : function(height, animate){
2744
        height = this.adjustHeight(height);
2745
        if(!animate || !A){
2746
            this.dom.style.height = this.addUnits(height);
2747
        }else{
2748
            this.anim({height: {to: height}}, this.preanim(arguments, 1));
2749
        }
2750
        return this;
2751
    },
2752
 
2753
 
2754
     setSize : function(width, height, animate){
2755
        if(typeof width == "object"){             height = width.height; width = width.width;
2756
        }
2757
        width = this.adjustWidth(width); height = this.adjustHeight(height);
2758
        if(!animate || !A){
2759
            this.dom.style.width = this.addUnits(width);
2760
            this.dom.style.height = this.addUnits(height);
2761
        }else{
2762
            this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
2763
        }
2764
        return this;
2765
    },
2766
 
2767
 
2768
    setBounds : function(x, y, width, height, animate){
2769
        if(!animate || !A){
2770
            this.setSize(width, height);
2771
            this.setLocation(x, y);
2772
        }else{
2773
            width = this.adjustWidth(width); height = this.adjustHeight(height);
2774
            this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
2775
                          this.preanim(arguments, 4), 'motion');
2776
        }
2777
        return this;
2778
    },
2779
 
2780
 
2781
    setRegion : function(region, animate){
2782
        this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
2783
        return this;
2784
    },
2785
 
2786
 
2787
    addListener : function(eventName, fn, scope, options){
2788
        Ext.EventManager.on(this.dom,  eventName, fn, scope || this, options);
2789
    },
2790
 
2791
 
2792
    removeListener : function(eventName, fn){
2793
        Ext.EventManager.removeListener(this.dom,  eventName, fn);
2794
        return this;
2795
    },
2796
 
2797
 
2798
    removeAllListeners : function(){
2799
        E.purgeElement(this.dom);
2800
        return this;
2801
    },
2802
 
2803
 
2804
    relayEvent : function(eventName, observable){
2805
        this.on(eventName, function(e){
2806
            observable.fireEvent(eventName, e);
2807
        });
2808
    },
2809
 
2810
 
2811
     setOpacity : function(opacity, animate){
2812
        if(!animate || !A){
2813
            var s = this.dom.style;
2814
            if(Ext.isIE){
2815
                s.zoom = 1;
2816
                s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
2817
                           (opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");
2818
            }else{
2819
                s.opacity = opacity;
2820
            }
2821
        }else{
2822
            this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
2823
        }
2824
        return this;
2825
    },
2826
 
2827
 
2828
    getLeft : function(local){
2829
        if(!local){
2830
            return this.getX();
2831
        }else{
2832
            return parseInt(this.getStyle("left"), 10) || 0;
2833
        }
2834
    },
2835
 
2836
 
2837
    getRight : function(local){
2838
        if(!local){
2839
            return this.getX() + this.getWidth();
2840
        }else{
2841
            return (this.getLeft(true) + this.getWidth()) || 0;
2842
        }
2843
    },
2844
 
2845
 
2846
    getTop : function(local) {
2847
        if(!local){
2848
            return this.getY();
2849
        }else{
2850
            return parseInt(this.getStyle("top"), 10) || 0;
2851
        }
2852
    },
2853
 
2854
 
2855
    getBottom : function(local){
2856
        if(!local){
2857
            return this.getY() + this.getHeight();
2858
        }else{
2859
            return (this.getTop(true) + this.getHeight()) || 0;
2860
        }
2861
    },
2862
 
2863
 
2864
    position : function(pos, zIndex, x, y){
2865
        if(!pos){
2866
           if(this.getStyle('position') == 'static'){
2867
               this.setStyle('position', 'relative');
2868
           }
2869
        }else{
2870
            this.setStyle("position", pos);
2871
        }
2872
        if(zIndex){
2873
            this.setStyle("z-index", zIndex);
2874
        }
2875
        if(x !== undefined && y !== undefined){
2876
            this.setXY([x, y]);
2877
        }else if(x !== undefined){
2878
            this.setX(x);
2879
        }else if(y !== undefined){
2880
            this.setY(y);
2881
        }
2882
    },
2883
 
2884
 
2885
    clearPositioning : function(value){
2886
        value = value ||'';
2887
        this.setStyle({
2888
            "left": value,
2889
            "right": value,
2890
            "top": value,
2891
            "bottom": value,
2892
            "z-index": "",
2893
            "position" : "static"
2894
        });
2895
        return this;
2896
    },
2897
 
2898
 
2899
    getPositioning : function(){
2900
        var l = this.getStyle("left");
2901
        var t = this.getStyle("top");
2902
        return {
2903
            "position" : this.getStyle("position"),
2904
            "left" : l,
2905
            "right" : l ? "" : this.getStyle("right"),
2906
            "top" : t,
2907
            "bottom" : t ? "" : this.getStyle("bottom"),
2908
            "z-index" : this.getStyle("z-index")
2909
        };
2910
    },
2911
 
2912
 
2913
    getBorderWidth : function(side){
2914
        return this.addStyles(side, El.borders);
2915
    },
2916
 
2917
 
2918
    getPadding : function(side){
2919
        return this.addStyles(side, El.paddings);
2920
    },
2921
 
2922
 
2923
    setPositioning : function(pc){
2924
        this.applyStyles(pc);
2925
        if(pc.right == "auto"){
2926
            this.dom.style.right = "";
2927
        }
2928
        if(pc.bottom == "auto"){
2929
            this.dom.style.bottom = "";
2930
        }
2931
        return this;
2932
    },
2933
 
2934
        fixDisplay : function(){
2935
        if(this.getStyle("display") == "none"){
2936
            this.setStyle("visibility", "hidden");
2937
            this.setStyle("display", this.originalDisplay);             if(this.getStyle("display") == "none"){                 this.setStyle("display", "block");
2938
            }
2939
        }
2940
    },
2941
 
2942
    	setOverflow : function(v){
2943
    	if(v=='auto' && Ext.isMac && Ext.isGecko){     		this.dom.style.overflow = 'hidden';
2944
        	(function(){this.dom.style.overflow = 'auto';}).defer(1, this);
2945
    	}else{
2946
    		this.dom.style.overflow = v;
2947
    	}
2948
	},
2949
 
2950
 
2951
     setLeftTop : function(left, top){
2952
        this.dom.style.left = this.addUnits(left);
2953
        this.dom.style.top = this.addUnits(top);
2954
        return this;
2955
    },
2956
 
2957
 
2958
     move : function(direction, distance, animate){
2959
        var xy = this.getXY();
2960
        direction = direction.toLowerCase();
2961
        switch(direction){
2962
            case "l":
2963
            case "left":
2964
                this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
2965
                break;
2966
           case "r":
2967
           case "right":
2968
                this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
2969
                break;
2970
           case "t":
2971
           case "top":
2972
           case "up":
2973
                this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
2974
                break;
2975
           case "b":
2976
           case "bottom":
2977
           case "down":
2978
                this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
2979
                break;
2980
        }
2981
        return this;
2982
    },
2983
 
2984
 
2985
    clip : function(){
2986
        if(!this.isClipped){
2987
           this.isClipped = true;
2988
           this.originalClip = {
2989
               "o": this.getStyle("overflow"),
2990
               "x": this.getStyle("overflow-x"),
2991
               "y": this.getStyle("overflow-y")
2992
           };
2993
           this.setStyle("overflow", "hidden");
2994
           this.setStyle("overflow-x", "hidden");
2995
           this.setStyle("overflow-y", "hidden");
2996
        }
2997
        return this;
2998
    },
2999
 
3000
 
3001
    unclip : function(){
3002
        if(this.isClipped){
3003
            this.isClipped = false;
3004
            var o = this.originalClip;
3005
            if(o.o){this.setStyle("overflow", o.o);}
3006
            if(o.x){this.setStyle("overflow-x", o.x);}
3007
            if(o.y){this.setStyle("overflow-y", o.y);}
3008
        }
3009
        return this;
3010
    },
3011
 
3012
 
3013
 
3014
    getAnchorXY : function(anchor, local, s){
3015
 
3016
        var w, h, vp = false;
3017
        if(!s){
3018
            var d = this.dom;
3019
            if(d == document.body || d == document){
3020
                vp = true;
3021
                w = D.getViewWidth(); h = D.getViewHeight();
3022
            }else{
3023
                w = this.getWidth(); h = this.getHeight();
3024
            }
3025
        }else{
3026
            w = s.width;  h = s.height;
3027
        }
3028
        var x = 0, y = 0, r = Math.round;
3029
        switch((anchor || "tl").toLowerCase()){
3030
            case "c":
3031
                x = r(w*.5);
3032
                y = r(h*.5);
3033
            break;
3034
            case "t":
3035
                x = r(w*.5);
3036
                y = 0;
3037
            break;
3038
            case "l":
3039
                x = 0;
3040
                y = r(h*.5);
3041
            break;
3042
            case "r":
3043
                x = w;
3044
                y = r(h*.5);
3045
            break;
3046
            case "b":
3047
                x = r(w*.5);
3048
                y = h;
3049
            break;
3050
            case "tl":
3051
                x = 0;
3052
                y = 0;
3053
            break;
3054
            case "bl":
3055
                x = 0;
3056
                y = h;
3057
            break;
3058
            case "br":
3059
                x = w;
3060
                y = h;
3061
            break;
3062
            case "tr":
3063
                x = w;
3064
                y = 0;
3065
            break;
3066
        }
3067
        if(local === true){
3068
            return [x, y];
3069
        }
3070
        if(vp){
3071
            var sc = this.getScroll();
3072
            return [x + sc.left, y + sc.top];
3073
        }
3074
                var o = this.getXY();
3075
        return [x+o[0], y+o[1]];
3076
    },
3077
 
3078
 
3079
    getAlignToXY : function(el, p, o){
3080
        el = Ext.get(el);
3081
        if(!el || !el.dom){
3082
            throw "Element.alignToXY with an element that doesn't exist";
3083
        }
3084
        var d = this.dom;
3085
        var c = false;         var p1 = "", p2 = "";
3086
        o = o || [0,0];
3087
 
3088
        if(!p){
3089
            p = "tl-bl";
3090
        }else if(p == "?"){
3091
            p = "tl-bl?";
3092
        }else if(p.indexOf("-") == -1){
3093
            p = "tl-" + p;
3094
        }
3095
        p = p.toLowerCase();
3096
        var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
3097
        if(!m){
3098
           throw "Element.alignTo with an invalid alignment " + p;
3099
        }
3100
        p1 = m[1]; p2 = m[2]; c = !!m[3];
3101
 
3102
                        var a1 = this.getAnchorXY(p1, true);
3103
        var a2 = el.getAnchorXY(p2, false);
3104
 
3105
        var x = a2[0] - a1[0] + o[0];
3106
        var y = a2[1] - a1[1] + o[1];
3107
 
3108
        if(c){
3109
                        var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
3110
                        var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
3111
 
3112
                                                var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
3113
           var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
3114
           var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
3115
           var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
3116
 
3117
           var doc = document;
3118
           var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
3119
           var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
3120
 
3121
           if((x+w) > dw + scrollX){
3122
                x = swapX ? r.left-w : dw+scrollX-w;
3123
            }
3124
           if(x < scrollX){
3125
               x = swapX ? r.right : scrollX;
3126
           }
3127
           if((y+h) > dh + scrollY){
3128
                y = swapY ? r.top-h : dh+scrollY-h;
3129
            }
3130
           if (y < scrollY){
3131
               y = swapY ? r.bottom : scrollY;
3132
           }
3133
        }
3134
        return [x,y];
3135
    },
3136
 
3137
        getConstrainToXY : function(){
3138
        var os = {top:0, left:0, bottom:0, right: 0};
3139
 
3140
        return function(el, local, offsets, proposedXY){
3141
            el = Ext.get(el);
3142
            offsets = offsets ? Ext.applyIf(offsets, os) : os;
3143
 
3144
            var vw, vh, vx = 0, vy = 0;
3145
            if(el.dom == document.body || el.dom == document){
3146
                vw = Ext.lib.Dom.getViewWidth();
3147
                vh = Ext.lib.Dom.getViewHeight();
3148
            }else{
3149
                vw = el.dom.clientWidth;
3150
                vh = el.dom.clientHeight;
3151
                if(!local){
3152
                    var vxy = el.getXY();
3153
                    vx = vxy[0];
3154
                    vy = vxy[1];
3155
                }
3156
            }
3157
 
3158
            var s = el.getScroll();
3159
 
3160
            vx += offsets.left + s.left;
3161
            vy += offsets.top + s.top;
3162
 
3163
            vw -= offsets.right;
3164
            vh -= offsets.bottom;
3165
 
3166
            var vr = vx+vw;
3167
            var vb = vy+vh;
3168
 
3169
            var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
3170
            var x = xy[0], y = xy[1];
3171
            var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
3172
 
3173
                        var moved = false;
3174
 
3175
                        if((x + w) > vr){
3176
                x = vr - w;
3177
                moved = true;
3178
            }
3179
            if((y + h) > vb){
3180
                y = vb - h;
3181
                moved = true;
3182
            }
3183
                        if(x < vx){
3184
                x = vx;
3185
                moved = true;
3186
            }
3187
            if(y < vy){
3188
                y = vy;
3189
                moved = true;
3190
            }
3191
            return moved ? [x, y] : false;
3192
        };
3193
    }(),
3194
 
3195
        adjustForConstraints : function(xy, parent, offsets){
3196
        return this.getConstrainToXY(parent || document, false, offsets, xy) ||  xy;
3197
    },
3198
 
3199
 
3200
    alignTo : function(element, position, offsets, animate){
3201
        var xy = this.getAlignToXY(element, position, offsets);
3202
        this.setXY(xy, this.preanim(arguments, 3));
3203
        return this;
3204
    },
3205
 
3206
 
3207
    anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
3208
        var action = function(){
3209
            this.alignTo(el, alignment, offsets, animate);
3210
            Ext.callback(callback, this);
3211
        };
3212
        Ext.EventManager.onWindowResize(action, this);
3213
        var tm = typeof monitorScroll;
3214
        if(tm != 'undefined'){
3215
            Ext.EventManager.on(window, 'scroll', action, this,
3216
                {buffer: tm == 'number' ? monitorScroll : 50});
3217
        }
3218
        action.call(this);         return this;
3219
    },
3220
 
3221
    clearOpacity : function(){
3222
        if (window.ActiveXObject) {
3223
            if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
3224
                this.dom.style.filter = "";
3225
            }
3226
        } else {
3227
            this.dom.style.opacity = "";
3228
            this.dom.style["-moz-opacity"] = "";
3229
            this.dom.style["-khtml-opacity"] = "";
3230
        }
3231
        return this;
3232
    },
3233
 
3234
 
3235
    hide : function(animate){
3236
        this.setVisible(false, this.preanim(arguments, 0));
3237
        return this;
3238
    },
3239
 
3240
 
3241
    show : function(animate){
3242
        this.setVisible(true, this.preanim(arguments, 0));
3243
        return this;
3244
    },
3245
 
3246
 
3247
    addUnits : function(size){
3248
        return Ext.Element.addUnits(size, this.defaultUnit);
3249
    },
3250
 
3251
 
3252
    update : function(html, loadScripts, callback){
3253
        if(typeof html == "undefined"){
3254
            html = "";
3255
        }
3256
        if(loadScripts !== true){
3257
            this.dom.innerHTML = html;
3258
            if(typeof callback == "function"){
3259
                callback();
3260
            }
3261
            return this;
3262
        }
3263
        var id = Ext.id();
3264
        var dom = this.dom;
3265
 
3266
        html += '<span id="' + id + '"></span>';
3267
 
3268
        E.onAvailable(id, function(){
3269
            var hd = document.getElementsByTagName("head")[0];
3270
            var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
3271
            var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
3272
            var typeRe = /\stype=([\'\"])(.*?)\1/i;
3273
 
3274
            var match;
3275
            while(match = re.exec(html)){
3276
                var attrs = match[1];
3277
                var srcMatch = attrs ? attrs.match(srcRe) : false;
3278
                if(srcMatch && srcMatch[2]){
3279
                   var s = document.createElement("script");
3280
                   s.src = srcMatch[2];
3281
                   var typeMatch = attrs.match(typeRe);
3282
                   if(typeMatch && typeMatch[2]){
3283
                       s.type = typeMatch[2];
3284
                   }
3285
                   hd.appendChild(s);
3286
                }else if(match[2] && match[2].length > 0){
3287
                    if(window.execScript) {
3288
                       window.execScript(match[2]);
3289
                    } else {
3290
                       window.eval(match[2]);
3291
                    }
3292
                }
3293
            }
3294
            var el = document.getElementById(id);
3295
            if(el){Ext.removeNode(el);}
3296
            if(typeof callback == "function"){
3297
                callback();
3298
            }
3299
        });
3300
        dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
3301
        return this;
3302
    },
3303
 
3304
 
3305
    load : function(){
3306
        var um = this.getUpdater();
3307
        um.update.apply(um, arguments);
3308
        return this;
3309
    },
3310
 
3311
 
3312
    getUpdater : function(){
3313
        if(!this.updateManager){
3314
            this.updateManager = new Ext.Updater(this);
3315
        }
3316
        return this.updateManager;
3317
    },
3318
 
3319
 
3320
    unselectable : function(){
3321
        this.dom.unselectable = "on";
3322
        this.swallowEvent("selectstart", true);
3323
        this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
3324
        this.addClass("x-unselectable");
3325
        return this;
3326
    },
3327
 
3328
 
3329
    getCenterXY : function(){
3330
        return this.getAlignToXY(document, 'c-c');
3331
    },
3332
 
3333
 
3334
    center : function(centerIn){
3335
        this.alignTo(centerIn || document, 'c-c');
3336
        return this;
3337
    },
3338
 
3339
 
3340
    isBorderBox : function(){
3341
        return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;
3342
    },
3343
 
3344
 
3345
    getBox : function(contentBox, local){
3346
        var xy;
3347
        if(!local){
3348
            xy = this.getXY();
3349
        }else{
3350
            var left = parseInt(this.getStyle("left"), 10) || 0;
3351
            var top = parseInt(this.getStyle("top"), 10) || 0;
3352
            xy = [left, top];
3353
        }
3354
        var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
3355
        if(!contentBox){
3356
            bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
3357
        }else{
3358
            var l = this.getBorderWidth("l")+this.getPadding("l");
3359
            var r = this.getBorderWidth("r")+this.getPadding("r");
3360
            var t = this.getBorderWidth("t")+this.getPadding("t");
3361
            var b = this.getBorderWidth("b")+this.getPadding("b");
3362
            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)};
3363
        }
3364
        bx.right = bx.x + bx.width;
3365
        bx.bottom = bx.y + bx.height;
3366
        return bx;
3367
    },
3368
 
3369
 
3370
    getFrameWidth : function(sides, onlyContentBox){
3371
        return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
3372
    },
3373
 
3374
 
3375
    setBox : function(box, adjust, animate){
3376
        var w = box.width, h = box.height;
3377
        if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
3378
           w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
3379
           h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
3380
        }
3381
        this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
3382
        return this;
3383
    },
3384
 
3385
 
3386
     repaint : function(){
3387
        var dom = this.dom;
3388
        this.addClass("x-repaint");
3389
        setTimeout(function(){
3390
            Ext.get(dom).removeClass("x-repaint");
3391
        }, 1);
3392
        return this;
3393
    },
3394
 
3395
 
3396
    getMargins : function(side){
3397
        if(!side){
3398
            return {
3399
                top: parseInt(this.getStyle("margin-top"), 10) || 0,
3400
                left: parseInt(this.getStyle("margin-left"), 10) || 0,
3401
                bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
3402
                right: parseInt(this.getStyle("margin-right"), 10) || 0
3403
            };
3404
        }else{
3405
            return this.addStyles(side, El.margins);
3406
         }
3407
    },
3408
 
3409
        addStyles : function(sides, styles){
3410
        var val = 0, v, w;
3411
        for(var i = 0, len = sides.length; i < len; i++){
3412
            v = this.getStyle(styles[sides.charAt(i)]);
3413
            if(v){
3414
                 w = parseInt(v, 10);
3415
                 if(w){ val += (w >= 0 ? w : -1 * w); }
3416
            }
3417
        }
3418
        return val;
3419
    },
3420
 
3421
 
3422
    createProxy : function(config, renderTo, matchBox){
3423
        config = typeof config == "object" ?
3424
            config : {tag : "div", cls: config};
3425
 
3426
        var proxy;
3427
        if(renderTo){
3428
            proxy = Ext.DomHelper.append(renderTo, config, true);
3429
        }else {
3430
            proxy = Ext.DomHelper.insertBefore(this.dom, config, true);
3431
        }
3432
        if(matchBox){
3433
           proxy.setBox(this.getBox());
3434
        }
3435
        return proxy;
3436
    },
3437
 
3438
 
3439
    mask : function(msg, msgCls){
3440
        if(this.getStyle("position") == "static"){
3441
            this.setStyle("position", "relative");
3442
        }
3443
        if(this._maskMsg){
3444
            this._maskMsg.remove();
3445
        }
3446
        if(this._mask){
3447
            this._mask.remove();
3448
        }
3449
 
3450
        this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);
3451
 
3452
        this.addClass("x-masked");
3453
        this._mask.setDisplayed(true);
3454
        if(typeof msg == 'string'){
3455
            this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);
3456
            var mm = this._maskMsg;
3457
            mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";
3458
            mm.dom.firstChild.innerHTML = msg;
3459
            mm.setDisplayed(true);
3460
            mm.center(this);
3461
        }
3462
        if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){             this._mask.setSize(this.dom.clientWidth, this.getHeight());
3463
        }
3464
        return this._mask;
3465
    },
3466
 
3467
 
3468
    unmask : function(){
3469
        if(this._mask){
3470
            if(this._maskMsg){
3471
                this._maskMsg.remove();
3472
                delete this._maskMsg;
3473
            }
3474
            this._mask.remove();
3475
            delete this._mask;
3476
        }
3477
        this.removeClass("x-masked");
3478
    },
3479
 
3480
 
3481
    isMasked : function(){
3482
        return this._mask && this._mask.isVisible();
3483
    },
3484
 
3485
 
3486
    createShim : function(){
3487
        var el = document.createElement('iframe');
3488
        el.frameBorder = 'no';
3489
        el.className = 'ext-shim';
3490
        if(Ext.isIE && Ext.isSecure){
3491
            el.src = Ext.SSL_SECURE_URL;
3492
        }
3493
        var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
3494
        shim.autoBoxAdjust = false;
3495
        return shim;
3496
    },
3497
 
3498
 
3499
    remove : function(){
3500
        Ext.removeNode(this.dom);
3501
        delete El.cache[this.dom.id];
3502
    },
3503
 
3504
 
3505
    hover : function(overFn, outFn, scope){
3506
        var preOverFn = function(e){
3507
            if(!e.within(this, true)){
3508
                overFn.apply(scope || this, arguments);
3509
            }
3510
        };
3511
        var preOutFn = function(e){
3512
            if(!e.within(this, true)){
3513
                outFn.apply(scope || this, arguments);
3514
            }
3515
        };
3516
        this.on("mouseover", preOverFn, this.dom);
3517
        this.on("mouseout", preOutFn, this.dom);
3518
        return this;
3519
    },
3520
 
3521
 
3522
    addClassOnOver : function(className, preventFlicker){
3523
        this.hover(
3524
            function(){
3525
                Ext.fly(this, '_internal').addClass(className);
3526
            },
3527
            function(){
3528
                Ext.fly(this, '_internal').removeClass(className);
3529
            }
3530
        );
3531
        return this;
3532
    },
3533
 
3534
 
3535
    addClassOnFocus : function(className){
3536
        this.on("focus", function(){
3537
            Ext.fly(this, '_internal').addClass(className);
3538
        }, this.dom);
3539
        this.on("blur", function(){
3540
            Ext.fly(this, '_internal').removeClass(className);
3541
        }, this.dom);
3542
        return this;
3543
    },
3544
 
3545
    addClassOnClick : function(className){
3546
        var dom = this.dom;
3547
        this.on("mousedown", function(){
3548
            Ext.fly(dom, '_internal').addClass(className);
3549
            var d = Ext.getDoc();
3550
            var fn = function(){
3551
                Ext.fly(dom, '_internal').removeClass(className);
3552
                d.removeListener("mouseup", fn);
3553
            };
3554
            d.on("mouseup", fn);
3555
        });
3556
        return this;
3557
    },
3558
 
3559
 
3560
    swallowEvent : function(eventName, preventDefault){
3561
        var fn = function(e){
3562
            e.stopPropagation();
3563
            if(preventDefault){
3564
                e.preventDefault();
3565
            }
3566
        };
3567
        if(Ext.isArray(eventName)){
3568
            for(var i = 0, len = eventName.length; i < len; i++){
3569
                 this.on(eventName[i], fn);
3570
            }
3571
            return this;
3572
        }
3573
        this.on(eventName, fn);
3574
        return this;
3575
    },
3576
 
3577
 
3578
    parent : function(selector, returnDom){
3579
        return this.matchNode('parentNode', 'parentNode', selector, returnDom);
3580
    },
3581
 
3582
 
3583
    next : function(selector, returnDom){
3584
        return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
3585
    },
3586
 
3587
 
3588
    prev : function(selector, returnDom){
3589
        return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
3590
    },
3591
 
3592
 
3593
 
3594
    first : function(selector, returnDom){
3595
        return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
3596
    },
3597
 
3598
 
3599
    last : function(selector, returnDom){
3600
        return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
3601
    },
3602
 
3603
    matchNode : function(dir, start, selector, returnDom){
3604
        var n = this.dom[start];
3605
        while(n){
3606
            if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){
3607
                return !returnDom ? Ext.get(n) : n;
3608
            }
3609
            n = n[dir];
3610
        }
3611
        return null;
3612
    },
3613
 
3614
 
3615
    appendChild: function(el){
3616
        el = Ext.get(el);
3617
        el.appendTo(this);
3618
        return this;
3619
    },
3620
 
3621
 
3622
    createChild: function(config, insertBefore, returnDom){
3623
        config = config || {tag:'div'};
3624
        if(insertBefore){
3625
            return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
3626
        }
3627
        return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config,  returnDom !== true);
3628
    },
3629
 
3630
 
3631
    appendTo: function(el){
3632
        el = Ext.getDom(el);
3633
        el.appendChild(this.dom);
3634
        return this;
3635
    },
3636
 
3637
 
3638
    insertBefore: function(el){
3639
        el = Ext.getDom(el);
3640
        el.parentNode.insertBefore(this.dom, el);
3641
        return this;
3642
    },
3643
 
3644
 
3645
    insertAfter: function(el){
3646
        el = Ext.getDom(el);
3647
        el.parentNode.insertBefore(this.dom, el.nextSibling);
3648
        return this;
3649
    },
3650
 
3651
 
3652
    insertFirst: function(el, returnDom){
3653
        el = el || {};
3654
        if(typeof el == 'object' && !el.nodeType && !el.dom){             return this.createChild(el, this.dom.firstChild, returnDom);
3655
        }else{
3656
            el = Ext.getDom(el);
3657
            this.dom.insertBefore(el, this.dom.firstChild);
3658
            return !returnDom ? Ext.get(el) : el;
3659
        }
3660
    },
3661
 
3662
 
3663
    insertSibling: function(el, where, returnDom){
3664
        var rt;
3665
        if(Ext.isArray(el)){
3666
            for(var i = 0, len = el.length; i < len; i++){
3667
                rt = this.insertSibling(el[i], where, returnDom);
3668
            }
3669
            return rt;
3670
        }
3671
        where = where ? where.toLowerCase() : 'before';
3672
        el = el || {};
3673
        var refNode = where == 'before' ? this.dom : this.dom.nextSibling;
3674
 
3675
        if(typeof el == 'object' && !el.nodeType && !el.dom){             if(where == 'after' && !this.dom.nextSibling){
3676
                rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);
3677
            }else{
3678
                rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
3679
            }
3680
 
3681
        }else{
3682
            rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);
3683
            if(!returnDom){
3684
                rt = Ext.get(rt);
3685
            }
3686
        }
3687
        return rt;
3688
    },
3689
 
3690
 
3691
    wrap: function(config, returnDom){
3692
        if(!config){
3693
            config = {tag: "div"};
3694
        }
3695
        var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);
3696
        newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
3697
        return newEl;
3698
    },
3699
 
3700
 
3701
    replace: function(el){
3702
        el = Ext.get(el);
3703
        this.insertBefore(el);
3704
        el.remove();
3705
        return this;
3706
    },
3707
 
3708
 
3709
    replaceWith: function(el){
3710
        if(typeof el == 'object' && !el.nodeType && !el.dom){             el = this.insertSibling(el, 'before');
3711
        }else{
3712
            el = Ext.getDom(el);
3713
            this.dom.parentNode.insertBefore(el, this.dom);
3714
        }
3715
        El.uncache(this.id);
3716
        this.dom.parentNode.removeChild(this.dom);
3717
        this.dom = el;
3718
        this.id = Ext.id(el);
3719
        El.cache[this.id] = this;
3720
        return this;
3721
    },
3722
 
3723
 
3724
    insertHtml : function(where, html, returnEl){
3725
        var el = Ext.DomHelper.insertHtml(where, this.dom, html);
3726
        return returnEl ? Ext.get(el) : el;
3727
    },
3728
 
3729
 
3730
    set : function(o, useSet){
3731
        var el = this.dom;
3732
        useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
3733
        for(var attr in o){
3734
            if(attr == "style" || typeof o[attr] == "function") continue;
3735
            if(attr=="cls"){
3736
                el.className = o["cls"];
3737
            }else if(o.hasOwnProperty(attr)){
3738
                if(useSet) el.setAttribute(attr, o[attr]);
3739
                else el[attr] = o[attr];
3740
            }
3741
        }
3742
        if(o.style){
3743
            Ext.DomHelper.applyStyles(el, o.style);
3744
        }
3745
        return this;
3746
    },
3747
 
3748
 
3749
    addKeyListener : function(key, fn, scope){
3750
        var config;
3751
        if(typeof key != "object" || Ext.isArray(key)){
3752
            config = {
3753
                key: key,
3754
                fn: fn,
3755
                scope: scope
3756
            };
3757
        }else{
3758
            config = {
3759
                key : key.key,
3760
                shift : key.shift,
3761
                ctrl : key.ctrl,
3762
                alt : key.alt,
3763
                fn: fn,
3764
                scope: scope
3765
            };
3766
        }
3767
        return new Ext.KeyMap(this, config);
3768
    },
3769
 
3770
 
3771
    addKeyMap : function(config){
3772
        return new Ext.KeyMap(this, config);
3773
    },
3774
 
3775
 
3776
     isScrollable : function(){
3777
        var dom = this.dom;
3778
        return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
3779
    },
3780
 
3781
 
3782
    scrollTo : function(side, value, animate){
3783
        var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
3784
        if(!animate || !A){
3785
            this.dom[prop] = value;
3786
        }else{
3787
            var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
3788
            this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
3789
        }
3790
        return this;
3791
    },
3792
 
3793
 
3794
     scroll : function(direction, distance, animate){
3795
         if(!this.isScrollable()){
3796
             return;
3797
         }
3798
         var el = this.dom;
3799
         var l = el.scrollLeft, t = el.scrollTop;
3800
         var w = el.scrollWidth, h = el.scrollHeight;
3801
         var cw = el.clientWidth, ch = el.clientHeight;
3802
         direction = direction.toLowerCase();
3803
         var scrolled = false;
3804
         var a = this.preanim(arguments, 2);
3805
         switch(direction){
3806
             case "l":
3807
             case "left":
3808
                 if(w - l > cw){
3809
                     var v = Math.min(l + distance, w-cw);
3810
                     this.scrollTo("left", v, a);
3811
                     scrolled = true;
3812
                 }
3813
                 break;
3814
            case "r":
3815
            case "right":
3816
                 if(l > 0){
3817
                     var v = Math.max(l - distance, 0);
3818
                     this.scrollTo("left", v, a);
3819
                     scrolled = true;
3820
                 }
3821
                 break;
3822
            case "t":
3823
            case "top":
3824
            case "up":
3825
                 if(t > 0){
3826
                     var v = Math.max(t - distance, 0);
3827
                     this.scrollTo("top", v, a);
3828
                     scrolled = true;
3829
                 }
3830
                 break;
3831
            case "b":
3832
            case "bottom":
3833
            case "down":
3834
                 if(h - t > ch){
3835
                     var v = Math.min(t + distance, h-ch);
3836
                     this.scrollTo("top", v, a);
3837
                     scrolled = true;
3838
                 }
3839
                 break;
3840
         }
3841
         return scrolled;
3842
    },
3843
 
3844
 
3845
    translatePoints : function(x, y){
3846
        if(typeof x == 'object' || Ext.isArray(x)){
3847
            y = x[1]; x = x[0];
3848
        }
3849
        var p = this.getStyle('position');
3850
        var o = this.getXY();
3851
 
3852
        var l = parseInt(this.getStyle('left'), 10);
3853
        var t = parseInt(this.getStyle('top'), 10);
3854
 
3855
        if(isNaN(l)){
3856
            l = (p == "relative") ? 0 : this.dom.offsetLeft;
3857
        }
3858
        if(isNaN(t)){
3859
            t = (p == "relative") ? 0 : this.dom.offsetTop;
3860
        }
3861
 
3862
        return {left: (x - o[0] + l), top: (y - o[1] + t)};
3863
    },
3864
 
3865
 
3866
    getScroll : function(){
3867
        var d = this.dom, doc = document;
3868
        if(d == doc || d == doc.body){
3869
            var l, t;
3870
            if(Ext.isIE && Ext.isStrict){
3871
                l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);
3872
                t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);
3873
            }else{
3874
                l = window.pageXOffset || (doc.body.scrollLeft || 0);
3875
                t = window.pageYOffset || (doc.body.scrollTop || 0);
3876
            }
3877
            return {left: l, top: t};
3878
        }else{
3879
            return {left: d.scrollLeft, top: d.scrollTop};
3880
        }
3881
    },
3882
 
3883
 
3884
    getColor : function(attr, defaultValue, prefix){
3885
        var v = this.getStyle(attr);
3886
        if(!v || v == "transparent" || v == "inherit") {
3887
            return defaultValue;
3888
        }
3889
        var color = typeof prefix == "undefined" ? "#" : prefix;
3890
        if(v.substr(0, 4) == "rgb("){
3891
            var rvs = v.slice(4, v.length -1).split(",");
3892
            for(var i = 0; i < 3; i++){
3893
                var h = parseInt(rvs[i]);
3894
                var s = h.toString(16);
3895
                if(h < 16){
3896
                    s = "0" + s;
3897
                }
3898
                color += s;
3899
            }
3900
        } else {
3901
            if(v.substr(0, 1) == "#"){
3902
                if(v.length == 4) {
3903
                    for(var i = 1; i < 4; i++){
3904
                        var c = v.charAt(i);
3905
                        color +=  c + c;
3906
                    }
3907
                }else if(v.length == 7){
3908
                    color += v.substr(1);
3909
                }
3910
            }
3911
        }
3912
        return(color.length > 5 ? color.toLowerCase() : defaultValue);
3913
    },
3914
 
3915
 
3916
    boxWrap : function(cls){
3917
        cls = cls || 'x-box';
3918
        var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
3919
        el.child('.'+cls+'-mc').dom.appendChild(this.dom);
3920
        return el;
3921
    },
3922
 
3923
 
3924
    getAttributeNS : Ext.isIE ? function(ns, name){
3925
        var d = this.dom;
3926
        var type = typeof d[ns+":"+name];
3927
        if(type != 'undefined' && type != 'unknown'){
3928
            return d[ns+":"+name];
3929
        }
3930
        return d[name];
3931
    } : function(ns, name){
3932
        var d = this.dom;
3933
        return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
3934
    },
3935
 
3936
    getTextWidth : function(text, min, max){
3937
        return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);
3938
    }
3939
};
3940
 
3941
var ep = El.prototype;
3942
 
3943
 
3944
ep.on = ep.addListener;
3945
    ep.mon = ep.addListener;
3946
 
3947
ep.getUpdateManager = ep.getUpdater;
3948
 
3949
 
3950
ep.un = ep.removeListener;
3951
 
3952
 
3953
ep.autoBoxAdjust = true;
3954
 
3955
El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
3956
 
3957
El.addUnits = function(v, defaultUnit){
3958
    if(v === "" || v == "auto"){
3959
        return v;
3960
    }
3961
    if(v === undefined){
3962
        return '';
3963
    }
3964
    if(typeof v == "number" || !El.unitPattern.test(v)){
3965
        return v + (defaultUnit || 'px');
3966
    }
3967
    return v;
3968
};
3969
 
3970
El.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>';
3971
 
3972
El.VISIBILITY = 1;
3973
 
3974
El.DISPLAY = 2;
3975
 
3976
El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
3977
El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
3978
El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
3979
 
3980
 
3981
 
3982
 
3983
El.cache = {};
3984
 
3985
var docEl;
3986
 
3987
 
3988
El.get = function(el){
3989
    var ex, elm, id;
3990
    if(!el){ return null; }
3991
    if(typeof el == "string"){         if(!(elm = document.getElementById(el))){
3992
            return null;
3993
        }
3994
        if(ex = El.cache[el]){
3995
            ex.dom = elm;
3996
        }else{
3997
            ex = El.cache[el] = new El(elm);
3998
        }
3999
        return ex;
4000
    }else if(el.tagName){         if(!(id = el.id)){
4001
            id = Ext.id(el);
4002
        }
4003
        if(ex = El.cache[id]){
4004
            ex.dom = el;
4005
        }else{
4006
            ex = El.cache[id] = new El(el);
4007
        }
4008
        return ex;
4009
    }else if(el instanceof El){
4010
        if(el != docEl){
4011
            el.dom = document.getElementById(el.id) || el.dom;                                                                       El.cache[el.id] = el;         }
4012
        return el;
4013
    }else if(el.isComposite){
4014
        return el;
4015
    }else if(Ext.isArray(el)){
4016
        return El.select(el);
4017
    }else if(el == document){
4018
                if(!docEl){
4019
            var f = function(){};
4020
            f.prototype = El.prototype;
4021
            docEl = new f();
4022
            docEl.dom = document;
4023
        }
4024
        return docEl;
4025
    }
4026
    return null;
4027
};
4028
 
4029
El.uncache = function(el){
4030
    for(var i = 0, a = arguments, len = a.length; i < len; i++) {
4031
        if(a[i]){
4032
            delete El.cache[a[i].id || a[i]];
4033
        }
4034
    }
4035
};
4036
 
4037
El.garbageCollect = function(){
4038
    if(!Ext.enableGarbageCollector){
4039
        clearInterval(El.collectorThread);
4040
        return;
4041
    }
4042
    for(var eid in El.cache){
4043
        var el = El.cache[eid], d = el.dom;
4044
                                                                                                                                                if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
4045
            delete El.cache[eid];
4046
            if(d && Ext.enableListenerCollection){
4047
                E.purgeElement(d);
4048
            }
4049
        }
4050
    }
4051
}
4052
El.collectorThreadId = setInterval(El.garbageCollect, 30000);
4053
 
4054
var flyFn = function(){};
4055
flyFn.prototype = El.prototype;
4056
var _cls = new flyFn();
4057
 
4058
El.Flyweight = function(dom){
4059
    this.dom = dom;
4060
};
4061
 
4062
El.Flyweight.prototype = _cls;
4063
El.Flyweight.prototype.isFlyweight = true;
4064
 
4065
El._flyweights = {};
4066
 
4067
El.fly = function(el, named){
4068
    named = named || '_global';
4069
    el = Ext.getDom(el);
4070
    if(!el){
4071
        return null;
4072
    }
4073
    if(!El._flyweights[named]){
4074
        El._flyweights[named] = new El.Flyweight();
4075
    }
4076
    El._flyweights[named].dom = el;
4077
    return El._flyweights[named];
4078
};
4079
 
4080
 
4081
Ext.get = El.get;
4082
 
4083
Ext.fly = El.fly;
4084
 
4085
var noBoxAdjust = Ext.isStrict ? {
4086
    select:1
4087
} : {
4088
    input:1, select:1, textarea:1
4089
};
4090
if(Ext.isIE || Ext.isGecko){
4091
    noBoxAdjust['button'] = 1;
4092
}
4093
 
4094
 
4095
Ext.EventManager.on(window, 'unload', function(){
4096
    delete El.cache;
4097
    delete El._flyweights;
4098
});
4099
})();
4100
 
4101
Ext.enableFx = true;
4102
 
4103
 
4104
Ext.Fx = {
4105
 
4106
    slideIn : function(anchor, o){
4107
        var el = this.getFxEl();
4108
        o = o || {};
4109
 
4110
        el.queueFx(o, function(){
4111
 
4112
            anchor = anchor || "t";
4113
 
4114
                        this.fixDisplay();
4115
 
4116
                        var r = this.getFxRestore();
4117
            var b = this.getBox();
4118
                        this.setSize(b);
4119
 
4120
                        var wrap = this.fxWrap(r.pos, o, "hidden");
4121
 
4122
            var st = this.dom.style;
4123
            st.visibility = "visible";
4124
            st.position = "absolute";
4125
 
4126
                        var after = function(){
4127
                el.fxUnwrap(wrap, r.pos, o);
4128
                st.width = r.width;
4129
                st.height = r.height;
4130
                el.afterFx(o);
4131
            };
4132
                        var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
4133
 
4134
            switch(anchor.toLowerCase()){
4135
                case "t":
4136
                    wrap.setSize(b.width, 0);
4137
                    st.left = st.bottom = "0";
4138
                    a = {height: bh};
4139
                break;
4140
                case "l":
4141
                    wrap.setSize(0, b.height);
4142
                    st.right = st.top = "0";
4143
                    a = {width: bw};
4144
                break;
4145
                case "r":
4146
                    wrap.setSize(0, b.height);
4147
                    wrap.setX(b.right);
4148
                    st.left = st.top = "0";
4149
                    a = {width: bw, points: pt};
4150
                break;
4151
                case "b":
4152
                    wrap.setSize(b.width, 0);
4153
                    wrap.setY(b.bottom);
4154
                    st.left = st.top = "0";
4155
                    a = {height: bh, points: pt};
4156
                break;
4157
                case "tl":
4158
                    wrap.setSize(0, 0);
4159
                    st.right = st.bottom = "0";
4160
                    a = {width: bw, height: bh};
4161
                break;
4162
                case "bl":
4163
                    wrap.setSize(0, 0);
4164
                    wrap.setY(b.y+b.height);
4165
                    st.right = st.top = "0";
4166
                    a = {width: bw, height: bh, points: pt};
4167
                break;
4168
                case "br":
4169
                    wrap.setSize(0, 0);
4170
                    wrap.setXY([b.right, b.bottom]);
4171
                    st.left = st.top = "0";
4172
                    a = {width: bw, height: bh, points: pt};
4173
                break;
4174
                case "tr":
4175
                    wrap.setSize(0, 0);
4176
                    wrap.setX(b.x+b.width);
4177
                    st.left = st.bottom = "0";
4178
                    a = {width: bw, height: bh, points: pt};
4179
                break;
4180
            }
4181
            this.dom.style.visibility = "visible";
4182
            wrap.show();
4183
 
4184
            arguments.callee.anim = wrap.fxanim(a,
4185
                o,
4186
                'motion',
4187
                .5,
4188
                'easeOut', after);
4189
        });
4190
        return this;
4191
    },
4192
 
4193
 
4194
    slideOut : function(anchor, o){
4195
        var el = this.getFxEl();
4196
        o = o || {};
4197
 
4198
        el.queueFx(o, function(){
4199
 
4200
            anchor = anchor || "t";
4201
 
4202
                        var r = this.getFxRestore();
4203
 
4204
            var b = this.getBox();
4205
                        this.setSize(b);
4206
 
4207
                        var wrap = this.fxWrap(r.pos, o, "visible");
4208
 
4209
            var st = this.dom.style;
4210
            st.visibility = "visible";
4211
            st.position = "absolute";
4212
 
4213
            wrap.setSize(b);
4214
 
4215
            var after = function(){
4216
                if(o.useDisplay){
4217
                    el.setDisplayed(false);
4218
                }else{
4219
                    el.hide();
4220
                }
4221
 
4222
                el.fxUnwrap(wrap, r.pos, o);
4223
 
4224
                st.width = r.width;
4225
                st.height = r.height;
4226
 
4227
                el.afterFx(o);
4228
            };
4229
 
4230
            var a, zero = {to: 0};
4231
            switch(anchor.toLowerCase()){
4232
                case "t":
4233
                    st.left = st.bottom = "0";
4234
                    a = {height: zero};
4235
                break;
4236
                case "l":
4237
                    st.right = st.top = "0";
4238
                    a = {width: zero};
4239
                break;
4240
                case "r":
4241
                    st.left = st.top = "0";
4242
                    a = {width: zero, points: {to:[b.right, b.y]}};
4243
                break;
4244
                case "b":
4245
                    st.left = st.top = "0";
4246
                    a = {height: zero, points: {to:[b.x, b.bottom]}};
4247
                break;
4248
                case "tl":
4249
                    st.right = st.bottom = "0";
4250
                    a = {width: zero, height: zero};
4251
                break;
4252
                case "bl":
4253
                    st.right = st.top = "0";
4254
                    a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
4255
                break;
4256
                case "br":
4257
                    st.left = st.top = "0";
4258
                    a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
4259
                break;
4260
                case "tr":
4261
                    st.left = st.bottom = "0";
4262
                    a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
4263
                break;
4264
            }
4265
 
4266
            arguments.callee.anim = wrap.fxanim(a,
4267
                o,
4268
                'motion',
4269
                .5,
4270
                "easeOut", after);
4271
        });
4272
        return this;
4273
    },
4274
 
4275
 
4276
    puff : function(o){
4277
        var el = this.getFxEl();
4278
        o = o || {};
4279
 
4280
        el.queueFx(o, function(){
4281
            this.clearOpacity();
4282
            this.show();
4283
 
4284
                        var r = this.getFxRestore();
4285
            var st = this.dom.style;
4286
 
4287
            var after = function(){
4288
                if(o.useDisplay){
4289
                    el.setDisplayed(false);
4290
                }else{
4291
                    el.hide();
4292
                }
4293
 
4294
                el.clearOpacity();
4295
 
4296
                el.setPositioning(r.pos);
4297
                st.width = r.width;
4298
                st.height = r.height;
4299
                st.fontSize = '';
4300
                el.afterFx(o);
4301
            };
4302
 
4303
            var width = this.getWidth();
4304
            var height = this.getHeight();
4305
 
4306
            arguments.callee.anim = this.fxanim({
4307
                    width : {to: this.adjustWidth(width * 2)},
4308
                    height : {to: this.adjustHeight(height * 2)},
4309
                    points : {by: [-(width * .5), -(height * .5)]},
4310
                    opacity : {to: 0},
4311
                    fontSize: {to:200, unit: "%"}
4312
                },
4313
                o,
4314
                'motion',
4315
                .5,
4316
                "easeOut", after);
4317
        });
4318
        return this;
4319
    },
4320
 
4321
 
4322
    switchOff : function(o){
4323
        var el = this.getFxEl();
4324
        o = o || {};
4325
 
4326
        el.queueFx(o, function(){
4327
            this.clearOpacity();
4328
            this.clip();
4329
 
4330
                        var r = this.getFxRestore();
4331
            var st = this.dom.style;
4332
 
4333
            var after = function(){
4334
                if(o.useDisplay){
4335
                    el.setDisplayed(false);
4336
                }else{
4337
                    el.hide();
4338
                }
4339
 
4340
                el.clearOpacity();
4341
                el.setPositioning(r.pos);
4342
                st.width = r.width;
4343
                st.height = r.height;
4344
 
4345
                el.afterFx(o);
4346
            };
4347
 
4348
            this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
4349
                this.clearOpacity();
4350
                (function(){
4351
                    this.fxanim({
4352
                        height:{to:1},
4353
                        points:{by:[0, this.getHeight() * .5]}
4354
                    }, o, 'motion', 0.3, 'easeIn', after);
4355
                }).defer(100, this);
4356
            });
4357
        });
4358
        return this;
4359
    },
4360
 
4361
 
4362
    highlight : function(color, o){
4363
        var el = this.getFxEl();
4364
        o = o || {};
4365
 
4366
        el.queueFx(o, function(){
4367
            color = color || "ffff9c";
4368
            var attr = o.attr || "backgroundColor";
4369
 
4370
            this.clearOpacity();
4371
            this.show();
4372
 
4373
            var origColor = this.getColor(attr);
4374
            var restoreColor = this.dom.style[attr];
4375
            var endColor = (o.endColor || origColor) || "ffffff";
4376
 
4377
            var after = function(){
4378
                el.dom.style[attr] = restoreColor;
4379
                el.afterFx(o);
4380
            };
4381
 
4382
            var a = {};
4383
            a[attr] = {from: color, to: endColor};
4384
            arguments.callee.anim = this.fxanim(a,
4385
                o,
4386
                'color',
4387
                1,
4388
                'easeIn', after);
4389
        });
4390
        return this;
4391
    },
4392
 
4393
 
4394
    frame : function(color, count, o){
4395
        var el = this.getFxEl();
4396
        o = o || {};
4397
 
4398
        el.queueFx(o, function(){
4399
            color = color || "#C3DAF9";
4400
            if(color.length == 6){
4401
                color = "#" + color;
4402
            }
4403
            count = count || 1;
4404
            var duration = o.duration || 1;
4405
            this.show();
4406
 
4407
            var b = this.getBox();
4408
            var animFn = function(){
4409
                var proxy = Ext.getBody().createChild({
4410
                     style:{
4411
                        visbility:"hidden",
4412
                        position:"absolute",
4413
                        "z-index":"35000",                         border:"0px solid " + color
4414
                     }
4415
                  });
4416
                var scale = Ext.isBorderBox ? 2 : 1;
4417
                proxy.animate({
4418
                    top:{from:b.y, to:b.y - 20},
4419
                    left:{from:b.x, to:b.x - 20},
4420
                    borderWidth:{from:0, to:10},
4421
                    opacity:{from:1, to:0},
4422
                    height:{from:b.height, to:(b.height + (20*scale))},
4423
                    width:{from:b.width, to:(b.width + (20*scale))}
4424
                }, duration, function(){
4425
                    proxy.remove();
4426
                    if(--count > 0){
4427
                         animFn();
4428
                    }else{
4429
                        el.afterFx(o);
4430
                    }
4431
                });
4432
            };
4433
            animFn.call(this);
4434
        });
4435
        return this;
4436
    },
4437
 
4438
 
4439
    pause : function(seconds){
4440
        var el = this.getFxEl();
4441
        var o = {};
4442
 
4443
        el.queueFx(o, function(){
4444
            setTimeout(function(){
4445
                el.afterFx(o);
4446
            }, seconds * 1000);
4447
        });
4448
        return this;
4449
    },
4450
 
4451
 
4452
    fadeIn : function(o){
4453
        var el = this.getFxEl();
4454
        o = o || {};
4455
        el.queueFx(o, function(){
4456
            this.setOpacity(0);
4457
            this.fixDisplay();
4458
            this.dom.style.visibility = 'visible';
4459
            var to = o.endOpacity || 1;
4460
            arguments.callee.anim = this.fxanim({opacity:{to:to}},
4461
                o, null, .5, "easeOut", function(){
4462
                if(to == 1){
4463
                    this.clearOpacity();
4464
                }
4465
                el.afterFx(o);
4466
            });
4467
        });
4468
        return this;
4469
    },
4470
 
4471
 
4472
    fadeOut : function(o){
4473
        var el = this.getFxEl();
4474
        o = o || {};
4475
        el.queueFx(o, function(){
4476
            arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}},
4477
                o, null, .5, "easeOut", function(){
4478
                if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){
4479
                     this.dom.style.display = "none";
4480
                }else{
4481
                     this.dom.style.visibility = "hidden";
4482
                }
4483
                this.clearOpacity();
4484
                el.afterFx(o);
4485
            });
4486
        });
4487
        return this;
4488
    },
4489
 
4490
 
4491
    scale : function(w, h, o){
4492
        this.shift(Ext.apply({}, o, {
4493
            width: w,
4494
            height: h
4495
        }));
4496
        return this;
4497
    },
4498
 
4499
 
4500
    shift : function(o){
4501
        var el = this.getFxEl();
4502
        o = o || {};
4503
        el.queueFx(o, function(){
4504
            var a = {}, w = o.width, h = o.height, x = o.x, y = o.y,  op = o.opacity;
4505
            if(w !== undefined){
4506
                a.width = {to: this.adjustWidth(w)};
4507
            }
4508
            if(h !== undefined){
4509
                a.height = {to: this.adjustHeight(h)};
4510
            }
4511
            if(x !== undefined || y !== undefined){
4512
                a.points = {to: [
4513
                    x !== undefined ? x : this.getX(),
4514
                    y !== undefined ? y : this.getY()
4515
                ]};
4516
            }
4517
            if(op !== undefined){
4518
                a.opacity = {to: op};
4519
            }
4520
            if(o.xy !== undefined){
4521
                a.points = {to: o.xy};
4522
            }
4523
            arguments.callee.anim = this.fxanim(a,
4524
                o, 'motion', .35, "easeOut", function(){
4525
                el.afterFx(o);
4526
            });
4527
        });
4528
        return this;
4529
    },
4530
 
4531
 
4532
    ghost : function(anchor, o){
4533
        var el = this.getFxEl();
4534
        o = o || {};
4535
 
4536
        el.queueFx(o, function(){
4537
            anchor = anchor || "b";
4538
 
4539
                        var r = this.getFxRestore();
4540
            var w = this.getWidth(),
4541
                h = this.getHeight();
4542
 
4543
            var st = this.dom.style;
4544
 
4545
            var after = function(){
4546
                if(o.useDisplay){
4547
                    el.setDisplayed(false);
4548
                }else{
4549
                    el.hide();
4550
                }
4551
 
4552
                el.clearOpacity();
4553
                el.setPositioning(r.pos);
4554
                st.width = r.width;
4555
                st.height = r.height;
4556
 
4557
                el.afterFx(o);
4558
            };
4559
 
4560
            var a = {opacity: {to: 0}, points: {}}, pt = a.points;
4561
            switch(anchor.toLowerCase()){
4562
                case "t":
4563
                    pt.by = [0, -h];
4564
                break;
4565
                case "l":
4566
                    pt.by = [-w, 0];
4567
                break;
4568
                case "r":
4569
                    pt.by = [w, 0];
4570
                break;
4571
                case "b":
4572
                    pt.by = [0, h];
4573
                break;
4574
                case "tl":
4575
                    pt.by = [-w, -h];
4576
                break;
4577
                case "bl":
4578
                    pt.by = [-w, h];
4579
                break;
4580
                case "br":
4581
                    pt.by = [w, h];
4582
                break;
4583
                case "tr":
4584
                    pt.by = [w, -h];
4585
                break;
4586
            }
4587
 
4588
            arguments.callee.anim = this.fxanim(a,
4589
                o,
4590
                'motion',
4591
                .5,
4592
                "easeOut", after);
4593
        });
4594
        return this;
4595
    },
4596
 
4597
 
4598
    syncFx : function(){
4599
        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4600
            block : false,
4601
            concurrent : true,
4602
            stopFx : false
4603
        });
4604
        return this;
4605
    },
4606
 
4607
 
4608
    sequenceFx : function(){
4609
        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
4610
            block : false,
4611
            concurrent : false,
4612
            stopFx : false
4613
        });
4614
        return this;
4615
    },
4616
 
4617
 
4618
    nextFx : function(){
4619
        var ef = this.fxQueue[0];
4620
        if(ef){
4621
            ef.call(this);
4622
        }
4623
    },
4624
 
4625
 
4626
    hasActiveFx : function(){
4627
        return this.fxQueue && this.fxQueue[0];
4628
    },
4629
 
4630
 
4631
    stopFx : function(){
4632
        if(this.hasActiveFx()){
4633
            var cur = this.fxQueue[0];
4634
            if(cur && cur.anim && cur.anim.isAnimated()){
4635
                this.fxQueue = [cur];                 cur.anim.stop(true);
4636
            }
4637
        }
4638
        return this;
4639
    },
4640
 
4641
 
4642
    beforeFx : function(o){
4643
        if(this.hasActiveFx() && !o.concurrent){
4644
           if(o.stopFx){
4645
               this.stopFx();
4646
               return true;
4647
           }
4648
           return false;
4649
        }
4650
        return true;
4651
    },
4652
 
4653
 
4654
    hasFxBlock : function(){
4655
        var q = this.fxQueue;
4656
        return q && q[0] && q[0].block;
4657
    },
4658
 
4659
 
4660
    queueFx : function(o, fn){
4661
        if(!this.fxQueue){
4662
            this.fxQueue = [];
4663
        }
4664
        if(!this.hasFxBlock()){
4665
            Ext.applyIf(o, this.fxDefaults);
4666
            if(!o.concurrent){
4667
                var run = this.beforeFx(o);
4668
                fn.block = o.block;
4669
                this.fxQueue.push(fn);
4670
                if(run){
4671
                    this.nextFx();
4672
                }
4673
            }else{
4674
                fn.call(this);
4675
            }
4676
        }
4677
        return this;
4678
    },
4679
 
4680
 
4681
    fxWrap : function(pos, o, vis){
4682
        var wrap;
4683
        if(!o.wrap || !(wrap = Ext.get(o.wrap))){
4684
            var wrapXY;
4685
            if(o.fixPosition){
4686
                wrapXY = this.getXY();
4687
            }
4688
            var div = document.createElement("div");
4689
            div.style.visibility = vis;
4690
            wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
4691
            wrap.setPositioning(pos);
4692
            if(wrap.getStyle("position") == "static"){
4693
                wrap.position("relative");
4694
            }
4695
            this.clearPositioning('auto');
4696
            wrap.clip();
4697
            wrap.dom.appendChild(this.dom);
4698
            if(wrapXY){
4699
                wrap.setXY(wrapXY);
4700
            }
4701
        }
4702
        return wrap;
4703
    },
4704
 
4705
 
4706
    fxUnwrap : function(wrap, pos, o){
4707
        this.clearPositioning();
4708
        this.setPositioning(pos);
4709
        if(!o.wrap){
4710
            wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
4711
            wrap.remove();
4712
        }
4713
    },
4714
 
4715
 
4716
    getFxRestore : function(){
4717
        var st = this.dom.style;
4718
        return {pos: this.getPositioning(), width: st.width, height : st.height};
4719
    },
4720
 
4721
 
4722
    afterFx : function(o){
4723
        if(o.afterStyle){
4724
            this.applyStyles(o.afterStyle);
4725
        }
4726
        if(o.afterCls){
4727
            this.addClass(o.afterCls);
4728
        }
4729
        if(o.remove === true){
4730
            this.remove();
4731
        }
4732
        Ext.callback(o.callback, o.scope, [this]);
4733
        if(!o.concurrent){
4734
            this.fxQueue.shift();
4735
            this.nextFx();
4736
        }
4737
    },
4738
 
4739
 
4740
    getFxEl : function(){         return Ext.get(this.dom);
4741
    },
4742
 
4743
 
4744
    fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
4745
        animType = animType || 'run';
4746
        opt = opt || {};
4747
        var anim = Ext.lib.Anim[animType](
4748
            this.dom, args,
4749
            (opt.duration || defaultDur) || .35,
4750
            (opt.easing || defaultEase) || 'easeOut',
4751
            function(){
4752
                Ext.callback(cb, this);
4753
            },
4754
            this
4755
        );
4756
        opt.anim = anim;
4757
        return anim;
4758
    }
4759
};
4760
 
4761
Ext.Fx.resize = Ext.Fx.scale;
4762
 
4763
Ext.apply(Ext.Element.prototype, Ext.Fx);
4764
 
4765
 
4766
Ext.CompositeElement = function(els){
4767
    this.elements = [];
4768
    this.addElements(els);
4769
};
4770
Ext.CompositeElement.prototype = {
4771
    isComposite: true,
4772
    addElements : function(els){
4773
        if(!els) return this;
4774
        if(typeof els == "string"){
4775
            els = Ext.Element.selectorFunction(els);
4776
        }
4777
        var yels = this.elements;
4778
        var index = yels.length-1;
4779
        for(var i = 0, len = els.length; i < len; i++) {
4780
        	yels[++index] = Ext.get(els[i]);
4781
        }
4782
        return this;
4783
    },
4784
 
4785
 
4786
    fill : function(els){
4787
        this.elements = [];
4788
        this.add(els);
4789
        return this;
4790
    },
4791
 
4792
 
4793
    filter : function(selector){
4794
        var els = [];
4795
        this.each(function(el){
4796
            if(el.is(selector)){
4797
                els[els.length] = el.dom;
4798
            }
4799
        });
4800
        this.fill(els);
4801
        return this;
4802
    },
4803
 
4804
    invoke : function(fn, args){
4805
        var els = this.elements;
4806
        for(var i = 0, len = els.length; i < len; i++) {
4807
        	Ext.Element.prototype[fn].apply(els[i], args);
4808
        }
4809
        return this;
4810
    },
4811
 
4812
    add : function(els){
4813
        if(typeof els == "string"){
4814
            this.addElements(Ext.Element.selectorFunction(els));
4815
        }else if(els.length !== undefined){
4816
            this.addElements(els);
4817
        }else{
4818
            this.addElements([els]);
4819
        }
4820
        return this;
4821
    },
4822
 
4823
    each : function(fn, scope){
4824
        var els = this.elements;
4825
        for(var i = 0, len = els.length; i < len; i++){
4826
            if(fn.call(scope || els[i], els[i], this, i) === false) {
4827
                break;
4828
            }
4829
        }
4830
        return this;
4831
    },
4832
 
4833
 
4834
    item : function(index){
4835
        return this.elements[index] || null;
4836
    },
4837
 
4838
 
4839
    first : function(){
4840
        return this.item(0);
4841
    },
4842
 
4843
 
4844
    last : function(){
4845
        return this.item(this.elements.length-1);
4846
    },
4847
 
4848
 
4849
    getCount : function(){
4850
        return this.elements.length;
4851
    },
4852
 
4853
 
4854
    contains : function(el){
4855
        return this.indexOf(el) !== -1;
4856
    },
4857
 
4858
 
4859
    indexOf : function(el){
4860
        return this.elements.indexOf(Ext.get(el));
4861
    },
4862
 
4863
 
4864
 
4865
    removeElement : function(el, removeDom){
4866
        if(Ext.isArray(el)){
4867
            for(var i = 0, len = el.length; i < len; i++){
4868
                this.removeElement(el[i]);
4869
            }
4870
            return this;
4871
        }
4872
        var index = typeof el == 'number' ? el : this.indexOf(el);
4873
        if(index !== -1 && this.elements[index]){
4874
            if(removeDom){
4875
                var d = this.elements[index];
4876
                if(d.dom){
4877
                    d.remove();
4878
                }else{
4879
                    Ext.removeNode(d);
4880
                }
4881
            }
4882
            this.elements.splice(index, 1);
4883
        }
4884
        return this;
4885
    },
4886
 
4887
 
4888
    replaceElement : function(el, replacement, domReplace){
4889
        var index = typeof el == 'number' ? el : this.indexOf(el);
4890
        if(index !== -1){
4891
            if(domReplace){
4892
                this.elements[index].replaceWith(replacement);
4893
            }else{
4894
                this.elements.splice(index, 1, Ext.get(replacement))
4895
            }
4896
        }
4897
        return this;
4898
    },
4899
 
4900
 
4901
    clear : function(){
4902
        this.elements = [];
4903
    }
4904
};
4905
(function(){
4906
Ext.CompositeElement.createCall = function(proto, fnName){
4907
    if(!proto[fnName]){
4908
        proto[fnName] = function(){
4909
            return this.invoke(fnName, arguments);
4910
        };
4911
    }
4912
};
4913
for(var fnName in Ext.Element.prototype){
4914
    if(typeof Ext.Element.prototype[fnName] == "function"){
4915
        Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
4916
    }
4917
};
4918
})();
4919
 
4920
 
4921
Ext.CompositeElementLite = function(els){
4922
    Ext.CompositeElementLite.superclass.constructor.call(this, els);
4923
    this.el = new Ext.Element.Flyweight();
4924
};
4925
Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
4926
    addElements : function(els){
4927
        if(els){
4928
            if(Ext.isArray(els)){
4929
                this.elements = this.elements.concat(els);
4930
            }else{
4931
                var yels = this.elements;
4932
                var index = yels.length-1;
4933
                for(var i = 0, len = els.length; i < len; i++) {
4934
                    yels[++index] = els[i];
4935
                }
4936
            }
4937
        }
4938
        return this;
4939
    },
4940
    invoke : function(fn, args){
4941
        var els = this.elements;
4942
        var el = this.el;
4943
        for(var i = 0, len = els.length; i < len; i++) {
4944
            el.dom = els[i];
4945
        	Ext.Element.prototype[fn].apply(el, args);
4946
        }
4947
        return this;
4948
    },
4949
 
4950
    item : function(index){
4951
        if(!this.elements[index]){
4952
            return null;
4953
        }
4954
        this.el.dom = this.elements[index];
4955
        return this.el;
4956
    },
4957
 
4958
 
4959
    addListener : function(eventName, handler, scope, opt){
4960
        var els = this.elements;
4961
        for(var i = 0, len = els.length; i < len; i++) {
4962
            Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
4963
        }
4964
        return this;
4965
    },
4966
 
4967
 
4968
    each : function(fn, scope){
4969
        var els = this.elements;
4970
        var el = this.el;
4971
        for(var i = 0, len = els.length; i < len; i++){
4972
            el.dom = els[i];
4973
        	if(fn.call(scope || el, el, this, i) === false){
4974
                break;
4975
            }
4976
        }
4977
        return this;
4978
    },
4979
 
4980
    indexOf : function(el){
4981
        return this.elements.indexOf(Ext.getDom(el));
4982
    },
4983
 
4984
    replaceElement : function(el, replacement, domReplace){
4985
        var index = typeof el == 'number' ? el : this.indexOf(el);
4986
        if(index !== -1){
4987
            replacement = Ext.getDom(replacement);
4988
            if(domReplace){
4989
                var d = this.elements[index];
4990
                d.parentNode.insertBefore(replacement, d);
4991
                Ext.removeNode(d);
4992
            }
4993
            this.elements.splice(index, 1, replacement);
4994
        }
4995
        return this;
4996
    }
4997
});
4998
Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
4999
if(Ext.DomQuery){
5000
    Ext.Element.selectorFunction = Ext.DomQuery.select;
5001
}
5002
 
5003
Ext.Element.select = function(selector, unique, root){
5004
    var els;
5005
    if(typeof selector == "string"){
5006
        els = Ext.Element.selectorFunction(selector, root);
5007
    }else if(selector.length !== undefined){
5008
        els = selector;
5009
    }else{
5010
        throw "Invalid selector";
5011
    }
5012
    if(unique === true){
5013
        return new Ext.CompositeElement(els);
5014
    }else{
5015
        return new Ext.CompositeElementLite(els);
5016
    }
5017
};
5018
 
5019
Ext.select = Ext.Element.select;
5020
 
5021
Ext.data.Connection = function(config){
5022
    Ext.apply(this, config);
5023
    this.addEvents(
5024
 
5025
        "beforerequest",
5026
 
5027
        "requestcomplete",
5028
 
5029
        "requestexception"
5030
    );
5031
    Ext.data.Connection.superclass.constructor.call(this);
5032
};
5033
 
5034
Ext.extend(Ext.data.Connection, Ext.util.Observable, {
5035
 
5036
 
5037
 
5038
 
5039
 
5040
    timeout : 30000,
5041
 
5042
    autoAbort:false,
5043
 
5044
 
5045
    disableCaching: true,
5046
 
5047
 
5048
    request : function(o){
5049
        if(this.fireEvent("beforerequest", this, o) !== false){
5050
            var p = o.params;
5051
 
5052
            if(typeof p == "function"){
5053
                p = p.call(o.scope||window, o);
5054
            }
5055
            if(typeof p == "object"){
5056
                p = Ext.urlEncode(p);
5057
            }
5058
            if(this.extraParams){
5059
                var extras = Ext.urlEncode(this.extraParams);
5060
                p = p ? (p + '&' + extras) : extras;
5061
            }
5062
 
5063
            var url = o.url || this.url;
5064
            if(typeof url == 'function'){
5065
                url = url.call(o.scope||window, o);
5066
            }
5067
 
5068
            if(o.form){
5069
                var form = Ext.getDom(o.form);
5070
                url = url || form.action;
5071
 
5072
                var enctype = form.getAttribute("enctype");
5073
                if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
5074
                    return this.doFormUpload(o, p, url);
5075
                }
5076
                var f = Ext.lib.Ajax.serializeForm(form);
5077
                p = p ? (p + '&' + f) : f;
5078
            }
5079
 
5080
            var hs = o.headers;
5081
            if(this.defaultHeaders){
5082
                hs = Ext.apply(hs || {}, this.defaultHeaders);
5083
                if(!o.headers){
5084
                    o.headers = hs;
5085
                }
5086
            }
5087
 
5088
            var cb = {
5089
                success: this.handleResponse,
5090
                failure: this.handleFailure,
5091
                scope: this,
5092
                argument: {options: o},
5093
                timeout : o.timeout || this.timeout
5094
            };
5095
 
5096
            var method = o.method||this.method||(p ? "POST" : "GET");
5097
 
5098
            if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
5099
                url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
5100
            }
5101
 
5102
            if(typeof o.autoAbort == 'boolean'){
5103
                if(o.autoAbort){
5104
                    this.abort();
5105
                }
5106
            }else if(this.autoAbort !== false){
5107
                this.abort();
5108
            }
5109
            if((method == 'GET' && p) || o.xmlData || o.jsonData){
5110
                url += (url.indexOf('?') != -1 ? '&' : '?') + p;
5111
                p = '';
5112
            }
5113
            this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
5114
            return this.transId;
5115
        }else{
5116
            Ext.callback(o.callback, o.scope, [o, null, null]);
5117
            return null;
5118
        }
5119
    },
5120
 
5121
 
5122
    isLoading : function(transId){
5123
        if(transId){
5124
            return Ext.lib.Ajax.isCallInProgress(transId);
5125
        }else{
5126
            return this.transId ? true : false;
5127
        }
5128
    },
5129
 
5130
 
5131
    abort : function(transId){
5132
        if(transId || this.isLoading()){
5133
            Ext.lib.Ajax.abort(transId || this.transId);
5134
        }
5135
    },
5136
 
5137
 
5138
    handleResponse : function(response){
5139
        this.transId = false;
5140
        var options = response.argument.options;
5141
        response.argument = options ? options.argument : null;
5142
        this.fireEvent("requestcomplete", this, response, options);
5143
        Ext.callback(options.success, options.scope, [response, options]);
5144
        Ext.callback(options.callback, options.scope, [options, true, response]);
5145
    },
5146
 
5147
 
5148
    handleFailure : function(response, e){
5149
        this.transId = false;
5150
        var options = response.argument.options;
5151
        response.argument = options ? options.argument : null;
5152
        this.fireEvent("requestexception", this, response, options, e);
5153
        Ext.callback(options.failure, options.scope, [response, options]);
5154
        Ext.callback(options.callback, options.scope, [options, false, response]);
5155
    },
5156
 
5157
 
5158
    doFormUpload : function(o, ps, url){
5159
        var id = Ext.id();
5160
        var frame = document.createElement('iframe');
5161
        frame.id = id;
5162
        frame.name = id;
5163
        frame.className = 'x-hidden';
5164
        if(Ext.isIE){
5165
            frame.src = Ext.SSL_SECURE_URL;
5166
        }
5167
        document.body.appendChild(frame);
5168
 
5169
        if(Ext.isIE){
5170
           document.frames[id].name = id;
5171
        }
5172
 
5173
        var form = Ext.getDom(o.form);
5174
        form.target = id;
5175
        form.method = 'POST';
5176
        form.enctype = form.encoding = 'multipart/form-data';
5177
        if(url){
5178
            form.action = url;
5179
        }
5180
 
5181
        var hiddens, hd;
5182
        if(ps){
5183
            hiddens = [];
5184
            ps = Ext.urlDecode(ps, false);
5185
            for(var k in ps){
5186
                if(ps.hasOwnProperty(k)){
5187
                    hd = document.createElement('input');
5188
                    hd.type = 'hidden';
5189
                    hd.name = k;
5190
                    hd.value = ps[k];
5191
                    form.appendChild(hd);
5192
                    hiddens.push(hd);
5193
                }
5194
            }
5195
        }
5196
 
5197
        function cb(){
5198
            var r = {
5199
                responseText : '',
5200
                responseXML : null
5201
            };
5202
 
5203
            r.argument = o ? o.argument : null;
5204
 
5205
            try {
5206
                var doc;
5207
                if(Ext.isIE){
5208
                    doc = frame.contentWindow.document;
5209
                }else {
5210
                    doc = (frame.contentDocument || window.frames[id].document);
5211
                }
5212
                if(doc && doc.body){
5213
                    r.responseText = doc.body.innerHTML;
5214
                }
5215
                if(doc && doc.XMLDocument){
5216
                    r.responseXML = doc.XMLDocument;
5217
                }else {
5218
                    r.responseXML = doc;
5219
                }
5220
            }
5221
            catch(e) {
5222
 
5223
            }
5224
 
5225
            Ext.EventManager.removeListener(frame, 'load', cb, this);
5226
 
5227
            this.fireEvent("requestcomplete", this, r, o);
5228
 
5229
            Ext.callback(o.success, o.scope, [r, o]);
5230
            Ext.callback(o.callback, o.scope, [o, true, r]);
5231
 
5232
            setTimeout(function(){Ext.removeNode(frame);}, 100);
5233
        }
5234
 
5235
        Ext.EventManager.on(frame, 'load', cb, this);
5236
        form.submit();
5237
 
5238
        if(hiddens){
5239
            for(var i = 0, len = hiddens.length; i < len; i++){
5240
                Ext.removeNode(hiddens[i]);
5241
            }
5242
        }
5243
    }
5244
});
5245
 
5246
 
5247
Ext.Ajax = new Ext.data.Connection({
5248
 
5249
 
5250
 
5251
 
5252
 
5253
 
5254
 
5255
 
5256
 
5257
 
5258
 
5259
 
5260
 
5261
 
5262
 
5263
 
5264
 
5265
    autoAbort : false,
5266
 
5267
 
5268
    serializeForm : function(form){
5269
        return Ext.lib.Ajax.serializeForm(form);
5270
    }
5271
});
5272
 
5273
Ext.Updater = function(el, forceNew){
5274
    el = Ext.get(el);
5275
    if(!forceNew && el.updateManager){
5276
        return el.updateManager;
5277
    }
5278
 
5279
    this.el = el;
5280
 
5281
    this.defaultUrl = null;
5282
 
5283
    this.addEvents(
5284
 
5285
        "beforeupdate",
5286
 
5287
        "update",
5288
 
5289
        "failure"
5290
    );
5291
    var d = Ext.Updater.defaults;
5292
 
5293
    this.sslBlankUrl = d.sslBlankUrl;
5294
 
5295
    this.disableCaching = d.disableCaching;
5296
 
5297
    this.indicatorText = d.indicatorText;
5298
 
5299
    this.showLoadIndicator = d.showLoadIndicator;
5300
 
5301
    this.timeout = d.timeout;
5302
 
5303
 
5304
    this.loadScripts = d.loadScripts;
5305
 
5306
 
5307
    this.transaction = null;
5308
 
5309
 
5310
    this.autoRefreshProcId = null;
5311
 
5312
    this.refreshDelegate = this.refresh.createDelegate(this);
5313
 
5314
    this.updateDelegate = this.update.createDelegate(this);
5315
 
5316
    this.formUpdateDelegate = this.formUpdate.createDelegate(this);
5317
 
5318
    if(!this.renderer){
5319
 
5320
    this.renderer = new Ext.Updater.BasicRenderer();
5321
    }
5322
    Ext.Updater.superclass.constructor.call(this);
5323
};
5324
 
5325
Ext.extend(Ext.Updater, Ext.util.Observable, {
5326
 
5327
    getEl : function(){
5328
        return this.el;
5329
    },
5330
 
5331
    update : function(url, params, callback, discardUrl){
5332
        if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
5333
            var method = this.method, cfg, callerScope;
5334
            if(typeof url == "object"){
5335
                cfg = url;
5336
                url = cfg.url;
5337
                params = params || cfg.params;
5338
                callback = callback || cfg.callback;
5339
                discardUrl = discardUrl || cfg.discardUrl;
5340
	            callerScope = cfg.scope;
5341
                if(typeof cfg.method != "undefined"){method = cfg.method;};
5342
                if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
5343
                if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
5344
                if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
5345
                if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
5346
            }
5347
            this.showLoading();
5348
            if(!discardUrl){
5349
                this.defaultUrl = url;
5350
            }
5351
            if(typeof url == "function"){
5352
                url = url.call(this);
5353
            }
5354
 
5355
            method = method || (params ? "POST" : "GET");
5356
            if(method == "GET"){
5357
                url = this.prepareUrl(url);
5358
            }
5359
 
5360
            var o = Ext.apply(cfg ||{}, {
5361
                url : url,
5362
                params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,
5363
                success: this.processSuccess,
5364
                failure: this.processFailure,
5365
                scope: this,
5366
                callback: undefined,
5367
                timeout: (this.timeout*1000),
5368
                argument: {
5369
                	"options": cfg,
5370
                	"url": url,
5371
                	"form": null,
5372
                	"callback": callback,
5373
                	"scope": callerScope || window,
5374
                	"params": params
5375
                }
5376
            });
5377
 
5378
            this.transaction = Ext.Ajax.request(o);
5379
        }
5380
    },
5381
 
5382
 
5383
    formUpdate : function(form, url, reset, callback){
5384
        if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
5385
            if(typeof url == "function"){
5386
                url = url.call(this);
5387
            }
5388
            form = Ext.getDom(form)
5389
            this.transaction = Ext.Ajax.request({
5390
                form: form,
5391
                url:url,
5392
                success: this.processSuccess,
5393
                failure: this.processFailure,
5394
                scope: this,
5395
                timeout: (this.timeout*1000),
5396
                argument: {
5397
                	"url": url,
5398
                	"form": form,
5399
                	"callback": callback,
5400
                	"reset": reset
5401
                }
5402
            });
5403
            this.showLoading.defer(1, this);
5404
        }
5405
    },
5406
 
5407
 
5408
    refresh : function(callback){
5409
        if(this.defaultUrl == null){
5410
            return;
5411
        }
5412
        this.update(this.defaultUrl, null, callback, true);
5413
    },
5414
 
5415
 
5416
    startAutoRefresh : function(interval, url, params, callback, refreshNow){
5417
        if(refreshNow){
5418
            this.update(url || this.defaultUrl, params, callback, true);
5419
        }
5420
        if(this.autoRefreshProcId){
5421
            clearInterval(this.autoRefreshProcId);
5422
        }
5423
        this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
5424
    },
5425
 
5426
 
5427
     stopAutoRefresh : function(){
5428
        if(this.autoRefreshProcId){
5429
            clearInterval(this.autoRefreshProcId);
5430
            delete this.autoRefreshProcId;
5431
        }
5432
    },
5433
 
5434
    isAutoRefreshing : function(){
5435
       return this.autoRefreshProcId ? true : false;
5436
    },
5437
 
5438
    showLoading : function(){
5439
        if(this.showLoadIndicator){
5440
            this.el.update(this.indicatorText);
5441
        }
5442
    },
5443
 
5444
 
5445
    prepareUrl : function(url){
5446
        if(this.disableCaching){
5447
            var append = "_dc=" + (new Date().getTime());
5448
            if(url.indexOf("?") !== -1){
5449
                url += "&" + append;
5450
            }else{
5451
                url += "?" + append;
5452
            }
5453
        }
5454
        return url;
5455
    },
5456
 
5457
 
5458
    processSuccess : function(response){
5459
        this.transaction = null;
5460
        if(response.argument.form && response.argument.reset){
5461
            try{
5462
                response.argument.form.reset();
5463
            }catch(e){}
5464
        }
5465
        if(this.loadScripts){
5466
            this.renderer.render(this.el, response, this,
5467
                this.updateComplete.createDelegate(this, [response]));
5468
        }else{
5469
            this.renderer.render(this.el, response, this);
5470
            this.updateComplete(response);
5471
        }
5472
    },
5473
 
5474
    updateComplete : function(response){
5475
        this.fireEvent("update", this.el, response);
5476
        if(typeof response.argument.callback == "function"){
5477
            response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);
5478
        }
5479
    },
5480
 
5481
 
5482
    processFailure : function(response){
5483
        this.transaction = null;
5484
        this.fireEvent("failure", this.el, response);
5485
        if(typeof response.argument.callback == "function"){
5486
            response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);
5487
        }
5488
    },
5489
 
5490
 
5491
    setRenderer : function(renderer){
5492
        this.renderer = renderer;
5493
    },
5494
 
5495
    getRenderer : function(){
5496
       return this.renderer;
5497
    },
5498
 
5499
 
5500
    setDefaultUrl : function(defaultUrl){
5501
        this.defaultUrl = defaultUrl;
5502
    },
5503
 
5504
 
5505
    abort : function(){
5506
        if(this.transaction){
5507
            Ext.Ajax.abort(this.transaction);
5508
        }
5509
    },
5510
 
5511
 
5512
    isUpdating : function(){
5513
        if(this.transaction){
5514
            return Ext.Ajax.isLoading(this.transaction);
5515
        }
5516
        return false;
5517
    }
5518
});
5519
 
5520
 
5521
   Ext.Updater.defaults = {
5522
 
5523
         timeout : 30,
5524
 
5525
 
5526
        loadScripts : false,
5527
 
5528
 
5529
        sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
5530
 
5531
        disableCaching : false,
5532
 
5533
        showLoadIndicator : true,
5534
 
5535
        indicatorText : '<div class="loading-indicator">Loading...</div>'
5536
   };
5537
 
5538
 
5539
Ext.Updater.updateElement = function(el, url, params, options){
5540
    var um = Ext.get(el).getUpdater();
5541
    Ext.apply(um, options);
5542
    um.update(url, params, options ? options.callback : null);
5543
};
5544
 
5545
Ext.Updater.update = Ext.Updater.updateElement;
5546
 
5547
Ext.Updater.BasicRenderer = function(){};
5548
 
5549
Ext.Updater.BasicRenderer.prototype = {
5550
 
5551
     render : function(el, response, updateManager, callback){
5552
        el.update(response.responseText, updateManager.loadScripts, callback);
5553
    }
5554
};
5555
 
5556
Ext.UpdateManager = Ext.Updater;
5557
 
5558
 
5559
Ext.util.DelayedTask = function(fn, scope, args){
5560
    var id = null, d, t;
5561
 
5562
    var call = function(){
5563
        var now = new Date().getTime();
5564
        if(now - t >= d){
5565
            clearInterval(id);
5566
            id = null;
5567
            fn.apply(scope, args || []);
5568
        }
5569
    };
5570
 
5571
    this.delay = function(delay, newFn, newScope, newArgs){
5572
        if(id && delay != d){
5573
            this.cancel();
5574
        }
5575
        d = delay;
5576
        t = new Date().getTime();
5577
        fn = newFn || fn;
5578
        scope = newScope || scope;
5579
        args = newArgs || args;
5580
        if(!id){
5581
            id = setInterval(call, d);
5582
        }
5583
    };
5584
 
5585
 
5586
    this.cancel = function(){
5587
        if(id){
5588
            clearInterval(id);
5589
            id = null;
5590
        }
5591
    };
5592
};