ext-all-debug.js
上传用户:chliyg
上传日期:2016-05-15
资源大小:3196k
文件大小:951k
源码类别:

Jsp/Servlet

开发平台:

Java

  1.         this.updating = true;
  2.     },
  3.          endUpdate : function(){
  4.         this.updating = false;
  5.         this.sync(true);
  6.     },
  7.          hideUnders : function(negOffset){
  8.         if(this.shadow){
  9.             this.shadow.hide();
  10.         }
  11.         this.hideShim();
  12.     },
  13.          constrainXY : function(){
  14.         if(this.constrain){
  15.             var vw = Ext.lib.Dom.getViewWidth(),
  16.                 vh = Ext.lib.Dom.getViewHeight();
  17.             var s = Ext.getDoc().getScroll();
  18.             var xy = this.getXY();
  19.             var x = xy[0], y = xy[1];   
  20.             var w = this.dom.offsetWidth+this.shadowOffset, h = this.dom.offsetHeight+this.shadowOffset;
  21.                          var moved = false;
  22.                          if((x + w) > vw+s.left){
  23.                 x = vw - w - this.shadowOffset;
  24.                 moved = true;
  25.             }
  26.             if((y + h) > vh+s.top){
  27.                 y = vh - h - this.shadowOffset;
  28.                 moved = true;
  29.             }
  30.                          if(x < s.left){
  31.                 x = s.left;
  32.                 moved = true;
  33.             }
  34.             if(y < s.top){
  35.                 y = s.top;
  36.                 moved = true;
  37.             }
  38.             if(moved){
  39.                 if(this.avoidY){
  40.                     var ay = this.avoidY;
  41.                     if(y <= ay && (y+h) >= ay){
  42.                         y = ay-h-5;   
  43.                     }
  44.                 }
  45.                 xy = [x, y];
  46.                 this.storeXY(xy);
  47.                 supr.setXY.call(this, xy);
  48.                 this.sync();
  49.             }
  50.         }
  51.     },
  52.     isVisible : function(){
  53.         return this.visible;    
  54.     },
  55.          showAction : function(){
  56.         this.visible = true;          if(this.useDisplay === true){
  57.             this.setDisplayed("");
  58.         }else if(this.lastXY){
  59.             supr.setXY.call(this, this.lastXY);
  60.         }else if(this.lastLT){
  61.             supr.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]);
  62.         }
  63.     },
  64.          hideAction : function(){
  65.         this.visible = false;
  66.         if(this.useDisplay === true){
  67.             this.setDisplayed(false);
  68.         }else{
  69.             this.setLeftTop(-10000,-10000);
  70.         }
  71.     },
  72.          setVisible : function(v, a, d, c, e){
  73.         if(v){
  74.             this.showAction();
  75.         }
  76.         if(a && v){
  77.             var cb = function(){
  78.                 this.sync(true);
  79.                 if(c){
  80.                     c();
  81.                 }
  82.             }.createDelegate(this);
  83.             supr.setVisible.call(this, true, true, d, cb, e);
  84.         }else{
  85.             if(!v){
  86.                 this.hideUnders(true);
  87.             }
  88.             var cb = c;
  89.             if(a){
  90.                 cb = function(){
  91.                     this.hideAction();
  92.                     if(c){
  93.                         c();
  94.                     }
  95.                 }.createDelegate(this);
  96.             }
  97.             supr.setVisible.call(this, v, a, d, cb, e);
  98.             if(v){
  99.                 this.sync(true);
  100.             }else if(!a){
  101.                 this.hideAction();
  102.             }
  103.         }
  104.     },
  105.     storeXY : function(xy){
  106.         delete this.lastLT;
  107.         this.lastXY = xy;
  108.     },
  109.     storeLeftTop : function(left, top){
  110.         delete this.lastXY;
  111.         this.lastLT = [left, top];
  112.     },
  113.          beforeFx : function(){
  114.         this.beforeAction();
  115.         return Ext.Layer.superclass.beforeFx.apply(this, arguments);
  116.     },
  117.          afterFx : function(){
  118.         Ext.Layer.superclass.afterFx.apply(this, arguments);
  119.         this.sync(this.isVisible());
  120.     },
  121.          beforeAction : function(){
  122.         if(!this.updating && this.shadow){
  123.             this.shadow.hide();
  124.         }
  125.     },
  126.          setLeft : function(left){
  127.         this.storeLeftTop(left, this.getTop(true));
  128.         supr.setLeft.apply(this, arguments);
  129.         this.sync();
  130.     },
  131.     setTop : function(top){
  132.         this.storeLeftTop(this.getLeft(true), top);
  133.         supr.setTop.apply(this, arguments);
  134.         this.sync();
  135.     },
  136.     setLeftTop : function(left, top){
  137.         this.storeLeftTop(left, top);
  138.         supr.setLeftTop.apply(this, arguments);
  139.         this.sync();
  140.     },
  141.     setXY : function(xy, a, d, c, e){
  142.         this.fixDisplay();
  143.         this.beforeAction();
  144.         this.storeXY(xy);
  145.         var cb = this.createCB(c);
  146.         supr.setXY.call(this, xy, a, d, cb, e);
  147.         if(!a){
  148.             cb();
  149.         }
  150.     },
  151.          createCB : function(c){
  152.         var el = this;
  153.         return function(){
  154.             el.constrainXY();
  155.             el.sync(true);
  156.             if(c){
  157.                 c();
  158.             }
  159.         };
  160.     },
  161.          setX : function(x, a, d, c, e){
  162.         this.setXY([x, this.getY()], a, d, c, e);
  163.     },
  164.          setY : function(y, a, d, c, e){
  165.         this.setXY([this.getX(), y], a, d, c, e);
  166.     },
  167.          setSize : function(w, h, a, d, c, e){
  168.         this.beforeAction();
  169.         var cb = this.createCB(c);
  170.         supr.setSize.call(this, w, h, a, d, cb, e);
  171.         if(!a){
  172.             cb();
  173.         }
  174.     },
  175.          setWidth : function(w, a, d, c, e){
  176.         this.beforeAction();
  177.         var cb = this.createCB(c);
  178.         supr.setWidth.call(this, w, a, d, cb, e);
  179.         if(!a){
  180.             cb();
  181.         }
  182.     },
  183.          setHeight : function(h, a, d, c, e){
  184.         this.beforeAction();
  185.         var cb = this.createCB(c);
  186.         supr.setHeight.call(this, h, a, d, cb, e);
  187.         if(!a){
  188.             cb();
  189.         }
  190.     },
  191.          setBounds : function(x, y, w, h, a, d, c, e){
  192.         this.beforeAction();
  193.         var cb = this.createCB(c);
  194.         if(!a){
  195.             this.storeXY([x, y]);
  196.             supr.setXY.call(this, [x, y]);
  197.             supr.setSize.call(this, w, h, a, d, cb, e);
  198.             cb();
  199.         }else{
  200.             supr.setBounds.call(this, x, y, w, h, a, d, cb, e);
  201.         }
  202.         return this;
  203.     },
  204.     
  205.     
  206.     setZIndex : function(zindex){
  207.         this.zindex = zindex;
  208.         this.setStyle("z-index", zindex + 2);
  209.         if(this.shadow){
  210.             this.shadow.setZIndex(zindex + 1);
  211.         }
  212.         if(this.shim){
  213.             this.shim.setStyle("z-index", zindex);
  214.         }
  215.     }
  216. });
  217. })(); Ext.Shadow = function(config){     Ext.apply(this, config);     if(typeof this.mode != "string"){         this.mode = this.defaultMode;     }     var o = this.offset, a = {h: 0};     var rad = Math.floor(this.offset/2);     switch(this.mode.toLowerCase()){         case "drop":             a.w = 0;             a.l = a.t = o;             a.t -= 1;             if(Ext.isIE){                 a.l -= this.offset + rad;                 a.t -= this.offset + rad;                 a.w -= rad;                 a.h -= rad;                 a.t += 1;             }         break;         case "sides":             a.w = (o*2);             a.l = -o;             a.t = o-1;             if(Ext.isIE){                 a.l -= (this.offset - rad);                 a.t -= this.offset + rad;                 a.l += 1;                 a.w -= (this.offset - rad)*2;                 a.w -= rad + 1;                 a.h -= 1;             }         break;         case "frame":             a.w = a.h = (o*2);             a.l = a.t = -o;             a.t += 1;             a.h -= 2;             if(Ext.isIE){                 a.l -= (this.offset - rad);                 a.t -= (this.offset - rad);                 a.l += 1;                 a.w -= (this.offset + rad + 1);                 a.h -= (this.offset + rad);                 a.h += 1;             }         break;     };     this.adjusts = a; }; Ext.Shadow.prototype = {               offset: 4,         defaultMode: "drop",          show : function(target){         target = Ext.get(target);         if(!this.el){             this.el = Ext.Shadow.Pool.pull();             if(this.el.dom.nextSibling != target.dom){                 this.el.insertBefore(target);             }         }         this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1);         if(Ext.isIE){             this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";         }         this.realign(             target.getLeft(true),             target.getTop(true),             target.getWidth(),             target.getHeight()         );         this.el.dom.style.display = "block";     },          isVisible : function(){         return this.el ? true : false;       },          realign : function(l, t, w, h){         if(!this.el){             return;         }         var a = this.adjusts, d = this.el.dom, s = d.style;         var iea = 0;         s.left = (l+a.l)+"px";         s.top = (t+a.t)+"px";         var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px";         if(s.width != sws || s.height != shs){             s.width = sws;             s.height = shs;             if(!Ext.isIE){                 var cn = d.childNodes;                 var sww = Math.max(0, (sw-12))+"px";                 cn[0].childNodes[1].style.width = sww;                 cn[1].childNodes[1].style.width = sww;                 cn[2].childNodes[1].style.width = sww;                 cn[1].style.height = Math.max(0, (sh-12))+"px";             }         }     },          hide : function(){         if(this.el){             this.el.dom.style.display = "none";             Ext.Shadow.Pool.push(this.el);             delete this.el;         }     },          setZIndex : function(z){         this.zIndex = z;         if(this.el){             this.el.setStyle("z-index", z);         }     } }; Ext.Shadow.Pool = function(){     var p = [];     var markup = Ext.isIE ?                  '<div class="x-ie-shadow"></div>' :                  '<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';     return {         pull : function(){             var sh = p.shift();             if(!sh){                 sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));                 sh.autoBoxAdjust = false;             }             return sh;         },         push : function(sh){             p.push(sh);         }     }; }(); Ext.BoxComponent = Ext.extend(Ext.Component, {                                                  initComponent : function(){         Ext.BoxComponent.superclass.initComponent.call(this);         this.addEvents(                          'resize',                          'move'         );     },         boxReady : false,         deferHeight: false,          setSize : function(w, h){                 if(typeof w == 'object'){             h = w.height;             w = w.width;         }                 if(!this.boxReady){             this.width = w;             this.height = h;             return this;         }                 if(this.lastSize && this.lastSize.width == w && this.lastSize.height == h){             return this;         }         this.lastSize = {width: w, height: h};         var adj = this.adjustSize(w, h);         var aw = adj.width, ah = adj.height;         if(aw !== undefined || ah !== undefined){             var rz = this.getResizeEl();             if(!this.deferHeight && aw !== undefined && ah !== undefined){                 rz.setSize(aw, ah);             }else if(!this.deferHeight && ah !== undefined){                 rz.setHeight(ah);             }else if(aw !== undefined){                 rz.setWidth(aw);             }             this.onResize(aw, ah, w, h);             this.fireEvent('resize', this, aw, ah, w, h);         }         return this;     },          setWidth : function(width){         return this.setSize(width);     },          setHeight : function(height){         return this.setSize(undefined, height);     },          getSize : function(){         return this.el.getSize();     },          getPosition : function(local){         if(local === true){             return [this.el.getLeft(true), this.el.getTop(true)];         }         return this.xy || this.el.getXY();     },          getBox : function(local){         var s = this.el.getSize();         if(local === true){             s.x = this.el.getLeft(true);             s.y = this.el.getTop(true);         }else{             var xy = this.xy || this.el.getXY();             s.x = xy[0];             s.y = xy[1];         }         return s;     },          updateBox : function(box){         this.setSize(box.width, box.height);         this.setPagePosition(box.x, box.y);         return this;     },         getResizeEl : function(){         return this.resizeEl || this.el;     },         getPositionEl : function(){         return this.positionEl || this.el;     },          setPosition : function(x, y){         if(x && typeof x[1] == 'number'){             y = x[1];             x = x[0];         }         this.x = x;         this.y = y;         if(!this.boxReady){             return this;         }         var adj = this.adjustPosition(x, y);         var ax = adj.x, ay = adj.y;         var el = this.getPositionEl();         if(ax !== undefined || ay !== undefined){             if(ax !== undefined && ay !== undefined){                 el.setLeftTop(ax, ay);             }else if(ax !== undefined){                 el.setLeft(ax);             }else if(ay !== undefined){                 el.setTop(ay);             }             this.onPosition(ax, ay);             this.fireEvent('move', this, ax, ay);         }         return this;     },          setPagePosition : function(x, y){         if(x && typeof x[1] == 'number'){             y = x[1];             x = x[0];         }         this.pageX = x;         this.pageY = y;         if(!this.boxReady){             return;         }         if(x === undefined || y === undefined){             return;         }         var p = this.el.translatePoints(x, y);         this.setPosition(p.left, p.top);         return this;     },         onRender : function(ct, position){         Ext.BoxComponent.superclass.onRender.call(this, ct, position);         if(this.resizeEl){             this.resizeEl = Ext.get(this.resizeEl);         }         if(this.positionEl){             this.positionEl = Ext.get(this.positionEl);         }     },         afterRender : function(){         Ext.BoxComponent.superclass.afterRender.call(this);         this.boxReady = true;         this.setSize(this.width, this.height);         if(this.x || this.y){             this.setPosition(this.x, this.y);         }else if(this.pageX || this.pageY){             this.setPagePosition(this.pageX, this.pageY);         }     },          syncSize : function(){         delete this.lastSize;         this.setSize(this.autoWidth ? undefined : this.el.getWidth(), this.autoHeight ? undefined : this.el.getHeight());         return this;     },          onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){     },          onPosition : function(x, y){     },         adjustSize : function(w, h){         if(this.autoWidth){             w = 'auto';         }         if(this.autoHeight){             h = 'auto';         }         return {width : w, height: h};     },         adjustPosition : function(x, y){         return {x : x, y: y};     } }); Ext.reg('box', Ext.BoxComponent);
  218. Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){
  219.     
  220.     
  221.     this.el = Ext.get(dragElement, true);
  222.     this.el.dom.unselectable = "on";
  223.     
  224.     this.resizingEl = Ext.get(resizingElement, true);
  225.     
  226.     this.orientation = orientation || Ext.SplitBar.HORIZONTAL;
  227.     
  228.     
  229.     this.minSize = 0;
  230.     
  231.     
  232.     this.maxSize = 2000;
  233.     
  234.     
  235.     this.animate = false;
  236.     
  237.     
  238.     this.useShim = false;
  239.     
  240.     
  241.     this.shim = null;
  242.     
  243.     if(!existingProxy){
  244.         
  245.         this.proxy = Ext.SplitBar.createProxy(this.orientation);
  246.     }else{
  247.         this.proxy = Ext.get(existingProxy).dom;
  248.     }
  249.     
  250.     this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", {dragElId : this.proxy.id});
  251.     
  252.     
  253.     this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this);
  254.     
  255.     
  256.     this.dd.endDrag = this.onEndProxyDrag.createDelegate(this);
  257.     
  258.     
  259.     this.dragSpecs = {};
  260.     
  261.     
  262.     this.adapter = new Ext.SplitBar.BasicLayoutAdapter();
  263.     this.adapter.init(this);
  264.     
  265.     if(this.orientation == Ext.SplitBar.HORIZONTAL){
  266.         
  267.         this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT);
  268.         this.el.addClass("x-splitbar-h");
  269.     }else{
  270.         
  271.         this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM);
  272.         this.el.addClass("x-splitbar-v");
  273.     }
  274.     
  275.     this.addEvents(
  276.         
  277.         "resize",
  278.         
  279.         "moved",
  280.         
  281.         "beforeresize",
  282.         "beforeapply"
  283.     );
  284.     Ext.SplitBar.superclass.constructor.call(this);
  285. };
  286. Ext.extend(Ext.SplitBar, Ext.util.Observable, {
  287.     onStartProxyDrag : function(x, y){
  288.         this.fireEvent("beforeresize", this);
  289.         this.overlay =  Ext.DomHelper.append(document.body,  {cls: "x-drag-overlay", html: "&#160;"}, true);
  290.         this.overlay.unselectable();
  291.         this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
  292.         this.overlay.show();
  293.         Ext.get(this.proxy).setDisplayed("block");
  294.         var size = this.adapter.getElementSize(this);
  295.         this.activeMinSize = this.getMinimumSize();;
  296.         this.activeMaxSize = this.getMaximumSize();;
  297.         var c1 = size - this.activeMinSize;
  298.         var c2 = Math.max(this.activeMaxSize - size, 0);
  299.         if(this.orientation == Ext.SplitBar.HORIZONTAL){
  300.             this.dd.resetConstraints();
  301.             this.dd.setXConstraint(
  302.                 this.placement == Ext.SplitBar.LEFT ? c1 : c2, 
  303.                 this.placement == Ext.SplitBar.LEFT ? c2 : c1
  304.             );
  305.             this.dd.setYConstraint(0, 0);
  306.         }else{
  307.             this.dd.resetConstraints();
  308.             this.dd.setXConstraint(0, 0);
  309.             this.dd.setYConstraint(
  310.                 this.placement == Ext.SplitBar.TOP ? c1 : c2, 
  311.                 this.placement == Ext.SplitBar.TOP ? c2 : c1
  312.             );
  313.          }
  314.         this.dragSpecs.startSize = size;
  315.         this.dragSpecs.startPoint = [x, y];
  316.         Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, x, y);
  317.     },
  318.     
  319.     
  320.     onEndProxyDrag : function(e){
  321.         Ext.get(this.proxy).setDisplayed(false);
  322.         var endPoint = Ext.lib.Event.getXY(e);
  323.         if(this.overlay){
  324.             this.overlay.remove();
  325.             delete this.overlay;
  326.         }
  327.         var newSize;
  328.         if(this.orientation == Ext.SplitBar.HORIZONTAL){
  329.             newSize = this.dragSpecs.startSize + 
  330.                 (this.placement == Ext.SplitBar.LEFT ?
  331.                     endPoint[0] - this.dragSpecs.startPoint[0] :
  332.                     this.dragSpecs.startPoint[0] - endPoint[0]
  333.                 );
  334.         }else{
  335.             newSize = this.dragSpecs.startSize + 
  336.                 (this.placement == Ext.SplitBar.TOP ?
  337.                     endPoint[1] - this.dragSpecs.startPoint[1] :
  338.                     this.dragSpecs.startPoint[1] - endPoint[1]
  339.                 );
  340.         }
  341.         newSize = Math.min(Math.max(newSize, this.activeMinSize), this.activeMaxSize);
  342.         if(newSize != this.dragSpecs.startSize){
  343.             if(this.fireEvent('beforeapply', this, newSize) !== false){
  344.                 this.adapter.setElementSize(this, newSize);
  345.                 this.fireEvent("moved", this, newSize);
  346.                 this.fireEvent("resize", this, newSize);
  347.             }
  348.         }
  349.     },
  350.     
  351.     
  352.     getAdapter : function(){
  353.         return this.adapter;
  354.     },
  355.     
  356.     
  357.     setAdapter : function(adapter){
  358.         this.adapter = adapter;
  359.         this.adapter.init(this);
  360.     },
  361.     
  362.     
  363.     getMinimumSize : function(){
  364.         return this.minSize;
  365.     },
  366.     
  367.     
  368.     setMinimumSize : function(minSize){
  369.         this.minSize = minSize;
  370.     },
  371.     
  372.     
  373.     getMaximumSize : function(){
  374.         return this.maxSize;
  375.     },
  376.     
  377.     
  378.     setMaximumSize : function(maxSize){
  379.         this.maxSize = maxSize;
  380.     },
  381.     
  382.     
  383.     setCurrentSize : function(size){
  384.         var oldAnimate = this.animate;
  385.         this.animate = false;
  386.         this.adapter.setElementSize(this, size);
  387.         this.animate = oldAnimate;
  388.     },
  389.     
  390.     
  391.     destroy : function(removeEl){
  392.         if(this.shim){
  393.             this.shim.remove();
  394.         }
  395.         this.dd.unreg();
  396.         Ext.removeNode(this.proxy);
  397.         if(removeEl){
  398.             this.el.remove();
  399.         }
  400.     }
  401. });
  402. Ext.SplitBar.createProxy = function(dir){
  403.     var proxy = new Ext.Element(document.createElement("div"));
  404.     proxy.unselectable();
  405.     var cls = 'x-splitbar-proxy';
  406.     proxy.addClass(cls + ' ' + (dir == Ext.SplitBar.HORIZONTAL ? cls +'-h' : cls + '-v'));
  407.     document.body.appendChild(proxy.dom);
  408.     return proxy.dom;
  409. };
  410. Ext.SplitBar.BasicLayoutAdapter = function(){
  411. };
  412. Ext.SplitBar.BasicLayoutAdapter.prototype = {
  413.          init : function(s){
  414.     
  415.     },
  416.     
  417.      getElementSize : function(s){
  418.         if(s.orientation == Ext.SplitBar.HORIZONTAL){
  419.             return s.resizingEl.getWidth();
  420.         }else{
  421.             return s.resizingEl.getHeight();
  422.         }
  423.     },
  424.     
  425.     
  426.     setElementSize : function(s, newSize, onComplete){
  427.         if(s.orientation == Ext.SplitBar.HORIZONTAL){
  428.             if(!s.animate){
  429.                 s.resizingEl.setWidth(newSize);
  430.                 if(onComplete){
  431.                     onComplete(s, newSize);
  432.                 }
  433.             }else{
  434.                 s.resizingEl.setWidth(newSize, true, .1, onComplete, 'easeOut');
  435.             }
  436.         }else{
  437.             
  438.             if(!s.animate){
  439.                 s.resizingEl.setHeight(newSize);
  440.                 if(onComplete){
  441.                     onComplete(s, newSize);
  442.                 }
  443.             }else{
  444.                 s.resizingEl.setHeight(newSize, true, .1, onComplete, 'easeOut');
  445.             }
  446.         }
  447.     }
  448. };
  449. Ext.SplitBar.AbsoluteLayoutAdapter = function(container){
  450.     this.basic = new Ext.SplitBar.BasicLayoutAdapter();
  451.     this.container = Ext.get(container);
  452. };
  453. Ext.SplitBar.AbsoluteLayoutAdapter.prototype = {
  454.     init : function(s){
  455.         this.basic.init(s);
  456.     },
  457.     
  458.     getElementSize : function(s){
  459.         return this.basic.getElementSize(s);
  460.     },
  461.     
  462.     setElementSize : function(s, newSize, onComplete){
  463.         this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s]));
  464.     },
  465.     
  466.     moveSplitter : function(s){
  467.         var yes = Ext.SplitBar;
  468.         switch(s.placement){
  469.             case yes.LEFT:
  470.                 s.el.setX(s.resizingEl.getRight());
  471.                 break;
  472.             case yes.RIGHT:
  473.                 s.el.setStyle("right", (this.container.getWidth() - s.resizingEl.getLeft()) + "px");
  474.                 break;
  475.             case yes.TOP:
  476.                 s.el.setY(s.resizingEl.getBottom());
  477.                 break;
  478.             case yes.BOTTOM:
  479.                 s.el.setY(s.resizingEl.getTop() - s.el.getHeight());
  480.                 break;
  481.         }
  482.     }
  483. };
  484. Ext.SplitBar.VERTICAL = 1;
  485. Ext.SplitBar.HORIZONTAL = 2;
  486. Ext.SplitBar.LEFT = 1;
  487. Ext.SplitBar.RIGHT = 2;
  488. Ext.SplitBar.TOP = 3;
  489. Ext.SplitBar.BOTTOM = 4;
  490. Ext.Container = Ext.extend(Ext.BoxComponent, {                                             autoDestroy: true,               defaultType: 'panel',         initComponent : function(){         Ext.Container.superclass.initComponent.call(this);         this.addEvents(                          'afterlayout',                          'beforeadd',                          'beforeremove',                          'add',                          'remove'         );                  var items = this.items;         if(items){             delete this.items;             if(Ext.isArray(items)){                 this.add.apply(this, items);             }else{                 this.add(items);             }         }     },         initItems : function(){         if(!this.items){             this.items = new Ext.util.MixedCollection(false, this.getComponentId);             this.getLayout();         }     },         setLayout : function(layout){         if(this.layout && this.layout != layout){             this.layout.setContainer(null);         }         this.initItems();         this.layout = layout;         layout.setContainer(this);     },         render : function(){         Ext.Container.superclass.render.apply(this, arguments);         if(this.layout){             if(typeof this.layout == 'string'){                 this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);             }             this.setLayout(this.layout);             if(this.activeItem !== undefined){                 var item = this.activeItem;                 delete this.activeItem;                 this.layout.setActiveItem(item);                 return;             }         }         if(!this.ownerCt){             this.doLayout();         }         if(this.monitorResize === true){             Ext.EventManager.onWindowResize(this.doLayout, this, [false]);         }     },         getLayoutTarget : function(){         return this.el;     },         getComponentId : function(comp){         return comp.itemId || comp.id;     },          add : function(comp){         if(!this.items){             this.initItems();         }         var a = arguments, len = a.length;         if(len > 1){             for(var i = 0; i < len; i++) {                 this.add(a[i]);             }             return;         }         var c = this.lookupComponent(this.applyDefaults(comp));         var pos = this.items.length;         if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){             this.items.add(c);             c.ownerCt = this;             this.fireEvent('add', this, c, pos);         }         return c;     },          insert : function(index, comp){         if(!this.items){             this.initItems();         }         var a = arguments, len = a.length;         if(len > 2){             for(var i = len-1; i >= 1; --i) {                 this.insert(index, a[i]);             }             return;         }         var c = this.lookupComponent(this.applyDefaults(comp));         if(c.ownerCt == this && this.items.indexOf(c) < index){             --index;         }         if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){             this.items.insert(index, c);             c.ownerCt = this;             this.fireEvent('add', this, c, index);         }         return c;     },         applyDefaults : function(c){         if(this.defaults){             if(typeof c == 'string'){                 c = Ext.ComponentMgr.get(c);                 Ext.apply(c, this.defaults);             }else if(!c.events){                 Ext.applyIf(c, this.defaults);             }else{                 Ext.apply(c, this.defaults);             }         }         return c;     },         onBeforeAdd : function(item){         if(item.ownerCt){             item.ownerCt.remove(item, false);         }         if(this.hideBorders === true){             item.border = (item.border === true);         }     },          remove : function(comp, autoDestroy){         var c = this.getComponent(comp);         if(c && this.fireEvent('beforeremove', this, c) !== false){             this.items.remove(c);             delete c.ownerCt;             if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){                 c.destroy();             }             if(this.layout && this.layout.activeItem == c){                 delete this.layout.activeItem;             }             this.fireEvent('remove', this, c);         }         return c;     },          getComponent : function(comp){         if(typeof comp == 'object'){             return comp;         }         return this.items.get(comp);     },         lookupComponent : function(comp){         if(typeof comp == 'string'){             return Ext.ComponentMgr.get(comp);         }else if(!comp.events){             return this.createComponent(comp);         }         return comp;     },         createComponent : function(config){         return Ext.ComponentMgr.create(config, this.defaultType);     },          doLayout : function(shallow){         if(this.rendered && this.layout){             this.layout.layout();         }         if(shallow !== false && this.items){             var cs = this.items.items;             for(var i = 0, len = cs.length; i < len; i++) {                 var c  = cs[i];                 if(c.doLayout){                     c.doLayout();                 }             }         }     },          getLayout : function(){         if(!this.layout){             var layout = new Ext.layout.ContainerLayout(this.layoutConfig);             this.setLayout(layout);         }         return this.layout;     },         beforeDestroy : function(){         if(this.items){             Ext.destroy.apply(Ext, this.items.items);         }         if(this.monitorResize){             Ext.EventManager.removeResizeListener(this.doLayout, this);         }         if (this.layout && this.layout.destroy) {             this.layout.destroy();         }         Ext.Container.superclass.beforeDestroy.call(this);     },          bubble : function(fn, scope, args){         var p = this;         while(p){             if(fn.apply(scope || p, args || [p]) === false){                 break;             }             p = p.ownerCt;         }     },          cascade : function(fn, scope, args){         if(fn.apply(scope || this, args || [this]) !== false){             if(this.items){                 var cs = this.items.items;                 for(var i = 0, len = cs.length; i < len; i++){                     if(cs[i].cascade){                         cs[i].cascade(fn, scope, args);                     }else{                         fn.apply(scope || cs[i], args || [cs[i]]);                     }                 }             }         }     },          findById : function(id){         var m, ct = this;         this.cascade(function(c){             if(ct != c && c.id === id){                 m = c;                 return false;             }         });         return m || null;     },          findByType : function(xtype){         return typeof xtype == 'function' ?             this.findBy(function(c){                 return c.constructor === xtype;             }) :             this.findBy(function(c){                 return c.constructor.xtype === xtype;             });     },          find : function(prop, value){         return this.findBy(function(c){             return c[prop] === value;         });     },          findBy : function(fn, scope){         var m = [], ct = this;         this.cascade(function(c){             if(ct != c && fn.call(scope || c, c, ct) === true){                 m.push(c);             }         });         return m;     } }); Ext.Container.LAYOUTS = {}; Ext.reg('container', Ext.Container); Ext.layout.ContainerLayout = function(config){     Ext.apply(this, config); }; Ext.layout.ContainerLayout.prototype = {                        monitorResize:false,         activeItem : null,         layout : function(){         var target = this.container.getLayoutTarget();         this.onLayout(this.container, target);         this.container.fireEvent('afterlayout', this.container, this);     },         onLayout : function(ct, target){         this.renderAll(ct, target);     },         isValidParent : function(c, target){ var el = c.getPositionEl ? c.getPositionEl() : c.getEl(); return el.dom.parentNode == target.dom;     },         renderAll : function(ct, target){         var items = ct.items.items;         for(var i = 0, len = items.length; i < len; i++) {             var c = items[i];             if(c && (!c.rendered || !this.isValidParent(c, target))){                 this.renderItem(c, i, target);             }         }     },         renderItem : function(c, position, target){         if(c && !c.rendered){             c.render(target, position);             if(this.extraCls){              var t = c.getPositionEl ? c.getPositionEl() : c;              t.addClass(this.extraCls);             }             if (this.renderHidden && c != this.activeItem) {                 c.hide();             }         }else if(c && !this.isValidParent(c, target)){             if(this.extraCls){                 c.addClass(this.extraCls);             }             if(typeof position == 'number'){                 position = target.dom.childNodes[position];             }             target.dom.insertBefore(c.getEl().dom, position || null);             if (this.renderHidden && c != this.activeItem) {                 c.hide();             }         }     },         onResize: function(){         if(this.container.collapsed){             return;         }         var b = this.container.bufferResize;         if(b){             if(!this.resizeTask){                 this.resizeTask = new Ext.util.DelayedTask(this.layout, this);                 this.resizeBuffer = typeof b == 'number' ? b : 100;             }             this.resizeTask.delay(this.resizeBuffer);         }else{             this.layout();         }     },         setContainer : function(ct){         if(this.monitorResize && ct != this.container){             if(this.container){                 this.container.un('resize', this.onResize, this);             }             if(ct){                 ct.on('resize', this.onResize, this);             }         }         this.container = ct;     },         parseMargins : function(v){         var ms = v.split(' ');         var len = ms.length;         if(len == 1){             ms[1] = ms[0];             ms[2] = ms[0];             ms[3] = ms[0];         }         if(len == 2){             ms[2] = ms[0];             ms[3] = ms[1];         }         return {             top:parseInt(ms[0], 10) || 0,             right:parseInt(ms[1], 10) || 0,             bottom:parseInt(ms[2], 10) || 0,             left:parseInt(ms[3], 10) || 0         };     },     destroy : Ext.emptyFn }; Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;
  491. Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
  492.          monitorResize:true,
  493.          onLayout : function(ct, target){
  494.         Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
  495.         if(!this.container.collapsed){
  496.             this.setItemSize(this.activeItem || ct.items.itemAt(0), target.getStyleSize());
  497.         }
  498.     },
  499.          setItemSize : function(item, size){
  500.         if(item && size.height > 0){              item.setSize(size);
  501.         }
  502.     }
  503. });
  504. Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;
  505. Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, {
  506.     
  507.     deferredRender : false,
  508.          renderHidden : true,
  509.     
  510.     setActiveItem : function(item){
  511.         item = this.container.getComponent(item);
  512.         if(this.activeItem != item){
  513.             if(this.activeItem){
  514.                 this.activeItem.hide();
  515.             }
  516.             this.activeItem = item;
  517.             item.show();
  518.             this.layout();
  519.         }
  520.     },
  521.          renderAll : function(ct, target){
  522.         if(this.deferredRender){
  523.             this.renderItem(this.activeItem, undefined, target);
  524.         }else{
  525.             Ext.layout.CardLayout.superclass.renderAll.call(this, ct, target);
  526.         }
  527.     }
  528. });
  529. Ext.Container.LAYOUTS['card'] = Ext.layout.CardLayout;
  530. Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, {
  531.          monitorResize:true,
  532.          getAnchorViewSize : function(ct, target){
  533.         return target.dom == document.body ?
  534.                    target.getViewSize() : target.getStyleSize();
  535.     },
  536.          onLayout : function(ct, target){
  537.         Ext.layout.AnchorLayout.superclass.onLayout.call(this, ct, target);
  538.         var size = this.getAnchorViewSize(ct, target);
  539.         var w = size.width, h = size.height;
  540.         if(w < 20 || h < 20){
  541.             return;
  542.         }
  543.                  var aw, ah;
  544.         if(ct.anchorSize){
  545.             if(typeof ct.anchorSize == 'number'){
  546.                 aw = ct.anchorSize;
  547.             }else{
  548.                 aw = ct.anchorSize.width;
  549.                 ah = ct.anchorSize.height;
  550.             }
  551.         }else{
  552.             aw = ct.initialConfig.width;
  553.             ah = ct.initialConfig.height;
  554.         }
  555.         var cs = ct.items.items, len = cs.length, i, c, a, cw, ch;
  556.         for(i = 0; i < len; i++){
  557.             c = cs[i];
  558.             if(c.anchor){
  559.                 a = c.anchorSpec;
  560.                 if(!a){                      var vs = c.anchor.split(' ');
  561.                     c.anchorSpec = a = {
  562.                         right: this.parseAnchor(vs[0], c.initialConfig.width, aw),
  563.                         bottom: this.parseAnchor(vs[1], c.initialConfig.height, ah)
  564.                     };
  565.                 }
  566.                 cw = a.right ? this.adjustWidthAnchor(a.right(w), c) : undefined;
  567.                 ch = a.bottom ? this.adjustHeightAnchor(a.bottom(h), c) : undefined;
  568.                 if(cw || ch){
  569.                     c.setSize(cw || undefined, ch || undefined);
  570.                 }
  571.             }
  572.         }
  573.     },
  574.          parseAnchor : function(a, start, cstart){
  575.         if(a && a != 'none'){
  576.             var last;
  577.             if(/^(r|right|b|bottom)$/i.test(a)){                    var diff = cstart - start;
  578.                 return function(v){
  579.                     if(v !== last){
  580.                         last = v;
  581.                         return v - diff;
  582.                     }
  583.                 }
  584.             }else if(a.indexOf('%') != -1){
  585.                 var ratio = parseFloat(a.replace('%', ''))*.01;                    return function(v){
  586.                     if(v !== last){
  587.                         last = v;
  588.                         return Math.floor(v*ratio);
  589.                     }
  590.                 }
  591.             }else{
  592.                 a = parseInt(a, 10);
  593.                 if(!isNaN(a)){                                                 return function(v){
  594.                         if(v !== last){
  595.                             last = v;
  596.                             return v + a;
  597.                         }
  598.                     }
  599.                 }
  600.             }
  601.         }
  602.         return false;
  603.     },
  604.          adjustWidthAnchor : function(value, comp){
  605.         return value;
  606.     },
  607.          adjustHeightAnchor : function(value, comp){
  608.         return value;
  609.     }
  610.     
  611.     
  612. });
  613. Ext.Container.LAYOUTS['anchor'] = Ext.layout.AnchorLayout;
  614. Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
  615.          monitorResize:true,
  616.          extraCls: 'x-column',
  617.     scrollOffset : 0,
  618.          isValidParent : function(c, target){
  619.         return c.getEl().dom.parentNode == this.innerCt.dom;
  620.     },
  621.          onLayout : function(ct, target){
  622.         var cs = ct.items.items, len = cs.length, c, i;
  623.         if(!this.innerCt){
  624.             target.addClass('x-column-layout-ct');
  625.                                       this.innerCt = target.createChild({cls:'x-column-inner'});
  626.             this.innerCt.createChild({cls:'x-clear'});
  627.         }
  628.         this.renderAll(ct, this.innerCt);
  629.         var size = Ext.isIE && target.dom != Ext.getBody().dom ? target.getStyleSize() : target.getViewSize();
  630.         if(size.width < 1 && size.height < 1){              return;
  631.         }
  632.         var w = size.width - target.getPadding('lr') - this.scrollOffset,
  633.             h = size.height - target.getPadding('tb'),
  634.             pw = w;
  635.         this.innerCt.setWidth(w);
  636.         
  637.                  
  638.         for(i = 0; i < len; i++){
  639.             c = cs[i];
  640.             if(!c.columnWidth){
  641.                 pw -= (c.getSize().width + c.getEl().getMargins('lr'));
  642.             }
  643.         }
  644.         pw = pw < 0 ? 0 : pw;
  645.         for(i = 0; i < len; i++){
  646.             c = cs[i];
  647.             if(c.columnWidth){
  648.                 c.setSize(Math.floor(c.columnWidth*pw) - c.getEl().getMargins('lr'));
  649.             }
  650.         }
  651.     }
  652.     
  653.     
  654. });
  655. Ext.Container.LAYOUTS['column'] = Ext.layout.ColumnLayout; Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {         monitorResize:true,         rendered : false,         onLayout : function(ct, target){         var collapsed;         if(!this.rendered){             target.position();             target.addClass('x-border-layout-ct');             var items = ct.items.items;             collapsed = [];             for(var i = 0, len = items.length; i < len; i++) {                 var c = items[i];                 var pos = c.region;                 if(c.collapsed){                     collapsed.push(c);                 }                 c.collapsed = false;                 if(!c.rendered){                     c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel';                     c.render(target, i);                 }                 this[pos] = pos != 'center' && c.split ?                     new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :                     new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);                 this[pos].render(target, c);             }             this.rendered = true;         }         var size = target.getViewSize();         if(size.width < 20 || size.height < 20){             if(collapsed){                 this.restoreCollapsed = collapsed;             }             return;         }else if(this.restoreCollapsed){             collapsed = this.restoreCollapsed;             delete this.restoreCollapsed;         }         var w = size.width, h = size.height;         var centerW = w, centerH = h, centerY = 0, centerX = 0;         var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center;         if(!c){             throw 'No center region defined in BorderLayout ' + ct.id;         }         if(n && n.isVisible()){             var b = n.getSize();             var m = n.getMargins();             b.width = w - (m.left+m.right);             b.x = m.left;             b.y = m.top;             centerY = b.height + b.y + m.bottom;             centerH -= centerY;             n.applyLayout(b);         }         if(s && s.isVisible()){             var b = s.getSize();             var m = s.getMargins();             b.width = w - (m.left+m.right);             b.x = m.left;             var totalHeight = (b.height + m.top + m.bottom);             b.y = h - totalHeight + m.top;             centerH -= totalHeight;             s.applyLayout(b);         }         if(west && west.isVisible()){             var b = west.getSize();             var m = west.getMargins();             b.height = centerH - (m.top+m.bottom);             b.x = m.left;             b.y = centerY + m.top;             var totalWidth = (b.width + m.left + m.right);             centerX += totalWidth;             centerW -= totalWidth;             west.applyLayout(b);         }         if(e && e.isVisible()){             var b = e.getSize();             var m = e.getMargins();             b.height = centerH - (m.top+m.bottom);             var totalWidth = (b.width + m.left + m.right);             b.x = w - totalWidth + m.left;             b.y = centerY + m.top;             centerW -= totalWidth;             e.applyLayout(b);         }         var m = c.getMargins();         var centerBox = {             x: centerX + m.left,             y: centerY + m.top,             width: centerW - (m.left+m.right),             height: centerH - (m.top+m.bottom)         };         c.applyLayout(centerBox);         if(collapsed){             for(var i = 0, len = collapsed.length; i < len; i++){                 collapsed[i].collapse(false);             }         }         if(Ext.isIE && Ext.isStrict){             target.repaint();         }     },     destroy: function() {         var r = ['north', 'south', 'east', 'west'];         for (var i = 0; i < r.length; i++) {             var region = this[r[i]];             if (region && region.split) {                 region.split.destroy(true);             }         }         Ext.layout.BorderLayout.superclass.destroy.call(this);     }           }); Ext.layout.BorderLayout.Region = function(layout, config, pos){     Ext.apply(this, config);     this.layout = layout;     this.position = pos;     this.state = {};     if(typeof this.margins == 'string'){         this.margins = this.layout.parseMargins(this.margins);     }     this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);     if(this.collapsible){         if(typeof this.cmargins == 'string'){             this.cmargins = this.layout.parseMargins(this.cmargins);         }         if(this.collapseMode == 'mini' && !this.cmargins){             this.cmargins = {left:0,top:0,right:0,bottom:0};         }else{             this.cmargins = Ext.applyIf(this.cmargins || {},                 pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);         }     } }; Ext.layout.BorderLayout.Region.prototype = {                                   collapsible : false,          split:false,          floatable: true,          minWidth:50,          minHeight:50,         defaultMargins : {left:0,top:0,right:0,bottom:0},         defaultNSCMargins : {left:5,top:5,right:5,bottom:5},         defaultEWCMargins : {left:5,top:0,right:5,bottom:0},          isCollapsed : false,                        render : function(ct, p){         this.panel = p;         p.el.enableDisplayMode();         this.targetEl = ct;         this.el = p.el;         var gs = p.getState, ps = this.position;         p.getState = function(){             return Ext.apply(gs.call(p) || {}, this.state);         }.createDelegate(this);         if(ps != 'center'){             p.allowQueuedExpand = false;             p.on({                 beforecollapse: this.beforeCollapse,                 collapse: this.onCollapse,                 beforeexpand: this.beforeExpand,                 expand: this.onExpand,                 hide: this.onHide,                 show: this.onShow,                 scope: this             });             if(this.collapsible){                 p.collapseEl = 'el';                 p.slideAnchor = this.getSlideAnchor();             }             if(p.tools && p.tools.toggle){                 p.tools.toggle.addClass('x-tool-collapse-'+ps);                 p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');             }         }     },         getCollapsedEl : function(){         if(!this.collapsedEl){             if(!this.toolTemplate){                 var tt = new Ext.Template(                      '<div class="x-tool x-tool-{id}">&#160;</div>'                 );                 tt.disableFormats = true;                 tt.compile();                 Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;             }             this.collapsedEl = this.targetEl.createChild({                 cls: "x-layout-collapsed x-layout-collapsed-"+this.position,                 id: this.panel.id + '-xcollapsed'             });             this.collapsedEl.enableDisplayMode('block');             if(this.collapseMode == 'mini'){                 this.collapsedEl.addClass('x-layout-cmini-'+this.position);                 this.miniCollapsedEl = this.collapsedEl.createChild({                     cls: "x-layout-mini x-layout-mini-"+this.position, html: "&#160;"                 });                 this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');                 this.collapsedEl.addClassOnOver("x-layout-collapsed-over");                 this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});             }else {                 var t = this.toolTemplate.append(                         this.collapsedEl.dom,                         {id:'expand-'+this.position}, true);                 t.addClassOnOver('x-tool-expand-'+this.position+'-over');                 t.on('click', this.onExpandClick, this, {stopEvent:true});                                  if(this.floatable !== false){                    this.collapsedEl.addClassOnOver("x-layout-collapsed-over");                    this.collapsedEl.on("click", this.collapseClick, this);                 }             }         }         return this.collapsedEl;     },         onExpandClick : function(e){         if(this.isSlid){             this.afterSlideIn();             this.panel.expand(false);         }else{             this.panel.expand();         }     },         onCollapseClick : function(e){         this.panel.collapse();     },         beforeCollapse : function(p, animate){         this.lastAnim = animate;         if(this.splitEl){             this.splitEl.hide();         }         this.getCollapsedEl().show();         this.panel.el.setStyle('z-index', 100);         this.isCollapsed = true;         this.layout.layout();     },         onCollapse : function(animate){         this.panel.el.setStyle('z-index', 1);         if(this.lastAnim === false || this.panel.animCollapse === false){             this.getCollapsedEl().dom.style.visibility = 'visible';         }else{             this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});         }         this.state.collapsed = true;         this.panel.saveState();     },         beforeExpand : function(animate){         var c = this.getCollapsedEl();         this.el.show();         if(this.position == 'east' || this.position == 'west'){             this.panel.setSize(undefined, c.getHeight());         }else{             this.panel.setSize(c.getWidth(), undefined);         }         c.hide();         c.dom.style.visibility = 'hidden';         this.panel.el.setStyle('z-index', 100);     },         onExpand : function(){         this.isCollapsed = false;         if(this.splitEl){             this.splitEl.show();         }         this.layout.layout();         this.panel.el.setStyle('z-index', 1);         this.state.collapsed = false;         this.panel.saveState();     },         collapseClick : function(e){         if(this.isSlid){            e.stopPropagation();            this.slideIn();         }else{            e.stopPropagation();            this.slideOut();         }     },         onHide : function(){         if(this.isCollapsed){             this.getCollapsedEl().hide();         }else if(this.splitEl){             this.splitEl.hide();         }     },         onShow : function(){         if(this.isCollapsed){             this.getCollapsedEl().show();         }else if(this.splitEl){             this.splitEl.show();         }     },          isVisible : function(){         return !this.panel.hidden;     },          getMargins : function(){         return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;     },          getSize : function(){         return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();     },          setPanel : function(panel){         this.panel = panel;     },          getMinWidth: function(){         return this.minWidth;     },          getMinHeight: function(){         return this.minHeight;     },         applyLayoutCollapsed : function(box){         var ce = this.getCollapsedEl();         ce.setLeftTop(box.x, box.y);         ce.setSize(box.width, box.height);     },         applyLayout : function(box){         if(this.isCollapsed){             this.applyLayoutCollapsed(box);         }else{             this.panel.setPosition(box.x, box.y);             this.panel.setSize(box.width, box.height);         }     },         beforeSlide: function(){         this.panel.beforeEffect();     },         afterSlide : function(){         this.panel.afterEffect();     },         initAutoHide : function(){         if(this.autoHide !== false){             if(!this.autoHideHd){                 var st = new Ext.util.DelayedTask(this.slideIn, this);                 this.autoHideHd = {                     "mouseout": function(e){                         if(!e.within(this.el, true)){                             st.delay(500);                         }                     },                     "mouseover" : function(e){                         st.cancel();                     },                     scope : this                 };             }             this.el.on(this.autoHideHd);         }     },         clearAutoHide : function(){         if(this.autoHide !== false){             this.el.un("mouseout", this.autoHideHd.mouseout);             this.el.un("mouseover", this.autoHideHd.mouseover);         }     },         clearMonitor : function(){         Ext.getDoc().un("click", this.slideInIf, this);     },             slideOut : function(){         if(this.isSlid || this.el.hasActiveFx()){             return;         }         this.isSlid = true;         var ts = this.panel.tools;         if(ts && ts.toggle){             ts.toggle.hide();         }         this.el.show();         if(this.position == 'east' || this.position == 'west'){             this.panel.setSize(undefined, this.collapsedEl.getHeight());         }else{             this.panel.setSize(this.collapsedEl.getWidth(), undefined);         }         this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];         this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());         this.el.setStyle("z-index", 102);         if(this.animFloat !== false){             this.beforeSlide();             this.el.slideIn(this.getSlideAnchor(), {                 callback: function(){                     this.afterSlide();                     this.initAutoHide();                     Ext.getDoc().on("click", this.slideInIf, this);                 },                 scope: this,                 block: true             });         }else{             this.initAutoHide();              Ext.getDoc().on("click", this.slideInIf, this);         }     },         afterSlideIn : function(){         this.clearAutoHide();         this.isSlid = false;         this.clearMonitor();         this.el.setStyle("z-index", "");         this.el.dom.style.left = this.restoreLT[0];         this.el.dom.style.top = this.restoreLT[1];         var ts = this.panel.tools;         if(ts && ts.toggle){             ts.toggle.show();         }     },         slideIn : function(cb){         if(!this.isSlid || this.el.hasActiveFx()){             Ext.callback(cb);             return;         }         this.isSlid = false;         if(this.animFloat !== false){             this.beforeSlide();             this.el.slideOut(this.getSlideAnchor(), {                 callback: function(){                     this.el.hide();                     this.afterSlide();                     this.afterSlideIn();                     Ext.callback(cb);                 },                 scope: this,                 block: true             });         }else{             this.el.hide();             this.afterSlideIn();         }     },         slideInIf : function(e){         if(!e.within(this.el)){             this.slideIn();         }     },         anchors : {         "west" : "left",         "east" : "right",         "north" : "top",         "south" : "bottom"     },         sanchors : {         "west" : "l",         "east" : "r",         "north" : "t",         "south" : "b"     },         canchors : {         "west" : "tl-tr",         "east" : "tr-tl",         "north" : "tl-bl",         "south" : "bl-tl"     },         getAnchor : function(){         return this.anchors[this.position];     },         getCollapseAnchor : function(){         return this.canchors[this.position];     },         getSlideAnchor : function(){         return this.sanchors[this.position];     },         getAlignAdj : function(){         var cm = this.cmargins;         switch(this.position){             case "west":                 return [0, 0];             break;             case "east":                 return [0, 0];             break;             case "north":                 return [0, 0];             break;             case "south":                 return [0, 0];             break;         }     },         getExpandAdj : function(){         var c = this.collapsedEl, cm = this.cmargins;         switch(this.position){             case "west":                 return [-(cm.right+c.getWidth()+cm.left), 0];             break;             case "east":                 return [cm.right+c.getWidth()+cm.left, 0];             break;             case "north":                 return [0, -(cm.top+cm.bottom+c.getHeight())];             break;             case "south":                 return [0, cm.top+cm.bottom+c.getHeight()];             break;         }     } }; Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){     Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);         this.applyLayout = this.applyFns[pos]; }; Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {          splitTip : "Drag to resize.",          collapsibleSplitTip : "Drag to resize. Double click to hide.",          useSplitTips : false,         splitSettings : {         north : {             orientation: Ext.SplitBar.VERTICAL,             placement: Ext.SplitBar.TOP,             maxFn : 'getVMaxSize',             minProp: 'minHeight',             maxProp: 'maxHeight'         },         south : {             orientation: Ext.SplitBar.VERTICAL,             placement: Ext.SplitBar.BOTTOM,             maxFn : 'getVMaxSize',             minProp: 'minHeight',             maxProp: 'maxHeight'         },         east : {             orientation: Ext.SplitBar.HORIZONTAL,             placement: Ext.SplitBar.RIGHT,             maxFn : 'getHMaxSize',             minProp: 'minWidth',             maxProp: 'maxWidth'         },         west : {             orientation: Ext.SplitBar.HORIZONTAL,             placement: Ext.SplitBar.LEFT,             maxFn : 'getHMaxSize',             minProp: 'minWidth',             maxProp: 'maxWidth'         }     },         applyFns : {         west : function(box){             if(this.isCollapsed){                 return this.applyLayoutCollapsed(box);             }             var sd = this.splitEl.dom, s = sd.style;             this.panel.setPosition(box.x, box.y);             var sw = sd.offsetWidth;             s.left = (box.x+box.width-sw)+'px';             s.top = (box.y)+'px';             s.height = Math.max(0, box.height)+'px';             this.panel.setSize(box.width-sw, box.height);         },         east : function(box){             if(this.isCollapsed){                 return this.applyLayoutCollapsed(box);             }             var sd = this.splitEl.dom, s = sd.style;             var sw = sd.offsetWidth;             this.panel.setPosition(box.x+sw, box.y);             s.left = (box.x)+'px';             s.top = (box.y)+'px';             s.height = Math.max(0, box.height)+'px';             this.panel.setSize(box.width-sw, box.height);         },         north : function(box){             if(this.isCollapsed){                 return this.applyLayoutCollapsed(box);             }             var sd = this.splitEl.dom, s = sd.style;             var sh = sd.offsetHeight;             this.panel.setPosition(box.x, box.y);             s.left = (box.x)+'px';             s.top = (box.y+box.height-sh)+'px';             s.width = Math.max(0, box.width)+'px';             this.panel.setSize(box.width, box.height-sh);         },         south : function(box){             if(this.isCollapsed){                 return this.applyLayoutCollapsed(box);             }             var sd = this.splitEl.dom, s = sd.style;             var sh = sd.offsetHeight;             this.panel.setPosition(box.x, box.y+sh);             s.left = (box.x)+'px';             s.top = (box.y)+'px';             s.width = Math.max(0, box.width)+'px';             this.panel.setSize(box.width, box.height-sh);         }     },         render : function(ct, p){         Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);         var ps = this.position;         this.splitEl = ct.createChild({             cls: "x-layout-split x-layout-split-"+ps, html: "&#160;",             id: this.panel.id + '-xsplit'         });         if(this.collapseMode == 'mini'){             this.miniSplitEl = this.splitEl.createChild({                 cls: "x-layout-mini x-layout-mini-"+ps, html: "&#160;"             });             this.miniSplitEl.addClassOnOver('x-layout-mini-over');             this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});         }         var s = this.splitSettings[ps];         this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);         this.split.placement = s.placement;         this.split.getMaximumSize = this[s.maxFn].createDelegate(this);         this.split.minSize = this.minSize || this[s.minProp];         this.split.on("beforeapply", this.onSplitMove, this);         this.split.useShim = this.useShim === true;         this.maxSize = this.maxSize || this[s.maxProp];         if(p.hidden){             this.splitEl.hide();         }         if(this.useSplitTips){             this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;         }         if(this.collapsible){             this.splitEl.on("dblclick", this.onCollapseClick,  this);         }     },         getSize : function(){         if(this.isCollapsed){             return this.collapsedEl.getSize();         }         var s = this.panel.getSize();         if(this.position == 'north' || this.position == 'south'){             s.height += this.splitEl.dom.offsetHeight;         }else{             s.width += this.splitEl.dom.offsetWidth;         }         return s;     },         getHMaxSize : function(){          var cmax = this.maxSize || 10000;          var center = this.layout.center;          return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());     },         getVMaxSize : function(){         var cmax = this.maxSize || 10000;         var center = this.layout.center;         return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());     },         onSplitMove : function(split, newSize){         var s = this.panel.getSize();         this.lastSplitSize = newSize;         if(this.position == 'north' || this.position == 'south'){             this.panel.setSize(s.width, newSize);             this.state.height = newSize;         }else{             this.panel.setSize(newSize, s.height);             this.state.width = newSize;         }         this.layout.layout();         this.panel.saveState();         return false;     },          getSplitBar : function(){         return this.split;     } }); Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout; Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, {                    labelSeparator : ':',         getAnchorViewSize : function(ct, target){         return ct.body.getStyleSize();     },         setContainer : function(ct){         Ext.layout.FormLayout.superclass.setContainer.call(this, ct);         if(ct.labelAlign){             ct.addClass('x-form-label-'+ct.labelAlign);         }         if(ct.hideLabels){             this.labelStyle = "display:none";             this.elementStyle = "padding-left:0;";             this.labelAdjust = 0;         }else{             this.labelSeparator = ct.labelSeparator || this.labelSeparator;             ct.labelWidth = ct.labelWidth || 100;             if(typeof ct.labelWidth == 'number'){                 var pad = (typeof ct.labelPad == 'number' ? ct.labelPad : 5);                 this.labelAdjust = ct.labelWidth+pad;                 this.labelStyle = "width:"+ct.labelWidth+"px;";                 this.elementStyle = "padding-left:"+(ct.labelWidth+pad)+'px';             }             if(ct.labelAlign == 'top'){                 this.labelStyle = "width:auto;";                 this.labelAdjust = 0;                 this.elementStyle = "padding-left:0;";             }         }         if(!this.fieldTpl){                         var t = new Ext.Template(                 '<div class="x-form-item {5}" tabIndex="-1">',                     '<label for="{0}" style="{2}" class="x-form-item-label">{1}{4}</label>',                     '<div class="x-form-element" id="x-form-el-{0}" style="{3}">',                     '</div><div class="{6}"></div>',                 '</div>'             );             t.disableFormats = true;             t.compile();             Ext.layout.FormLayout.prototype.fieldTpl = t;         }     },         renderItem : function(c, position, target){         if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){             var args = [                    c.id, c.fieldLabel,                    c.labelStyle||this.labelStyle||'',                    this.elementStyle||'',                    typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator,                    (c.itemCls||this.container.itemCls||'') + (c.hideLabel ? ' x-hide-label' : ''),                    c.clearCls || 'x-form-clear-left'              ];             if(typeof position == 'number'){                 position = target.dom.childNodes[position] || null;             }             if(position){                 this.fieldTpl.insertBefore(position, args);             }else{                 this.fieldTpl.append(target, args);             }             c.render('x-form-el-'+c.id);         }else {             Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);         }     },         adjustWidthAnchor : function(value, comp){         return value - (comp.isFormField  ? (comp.hideLabel ? 0 : this.labelAdjust) : 0);     },         isValidParent : function(c, target){         return true;     }      }); Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout;
  656. Ext.layout.Accordion = Ext.extend(Ext.layout.FitLayout, {
  657.     
  658.     fill : true,
  659.     
  660.     autoWidth : true,
  661.     
  662.     titleCollapse : true,
  663.     
  664.     hideCollapseTool : false,
  665.     
  666.     collapseFirst : false,
  667.     
  668.     animate : false,
  669.     
  670.     sequence : false,
  671.     
  672.     activeOnTop : false,
  673.     renderItem : function(c){
  674.         if(this.animate === false){
  675.             c.animCollapse = false;
  676.         }
  677.         c.collapsible = true;
  678.         if(this.autoWidth){
  679.             c.autoWidth = true;
  680.         }
  681.         if(this.titleCollapse){
  682.             c.titleCollapse = true;
  683.         }
  684.         if(this.hideCollapseTool){
  685.             c.hideCollapseTool = true;
  686.         }
  687.         if(this.collapseFirst !== undefined){
  688.             c.collapseFirst = this.collapseFirst;
  689.         }
  690.         if(!this.activeItem && !c.collapsed){
  691.             this.activeItem = c;
  692.         }else if(this.activeItem){
  693.             c.collapsed = true;
  694.         }
  695.         Ext.layout.Accordion.superclass.renderItem.apply(this, arguments);
  696.         c.header.addClass('x-accordion-hd');
  697.         c.on('beforeexpand', this.beforeExpand, this);
  698.     },
  699.          beforeExpand : function(p, anim){
  700.         var ai = this.activeItem;
  701.         if(ai){
  702.             if(this.sequence){
  703.                 delete this.activeItem;
  704.                 if (!ai.collapsed){
  705.                     ai.collapse({callback:function(){
  706.                         p.expand(anim || true);
  707.                     }, scope: this});
  708.                     return false;
  709.                 }
  710.             }else{
  711.                 ai.collapse(this.animate);
  712.             }
  713.         }
  714.         this.activeItem = p;
  715.         if(this.activeOnTop){
  716.             p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);
  717.         }
  718.         this.layout();
  719.     },
  720.          setItemSize : function(item, size){
  721.         if(this.fill && item){
  722.             var items = this.container.items.items;
  723.             var hh = 0;
  724.             for(var i = 0, len = items.length; i < len; i++){
  725.                 var p = items[i];
  726.                 if(p != item){
  727.                     hh += (p.getSize().height - p.bwrap.getHeight());
  728.                 }
  729.             }
  730.             size.height -= hh;
  731.             item.setSize(size);
  732.         }
  733.     }
  734. });
  735. Ext.Container.LAYOUTS['accordion'] = Ext.layout.Accordion;
  736. Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, {
  737.     
  738.          monitorResize:false,
  739.          setContainer : function(ct){
  740.         Ext.layout.TableLayout.superclass.setContainer.call(this, ct);
  741.         this.currentRow = 0;
  742.         this.currentColumn = 0;
  743.         this.cells = [];
  744.     },
  745.          onLayout : function(ct, target){
  746.         var cs = ct.items.items, len = cs.length, c, i;
  747.         if(!this.table){
  748.             target.addClass('x-table-layout-ct');
  749.             this.table = target.createChild(
  750.                 {tag:'table', cls:'x-table-layout', cellspacing: 0, cn: {tag: 'tbody'}}, null, true);
  751.             this.renderAll(ct, target);
  752.         }
  753.     },
  754.          getRow : function(index){
  755.         var row = this.table.tBodies[0].childNodes[index];
  756.         if(!row){
  757.             row = document.createElement('tr');
  758.             this.table.tBodies[0].appendChild(row);
  759.         }
  760.         return row;
  761.     },
  762.      getNextCell : function(c){
  763. var cell = this.getNextNonSpan(this.currentColumn, this.currentRow);
  764. var curCol = this.currentColumn = cell[0], curRow = this.currentRow = cell[1];
  765. for(var rowIndex = curRow; rowIndex < curRow + (c.rowspan || 1); rowIndex++){
  766. if(!this.cells[rowIndex]){
  767. this.cells[rowIndex] = [];
  768. }
  769. for(var colIndex = curCol; colIndex < curCol + (c.colspan || 1); colIndex++){
  770. this.cells[rowIndex][colIndex] = true;
  771. }
  772. }
  773. var td = document.createElement('td');
  774. if(c.cellId){
  775. td.id = c.cellId;
  776. }
  777. var cls = 'x-table-layout-cell';
  778. if(c.cellCls){
  779. cls += ' ' + c.cellCls;
  780. }
  781. td.className = cls;
  782. if(c.colspan){
  783. td.colSpan = c.colspan;
  784. }
  785. if(c.rowspan){
  786. td.rowSpan = c.rowspan;
  787. }
  788. this.getRow(curRow).appendChild(td);
  789. return td;
  790. },
  791.     
  792.      getNextNonSpan: function(colIndex, rowIndex){
  793. var cols = this.columns;
  794. while((cols && colIndex >= cols) || (this.cells[rowIndex] && this.cells[rowIndex][colIndex])) {
  795. if(cols && colIndex >= cols){
  796. rowIndex++;
  797. colIndex = 0;
  798. }else{
  799. colIndex++;
  800. }
  801. }
  802. return [colIndex, rowIndex];
  803. },
  804.          renderItem : function(c, position, target){
  805.         if(c && !c.rendered){
  806.             c.render(this.getNextCell(c));
  807.         }
  808.     },
  809.          isValidParent : function(c, target){
  810.         return true;
  811.     }
  812.     
  813. });
  814. Ext.Container.LAYOUTS['table'] = Ext.layout.TableLayout;
  815. Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {
  816.     extraCls: 'x-abs-layout-item',
  817.     isForm: false,
  818.          setContainer : function(ct){
  819.         Ext.layout.AbsoluteLayout.superclass.setContainer.call(this, ct);
  820.         if(ct.isXType('form')){
  821.             this.isForm = true;
  822.         }
  823.     },
  824.     onLayout : function(ct, target){
  825.         if(this.isForm){ ct.body.position(); } else { target.position(); }
  826.         Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);
  827.     },
  828.          getAnchorViewSize : function(ct, target){
  829.         return this.isForm ? ct.body.getStyleSize() : Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this, ct, target);
  830.     },
  831.          isValidParent : function(c, target){
  832.         return this.isForm ? true : Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this, c, target);
  833.     },
  834.          adjustWidthAnchor : function(value, comp){
  835.         return value ? value - comp.getPosition(true)[0] : value;
  836.     },
  837.          adjustHeightAnchor : function(value, comp){
  838.         return  value ? value - comp.getPosition(true)[1] : value;
  839.     }
  840.     
  841. });
  842. Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;
  843. Ext.Viewport = Ext.extend(Ext.Container, {
  844.     
  845.     
  846.     
  847.     
  848.     
  849.     
  850.     
  851.     
  852.     
  853.     
  854.     
  855.     initComponent : function() {
  856.         Ext.Viewport.superclass.initComponent.call(this);
  857.         document.getElementsByTagName('html')[0].className += ' x-viewport';
  858.         this.el = Ext.getBody();
  859.         this.el.setHeight = Ext.emptyFn;
  860.         this.el.setWidth = Ext.emptyFn;
  861.         this.el.setSize = Ext.emptyFn;
  862.         this.el.dom.scroll = 'no';
  863.         this.allowDomMove = false;
  864.         this.autoWidth = true;
  865.         this.autoHeight = true;
  866.         Ext.EventManager.onWindowResize(this.fireResize, this);
  867.         this.renderTo = this.el;
  868.     },
  869.     fireResize : function(w, h){
  870.         this.fireEvent('resize', this, w, h, w, h);
  871.     }
  872. });
  873. Ext.reg('viewport', Ext.Viewport); Ext.Panel = Ext.extend(Ext.Container, {                                                                                                                                                                           baseCls : 'x-panel',          collapsedCls : 'x-panel-collapsed',          maskDisabled: true,          animCollapse: Ext.enableFx,          headerAsText: true,          buttonAlign: 'right',          collapsed : false,          collapseFirst: true,          minButtonWidth:75,          elements : 'body',                 toolTarget : 'header',     collapseEl : 'bwrap',     slideAnchor : 't',     disabledClass: '',         deferHeight: true,         expandDefaults: {         duration:.25     },         collapseDefaults: {         duration:.25     },         initComponent : function(){         Ext.Panel.superclass.initComponent.call(this);         this.addEvents(                          'bodyresize',                          'titlechange',                          'collapse',                          'expand',                          'beforecollapse',                          'beforeexpand',                          'beforeclose',                          'close',                          'activate',                          'deactivate'         );                 if(this.tbar){             this.elements += ',tbar';             if(typeof this.tbar == 'object'){                 this.topToolbar = this.tbar;             }             delete this.tbar;         }         if(this.bbar){             this.elements += ',bbar';             if(typeof this.bbar == 'object'){                 this.bottomToolbar = this.bbar;             }             delete this.bbar;         }         if(this.header === true){             this.elements += ',header';             delete this.header;         }else if(this.title && this.header !== false){             this.elements += ',header';         }         if(this.footer === true){             this.elements += ',footer';             delete this.footer;         }         if(this.buttons){             var btns = this.buttons;                          this.buttons = [];             for(var i = 0, len = btns.length; i < len; i++) {                 if(btns[i].render){                     btns[i].ownerCt = this;                     this.buttons.push(btns[i]);                 }else{                     this.addButton(btns[i]);                 }             }         }         if(this.autoLoad){             this.on('render', this.doAutoLoad, this, {delay:10});         }     },         createElement : function(name, pnode){         if(this[name]){             pnode.appendChild(this[name].dom);             return;         }         if(name === 'bwrap' || this.elements.indexOf(name) != -1){             if(this[name+'Cfg']){                 this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);             }else{                 var el = document.createElement('div');                 el.className = this[name+'Cls'];                 this[name] = Ext.get(pnode.appendChild(el));             }         }     },         onRender : function(ct, position){         Ext.Panel.superclass.onRender.call(this, ct, position);         this.createClasses();         if(this.el){             this.el.addClass(this.baseCls);             this.header = this.el.down('.'+this.headerCls);             this.bwrap = this.el.down('.'+this.bwrapCls);             var cp = this.bwrap ? this.bwrap : this.el;             this.tbar = cp.down('.'+this.tbarCls);             this.body = cp.down('.'+this.bodyCls);             this.bbar = cp.down('.'+this.bbarCls);             this.footer = cp.down('.'+this.footerCls);             this.fromMarkup = true;         }else{             this.el = ct.createChild({                 id: this.id,                 cls: this.baseCls             }, position);         }         var el = this.el, d = el.dom;         if(this.cls){             this.el.addClass(this.cls);         }         if(this.buttons){             this.elements += ',footer';         }                          if(this.frame){             el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));             this.createElement('header', d.firstChild.firstChild.firstChild);             this.createElement('bwrap', d);                         var bw = this.bwrap.dom;             var ml = d.childNodes[1], bl = d.childNodes[2];             bw.appendChild(ml);             bw.appendChild(bl);             var mc = bw.firstChild.firstChild.firstChild;             this.createElement('tbar', mc);             this.createElement('body', mc);             this.createElement('bbar', mc);             this.createElement('footer', bw.lastChild.firstChild.firstChild);             if(!this.footer){                 this.bwrap.dom.lastChild.className += ' x-panel-nofooter';             }         }else{             this.createElement('header', d);             this.createElement('bwrap', d);                         var bw = this.bwrap.dom;             this.createElement('tbar', bw);             this.createElement('body', bw);             this.createElement('bbar', bw);             this.createElement('footer', bw);             if(!this.header){                 this.body.addClass(this.bodyCls + '-noheader');                 if(this.tbar){                     this.tbar.addClass(this.tbarCls + '-noheader');                 }             }         }         if(this.border === false){             this.el.addClass(this.baseCls + '-noborder');             this.body.addClass(this.bodyCls + '-noborder');             if(this.header){                 this.header.addClass(this.headerCls + '-noborder');             }             if(this.footer){                 this.footer.addClass(this.footerCls + '-noborder');             }             if(this.tbar){                 this.tbar.addClass(this.tbarCls + '-noborder');             }             if(this.bbar){                 this.bbar.addClass(this.bbarCls + '-noborder');             }         }         if(this.bodyBorder === false){            this.body.addClass(this.bodyCls + '-noborder');         }         if(this.bodyStyle){            this.body.applyStyles(this.bodyStyle);         }         this.bwrap.enableDisplayMode('block');         if(this.header){             this.header.unselectable();                         if(this.headerAsText){                 this.header.dom.innerHTML =                     '<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>';                 if(this.iconCls){                     this.setIconClass(this.iconCls);                 }             }         }         if(this.floating){             this.makeFloating(this.floating);         }         if(this.collapsible){             this.tools = this.tools ? this.tools.slice(0) : [];             if(!this.hideCollapseTool){                 this.tools[this.collapseFirst?'unshift':'push']({                     id: 'toggle',                     handler : this.toggleCollapse,                     scope: this                 });             }             if(this.titleCollapse && this.header){                 this.header.on('click', this.toggleCollapse, this);                 this.header.setStyle('cursor', 'pointer');             }         }         if(this.tools){             var ts = this.tools;             this.tools = {};             this.addTool.apply(this, ts);         }else{             this.tools = {};         }         if(this.buttons && this.buttons.length > 0){                         var tb = this.footer.createChild({cls:'x-panel-btns-ct', cn: {                 cls:"x-panel-btns x-panel-btns-"+this.buttonAlign,                 html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'             }}, null, true);             var tr = tb.getElementsByTagName('tr')[0];             for(var i = 0, len = this.buttons.length; i < len; i++) {                 var b = this.buttons[i];                 var td = document.createElement('td');                 td.className = 'x-panel-btn-td';                 b.render(tr.appendChild(td));             }         }         if(this.tbar && this.topToolbar){             if(Ext.isArray(this.topToolbar)){                 this.topToolbar = new Ext.Toolbar(this.topToolbar);             }             this.topToolbar.render(this.tbar);             this.topToolbar.ownerCt = this;         }         if(this.bbar && this.bottomToolbar){             if(Ext.isArray(this.bottomToolbar)){                 this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);             }             this.bottomToolbar.render(this.bbar);             this.bottomToolbar.ownerCt = this;         }     },          setIconClass : function(cls){         var old = this.iconCls;         this.iconCls = cls;         if(this.rendered && this.header){             if(this.frame){                 this.header.addClass('x-panel-icon');                 this.header.replaceClass(old, this.iconCls);             }else{                 var hd = this.header.dom;                 var img = hd.firstChild && String(hd.firstChild.tagName).toLowerCase() == 'img' ? hd.firstChild : null;                 if(img){                     Ext.fly(img).replaceClass(old, this.iconCls);                 }else{                     Ext.DomHelper.insertBefore(hd.firstChild, {                         tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls                     });                  }             }         }     },         makeFloating : function(cfg){         this.floating = true;         this.el = new Ext.Layer(             typeof cfg == 'object' ? cfg : {                 shadow: this.shadow !== undefined ? this.shadow : 'sides',                 shadowOffset: this.shadowOffset,                 constrain:false,                 shim: this.shim === false ? false : undefined             }, this.el         );     },          getTopToolbar : function(){         return this.topToolbar;     },          getBottomToolbar : function(){         return this.bottomToolbar;     },          addButton : function(config, handler, scope){         var bc = {             handler: handler,             scope: scope,             minWidth: this.minButtonWidth,             hideParent:true         };         if(typeof config == "string"){             bc.text = config;         }else{             Ext.apply(bc, config);         }         var btn = new Ext.Button(bc);         btn.ownerCt = this;         if(!this.buttons){             this.buttons = [];         }         this.buttons.push(btn);         return btn;     },         addTool : function(){         if(!this[this.toolTarget]) {             return;         }         if(!this.toolTemplate){                         var tt = new Ext.Template(                  '<div class="x-tool x-tool-{id}">&#160;</div>'             );             tt.disableFormats = true;             tt.compile();             Ext.Panel.prototype.toolTemplate = tt;         }         for(var i = 0, a = arguments, len = a.length; i < len; i++) {             var tc = a[i], overCls = 'x-tool-'+tc.id+'-over';             var t = this.toolTemplate.insertFirst((tc.align !== 'left') ? this[this.toolTarget] : this[this.toolTarget].child('span'), tc, true);             this.tools[tc.id] = t;             t.enableDisplayMode('block');             t.on('click', this.createToolHandler(t, tc, overCls, this));             if(tc.on){                 t.on(tc.on);             }             if(tc.hidden){                 t.hide();             }             if(tc.qtip){                 if(typeof tc.qtip == 'object'){                     Ext.QuickTips.register(Ext.apply({                           target: t.id                     }, tc.qtip));                 } else {                     t.dom.qtip = tc.qtip;                 }             }             t.addClassOnOver(overCls);         }     },         onShow : function(){         if(this.floating){             return this.el.show();         }         Ext.Panel.superclass.onShow.call(this);     },         onHide : function(){         if(this.floating){             return this.el.hide();         }         Ext.Panel.superclass.onHide.call(this);     },         createToolHandler : function(t, tc, overCls, panel){         return function(e){             t.removeClass(overCls);             e.stopEvent();             if(tc.handler){                 tc.handler.call(tc.scope || t, e, t, panel);             }         };     },         afterRender : function(){         if(this.fromMarkup && this.height === undefined && !this.autoHeight){             this.height = this.el.getHeight();         }         if(this.floating && !this.hidden && !this.initHidden){             this.el.show();         }         if(this.title){             this.setTitle(this.title);         }         this.setAutoScroll();         if(this.html){             this.body.update(typeof this.html == 'object' ?                              Ext.DomHelper.markup(this.html) :                              this.html);             delete this.html;         }         if(this.contentEl){             var ce = Ext.getDom(this.contentEl);             Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);             this.body.dom.appendChild(ce);         }         if(this.collapsed){             this.collapsed = false;             this.collapse(false);         }         Ext.Panel.superclass.afterRender.call(this);         this.initEvents();     },         setAutoScroll : function(){         if(this.rendered && this.autoScroll){             var el = this.body || this.el;             if(el){                 el.setOverflow('auto');             }         }     },         getKeyMap : function(){         if(!this.keyMap){             this.keyMap = new Ext.KeyMap(this.el, this.keys);         }         return this.keyMap;     },         initEvents : function(){         if(this.keys){             this.getKeyMap();         }         if(this.draggable){             this.initDraggable();         }     },         initDraggable : function(){                  this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);     },         beforeEffect : function(){         if(this.floating){             this.el.beforeAction();         }         this.el.addClass('x-panel-animated');     },         afterEffect : function(){         this.syncShadow();         this.el.removeClass('x-panel-animated');     },         createEffect : function(a, cb, scope){         var o = {             scope:scope,             block:true         };         if(a === true){             o.callback = cb;             return o;         }else if(!a.callback){             o.callback = cb;         }else {             o.callback = function(){                 cb.call(scope);                 Ext.callback(a.callback, a.scope);             };         }         return Ext.applyIf(o, a);     },          collapse : function(animate){         if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){             return;         }         var doAnim = animate === true || (animate !== false && this.animCollapse);         this.beforeEffect();         this.onCollapse(doAnim, animate);         return this;     },         onCollapse : function(doAnim, animArg){         if(doAnim){             this[this.collapseEl].slideOut(this.slideAnchor,                     Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),                         this.collapseDefaults));         }else{             this[this.collapseEl].hide();             this.afterCollapse();         }     },         afterCollapse : function(){         this.collapsed = true;         this.el.addClass(this.collapsedCls);         this.afterEffect();         this.fireEvent('collapse', this);     },          expand : function(animate){         if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){             return;         }         var doAnim = animate === true || (animate !== false && this.animCollapse);         this.el.removeClass(this.collapsedCls);         this.beforeEffect();         this.onExpand(doAnim, animate);         return this;     },         onExpand : function(doAnim, animArg){         if(doAnim){             this[this.collapseEl].slideIn(this.slideAnchor,                     Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),                         this.expandDefaults));         }else{             this[this.collapseEl].show();             this.afterExpand();         }     },         afterExpand : function(){         this.collapsed = false;         this.afterEffect();         this.fireEvent('expand', this);     },          toggleCollapse : function(animate){         this[this.collapsed ? 'expand' : 'collapse'](animate);         return this;     },         onDisable : function(){         if(this.rendered && this.maskDisabled){             this.el.mask();         }         Ext.Panel.superclass.onDisable.call(this);     },         onEnable : function(){         if(this.rendered && this.maskDisabled){             this.el.unmask();         }         Ext.Panel.superclass.onEnable.call(this);     },         onResize : function(w, h){         if(w !== undefined || h !== undefined){             if(!this.collapsed){                 if(typeof w == 'number'){                     this.body.setWidth(                             this.adjustBodyWidth(w - this.getFrameWidth()));                 }else if(w == 'auto'){                     this.body.setWidth(w);                 }                 if(typeof h == 'number'){                     this.body.setHeight(                             this.adjustBodyHeight(h - this.getFrameHeight()));                 }else if(h == 'auto'){                     this.body.setHeight(h);                 }                                  if(this.disabled && this.el._mask){                     this.el._mask.setSize(this.el.dom.clientWidth, this.el.getHeight());                 }             }else{                 this.queuedBodySize = {width: w, height: h};                 if(!this.queuedExpand && this.allowQueuedExpand !== false){                     this.queuedExpand = true;                     this.on('expand', function(){                         delete this.queuedExpand;                         this.onResize(this.queuedBodySize.width, this.queuedBodySize.height);                         this.doLayout();                     }, this, {single:true});                 }             }             this.fireEvent('bodyresize', this, w, h);         }         this.syncShadow();     },         adjustBodyHeight : function(h){         return h;     },         adjustBodyWidth : function(w){         return w;     },         onPosition : function(){         this.syncShadow();     },          getFrameWidth : function(){         var w = this.el.getFrameWidth('lr');         if(this.frame){             var l = this.bwrap.dom.firstChild;             w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r'));             var mc = this.bwrap.dom.firstChild.firstChild.firstChild;             w += Ext.fly(mc).getFrameWidth('lr');         }         return w;     },          getFrameHeight : function(){         var h  = this.el.getFrameWidth('tb');         h += (this.tbar ? this.tbar.getHeight() : 0) +              (this.bbar ? this.bbar.getHeight() : 0);         if(this.frame){             var hd = this.el.dom.firstChild;             var ft = this.bwrap.dom.lastChild;             h += (hd.offsetHeight + ft.offsetHeight);             var mc = this.bwrap.dom.firstChild.firstChild.firstChild;             h += Ext.fly(mc).getFrameWidth('tb');         }else{             h += (this.header ? this.header.getHeight() : 0) +                 (this.footer ? this.footer.getHeight() : 0);         }         return h;     },          getInnerWidth : function(){         return this.getSize().width - this.getFrameWidth();     },          getInnerHeight : function(){         return this.getSize().height - this.getFrameHeight();     },         syncShadow : function(){         if(this.floating){             this.el.sync(true);         }     },         getLayoutTarget : function(){         return this.body;     },          setTitle : function(title, iconCls){         this.title = title;         if(this.header && this.headerAsText){             this.header.child('span').update(title);         }         if(iconCls){             this.setIconClass(iconCls);         }         this.fireEvent('titlechange', this, title);         return this;     },          getUpdater : function(){         return this.body.getUpdater();     },           load : function(){         var um = this.body.getUpdater();         um.update.apply(um, arguments);         return this;     },         beforeDestroy : function(){         Ext.Element.uncache(             this.header,             this.tbar,             this.bbar,             this.footer,             this.body         );         if(this.tools){             for(var k in this.tools){                 Ext.destroy(this.tools[k]);             }         }         if(this.buttons){             for(var b in this.buttons){                 Ext.destroy(this.buttons[b]);             }         }         Ext.destroy(             this.topToolbar,             this.bottomToolbar         );         Ext.Panel.superclass.beforeDestroy.call(this);     },         createClasses : function(){         this.headerCls = this.baseCls + '-header';         this.headerTextCls = this.baseCls + '-header-text';         this.bwrapCls = this.baseCls + '-bwrap';         this.tbarCls = this.baseCls + '-tbar';         this.bodyCls = this.baseCls + '-body';         this.bbarCls = this.baseCls + '-bbar';         this.footerCls = this.baseCls + '-footer';     },         createGhost : function(cls, useShim, appendTo){         var el = document.createElement('div');         el.className = 'x-panel-ghost ' + (cls ? cls : '');         if(this.header){             el.appendChild(this.el.dom.firstChild.cloneNode(true));         }         Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());         el.style.width = this.el.dom.offsetWidth + 'px';;         if(!appendTo){             this.container.dom.appendChild(el);         }else{             Ext.getDom(appendTo).appendChild(el);         }         if(useShim !== false && this.el.useShim !== false){             var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);             layer.show();             return layer;         }else{             return new Ext.Element(el);         }     },         doAutoLoad : function(){         this.body.load(             typeof this.autoLoad == 'object' ?                 this.autoLoad : {url: this.autoLoad});     } }); Ext.reg('panel', Ext.Panel); Ext.Window = Ext.extend(Ext.Panel, {                                                  baseCls : 'x-window',          resizable:true,          draggable:true,          closable : true,          constrain:false,          constrainHeader:false,          plain:false,          minimizable : false,          maximizable : false,          minHeight: 100,          minWidth: 200,          expandOnShow: true,          closeAction: 'close',          elements: 'header,body',         collapsible:false,         initHidden : true,          monitorResize : true,          frame:true,          floating:true,         initComponent : function(){         Ext.Window.superclass.initComponent.call(this);         this.addEvents(                                                    'resize',                          'maximize',                          'minimize',                          'restore'         );     },         getState : function(){         return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox());     },         onRender : function(ct, position){         Ext.Window.superclass.onRender.call(this, ct, position);         if(this.plain){             this.el.addClass('x-window-plain');         }                 this.focusEl = this.el.createChild({                     tag: "a", href:"#", cls:"x-dlg-focus",                     tabIndex:"-1", html: "&#160;"});         this.focusEl.swallowEvent('click', true);         this.proxy = this.el.createProxy("x-window-proxy");         this.proxy.enableDisplayMode('block');         if(this.modal){             this.mask = this.container.createChild({cls:"ext-el-mask"}, this.el.dom);             this.mask.enableDisplayMode("block");             this.mask.hide();         }     },         initEvents : function(){         Ext.Window.superclass.initEvents.call(this);         if(this.animateTarget){             this.setAnimateTarget(this.animateTarget);         }         if(this.resizable){             this.resizer = new Ext.Resizable(this.el, {                 minWidth: this.minWidth,                 minHeight:this.minHeight,                 handles: this.resizeHandles || "all",                 pinned: true,                 resizeElement : this.resizerAction             });             this.resizer.window = this;             this.resizer.on("beforeresize", this.beforeResize, this);         }         if(this.draggable){             this.header.addClass("x-window-draggable");         }         this.initTools();         this.el.on("mousedown", this.toFront, this);         this.manager = this.manager || Ext.WindowMgr;         this.manager.register(this);         this.hidden = true;         if(this.maximized){             this.maximized = false;             this.maximize();         }         if(this.closable){             var km = this.getKeyMap();             km.on(27, this.onEsc, this);             km.disable();         }     },     initDraggable : function(){                  this.dd = new Ext.Window.DD(this);     },        onEsc : function(){         this[this.closeAction]();     },         beforeDestroy : function(){         Ext.destroy(             this.resizer,             this.dd,             this.proxy,             this.mask         );         Ext.Window.superclass.beforeDestroy.call(this);     },         onDestroy : function(){         if(this.manager){             this.manager.unregister(this);         }         Ext.Window.superclass.onDestroy.call(this);     },         initTools : function(){         if(this.minimizable){             this.addTool({                 id: 'minimize',                 handler: this.minimize.createDelegate(this, [])             });         }         if(this.maximizable){             this.addTool({                 id: 'maximize',                 handler: this.maximize.createDelegate(this, [])             });             this.addTool({                 id: 'restore',                 handler: this.restore.createDelegate(this, []),                 hidden:true             });             this.header.on('dblclick', this.toggleMaximize, this);         }         if(this.closable){             this.addTool({                 id: 'close',                 handler: this[this.closeAction].createDelegate(this, [])             });         }     },         resizerAction : function(){         var box = this.proxy.getBox();         this.proxy.hide();         this.window.handleResize(box);         return box;     },         beforeResize : function(){         this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40);         this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);         this.resizeBox = this.el.getBox();     },         updateHandles : function(){         if(Ext.isIE && this.resizer){             this.resizer.syncHandleHeight();             this.el.repaint();         }     },         handleResize : function(box){         var rz = this.resizeBox;         if(rz.x != box.x || rz.y != box.y){             this.updateBox(box);         }else{             this.setSize(box);         }         this.focus();         this.updateHandles();         this.saveState();         if(this.layout){             this.doLayout();         }         this.fireEvent("resize", this, box.width, box.height);     },          focus : function(){         var f = this.focusEl, db = this.defaultButton, t = typeof db;         if(t != 'undefined'){             if(t == 'number'){                 f = this.buttons[db];             }else if(t == 'string'){                 f = Ext.getCmp(db);             }else{                 f = db;             }         }         f.focus.defer(10, f);     },          setAnimateTarget : function(el){         el = Ext.get(el);         this.animateTarget = el;     },         beforeShow : function(){         delete this.el.lastXY;         delete this.el.lastLT;         if(this.x === undefined || this.y === undefined){             var xy = this.el.getAlignToXY(this.container, 'c-c');             var pos = this.el.translatePoints(xy[0], xy[1]);             this.x = this.x === undefined? pos.left : this.x;             this.y = this.y === undefined? pos.top : this.y;         }         this.el.setLeftTop(this.x, this.y);         if(this.expandOnShow){             this.expand(false);         }         if(this.modal){             Ext.getBody().addClass("x-body-masked");             this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));             this.mask.show();         }     },          show : function(animateTarget, cb, scope){         if(!this.rendered){             this.render(Ext.getBody());         }         if(this.hidden === false){             this.toFront();             return;         }         if(this.fireEvent("beforeshow", this) === false){             return;         }         if(cb){             this.on('show', cb, scope, {single:true});         }         this.hidden = false;         if(animateTarget !== undefined){             this.setAnimateTarget(animateTarget);         }         this.beforeShow();         if(this.animateTarget){             this.animShow();         }else{             this.afterShow();         }     },         afterShow : function(){         this.proxy.hide();         this.el.setStyle('display', 'block');         this.el.show();         if(this.maximized){             this.fitContainer();         }         if(Ext.isMac && Ext.isGecko){          this.cascade(this.setAutoScroll);         }         if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){             Ext.EventManager.onWindowResize(this.onWindowResize, this);         }         this.doConstrain();         if(this.layout){             this.doLayout();         }         if(this.keyMap){             this.keyMap.enable();         }         this.toFront();         this.updateHandles();         this.fireEvent("show", this);     },         animShow : function(){         this.proxy.show();         this.proxy.setBox(this.animateTarget.getBox());         this.proxy.setOpacity(0);         var b = this.getBox(false);         b.callback = this.afterShow;         b.scope = this;         b.duration = .25;         b.easing = 'easeNone';         b.opacity = .5;         b.block = true;         this.el.setStyle('display', 'none');         this.proxy.shift(b);     },          hide : function(animateTarget, cb, scope){         if(this.activeGhost){             this.hide.defer(100, this, [animateTarget, cb, scope]);             return;         }         if(this.hidden || this.fireEvent("beforehide", this) === false){             return;         }         if(cb){             this.on('hide', cb, scope, {single:true});         }         this.hidden = true;         if(animateTarget !== undefined){             this.setAnimateTarget(animateTarget);         }         if(this.animateTarget){             this.animHide();         }else{             this.el.hide();             this.afterHide();         }     },         afterHide : function(){         this.proxy.hide();         if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){             Ext.EventManager.removeResizeListener(this.onWindowResize, this);         }         if(this.modal){             this.mask.hide();             Ext.getBody().removeClass("x-body-masked");         }         if(this.keyMap){             this.keyMap.disable();         }         this.fireEvent("hide", this);     },         animHide : function(){         this.proxy.setOpacity(.5);         this.proxy.show();         var tb = this.getBox(false);         this.proxy.setBox(tb);         this.el.hide();         var b = this.animateTarget.getBox();         b.callback = this.afterHide;         b.scope = this;         b.duration = .25;         b.easing = 'easeNone';         b.block = true;         b.opacity = 0;         this.proxy.shift(b);     },         onWindowResize : function(){         if(this.maximized){             this.fitContainer();         }         if(this.modal){             this.mask.setSize('100%', '100%');             var force = this.mask.dom.offsetHeight;             this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));         }         this.doConstrain();     },         doConstrain : function(){         if(this.constrain || this.constrainHeader){             var offsets;             if(this.constrain){                 offsets = {                     right:this.el.shadowOffset,                     left:this.el.shadowOffset,                     bottom:this.el.shadowOffset                 };             }else {                 var s = this.getSize();                 offsets = {                     right:-(s.width - 100),                     bottom:-(s.height - 25)                 };             }             var xy = this.el.getConstrainToXY(this.container, true, offsets);             if(xy){                 this.setPosition(xy[0], xy[1]);             }         }     },         ghost : function(cls){         var ghost = this.createGhost(cls);         var box = this.getBox(true);         ghost.setLeftTop(box.x, box.y);         ghost.setWidth(box.width);         this.el.hide();         this.activeGhost = ghost;         return ghost;     },         unghost : function(show, matchPosition){         if(show !== false){             this.el.show();             this.focus();         if(Ext.isMac && Ext.isGecko){           this.cascade(this.setAutoScroll);         }         }         if(matchPosition !== false){             this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));         }         this.activeGhost.hide();         this.activeGhost.remove();         delete this.activeGhost;     },          minimize : function(){         this.fireEvent('minimize', this);     },          close : function(){         if(this.fireEvent("beforeclose", this) !== false){             this.hide(null, function(){                 this.fireEvent('close', this);                 this.destroy();             }, this);         }     },          maximize : function(){         if(!this.maximized){             this.expand(false);             this.restoreSize = this.getSize();             this.restorePos = this.getPosition(true);             if (this.maximizable){                 this.tools.maximize.hide();                 this.tools.restore.show();             }             this.maximized = true;             this.el.disableShadow();             if(this.dd){                 this.dd.lock();             }             if(this.collapsible){                 this.tools.toggle.hide();             }             this.el.addClass('x-window-maximized');             this.container.addClass('x-window-maximized-ct');             this.setPosition(0, 0);             this.fitContainer();             this.fireEvent('maximize', this);         }     },          restore : function(){         if(this.maximized){             this.el.removeClass('x-window-maximized');             this.tools.restore.hide();             this.tools.maximize.show();             this.setPosition(this.restorePos[0], this.restorePos[1]);             this.setSize(this.restoreSize.width, this.restoreSize.height);             delete this.restorePos;             delete this.restoreSize;             this.maximized = false;             this.el.enableShadow(true);             if(this.dd){                 this.dd.unlock();             }             if(this.collapsible){                 this.tools.toggle.show();             }             this.container.removeClass('x-window-maximized-ct');             this.doConstrain();             this.fireEvent('restore', this);         }     },          toggleMaximize : function(){         this[this.maximized ? 'restore' : 'maximize']();     },         fitContainer : function(){         var vs = this.container.getViewSize();         this.setSize(vs.width, vs.height);     },             setZIndex : function(index){         if(this.modal){             this.mask.setStyle("z-index", index);         }         this.el.setZIndex(++index);         index += 5;         if(this.resizer){             this.resizer.proxy.setStyle("z-index", ++index);         }         this.lastZIndex = index;     },          alignTo : function(element, position, offsets){         var xy = this.el.getAlignToXY(element, position, offsets);         this.setPagePosition(xy[0], xy[1]);         return this;     },          anchorTo : function(el, alignment, offsets, monitorScroll, _pname){         var action = function(){             this.alignTo(el, alignment, offsets);         };         Ext.EventManager.onWindowResize(action, this);         var tm = typeof monitorScroll;         if(tm != 'undefined'){             Ext.EventManager.on(window, 'scroll', action, this,                 {buffer: tm == 'number' ? monitorScroll : 50});         }         action.call(this);         this[_pname] = action;         return this;     },          toFront : function(){         if(this.manager.bringToFront(this)){             this.focus();         }         return this;     },          setActive : function(active){         if(active){             if(!this.maximized){                 this.el.enableShadow(true);             }             this.fireEvent('activate', this);         }else{             this.el.disableShadow();             this.fireEvent('deactivate', this);         }     },          toBack : function(){         this.manager.sendToBack(this);         return this;     },          center : function(){         var xy = this.el.getAlignToXY(this.container, 'c-c');         this.setPagePosition(xy[0], xy[1]);         return this;     }      }); Ext.reg('window', Ext.Window); Ext.Window.DD = function(win){     this.win = win;     Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);     this.setHandleElId(win.header.id);     this.scroll = false; }; Ext.extend(Ext.Window.DD, Ext.dd.DD, {     moveOnly:true,     headerOffsets:[100, 25],     startDrag : function(){         var w = this.win;         this.proxy = w.ghost();         if(w.constrain !== false){             var so = w.el.shadowOffset;             this.constrainTo(w.container, {right: so, left: so, bottom: so});         }else if(w.constrainHeader !== false){             var s = this.proxy.getSize();             this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});         }     },     b4Drag : Ext.emptyFn,     onDrag : function(e){         this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());     },     endDrag : function(e){         this.win.unghost();         this.win.saveState();     } }); Ext.WindowGroup = function(){     var list = {};     var accessList = [];     var front = null;         var sortWindows = function(d1, d2){         return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;     };         var orderWindows = function(){         var a = accessList, len = a.length;         if(len > 0){             a.sort(sortWindows);             var seed = a[0].manager.zseed;             for(var i = 0; i < len; i++){                 var win = a[i];                 if(win && !win.hidden){                     win.setZIndex(seed + (i*10));                 }             }         }         activateLast();     };         var setActiveWin = function(win){         if(win != front){             if(front){                 front.setActive(false);             }             front = win;             if(win){                 win.setActive(true);             }         }     };         var activateLast = function(){         for(var i = accessList.length-1; i >=0; --i) {             if(!accessList[i].hidden){                 setActiveWin(accessList[i]);                 return;             }         }                 setActiveWin(null);     };     return {                  zseed : 9000,                 register : function(win){             list[win.id] = win;             accessList.push(win);             win.on('hide', activateLast);         },                 unregister : function(win){             delete list[win.id];             win.un('hide', activateLast);             accessList.remove(win);         },                  get : function(id){             return typeof id == "object" ? id : list[id];         },                  bringToFront : function(win){             win = this.get(win);             if(win != front){                 win._lastAccess = new Date().getTime();                 orderWindows();                 return true;             }             return false;         },                  sendToBack : function(win){             win = this.get(win);             win._lastAccess = -(new Date().getTime());             orderWindows();             return win;         },                  hideAll : function(){             for(var id in list){                 if(list[id] && typeof list[id] != "function" && list[id].isVisible()){                     list[id].hide();                 }             }         },                  getActive : function(){             return front;         },                  getBy : function(fn, scope){             var r = [];             for(var i = accessList.length-1; i >=0; --i) {                 var win = accessList[i];                 if(fn.call(scope||win, win) !== false){                     r.push(win);                 }             }             return r;         },                  each : function(fn, scope){             for(var id in list){                 if(list[id] && typeof list[id] != "function"){                     if(fn.call(scope || list[id], list[id]) === false){                         return;                     }                 }             }         }     }; }; Ext.WindowMgr = new Ext.WindowGroup();
  874. Ext.dd.PanelProxy = function(panel, config){
  875.     this.panel = panel;
  876.     this.id = this.panel.id +'-ddproxy';
  877.     Ext.apply(this, config);
  878. };
  879. Ext.dd.PanelProxy.prototype = {
  880.     
  881.     insertProxy : true,
  882.          setStatus : Ext.emptyFn,
  883.     reset : Ext.emptyFn,
  884.     update : Ext.emptyFn,
  885.     stop : Ext.emptyFn,
  886.     sync: Ext.emptyFn,
  887.     
  888.     getEl : function(){
  889.         return this.ghost;
  890.     },
  891.     
  892.     getGhost : function(){
  893.         return this.ghost;
  894.     },
  895.     
  896.     getProxy : function(){
  897.         return this.proxy;
  898.     },
  899.     
  900.     hide : function(){
  901.         if(this.ghost){
  902.             if(this.proxy){
  903.                 this.proxy.remove();
  904.                 delete this.proxy;
  905.             }
  906.             this.panel.el.dom.style.display = '';
  907.             this.ghost.remove();
  908.             delete this.ghost;
  909.         }
  910.     },
  911.     
  912.     show : function(){
  913.         if(!this.ghost){
  914.             this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
  915.             this.ghost.setXY(this.panel.el.getXY())
  916.             if(this.insertProxy){
  917.                 this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
  918.                 this.proxy.setSize(this.panel.getSize());
  919.             }
  920.             this.panel.el.dom.style.display = 'none';
  921.         }
  922.     },
  923.          repair : function(xy, callback, scope){
  924.         this.hide();
  925.         if(typeof callback == "function"){
  926.             callback.call(scope || this);
  927.         }
  928.     },
  929.     
  930.     moveProxy : function(parentNode, before){
  931.         if(this.proxy){
  932.             parentNode.insertBefore(this.proxy.dom, before);
  933.         }
  934.     }
  935. };
  936. Ext.Panel.DD = function(panel, cfg){
  937.     this.panel = panel;
  938.     this.dragData = {panel: panel};
  939.     this.proxy = new Ext.dd.PanelProxy(panel, cfg);
  940.     Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
  941.     var h = panel.header;
  942.     if(h){
  943.         this.setHandleElId(h.id);
  944.     }
  945.     (h ? h : this.panel.body).setStyle('cursor', 'move');
  946.     this.scroll = false;
  947. };
  948. Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
  949.     showFrame: Ext.emptyFn,
  950.     startDrag: Ext.emptyFn,
  951.     b4StartDrag: function(x, y) {
  952.         this.proxy.show();
  953.     },
  954.     b4MouseDown: function(e) {
  955.         var x = e.getPageX();
  956.         var y = e.getPageY();
  957.         this.autoOffset(x, y);
  958.     },
  959.     onInitDrag : function(x, y){
  960.         this.onStartDrag(x, y);
  961.         return true;
  962.     },
  963.     createFrame : Ext.emptyFn,
  964.     getDragEl : function(e){
  965.         return this.proxy.ghost.dom;
  966.     },
  967.     endDrag : function(e){
  968.         this.proxy.hide();
  969.         this.panel.saveState();
  970.     },
  971.     autoOffset : function(x, y) {
  972.         x -= this.startPageX;
  973.         y -= this.startPageY;
  974.         this.setDelta(x, y);
  975.     }
  976. });
  977. Ext.state.Provider = function(){
  978.     
  979.     this.addEvents("statechange");
  980.     this.state = {};
  981.     Ext.state.Provider.superclass.constructor.call(this);
  982. };
  983. Ext.extend(Ext.state.Provider, Ext.util.Observable, {
  984.     
  985.     get : function(name, defaultValue){
  986.         return typeof this.state[name] == "undefined" ?
  987.             defaultValue : this.state[name];
  988.     },
  989.     
  990.     
  991.     clear : function(name){
  992.         delete this.state[name];
  993.         this.fireEvent("statechange", this, name, null);
  994.     },
  995.     
  996.     
  997.     set : function(name, value){
  998.         this.state[name] = value;
  999.         this.fireEvent("statechange", this, name, value);
  1000.     },
  1001.     
  1002.     
  1003.     decodeValue : function(cookie){
  1004.         var re = /^(a|n|d|b|s|o):(.*)$/;
  1005.         var matches = re.exec(unescape(cookie));
  1006.         if(!matches || !matches[1]) return;          var type = matches[1];
  1007.         var v = matches[2];
  1008.         switch(type){
  1009.             case "n":
  1010.                 return parseFloat(v);
  1011.             case "d":
  1012.                 return new Date(Date.parse(v));
  1013.             case "b":
  1014.                 return (v == "1");
  1015.             case "a":
  1016.                 var all = [];
  1017.                 var values = v.split("^");
  1018.                 for(var i = 0, len = values.length; i < len; i++){
  1019.                     all.push(this.decodeValue(values[i]));
  1020.                 }
  1021.                 return all;
  1022.            case "o":
  1023.                 var all = {};
  1024.                 var values = v.split("^");
  1025.                 for(var i = 0, len = values.length; i < len; i++){
  1026.                     var kv = values[i].split("=");
  1027.                     all[kv[0]] = this.decodeValue(kv[1]);
  1028.                 }
  1029.                 return all;
  1030.            default:
  1031.                 return v;
  1032.         }
  1033.     },
  1034.     
  1035.     
  1036.     encodeValue : function(v){
  1037.         var enc;
  1038.         if(typeof v == "number"){
  1039.             enc = "n:" + v;
  1040.         }else if(typeof v == "boolean"){
  1041.             enc = "b:" + (v ? "1" : "0");
  1042.         }else if(Ext.isDate(v)){
  1043.             enc = "d:" + v.toGMTString();
  1044.         }else if(Ext.isArray(v)){
  1045.             var flat = "";
  1046.             for(var i = 0, len = v.length; i < len; i++){
  1047.                 flat += this.encodeValue(v[i]);
  1048.                 if(i != len-1) flat += "^";
  1049.             }
  1050.             enc = "a:" + flat;
  1051.         }else if(typeof v == "object"){
  1052.             var flat = "";
  1053.             for(var key in v){
  1054.                 if(typeof v[key] != "function" && v[key] !== undefined){
  1055.                     flat += key + "=" + this.encodeValue(v[key]) + "^";
  1056.                 }
  1057.             }
  1058.             enc = "o:" + flat.substring(0, flat.length-1);
  1059.         }else{
  1060.             enc = "s:" + v;
  1061.         }
  1062.         return escape(enc);        
  1063.     }
  1064. });
  1065. Ext.state.Manager = function(){
  1066.     var provider = new Ext.state.Provider();
  1067.     return {
  1068.         
  1069.         setProvider : function(stateProvider){
  1070.             provider = stateProvider;
  1071.         },
  1072.         
  1073.         get : function(key, defaultValue){
  1074.             return provider.get(key, defaultValue);
  1075.         },
  1076.         
  1077.          set : function(key, value){
  1078.             provider.set(key, value);
  1079.         },
  1080.         
  1081.         clear : function(key){
  1082.             provider.clear(key);
  1083.         },
  1084.         
  1085.         getProvider : function(){
  1086.             return provider;
  1087.         }
  1088.     };
  1089. }();
  1090. Ext.state.CookieProvider = function(config){
  1091.     Ext.state.CookieProvider.superclass.constructor.call(this);
  1092.     this.path = "/";
  1093.     this.expires = new Date(new Date().getTime()+(1000*60*60*24*7));      this.domain = null;
  1094.     this.secure = false;
  1095.     Ext.apply(this, config);
  1096.     this.state = this.readCookies();
  1097. };
  1098. Ext.extend(Ext.state.CookieProvider, Ext.state.Provider, {
  1099.          set : function(name, value){
  1100.         if(typeof value == "undefined" || value === null){
  1101.             this.clear(name);
  1102.             return;
  1103.         }
  1104.         this.setCookie(name, value);
  1105.         Ext.state.CookieProvider.superclass.set.call(this, name, value);
  1106.     },
  1107.          clear : function(name){
  1108.         this.clearCookie(name);
  1109.         Ext.state.CookieProvider.superclass.clear.call(this, name);
  1110.     },
  1111.          readCookies : function(){
  1112.         var cookies = {};
  1113.         var c = document.cookie + ";";
  1114.         var re = /s?(.*?)=(.*?);/g;
  1115.      var matches;
  1116.      while((matches = re.exec(c)) != null){
  1117.             var name = matches[1];
  1118.             var value = matches[2];
  1119.             if(name && name.substring(0,3) == "ys-"){
  1120.                 cookies[name.substr(3)] = this.decodeValue(value);
  1121.             }
  1122.         }
  1123.         return cookies;
  1124.     },
  1125.          setCookie : function(name, value){
  1126.         document.cookie = "ys-"+ name + "=" + this.encodeValue(value) +
  1127.            ((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) +
  1128.            ((this.path == null) ? "" : ("; path=" + this.path)) +
  1129.            ((this.domain == null) ? "" : ("; domain=" + this.domain)) +
  1130.            ((this.secure == true) ? "; secure" : "");
  1131.     },
  1132.          clearCookie : function(name){
  1133.         document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" +
  1134.            ((this.path == null) ? "" : ("; path=" + this.path)) +
  1135.            ((this.domain == null) ? "" : ("; domain=" + this.domain)) +
  1136.            ((this.secure == true) ? "; secure" : "");
  1137.     }
  1138. }); Ext.DataView = Ext.extend(Ext.BoxComponent, {                                                  selectedClass : "x-view-selected",          emptyText : "",          deferEmptyText: true,          trackOver: false,         last: false,         initComponent : function(){         Ext.DataView.superclass.initComponent.call(this);         if(typeof this.tpl == "string"){             this.tpl = new Ext.XTemplate(this.tpl);         }         this.addEvents(                          "beforeclick",                          "click",                          "mouseenter",                          "mouseleave",                          "containerclick",                          "dblclick",                          "contextmenu",                          "selectionchange",                          "beforeselect"         );         this.all = new Ext.CompositeElementLite();         this.selected = new Ext.CompositeElementLite();     },         onRender : function(){         if(!this.el){             this.el = document.createElement('div');             this.el.id = this.id;         }         Ext.DataView.superclass.onRender.apply(this, arguments);     },         afterRender : function(){         Ext.DataView.superclass.afterRender.call(this);         this.el.on({             "click": this.onClick,             "dblclick": this.onDblClick,             "contextmenu": this.onContextMenu,             scope:this         });         if(this.overClass || this.trackOver){             this.el.on({                 "mouseover": this.onMouseOver,                 "mouseout": this.onMouseOut,                 scope:this             });         }         if(this.store){             this.setStore(this.store, true);         }     },          refresh : function(){         this.clearSelections(false, true);         this.el.update("");         var records = this.store.getRange();         if(records.length < 1){             if(!this.deferEmptyText || this.hasSkippedEmptyText){                 this.el.update(this.emptyText);             }             this.hasSkippedEmptyText = true;             this.all.clear();             return;         }         this.tpl.overwrite(this.el, this.collectData(records, 0));         this.all.fill(Ext.query(this.itemSelector, this.el.dom));         this.updateIndexes(0);     },          prepareData : function(data){         return data;     },          collectData : function(records, startIndex){         var r = [];         for(var i = 0, len = records.length; i < len; i++){             r[r.length] = this.prepareData(records[i].data, startIndex+i, records[i]);         }         return r;     },         bufferRender : function(records){         var div = document.createElement('div');         this.tpl.overwrite(div, this.collectData(records));         return Ext.query(this.itemSelector, div);     },         onUpdate : function(ds, record){         var index = this.store.indexOf(record);         var sel = this.isSelected(index);         var original = this.all.elements[index];         var node = this.bufferRender([record], index)[0];         this.all.replaceElement(index, node, true);         if(sel){             this.selected.replaceElement(original, node);             this.all.item(index).addClass(this.selectedClass);         }         this.updateIndexes(index, index);     },         onAdd : function(ds, records, index){         if(this.all.getCount() == 0){             this.refresh();             return;         }         var nodes = this.bufferRender(records, index), n, a = this.all.elements;         if(index < this.all.getCount()){             n = this.all.item(index).insertSibling(nodes, 'before', true);             a.splice.apply(a, [index, 0].concat(nodes));         }else{             n = this.all.last().insertSibling(nodes, 'after', true);             a.push.apply(a, nodes);         }         this.updateIndexes(index);     },         onRemove : function(ds, record, index){         this.deselect(index);         this.all.removeElement(index, true);         this.updateIndexes(index);     },          refreshNode : function(index){         this.onUpdate(this.store, this.store.getAt(index));     },         updateIndexes : function(startIndex, endIndex){         var ns = this.all.elements;         startIndex = startIndex || 0;         endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));         for(var i = startIndex; i <= endIndex; i++){             ns[i].viewIndex = i;         }     },          setStore : function(store, initial){         if(!initial && this.store){             this.store.un("beforeload", this.onBeforeLoad, this);             this.store.un("datachanged", this.refresh, this);             this.store.un("add", this.onAdd, this);             this.store.un("remove", this.onRemove, this);             this.store.un("update", this.onUpdate, this);             this.store.un("clear", this.refresh, this);         }         if(store){             store = Ext.StoreMgr.lookup(store);             store.on("beforeload", this.onBeforeLoad, this);             store.on("datachanged", this.refresh, this);             store.on("add", this.onAdd, this);             store.on("remove", this.onRemove, this);             store.on("update", this.onUpdate, this);             store.on("clear", this.refresh, this);         }         this.store = store;         if(store){             this.refresh();         }     },          findItemFromChild : function(node){         return Ext.fly(node).findParent(this.itemSelector, this.el);     },         onClick : function(e){         var item = e.getTarget(this.itemSelector, this.el);         if(item){             var index = this.indexOf(item);             if(this.onItemClick(item, index, e) !== false){                 this.fireEvent("click", this, index, item, e);             }         }else{             if(this.fireEvent("containerclick", this, e) !== false){                 this.clearSelections();             }         }     },         onContextMenu : function(e){         var item = e.getTarget(this.itemSelector, this.el);         if(item){             this.fireEvent("contextmenu", this, this.indexOf(item), item, e);         }     },         onDblClick : function(e){         var item = e.getTarget(this.itemSelector, this.el);         if(item){             this.fireEvent("dblclick", this, this.indexOf(item), item, e);         }     },         onMouseOver : function(e){         var item = e.getTarget(this.itemSelector, this.el);         if(item && item !== this.lastItem){             this.lastItem = item;             Ext.fly(item).addClass(this.overClass);             this.fireEvent("mouseenter", this, this.indexOf(item), item, e);         }     },         onMouseOut : function(e){         if(this.lastItem){             if(!e.within(this.lastItem, true)){                 Ext.fly(this.lastItem).removeClass(this.overClass);                 this.fireEvent("mouseleave", this, this.indexOf(this.lastItem), this.lastItem, e);                 delete this.lastItem;             }         }     },         onItemClick : function(item, index, e){         if(this.fireEvent("beforeclick", this, index, item, e) === false){             return false;         }         if(this.multiSelect){             this.doMultiSelection(item, index, e);             e.preventDefault();         }else if(this.singleSelect){             this.doSingleSelection(item, index, e);             e.preventDefault();         }         return true;     },         doSingleSelection : function(item, index, e){         if(e.ctrlKey && this.isSelected(index)){             this.deselect(index);         }else{             this.select(index, false);         }     },         doMultiSelection : function(item, index, e){         if(e.shiftKey && this.last !== false){             var last = this.last;             this.selectRange(last, index, e.ctrlKey);             this.last = last;         }else{             if((e.ctrlKey||this.simpleSelect) && this.isSelected(index)){                 this.deselect(index);             }else{                 this.select(index, e.ctrlKey || e.shiftKey || this.simpleSelect);             }         }     },          getSelectionCount : function(){         return this.selected.getCount()     },          getSelectedNodes : function(){         return this.selected.elements;     },          getSelectedIndexes : function(){         var indexes = [], s = this.selected.elements;         for(var i = 0, len = s.length; i < len; i++){             indexes.push(s[i].viewIndex);         }         return indexes;     },          getSelectedRecords : function(){         var r = [], s = this.selected.elements;         for(var i = 0, len = s.length; i < len; i++){             r[r.length] = this.store.getAt(s[i].viewIndex);         }         return r;     },          getRecords : function(nodes){         var r = [], s = nodes;         for(var i = 0, len = s.length; i < len; i++){             r[r.length] = this.store.getAt(s[i].viewIndex);         }         return r;     },          getRecord : function(node){         return this.store.getAt(node.viewIndex);     },          clearSelections : function(suppressEvent, skipUpdate){         if((this.multiSelect || this.singleSelect) && this.selected.getCount() > 0){             if(!skipUpdate){                 this.selected.removeClass(this.selectedClass);             }             this.selected.clear();             this.last = false;             if(!suppressEvent){                 this.fireEvent("selectionchange", this, this.selected.elements);             }         }     },          isSelected : function(node){         return this.selected.contains(this.getNode(node));     },          deselect : function(node){         if(this.isSelected(node)){             node = this.getNode(node);             this.selected.removeElement(node);             if(this.last == node.viewIndex){                 this.last = false;             }             Ext.fly(node).removeClass(this.selectedClass);             this.fireEvent("selectionchange", this, this.selected.elements);         }     },          select : function(nodeInfo, keepExisting, suppressEvent){         if(Ext.isArray(nodeInfo)){             if(!keepExisting){                 this.clearSelections(true);             }             for(var i = 0, len = nodeInfo.length; i < len; i++){                 this.select(nodeInfo[i], true, true);             }         if(!suppressEvent){             this.fireEvent("selectionchange", this, this.selected.elements);         }         } else{             var node = this.getNode(nodeInfo);             if(!keepExisting){                 this.clearSelections(true);             }             if(node && !this.isSelected(node)){                 if(this.fireEvent("beforeselect", this, node, this.selected.elements) !== false){                     Ext.fly(node).addClass(this.selectedClass);                     this.selected.add(node);                     this.last = node.viewIndex;                     if(!suppressEvent){                         this.fireEvent("selectionchange", this, this.selected.elements);                     }                 }             }         }     },          selectRange : function(start, end, keepExisting){         if(!keepExisting){             this.clearSelections(true);         }         this.select(this.getNodes(start, end), true);     },          getNode : function(nodeInfo){         if(typeof nodeInfo == "string"){             return document.getElementById(nodeInfo);         }else if(typeof nodeInfo == "number"){             return this.all.elements[nodeInfo];         }         return nodeInfo;     },          getNodes : function(start, end){         var ns = this.all.elements;         start = start || 0;         end = typeof end == "undefined" ? Math.max(ns.length - 1, 0) : end;         var nodes = [], i;         if(start <= end){             for(i = start; i <= end && ns[i]; i++){                 nodes.push(ns[i]);             }         } else{             for(i = start; i >= end && ns[i]; i--){                 nodes.push(ns[i]);             }         }         return nodes;     },          indexOf : function(node){         node = this.getNode(node);         if(typeof node.viewIndex == "number"){             return node.viewIndex;         }         return this.all.indexOf(node);     },         onBeforeLoad : function(){         if(this.loadingText){             this.clearSelections(false, true);             this.el.update('<div class="loading-indicator">'+this.loadingText+'</div>');             this.all.clear();         }     },     onDestroy : function(){         Ext.DataView.superclass.onDestroy.call(this);         this.setStore(null);     } }); Ext.reg('dataview', Ext.DataView); Ext.ColorPalette = function(config){     Ext.ColorPalette.superclass.constructor.call(this, config);     this.addEvents(                  'select'     );     if(this.handler){         this.on("select", this.handler, this.scope, true);     } }; Ext.extend(Ext.ColorPalette, Ext.Component, {          itemCls : "x-color-palette",          value : null,     clickEvent:'click',         ctype: "Ext.ColorPalette",          allowReselect : false,          colors : [         "000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333",         "800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080",         "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696",         "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0",         "FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"     ],         onRender : function(container, position){         var t = this.tpl || new Ext.XTemplate(             '<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>'         );         var el = document.createElement("div");         el.className = this.itemCls;         t.overwrite(el, this.colors);         container.dom.insertBefore(el, position);         this.el = Ext.get(el);         this.el.on(this.clickEvent, this.handleClick,  this, {delegate: "a"});         if(this.clickEvent != 'click'){             this.el.on('click', Ext.emptyFn,  this, {delegate: "a", preventDefault:true});         }     },         afterRender : function(){         Ext.ColorPalette.superclass.afterRender.call(this);         if(this.value){             var s = this.value;             this.value = null;             this.select(s);         }     },         handleClick : function(e, t){         e.preventDefault();         if(!this.disabled){             var c = t.className.match(/(?:^|s)color-(.{6})(?:s|$)/)[1];             this.select(c.toUpperCase());         }     },          select : function(color){         color = color.replace("#", "");         if(color != this.value || this.allowReselect){             var el = this.el;             if(this.value){                 el.child("a.color-"+this.value).removeClass("x-color-palette-sel");             }             el.child("a.color-"+color).addClass("x-color-palette-sel");             this.value = color;             this.fireEvent("select", this, color);         }     }      }); Ext.reg('colorpalette', Ext.ColorPalette);
  1139. Ext.DatePicker = Ext.extend(Ext.Component, {
  1140.     
  1141.     todayText : "Today",
  1142.     
  1143.     okText : "&#160;OK&#160;",      
  1144.     cancelText : "Cancel",
  1145.     
  1146.     todayTip : "{0} (Spacebar)",
  1147.     
  1148.     minText : "This date is before the minimum date",
  1149.     
  1150.     maxText : "This date is after the maximum date",
  1151.     
  1152.     format : "m/d/y",
  1153.     
  1154.     disabledDaysText : "Disabled",
  1155.     
  1156.     disabledDatesText : "Disabled",
  1157.     
  1158.     constrainToViewport : true,
  1159.     
  1160.     monthNames : Date.monthNames,
  1161.     
  1162.     dayNames : Date.dayNames,
  1163.     
  1164.     nextText: 'Next Month (Control+Right)',
  1165.     
  1166.     prevText: 'Previous Month (Control+Left)',
  1167.     
  1168.     monthYearText: 'Choose a month (Control+Up/Down to move years)',
  1169.     
  1170.     startDay : 0,
  1171.     
  1172.     showToday : true,
  1173.     
  1174.     
  1175.     
  1176.     
  1177.     
  1178.          initComponent : function(){
  1179.         Ext.DatePicker.superclass.initComponent.call(this);
  1180.         this.value = this.value ?
  1181.                  this.value.clearTime() : new Date().clearTime();
  1182.         this.addEvents(
  1183.             
  1184.             'select'
  1185.         );
  1186.         if(this.handler){
  1187.             this.on("select", this.handler,  this.scope || this);
  1188.         }
  1189.         this.initDisabledDays();
  1190.     },
  1191.          initDisabledDays : function(){
  1192.         if(!this.disabledDatesRE && this.disabledDates){
  1193.             var dd = this.disabledDates;
  1194.             var re = "(?:";
  1195.             for(var i = 0; i < dd.length; i++){
  1196.                 re += dd[i];
  1197.                 if(i != dd.length-1) re += "|";
  1198.             }
  1199.             this.disabledDatesRE = new RegExp(re + ")");
  1200.         }
  1201.     },
  1202.     
  1203.     
  1204.     setDisabledDates : function(dd){
  1205.         if(Ext.isArray(dd)){
  1206.             this.disabledDates = dd;
  1207.             this.disabledDatesRE = null;
  1208.         }else{
  1209.             this.disabledDatesRE = dd;
  1210.         }
  1211.         this.initDisabledDays();
  1212.         this.update(this.value, true);
  1213.     },
  1214.     
  1215.     
  1216.     setDisabledDays : function(dd){
  1217.         this.disabledDays = dd;
  1218.         this.update(this.value, true);
  1219.     },
  1220.     
  1221.     
  1222.     setMinDate : function(dt){
  1223.         this.minDate = dt;
  1224.         this.update(this.value, true);
  1225.     },
  1226.     
  1227.     
  1228.     setMaxDate : function(dt){
  1229.         this.maxDate = dt;
  1230.         this.update(this.value, true);
  1231.     },
  1232.     
  1233.     setValue : function(value){
  1234.         var old = this.value;
  1235.         this.value = value.clearTime(true);
  1236.         if(this.el){
  1237.             this.update(this.value);
  1238.         }
  1239.     },
  1240.     
  1241.     getValue : function(){
  1242.         return this.value;
  1243.     },
  1244.          focus : function(){
  1245.         if(this.el){
  1246.             this.update(this.activeDate);
  1247.         }
  1248.     },
  1249.          onRender : function(container, position){
  1250.         var m = [
  1251.              '<table cellspacing="0">',
  1252.                 '<tr><td class="x-date-left"><a href="#" title="', this.prevText ,'">&#160;</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', this.nextText ,'">&#160;</a></td></tr>',
  1253.                 '<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];
  1254.         var dn = this.dayNames;
  1255.         for(var i = 0; i < 7; i++){
  1256.             var d = this.startDay+i;
  1257.             if(d > 6){
  1258.                 d = d-7;
  1259.             }
  1260.             m.push("<th><span>", dn[d].substr(0,1), "</span></th>");
  1261.         }
  1262.         m[m.length] = "</tr></thead><tbody><tr>";
  1263.         for(var i = 0; i < 42; i++) {
  1264.             if(i % 7 == 0 && i != 0){
  1265.                 m[m.length] = "</tr><tr>";
  1266.             }
  1267.             m[m.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';
  1268.         }
  1269.         m.push('</tr></tbody></table></td></tr>', 
  1270.                 this.showToday ? '<tr><td colspan="3" class="x-date-bottom" align="center"></td></tr>' : '', 
  1271.                 '</table><div class="x-date-mp"></div>');
  1272.         var el = document.createElement("div");
  1273.         el.className = "x-date-picker";
  1274.         el.innerHTML = m.join("");
  1275.         container.dom.insertBefore(el, position);
  1276.         this.el = Ext.get(el);
  1277.         this.eventEl = Ext.get(el.firstChild);
  1278.         new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"), {
  1279.             handler: this.showPrevMonth,
  1280.             scope: this,
  1281.             preventDefault:true,
  1282.             stopDefault:true
  1283.         });
  1284.         new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"), {
  1285.             handler: this.showNextMonth,
  1286.             scope: this,
  1287.             preventDefault:true,
  1288.             stopDefault:true
  1289.         });
  1290.         this.eventEl.on("mousewheel", this.handleMouseWheel,  this);
  1291.         this.monthPicker = this.el.down('div.x-date-mp');
  1292.         this.monthPicker.enableDisplayMode('block');
  1293.         
  1294.         var kn = new Ext.KeyNav(this.eventEl, {
  1295.             "left" : function(e){
  1296.                 e.ctrlKey ?
  1297.                     this.showPrevMonth() :
  1298.                     this.update(this.activeDate.add("d", -1));
  1299.             },
  1300.             "right" : function(e){
  1301.                 e.ctrlKey ?
  1302.                     this.showNextMonth() :
  1303.                     this.update(this.activeDate.add("d", 1));
  1304.             },
  1305.             "up" : function(e){
  1306.                 e.ctrlKey ?
  1307.                     this.showNextYear() :
  1308.                     this.update(this.activeDate.add("d", -7));
  1309.             },
  1310.             "down" : function(e){
  1311.                 e.ctrlKey ?
  1312.                     this.showPrevYear() :
  1313.                     this.update(this.activeDate.add("d", 7));
  1314.             },
  1315.             "pageUp" : function(e){
  1316.                 this.showNextMonth();
  1317.             },
  1318.             "pageDown" : function(e){
  1319.                 this.showPrevMonth();
  1320.             },
  1321.             "enter" : function(e){
  1322.                 e.stopPropagation();
  1323.                 return true;
  1324.             },
  1325.             scope : this
  1326.         });
  1327.         this.eventEl.on("click", this.handleDateClick,  this, {delegate: "a.x-date-date"});
  1328.         this.el.unselectable();
  1329.         
  1330.         this.cells = this.el.select("table.x-date-inner tbody td");
  1331.         this.textNodes = this.el.query("table.x-date-inner tbody span");
  1332.         this.mbtn = new Ext.Button({
  1333.             text: "&#160;",
  1334.             tooltip: this.monthYearText,
  1335.             renderTo: this.el.child("td.x-date-middle", true)
  1336.         });
  1337.         this.mbtn.on('click', this.showMonthPicker, this);
  1338.         this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");
  1339.         if(this.showToday){
  1340.             this.todayKeyListener = this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday,  this);
  1341.             var today = (new Date()).dateFormat(this.format);
  1342.             this.todayBtn = new Ext.Button({
  1343.                 renderTo: this.el.child("td.x-date-bottom", true),
  1344.                 text: String.format(this.todayText, today),
  1345.                 tooltip: String.format(this.todayTip, today),
  1346.                 handler: this.selectToday,
  1347.                 scope: this
  1348.             });
  1349.         }
  1350.         
  1351.         if(Ext.isIE){
  1352.             this.el.repaint();
  1353.         }
  1354.         this.update(this.value);
  1355.     },
  1356.          createMonthPicker : function(){
  1357.         if(!this.monthPicker.dom.firstChild){
  1358.             var buf = ['<table border="0" cellspacing="0">'];
  1359.             for(var i = 0; i < 6; i++){
  1360.                 buf.push(
  1361.                     '<tr><td class="x-date-mp-month"><a href="#">', this.monthNames[i].substr(0, 3), '</a></td>',
  1362.                     '<td class="x-date-mp-month x-date-mp-sep"><a href="#">', this.monthNames[i+6].substr(0, 3), '</a></td>',
  1363.                     i == 0 ?
  1364.                     '<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>' :
  1365.                     '<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>'
  1366.                 );
  1367.             }
  1368.             buf.push(
  1369.                 '<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',
  1370.                     this.okText,
  1371.                     '</button><button type="button" class="x-date-mp-cancel">',
  1372.                     this.cancelText,
  1373.                     '</button></td></tr>',
  1374.                 '</table>'
  1375.             );
  1376.             this.monthPicker.update(buf.join(''));
  1377.             this.monthPicker.on('click', this.onMonthClick, this);
  1378.             this.monthPicker.on('dblclick', this.onMonthDblClick, this);
  1379.             this.mpMonths = this.monthPicker.select('td.x-date-mp-month');
  1380.             this.mpYears = this.monthPicker.select('td.x-date-mp-year');
  1381.             this.mpMonths.each(function(m, a, i){
  1382.                 i += 1;
  1383.                 if((i%2) == 0){
  1384.                     m.dom.xmonth = 5 + Math.round(i * .5);
  1385.                 }else{
  1386.                     m.dom.xmonth = Math.round((i-1) * .5);
  1387.                 }
  1388.             });
  1389.         }
  1390.     },
  1391.          showMonthPicker : function(){
  1392.         this.createMonthPicker();
  1393.         var size = this.el.getSize();
  1394.         this.monthPicker.setSize(size);
  1395.         this.monthPicker.child('table').setSize(size);
  1396.         this.mpSelMonth = (this.activeDate || this.value).getMonth();
  1397.         this.updateMPMonth(this.mpSelMonth);
  1398.         this.mpSelYear = (this.activeDate || this.value).getFullYear();
  1399.         this.updateMPYear(this.mpSelYear);
  1400.         this.monthPicker.slideIn('t', {duration:.2});
  1401.     },
  1402.          updateMPYear : function(y){
  1403.         this.mpyear = y;
  1404.         var ys = this.mpYears.elements;
  1405.         for(var i = 1; i <= 10; i++){
  1406.             var td = ys[i-1], y2;
  1407.             if((i%2) == 0){
  1408.                 y2 = y + Math.round(i * .5);
  1409.                 td.firstChild.innerHTML = y2;
  1410.                 td.xyear = y2;
  1411.             }else{
  1412.                 y2 = y - (5-Math.round(i * .5));
  1413.                 td.firstChild.innerHTML = y2;
  1414.                 td.xyear = y2;
  1415.             }
  1416.             this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel');
  1417.         }
  1418.     },
  1419.          updateMPMonth : function(sm){
  1420.         this.mpMonths.each(function(m, a, i){
  1421.             m[m.dom.xmonth == sm ? 'addClass' : 'removeClass']('x-date-mp-sel');
  1422.         });
  1423.     },
  1424.          selectMPMonth: function(m){
  1425.         
  1426.     },
  1427.          onMonthClick : function(e, t){
  1428.         e.stopEvent();
  1429.         var el = new Ext.Element(t), pn;
  1430.         if(el.is('button.x-date-mp-cancel')){
  1431.             this.hideMonthPicker();
  1432.         }
  1433.         else if(el.is('button.x-date-mp-ok')){
  1434.             var d = new Date(this.mpSelYear, this.mpSelMonth, (this.activeDate || this.value).getDate());
  1435.             if(d.getMonth() != this.mpSelMonth){
  1436.                                  d = new Date(this.mpSelYear, this.mpSelMonth, 1).getLastDateOfMonth();
  1437.             }
  1438.             this.update(d);
  1439.             this.hideMonthPicker();
  1440.         }
  1441.         else if(pn = el.up('td.x-date-mp-month', 2)){
  1442.             this.mpMonths.removeClass('x-date-mp-sel');
  1443.             pn.addClass('x-date-mp-sel');
  1444.             this.mpSelMonth = pn.dom.xmonth;
  1445.         }
  1446.         else if(pn = el.up('td.x-date-mp-year', 2)){
  1447.             this.mpYears.removeClass('x-date-mp-sel');
  1448.             pn.addClass('x-date-mp-sel');
  1449.             this.mpSelYear = pn.dom.xyear;
  1450.         }
  1451.         else if(el.is('a.x-date-mp-prev')){
  1452.             this.updateMPYear(this.mpyear-10);
  1453.         }
  1454.         else if(el.is('a.x-date-mp-next')){
  1455.             this.updateMPYear(this.mpyear+10);
  1456.         }
  1457.     },
  1458.          onMonthDblClick : function(e, t){
  1459.         e.stopEvent();
  1460.         var el = new Ext.Element(t), pn;
  1461.         if(pn = el.up('td.x-date-mp-month', 2)){
  1462.             this.update(new Date(this.mpSelYear, pn.dom.xmonth, (this.activeDate || this.value).getDate()));
  1463.             this.hideMonthPicker();
  1464.         }
  1465.         else if(pn = el.up('td.x-date-mp-year', 2)){
  1466.             this.update(new Date(pn.dom.xyear, this.mpSelMonth, (this.activeDate || this.value).getDate()));
  1467.             this.hideMonthPicker();
  1468.         }
  1469.     },
  1470.          hideMonthPicker : function(disableAnim){
  1471.         if(this.monthPicker){
  1472.             if(disableAnim === true){
  1473.                 this.monthPicker.hide();
  1474.             }else{
  1475.                 this.monthPicker.slideOut('t', {duration:.2});
  1476.             }
  1477.         }
  1478.     },
  1479.          showPrevMonth : function(e){
  1480.         this.update(this.activeDate.add("mo", -1));
  1481.     },
  1482.          showNextMonth : function(e){
  1483.         this.update(this.activeDate.add("mo", 1));
  1484.     },
  1485.          showPrevYear : function(){
  1486.         this.update(this.activeDate.add("y", -1));
  1487.     },
  1488.          showNextYear : function(){
  1489.         this.update(this.activeDate.add("y", 1));
  1490.     },
  1491.          handleMouseWheel : function(e){
  1492.         var delta = e.getWheelDelta();
  1493.         if(delta > 0){
  1494.             this.showPrevMonth();
  1495.             e.stopEvent();
  1496.         } else if(delta < 0){
  1497.             this.showNextMonth();
  1498.             e.stopEvent();
  1499.         }
  1500.     },
  1501.          handleDateClick : function(e, t){
  1502.         e.stopEvent();
  1503.         if(t.dateValue && !Ext.fly(t.parentNode).hasClass("x-date-disabled")){
  1504.             this.setValue(new Date(t.dateValue));
  1505.             this.fireEvent("select", this, this.value);
  1506.         }
  1507.     },
  1508.          selectToday : function(){
  1509.         if(this.todayBtn && !this.todayBtn.disabled){
  1510.         this.setValue(new Date().clearTime());
  1511.         this.fireEvent("select", this, this.value);
  1512.         }
  1513.     },