roojs-ui-debug.js
authorAlan Knowles <alan@akbkhome.com>
Thu, 19 Jan 2012 05:48:02 +0000 (13:48 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 19 Jan 2012 05:48:02 +0000 (13:48 +0800)
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui-debug.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-ui.js
roojs-all.js
roojs-debug.js

roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index dd1937a..78a82fb 100644 (file)
@@ -246,6 +246,7 @@ A="o:"+B.substring(0,B.length-1);}else {A="s:"+v;}return escape(A);}});
 Roo.state.Manager=function(){var A=new Roo.state.Provider();return {setProvider:function(B){A=B;},get:function(B,C){return A.get(B,C);},set:function(B,C){A.set(B,C);},clear:function(B){A.clear(B);},getProvider:function(){return A;}};}();
 Roo.state.CookieProvider=function(A){Roo.state.CookieProvider.superclass.constructor.call(this);this.path="/";this.expires=new Date(new Date().getTime()+(1000*60*60*24*7));this.domain=null;this.secure=false;Roo.apply(this,A);this.state=this.readCookies();};Roo.extend(Roo.state.CookieProvider,Roo.state.Provider,{set:function(A,B){if(typeof B=="undefined"||B===null){this.clear(A);return;}
 this.setCookie(A,B);Roo.state.CookieProvider.superclass.set.call(this,A,B);},clear:function(A){this.clearCookie(A);Roo.state.CookieProvider.superclass.clear.call(this,A);},readCookies:function(){var A={};var c=document.cookie+";";var re=/\s?(.*?)=(.*?);/g;var B;while((B=re.exec(c))!=null){var C=B[1];var D=B[2];if(C&&C.substring(0,3)=="ys-"){A[C.substr(3)]=this.decodeValue(D);}}return A;},setCookie:function(A,B){document.cookie="ys-"+A+"="+this.encodeValue(B)+((this.expires==null)?"":("; expires="+this.expires.toGMTString()))+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"");},clearCookie:function(A){document.cookie="ys-"+A+"=null; expires=Thu, 01-Jan-70 00:00:01 GMT"+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"");}});
+//Roo/dd/DragDrop.js
 (function(){var A=Roo.EventManager;var B=Roo.lib.Dom;Roo.dd.DragDrop=function(id,C,D){if(id){this.init(id,C,D);}};Roo.extend(Roo.dd.DragDrop,Roo.util.Observable,{id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(C,D,E){if(typeof D=="number"){D={left:D,right:D,top:D,bottom:D};}
 D=D||this.defaultPadding;var b=Roo.get(this.getEl()).getBox();var ce=Roo.get(C);var s=ce.getScroll();var c,cd=ce.dom;if(cd==document.body){c={x:s.left,y:s.top,width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()};}else {xy=ce.getXY();c={x:xy[0]+s.left,y:xy[1]+s.top,width:cd.clientWidth,height:cd.clientHeight};}var F=b.y-c.y;var G=b.x-c.x;this.resetConstraints();this.setXConstraint(G-(D.left||0),c.width-G-b.width-(D.right||0));this.setYConstraint(F-(D.top||0),c.height-F-b.height-(D.bottom||0));},getEl:function(){if(!this._domRef){this._domRef=Roo.getDom(this.id);}return this._domRef;},getDragEl:function(){return Roo.getDom(this.dragElId);},init:function(id,C,D){this.initTarget(id,C,D);A.on(this.id,"mousedown",this.handleMouseDown,this);},initTarget:function(id,C,D){this.config=D||{};this.DDM=Roo.dd.DDM;this.groups={};if(typeof id!=="string"){id=Roo.id(id);}
 this.id=id;this.addToGroup((C)?C:"default");this.handleElId=id;this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();this.handleOnAvailable();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(C,D,E,F){if(!D&&0!==D){this.padding=[C,C,C,C];}else if(!E&&0!==E){this.padding=[C,D,C,D];}else {this.padding=[C,D,E,F];}},setInitPosition:function(C,D){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=C||0;var dy=D||0;var p=B.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(C){var p=C||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C);},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C];}
@@ -259,6 +260,7 @@ this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(C,D){this.yTicks=[];
 this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(C,D,E){this.leftConstraint=C;this.rightConstraint=D;this.minX=this.initPageX-C;this.maxX=this.initPageX+D;if(E){this.setXTicks(this.initPageX,E);}
 this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(C,D,E){this.topConstraint=C;this.bottomConstraint=D;this.minY=this.initPageY-C;this.maxY=this.initPageY+D;if(E){this.setYTicks(this.initPageY,E);}
 this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else {this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(C,D){if(!D){return C;}else if(D[0]>=C){return D[0];}else {for(var i=0,E=D.length;i<E;++i){var F=i+1;if(D[F]&&D[F]>=C){var G=C-D[i];var H=D[F]-C;return (H>G)?D[i]:D[F];}}return D[D.length-1];}},toString:function(){return ("DragDrop "+this.id);}});})();
+//Roo/dd/DragDropMgr.js
 if(!Roo.dd.DragDropMgr){Roo.dd.DragDropMgr=function(){var A=Roo.EventManager;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(B,C){for(var i in this.ids){for(var j in this.ids[i]){var D=this.ids[i][j];if(!this.isTypeOfDD(D)){continue;}
 D[B].apply(D,C);}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(B,C){if(!this.initialized){this.init();}if(!this.ids[C]){this.ids[C]={};}
 this.ids[C][B.id]=B;},removeDDFromGroup:function(B,C){if(!this.ids[C]){this.ids[C]={};}var D=this.ids[C];if(D&&D[B.id]){delete D[B.id];}},_remove:function(B){for(var g in B.groups){if(g&&this.ids[g][B.id]){delete this.ids[g][B.id];}}delete this.handleIds[B.id];},regHandle:function(B,C){if(!this.handleIds[B]){this.handleIds[B]={};}
@@ -277,19 +279,26 @@ B.cursorIsOver=D.contains(pt);var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord
 B.overlap=null;var E=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var F=new Roo.lib.Region(E.y,E.x+el.offsetWidth,E.y+el.offsetHeight,E.x);var G=F.intersect(D);if(G){B.overlap=G;return (C)?true:B.cursorIsOver;}else {return false;}},_onUnload:function(e,me){Roo.dd.DragDropMgr.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}
 this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}
 this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var B=this.elementCache[id];if(!B||!B.el){B=this.elementCache[id]=new this.ElementWrapper(Roo.getDom(id));}return B;},getElement:function(id){return Roo.getDom(id);},getCss:function(id){var el=Roo.getDom(id);return (el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return Roo.lib.Dom.getX(el);},getPosY:function(el){return Roo.lib.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else {var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else {n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}},getScroll:function(){var t,l,B=document.documentElement,db=document.body;if(B&&(B.scrollTop||B.scrollLeft)){t=B.scrollTop;l=B.scrollLeft;}else if(db){t=db.scrollTop;l=db.scrollLeft;}else {}return {top:t,left:l};},getStyle:function(el,B){return Roo.fly(el).getStyle(B);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(B,C){var D=Roo.lib.Dom.getXY(C);Roo.lib.Dom.setXY(B,D);},numericSort:function(a,b){return (a-b);},_timeoutCount:0,_addListeners:function(){var B=Roo.dd.DDM;if(Roo.lib.Event&&document){B._onLoad();}else {if(B._timeoutCount>2000){}else {setTimeout(B._addListeners,10);if(document&&document.body){B._timeoutCount+=1;}}}},handleWasClicked:function(B,id){if(this.isHandle(id,B.id)){return true;}else {var p=B.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else {p=p.parentNode;}}}return false;}};}();Roo.dd.DDM=Roo.dd.DragDropMgr;Roo.dd.DDM._addListeners();}
+//Roo/dd/DD.js
 Roo.dd.DD=function(id,A,B){if(id){this.init(id,A,B);}};Roo.extend(Roo.dd.DD,Roo.dd.DragDrop,{scroll:true,autoOffset:function(A,B){var x=A-this.startPageX;var y=B-this.startPageY;this.setDelta(x,y);},setDelta:function(A,B){this.deltaX=A;this.deltaY=B;},setDragElPos:function(A,B){var el=this.getDragEl();this.alignElWithMouse(el,A,B);},alignElWithMouse:function(el,A,B){var C=this.getTargetCoord(A,B);var D=el.dom?el:Roo.fly(el);if(!this.deltaSetXY){var E=[C.x,C.y];D.setXY(E);var F=D.getLeft(true);var G=D.getTop(true);this.deltaSetXY=[F-C.x,G-C.y];}else {D.setLeftTop(C.x+this.deltaSetXY[0],C.y+this.deltaSetXY[1]);}
 this.cachePosition(C.x,C.y);this.autoScroll(C.x,C.y,el.offsetHeight,el.offsetWidth);return C;},cachePosition:function(A,B){if(A){this.lastPageX=A;this.lastPageY=B;}else {var C=Roo.lib.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var A=Roo.lib.Dom.getViewWidth();var B=Roo.lib.Dom.getViewHeight();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var C=h+y;var D=w+x;var E=(A+st-y-this.deltaY);var F=(B+sl-x-this.deltaX);var G=40;var H=(document.all)?80:30;if(C>A&&E<G){window.scrollTo(sl,st+H);}if(y<st&&st>0&&y-st<G){window.scrollTo(sl,st-H);}if(D>B&&F<G){window.scrollTo(sl+H,st);}if(x<sl&&sl>0&&x-sl<G){window.scrollTo(sl-H,st);}}},getTargetCoord:function(A,B){var x=A-this.deltaX;var y=B-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}if(x>this.maxX){x=this.maxX;}}if(this.constrainY){if(y<this.minY){y=this.minY;}if(y>this.maxY){y=this.maxY;}}
 x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){Roo.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(e.getPageX(),e.getPageY());},b4Drag:function(e){this.setDragElPos(e.getPageX(),e.getPageY());},toString:function(){return ("DD "+this.id);}});
+//Roo/dd/DDProxy.js
 Roo.dd.DDProxy=function(id,A,B){if(id){this.init(id,A,B);this.initFrame();}};Roo.dd.DDProxy.dragElId="ygddfdiv";Roo.extend(Roo.dd.DDProxy,Roo.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var A=this;var B=document.body;if(!B||!B.firstChild){setTimeout(function(){A.createFrame();},50);return;}var C=this.getDragEl();if(!C){C=document.createElement("div");C.id=this.dragElId;var s=C.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;B.insertBefore(C,B.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){Roo.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Roo.dd.DDProxy.dragElId);},showFrame:function(A,B){var el=this.getEl();var C=this.getDragEl();var s=C.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}
 this.setDragElPos(A,B);Roo.fly(C).show();},_resizeProxy:function(){if(this.resizeFrame){var el=this.getEl();Roo.fly(this.getDragEl()).setSize(el.offsetWidth,el.offsetHeight);}},b4MouseDown:function(e){var x=e.getPageX();var y=e.getPageY();this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){Roo.fly(this.getDragEl()).hide();},endDrag:function(e){var A=this.getEl();var B=this.getDragEl();B.style.visibility="";this.beforeMove();A.style.visibility="hidden";Roo.dd.DDM.moveToEl(A,B);B.style.visibility="hidden";A.style.visibility="";this.afterDrag();},beforeMove:function(){},afterDrag:function(){},toString:function(){return ("DDProxy "+this.id);}});
+//Roo/dd/DDTarget.js
 Roo.dd.DDTarget=function(id,A,B){if(id){this.initTarget(id,A,B);}if(B.listeners||B.events){Roo.dd.DragDrop.superclass.constructor.call(this,{listeners:B.listeners||{},events:B.events||{}});}};Roo.extend(Roo.dd.DDTarget,Roo.dd.DragDrop,{toString:function(){return ("DDTarget "+this.id);}});
+//Roo/dd/ScrollManager.js
 Roo.dd.ScrollManager=function(){var A=Roo.dd.DragDropMgr;var B={};var C=null;var D={};var E=function(e){C=null;H();};var F=function(){if(A.dragCurrent){A.refreshCache(A.dragCurrent.groups);}};var G=function(){if(A.dragCurrent){var K=Roo.dd.ScrollManager;if(!K.animate){if(D.el.scroll(D.dir,K.increment)){F();}}else {D.el.scroll(D.dir,K.increment,true,K.animDuration,F);}}};var H=function(){if(D.id){clearInterval(D.id);}
 D.id=0;D.el=null;D.dir="";};var I=function(el,K){H();D.el=el;D.dir=K;D.id=setInterval(G,Roo.dd.ScrollManager.frequency);};var J=function(e,K){if(K||!A.dragCurrent){return;}var L=Roo.dd.ScrollManager;if(!C||C!=A.dragCurrent){C=A.dragCurrent;L.refreshCache();}var xy=Roo.lib.Event.getXY(e);var pt=new Roo.lib.Point(xy[0],xy[1]);for(var id in B){var el=B[id],r=el._region;if(r&&r.contains(pt)&&el.isScrollable()){if(r.bottom-pt.y<=L.thresh){if(D.el!=el){I(el,"down");}return;}else if(r.right-pt.x<=L.thresh){if(D.el!=el){I(el,"left");}return;}else if(pt.y-r.top<=L.thresh){if(D.el!=el){I(el,"up");}return;}else if(pt.x-r.left<=L.thresh){if(D.el!=el){I(el,"right");}return;}}}
 H();};A.fireEvents=A.fireEvents.createSequence(J,A);A.stopDrag=A.stopDrag.createSequence(E,A);return {register:function(el){if(el instanceof Array){for(var i=0,K=el.length;i<K;i++){this.register(el[i]);}}else {el=Roo.get(el);B[el.id]=el;}},unregister:function(el){if(el instanceof Array){for(var i=0,K=el.length;i<K;i++){this.unregister(el[i]);}}else {el=Roo.get(el);delete B[el.id];}},thresh:25,increment:100,frequency:500,animate:true,animDuration:.4,refreshCache:function(){for(var id in B){if(typeof B[id]=='object'){B[id]._region=B[id].getRegion();}}}};}();
+//Roo/dd/Registry.js
 Roo.dd.Registry=function(){var A={};var B={};var C=0;var D=function(el,E){if(typeof el=="string"){return el;}var id=el.id;if(!id&&E!==false){id="roodd-"+(++C);el.id=id;}return id;};return {register:function(el,E){E=E||{};if(typeof el=="string"){el=document.getElementById(el);}
 E.ddel=el;A[D(el)]=E;if(E.isHandle!==false){B[E.ddel.id]=E;}if(E.handles){var hs=E.handles;for(var i=0,F=hs.length;i<F;i++){B[D(hs[i])]=E;}}},unregister:function(el){var id=D(el,false);var E=A[id];if(E){delete A[id];if(E.handles){var hs=E.handles;for(var i=0,F=hs.length;i<F;i++){delete B[D(hs[i],false)];}}}},getHandle:function(id){if(typeof id!="string"){id=id.id;}return B[id];},getHandleFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?B[t.id]:null;},getTarget:function(id){if(typeof id!="string"){id=id.id;}return A[id];},getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?A[t.id]||B[t.id]:null;}};}();
+//Roo/dd/StatusProxy.js
 Roo.dd.StatusProxy=function(A){Roo.apply(this,A);this.id=this.id||Roo.id();this.el=new Roo.Layer({dh:{id:this.id,tag:"div",cls:"x-dd-drag-proxy "+this.dropNotAllowed,children:[{tag:"div",cls:"x-dd-drop-icon"},{tag:"div",cls:"x-dd-drag-ghost"}]},shadow:!A||A.shadow!==false});this.ghost=Roo.get(this.el.dom.childNodes[1]);this.dropStatus=this.dropNotAllowed;};Roo.dd.StatusProxy.prototype={dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",setStatus:function(A){A=A||this.dropNotAllowed;if(this.dropStatus!=A){this.el.replaceClass(this.dropStatus,A);this.dropStatus=A;}},reset:function(A){this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;this.dropStatus=this.dropNotAllowed;if(A){this.ghost.update("");}},update:function(A){if(typeof A=="string"){this.ghost.update(A);}else {this.ghost.update("");A.style.margin="0";this.ghost.dom.appendChild(A);}var el=this.ghost.dom.firstChild;if(el){Roo.fly(el).setStyle('float','none');}},getEl:function(){return this.el;},getGhost:function(){return this.ghost;},hide:function(A){this.el.hide();if(A){this.reset(true);}},stop:function(){if(this.anim&&this.anim.isAnimated&&this.anim.isAnimated()){this.anim.stop();}},show:function(){this.el.show();},sync:function(){this.el.sync();},repair:function(xy,A,B){this.callback=A;this.scope=B;if(xy&&this.animRepair!==false){this.el.addClass("x-dd-drag-repair");this.el.hideUnders(true);this.anim=this.el.shift({duration:this.repairDuration||.5,easing:'easeOut',xy:xy,stopFx:true,callback:this.afterRepair,scope:this});}else {this.afterRepair();}},afterRepair:function(){this.hide(true);if(typeof this.callback=="function"){this.callback.call(this.scope||this);}
 this.callback=null;this.scope=null;}};
+//Roo/dd/DragSource.js
 Roo.dd.DragSource=function(el,A){this.el=Roo.get(el);this.dragData={};Roo.apply(this,A);if(!this.proxy){this.proxy=new Roo.dd.StatusProxy();}
 Roo.dd.DragSource.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{dragElId:this.proxy.id,resizeFrame:false,isTarget:false,scroll:this.scroll===true});this.dragging=false;};Roo.extend(Roo.dd.DragSource,Roo.dd.DDProxy,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",getDragData:function(e){return this.dragData;},onDragEnter:function(e,id){var A=Roo.dd.DragDropMgr.getDDById(id);this.cachedTarget=A;if(this.beforeDragEnter(A,e,id)!==false){if(A.isNotifyTarget){var B=A.notifyEnter(this,e,this.dragData);this.proxy.setStatus(B);}else {this.proxy.setStatus(this.dropAllowed);}if(this.afterDragEnter){this.afterDragEnter(A,e,id);}}},beforeDragEnter:function(A,e,id){return true;},alignElWithMouse:function(){Roo.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);this.proxy.sync();},onDragOver:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOver(A,e,id)!==false){if(A.isNotifyTarget){var B=A.notifyOver(this,e,this.dragData);this.proxy.setStatus(B);}if(this.afterDragOver){this.afterDragOver(A,e,id);}}},beforeDragOver:function(A,e,id){return true;},onDragOut:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOut(A,e,id)!==false){if(A.isNotifyTarget){A.notifyOut(this,e,this.dragData);}
 this.proxy.reset();if(this.afterDragOut){this.afterDragOut(A,e,id);}}
@@ -297,19 +306,25 @@ this.cachedTarget=null;},beforeDragOut:function(A,e,id){return true;},onDragDrop
 this.cacheTarget=null;}
 this.proxy.repair(this.getRepairXY(e,this.dragData),this.afterRepair,this);if(this.afterInvalidDrop){this.afterInvalidDrop(e,id);}},afterRepair:function(){if(Roo.enableFx){this.el.highlight(this.hlColor||"c3daf9");}
 this.dragging=false;},beforeInvalidDrop:function(A,e,id){return true;},handleMouseDown:function(e){if(this.dragging){return;}var A=this.getDragData(e);if(A&&this.onBeforeDrag(A,e)!==false){this.dragData=A;this.proxy.stop();Roo.dd.DragSource.superclass.handleMouseDown.apply(this,arguments);}},onBeforeDrag:function(A,e){return true;},onStartDrag:Roo.emptyFn,startDrag:function(x,y){this.proxy.reset();this.dragging=true;this.proxy.update("");this.onInitDrag(x,y);this.proxy.show();},onInitDrag:function(x,y){var A=this.el.dom.cloneNode(true);A.id=Roo.id();this.proxy.update(A);this.onStartDrag(x,y);return true;},getProxy:function(){return this.proxy;},hideProxy:function(){this.proxy.hide();this.proxy.reset(true);this.dragging=false;},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups);},b4EndDrag:function(e){},endDrag:function(e){this.onEndDrag(this.dragData,e);},onEndDrag:function(A,e){},autoOffset:function(x,y){this.setDelta(-12,-20);}});
+//Roo/dd/DropTarget.js
 Roo.dd.DropTarget=function(el,A){this.el=Roo.get(el);var B=false;;if(A&&A.listeners){B=A.listeners;delete A.listeners;}
 Roo.apply(this,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}
 this.addEvents({"enter":true,"over":true,"out":true,"drop":true});Roo.dd.DropTarget.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{isTarget:true,listeners:B||{}});};Roo.extend(Roo.dd.DropTarget,Roo.dd.DDTarget,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",success:false,valid:false,isTarget:true,isNotifyTarget:true,notifyEnter:function(dd,e,A){this.valid=true;this.fireEvent('enter',dd,e,A);if(this.overClass){this.el.addClass(this.overClass);}return typeof(this.valid)=='string'?'x-dd-drop-'+this.valid:(this.valid?this.dropAllowed:this.dropNotAllowed);},notifyOver:function(dd,e,A){this.valid=true;this.fireEvent('over',dd,e,A);return typeof(this.valid)=='string'?'x-dd-drop-'+this.valid:(this.valid?this.dropAllowed:this.dropNotAllowed);},notifyOut:function(dd,e,A){this.fireEvent('out',dd,e,A);if(this.overClass){this.el.removeClass(this.overClass);}},notifyDrop:function(dd,e,A){this.success=false;this.fireEvent('drop',dd,e,A);return this.success;}});
+//Roo/dd/DragZone.js
 Roo.dd.DragZone=function(el,A){Roo.dd.DragZone.superclass.constructor.call(this,el,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}};Roo.extend(Roo.dd.DragZone,Roo.dd.DragSource,{getDragData:function(e){return Roo.dd.Registry.getHandleFromEvent(e);},onInitDrag:function(x,y){this.proxy.update(this.dragData.ddel.cloneNode(true));this.onStartDrag(x,y);return true;},afterRepair:function(){if(Roo.enableFx){Roo.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");}
 this.dragging=false;},getRepairXY:function(e){return Roo.Element.fly(this.dragData.ddel).getXY();}});
+//Roo/dd/DropZone.js
 Roo.dd.DropZone=function(el,A){Roo.dd.DropZone.superclass.constructor.call(this,el,A);};Roo.extend(Roo.dd.DropZone,Roo.dd.DropTarget,{getTargetFromEvent:function(e){return Roo.dd.Registry.getTargetFromEvent(e);},onNodeEnter:function(n,dd,e,A){},onNodeOver:function(n,dd,e,A){return this.dropAllowed;},onNodeOut:function(n,dd,e,A){},onNodeDrop:function(n,dd,e,A){return false;},onContainerOver:function(dd,e,A){return this.dropNotAllowed;},onContainerDrop:function(dd,e,A){return false;},notifyEnter:function(dd,e,A){return this.dropNotAllowed;},notifyOver:function(dd,e,A){var n=this.getTargetFromEvent(e);if(!n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}return this.onContainerOver(dd,e,A);}if(this.lastOverNode!=n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);}
 this.onNodeEnter(n,dd,e,A);this.lastOverNode=n;}return this.onNodeOver(n,dd,e,A);},notifyOut:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}},notifyDrop:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}var n=this.getTargetFromEvent(e);return n?this.onNodeDrop(n,dd,e,A):this.onContainerDrop(dd,e,A);},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups);}});
+//Roo/data/SortTypes.js
 Roo.data.SortTypes={none:function(s){return s;},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"");},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"");},asUCString:function(s){return String(s).toUpperCase();},asDate:function(s){if(!s){return 0;}if(s instanceof Date){return s.getTime();}return Date.parse(String(s));},asFloat:function(s){var A=parseFloat(String(s).replace(/,/g,""));if(isNaN(A))A=0;return A;},asInt:function(s){var A=parseInt(String(s).replace(/,/g,""));if(isNaN(A))A=0;return A;}};
+//Roo/data/Record.js
 Roo.data.Record=function(A,id){this.id=(id||id===0)?id:++Roo.data.Record.AUTO_ID;this.data=A;};Roo.data.Record.create=function(o){var f=function(){f.superclass.constructor.apply(this,arguments);};Roo.extend(f,Roo.data.Record);var p=f.prototype;p.fields=new Roo.util.MixedCollection(false,function(B){return B.name;});for(var i=0,A=o.length;i<A;i++){p.fields.add(new Roo.data.Field(o[i]));}
 f.getField=function(B){return p.fields.get(B);};return f;};Roo.data.Record.AUTO_ID=1000;Roo.data.Record.EDIT='edit';Roo.data.Record.REJECT='reject';Roo.data.Record.COMMIT='commit';Roo.data.Record.prototype={dirty:false,editing:false,error:null,modified:null,join:function(A){this.store=A;},set:function(A,B){if(this.data[A]==B){return;}
 this.dirty=true;if(!this.modified){this.modified={};}if(typeof this.modified[A]=='undefined'){this.modified[A]=this.data[A];}
 this.data[A]=B;if(!this.editing&&this.store){this.store.afterEdit(this);}},get:function(A){return this.data[A];},beginEdit:function(){this.editing=true;this.modified={};},cancelEdit:function(){this.editing=false;delete this.modified;},endEdit:function(){this.editing=false;if(this.dirty&&this.store){this.store.afterEdit(this);}},reject:function(){var m=this.modified;for(var n in m){if(typeof m[n]!="function"){this.data[n]=m[n];}}
 this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterReject(this);}},commit:function(){this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterCommit(this);}},hasError:function(){return this.error!=null;},clearError:function(){this.error=null;},copy:function(A){return new this.constructor(Roo.apply({},this.data),A||this.id);}};
+//Roo/data/Store.js
 Roo.data.Store=function(A){this.data=new Roo.util.MixedCollection(false);this.data.getKey=function(o){return o.id;};this.baseParams={};this.paramNames={"start":"start","limit":"limit","sort":"sort","dir":"dir","multisort":"_multisort"};if(A&&A.data){this.inlineData=A.data;delete A.data;}
 Roo.apply(this,A);if(this.reader){this.reader=Roo.factory(this.reader,Roo.data);this.reader.xmodule=this.xmodule||false;if(!this.recordType){this.recordType=this.reader.recordType;}if(this.reader.onMetaChange){this.reader.onMetaChange=this.onMetaChange.createDelegate(this);}}if(this.recordType){this.fields=this.recordType.prototype.fields;}
 this.modified=[];this.addEvents({datachanged:true,metachange:true,add:true,remove:true,update:true,clear:true,beforeload:true,load:true,loadexception:true});if(this.proxy){this.proxy=Roo.factory(this.proxy,Roo.data);this.proxy.xmodule=this.xmodule||false;this.relayEvents(this.proxy,["loadexception"]);}
@@ -324,28 +339,40 @@ this.fireEvent("load",this,r,A);if(A.callback){A.callback.call(A.scope||this,r,A
 this.sortToggle[f.name]=B;this.sortInfo={field:f.name,direction:B};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else {this.load(this.lastOptions);}},each:function(fn,A){this.data.each(fn,A);},getModifiedRecords:function(){return this.modified;},createFilterFn:function(A,B,C){if(!B.exec){B=String(B);if(B.length==0){return false;}
 B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
 this.fireEvent("update",this,A,Roo.data.Record.EDIT);},afterReject:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.REJECT);},afterCommit:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].reject();}},onMetaChange:function(A,B,o){this.recordType=B;this.fields=B.prototype.fields;delete this.snapshot;this.sortInfo=A.sortInfo||this.sortInfo;this.modified=[];this.fireEvent('metachange',this,this.reader.meta);}});
+//Roo/data/SimpleStore.js
 Roo.data.SimpleStore=function(A){Roo.data.SimpleStore.superclass.constructor.call(this,{isLocal:true,reader:new Roo.data.ArrayReader({id:A.id},Roo.data.Record.create(A.fields)),proxy:new Roo.data.MemoryProxy(A.data)});this.load();};Roo.extend(Roo.data.SimpleStore,Roo.data.Store);
+//Roo/data/JsonStore.js
 Roo.data.JsonStore=function(c){Roo.data.JsonStore.superclass.constructor.call(this,Roo.apply(c,{proxy:!c.data?new Roo.data.HttpProxy({url:c.url}):undefined,reader:new Roo.data.JsonReader(c,c.fields)}));};Roo.extend(Roo.data.JsonStore,Roo.data.Store);
+//Roo/data/Field.js
 Roo.data.Field=function(A){if(typeof A=="string"){A={name:A};}
 Roo.apply(this,A);if(!this.type){this.type="auto";}var st=Roo.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType];}if(!this.sortType){switch(this.type){case "string":this.sortType=st.asUCString;break;case "date":this.sortType=st.asDate;break;default:this.sortType=st.none;}}var B=/[\$,%]/g;if(!this.convert){var cv,C=this.dateFormat;switch(this.type){case "":case "auto":case undefined:cv=function(v){return v;};break;case "string":cv=function(v){return (v===undefined||v===null)?'':String(v);};break;case "int":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseInt(String(v).replace(B,""),10):'';};break;case "float":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseFloat(String(v).replace(B,""),10):'';};break;case "bool":case "boolean":cv=function(v){return v===true||v==="true"||v==1;};break;case "date":cv=function(v){if(!v){return '';}if(v instanceof Date){return v;}if(C){if(C=="timestamp"){return new Date(v*1000);}return Date.parseDate(v,C);}var D=Date.parse(v);return D?new Date(D):null;};break;}
 this.convert=cv;}};Roo.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"};
+//Roo/data/DataReader.js
 Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){switch(c.type){case 'int':da[c.name]=0;break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break;case 'boolean':da[c.name]=false;break;default:da[c.name]="";break;}});return new this.recordType(Roo.apply(da,d));}};
+//Roo/data/DataProxy.js
 Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable);
+//Roo/data/MemoryProxy.js
 Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}
 Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,arg,null,e);callback.call(scope,null,arg,false);return;}
 C.call(D,F,E,true);},update:function(A,B){}});
+//Roo/data/HttpProxy.js
 Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{},request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}
 this.activeRequest=Roo.Ajax.request(o);}else {this.conn.request(o);}}else {C.call(D||this,null,E,false);}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){this.fireEvent("loadexception",this,o,response,e);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}
 this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){}});
+//Roo/data/ScriptTagProxy.js
 Roo.data.ScriptTagProxy=function(A){Roo.data.ScriptTagProxy.superclass.constructor.call(this);Roo.apply(this,A);this.head=document.getElementsByTagName("head")[0];};Roo.data.ScriptTagProxy.TRANS_ID=1000;Roo.extend(Roo.data.ScriptTagProxy,Roo.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var p=Roo.urlEncode(Roo.apply(A,this.extraParams));var F=this.url;F+=(F.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){F+="&_dc="+(new Date().getTime());}var G=++Roo.data.ScriptTagProxy.TRANS_ID;var H={id:G,cb:"stcCallback"+G,scriptId:"stcScript"+G,params:A,arg:E,url:F,callback:C,scope:D,reader:B};var I=this;window[H.cb]=function(o){I.handleResponse(o,H);};F+=String.format("&{0}={1}",this.callbackParam,H.cb);if(this.autoAbort!==false){this.abort();}
 H.timeoutId=this.handleFailure.defer(this.timeout,this,[H]);var J=document.createElement("script");J.setAttribute("src",F);J.setAttribute("type","text/javascript");J.setAttribute("id",H.scriptId);this.head.appendChild(J);this.trans=H;}else {C.call(D||this,null,E,false);}},isLoading:function(){return this.trans?true:false;},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans);}},destroyTrans:function(A,B){this.head.removeChild(document.getElementById(A.scriptId));clearTimeout(A.timeoutId);if(B){window[A.cb]=undefined;try{delete window[A.cb];}catch(e){}}else {window[A.cb]=function(){window[A.cb]=undefined;try{delete window[A.cb];}catch(e){}};}},handleResponse:function(o,A){this.trans=false;this.destroyTrans(A,true);var B;try{B=A.reader.readRecords(o);}catch(e){this.fireEvent("loadexception",this,o,trans.arg,e);trans.callback.call(trans.scope||window,null,trans.arg,false);return;}
 this.fireEvent("load",this,o,A.arg);A.callback.call(A.scope||window,B,A.arg,true);},handleFailure:function(A){this.trans=false;this.destroyTrans(A,false);this.fireEvent("loadexception",this,null,A.arg);A.callback.call(A.scope||window,null,A.arg,false);}});
+//Roo/data/JsonReader.js
 Roo.data.JsonReader=function(A,B){A=A||{};Roo.applyIf(A,{totalProperty:'total',successProperty:'success',root:'data',id:'id'});Roo.data.JsonReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.JsonReader,Roo.data.DataReader,{metaFromRemote:false,read:function(A){var B=A.responseText;var o=eval("("+B+")");if(!o){throw {message:"JsonReader.read: Json object not found"};}if(o.metaData){delete this.ef;this.metaFromRemote=true;this.meta=o.metaData;this.recordType=Roo.data.Record.create(o.metaData.fields);this.onMetaChange(this.meta,this.recordType,o);}return this.readRecords(o);},onMetaChange:function(A,B,o){},simpleAccess:function(A,B){return A[B];},getJsonAccessor:function(){var re=/[\[\.]/;return function(A){try{return (re.test(A))?new Function("obj","return obj."+A):function(B){return B[A];};}catch(e){}return Roo.emptyFn;};}(),readRecords:function(o){this.jsonData=o;var s=this.meta,A=this.recordType,f=A.prototype.fields,fi=f.items,fl=f.length;if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);}if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);}
 this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(I){var r=g(I);return (r===undefined||r==="")?null:r;};}else {this.getId=function(){return null;};}
 this.ef=[];for(var jj=0;jj<fl;jj++){f=fi[jj];var B=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[jj]=this.getJsonAccessor(B);}}var C=this.getRoot(o),c=C.length,D=c,E=true;if(s.totalProperty){var vt=parseInt(this.getTotal(o),10);if(!isNaN(vt)){D=vt;}}if(s.successProperty){var vs=this.getSuccess(o);if(vs===false||vs==='false'){E=false;}}var F=[];for(var i=0;i<c;i++){var n=C[i];var G={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);if(!f.convert){Roo.log('missing convert for '+f.name);Roo.log(f);continue;}
 G[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var H=new A(G,id);H.json=n;F[i]=H;}return {success:E,records:F,totalRecords:D};}});
+//Roo/data/XmlReader.js
 Roo.data.XmlReader=function(A,B){A=A||{};Roo.data.XmlReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.XmlReader,Roo.data.DataReader,{read:function(A){var B=A.responseXML;if(!B){throw {message:"XmlReader.read: XML Document not available"};}return this.readRecords(B);},readRecords:function(A){this.xmlData=A;var B=A.documentElement||A;var q=Roo.DomQuery;var C=this.recordType,D=C.prototype.fields;var E=this.meta.id;var F=0,G=true;if(this.meta.totalRecords){F=q.selectNumber(this.meta.totalRecords,B,0);}if(this.meta.success){var sv=q.selectValue(this.meta.success,B,true);G=sv!==false&&sv!=='false';}var H=[];var ns=q.select(this.meta.record,B);for(var i=0,I=ns.length;i<I;i++){var n=ns[i];var J={};var id=E?q.selectValue(E,n):undefined;for(var j=0,K=D.length;j<K;j++){var f=D.items[j];var v=q.selectValue(f.mapping||f.name,n,f.defaultValue);v=f.convert(v);J[f.name]=v;}var L=new C(J,id);L.node=n;H[H.length]=L;}return {success:G,records:H,totalRecords:F||H.length};}});
+//Roo/data/ArrayReader.js
 Roo.data.ArrayReader=function(A,B){Roo.data.ArrayReader.superclass.constructor.call(this,A,B);};Roo.extend(Roo.data.ArrayReader,Roo.data.JsonReader,{readRecords:function(o){var A=this.meta?this.meta.id:null;var B=this.recordType,C=B.prototype.fields;var D=[];var E=o;for(var i=0;i<E.length;i++){var n=E[i];var F={};var id=((A||A===0)&&n[A]!==undefined&&n[A]!==""?n[A]:null);for(var j=0,G=C.length;j<G;j++){var f=C.items[j];var k=f.mapping!==undefined&&f.mapping!==null?f.mapping:j;var v=n[k]!==undefined?n[k]:f.defaultValue;v=f.convert(v);F[f.name]=v;}var H=new B(F,id);H.json=n;D[D.length]=H;}return {records:D,totalRecords:D.length};}});
+//Roo/data/Tree.js
 Roo.data.Tree=function(A){this.nodeHash={};this.root=null;if(A){this.setRootNode(A);}
 this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true});Roo.data.Tree.superclass.constructor.call(this);};Roo.extend(Roo.data.Tree,Roo.util.Observable,{pathSeparator:"/",proxyNodeEvent:function(){return this.fireEvent.apply(this,arguments);},getRootNode:function(){return this.root;},setRootNode:function(A){this.root=A;A.ownerTree=this;A.isRoot=true;this.registerNode(A);return A;},getNodeById:function(id){return this.nodeHash[id];},registerNode:function(A){this.nodeHash[A.id]=A;},unregisterNode:function(A){delete this.nodeHash[A.id];},toString:function(){return "[Tree"+(this.id?" "+this.id:"")+"]";}});Roo.data.Node=function(A){this.attributes=A||{};this.leaf=this.attributes.leaf;this.id=this.attributes.id;if(!this.id){this.id=Roo.id(null,"ynode-");this.attributes.id=this.id;}
 this.childNodes=[];if(!this.childNodes.indexOf){this.childNodes.indexOf=function(o){for(var i=0,B=this.length;i<B;i++){if(this[i]==o){return i;}}return -1;};}
@@ -363,7 +390,9 @@ p=p.parentNode;}}return this.ownerTree;},getDepth:function(){var A=0;var p=this;
 this.ownerTree=A;var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].setOwnerTree(A);}if(A){A.registerNode(this);}}},getPath:function(A){A=A||"id";var p=this.parentNode;var b=[this.attributes[A]];while(p){b.unshift(p.attributes[A]);p=p.parentNode;}var B=this.getOwnerTree().pathSeparator;return B+b.join(B);},bubble:function(fn,A,B){var p=this;while(p){if(fn.call(A||p,B||p)===false){break;}
 p=p.parentNode;}},cascade:function(fn,A,B){if(fn.call(A||this,B||this)!==false){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].cascade(fn,A,B);}}},eachChild:function(fn,A,B){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){if(fn.call(A||this,B||cs[i])===false){break;}}},findChild:function(A,B){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){if(cs[i].attributes[A]==B){return cs[i];}}return null;},findChildBy:function(fn,A){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){if(fn.call(A||cs[i],cs[i])===true){return cs[i];}}return null;},sort:function(fn,A){var cs=this.childNodes;var B=cs.length;if(B>0){var C=A?function(){fn.apply(A,arguments);}:fn;cs.sort(C);for(var i=0;i<B;i++){var n=cs[i];n.previousSibling=cs[i-1];n.nextSibling=cs[i+1];if(i==0){this.setFirstChild(n);}if(i==B-1){this.setLastChild(n);}}}},contains:function(A){return A.isAncestor(this);},isAncestor:function(A){var p=this.parentNode;while(p){if(p==A){return true;}
 p=p.parentNode;}return false;},toString:function(){return "[Node"+(this.id?" "+this.id:"")+"]";}});
+//Roo/ComponentMgr.js
 Roo.ComponentMgr=function(){var A=new Roo.util.MixedCollection();return {register:function(c){A.add(c);},unregister:function(c){A.remove(c);},get:function(id){return A.get(id);},onAvailable:function(id,fn,B){A.on("add",function(C,o){if(o.id==id){fn.call(B||o,o);A.un("add",fn,B);}});}};}();
+//Roo/Component.js
 Roo.Component=function(A){A=A||{};if(A.tagName||A.dom||typeof A=="string"){A={el:A,id:A.id||A};}
 this.initialConfig=A;Roo.apply(this,A);this.addEvents({disable:true,enable:true,beforeshow:true,show:true,beforehide:true,hide:true,beforerender:true,render:true,beforedestroy:true,destroy:true});if(!this.id){this.id="ext-comp-"+(++Roo.Component.AUTO_ID);}
 Roo.ComponentMgr.register(this);Roo.Component.superclass.constructor.call(this);this.initComponent();if(this.renderTo){this.render(this.renderTo);delete this.renderTo;}};Roo.Component.AUTO_ID=1000;Roo.extend(Roo.Component,Roo.util.Observable,{hidden:false,disabled:false,rendered:false,disabledClass:"x-item-disabled",allowDomMove:true,hideMode:'display',ctype:"Roo.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initComponent:Roo.emptyFn,render:function(A,B){if(!this.rendered&&this.fireEvent("beforerender",this)!==false){if(!A&&this.el){this.el=Roo.get(this.el);A=this.el.dom.parentNode;this.allowDomMove=false;}
@@ -375,6 +404,7 @@ this.disabled=true;this.fireEvent("disable",this);return this;},onDisable:functi
 this.disabled=false;this.fireEvent("enable",this);return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);this.el.dom.disabled=false;},setDisabled:function(A){this[A?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;if(this.rendered){this.onShow();}
 this.fireEvent("show",this);}return this;},onShow:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="visible";}else if(this.hideMode=='offsets'){ae.removeClass('x-hidden');}else {ae.dom.style.display="";}},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;if(this.rendered){this.onHide();}
 this.fireEvent("hide",this);}return this;},onHide:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="hidden";}else if(this.hideMode=='offsets'){ae.addClass('x-hidden');}else {ae.dom.style.display="none";}},setVisible:function(A){if(A){this.show();}else {this.hide();}return this;},isVisible:function(){return this.getActionEl().isVisible();},cloneConfig:function(A){A=A||{};var id=A.id||Roo.id();var B=Roo.applyIf(A,this.initialConfig);B.id=id;return new this.constructor(B);}});
+//Roo/Layer.js
 (function(){Roo.Layer=function(C,D){C=C||{};var dh=Roo.DomHelper;var cp=C.parentEl,E=cp?Roo.getDom(cp):document.body;if(D){this.dom=Roo.getDom(D);}if(!this.dom){var o=C.dh||{tag:"div",cls:"x-layer"};this.dom=dh.append(E,o);}if(C.cls){this.addClass(C.cls);}
 this.constrain=C.constrain!==false;this.visibilityMode=Roo.Element.VISIBILITY;if(C.id){this.id=this.dom.id=C.id;}else {this.id=Roo.id(this.dom);}
 this.zindex=C.zindex||this.getZIndex();this.position("absolute",this.zindex);if(C.shadow){this.shadowOffset=C.shadowOffset||4;this.shadow=new Roo.Shadow({offset:this.shadowOffset,mode:C.shadow});}else {this.shadowOffset=0;}
@@ -386,13 +416,16 @@ Roo.Element.uncache(this.id);},remove:function(){this.destroy();},beginUpdate:fu
 this.hideShim();},constrainXY:function(){if(this.constrain){var vw=Roo.lib.Dom.getViewWidth(),vh=Roo.lib.Dom.getViewHeight();var s=Roo.get(document).getScroll();var xy=this.getXY();var x=xy[0],y=xy[1];var w=this.dom.offsetWidth+this.shadowOffset,h=this.dom.offsetHeight+this.shadowOffset;var C=false;if((x+w)>vw+s.left){x=vw-w-this.shadowOffset;C=true;}if((y+h)>vh+s.top){y=vh-h-this.shadowOffset;C=true;}if(x<s.left){x=s.left;C=true;}if(y<s.top){y=s.top;C=true;}if(C){if(this.avoidY){var ay=this.avoidY;if(y<=ay&&(y+h)>=ay){y=ay-h-5;}}
 xy=[x,y];this.storeXY(xy);A.setXY.call(this,xy);this.sync();}}},isVisible:function(){return this.visible;},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("");}else if(this.lastXY){A.setXY.call(this,this.lastXY);}else if(this.lastLT){A.setLeftTop.call(this,this.lastLT[0],this.lastLT[1]);}},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false);}else {this.setLeftTop(-10000,-10000);}},setVisible:function(v,a,d,c,e){if(v){this.showAction();}if(a&&v){var cb=function(){this.sync(true);if(c){c();}}.createDelegate(this);A.setVisible.call(this,true,true,d,cb,e);}else {if(!v){this.hideUnders(true);}var cb=c;if(a){cb=function(){this.hideAction();if(c){c();}}.createDelegate(this);}
 A.setVisible.call(this,v,a,d,cb,e);if(v){this.sync(true);}else if(!a){this.hideAction();}}},storeXY:function(xy){delete this.lastLT;this.lastXY=xy;},storeLeftTop:function(C,D){delete this.lastXY;this.lastLT=[C,D];},beforeFx:function(){this.beforeAction();return Roo.Layer.superclass.beforeFx.apply(this,arguments);},afterFx:function(){Roo.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible());},beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide();}},setLeft:function(C){this.storeLeftTop(C,this.getTop(true));A.setLeft.apply(this,arguments);this.sync();},setTop:function(C){this.storeLeftTop(this.getLeft(true),C);A.setTop.apply(this,arguments);this.sync();},setLeftTop:function(C,D){this.storeLeftTop(C,D);A.setLeftTop.apply(this,arguments);this.sync();},setXY:function(xy,a,d,c,e){this.fixDisplay();this.beforeAction();this.storeXY(xy);var cb=this.createCB(c);A.setXY.call(this,xy,a,d,cb,e);if(!a){cb();}},createCB:function(c){var el=this;return function(){el.constrainXY();el.sync(true);if(c){c();}};},setX:function(x,a,d,c,e){this.setXY([x,this.getY()],a,d,c,e);},setY:function(y,a,d,c,e){this.setXY([this.getX(),y],a,d,c,e);},setSize:function(w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setSize.call(this,w,h,a,d,cb,e);if(!a){cb();}},setWidth:function(w,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setWidth.call(this,w,a,d,cb,e);if(!a){cb();}},setHeight:function(h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setHeight.call(this,h,a,d,cb,e);if(!a){cb();}},setBounds:function(x,y,w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);if(!a){this.storeXY([x,y]);A.setXY.call(this,[x,y]);A.setSize.call(this,w,h,a,d,cb,e);cb();}else {A.setBounds.call(this,x,y,w,h,a,d,cb,e);}return this;},setZIndex:function(C){this.zindex=C;this.setStyle("z-index",C+2);if(this.shadow){this.shadow.setZIndex(C+1);}if(this.shim){this.shim.setStyle("z-index",C);}}});})();
+//Roo/Shadow.js
 Roo.Shadow=function(A){Roo.apply(this,A);if(typeof this.mode!="string"){this.mode=this.defaultMode;}var o=this.offset,a={h:0};var B=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case "drop":a.w=0;a.l=a.t=o;a.t-=1;if(Roo.isIE){a.l-=this.offset+B;a.t-=this.offset+B;a.w-=B;a.h-=B;a.t+=1;}break;case "sides":a.w=(o*2);a.l=-o;a.t=o-1;if(Roo.isIE){a.l-=(this.offset-B);a.t-=this.offset+B;a.l+=1;a.w-=(this.offset-B)*2;a.w-=B+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(Roo.isIE){a.l-=(this.offset-B);a.t-=(this.offset-B);a.l+=1;a.w-=(this.offset+B+1);a.h-=(this.offset+B);a.h+=1;}break;};this.adjusts=a;};Roo.Shadow.prototype={offset:4,defaultMode:"drop",show:function(A){A=Roo.get(A);if(!this.el){this.el=Roo.Shadow.Pool.pull();if(this.el.dom.nextSibling!=A.dom){this.el.insertBefore(A);}}
 this.el.setStyle("z-index",this.zIndex||parseInt(A.getStyle("z-index"),10)-1);if(Roo.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";}
 this.realign(A.getLeft(true),A.getTop(true),A.getWidth(),A.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 A=0;s.left=(l+a.l)+"px";s.top=(t+a.t)+"px";var sw=(w+a.w),sh=(h+a.h),B=sw+"px",C=sh+"px";if(s.width!=B||s.height!=C){s.width=B;s.height=C;if(!Roo.isIE){var cn=d.childNodes;var D=Math.max(0,(sw-12))+"px";cn[0].childNodes[1].style.width=D;cn[1].childNodes[1].style.width=D;cn[2].childNodes[1].style.width=D;cn[1].style.height=Math.max(0,(sh-12))+"px";}}},hide:function(){if(this.el){this.el.dom.style.display="none";Roo.Shadow.Pool.push(this.el);delete this.el;}},setZIndex:function(z){this.zIndex=z;if(this.el){this.el.setStyle("z-index",z);}}};Roo.Shadow.Pool=function(){var p=[];var A=Roo.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=Roo.get(Roo.DomHelper.insertHtml("beforeBegin",document.body.firstChild,A));sh.autoBoxAdjust=false;}return sh;},push:function(sh){p.push(sh);}};}();
+//Roo/BoxComponent.js
 Roo.BoxComponent=function(A){Roo.Component.call(this,A);this.addEvents({resize:true,move:true});};Roo.extend(Roo.BoxComponent,Roo.Component,{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 A=this.adjustSize(w,h);var aw=A.width,ah=A.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;},getSize:function(){return this.el.getSize();},getPosition:function(A){if(A===true){return [this.el.getLeft(true),this.el.getTop(true)];}return this.xy||this.el.getXY();},getBox:function(A){var s=this.el.getSize();if(A){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(A){this.setSize(A.width,A.height);this.setPagePosition(A.x,A.y);return this;},getResizeEl:function(){return this.resizeEl||this.el;},getPositionEl:function(){return this.positionEl||this.el;},setPosition:function(x,y){this.x=x;this.y=y;if(!this.boxReady){return this;}var A=this.adjustPosition(x,y);var ax=A.x,ay=A.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){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,A){Roo.BoxComponent.superclass.onRender.call(this,ct,A);if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl);}if(this.positionEl){this.positionEl=Roo.get(this.positionEl);}},afterRender:function(){Roo.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);}if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY);}},syncSize:function(){delete this.lastSize;this.setSize(this.el.getWidth(),this.el.getHeight());return this;},onResize:function(A,B,C,D){},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};}});
+//Roo/SplitBar.js
 Roo.SplitBar=function(A,B,C,D,E){this.el=Roo.get(A,true);this.el.dom.unselectable="on";this.resizingEl=Roo.get(B,true);this.orientation=C||Roo.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!E){this.proxy=Roo.SplitBar.createProxy(this.orientation);}else {this.proxy=Roo.get(E).dom;}
 this.dd=new Roo.dd.DDProxy(this.el.dom.id,"XSplitBars",{dragElId:this.proxy.id});this.dd.b4StartDrag=this.onStartProxyDrag.createDelegate(this);this.dd.endDrag=this.onEndProxyDrag.createDelegate(this);this.dragSpecs={};this.adapter=new Roo.SplitBar.BasicLayoutAdapter();this.adapter.init(this);if(this.orientation==Roo.SplitBar.HORIZONTAL){this.placement=D||(this.el.getX()>this.resizingEl.getX()?Roo.SplitBar.LEFT:Roo.SplitBar.RIGHT);this.el.addClass("x-splitbar-h");}else {this.placement=D||(this.el.getY()>this.resizingEl.getY()?Roo.SplitBar.TOP:Roo.SplitBar.BOTTOM);this.el.addClass("x-splitbar-v");}
 this.addEvents({"resize":true,"moved":true,"beforeresize":true,"beforeapply":true});Roo.util.Observable.call(this);};Roo.extend(Roo.SplitBar,Roo.util.Observable,{onStartProxyDrag:function(x,y){this.fireEvent("beforeresize",this);if(!this.overlay){var o=Roo.DomHelper.insertFirst(document.body,{cls:"x-drag-overlay",html:"&#160;"},true);o.unselectable();o.enableDisplayMode("block");Roo.SplitBar.prototype.overlay=o;}
@@ -400,6 +433,7 @@ this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(tr
 this.dragSpecs.startSize=A;this.dragSpecs.startPoint=[x,y];Roo.dd.DDProxy.prototype.b4StartDrag.call(this.dd,x,y);},onEndProxyDrag:function(e){Roo.get(this.proxy).setDisplayed(false);var A=Roo.lib.Event.getXY(e);if(this.overlay){this.overlay.hide();}var B;if(this.orientation==Roo.SplitBar.HORIZONTAL){B=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.LEFT?A[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-A[0]);}else {B=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.TOP?A[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-A[1]);}
 B=Math.min(Math.max(B,this.activeMinSize),this.activeMaxSize);if(B!=this.dragSpecs.startSize){if(this.fireEvent('beforeapply',this,B)!==false){this.adapter.setElementSize(this,B);this.fireEvent("moved",this,B);this.fireEvent("resize",this,B);}}},getAdapter:function(){return this.adapter;},setAdapter:function(A){this.adapter=A;this.adapter.init(this);},getMinimumSize:function(){return this.minSize;},setMinimumSize:function(A){this.minSize=A;},getMaximumSize:function(){return this.maxSize;},setMaximumSize:function(A){this.maxSize=A;},setCurrentSize:function(A){var B=this.animate;this.animate=false;this.adapter.setElementSize(this,A);this.animate=B;},destroy:function(A){if(this.shim){this.shim.remove();}
 this.dd.unreg();this.proxy.parentNode.removeChild(this.proxy);if(A){this.el.remove();}}});Roo.SplitBar.createProxy=function(A){var B=new Roo.Element(document.createElement("div"));B.unselectable();var C='x-splitbar-proxy';B.addClass(C+' '+(A==Roo.SplitBar.HORIZONTAL?C+'-h':C+'-v'));document.body.appendChild(B.dom);return B.dom;};Roo.SplitBar.BasicLayoutAdapter=function(){};Roo.SplitBar.BasicLayoutAdapter.prototype={init:function(s){},getElementSize:function(s){if(s.orientation==Roo.SplitBar.HORIZONTAL){return s.resizingEl.getWidth();}else {return s.resizingEl.getHeight();}},setElementSize:function(s,A,B){if(s.orientation==Roo.SplitBar.HORIZONTAL){if(!s.animate){s.resizingEl.setWidth(A);if(B){B(s,A);}}else {s.resizingEl.setWidth(A,true,.1,B,'easeOut');}}else {if(!s.animate){s.resizingEl.setHeight(A);if(B){B(s,A);}}else {s.resizingEl.setHeight(A,true,.1,B,'easeOut');}}}};Roo.SplitBar.AbsoluteLayoutAdapter=function(A){this.basic=new Roo.SplitBar.BasicLayoutAdapter();this.container=Roo.get(A);};Roo.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(s){this.basic.init(s);},getElementSize:function(s){return this.basic.getElementSize(s);},setElementSize:function(s,A,B){this.basic.setElementSize(s,A,this.moveSplitter.createDelegate(this,[s]));},moveSplitter:function(s){var A=Roo.SplitBar;switch(s.placement){case A.LEFT:s.el.setX(s.resizingEl.getRight());break;case A.RIGHT:s.el.setStyle("right",(this.container.getWidth()-s.resizingEl.getLeft())+"px");break;case A.TOP:s.el.setY(s.resizingEl.getBottom());break;case A.BOTTOM:s.el.setY(s.resizingEl.getTop()-s.el.getHeight());break;}}};Roo.SplitBar.VERTICAL=1;Roo.SplitBar.HORIZONTAL=2;Roo.SplitBar.LEFT=1;Roo.SplitBar.RIGHT=2;Roo.SplitBar.TOP=3;Roo.SplitBar.BOTTOM=4;
+//Roo/View.js
 Roo.View=function(A,B,C){if(typeof(B)=='undefined'){Roo.apply(this,A);this.el=Roo.get(this.el);}else {this.el=Roo.get(A);this.tpl=B;Roo.apply(this,C);}if(typeof(this.tpl)=="string"){this.tpl=new Roo.Template(this.tpl);}else {this.tpl=new Roo.factory(this.tpl,Roo);}
 this.tpl.compile();this.addEvents({"beforeclick":true,"click":true,"dblclick":true,"contextmenu":true,"selectionchange":true,"beforeselect":true,"preparedata":true});this.el.on({"click":this.onClick,"dblclick":this.onDblClick,"contextmenu":this.onContextMenu,scope:this});this.selections=[];this.nodes=[];this.cmp=new Roo.CompositeElementLite([]);if(this.store){this.store=Roo.factory(this.store,Roo.data);this.setStore(this.store,true);}
 Roo.View.superclass.constructor.call(this);};Roo.extend(Roo.View,Roo.util.Observable,{store:false,el:'',tpl:false,selectedClass:"x-view-selected",emptyText:"",multiSelect:false,singleSelect:false,toggleSelect:false,getEl:function(){return this.el;},refresh:function(){var t=this.tpl;this.clearSelections();this.el.update("");var A=[];var B=this.store.getRange();if(B.length<1){this.el.update(this.emptyText);return;}for(var i=0,C=B.length;i<C;i++){var D=this.prepareData(B[i].data,i,B[i]);this.fireEvent("preparedata",this,D,i,B[i]);A[A.length]=t.apply(D);}
@@ -409,6 +443,7 @@ p=p.parentNode;}return null;},onClick:function(e){var A=this.findItemFromChild(e
 e.preventDefault();}return true;},getSelectionCount:function(){return this.selections.length;},getSelectedNodes:function(){return this.selections;},getSelectedIndexes:function(){var A=[],s=this.selections;for(var i=0,B=s.length;i<B;i++){A.push(s[i].nodeIndex);}return A;},clearSelections:function(A){if(this.nodes&&(this.multiSelect||this.singleSelect)&&this.selections.length>0){this.cmp.elements=this.selections;this.cmp.removeClass(this.selectedClass);this.selections=[];if(!A){this.fireEvent("selectionchange",this,this.selections);}}},isSelected:function(A){var s=this.selections;if(s.length<1){return false;}
 A=this.getNode(A);return s.indexOf(A)!==-1;},select:function(A,B,C){if(A instanceof Array){if(!B){this.clearSelections(true);}for(var i=0,D=A.length;i<D;i++){this.select(A[i],true,true);}return;}var E=this.getNode(A);if(!E||this.isSelected(E)){return;}if(!B){this.clearSelections(true);}if(this.fireEvent("beforeselect",this,E,this.selections)!==false){Roo.fly(E).addClass(this.selectedClass);this.selections.push(E);if(!C){this.fireEvent("selectionchange",this,this.selections);}}},unselect:function(A,B,C){if(A instanceof Array){Roo.each(this.selections,function(s){this.unselect(s,A);},this);return;}var D=this.getNode(A);if(!D||!this.isSelected(D)){Roo.log("not selected");return;}var ns=[];Roo.each(this.selections,function(s){if(s==D){Roo.fly(D).removeClass(this.selectedClass);return;}
 ns.push(s);},this);this.selections=ns;this.fireEvent("selectionchange",this,this.selections);},getNode:function(A){if(typeof A=="string"){return document.getElementById(A);}else if(typeof A=="number"){return this.nodes[A];}return A;},getNodes:function(A,B){var ns=this.nodes;A=A||0;B=typeof B=="undefined"?ns.length-1:B;var C=[];if(A<=B){for(var i=A;i<=B;i++){C.push(ns[i]);}}else {for(var i=A;i>=B;i--){C.push(ns[i]);}}return C;},indexOf:function(A){A=this.getNode(A);if(typeof A.nodeIndex=="number"){return A.nodeIndex;}var ns=this.nodes;for(var i=0,B=ns.length;i<B;i++){if(ns[i]==A){return i;}}return -1;}});
+//Roo/JsonView.js
 Roo.JsonView=function(A,B,C){Roo.JsonView.superclass.constructor.call(this,A,B,C);var um=this.el.getUpdateManager();um.setRenderer(this);um.on("update",this.onLoad,this);um.on("failure",this.onLoadException,this);this.addEvents({'beforerender':true,'load':true,'loadexception':true});};Roo.extend(Roo.JsonView,Roo.View,{jsonRoot:"",refresh:function(){this.clearSelections();this.el.update("");var A=[];var o=this.jsonData;if(o&&o.length>0){for(var i=0,B=o.length;i<B;i++){var C=this.prepareData(o[i],i,o);A[A.length]=this.tpl.apply(C);}}else {A.push(this.emptyText);}
 this.el.update(A.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0);},load:function(){var um=this.el.getUpdateManager();um.update.apply(um,arguments);},render:function(el,A){this.clearSelections();this.el.update("");var o;try{o=Roo.util.JSON.decode(A.responseText);if(this.jsonRoot){o=o[this.jsonRoot];}}catch(e){}
 this.jsonData=o;this.beforeRender();this.refresh();},getCount:function(){return this.jsonData?this.jsonData.length:0;},getNodeData:function(A){if(A instanceof Array){var B=[];for(var i=0,C=A.length;i<C;i++){B.push(this.getNodeData(A[i]));}return B;}return this.jsonData[this.indexOf(A)]||null;},beforeRender:function(){this.snapshot=this.jsonData;if(this.sortInfo){this.sort.apply(this,this.sortInfo);}
@@ -416,8 +451,10 @@ this.fireEvent("beforerender",this,this.jsonData);},onLoad:function(el,o){this.f
 B=B.toLowerCase();for(var i=0,E=ss.length;i<E;i++){var o=ss[i];if(o[A].substr(0,D).toLowerCase()==B){C.push(o);}}}else if(B.exec){for(var i=0,E=ss.length;i<E;i++){var o=ss[i];if(B.test(o[A])){C.push(o);}}}else {return;}
 this.jsonData=C;this.refresh();}},filterBy:function(fn,A){if(this.jsonData){var B=[];var ss=this.snapshot;for(var i=0,C=ss.length;i<C;i++){var o=ss[i];if(fn.call(A||this,o)){B.push(o);}}
 this.jsonData=B;this.refresh();}},clearFilter:function(){if(this.snapshot&&this.jsonData!=this.snapshot){this.jsonData=this.snapshot;this.refresh();}},sort:function(A,B,C){this.sortInfo=Array.prototype.slice.call(arguments,0);if(this.jsonData){var p=A;var D=B&&B.toLowerCase()=="desc";var f=function(o1,o2){var v1=C?C(o1[p]):o1[p];var v2=C?C(o2[p]):o2[p];;if(v1<v2){return D?+1:-1;}else if(v1>v2){return D?-1:+1;}else {return 0;}};this.jsonData.sort(f);this.refresh();if(this.jsonData!=this.snapshot){this.snapshot.sort(f);}}}});
+//Roo/ColorPalette.js
 Roo.ColorPalette=function(A){Roo.ColorPalette.superclass.constructor.call(this,A);this.addEvents({select:true});if(this.handler){this.on("select",this.handler,this.scope,true);}};Roo.extend(Roo.ColorPalette,Roo.Component,{itemCls:"x-color-palette",value:null,clickEvent:'click',ctype:"Roo.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(A,B){var t=new Roo.MasterTemplate('<tpl><a href="#" class="color-{0}" hidefocus="on"><em><span style="background:#{0}" unselectable="on">&#160;</span></em></a></tpl>');var c=this.colors;for(var i=0,C=c.length;i<C;i++){t.add([c[i]]);}var el=document.createElement("div");el.className=this.itemCls;t.overwrite(el);A.dom.insertBefore(el,B);this.el=Roo.get(el);this.el.on(this.clickEvent,this.handleClick,this,{delegate:"a"});if(this.clickEvent!='click'){this.el.on('click',Roo.emptyFn,this,{delegate:"a",preventDefault:true});}},afterRender:function(){Roo.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(A){A=A.replace("#","");if(A!=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-"+A).addClass("x-color-palette-sel");this.value=A;this.fireEvent("select",this,A);}}});
+//Roo/DatePicker.js
 Roo.DatePicker=function(A){Roo.DatePicker.superclass.constructor.call(this,A);this.value=A&&A.value?A.value.clearTime():new Date().clearTime();this.addEvents({'select':true,'monthchange':true});if(this.handler){this.on("select",this.handler,this.scope||this);}if(!this.disabledDatesRE&&this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|";}
 this.disabledDatesRE=new RegExp(re+")");}};Roo.extend(Roo.DatePicker,Roo.Component,{todayText:"Today",okText:"&#160;OK&#160;",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minDate:null,maxDate:null,minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDays:null,disabledDaysText:"",disabledDatesRE:null,disabledDatesText:"",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:'Next Month (Control+Right)',prevText:'Previous Month (Control+Left)',monthYearText:'Choose a month (Control+Up/Down to move years)',startDay:0,showClear:false,setValue:function(A){var B=this.value;this.value=A.clearTime(true);if(this.el){this.update(this.value);}},getValue:function(){return this.value;},focus:function(){if(this.el){this.update(this.activeDate);}},onRender:function(A,B){var m=['<table cellspacing="0">','<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>','<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];var dn=this.dayNames;for(var i=0;i<7;i++){var d=this.startDay+i;if(d>6){d=d-7;}
 m.push("<th><span>",dn[d].substr(0,1),"</span></th>");}
@@ -429,6 +466,7 @@ this.update(this.value);},createMonthPicker:function(){if(!this.monthPicker.dom.
 A.push('<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',this.okText,'</button><button type="button" class="x-date-mp-cancel">',this.cancelText,'</button></td></tr>','</table>');this.monthPicker.update(A.join(''));this.monthPicker.on('click',this.onMonthClick,this);this.monthPicker.on('dblclick',this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select('td.x-date-mp-month');this.mpYears=this.monthPicker.select('td.x-date-mp-year');this.mpMonths.each(function(m,a,i){i+=1;if((i%2)==0){m.dom.xmonth=5+Math.round(i*.5);}else {m.dom.xmonth=Math.round((i-1)*.5);}});}},showMonthPicker:function(){this.createMonthPicker();var A=this.el.getSize();this.monthPicker.setSize(A);this.monthPicker.child('table').setSize(A);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn('t',{duration:.2});},updateMPYear:function(y){this.mpyear=y;var ys=this.mpYears.elements;for(var i=1;i<=10;i++){var td=ys[i-1],y2;if((i%2)==0){y2=y+Math.round(i*.5);td.firstChild.innerHTML=y2;td.xyear=y2;}else {y2=y-(5-Math.round(i*.5));td.firstChild.innerHTML=y2;td.xyear=y2;}
 this.mpYears.item(i-1)[y2==this.mpSelYear?'addClass':'removeClass']('x-date-mp-sel');}},updateMPMonth:function(sm){this.mpMonths.each(function(m,a,i){m[m.dom.xmonth==sm?'addClass':'removeClass']('x-date-mp-sel');});},selectMPMonth:function(m){},onMonthClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(el.is('button.x-date-mp-cancel')){this.hideMonthPicker();}else if(el.is('button.x-date-mp-ok')){this.update(new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else if(pn=el.up('td.x-date-mp-month',2)){this.mpMonths.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');this.mpSelMonth=pn.dom.xmonth;}else if(pn=el.up('td.x-date-mp-year',2)){this.mpYears.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');this.mpSelYear=pn.dom.xyear;}else if(el.is('a.x-date-mp-prev')){this.updateMPYear(this.mpyear-10);}else if(el.is('a.x-date-mp-next')){this.updateMPYear(this.mpyear+10);}},onMonthDblClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(pn=el.up('td.x-date-mp-month',2)){this.update(new Date(this.mpSelYear,pn.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else if(pn=el.up('td.x-date-mp-year',2)){this.update(new Date(pn.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}},hideMonthPicker:function(A){if(this.monthPicker){if(A===true){this.monthPicker.hide();}else {this.monthPicker.slideOut('t',{duration:.2});}}},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1));},showNextMonth:function(e){this.update(this.activeDate.add("mo",1));},showPrevYear:function(){this.update(this.activeDate.add("y",-1));},showNextYear:function(){this.update(this.activeDate.add("y",1));},handleMouseWheel:function(e){var A=e.getWheelDelta();if(A>0){this.showPrevMonth();e.stopEvent();}else if(A<0){this.showNextMonth();e.stopEvent();}},handleDateClick:function(e,t){e.stopEvent();if(t.dateValue&&!Roo.fly(t.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(t.dateValue));this.fireEvent("select",this,this.value);}},selectToday:function(){this.setValue(new Date().clearTime());this.fireEvent("select",this,this.value);},update:function(A){var vd=this.activeDate;this.activeDate=A;if(vd&&this.el){var t=A.getTime();if(vd.getMonth()==A.getMonth()&&vd.getFullYear()==A.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(c){if(c.dom.firstChild.dateValue==t){c.addClass("x-date-selected");setTimeout(function(){try{c.dom.firstChild.focus();}catch(e){}},50);return false;}});return;}}var B=A.getDaysInMonth();var C=A.getFirstDateOfMonth();var D=C.getDay()-this.startDay;if(D<=this.startDay){D+=7;}var pm=A.add("mo",-1);var E=pm.getDaysInMonth()-D;var F=this.cells.elements;var G=this.textNodes;B+=D;var H=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),E)).clearTime();var I=new Date().clearTime().getTime();var J=A.clearTime().getTime();var K=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var L=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var M=this.disabledDatesRE;var N=this.disabledDatesText;var O=this.disabledDays?this.disabledDays.join(""):false;var P=this.disabledDaysText;var Q=this.format;var R=function(U,V){V.title="";var t=d.getTime();V.firstChild.dateValue=t;if(t==I){V.className+=" x-date-today";V.title=U.todayText;}if(t==J){V.className+=" x-date-selected";setTimeout(function(){try{V.firstChild.focus();}catch(e){}},50);}if(t<K){V.className=" x-date-disabled";V.title=U.minText;return;}if(t>L){V.className=" x-date-disabled";V.title=U.maxText;return;}if(O){if(O.indexOf(d.getDay())!=-1){V.title=P;V.className=" x-date-disabled";}}if(M&&Q){var W=d.dateFormat(Q);if(M.test(W)){V.title=N.replace("%0",W);V.className=" x-date-disabled";}}};var i=0;for(;i<D;i++){G[i].innerHTML=(++E);d.setDate(d.getDate()+1);F[i].className="x-date-prevday";R(this,F[i]);}for(;i<B;i++){intDay=i-D+1;G[i].innerHTML=(intDay);d.setDate(d.getDate()+1);F[i].className="x-date-active";R(this,F[i]);}var S=0;for(;i<42;i++){G[i].innerHTML=(++S);d.setDate(d.getDate()+1);F[i].className="x-date-nextday";R(this,F[i]);}
 this.mbtn.setText(this.monthNames[A.getMonth()]+" "+A.getFullYear());this.fireEvent('monthchange',this,A);if(!this.internalRender){var T=this.el.dom.firstChild;var w=T.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Roo.fly(T).setWidth(w);this.internalRender=true;if(Roo.isOpera&&!this.secondPass){T.rows[0].cells[1].style.width=(w-(T.rows[0].cells[0].offsetWidth+T.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[A]);}}}});
+//Roo/TabPanel.js
 Roo.TabPanel=function(A,B){this.el=Roo.get(A,true);if(B){if(typeof B=="boolean"){this.tabPosition=B?"bottom":"top";}else {Roo.apply(this,B);}}if(this.tabPosition=="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-bottom");}
 this.stripWrap=Roo.get(this.createStrip(this.el.dom),true);this.stripEl=Roo.get(this.createStripList(this.stripWrap.dom),true);this.stripBody=Roo.get(this.stripWrap.dom.firstChild.firstChild,true);if(Roo.isIE){Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x","hidden");}if(this.tabPosition!="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-top");}
 this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,"beforetabchange":true});Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;if(this.toolbar){var C=this.toolbar;C.container=this.stripEl.child('td.x-tab-strip-toolbar');this.toolbar=new Roo.Toolbar(C);if(Roo.isSafari){var D=C.container.child('table',true);D.setAttribute('width','100%');}}
@@ -441,6 +479,7 @@ this.addEvents({"activate":true,"beforeclose":true,"close":true,"deactivate":tru
 this.fireEvent("activate",this.tabPanel,this);},isActive:function(){return this.tabPanel.getActiveTab()==this;},hide:function(){this.pnode.removeClass("on");this.hideAction();this.fireEvent("deactivate",this.tabPanel,this);},hideAction:function(){this.bodyEl.hide();this.bodyEl.setStyle("position","absolute");this.bodyEl.setLeft("-20000px");this.bodyEl.setTop("-20000px");},showAction:function(){this.bodyEl.setStyle("position","relative");this.bodyEl.setTop("");this.bodyEl.setLeft("");this.bodyEl.show();},setTooltip:function(A){if(Roo.QuickTips&&Roo.QuickTips.isEnabled()){this.textEl.dom.qtip=A;this.textEl.dom.removeAttribute('title');}else {this.textEl.dom.title=A;}},onTabClick:function(e){e.preventDefault();this.tabPanel.activate(this.id);},onTabMouseDown:function(e){e.preventDefault();this.tabPanel.activate(this.id);},getWidth:function(){return this.inner.getWidth();},setWidth:function(A){var B=A-this.pnode.getPadding("lr");this.inner.setWidth(B);this.textEl.setWidth(B-this.inner.getPadding("lr"));this.pnode.setWidth(A);},setHidden:function(A){this.hidden=A;this.pnode.setStyle("display",A?"none":"");},isHidden:function(){return this.hidden;},getText:function(){return this.text;},autoSize:function(){this.textEl.setWidth(1);this.setWidth(this.textEl.dom.scrollWidth+this.pnode.getPadding("lr")+this.inner.getPadding("lr"));},setText:function(A){this.text=A;this.textEl.update(A);this.setTooltip(A);if(!this.tabPanel.resizeTabs){this.autoSize();}},activate:function(){this.tabPanel.activate(this.id);},disable:function(){if(this.tabPanel.active!=this){this.disabled=true;this.pnode.addClass("disabled");}},enable:function(){this.disabled=false;this.pnode.removeClass("disabled");},setContent:function(A,B){this.bodyEl.update(A,B);},getUpdateManager:function(){return this.bodyEl.getUpdateManager();},setUrl:function(A,B,C){if(this.refreshDelegate){this.un('activate',this.refreshDelegate);}
 this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);return this.bodyEl.getUpdateManager();},_handleRefresh:function(A,B,C){if(!C||!this.loaded){var D=this.bodyEl.getUpdateManager();D.update(A,B,this._setLoaded.createDelegate(this));}},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();}},_setLoaded:function(){this.loaded=true;},closeClick:function(e){var o={};e.stopEvent();this.fireEvent("beforeclose",this,o);if(o.cancel!==true){this.tabPanel.removeTab(this.id);}},closeText:"Close this tab"});Roo.TabPanel.prototype.createStrip=function(A){var B=document.createElement("div");B.className="x-tabs-wrap";A.appendChild(B);return B;};Roo.TabPanel.prototype.createStripList=function(A){A.innerHTML='<div class="x-tabs-strip-wrap">'+'<table class="x-tabs-strip" cellspacing="0" cellpadding="0" border="0"><tbody><tr>'+'<td class="x-tab-strip-toolbar"></td></tr></tbody></table></div>';return A.firstChild.firstChild.firstChild.firstChild;};Roo.TabPanel.prototype.createBody=function(A){var B=document.createElement("div");Roo.id(B,"tab-body");Roo.fly(B).addClass("x-tabs-body");A.appendChild(B);return B;};Roo.TabPanel.prototype.createItemBody=function(A,id){var B=Roo.getDom(id);if(!B){B=document.createElement("div");B.id=id;}
 Roo.fly(B).addClass("x-tabs-item-body");A.insertBefore(B,A.firstChild);return B;};Roo.TabPanel.prototype.createStripElements=function(A,B,C){var td=document.createElement("td");A.insertBefore(td,A.childNodes[A.childNodes.length-1]);if(C){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template('<a href="#" class="x-tabs-right"><span class="x-tabs-left"><em class="x-tabs-inner">'+'<span unselectable="on"'+(this.disableTooltips?'':' title="{text}"')+' class="x-tabs-text">{text}</span>'+'<div unselectable="on" class="close-icon">&#160;</div></em></span></a>');}var el=this.closeTpl.overwrite(td,{"text":B});var D=el.getElementsByTagName("div")[0];var E=el.getElementsByTagName("em")[0];return {"el":el,"close":D,"inner":E};}else {if(!this.tabTpl){this.tabTpl=new Roo.Template('<a href="#" class="x-tabs-right"><span class="x-tabs-left"><em class="x-tabs-inner">'+'<span unselectable="on"'+(this.disableTooltips?'':' title="{text}"')+' class="x-tabs-text">{text}</span></em></span></a>');}var el=this.tabTpl.overwrite(td,{"text":B});var E=el.getElementsByTagName("em")[0];return {"el":el,"inner":E};}};
+//Roo/Button.js
 Roo.Button=function(A,B){if(!B){B=A;A=B.renderTo||false;}
 Roo.apply(this,B);this.addEvents({"click":true,"toggle":true,'mouseover':true,'mouseout':true,'render':true});if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);}
 Roo.util.Observable.call(this);if(A){this.render(A);}};Roo.extend(Roo.Button,Roo.util.Observable,{hidden:false,disabled:false,pressed:false,tabIndex:undefined,enableToggle:false,menu:undefined,menuAlign:"tl-bl?",iconCls:undefined,type:'button',menuClassTarget:'tr',clickEvent:'click',handleMouseEvents:true,tooltipType:'qtip',render:function(A){var B;if(this.hideParent){this.parentEl=Roo.get(A);}if(!this.dhconfig){if(!this.template){if(!Roo.Button.buttonTemplate){Roo.Button.buttonTemplate=new Roo.Template('<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>','<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>',"</tr></tbody></table>");}
@@ -456,21 +495,25 @@ this.disabled=true;},enable:function(){if(this.el){this.el.removeClass("x-btn-di
 this.disabled=false;},setDisabled:function(v){this[v!==true?"enable":"disable"]();},onClick:function(e){if(e){e.preventDefault();}if(e.button!=0){return;}if(!this.disabled){if(this.enableToggle){this.toggle();}if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);}
 this.fireEvent("click",this,e);if(this.handler){this.el.removeClass("x-btn-over");this.handler.call(this.scope||this,this,e);}}},onMouseOver:function(e){if(!this.disabled){this.el.addClass("x-btn-over");this.fireEvent('mouseover',this,e);}},onMouseOut:function(e){if(!e.within(this.el,true)){this.el.removeClass("x-btn-over");this.fireEvent('mouseout',this,e);}},onFocus:function(e){if(!this.disabled){this.el.addClass("x-btn-focus");}},onBlur:function(e){this.el.removeClass("x-btn-focus");},onMouseDown:function(e){if(!this.disabled&&e.button==0){this.el.addClass("x-btn-click");Roo.get(document).on('mouseup',this.onMouseUp,this);}},onMouseUp:function(e){if(e.button==0){this.el.removeClass("x-btn-click");Roo.get(document).un('mouseup',this.onMouseUp,this);}},onMenuShow:function(e){this.el.addClass("x-btn-menu-active");},onMenuHide:function(e){this.el.removeClass("x-btn-menu-active");}});Roo.ButtonToggleMgr=function(){var A={};function toggleGroup(B,C){if(C){var g=A[B.toggleGroup];for(var i=0,l=g.length;i<l;i++){if(g[i]!=B){g[i].toggle(false);}}}}return {register:function(B){if(!B.toggleGroup){return;}var g=A[B.toggleGroup];if(!g){g=A[B.toggleGroup]=[];}
 g.push(B);B.on("toggle",toggleGroup);},unregister:function(B){if(!B.toggleGroup){return;}var g=A[B.toggleGroup];if(g){g.remove(B);B.un("toggle",toggleGroup);}}};}();
+//Roo/SplitButton.js
 Roo.SplitButton=function(A,B){Roo.SplitButton.superclass.constructor.call(this,A,B);this.addEvents({"arrowclick":true});};Roo.extend(Roo.SplitButton,Roo.Button,{render:function(A){var B=new Roo.Template('<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>','<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>','<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',"</tbody></table></td><td>",'<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>','<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',"</tbody></table></td></tr></table>");var C=B.append(A,[this.text,this.type],true);var D=C.child("button");if(this.cls){C.addClass(this.cls);}if(this.icon){D.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){D.addClass(this.iconCls);if(!this.cls){C.addClass(this.text?'x-btn-text-icon':'x-btn-icon');}}
 this.el=C;if(this.handleMouseEvents){C.on("mouseover",this.onMouseOver,this);C.on("mouseout",this.onMouseOut,this);C.on("mousedown",this.onMouseDown,this);C.on("mouseup",this.onMouseUp,this);}
 C.on(this.clickEvent,this.onClick,this);if(this.tooltip){if(typeof this.tooltip=='object'){Roo.QuickTips.tips(Roo.apply({target:D.id},this.tooltip));}else {D.dom[this.tooltipType]=this.tooltip;}}if(this.arrowTooltip){C.child("button:nth(2)").dom[this.tooltipType]=this.arrowTooltip;}if(this.hidden){this.hide();}if(this.disabled){this.disable();}if(this.pressed){this.el.addClass("x-btn-pressed");}if(Roo.isIE&&!Roo.isIE7){this.autoWidth.defer(1,this);}else {this.autoWidth();}if(this.menu){this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this);}
 this.fireEvent('render',this);},autoWidth:function(){if(this.el){var A=this.el.child("table:first");var B=this.el.child("table:last");this.el.setWidth("auto");A.setWidth("auto");if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button:first');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if((A.getWidth()+B.getWidth())<this.minWidth){A.setWidth(this.minWidth-B.getWidth());}if(this.hidden){this.el.endMeasure();}}
 this.el.setWidth(A.getWidth()+B.getWidth());}},setHandler:function(A,B){this.handler=A;this.scope=B;},setArrowHandler:function(A,B){this.arrowHandler=A;this.scope=B;},focus:function(){if(this.el){this.el.child("button:first").focus();}},onClick:function(e){e.preventDefault();if(!this.disabled){if(e.getTarget(".x-btn-menu-arrow-wrap")){if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);}
 this.fireEvent("arrowclick",this,e);if(this.arrowHandler){this.arrowHandler.call(this.scope||this,this,e);}}else {this.fireEvent("click",this,e);if(this.handler){this.handler.call(this.scope||this,this,e);}}}},onMouseDown:function(e){if(!this.disabled){Roo.fly(e.getTarget("table")).addClass("x-btn-click");}},onMouseUp:function(e){Roo.fly(e.getTarget("table")).removeClass("x-btn-click");}});Roo.MenuButton=Roo.SplitButton;
+//Roo/Toolbar.js
 Roo.Toolbar=function(A,B,C){if(A instanceof Array){B=A;C=B;A=null;}if(typeof(A)=='object'&&A.xtype){C=A;A=C.container;B=C.buttons||[];}var D=[];if(C&&C.items){D=C.items;delete C.items;}
 Roo.apply(this,C);this.buttons=B;if(A){this.render(A);}
 this.xitems=D;Roo.each(D,function(b){this.add(b);},this);};Roo.Toolbar.prototype={render:function(ct){this.el=Roo.get(ct);if(this.cls){this.el.addClass(this.cls);}
 this.el.update('<div class="x-toolbar x-small-editor"><table cellspacing="0"><tr></tr></table></div>');this.tr=this.el.child("tr",true);var A=0;this.items=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++A));});if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons;}},add:function(){var a=arguments,l=a.length;for(var i=0;i<l;i++){this._add(a[i]);}},_add:function(el){if(el.xtype){el=Roo.factory(el,typeof(Roo.Toolbar[el.xtype])=='undefined'?Roo.form:Roo.Toolbar);}if(el.applyTo){return this.addField(el);}if(el.render){return this.addItem(el);}if(typeof el=="string"){if(el=="separator"||el=="-"){return this.addSeparator();}if(el==" "){return this.addSpacer();}if(el=="->"){return this.addFill();}return this.addText(el);}if(el.tagName){return this.addElement(el);}if(typeof el=="object"){return this.addButton(el);}return false;},addxtype:function(e){return this.add(e);},getEl:function(){return this.el;},addSeparator:function(){return this.addItem(new Roo.Toolbar.Separator());},addSpacer:function(){return this.addItem(new Roo.Toolbar.Spacer());},addFill:function(){return this.addItem(new Roo.Toolbar.Fill());},addElement:function(el){return this.addItem(new Roo.Toolbar.Item(el));},items:false,addItem:function(A){var td=this.nextBlock();A.render(td);this.items.add(A);return A;},addButton:function(A){if(A instanceof Array){var B=[];for(var i=0,C=A.length;i<C;i++){B.push(this.addButton(A[i]));}return B;}var b=A;if(!(A instanceof Roo.Toolbar.Button)){b=A.split?new Roo.Toolbar.SplitButton(A):new Roo.Toolbar.Button(A);}var td=this.nextBlock();b.render(td);this.items.add(b);return b;},addText:function(A){return this.addItem(new Roo.Toolbar.TextItem(A));},insertButton:function(A,B){if(B instanceof Array){var C=[];for(var i=0,D=B.length;i<D;i++){C.push(this.insertButton(A+i,B[i]));}return C;}if(!(B instanceof Roo.Toolbar.Button)){B=new Roo.Toolbar.Button(B);}var td=document.createElement("td");this.tr.insertBefore(td,this.tr.childNodes[A]);B.render(td);this.items.insert(A,B);return B;},addDom:function(A,B){var td=this.nextBlock();Roo.DomHelper.overwrite(td,A);var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);return ti;},fields:false,addField:function(A){if(!this.fields){var B=0;this.fields=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++B));});}var td=this.nextBlock();A.render(td);var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);this.fields.add(A);return ti;},hide:function(){this.el.child('div').setVisibilityMode(Roo.Element.DISPLAY);this.el.child('div').hide();},show:function(){this.el.child('div').show();},nextBlock:function(){var td=document.createElement("td");this.tr.appendChild(td);return td;},destroy:function(){if(this.items){Roo.destroy.apply(Roo,this.items.items);}if(this.fields){Roo.destroy.apply(Roo,this.fields.items);}
 Roo.Element.uncache(this.el,this.tr);}};Roo.Toolbar.Item=function(el){this.el=Roo.getDom(el);this.id=Roo.id(this.el);this.hidden=false;};Roo.Toolbar.Item.prototype={getEl:function(){return this.el;},render:function(td){this.td=td;td.appendChild(this.el);},destroy:function(){this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},setVisible:function(A){if(A){this.show();}else {this.hide();}},focus:function(){Roo.fly(this.el).focus();},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");this.disabled=true;this.el.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");this.disabled=false;this.el.disabled=false;}};Roo.Toolbar.Separator=function(){var s=document.createElement("span");s.className="ytb-sep";Roo.Toolbar.Separator.superclass.constructor.call(this,s);};Roo.extend(Roo.Toolbar.Separator,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Spacer=function(){var s=document.createElement("div");s.className="ytb-spacer";Roo.Toolbar.Spacer.superclass.constructor.call(this,s);};Roo.extend(Roo.Toolbar.Spacer,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Fill=Roo.extend(Roo.Toolbar.Spacer,{render:function(td){td.style.width='100%';Roo.Toolbar.Fill.superclass.render.call(this,td);}});Roo.Toolbar.TextItem=function(A){if(typeof(A)=='object'){A=A.text;}var s=document.createElement("span");s.className="ytb-text";s.innerHTML=A;Roo.Toolbar.TextItem.superclass.constructor.call(this,s);};Roo.extend(Roo.Toolbar.TextItem,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Button=function(A){Roo.Toolbar.Button.superclass.constructor.call(this,null,A);};Roo.extend(Roo.Toolbar.Button,Roo.Button,{render:function(td){this.td=td;Roo.Toolbar.Button.superclass.render.call(this,td);},destroy:function(){Roo.Toolbar.Button.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");this.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");this.disabled=false;}});Roo.ToolbarButton=Roo.Toolbar.Button;Roo.Toolbar.SplitButton=function(A){Roo.Toolbar.SplitButton.superclass.constructor.call(this,null,A);};Roo.extend(Roo.Toolbar.SplitButton,Roo.SplitButton,{render:function(td){this.td=td;Roo.Toolbar.SplitButton.superclass.render.call(this,td);},destroy:function(){Roo.Toolbar.SplitButton.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";}});Roo.Toolbar.MenuButton=Roo.Toolbar.SplitButton;
+//Roo/PagingToolbar.js
 Roo.PagingToolbar=function(el,ds,A){if(typeof(el)=='object'&&el.xtype){A=el;ds=el.dataSource;el=A.container;}var B=[];if(A.items){B=A.items;A.items=[];}
 Roo.PagingToolbar.superclass.constructor.call(this,el,null,A);this.ds=ds;this.cursor=0;this.renderButtons(this.el);this.bind(ds);Roo.each(B,function(e){this.add(Roo.factory(e));},this);};Roo.extend(Roo.PagingToolbar,Roo.Toolbar,{pageSize:20,displayMsg:'Displaying {0} - {1} of {2}',emptyMsg:'No data to display',beforePageText:"Page",afterPageText:"of {0}",firstText:"First Page",prevText:"Previous Page",nextText:"Next Page",lastText:"Last Page",refreshText:"Refresh",renderButtons:function(el){Roo.PagingToolbar.superclass.render.call(this,el);this.first=this.addButton({tooltip:this.firstText,cls:"x-btn-icon x-grid-page-first",disabled:true,handler:this.onClick.createDelegate(this,["first"])});this.prev=this.addButton({tooltip:this.prevText,cls:"x-btn-icon x-grid-page-prev",disabled:true,handler:this.onClick.createDelegate(this,["prev"])});this.add(this.beforePageText);this.field=Roo.get(this.addDom({tag:"input",type:"text",size:"3",value:"1",cls:"x-grid-page-number"}).el);this.field.on("keydown",this.onPagingKeydown,this);this.field.on("focus",function(){this.dom.select();});this.afterTextEl=this.addText(String.format(this.afterPageText,1));this.field.setHeight(18);this.next=this.addButton({tooltip:this.nextText,cls:"x-btn-icon x-grid-page-next",disabled:true,handler:this.onClick.createDelegate(this,["next"])});this.last=this.addButton({tooltip:this.lastText,cls:"x-btn-icon x-grid-page-last",disabled:true,handler:this.onClick.createDelegate(this,["last"])});this.loading=this.addButton({tooltip:this.refreshText,cls:"x-btn-icon x-grid-loading",handler:this.onClick.createDelegate(this,["refresh"])});if(this.displayInfo){this.displayEl=Roo.fly(this.el.dom.firstChild).createChild({cls:'x-paging-info'});}},updateInfo:function(){if(this.displayEl){var A=this.ds.getCount();var B=A==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+A,this.ds.getTotalCount());this.displayEl.update(B);}},onLoad:function(ds,r,o){this.cursor=o.params?o.params.start:0;var d=this.getPageData(),ap=d.activePage,ps=d.pages;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,d.pages);this.field.dom.value=ap;this.first.setDisabled(ap==1);this.prev.setDisabled(ap==1);this.next.setDisabled(ap==ps);this.last.setDisabled(ap==ps);this.loading.enable();this.updateInfo();},getPageData:function(){var A=this.ds.getTotalCount();return {total:A,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:A<this.pageSize?1:Math.ceil(A/this.pageSize)};},onLoadError:function(){this.loading.enable();},onPagingKeydown:function(e){var k=e.getKey();var d=this.getPageData();if(k==e.RETURN ){var v=this.field.dom.value,A;if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}
 A=Math.min(Math.max(1,A),d.pages)-1;this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.HOME||(k==e.UP&&e.ctrlKey)||(k==e.PAGEUP&&e.ctrlKey)||(k==e.RIGHT&&e.ctrlKey)||k==e.END||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey)){var A=(k==e.HOME||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey))?1:d.pages;this.field.dom.value=A;this.ds.load({params:{start:(A-1)*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.UP||k==e.RIGHT||k==e.PAGEUP||k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN){var v=this.field.dom.value,A;var B=(e.shiftKey)?10:1;if(k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN)B*=-1;if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}else if(parseInt(v,10)+B>=1&parseInt(v,10)+B<=d.pages){this.field.dom.value=parseInt(v,10)+B;A=Math.min(Math.max(1,A+B),d.pages)-1;this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}});}
 e.stopEvent();}},beforeLoad:function(){if(this.loading){this.loading.disable();}},onClick:function(A){var ds=this.ds;switch(A){case "first":ds.load({params:{start:0,limit:this.pageSize}});break;case "prev":ds.load({params:{start:Math.max(0,this.cursor-this.pageSize),limit:this.pageSize}});break;case "next":ds.load({params:{start:this.cursor+this.pageSize,limit:this.pageSize}});break;case "last":var B=ds.getTotalCount();var C=B%this.pageSize;var D=C?(B-C):B-this.pageSize;ds.load({params:{start:D,limit:this.pageSize}});break;case "refresh":ds.load({params:{start:this.cursor,limit:this.pageSize}});break;}},unbind:function(ds){ds.un("beforeload",this.beforeLoad,this);ds.un("load",this.onLoad,this);ds.un("loadexception",this.onLoadError,this);ds.un("remove",this.updateInfo,this);ds.un("add",this.updateInfo,this);this.ds=undefined;},bind:function(ds){ds.on("beforeload",this.beforeLoad,this);ds.on("load",this.onLoad,this);ds.on("loadexception",this.onLoadError,this);ds.on("remove",this.updateInfo,this);ds.on("add",this.updateInfo,this);this.ds=ds;}});
+//Roo/Resizable.js
 Roo.Resizable=function(el,A){this.el=Roo.get(el);if(A&&A.wrap){A.resizeChild=this.el;this.el=this.el.wrap(typeof A.wrap=="object"?A.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=A.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(A.resizeChild.getPositioning());A.resizeChild.clearPositioning();if(!A.width||!A.height){var B=A.resizeChild.getSize();this.el.setSize(B.width,B.height);}if(A.pinned&&!A.adjustments){A.adjustments="auto";}}
 this.proxy=this.el.createProxy({tag:"div",cls:"x-resizable-proxy",id:this.el.id+"-rzproxy"});this.proxy.unselectable();this.proxy.enableDisplayMode('block');Roo.apply(this,A);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned");}var C=this.el.getStyle("position");if(C!="absolute"&&C!="fixed"){this.el.setStyle("position","relative");}if(!this.handles){this.handles='s,e,se';if(this.multiDirectional){this.handles+=',n,w';}}if(this.handles=="all"){this.handles="n s e w ne nw se sw";}var hs=this.handles.split(/\s*?[,;]\s*?| /);var ps=Roo.Resizable.positions;for(var i=0,D=hs.length;i<D;i++){if(hs[i]&&ps[hs[i]]){var E=ps[hs[i]];this[E]=new Roo.Resizable.Handle(this,E,this.disableTrackOver,this.transparent);}}
 this.corner=this.southeast;if(this.handles.indexOf("n")!=-1||this.handles.indexOf("w")!=-1||this.handles.indexOf("hd")!=-1){this.updateBox=true;}
@@ -487,6 +530,7 @@ this.proxy.setBounds(x,y,w,h);if(this.dynamic){this.resizeElement();}}catch(e){}
 this.position=A;this.rz=rz;var E=A=='hdrag'?'north':A;this.el=this.tpl.append(rz.el.dom,[E],true);if(A=='hdrag'){this.el.setStyle('cursor','pointer');}
 this.el.unselectable();if(C){this.el.setOpacity(0);}
 this.el.on("mousedown",this.onMouseDown,this);if(!B){this.el.on("mouseover",this.onMouseOver,this);this.el.on("mouseout",this.onMouseOut,this);}};Roo.Resizable.Handle.prototype={afterResize:function(rz){},onMouseDown:function(e){this.rz.onMouseDown(this,e);},onMouseOver:function(e){this.rz.handleOver(this,e);},onMouseOut:function(e){this.rz.handleOut(this,e);}};
+//Roo/Editor.js
 Roo.Editor=function(A,B){Roo.Editor.superclass.constructor.call(this,B);this.field=A;this.addEvents({"beforestartedit":true,"startedit":true,"beforecomplete":true,"complete":true,"specialkey":true});};Roo.extend(Roo.Editor,Roo.Component,{value:"",alignment:"c-c?",shadow:"frame",constrain:false,completeOnEnter:false,cancelOnEsc:false,updateEl:false,onRender:function(ct,A){this.el=new Roo.Layer({shadow:this.shadow,cls:"x-editor",parentEl:ct,shim:this.shim,shadowOffset:4,id:this.id,constrain:this.constrain});this.el.setStyle("overflow",Roo.isGecko?"auto":"hidden");if(this.field.msgTarget!='title'){this.field.msgTarget='qtip';}
 this.field.render(this.el);if(Roo.isGecko){this.field.el.dom.setAttribute('autocomplete','off');}
 this.field.on("specialkey",this.onSpecialKey,this);if(this.swallowKeys){this.field.el.swallowEvent(['keydown','keypress']);}
@@ -500,6 +544,7 @@ this.field.show();if(Roo.isIE&&!this.fixIEFocus){this.fixIEFocus=true;this.defer
 this.fireEvent("startedit",this.boundEl,this.startValue);},deferredFocus:function(){if(this.editing){this.field.focus();}},cancelEdit:function(A){if(this.editing){this.setValue(this.startValue);if(A!==true){this.hide();}}},onBlur:function(){if(this.allowBlur!==true&&this.editing){this.completeEdit();}},onHide:function(){if(this.editing){this.completeEdit();return;}
 this.field.blur();if(this.field.collapse){this.field.collapse();}
 this.el.hide();if(this.hideEl!==false){this.boundEl.show();}if(Roo.QuickTips){Roo.QuickTips.enable();}},setValue:function(v){this.field.setValue(v);},getValue:function(){return this.field.getValue();}});
+//Roo/BasicDialog.js
 Roo.BasicDialog=function(el,A){this.el=Roo.get(el);var dh=Roo.DomHelper;if(!this.el&&A&&A.autoCreate){if(typeof A.autoCreate=="object"){if(!A.autoCreate.id){A.autoCreate.id=el;}
 this.el=dh.append(document.body,A.autoCreate,true);}else {this.el=dh.append(document.body,{tag:"div",id:el,style:'visibility:hidden;'},true);}}
 el=this.el;el.setDisplayed(true);el.hide=this.hideAction;this.id=el.id;el.addClass("x-dlg");Roo.apply(this,A);this.proxy=el.createProxy("x-dlg-proxy");this.proxy.hide=this.hideAction;this.proxy.setOpacity(.5);this.proxy.hide();if(A.width){el.setWidth(A.width);}if(A.height){el.setHeight(A.height);}
@@ -530,6 +575,7 @@ this.fireEvent("hide",this);if(typeof A=="function"){A();}},hideAction:function(
 this.el.setStyle("z-index",++A);if(this.proxy){this.proxy.setStyle("z-index",++A);}if(this.resizer){this.resizer.proxy.setStyle("z-index",++A);}
 this.lastZIndex=A;},getEl:function(){return this.el;}});Roo.DialogManager=function(){var A={};var B=[];var C=null;var D=function(d1,d2){return (!d1._lastAccess||d1._lastAccess<d2._lastAccess)?-1:1;};var E=function(){B.sort(D);var F=Roo.DialogManager.zseed;for(var i=0,G=B.length;i<G;i++){var H=B[i];if(H){H.setZIndex(F+(i*10));}}};return {zseed:9000,register:function(F){A[F.id]=F;B.push(F);},unregister:function(F){delete A[F.id];var i=0;var G=0;if(!B.indexOf){for(i=0,G=B.length;i<G;i++){if(B[i]==F){B.splice(i,1);return;}}}else {i=B.indexOf(F);if(i!=-1){B.splice(i,1);}}},get:function(id){return typeof id=="object"?id:A[id];},bringToFront:function(F){F=this.get(F);if(F!=C){C=F;F._lastAccess=new Date().getTime();E();}return F;},sendToBack:function(F){F=this.get(F);F._lastAccess=-(new Date().getTime());E();return F;},hideAll:function(){for(var id in A){if(A[id]&&typeof A[id]!="function"&&A[id].isVisible()){A[id].hide();}}}};}();Roo.LayoutDialog=function(el,A){var B=A;if(typeof(A)=='undefined'){B=Roo.apply({},el);el=Roo.get(document.body||document.documentElement).createChild();}
 B.autoTabs=false;Roo.LayoutDialog.superclass.constructor.call(this,el,B);this.body.setStyle({overflow:"hidden",position:"relative"});this.layout=new Roo.BorderLayout(this.body.dom,B);this.layout.monitorWindowResize=false;this.el.addClass("x-dlg-auto-layout");this.center=Roo.BasicDialog.prototype.center;this.on("show",this.layout.layout,this.layout,true);if(B.items){var C=B.items;delete B.items;Roo.each(C,this.addxtype,this);}};Roo.extend(Roo.LayoutDialog,Roo.BasicDialog,{endUpdate:function(){this.layout.endUpdate();},beginUpdate:function(){this.layout.beginUpdate();},getLayout:function(){return this.layout;},showEl:function(){Roo.LayoutDialog.superclass.showEl.apply(this,arguments);if(Roo.isIE7){this.layout.layout();}},syncBodyHeight:function(){Roo.LayoutDialog.superclass.syncBodyHeight.call(this);if(this.layout){this.layout.layout();}},addxtype:function(c){return this.layout.addxtype(c);}});
+//Roo/MessageBox.js
 Roo.MessageBox=function(){var A,B,C,D;var E,F,G,H,I,pp;var J,K,L;var M=function(Q){A.hide();Roo.callback(B.fn,B.scope||window,[Q,K.dom.value],1);};var N=function(){if(B&&B.cls){A.el.removeClass(B.cls);}if(D){Roo.TaskMgr.stop(D);D=null;}};var O=function(b){var Q=0;if(!b){J["ok"].hide();J["cancel"].hide();J["yes"].hide();J["no"].hide();A.footer.dom.style.display='none';return Q;}
 A.footer.dom.style.display='';for(var k in J){if(typeof J[k]!="function"){if(b[k]){J[k].show();J[k].setText(typeof b[k]=="string"?b[k]:Roo.MessageBox.buttonText[k]);Q+=J[k].el.getWidth()+15;}else {J[k].hide();}}}return Q;};var P=function(d,k,e){if(B&&B.closable!==false){A.hide();}if(e){e.stopEvent();}};return {getDialog:function(){if(!A){A=new Roo.BasicDialog("x-msg-box",{autoCreate:true,shadow:true,draggable:true,resizable:false,constraintoviewport:false,fixedcenter:true,collapsible:false,shim:true,modal:true,width:400,height:100,buttonAlign:"center",closeClick:function(){if(B&&B.buttons&&B.buttons.no&&!B.buttons.cancel){M("no");}else {M("cancel");}}});A.on("hide",N);C=A.mask;A.addKeyListener(27,P);J={};var bt=this.buttonText;J["ok"]=A.addButton(bt["ok"],M.createCallback("ok"));J["yes"]=A.addButton(bt["yes"],M.createCallback("yes"));J["no"]=A.addButton(bt["no"],M.createCallback("no"));J["cancel"]=A.addButton(bt["cancel"],M.createCallback("cancel"));E=A.body.createChild({html:'<span class="roo-mb-text"></span><br /><input type="text" class="roo-mb-input" /><textarea class="roo-mb-textarea"></textarea><div class="roo-mb-progress-wrap"><div class="roo-mb-progress"><div class="roo-mb-progress-bar">&#160;</div></div></div>'});F=E.dom.firstChild;G=Roo.get(E.dom.childNodes[2]);G.enableDisplayMode();G.addKeyListener([10,13],function(){if(A.isVisible()&&B&&B.buttons){if(B.buttons.ok){M("ok");}else if(B.buttons.yes){M("yes");}}});H=Roo.get(E.dom.childNodes[3]);H.enableDisplayMode();I=Roo.get(E.dom.childNodes[4]);I.enableDisplayMode();var pf=I.dom.firstChild;if(pf){pp=Roo.get(pf.firstChild);pp.setHeight(pf.offsetHeight);}}return A;},updateText:function(Q){if(!A.isVisible()&&!B.width){A.resizeTo(this.maxWidth,100);}
 F.innerHTML=Q||'&#160;';var cw=Math.max(F.offsetWidth,F.parentNode.scrollWidth);var w=Math.max(Math.min(B.width||cw,this.maxWidth),Math.max(B.minWidth||this.minWidth,L));if(B.prompt){K.setWidth(w);}if(A.isVisible()){A.fixedcenter=false;}if(E.getHeight()>(Roo.lib.Dom.getViewHeight()-100)){E.setHeight(Roo.lib.Dom.getViewHeight()-100);E.dom.style.overflowY='auto'+(Roo.isIE?'':' !important');}else {E.dom.style.height='';E.dom.style.overflowY='';}if(cw>w){E.dom.style.get='auto'+(Roo.isIE?'':' !important');}else {E.dom.style.overflowX='';}
@@ -538,6 +584,7 @@ I.setDisplayed(B.progress===true);this.updateProgress(0);K.dom.value=B.value||""
 A.setDefaultButton(db);}
 L=O(B.buttons);this.updateText(B.msg);if(B.cls){d.el.addClass(B.cls);}
 d.proxyDrag=B.proxyDrag===true;d.modal=B.modal!==false;d.mask=B.modal!==false?C:false;if(!d.isVisible()){document.body.appendChild(A.el.dom);d.animateTarget=null;d.show(Q.animEl);}return this;},progress:function(Q,R){this.show({title:Q,msg:R,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,modal:true});return this;},alert:function(Q,R,fn,S){this.show({title:Q,msg:R,buttons:this.OK,fn:fn,scope:S,modal:true});return this;},wait:function(Q,R){this.show({title:R,msg:Q,buttons:false,closable:false,progress:true,modal:true,width:300,wait:true});D=Roo.TaskMgr.start({run:function(i){Roo.MessageBox.updateProgress(((((i+20)%20)+1)*5)*.01);},interval:1000});return this;},confirm:function(Q,R,fn,S){this.show({title:Q,msg:R,buttons:this.YESNO,fn:fn,scope:S,modal:true});return this;},prompt:function(Q,R,fn,S,T){this.show({title:Q,msg:R,buttons:this.OKCANCEL,fn:fn,minWidth:250,scope:S,prompt:true,multiline:T,modal:true});return this;},OK:{ok:true},YESNO:{yes:true,no:true},OKCANCEL:{ok:true,cancel:true},YESNOCANCEL:{yes:true,no:true,cancel:true},defaultTextHeight:75,maxWidth:600,minWidth:100,minProgressWidth:250,buttonText:{ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"}};}();Roo.Msg=Roo.MessageBox;
+//Roo/QuickTips.js
 Roo.QuickTips=function(){var el,A,B,C,tm,D,E,F={},G,H=null,I,J;var ce,bd,xy,dd;var K=false,L=true,M=false;var N=1,O=1,P=1,Q=[];var R=function(e){if(L){return;}var t=e.getTarget();if(!t||t.nodeType!==1||t==document||t==document.body){return;}if(ce&&t==ce.el){clearTimeout(O);return;}if(t&&F[t.id]){F[t.id].el=t;N=W.defer(tm.showDelay,tm,[F[t.id]]);return;}var a,et=Roo.fly(t);var ns=D.namespace;if(tm.interceptTitles&&t.title){a=t.title;t.qtip=a;t.removeAttribute("title");e.preventDefault();}else {a=t.qtip||et.getAttributeNS(ns,D.attribute);}if(a){N=W.defer(tm.showDelay,tm,[{el:t,text:a,width:et.getAttributeNS(ns,D.width),autoHide:et.getAttributeNS(ns,D.hide)!="user",title:et.getAttributeNS(ns,D.title),cls:et.getAttributeNS(ns,D.cls)}]);}};var S=function(e){clearTimeout(N);var t=e.getTarget();if(t&&ce&&ce.el==t&&(tm.autoHide&&ce.autoHide!==false)){O=setTimeout(Y,tm.hideDelay);}};var T=function(e){if(L){return;}
 xy=e.getXY();xy[1]+=18;if(tm.trackMouse&&ce){el.setXY(xy);}};var U=function(e){clearTimeout(N);clearTimeout(O);if(!e.within(el)){if(tm.hideOnClick){Y();tm.disable();tm.enable.defer(100,tm);}}};var V=function(){return 2;};var W=function(o){if(L){return;}
 clearTimeout(P);ce=o;if(H){el.removeClass(H);H=null;}if(ce.cls){el.addClass(ce.cls);H=ce.cls;}if(ce.title){C.update(ce.title);C.show();}else {C.update('');C.hide();}
@@ -547,6 +594,7 @@ el=new Roo.Layer({cls:"x-tip",shadow:"drop",shim:true,constrain:true,shadowOffse
 M=true;}
 this.enable();},register:function(a){var cs=a instanceof Array?a:arguments;for(var i=0,b=cs.length;i<b;i++){var c=cs[i];var d=c.target;if(d){if(d instanceof Array){for(var j=0,e=d.length;j<e;j++){F[d[j]]=c;}}else {F[typeof d=='string'?d:Roo.id(d)]=c;}}}},unregister:function(el){delete F[Roo.id(el)];},enable:function(){if(M&&L){Q.pop();if(Q.length<1){L=false;}}},disable:function(){L=true;clearTimeout(N);clearTimeout(O);clearTimeout(P);if(ce){Y(true);}
 Q.push(1);},isEnabled:function(){return !L;},tagConfig:{namespace:"ext",attribute:"qtip",width:"width",target:"target",title:"qtitle",hide:"hide",cls:"qclass"}};}();Roo.QuickTips.tips=Roo.QuickTips.register;
+//Roo/tree/TreePanel.js
 Roo.tree.TreePanel=function(el,A){var B=false;var C=false;if(A.root){B=A.root;delete A.root;}if(A.loader){C=A.loader;delete A.loader;}
 Roo.apply(this,A);Roo.tree.TreePanel.superclass.constructor.call(this);this.el=Roo.get(el);this.el.addClass('x-tree');if(B){this.setRootNode(Roo.factory(B,Roo.tree));}if(C){this.loader=Roo.factory(C,Roo.tree);}
 this.id=this.el.id;this.addEvents({"beforeload":true,"load":true,"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"checkchange":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true,"startdrag":true,"enddrag":true,"dragdrop":true,"beforenodedrop":true,"nodedrop":true,"nodedragover":true});if(this.singleExpand){this.on("beforeexpand",this.restrictExpand,this);}if(this.editor){this.editor.tree=this;this.editor=Roo.factory(this.editor,Roo.tree);}if(this.selModel){this.selModel=Roo.factory(this.selModel,Roo.tree);}};Roo.extend(Roo.tree.TreePanel,Roo.data.Tree,{rootVisible:true,animate:Roo.enableFx,lines:true,enableDD:false,hlDrop:Roo.enableFx,renderer:false,rendererTip:false,restrictExpand:function(A){var p=A.parentNode;if(p){if(p.expandedChild&&p.expandedChild.parentNode==p){p.expandedChild.collapse();}
@@ -554,15 +602,18 @@ p.expandedChild=A;}},setRootNode:function(A){Roo.tree.TreePanel.superclass.setRo
 A.cascade(f);return r;},expandPath:function(A,B,C){B=B||"id";var D=A.split(this.pathSeparator);var E=this.root;if(E.attributes[B]!=D[1]){if(C){C(false,null);}return;}var F=1;var f=function(){if(++F==D.length){if(C){C(true,E);}return;}var c=E.findChild(B,D[F]);if(!c){if(C){C(false,E);}return;}
 E=c;c.expand(false,false,f);};E.expand(false,false,f);},selectPath:function(A,B,C){B=B||"id";var D=A.split(this.pathSeparator);var v=D.pop();if(D.length>0){var f=function(E,F){if(E&&F){var n=F.findChild(B,v);if(n){n.select();if(C){C(true,n);}}else if(C){C(false,n);}}else {if(C){C(false,n);}}};this.expandPath(D.join(this.pathSeparator),B,f);}else {this.root.select();if(C){C(true,this.root);}}},getTreeEl:function(){return this.el;},render:function(){if(this.innerCt){return this;}
 this.innerCt=this.el.createChild({tag:"ul",cls:"x-tree-root-ct "+(this.lines?"x-tree-lines":"x-tree-no-lines")});if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Roo.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true});}if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Roo.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll});}
-this.getSelectionModel().init(this);if(!this.root){console.log("ROOT not set in tree");return;}
+this.getSelectionModel().init(this);if(!this.root){Roo.log("ROOT not set in tree");return this;}
 this.root.render();if(!this.rootVisible){this.root.renderChildren();}return this;}});
+//Roo/tree/TreeSelectionModel.js
 Roo.tree.DefaultSelectionModel=function(A){this.selNode=null;this.addEvents({"selectionchange":true,"beforeselect":true});Roo.tree.DefaultSelectionModel.superclass.constructor.call(this,A);};Roo.extend(Roo.tree.DefaultSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this);},onNodeClick:function(A,e){if(e.ctrlKey&&this.selNode==A){this.unselect(A);return;}
 this.select(A);},select:function(A){var B=this.selNode;if(B!=A&&this.fireEvent('beforeselect',this,A,B)!==false){if(B){B.ui.onSelectedChange(false);}
 this.selNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,A,B);}return A;},unselect:function(A){if(this.selNode==A){this.clearSelections();}},clearSelections:function(){var n=this.selNode;if(n){n.ui.onSelectedChange(false);this.selNode=null;this.fireEvent("selectionchange",this,null);}return n;},getSelectedNode:function(){return this.selNode;},isSelected:function(A){return this.selNode==A;},selectPrevious:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}var ps=s.previousSibling;if(ps){if(!ps.isExpanded()||ps.childNodes.length<1){return this.select(ps);}else {var lc=ps.lastChild;while(lc&&lc.isExpanded()&&lc.childNodes.length>0){lc=lc.lastChild;}return this.select(lc);}}else if(s.parentNode&&(this.tree.rootVisible||!s.parentNode.isRoot)){return this.select(s.parentNode);}return null;},selectNext:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}if(s.firstChild&&s.isExpanded()){return this.select(s.firstChild);}else if(s.nextSibling){return this.select(s.nextSibling);}else if(s.parentNode){var A=null;s.parentNode.bubble(function(){if(this.nextSibling){A=this.getOwnerTree().selModel.select(this.nextSibling);return false;}});return A;}return null;},onKeyDown:function(e){var s=this.selNode||this.lastSelNode;var sm=this;if(!s){return;}var k=e.getKey();switch(k){case e.DOWN:e.stopEvent();this.selectNext();break;case e.UP:e.stopEvent();this.selectPrevious();break;case e.RIGHT:e.preventDefault();if(s.hasChildNodes()){if(!s.isExpanded()){s.expand();}else if(s.firstChild){this.select(s.firstChild,e);}}break;case e.LEFT:e.preventDefault();if(s.hasChildNodes()&&s.isExpanded()){s.collapse();}else if(s.parentNode&&(this.tree.rootVisible||s.parentNode!=this.tree.getRootNode())){this.select(s.parentNode,e);}break;};}});Roo.tree.MultiSelectionModel=function(){this.selNodes=[];this.selMap={};this.addEvents({"selectionchange":true});Roo.tree.MultiSelectionModel.superclass.constructor.call(this,cfg);};Roo.extend(Roo.tree.MultiSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this);},onNodeClick:function(A,e){this.select(A,e,e.ctrlKey);},select:function(A,e,B){if(B!==true){this.clearSelections(true);}if(this.isSelected(A)){this.lastSelNode=A;return A;}
 this.selNodes.push(A);this.selMap[A.id]=A;this.lastSelNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return A;},unselect:function(A){if(this.selMap[A.id]){A.ui.onSelectedChange(false);var sn=this.selNodes;var B=-1;if(sn.indexOf){B=sn.indexOf(A);}else {for(var i=0,C=sn.length;i<C;i++){if(sn[i]==A){B=i;break;}}}if(B!=-1){this.selNodes.splice(B,1);}delete this.selMap[A.id];this.fireEvent("selectionchange",this,this.selNodes);}},clearSelections:function(A){var sn=this.selNodes;if(sn.length>0){for(var i=0,B=sn.length;i<B;i++){sn[i].ui.onSelectedChange(false);}
 this.selNodes=[];this.selMap={};if(A!==true){this.fireEvent("selectionchange",this,this.selNodes);}}},isSelected:function(A){return this.selMap[A.id]?true:false;},getSelectedNodes:function(){return this.selNodes;},onKeyDown:Roo.tree.DefaultSelectionModel.prototype.onKeyDown,selectNext:Roo.tree.DefaultSelectionModel.prototype.selectNext,selectPrevious:Roo.tree.DefaultSelectionModel.prototype.selectPrevious});
+//Roo/tree/TreeNode.js
 Roo.tree.TreeNode=function(A){A=A||{};if(typeof A=="string"){A={text:A};}
-this.childrenRendered=false;this.rendered=false;Roo.tree.TreeNode.superclass.constructor.call(this,A);this.expanded=A.expanded===true;this.isTarget=A.isTarget!==false;this.draggable=A.draggable!==false&&A.allowDrag!==false;this.allowChildren=A.allowChildren!==false&&A.allowDrop!==false;this.text=A.text;this.disabled=A.disabled===true;this.addEvents({"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"checkchange":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true});var B=this.attributes.uiProvider||Roo.tree.TreeNodeUI;this.ui=new B(this);};Roo.extend(Roo.tree.TreeNode,Roo.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded;},getUI:function(){return this.ui;},setFirstChild:function(A){var of=this.firstChild;Roo.tree.TreeNode.superclass.setFirstChild.call(this,A);if(this.childrenRendered&&of&&A!=of){of.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},setLastChild:function(A){var ol=this.lastChild;Roo.tree.TreeNode.superclass.setLastChild.call(this,A);if(this.childrenRendered&&ol&&A!=ol){ol.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},appendChild:function(){var A=Roo.tree.TreeNode.superclass.appendChild.apply(this,arguments);if(A&&this.childrenRendered){A.render();}
+this.childrenRendered=false;this.rendered=false;Roo.tree.TreeNode.superclass.constructor.call(this,A);this.expanded=A.expanded===true;this.isTarget=A.isTarget!==false;this.draggable=A.draggable!==false&&A.allowDrag!==false;this.allowChildren=A.allowChildren!==false&&A.allowDrop!==false;this.text=A.text;this.disabled=A.disabled===true;this.addEvents({"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"checkchange":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true});var B=this.attributes.uiProvider||Roo.tree.TreeNodeUI;this.ui=new B(this);if(typeof(this.attributes.items)=='undefined'||!this.attributes.items){return;}
+Roo.each(this.attributes.items,function(c){this.appendChild(Roo.factory(c,Roo.Tree));},this)};Roo.extend(Roo.tree.TreeNode,Roo.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded;},getUI:function(){return this.ui;},setFirstChild:function(A){var of=this.firstChild;Roo.tree.TreeNode.superclass.setFirstChild.call(this,A);if(this.childrenRendered&&of&&A!=of){of.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},setLastChild:function(A){var ol=this.lastChild;Roo.tree.TreeNode.superclass.setLastChild.call(this,A);if(this.childrenRendered&&ol&&A!=ol){ol.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},appendChild:function(){var A=Roo.tree.TreeNode.superclass.appendChild.apply(this,arguments);if(A&&this.childrenRendered){A.render();}
 this.ui.updateExpandIcon();return A;},removeChild:function(A){this.ownerTree.getSelectionModel().unselect(A);Roo.tree.TreeNode.superclass.removeChild.apply(this,arguments);if(this.childrenRendered){A.ui.remove();}if(this.childNodes.length<1){this.collapse(false,false);}else {this.ui.updateExpandIcon();}if(!this.firstChild){this.childrenRendered=false;}return A;},insertBefore:function(A,B){var C=Roo.tree.TreeNode.superclass.insertBefore.apply(this,arguments);if(C&&B&&this.childrenRendered){A.render();}
 this.ui.updateExpandIcon();return C;},setText:function(A){var B=this.text;this.text=A;this.attributes.text=A;if(this.rendered){this.ui.onTextChange(this,A,B);}
 this.fireEvent("textchange",this,A,B);},select:function(){this.getOwnerTree().getSelectionModel().select(this);},unselect:function(){this.getOwnerTree().getSelectionModel().unselect(this);},isSelected:function(){return this.getOwnerTree().getSelectionModel().isSelected(this);},expand:function(A,B,C){if(!this.expanded){if(this.fireEvent("beforeexpand",this,A,B)===false){return;}if(!this.childrenRendered){this.renderChildren();}
@@ -573,11 +624,13 @@ this.fireEvent("disabledchange",this,true);},enable:function(){this.disabled=fal
 this.fireEvent("disabledchange",this,false);},renderChildren:function(A){if(A!==false){this.fireEvent("beforechildrenrendered",this);}var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].render(true);}
 this.childrenRendered=true;},sort:function(fn,A){Roo.tree.TreeNode.superclass.sort.apply(this,arguments);if(this.childrenRendered){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].render(true);}}},render:function(A){this.ui.render(A);if(!this.rendered){this.rendered=true;if(this.expanded){this.expanded=false;this.expand(false,false);}}},renderIndent:function(A,B){if(B){this.ui.childIndent=null;}
 this.ui.renderIndent();if(A===true&&this.childrenRendered){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].renderIndent(true,B);}}}});
+//Roo/tree/AsyncTreeNode.js
 Roo.tree.AsyncTreeNode=function(A){this.loaded=false;this.loading=false;Roo.tree.AsyncTreeNode.superclass.constructor.apply(this,arguments);this.addEvents({'beforeload':true,'load':true});};Roo.extend(Roo.tree.AsyncTreeNode,Roo.tree.TreeNode,{expand:function(A,B,C){if(this.loading){var D;var f=function(){if(!this.loading){clearInterval(D);this.expand(A,B,C);}}.createDelegate(this);D=setInterval(f,200);return;}if(!this.loaded){if(this.fireEvent("beforeload",this)===false){return;}
 this.loading=true;this.ui.beforeLoad(this);var E=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();if(E){E.load(this,this.loadComplete.createDelegate(this,[A,B,C]));return;}}
 Roo.tree.AsyncTreeNode.superclass.expand.call(this,A,B,C);},isLoading:function(){return this.loading;},loadComplete:function(A,B,C){this.loading=false;this.loaded=true;this.ui.afterLoad(this);this.fireEvent("load",this);this.expand(A,B,C);},isLoaded:function(){return this.loaded;},hasChildNodes:function(){if(!this.isLeaf()&&!this.loaded){return true;}else {return Roo.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);}},reload:function(A){this.collapse(false,false);while(this.firstChild){this.removeChild(this.firstChild);}
 this.childrenRendered=false;this.loaded=false;if(this.isHiddenRoot()){this.expanded=false;}
 this.expand(false,false,A);}});
+//Roo/tree/TreeNodeUI.js
 Roo.tree.TreeNodeUI=function(A){this.node=A;this.rendered=false;this.animating=false;this.emptyIcon=Roo.BLANK_IMAGE_URL;};Roo.tree.TreeNodeUI.prototype={removeChild:function(A){if(this.rendered){this.ctNode.removeChild(A.ui.getEl());}},beforeLoad:function(){this.addClass("x-tree-node-loading");},afterLoad:function(){this.removeClass("x-tree-node-loading");},onTextChange:function(A,B,C){if(this.rendered){this.textNode.innerHTML=B;}},onDisableChange:function(A,B){this.disabled=B;if(B){this.addClass("x-tree-node-disabled");}else {this.removeClass("x-tree-node-disabled");}},onSelectedChange:function(A){if(A){this.focus();this.addClass("x-tree-selected");}else {this.removeClass("x-tree-selected");}},onMove:function(A,B,C,D,E,F){this.childIndent=null;if(this.rendered){var G=D.ui.getContainer();if(!G){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);return;}var H=F?F.ui.getEl():null;if(H){G.insertBefore(this.wrap,H);}else {G.appendChild(this.wrap);}
 this.node.renderIndent(true);}},addClass:function(A){if(this.elNode){Roo.fly(this.elNode).addClass(A);}},removeClass:function(A){if(this.elNode){Roo.fly(this.elNode).removeClass(A);}},remove:function(){if(this.rendered){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);}},fireEvent:function(){return this.node.fireEvent.apply(this.node,arguments);},initEvents:function(){this.node.on("move",this.onMove,this);var E=Roo.EventManager;var a=this.anchor;var el=Roo.fly(a,'_treeui');if(Roo.isOpera){el.setStyle("text-decoration","none");}
 el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);if(this.checkbox){Roo.EventManager.on(this.checkbox,Roo.isIE?'click':'change',this.onCheckChange,this);}
@@ -592,30 +645,39 @@ this.anchor=cs[G];this.textNode=cs[G].firstChild;},getAnchor:function(){return t
 p=p.parentNode;}
 this.childIndent=A.join("");}return this.childIndent;},renderIndent:function(){if(this.rendered){var A="";var p=this.node.parentNode;if(p){A=p.ui.getChildIndent();}if(this.indentMarkup!=A){this.indentNode.innerHTML=A;this.indentMarkup=A;}
 this.updateExpandIcon();}}};Roo.tree.RootTreeNodeUI=function(){Roo.tree.RootTreeNodeUI.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.tree.RootTreeNodeUI,Roo.tree.TreeNodeUI,{render:function(){if(!this.rendered){var A=this.node.ownerTree.innerCt.dom;this.node.expanded=true;A.innerHTML='<div class="x-tree-root-node"></div>';this.wrap=this.ctNode=A.firstChild;}},collapse:function(){},expand:function(){}});
+//Roo/tree/TreeLoader.js
 Roo.tree.TreeLoader=function(A){this.baseParams={};this.requestMethod="POST";Roo.apply(this,A);this.addEvents({beforeload:true,load:true,loadexception:true,create:true});Roo.tree.TreeLoader.superclass.constructor.call(this);};Roo.extend(Roo.tree.TreeLoader,Roo.util.Observable,{uiProviders:{},clearOnLoad:true,root:false,queryParam:false,load:function(A,B){if(this.clearOnLoad){while(A.firstChild){A.removeChild(A.firstChild);}}if(A.attributes.children){var cs=A.attributes.children;for(var i=0,C=cs.length;i<C;i++){A.appendChild(this.createNode(cs[i]));}if(typeof B=="function"){B();}}else if(this.dataUrl){this.requestData(A,B);}},getParams:function(A){var B=[],bp=this.baseParams;for(var C in bp){if(typeof bp[C]!="function"){B.push(encodeURIComponent(C),"=",encodeURIComponent(bp[C]),"&");}}var n=this.queryParam===false?'node':this.queryParam;B.push(n+"=",encodeURIComponent(A.id));return B.join("");},requestData:function(A,B){if(this.fireEvent("beforeload",this,A,B)!==false){this.transId=Roo.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:B,node:A},params:this.getParams(A)});}else {if(typeof B=="function"){B();}}},isLoading:function(){return this.transId?true:false;},abort:function(){if(this.isLoading()){Roo.Ajax.abort(this.transId);}},createNode:function(attr){if(this.baseAttrs){Roo.applyIf(attr,this.baseAttrs);}if(this.applyLoader!==false){attr.loader=this;}if(typeof(attr.uiProvider)=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}if(typeof(this.uiProviders['default'])!='undefined'){attr.uiProvider=this.uiProviders['default'];}
 this.fireEvent('create',this,attr);attr.leaf=typeof(attr.leaf)=='string'?attr.leaf*1:attr.leaf;return (attr.leaf?new Roo.tree.TreeNode(attr):new Roo.tree.AsyncTreeNode(attr));},processResponse:function(A,B,C){var D=A.responseText;try{var o=Roo.decode(D);if(!o.success){var a=A.argument;this.fireEvent("loadexception",this,a.node,A);Roo.log("Load failed - should have a handler really");return;}if(this.root!==false){o=o[this.root];}for(var i=0,E=o.length;i<E;i++){var n=this.createNode(o[i]);if(n){B.appendChild(n);}}if(typeof C=="function"){C(this,B);}}catch(e){this.handleFailure(response);}},handleResponse:function(A){this.transId=false;var a=A.argument;this.processResponse(A,a.node,a.callback);this.fireEvent("load",this,a.node,A);},handleFailure:function(A){this.transId=false;var a=A.argument;this.fireEvent("loadexception",this,a.node,A);if(typeof a.callback=="function"){a.callback(this,a.node);}}});
+//Roo/tree/TreeFilter.js
 Roo.tree.TreeFilter=function(A,B){this.tree=A;this.filtered={};Roo.apply(this,B);};Roo.tree.TreeFilter.prototype={clearBlank:false,reverse:false,autoClear:false,remove:false,filter:function(A,B,C){B=B||"text";var f;if(typeof A=="string"){var D=A.length;if(D==0&&this.clearBlank){this.clear();return;}
 A=A.toLowerCase();f=function(n){return n.attributes[B].substr(0,D).toLowerCase()==A;};}else if(A.exec){f=function(n){return A.test(n.attributes[B]);};}else {throw 'Illegal filter type, must be string or regex';}
 this.filterBy(f,null,C);},filterBy:function(fn,A,B){B=B||this.tree.root;if(this.autoClear){this.clear();}var af=this.filtered,rv=this.reverse;var f=function(n){if(n==B){return true;}if(af[n.id]){return false;}var m=fn.call(A||n,n);if(!m||rv){af[n.id]=n;n.ui.hide();return false;}return true;};B.cascade(f);if(this.remove){for(var id in af){if(typeof id!="function"){var n=af[id];if(n&&n.parentNode){n.parentNode.removeChild(n);}}}}},clear:function(){var t=this.tree;var af=this.filtered;for(var id in af){if(typeof id!="function"){var n=af[id];if(n){n.ui.show();}}}
 this.filtered={};}};
+//Roo/tree/TreeSorter.js
 Roo.tree.TreeSorter=function(A,B){Roo.apply(this,B);A.on("beforechildrenrendered",this.doSort,this);A.on("append",this.updateSort,this);A.on("insert",this.updateSort,this);var C=this.dir&&this.dir.toLowerCase()=="desc";var p=this.property||"text";var D=this.sortType;var fs=this.folderSort;var cs=this.caseSensitive===true;var E=this.leafAttr||'leaf';this.sortFn=function(n1,n2){if(fs){if(n1.attributes[E]&&!n2.attributes[E]){return 1;}if(!n1.attributes[E]&&n2.attributes[E]){return -1;}}var v1=D?D(n1):(cs?n1.attributes[p]:n1.attributes[p].toUpperCase());var v2=D?D(n2):(cs?n2.attributes[p]:n2.attributes[p].toUpperCase());if(v1<v2){return C?+1:-1;}else if(v1>v2){return C?-1:+1;}else {return 0;}};};Roo.tree.TreeSorter.prototype={doSort:function(A){A.sort(this.sortFn);},compareNodes:function(n1,n2){return (n1.text.toUpperCase()>n2.text.toUpperCase()?1:-1);},updateSort:function(A,B){if(B.childrenRendered){this.doSort.defer(1,this,[B]);}}};
+//Roo/tree/TreeDropZone.js
 if(Roo.dd.DropZone){Roo.tree.TreeDropZone=function(A,B){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Roo.tree.TreeDropZone.superclass.constructor.call(this,A.innerCt,B);this.tree=A;this.lastInsertClass="x-tree-no-status";this.dragOverData={};};Roo.extend(Roo.tree.TreeDropZone,Roo.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(A){if(A.hasChildNodes()&&!A.isExpanded()){A.expand(false,null,this.triggerCacheRefresh.createDelegate(this));}},queueExpand:function(A){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[A]);},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false;}},isValidDropPoint:function(n,pt,dd,e,A){if(!n||!A){return false;}var B=n.node;var C=A.node;if(!(B&&B.isTarget&&pt)){return false;}if(pt=="append"&&B.allowChildren===false){return false;}if((pt=="above"||pt=="below")&&(B.parentNode&&B.parentNode.allowChildren===false)){return false;}if(C&&(B==C||C.contains(B))){return false;}var D=this.dragOverData;D.tree=this.tree;D.target=B;D.data=A;D.point=pt;D.source=dd;D.rawEvent=e;D.dropNode=C;D.cancel=false;var E=this.tree.fireEvent("nodedragover",D);return D.cancel===false&&E!==false;},getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false;}var A=n.ddel;var t=Roo.lib.Dom.getY(A),b=t+A.offsetHeight;var y=Roo.lib.Event.getPageY(e);var B=tn.allowChildren===false;if(this.appendOnly||tn.parentNode.allowChildren===false){return B?false:"append";}var C=false;if(!this.allowParentInsert){C=tn.hasChildNodes()&&tn.isExpanded();}var q=(b-t)/(B?2:3);if(y>=t&&y<(t+q)){return "above";}else if(!C&&(B||y>=b-q&&y<=b)){return "below";}else {return "append";}},onNodeEnter:function(n,dd,e,A){this.cancelExpand();},onNodeOver:function(n,dd,e,A){var pt=this.getDropPoint(e,n,dd);var B=n.node;if(!this.expandProcId&&pt=="append"&&B.hasChildNodes()&&!n.node.isExpanded()){this.queueExpand(B);}else if(pt!="append"){this.cancelExpand();}var C=this.dropNotAllowed;if(this.isValidDropPoint(n,pt,dd,e,A)){if(pt){var el=n.ddel;var D;if(pt=="above"){C=n.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";D="x-tree-drag-insert-above";}else if(pt=="below"){C=n.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";D="x-tree-drag-insert-below";}else {C="x-tree-drop-ok-append";D="x-tree-drag-append";}if(this.lastInsertClass!=D){Roo.fly(el).replaceClass(this.lastInsertClass,D);this.lastInsertClass=D;}}}return C;},onNodeOut:function(n,dd,e,A){this.cancelExpand();this.removeDropIndicators(n);},onNodeDrop:function(n,dd,e,A){var B=this.getDropPoint(e,n,dd);var C=n.node;C.ui.startDrop();if(!this.isValidDropPoint(n,B,dd,e,A)){C.ui.endDrop();return false;}var D=A.node||(dd.getTreeNode?dd.getTreeNode(A,C,B,e):null);var E={tree:this.tree,target:C,data:A,point:B,source:dd,rawEvent:e,dropNode:D,cancel:!D};var F=this.tree.fireEvent("beforenodedrop",E);if(F===false||E.cancel===true||!E.dropNode){C.ui.endDrop();return false;}
 C=E.target;if(B=="append"&&!C.isExpanded()){C.expand(false,null,function(){this.completeDrop(E);}.createDelegate(this));}else {this.completeDrop(E);}return true;},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!(ns instanceof Array)){ns=[ns];}var n;for(var i=0,A=ns.length;i<A;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t);}else if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling);}else {t.appendChild(n);}}
 n.ui.focus();if(this.tree.hlDrop){n.ui.highlight();}
 t.ui.endDrop();this.tree.fireEvent("nodedrop",de);},afterNodeMoved:function(dd,A,e,B,C){if(this.tree.hlDrop){C.ui.focus();C.ui.highlight();}
 this.tree.fireEvent("nodedrop",this.tree,B,A,dd,e);},getTree:function(){return this.tree;},removeDropIndicators:function(n){if(n&&n.ddel){var el=n.ddel;Roo.fly(el).removeClass(["x-tree-drag-insert-above","x-tree-drag-insert-below","x-tree-drag-append"]);this.lastInsertClass="_noclass";}},beforeDragDrop:function(A,e,id){this.cancelExpand();return true;},afterRepair:function(A){if(A&&Roo.enableFx){A.node.ui.highlight();}
 this.hideProxy();}});}
+//Roo/tree/TreeDragZone.js
 if(Roo.dd.DragZone){Roo.tree.TreeDragZone=function(A,B){Roo.tree.TreeDragZone.superclass.constructor.call(this,A.getTreeEl(),B);this.tree=A;};Roo.extend(Roo.tree.TreeDragZone,Roo.dd.DragZone,{ddGroup:"TreeDD",onBeforeDrag:function(A,e){var n=A.node;return n&&n.draggable&&!n.disabled;},onInitDrag:function(e){var A=this.dragData;this.tree.getSelectionModel().select(A.node);this.proxy.update("");A.node.ui.appendDDGhost(this.proxy.ghost.dom);this.tree.fireEvent("startdrag",this.tree,A.node,e);},getRepairXY:function(e,A){return A.node.ui.getDDRepairXY();},onEndDrag:function(A,e){this.tree.fireEvent("enddrag",this.tree,A.node,e);},onValidDrop:function(dd,e,id){this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,dd,e);this.hideProxy();},beforeInvalidDrop:function(e,id){var sm=this.tree.getSelectionModel();sm.clearSelections();sm.select(this.dragData.node);}});}
+//Roo/tree/TreeEditor.js
 Roo.tree.TreeEditor=function(A,B){var C=A;var D;if(B){D=B.events?B:new Roo.form.TextField(B);}else {C=A.tree;A.field=A.field||{};A.field.xtype='TextField';D=Roo.factory(A.field,Roo.form);}
 A=A||{};this.addEvents({"beforenodeedit":true});Roo.tree.TreeEditor.superclass.constructor.call(this,D,A);this.tree=C;C.on('beforeclick',this.beforeNodeClick,this);C.getTreeEl().on('mousedown',this.hide,this);this.on('complete',this.updateNode,this);this.on('beforestartedit',this.fitToTree,this);this.on('startedit',this.bindScroll,this,{delay:10});this.on('specialkey',this.onSpecialKey,this);};Roo.extend(Roo.tree.TreeEditor,Roo.Editor,{alignment:"l-l",autoSize:false,hideEl:false,cls:"x-small-editor x-tree-editor",shim:false,shadow:"frame",maxWidth:250,editDelay:350,fitToTree:function(ed,el){var td=this.tree.getTreeEl().dom,nd=el.dom;if(td.scrollLeft>nd.offsetLeft){td.scrollLeft=nd.offsetLeft;}var w=Math.min(this.maxWidth,(td.clientWidth>20?td.clientWidth:td.offsetWidth)-Math.max(0,nd.offsetLeft-td.scrollLeft)-5);this.setSize(w,'');return this.fireEvent('beforenodeedit',this,this.editNode);},triggerEdit:function(A){this.completeEdit();this.editNode=A;this.startEdit(A.ui.textNode,A.text);},bindScroll:function(){this.tree.getTreeEl().on('scroll',this.cancelEdit,this);},beforeNodeClick:function(A,e){var B=(this.lastClick?this.lastClick.getElapsed():0);this.lastClick=new Date();if(B>this.editDelay&&this.tree.getSelectionModel().isSelected(A)){e.stopEvent();this.triggerEdit(A);return false;}return true;},updateNode:function(ed,A){this.tree.getTreeEl().un('scroll',this.cancelEdit,this);this.editNode.setText(A);},onHide:function(){Roo.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus();}},onSpecialKey:function(A,e){var k=e.getKey();if(k==e.ESC){e.stopEvent();this.cancelEdit();}else if(k==e.ENTER&&!e.hasModifier()){e.stopEvent();this.completeEdit();}}});
+//Roo/tree/ColumnNodeUI.js
 Roo.tree.ColumnNodeUI=Roo.extend(Roo.tree.TreeNodeUI,{renderElements:function(n,a,A,B){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var t=n.getOwnerTree();var C=Pman.Tab.Document_TypesTree.tree.el.id;var D=t.columns;var bw=t.borderWidth;var c=D[0];var E=a.href?a.href:Roo.isGecko?"":"#";var cb=typeof a.checked=="boolean";var tx=String.format('{0}',n.text||(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));var F='x-t-'+C+'-c0';var G=['<li class="x-tree-node">','<div class="x-tree-node-el ',a.cls,'">','<div class="x-tree-col ',F,'" style="width:',c.width-bw,'px;">','<span class="x-tree-node-indent">',this.indentMarkup,'</span>','<img src="',this.emptyIcon,'" class="x-tree-ec-icon  " />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?' x-tree-node-inline-icon':''),(a.iconCls?' '+a.iconCls:''),'" unselectable="on" />',(cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':' />')):''),'<a class="x-tree-node-anchor" hidefocus="on" href="',E,'" tabIndex="1" ',(a.hrefTarget?' target="'+a.hrefTarget+'"':''),'>','<span unselectable="on" qtip="'+tx+'">',tx,'</span></a>','</div>','<a class="x-tree-node-anchor" hidefocus="on" href="',E,'" tabIndex="1" ',(a.hrefTarget?' target="'+a.hrefTarget+'"':''),'>'];for(var i=1,H=D.length;i<H;i++){c=D[i];F='x-t-'+C+'-c'+i;tx=String.format('{0}',(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));G.push('<div class="x-tree-col ',F,' ',(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">','<div class="x-tree-col-text" qtip="'+tx+'">',tx,"</div>","</div>");}
 G.push('</a>','<div class="x-clear"></div></div>','<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>");if(B!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),G.join(""));}else {this.wrap=Roo.DomHelper.insertHtml("beforeEnd",A,G.join(""));}var el=this.wrap.firstChild;this.elRow=el;this.elNode=el.firstChild;this.ranchor=el.childNodes[1];this.ctNode=this.wrap.childNodes[1];var cs=el.firstChild.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var I=3;if(cb){this.checkbox=cs[3];I++;}
 this.anchor=cs[I];this.textNode=cs[I].firstChild;},initEvents:function(){Roo.tree.ColumnNodeUI.superclass.initEvents.call(this);var a=this.ranchor;var el=Roo.get(a);if(Roo.isOpera){el.setStyle("text-decoration","none");}
 el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);el.on("contextmenu",this.onContextMenu,this);},addClass:function(A){if(this.elRow){Roo.fly(this.elRow).addClass(A);}},removeClass:function(A){if(this.elRow){Roo.fly(this.elRow).removeClass(A);}}});
+//Roo/tree/ColumnTree.js
 Roo.tree.ColumnTree=function(el,A){Roo.tree.ColumnTree.superclass.constructor.call(this,el,A);this.addEvents({"resize":true});this.on('resize',this.onResize,this);};Roo.extend(Roo.tree.ColumnTree,Roo.tree.TreePanel,{borderWidth:Roo.isBorderBox?0:2,headEls:false,render:function(){Roo.tree.ColumnTree.superclass.render.apply(this);this.el.addClass('x-column-tree');this.headers=this.el.createChild({cls:'x-tree-headers'},this.innerCt.dom);var A=this.columns,c;var B=0;this.headEls=[];var C=A.length;for(var i=0;i<C;i++){c=A[i];B+=c.width;this.headEls.push(this.headers.createChild({cls:'x-tree-hd '+(c.cls?c.cls+'-hd':''),cn:{cls:'x-tree-hd-text',html:c.header},style:'width:'+(c.width-this.borderWidth)+'px;'}));}
 this.headers.createChild({cls:'x-clear'});this.headers.setWidth(B);this.innerCt.setStyle({overflow:'auto'});this.onResize(this.width,this.height);},onResize:function(w,h){this.height=h;this.width=w;this.innerCt.setWidth(this.width);this.innerCt.setHeight(this.height-20);var A=this.columns,c;var B=0;var C=false;var D=A.length;for(var i=0;i<D;i++){c=A[i];if(this.autoExpandColumn!==false&&c.dataIndex==this.autoExpandColumn){C=this.headEls[i];continue;}
 B+=c.width;}if(C){C.setWidth(((w-B)-this.borderWidth-20));}
 this.headers.setWidth(w-20);}});
+//Roo/menu/Menu.js
 Roo.menu.Menu=function(A){Roo.apply(this,A);this.id=this.id||Roo.id();this.addEvents({beforeshow:true,beforehide:true,show:true,hide:true,click:true,mouseover:true,mouseout:true,itemclick:true});if(this.registerMenu){Roo.menu.MenuMgr.register(this);}var B=this.items;this.items=new Roo.util.MixedCollection();if(B){this.add.apply(this,B);}};Roo.extend(Roo.menu.Menu,Roo.util.Observable,{minWidth:120,shadow:"sides",subMenuAlign:"tl-tr?",defaultAlign:"tl-bl?",allowOtherMenus:false,registerMenu:true,hidden:true,render:function(){if(this.el){return;}var el=this.el=new Roo.Layer({cls:"x-menu",shadow:this.shadow,constrain:false,parentEl:this.parentEl||document.body,zindex:15000});this.keyNav=new Roo.menu.MenuNav(this);if(this.plain){el.addClass("x-menu-plain");}if(this.cls){el.addClass(this.cls);}
 this.focusEl=el.createChild({tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"});var ul=el.createChild({tag:"ul",cls:"x-menu-list"});ul.on("click",this.onClick,this);ul.on("mouseover",this.onMouseOver,this);ul.on("mouseout",this.onMouseOut,this);this.items.each(function(A){var li=document.createElement("li");li.className="x-menu-list-item";ul.dom.appendChild(li);A.render(li,this);},this);this.ul=ul;this.autoWidth();},autoWidth:function(){var el=this.el,ul=this.ul;if(!el){return;}var w=this.width;if(w){el.setWidth(w);}else if(Roo.isIE){el.setWidth(this.minWidth);var t=el.dom.offsetWidth;el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));}},delayAutoWidth:function(){if(this.rendered){if(!this.awTask){this.awTask=new Roo.util.DelayedTask(this.autoWidth,this);}
 this.awTask.delay(20);}},findTargetItem:function(e){var t=e.getTarget(".x-menu-list-item",this.ul,true);if(t&&t.menuItemId){return this.items.get(t.menuItemId);}},onClick:function(e){var t;if(t=this.findTargetItem(e)){t.onClick(e);this.fireEvent("click",this,t,e);}},setActiveItem:function(A,B){if(A!=this.activeItem){if(this.activeItem){this.activeItem.deactivate();}
@@ -625,28 +687,40 @@ this.fireEvent("mouseout",this,e,t);},isVisible:function(){return this.el&&!this
 this.fireEvent("beforeshow",this);this.showAt(this.el.getAlignToXY(el,A||this.defaultAlign),B,false);},showAt:function(xy,A,_e){this.parentMenu=A;if(!this.el){this.render();}if(_e!==false){this.fireEvent("beforeshow",this);xy=this.el.adjustForConstraints(xy);}
 this.el.setXY(xy);this.el.show();this.hidden=false;this.focus();this.fireEvent("show",this);},focus:function(){if(!this.hidden){this.doFocus.defer(50,this);}},doFocus:function(){if(!this.hidden){this.focusEl.focus();}},hide:function(A){if(this.el&&this.isVisible()){this.fireEvent("beforehide",this);if(this.activeItem){this.activeItem.deactivate();this.activeItem=null;}
 this.el.hide();this.hidden=true;this.fireEvent("hide",this);}if(A===true&&this.parentMenu){this.parentMenu.hide(true);}},add:function(){var a=arguments,l=a.length,A;for(var i=0;i<l;i++){var el=a[i];if((typeof(el)=="object")&&el.xtype&&el.xns){el=Roo.factory(el,Roo.menu);}if(el.render){A=this.addItem(el);}else if(typeof el=="string"){if(el=="separator"||el=="-"){A=this.addSeparator();}else {A=this.addText(el);}}else if(el.tagName||el.el){A=this.addElement(el);}else if(typeof el=="object"){A=this.addMenuItem(el);}}return A;},getEl:function(){if(!this.el){this.render();}return this.el;},addSeparator:function(){return this.addItem(new Roo.menu.Separator());},addElement:function(el){return this.addItem(new Roo.menu.BaseItem(el));},addItem:function(A){this.items.add(A);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.appendChild(li);A.render(li,this);this.delayAutoWidth();}return A;},addMenuItem:function(A){if(!(A instanceof Roo.menu.Item)){if(typeof A.checked=="boolean"){A=new Roo.menu.CheckItem(A);}else {A=new Roo.menu.Item(A);}}return this.addItem(A);},addText:function(A){return this.addItem(new Roo.menu.TextItem({text:A}));},insert:function(A,B){this.items.insert(A,B);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.insertBefore(li,this.ul.dom.childNodes[A]);B.render(li,this);this.delayAutoWidth();}return B;},remove:function(A){this.items.removeKey(A.id);A.destroy();},removeAll:function(){var f;while(f=this.items.first()){this.remove(f);}}});Roo.menu.MenuNav=function(A){Roo.menu.MenuNav.superclass.constructor.call(this,A.el);this.scope=this.menu=A;};Roo.extend(Roo.menu.MenuNav,Roo.KeyNav,{doRelay:function(e,h){var k=e.getKey();if(!this.menu.activeItem&&e.isNavKeyPress()&&k!=e.SPACE&&k!=e.RETURN ){this.menu.tryActivate(0,1);return false;}return h.call(this.scope||this,e,this.menu);},up:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)-1,-1)){m.tryActivate(m.items.length-1,-1);}},down:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)+1,1)){m.tryActivate(0,1);}},right:function(e,m){if(m.activeItem){m.activeItem.expandMenu(true);}},left:function(e,m){m.hide();if(m.parentMenu&&m.parentMenu.activeItem){m.parentMenu.activeItem.activate();}},enter:function(e,m){if(m.activeItem){e.stopPropagation();m.activeItem.onClick(e);m.fireEvent("click",this,m.activeItem);return true;}}});
+//Roo/menu/MenuMgr.js
 Roo.menu.MenuMgr=function(){var A,B,C={},D=false,E=new Date();function init(){A={};B=new Roo.util.MixedCollection();Roo.get(document).addKeyListener(27,function(){if(B.length>0){hideAll();}});}function hideAll(){if(B&&B.length>0){var c=B.clone();c.each(function(m){m.hide();});}}function onHide(m){B.remove(m);if(B.length<1){Roo.get(document).un("mousedown",onMouseDown);D=false;}}function onShow(m){var F=B.last();E=new Date();B.add(m);if(!D){Roo.get(document).on("mousedown",onMouseDown);D=true;}if(m.parentMenu){m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"),10)+3);m.parentMenu.activeChild=m;}else if(F&&F.isVisible()){m.getEl().setZIndex(parseInt(F.getEl().getStyle("z-index"),10)+3);}}function onBeforeHide(m){if(m.activeChild){m.activeChild.hide();}if(m.autoHideTimer){clearTimeout(m.autoHideTimer);delete m.autoHideTimer;}}function onBeforeShow(m){var pm=m.parentMenu;if(!pm&&!m.allowOtherMenus){hideAll();}else if(pm&&pm.activeChild&&B!=m){pm.activeChild.hide();}}function onMouseDown(e){if(E.getElapsed()>50&&B.length>0&&!e.getTarget(".x-menu")){hideAll();}}function onBeforeCheck(mi,F){if(F){var g=C[mi.group];for(var i=0,l=g.length;i<l;i++){if(g[i]!=mi){g[i].setChecked(false);}}}}return {hideAll:function(){hideAll();},register:function(F){if(!A){init();}
 A[F.id]=F;F.on("beforehide",onBeforeHide);F.on("hide",onHide);F.on("beforeshow",onBeforeShow);F.on("show",onShow);var g=F.group;if(g&&F.events["checkchange"]){if(!C[g]){C[g]=[];}
 C[g].push(F);F.on("checkchange",onCheck);}},get:function(F){if(typeof F=="string"){return A[F];}else if(F.events){return F;}else if(typeof F.length=='number'){return new Roo.menu.Menu({items:F});}else {return new Roo.menu.Menu(F);}},unregister:function(F){delete A[F.id];F.un("beforehide",onBeforeHide);F.un("hide",onHide);F.un("beforeshow",onBeforeShow);F.un("show",onShow);var g=F.group;if(g&&F.events["checkchange"]){C[g].remove(F);F.un("checkchange",onCheck);}},registerCheckable:function(F){var g=F.group;if(g){if(!C[g]){C[g]=[];}
 C[g].push(F);F.on("beforecheckchange",onBeforeCheck);}},unregisterCheckable:function(F){var g=F.group;if(g){C[g].remove(F);F.un("beforecheckchange",onBeforeCheck);}}};}();
+//Roo/menu/BaseItem.js
 Roo.menu.BaseItem=function(A){Roo.menu.BaseItem.superclass.constructor.call(this,A);this.addEvents({click:true,activate:true,deactivate:true});if(this.handler){this.on("click",this.handler,this.scope,true);}};Roo.extend(Roo.menu.BaseItem,Roo.Component,{canActivate:false,activeClass:"x-menu-item-active",hideOnClick:true,hideDelay:100,ctype:"Roo.menu.BaseItem",actionMode:"container",render:function(A,B){this.parentMenu=B;Roo.menu.BaseItem.superclass.render.call(this,A);this.container.menuItemId=this.id;},onRender:function(A,B){this.el=Roo.get(this.el);A.dom.appendChild(this.el.dom);},onClick:function(e){if(!this.disabled&&this.fireEvent("click",this,e)!==false&&this.parentMenu.fireEvent("itemclick",this,e)!==false){this.handleClick(e);}else {e.stopEvent();}},activate:function(){if(this.disabled){return false;}var li=this.container;li.addClass(this.activeClass);this.region=li.getRegion().adjust(2,2,-2,-2);this.fireEvent("activate",this);return true;},deactivate:function(){this.container.removeClass(this.activeClass);this.fireEvent("deactivate",this);},shouldDeactivate:function(e){return !this.region||!this.region.contains(e.getPoint());},handleClick:function(e){if(this.hideOnClick){this.parentMenu.hide.defer(this.hideDelay,this.parentMenu,[true]);}},expandMenu:function(A){},hideMenu:function(){}});
+//Roo/menu/Adapter.js
 Roo.menu.Adapter=function(A,B){Roo.menu.Adapter.superclass.constructor.call(this,B);this.component=A;};Roo.extend(Roo.menu.Adapter,Roo.menu.BaseItem,{canActivate:true,onRender:function(A,B){this.component.render(A);this.el=this.component.getEl();},activate:function(){if(this.disabled){return false;}
 this.component.focus();this.fireEvent("activate",this);return true;},deactivate:function(){this.fireEvent("deactivate",this);},disable:function(){this.component.disable();Roo.menu.Adapter.superclass.disable.call(this);},enable:function(){this.component.enable();Roo.menu.Adapter.superclass.enable.call(this);}});
+//Roo/menu/TextItem.js
 Roo.menu.TextItem=function(A){if(typeof(A)=='string'){this.text=A;}else {Roo.apply(this,A);}
 Roo.menu.TextItem.superclass.constructor.call(this);};Roo.extend(Roo.menu.TextItem,Roo.menu.BaseItem,{text:'',hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML=this.text;this.el=s;Roo.menu.TextItem.superclass.onRender.apply(this,arguments);}});
+//Roo/menu/Separator.js
 Roo.menu.Separator=function(A){Roo.menu.Separator.superclass.constructor.call(this,A);};Roo.extend(Roo.menu.Separator,Roo.menu.BaseItem,{itemCls:"x-menu-sep",hideOnClick:false,onRender:function(li){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML="&#160;";this.el=s;li.addClass("x-menu-sep-li");Roo.menu.Separator.superclass.onRender.apply(this,arguments);}});
+//Roo/menu/Item.js
 Roo.menu.Item=function(A){Roo.menu.Item.superclass.constructor.call(this,A);if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);}};Roo.extend(Roo.menu.Item,Roo.menu.BaseItem,{text:'',html:'',icon:undefined,itemCls:"x-menu-item",canActivate:true,showDelay:200,hideDelay:200,ctype:"Roo.menu.Item",onRender:function(A,B){var el=document.createElement("a");el.hideFocus=true;el.unselectable="on";el.href=this.href||"#";if(this.hrefTarget){el.target=this.hrefTarget;}
 el.className=this.itemCls+(this.menu?" x-menu-item-arrow":"")+(this.cls?" "+this.cls:"");var C=this.html.length?this.html:String.format('{0}',this.text);el.innerHTML=String.format('<img src="{0}" class="x-menu-item-icon {1}" />'+C,this.icon||Roo.BLANK_IMAGE_URL,this.iconCls||'');this.el=el;Roo.menu.Item.superclass.onRender.call(this,A,B);},setText:function(A,B){if(B){this.html=A;}else {this.text=A;this.html='';}if(this.rendered){var C=this.html.length?this.html:String.format('{0}',this.text);this.el.update(String.format('<img src="{0}" class="x-menu-item-icon {2}">'+C,this.icon||Roo.BLANK_IMAGE_URL,this.text,this.iconCls||''));this.parentMenu.autoWidth();}},handleClick:function(e){if(!this.href){e.stopEvent();}
 Roo.menu.Item.superclass.handleClick.apply(this,arguments);},activate:function(A){if(Roo.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(A){this.expandMenu();}}return true;},shouldDeactivate:function(e){if(Roo.menu.Item.superclass.shouldDeactivate.call(this,e)){if(this.menu&&this.menu.isVisible()){return !this.menu.getEl().getRegion().contains(e.getPoint());}return true;}return false;},deactivate:function(){Roo.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu();},expandMenu:function(A){if(!this.disabled&&this.menu){clearTimeout(this.hideTimer);delete this.hideTimer;if(!this.menu.isVisible()&&!this.showTimer){this.showTimer=this.deferExpand.defer(this.showDelay,this,[A]);}else if(this.menu.isVisible()&&A){this.menu.tryActivate(0,1);}}},deferExpand:function(A){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(A){this.menu.tryActivate(0,1);}},hideMenu:function(){clearTimeout(this.showTimer);delete this.showTimer;if(!this.hideTimer&&this.menu&&this.menu.isVisible()){this.hideTimer=this.deferHide.defer(this.hideDelay,this);}},deferHide:function(){delete this.hideTimer;this.menu.hide();}});
+//Roo/menu/CheckItem.js
 Roo.menu.CheckItem=function(A){Roo.menu.CheckItem.superclass.constructor.call(this,A);this.addEvents({"beforecheckchange":true,"checkchange":true});if(this.checkHandler){this.on('checkchange',this.checkHandler,this.scope);}};Roo.extend(Roo.menu.CheckItem,Roo.menu.Item,{itemCls:"x-menu-item x-menu-check-item",groupClass:"x-menu-group-item",checked:false,ctype:"Roo.menu.CheckItem",onRender:function(c){Roo.menu.CheckItem.superclass.onRender.apply(this,arguments);if(this.group){this.el.addClass(this.groupClass);}
 Roo.menu.MenuMgr.registerCheckable(this);if(this.checked){this.checked=false;this.setChecked(true,true);}},destroy:function(){if(this.rendered){Roo.menu.MenuMgr.unregisterCheckable(this);}
 Roo.menu.CheckItem.superclass.destroy.apply(this,arguments);},setChecked:function(A,B){if(this.checked!=A&&this.fireEvent("beforecheckchange",this,A)!==false){if(this.container){this.container[A?"addClass":"removeClass"]("x-menu-item-checked");}
 this.checked=A;if(B!==true){this.fireEvent("checkchange",this,A);}}},handleClick:function(e){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked);}
 Roo.menu.CheckItem.superclass.handleClick.apply(this,arguments);}});
+//Roo/menu/DateItem.js
 Roo.menu.DateItem=function(A){Roo.menu.DateItem.superclass.constructor.call(this,new Roo.DatePicker(A),A);this.picker=this.component;this.addEvents({select:true});this.picker.on("render",function(B){B.getEl().swallowEvent("click");B.container.addClass("x-menu-date-item");});this.picker.on("select",this.onSelect,this);};Roo.extend(Roo.menu.DateItem,Roo.menu.Adapter,{onSelect:function(A,B){this.fireEvent("select",this,B,A);Roo.menu.DateItem.superclass.handleClick.call(this);}});
+//Roo/menu/ColorItem.js
 Roo.menu.ColorItem=function(A){Roo.menu.ColorItem.superclass.constructor.call(this,new Roo.ColorPalette(A),A);this.palette=this.component;this.relayEvents(this.palette,["select"]);if(this.selectHandler){this.on('select',this.selectHandler,this.scope);}};Roo.extend(Roo.menu.ColorItem,Roo.menu.Adapter);
+//Roo/menu/DateMenu.js
 Roo.menu.DateMenu=function(A){Roo.menu.DateMenu.superclass.constructor.call(this,A);this.plain=true;var di=new Roo.menu.DateItem(A);this.add(di);this.picker=di.picker;this.relayEvents(di,["select"]);this.on('beforeshow',function(){if(this.picker){this.picker.hideMonthPicker(true);}},this);};Roo.extend(Roo.menu.DateMenu,Roo.menu.Menu,{cls:'x-date-menu'});
+//Roo/menu/ColorMenu.js
 Roo.menu.ColorMenu=function(A){Roo.menu.ColorMenu.superclass.constructor.call(this,A);this.plain=true;var ci=new Roo.menu.ColorItem(A);this.add(ci);this.palette=ci.palette;this.relayEvents(ci,["select"]);};Roo.extend(Roo.menu.ColorMenu,Roo.menu.Menu);
+//Roo/form/Field.js
 Roo.form.Field=function(A){Roo.form.Field.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Field,Roo.BoxComponent,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},fieldClass:"x-form-field",msgTarget:'qtip',msgFx:'normal',readOnly:false,disabled:false,inputType:undefined,tabIndex:undefined,isFormField:true,hasFocus:false,value:undefined,initComponent:function(){Roo.form.Field.superclass.initComponent.call(this);this.addEvents({focus:true,blur:true,specialkey:true,change:true,invalid:true,valid:true,keyup:true});},getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');},onRender:function(ct,A){Roo.form.Field.superclass.onRender.call(this,ct,A);if(!this.el){var B=this.getAutoCreate();if(!B.name){B.name=this.name||this.id;}if(this.inputType){B.type=this.inputType;}
 this.el=ct.createChild(B,A);}var C=this.el.dom.type;if(C){if(C=='password'){C='text';}
 this.el.addClass('x-form-'+C);}if(this.readOnly){this.el.dom.readOnly=true;}if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);}
@@ -659,27 +733,34 @@ this.alignErrorIcon();this.errorIcon.dom.qtip=A;this.errorIcon.dom.qclass='x-for
 this.fireEvent('invalid',this,A);},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,'tl-tr',[2,0]);},clearInvalid:function(){if(!this.rendered||this.preventMark){return;}
 this.el.removeClass(this.invalidClass);switch(this.msgTarget){case 'qtip':this.el.dom.qtip='';break;case 'title':this.el.dom.title='';break;case 'under':if(this.errorEl){Roo.form.Field.msgFx[this.msgFx].hide(this.errorEl,this);}break;case 'side':if(this.errorIcon){this.errorIcon.dom.qtip='';this.errorIcon.hide();this.un('resize',this.alignErrorIcon,this);}break;default:var t=Roo.getDom(this.msgTarget);t.innerHTML='';t.style.display='none';break;}
 this.fireEvent('valid',this);},getRawValue:function(){var v=this.el.getValue();if(v===this.emptyText){v='';}return v;},getValue:function(){var v=this.el.getValue();if(v===this.emptyText||v===undefined){v='';}return v;},setRawValue:function(v){return this.el.dom.value=(v===null||v===undefined?'':v);},setValue:function(v){this.value=v;if(this.rendered){this.el.dom.value=(v===null||v===undefined?'':v);this.validate();}},adjustSize:function(w,h){var s=Roo.form.Field.superclass.adjustSize.call(this,w,h);s.width=this.adjustWidth(this.el.dom.tagName,s.width);return s;},adjustWidth:function(A,w){A=A.toLowerCase();if(typeof w=='number'&&Roo.isStrict&&!Roo.isSafari){if(Roo.isIE&&(A=='input'||A=='textarea')){if(A=='input'){return w+2;}if(A='textarea'){return w-2;}}else if(Roo.isOpera){if(A=='input'){return w+2;}if(A='textarea'){return w-2;}}}return w;}});Roo.form.Field.msgFx={normal:{show:function(A,f){A.setDisplayed('block');},hide:function(A,f){A.setDisplayed(false).update('');}},slide:{show:function(A,f){A.slideIn('t',{stopFx:true});},hide:function(A,f){A.slideOut('t',{stopFx:true,useDisplay:true});}},slideRight:{show:function(A,f){A.fixDisplay();A.alignTo(f.el,'tl-tr');A.slideIn('l',{stopFx:true});},hide:function(A,f){A.slideOut('l',{stopFx:true,useDisplay:true});}}};
+//Roo/form/TextField.js
 Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(this,A);this.addEvents({autosize:true});};Roo.extend(Roo.form.TextField,Roo.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,emptyClass:'x-form-empty-field',initEvents:function(){Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay});}if(this.selectOnFocus||this.emptyText){this.on("focus",this.preFocus,this);if(this.emptyText){this.on('blur',this.postBlur,this);this.applyEmptyText();}}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this);}if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,'');if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},reset:function(){Roo.form.TextField.superclass.reset.call(this);this.applyEmptyText();},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass);}},preFocus:function(){if(this.emptyText){if(this.el.dom.value==this.emptyText){this.setRawValue('');}
 this.el.removeClass(this.emptyClass);}if(this.selectOnFocus){this.el.dom.select();}},postBlur:function(){this.applyEmptyText();},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE &&e.button==-1))){return;}var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){if(this.emptyText&&this.el&&v!==undefined&&v!==null&&v!==''){this.el.removeClass(this.emptyClass);}
 Roo.form.TextField.superclass.setValue.apply(this,arguments);this.applyEmptyText();this.autoSize();},validateValue:function(A){if(A.length<1||A===this.emptyText){if(this.allowBlank){this.clearInvalid();return true;}else {this.markInvalid(this.blankText);return false;}}if(A.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false;}if(A.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false;}if(this.vtype){var vt=Roo.form.VTypes;if(!vt[this.vtype](A,this)){this.markInvalid(this.vtypeText||vt[this.vtype+'Text']);return false;}}if(typeof this.validator=="function"){var B=this.validator(A);if(B!==true){this.markInvalid(B);return false;}}if(this.regex&&!this.regex.test(A)){this.markInvalid(this.regexText);return false;}return true;},selectText:function(A,B){var v=this.getRawValue();if(v.length>0){A=A===undefined?0:A;B=B===undefined?v.length:B;var d=this.el.dom;if(d.setSelectionRange){d.setSelectionRange(A,B);}else if(d.createTextRange){var C=d.createTextRange();C.moveStart("character",A);C.moveEnd("character",v.length-B);C.select();}}},autoSize:function(){if(!this.grow||!this.rendered){return;}if(!this.metrics){this.metrics=Roo.util.TextMetrics.createInstance(this.el);}var el=this.el;var v=el.dom.value;var d=document.createElement('div');d.appendChild(document.createTextNode(v));v=d.innerHTML;d=null;v+="&#160;";var w=Math.min(this.growMax,Math.max(this.metrics.getWidth(v)+10,this.growMin));this.el.setWidth(w);this.fireEvent("autosize",this,w);}});
+//Roo/form/Hidden.js
 Roo.form.Hidden=function(A){Roo.form.Hidden.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Hidden,Roo.form.TextField,{fieldLabel:'',inputType:'hidden',width:50,allowBlank:true,labelSeparator:'',hidden:true,itemCls:'x-form-item-display-none'});
+//Roo/form/TriggerField.js
 Roo.form.TriggerField=function(A){this.mimicing=false;Roo.form.TriggerField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.TriggerField,Roo.form.TextField,{defaultAutoCreate:{tag:"input",type:"text",size:"16",autocomplete:"off"},hideTrigger:false,autoSize:Roo.emptyFn,monitorTab:true,deferHeight:true,actionMode:'wrap',onResize:function(w,h){Roo.form.TriggerField.superclass.onResize.apply(this,arguments);if(typeof w=='number'){var x=w-this.trigger.getWidth();this.el.setWidth(this.adjustWidth('input',x));this.trigger.setStyle('left',x+'px');}},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,'tl-tr',[2,0]);},onRender:function(ct,A){Roo.form.TriggerField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:"x-form-field-wrap"});this.trigger=this.wrap.createChild(this.triggerConfig||{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});if(this.hideTrigger){this.trigger.setDisplayed(false);}
 this.initTrigger();if(!this.width){this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());}},initTrigger:function(){this.trigger.on("click",this.onTriggerClick,this,{preventDefault:true});this.trigger.addClassOnOver('x-form-trigger-over');this.trigger.addClassOnClick('x-form-trigger-click');},onDestroy:function(){if(this.trigger){this.trigger.removeAllListeners();this.trigger.remove();}if(this.wrap){this.wrap.remove();}
 Roo.form.TriggerField.superclass.onDestroy.call(this);},onFocus:function(){Roo.form.TriggerField.superclass.onFocus.call(this);if(!this.mimicing){this.wrap.addClass('x-trigger-wrap-focus');this.mimicing=true;Roo.get(Roo.isIE?document.body:document).on("mousedown",this.mimicBlur,this);if(this.monitorTab){this.el.on("keydown",this.checkTab,this);}}},checkTab:function(e){if(e.getKey()==e.TAB){this.triggerBlur();}},onBlur:function(){},mimicBlur:function(e,t){if(!this.wrap.contains(t)&&this.validateBlur()){this.triggerBlur();}},triggerBlur:function(){this.mimicing=false;Roo.get(Roo.isIE?document.body:document).un("mousedown",this.mimicBlur);if(this.monitorTab){this.el.un("keydown",this.checkTab,this);}
 this.wrap.removeClass('x-trigger-wrap-focus');Roo.form.TriggerField.superclass.onBlur.call(this);},validateBlur:function(e,t){return true;},onDisable:function(){Roo.form.TriggerField.superclass.onDisable.call(this);if(this.wrap){this.wrap.addClass('x-item-disabled');}},onEnable:function(){Roo.form.TriggerField.superclass.onEnable.call(this);if(this.wrap){this.wrap.removeClass('x-item-disabled');}},onShow:function(){var ae=this.getActionEl();if(ae){ae.dom.style.display='';ae.dom.style.visibility='visible';}},onHide:function(){var ae=this.getActionEl();ae.dom.style.display='none';},onTriggerClick:Roo.emptyFn});Roo.form.TwinTriggerField=Roo.extend(Roo.form.TriggerField,{initComponent:function(){Roo.form.TwinTriggerField.superclass.initComponent.call(this);this.triggerConfig={tag:'span',cls:'x-form-twin-triggers',cn:[{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]};},getTrigger:function(A){return this.triggers[A];},initTrigger:function(){var ts=this.trigger.select('.x-form-trigger',true);this.wrap.setStyle('overflow','hidden');var A=this;ts.each(function(t,B,C){t.hide=function(){var w=A.wrap.getWidth();this.dom.style.display='none';A.el.setWidth(w-A.trigger.getWidth());};t.show=function(){var w=A.wrap.getWidth();this.dom.style.display='';A.el.setWidth(w-A.trigger.getWidth());};var D='Trigger'+(C+1);if(this['hide'+D]){t.dom.style.display='none';}
 t.on("click",this['on'+D+'Click'],this,{preventDefault:true});t.addClassOnOver('x-form-trigger-over');t.addClassOnClick('x-form-trigger-click');},this);this.triggers=ts.elements;},onTrigger1Click:Roo.emptyFn,onTrigger2Click:Roo.emptyFn});
+//Roo/form/TextArea.js
 Roo.form.TextArea=function(A){Roo.form.TextArea.superclass.constructor.call(this,A);if(this.minHeight!==undefined){this.growMin=this.minHeight;}if(this.maxHeight!==undefined){this.growMax=this.maxHeight;}};Roo.extend(Roo.form.TextArea,Roo.form.TextField,{growMin:60,growMax:1000,preventScrollbars:false,onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"off"};}
 Roo.form.TextArea.superclass.onRender.call(this,ct,A);if(this.grow){this.textSizeEl=Roo.DomHelper.append(document.body,{tag:"pre",cls:"x-form-grow-sizer"});if(this.preventScrollbars){this.el.setStyle("overflow","hidden");}
 this.el.setHeight(this.growMin);}},onDestroy:function(){if(this.textSizeEl){this.textSizeEl.parentNode.removeChild(this.textSizeEl);}
 Roo.form.TextArea.superclass.onDestroy.call(this);},onKeyUp:function(e){if(!e.isNavKeyPress()||e.getKey()==e.ENTER){this.autoSize();}},autoSize:function(){if(!this.grow||!this.textSizeEl){return;}var el=this.el;var v=el.dom.value;var ts=this.textSizeEl;ts.innerHTML='';ts.appendChild(document.createTextNode(v));v=ts.innerHTML;Roo.fly(ts).setWidth(this.el.getWidth());if(v.length<1){v="&#160;&#160;";}else {if(Roo.isIE){v=v.replace(/\n/g,'<p>&#160;</p>');}
 v+="&#160;\n&#160;";}
 ts.innerHTML=v;var h=Math.min(this.growMax,Math.max(ts.offsetHeight,this.growMin));if(h!=this.lastHeight){this.lastHeight=h;this.el.setHeight(h);this.fireEvent("autosize",this,h);}}});
+//Roo/form/NumberField.js
 Roo.form.NumberField=function(A){Roo.form.NumberField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.NumberField,Roo.form.TextField,{fieldClass:"x-form-field x-form-num-field",allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",initEvents:function(){Roo.form.NumberField.superclass.initEvents.call(this);var A="0123456789";if(this.allowDecimals){A+=this.decimalSeparator;}if(this.allowNegative){A+="-";}
 this.stripCharsRe=new RegExp('[^'+A+']','gi');var B=function(e){var k=e.getKey();if(!Roo.isIE&&(e.isSpecialKey()||k==e.BACKSPACE||k==e.DELETE )){return;}var c=e.getCharCode();if(A.indexOf(String.fromCharCode(c))===-1){e.stopEvent();}};this.el.on("keypress",B,this);},validateValue:function(A){if(!Roo.form.NumberField.superclass.validateValue.call(this,A)){return false;}if(A.length<1){return true;}var B=this.parseValue(A);if(isNaN(B)){this.markInvalid(String.format(this.nanText,A));return false;}if(B<this.minValue){this.markInvalid(String.format(this.minText,this.minValue));return false;}if(B>this.maxValue){this.markInvalid(String.format(this.maxText,this.maxValue));return false;}return true;},getValue:function(){return this.fixPrecision(this.parseValue(Roo.form.NumberField.superclass.getValue.call(this)));},parseValue:function(A){A=parseFloat(String(A).replace(this.decimalSeparator,"."));return isNaN(A)?'':A;},fixPrecision:function(A){var B=isNaN(A);if(!this.allowDecimals||this.decimalPrecision==-1||B||!A){return B?'':A;}return parseFloat(A).toFixed(this.decimalPrecision);},setValue:function(v){v=this.fixPrecision(v);Roo.form.NumberField.superclass.setValue.call(this,String(v).replace(".",this.decimalSeparator));},decimalPrecisionFcn:function(v){return Math.floor(v);},beforeBlur:function(){var v=this.parseValue(this.getRawValue());if(v){this.setValue(v);}}});
+//Roo/form/DateField.js
 Roo.form.DateField=function(A){Roo.form.DateField.superclass.constructor.call(this,A);this.addEvents({'select':true});if(typeof this.minValue=="string")this.minValue=this.parseDate(this.minValue);if(typeof this.maxValue=="string")this.maxValue=this.parseDate(this.maxValue);this.ddMatch=null;if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|";}
 this.ddMatch=new RegExp(re+")");}};Roo.extend(Roo.form.DateField,Roo.form.TriggerField,{format:"m/d/y",altFormats:"m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d",disabledDays:null,disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:'x-form-date-trigger',useIso:false,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},hiddenField:false,onRender:function(ct,A){Roo.form.DateField.superclass.onRender.call(this,ct,A);if(this.useIso){this.el.dom.removeAttribute('name');this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.name},'before',true);this.hiddenField.value=this.formatDate(this.value,'Y-m-d');this.hiddenName=this.name;}},validateValue:function(A){A=this.formatDate(A);if(!Roo.form.DateField.superclass.validateValue.call(this,A)){return false;}if(A.length<1){return true;}var B=A;A=this.parseDate(A);if(!A){this.markInvalid(String.format(this.invalidText,B,this.format));return false;}var C=A.getTime();if(this.minValue&&C<this.minValue.getTime()){this.markInvalid(String.format(this.minText,this.formatDate(this.minValue)));return false;}if(this.maxValue&&C>this.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false;}if(this.disabledDays){var D=A.getDay();for(var i=0;i<this.disabledDays.length;i++){if(D===this.disabledDays[i]){this.markInvalid(this.disabledDaysText);return false;}}}var E=this.formatDate(A);if(this.ddMatch&&this.ddMatch.test(E)){this.markInvalid(String.format(this.disabledDatesText,E));return false;}return true;},validateBlur:function(){return !this.menu||!this.menu.isVisible();},getValue:function(){return this.hiddenField?this.hiddenField.value:this.parseDate(Roo.form.DateField.superclass.getValue.call(this))||"";},setValue:function(A){if(this.hiddenField){this.hiddenField.value=this.formatDate(this.parseDate(A),'Y-m-d');}
 Roo.form.DateField.superclass.setValue.call(this,this.formatDate(this.parseDate(A)));},parseDate:function(A){if(!A||A instanceof Date){return A;}var v=Date.parseDate(A,this.format);if(!v&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|");}for(var i=0,B=this.altFormatsArray.length;i<B&&!v;i++){v=Date.parseDate(A,this.altFormatsArray[i]);}}return v;},formatDate:function(A,B){return (!A||!(A instanceof Date))?A:A.dateFormat(B||this.format);},menuListeners:{select:function(m,d){this.setValue(d);this.fireEvent('select',this,d);},show:function(){this.onFocus();},hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);this.menu.un("hide",ml.hide,this);}},onTriggerClick:function(){if(this.disabled){return;}if(this.menu==null){this.menu=new Roo.menu.DateMenu();}
 Roo.apply(this.menu.picker,{showClear:this.allowBlank,minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.format,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))});this.menu.on(Roo.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?");},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v);}}});
+//Roo/form/ComboBox.js
 Roo.form.ComboBox=function(A){Roo.form.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true});if(this.transform){this.allowDomMove=false;var s=Roo.getDom(this.transform);if(!this.hiddenName){this.hiddenName=s.name;}if(!this.store){this.mode='local';var d=[],B=s.options;for(var i=0,C=B.length;i<C;i++){var o=B[i];var D=(Roo.isIE?o.getAttributeNode('value').specified:o.hasAttribute('value'))?o.value:o.text;if(o.selected){this.value=D;}
 d.push([D,o.text]);}
 this.store=new Roo.data.SimpleStore({'id':0,fields:['value','text'],data:d});this.valueField='value';this.displayField='text';}
@@ -704,13 +785,16 @@ this.fireEvent('expand',this);},onTriggerClick:function(){if(this.disabled){retu
 this.store.each(function(v){if(C){if(C.id==v.id){C=false;}return;}if(v.get(this.displayField)&&v.get(this.displayField).substring(0,1).toUpperCase()==k){A=this.store.indexOf(v);return false;}},this);if(A===false){return true;}
 this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0])
 sn.scrollIntoView(sn.dom.parentNode,false);}});
+//Roo/form/Checkbox.js
 Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},boxLabel:"",inputValue:'1',valueOff:'0',actionMode:'viewEl',itemCls:'x-menu-check-item x-form-item',groupClass:'x-menu-group-item',inputType:'hidden',inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-menu-check-item '});var B=this.wrap.createChild({tag:'img',cls:'x-menu-item-icon',style:'margin: 0px;',src:Roo.BLANK_IMAGE_URL});this.viewEl=B;this.wrap.on('click',this.onClick,this);this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel});}
 this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;}return this.valueOff;},onClick:function(){this.setChecked(!this.checked);},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);},setChecked:function(A,B){if(this.inSetChecked){this.checked=A;return;}if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked');}
 this.checked=A;if(B!==true){this.fireEvent('check',this,A);}
 this.inSetChecked=true;this.el.dom.value=A?this.inputValue:this.valueOff;this.inSetChecked=false;},setFromHidden:function(){if(!this.el){return;}
 this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}
 Roo.form.Checkbox.superclass.onDestroy.call(this);}});
+//Roo/form/Radio.js
 Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value;}});
+//Roo/form/HtmlEditor.js
 Roo.form.HtmlEditor=Roo.extend(Roo.form.Field,{toolbars:false,createLinkText:'Please enter the URL for the link:',defaultLinkValue:'http:/'+'/',resizable:false,height:300,width:500,stylesheets:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',defaultAutoCreate:{tag:"textarea",style:"width:500px;height:300px;",autocomplete:"off"},initComponent:function(){this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editmodechange:true,editorevent:true});this.defaultAutoCreate={tag:"textarea",style:'width: '+this.width+'px;height: '+this.height+'px;',autocomplete:"off"};},createToolbar:function(A){if(!A.toolbars||!A.toolbars.length){A.toolbars=[new Roo.form.HtmlEditor.ToolbarStandard()];}for(var i=0;i<A.toolbars.length;i++){A.toolbars[i]=Roo.factory(A.toolbars[i],Roo.form.HtmlEditor);A.toolbars[i].init(A);}},getDocMarkup:function(){var st='';if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(A){st+=A.dom.outerHTML||new XMLSerializer().serializeToString(A.dom);});Roo.get(document.head).select('link').each(function(A){st+=A.dom.outerHTML||new XMLSerializer().serializeToString(A.dom);});}else if(!this.stylesheets.length){st='<style type="text/css">'+'body{border:0;margin:0;padding:3px;height:98%;cursor:text;}'+'</style>';}else {Roo.each(this.stylesheets,function(s){st+='<link rel="stylesheet" type="text/css" href="'+s+'" />'});}return '<html><head>'+st+' </head><body></body></html>';},onRender:function(ct,A){var _t=this;Roo.form.HtmlEditor.superclass.onRender.call(this,ct,A);this.el.dom.style.border='0 none';this.el.dom.setAttribute('tabIndex',-1);this.el.addClass('x-hidden');if(Roo.isIE){this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')}
 this.wrap=this.el.wrap({cls:'x-html-editor-wrap',cn:{cls:'x-html-editor-tb'}});if(this.resizable){this.resizeEl=new Roo.Resizable(this.wrap,{pinned:true,wrap:true,dynamic:true,minHeight:this.height,height:this.height,handles:this.resizable,width:this.width,listeners:{resize:function(r,w,h){_t.onResize(w,h);}}});}
 this.frameId=Roo.id();this.createToolbar(this);var B=this.wrap.createChild({tag:'iframe',id:this.frameId,name:this.frameId,frameBorder:'no','src':Roo.SSL_SECURE_URL?Roo.SSL_SECURE_URL:"javascript:false"},this.el);this.iframe=B.dom;this.assignDocWin();this.doc.designMode='on';this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var C={run:function(){this.assignDocWin();if(this.doc.body||this.doc.readyState=='complete'){try{this.doc.designMode="on";}catch(e){return;}
@@ -729,6 +813,7 @@ A.collapse(true);C.collapse(true);var ss=A.compareBoundaryPoints(Range.START_TO_
 A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)){return;}
 Roo.log("(REMOVE)"+A.tagName+'.'+n+'='+v);A.removeAttribute(n);}function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var C=v.split(/;/);Roo.each(C,function(p){p=p.replace(/\s+/g,'');if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');if(Roo.form.HtmlEditor.cwhite.indexOf(l)<0){Roo.log('(REMOVE)'+A.tagName+'.'+n+':'+l+'='+v);A.removeAttribute(n);return false;}return true;});}for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(Roo.form.HtmlEditor.ablack.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);return;}if(Roo.form.HtmlEditor.aclean.indexOf(a.name.toLowerCase())>-1){cleanAttr(a.name,a.value);return;}if(a.name=='style'){cleanStyle(a.name,a.value);}if(a.name=='class'){if(a.value.match(/^Mso/)){A.className='';}if(a.value.match(/body/)){A.className='';}}}
 this.cleanUpChildren(A);}});Roo.form.HtmlEditor.white=['area','br','img','input','hr','wbr','address','blockquote','center','dd','dir','div','dl','dt','h1','h2','h3','h4','h5','h6','hr','isindex','listing','marquee','menu','multicol','ol','p','plaintext','pre','table','ul','xmp','caption','col','colgroup','tbody','td','tfoot','th','thead','tr','dir','menu','ol','ul','dl','embed','object'];Roo.form.HtmlEditor.black=['applet','base','basefont','bgsound','blink','body','frame','frameset','head','html','ilayer','iframe','layer','link','meta','object','script','style','title','xml'];Roo.form.HtmlEditor.clean=['script','style','title','xml'];Roo.form.HtmlEditor.remove=['font'];Roo.form.HtmlEditor.ablack=['on'];Roo.form.HtmlEditor.aclean=['action','background','codebase','dynsrc','href','lowsrc'];Roo.form.HtmlEditor.pwhite=['http','https','mailto'];Roo.form.HtmlEditor.cwhite=['text-align','font-size'];Roo.form.HtmlEditor.swapCodes=[[8211,"--"],[8212,"--"],[8216,"'"],[8217,"'"],[8220,'"'],[8221,'"'],[8226,"*"],[8230,"..."]];
+//Roo/form/HtmlEditor/ToolbarStandard.js
 Roo.form.HtmlEditor.ToolbarStandard=function(A){Roo.apply(this,A);this.disable=this.disable||{};Roo.applyIf(this.disable,{fontSize:true,colors:true,specialElements:true});}
 Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype,{tb:false,rendered:false,editor:false,disable:false,fontFamilies:['Arial','Courier New','Tahoma','Times New Roman','Verdana'],specialChars:["&#169;","&#174;","&#8482;","&#163;","&#8230;","&#247;","&#8364;","&#176;"],specialElements:[{text:"Insert Table",xtype:'MenuItem',xns:Roo.Menu,ihtml:'<table><tr><td>Cell</td></tr></table>'},{text:"Insert Image",xtype:'MenuItem',xns:Roo.Menu,ihtml:'<img src="about:blank"/>'}],inputElements:["form","input:text","input:hidden","input:checkbox","input:radio","input:password","input:submit","input:button","select","textarea","label"],formats:[["p"],["h1"],["h2"],["h3"],["h4"],["h5"],["h6"],["pre"],["code"],["abbr"],["acronym"],["address"],["cite"],["samp"],["var"]],defaultFont:'tahoma',fontSelect:false,formatCombo:false,init:function(A){this.editor=A;var B=A.frameId;var C=this;function btn(id,F,G){var H=B+'-'+id;return {id:H,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:F!==false,scope:A,handler:G||A.relayBtnCmd,clickEvent:'mousedown',tooltip:C.buttonTips[id]||undefined,tabIndex:-1};}var tb=new Roo.Toolbar(A.wrap.dom.firstChild);this.tb=tb;tb.el.on('click',function(e){e.preventDefault();});if(!this.disable.font&&!Roo.isSafari){};if(!this.disable.formats){this.formatCombo=new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'tag',fields:['tag'],data:this.formats}),blockFocus:true,displayField:'tag',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Add tag',selectOnFocus:true,width:135,listeners:{'select':function(c,r,i){A.insertTag(r.get('tag'));A.focus();}}});tb.addField(this.formatCombo);}if(!this.disable.format){tb.add(btn('bold'),btn('italic'),btn('underline'));};if(!this.disable.fontSize){tb.add('-',btn('increasefontsize',false,A.adjustFont),btn('decreasefontsize',false,A.adjustFont));};if(!this.disable.colors){tb.add('-',{id:A.frameId+'-forecolor',cls:'x-btn-icon x-edit-forecolor',clickEvent:'mousedown',tooltip:this.buttonTips['forecolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({allowReselect:true,focus:Roo.emptyFn,value:'000000',plain:true,selectHandler:function(cp,F){A.execCmd('forecolor',Roo.isSafari||Roo.isIE?'#'+F:F);A.deferFocus();},scope:A,clickEvent:'mousedown'})},{id:A.frameId+'backcolor',cls:'x-btn-icon x-edit-backcolor',clickEvent:'mousedown',tooltip:this.buttonTips['backcolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({focus:Roo.emptyFn,value:'FFFFFF',plain:true,allowReselect:true,selectHandler:function(cp,F){if(Roo.isGecko){A.execCmd('useCSS',false);A.execCmd('hilitecolor',F);A.execCmd('useCSS',true);A.deferFocus();}else {A.execCmd(Roo.isOpera?'hilitecolor':'backcolor',Roo.isSafari||Roo.isIE?'#'+F:F);A.deferFocus();}},scope:A,clickEvent:'mousedown'})});};if(!this.disable.alignments){tb.add('-',btn('justifyleft'),btn('justifycenter'),btn('justifyright'));};if(!this.disable.links){tb.add('-',btn('createlink',false,A.createLink));};if(!this.disable.lists){tb.add('-',btn('insertorderedlist'),btn('insertunorderedlist'));}if(!this.disable.sourceEdit){tb.add('-',btn('sourceedit',true,function(F){this.toggleSourceEdit(F.pressed);}));}var D={};if(!this.disable.special){D={text:"&#169;",cls:'x-edit-none',menu:{items:[]}};for(var i=0;i<this.specialChars.length;i++){D.menu.items.push({html:this.specialChars[i],handler:function(a,b){A.insertAtCursor(String.fromCharCode(a.html.replace('&#','').replace(';','')));},tabIndex:-1});}
 tb.add(D);}if(!this.disable.specialElements){var E={text:"Other;",cls:'x-edit-none',menu:{items:[]}};for(var i=0;i<this.specialElements.length;i++){E.menu.items.push(Roo.apply({handler:function(a,b){A.insertAtCursor(this.ihtml);}},this.specialElements[i]));}
@@ -738,6 +823,7 @@ Roo.menu.MenuMgr.hideAll();},createFontOptions:function(){var A=[],fs=this.fontF
 this.sourceEditMode=A===true;var B=this.tb.items.get(this.editor.frameId+'-sourceedit');if(B.pressed!==this.editor.sourceEditMode){B.toggle(this.editor.sourceEditMode);return;}if(this.sourceEditMode){this.tb.items.each(function(C){if(C.cmd!='sourceedit'){C.disable();}});}else {if(this.initialized){this.tb.items.each(function(C){C.enable();});}}
 this.editor.toggleSourceEdit(A);},buttonTips:{bold:{title:'Bold (Ctrl+B)',text:'Make the selected text bold.',cls:'x-html-editor-tip'},italic:{title:'Italic (Ctrl+I)',text:'Make the selected text italic.',cls:'x-html-editor-tip'},underline:{title:'Underline (Ctrl+U)',text:'Underline the selected text.',cls:'x-html-editor-tip'},increasefontsize:{title:'Grow Text',text:'Increase the font size.',cls:'x-html-editor-tip'},decreasefontsize:{title:'Shrink Text',text:'Decrease the font size.',cls:'x-html-editor-tip'},backcolor:{title:'Text Highlight Color',text:'Change the background color of the selected text.',cls:'x-html-editor-tip'},forecolor:{title:'Font Color',text:'Change the color of the selected text.',cls:'x-html-editor-tip'},justifyleft:{title:'Align Text Left',text:'Align text to the left.',cls:'x-html-editor-tip'},justifycenter:{title:'Center Text',text:'Center text in the editor.',cls:'x-html-editor-tip'},justifyright:{title:'Align Text Right',text:'Align text to the right.',cls:'x-html-editor-tip'},insertunorderedlist:{title:'Bullet List',text:'Start a bulleted list.',cls:'x-html-editor-tip'},insertorderedlist:{title:'Numbered List',text:'Start a numbered list.',cls:'x-html-editor-tip'},createlink:{title:'Hyperlink',text:'Make the selected text a hyperlink.',cls:'x-html-editor-tip'},sourceedit:{title:'Source Edit',text:'Switch to source editing mode.',cls:'x-html-editor-tip'}},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();if(A.menu.el){A.menu.el.destroy();}}
 A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});}});
+//Roo/form/HtmlEditor/ToolbarContext.js
 Roo.form.HtmlEditor.ToolbarContext=function(A){Roo.apply(this,A);this.styles=this.styles||{};}
 Roo.form.HtmlEditor.ToolbarContext.types={'IMG':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["right"],["center"],["top"]],width:80},border:{title:"Border",width:40},alt:{title:"Alt",width:120},src:{title:"Src",width:220}},'A':{name:{title:"Name",width:50},href:{title:"Href",width:220}},'TABLE':{rows:{title:"Rows",width:20},cols:{title:"Cols",width:20},width:{title:"Width",width:40},height:{title:"Height",width:40},border:{title:"Border",width:20}},'TD':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["center"],["right"],["justify"],["char"]],width:80},valign:{title:"Valign",opts:[[""],["top"],["middle"],["bottom"],["baseline"]],width:80},colspan:{title:"Colspan",width:20}},'INPUT':{name:{title:"name",width:120},value:{title:"Value",width:120},width:{title:"Width",width:40}},'LABEL':{'for':{title:"For",width:120}},'TEXTAREA':{name:{title:"name",width:120},rows:{title:"Rows",width:20},cols:{title:"Cols",width:20}},'SELECT':{name:{title:"name",width:120},selectoptions:{title:"Options",width:200}},'BODY':{title:{title:"title",width:200,disabled:true}},'*':{}};Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,{tb:false,rendered:false,editor:false,disable:false,styles:false,toolbars:false,init:function(A){this.editor=A;var B=A.frameId;var C=this;function btn(id,E,F){var G=B+'-'+id;return {id:G,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:E!==false,scope:A,handler:F||A.relayBtnCmd,clickEvent:'mousedown',tooltip:C.buttonTips[id]||undefined,tabIndex:-1};}var D=A.wrap.createChild({tag:'div'},A.wrap.dom.firstChild.nextSibling,true);var ty=Roo.form.HtmlEditor.ToolbarContext.types;this.toolbars={};for(var i in ty){this.toolbars[i]=this.buildToolbar(ty[i],i);}
 this.tb=this.toolbars.BODY;this.tb.el.show();this.buildFooter();this.footer.show();this.rendered=true;A.on('editorevent',this.updateToolbar,this);},updateToolbar:function(A,B,C){if(!this.editor.activated){this.editor.onFirstFocus();return;}var D=C?false:true;var E=this.editor.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;if(!C){C=E.length?(E[0]?E[0]:E[1]):this.editor.doc.body;C=C?C:this.editor.doc.body;C=C.tagName.length?C:this.editor.doc.body;}var tn=C.tagName.toUpperCase();tn=C.tagName.toUpperCase();var F=this.tb.selectedNode
@@ -747,6 +833,7 @@ H+=H.length?' &gt; ':'';H+='<span class="x-ed-loc-'+i+'">'+a.tagName+'</span>';}
 A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});},buildToolbar:function(A,nm){var B=this.editor;var C=B.wrap.createChild({tag:'div'},B.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(C);tb.add(nm+":&nbsp;");if(this.styles){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val','selected'],data:[]}),name:'className',displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select Style',selectOnFocus:true,width:130,listeners:{'select':function(c,r,i){tb.selectedNode.className=r?r.get('val'):'';}}}));}for(var i in A){var D=A[i];tb.add(D.title+":&nbsp;");if(D.opts){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val'],data:D.opts}),name:i,displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:D.width?D.width:130,listeners:{'select':function(c,r,i){tb.selectedNode.setAttribute(c.name,r.get('val'));}}}));continue;tb.addField(new Roo.form.TextField({name:i,width:100,value:''}));continue;}
 tb.addField(new Roo.form.TextField({name:i,width:D.width,value:'',listeners:{'change':function(f,nv,ov){tb.selectedNode.setAttribute(f.name,nv);}}}));}
 tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();tb.name=nm;return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}});this.footer.add(B);this.footer.add({text:'&gt;',xtype:'Button',handler:function(){_t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);}});var A=Roo.get(B.el);A.addClass('x-editor-context');this.footDispWrap=A;this.footDispWrap.overflow='hidden';this.footDisp=A.createChild();this.footDispWrap.on('click',this.onContextClick,this)},onContextClick:function(ev,A){ev.preventDefault();var cn=A.className;Roo.log(cn);if(!cn.match(/x-ed-loc-/)){return;}var n=cn.split('-').pop();var B=this.footerEls;var C=B[n];var D=this.editor.createRange();D.selectNodeContents(C);var E=this.editor.getSelection();E.removeAllRanges();E.addRange(D);this.updateToolbar(null,null,C);}});
+//Roo/form/BasicForm.js
 Roo.form.BasicForm=function(el,A){this.allItems=[];this.childForms=[];Roo.apply(this,A);this.items=new Roo.util.MixedCollection(false,function(o){return o.id||(o.id=Roo.id());});this.addEvents({beforeaction:true,actionfailed:true,actioncomplete:true});if(el){this.initEl(el);}
 Roo.form.BasicForm.superclass.constructor.call(this);};Roo.extend(Roo.form.BasicForm,Roo.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,childForms:false,allItems:false,waitMsgTarget:false,initEl:function(el){this.el=Roo.get(el);this.id=this.el.id||Roo.id();this.el.on('submit',this.onSubmit,this);this.el.addClass('x-form');},onSubmit:function(e){e.stopEvent();},isValid:function(){var A=true;this.items.each(function(f){if(!f.validate()){A=false;}});return A;},isDirty:function(){var A=false;this.items.each(function(f){if(f.isDirty()){A=true;return false;}});return A;},doAction:function(A,B){if(typeof A=='string'){A=new Roo.form.Action.ACTION_TYPES[A](this,B);}if(this.fireEvent('beforeaction',this,A)!==false){this.beforeAction(A);A.run.defer(100,A);}return this;},submit:function(A){this.doAction('submit',A);return this;},load:function(A){this.doAction('load',A);return this;},updateRecord:function(A){A.beginEdit();var fs=A.fields;fs.each(function(f){var B=this.findField(f.name);if(B){A.set(f.name,B.getValue());}},this);A.endEdit();return this;},loadRecord:function(A){this.setValues(A.data);return this;},beforeAction:function(A){var o=A.options;if(this.waitMsgTarget===true){this.el.mask(o.waitMsg||"Sending",'x-mask-loading');}else if(this.waitMsgTarget){this.waitMsgTarget=Roo.get(this.waitMsgTarget);this.waitMsgTarget.mask(o.waitMsg||"Sending",'x-mask-loading');}else {Roo.MessageBox.wait(o.waitMsg||"Sending",o.waitTitle||this.waitTitle||'Please Wait...');}},afterAction:function(A,B){this.activeAction=null;var o=A.options;if(this.waitMsgTarget===true){this.el.unmask();}else if(this.waitMsgTarget){this.waitMsgTarget.unmask();}else {Roo.MessageBox.updateProgress(1);Roo.MessageBox.hide();}if(B){if(o.reset){this.reset();}
 Roo.callback(o.success,o.scope,[this,A]);this.fireEvent('actioncomplete',this,A);}else {Roo.callback(o.failure,o.scope,[this,A]);if(!this.hasListener('actionfailed')){Roo.MessageBox.alert("Error",(typeof(A.result)!='undefined'&&typeof(A.result.errorMsg)!='undefined')?A.result.errorMsg:"Saving Failed, please check your entries");}
@@ -755,6 +842,7 @@ this.childForms.push(A);var n='';Roo.each(A.allItems,function(fe){n=typeof(fe.ge
 Roo.each(this.childForms||[],function(f){f.markInvalid(A);});return this;},setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else {var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={};sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else {C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();}}}}
 Roo.each(this.childForms||[],function(f){f.setValues(A);});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}var B={};this.items.each(function(f){if(!f.getName()){return;}var v=f.getValue();if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){B[f.name]=f.getRawValue();}
 B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();});return this;},reset:function(){this.items.each(function(f){f.reset();});Roo.each(this.childForms||[],function(f){f.reset();});return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this;},remove:function(A){this.items.remove(A);return this;},render:function(){this.items.each(function(f){if(f.isFormField&&!f.rendered&&document.getElementById(f.id)){f.applyTo(f.id);}});return this;},applyToFields:function(o){this.items.each(function(f){Roo.apply(f,o);});return this;},applyIfToFields:function(o){this.items.each(function(f){Roo.applyIf(f,o);});return this;}});Roo.BasicForm=Roo.form.BasicForm;
+//Roo/form/Form.js
 Roo.form.Form=function(A){var B=[];if(A.items){B=A.items;delete A.items;}
 Roo.form.Form.superclass.constructor.call(this,null,A);this.url=this.url||this.action;if(!this.root){this.root=new Roo.form.Layout(Roo.applyIf({id:Roo.id()},A));}
 this.active=this.root;this.buttons=[];this.allItems=[];this.addEvents({clientvalidation:true,rendered:true});if(this.progressUrl){this.addxtype({xns:Roo.form,xtype:'Hidden',name:'UPLOAD_IDENTIFIER'});}
@@ -766,6 +854,7 @@ fe.form=this;if(fe.store){fe.store.form=this;}if(fe.isLayout){this.start(fe);thi
 this.end();continue;}
 this.add(fe);}if(ar[i].xtype=='Button'){this.addButton(ar[i]);this.allItems.push(fe);continue;}if(ar[i].xtype=='end'){alert('end is not supported on xtype any more, use items');}}return A;},startMonitoring:function(){if(!this.bound){this.bound=true;Roo.TaskMgr.start({run:this.bindHandler,interval:this.monitorPoll||200,scope:this});}},stopMonitoring:function(){this.bound=false;},bindHandler:function(){if(!this.bound){return false;}var A=true;this.items.each(function(f){if(!f.isValid(true)){A=false;return false;}});for(var i=0,B=this.buttons.length;i<B;i++){var C=this.buttons[i];if(C.formBind===true&&C.disabled===A){C.setDisabled(!A);}}
 this.fireEvent('clientvalidation',this,A);}});Roo.Form=Roo.form.Form;
+//Roo/form/Action.js
 Roo.form.Action=function(A,B){this.form=A;this.options=B||{};};Roo.form.Action.CLIENT_INVALID='client';Roo.form.Action.SERVER_INVALID='server';Roo.form.Action.CONNECT_FAILURE='connect';Roo.form.Action.LOAD_FAILURE='load';Roo.form.Action.prototype={type:'default',failureType:undefined,response:undefined,result:undefined,run:function(A){},success:function(A){},handleResponse:function(A){},failure:function(A){this.response=A;this.failureType=Roo.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);},processResponse:function(A){this.response=A;if(!A.responseText){return true;}
 this.result=this.handleResponse(A);return this.result;},getUrl:function(A){var B=this.options.url||this.form.url||this.form.el.dom.action;if(A){var p=this.getParams();if(p){B+=(B.indexOf('?')!=-1?'&':'?')+p;}}return B;},getMethod:function(){return (this.options.method||this.form.method||this.form.el.dom.method||'POST').toUpperCase();},getParams:function(){var bp=this.form.baseParams;var p=this.options.params;if(p){if(typeof p=="object"){p=Roo.urlEncode(Roo.applyIf(p,bp));}else if(typeof p=='string'&&bp){p+='&'+Roo.urlEncode(bp);}}else if(bp){p=Roo.urlEncode(bp);}return p;},createCallback:function(){return {success:this.success,failure:this.failure,scope:this,timeout:(this.form.timeout*1000),upload:this.form.fileUpload?this.success:undefined};}};Roo.form.Action.Submit=function(A,B){Roo.form.Action.Submit.superclass.constructor.call(this,A,B);};Roo.extend(Roo.form.Action.Submit,Roo.form.Action,{type:'submit',haveProgress:false,uploadComplete:false,uploadProgress:function(){if(!this.form.progressUrl){return;}if(!this.haveProgress){Roo.MessageBox.progress("Uploading","Uploading");}if(this.uploadComplete){Roo.MessageBox.hide();return;}
 this.haveProgress=true;var A=this.form.findField('UPLOAD_IDENTIFIER').getValue();var c=new Roo.data.Connection();c.request({url:this.form.progressUrl,params:{id:A},method:'GET',success:function(B){var C=false;var D;try{C=Roo.decode(B.responseText)}catch(e){Roo.log("Invalid data from server..");Roo.log(edata);return;}if(!C||!C.success){Roo.log(C);return;}var E=C.data;if(this.uploadComplete){Roo.MessageBox.hide();return;}if(E){Roo.MessageBox.updateProgress(E.bytes_uploaded/E.bytes_total,Math.floor((E.bytes_total-E.bytes_uploaded)/1000)+'k remaining');}
@@ -773,39 +862,49 @@ this.uploadProgress.defer(2000,this);},failure:function(B){Roo.log('progress url
 this.form.afterAction(this,false);},failure:function(A){this.uploadComplete=true;if(this.haveProgress){Roo.MessageBox.hide();}
 this.response=A;this.failureType=Roo.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);},handleResponse:function(A){if(this.form.errorReader){var rs=this.form.errorReader.read(A);var B=[];if(rs.records){for(var i=0,C=rs.records.length;i<C;i++){var r=rs.records[i];B[i]=r.data;}}if(B.length<1){B=null;}return {success:rs.success,errors:B};}var D=false;try{D=Roo.decode(A.responseText);}catch(e){ret={success:false,errorMsg:"Failed to read server message: "+(response?response.responseText:' - no message'),errors:[]};}return D;}});Roo.form.Action.Load=function(A,B){Roo.form.Action.Load.superclass.constructor.call(this,A,B);this.reader=this.form.reader;};Roo.extend(Roo.form.Action.Load,Roo.form.Action,{type:'load',run:function(){Roo.Ajax.request(Roo.apply(this.createCallback(),{method:this.getMethod(),url:this.getUrl(false),params:this.getParams()}));},success:function(A){var B=this.processResponse(A);if(B===true||!B.success||!B.data){this.failureType=Roo.form.Action.LOAD_FAILURE;this.form.afterAction(this,false);return;}
 this.form.clearInvalid();this.form.setValues(B.data);this.form.afterAction(this,true);},handleResponse:function(A){if(this.form.reader){var rs=this.form.reader.read(A);var B=rs.records&&rs.records[0]?rs.records[0].data:null;return {success:rs.success,data:B};}return Roo.decode(A.responseText);}});Roo.form.Action.ACTION_TYPES={'load':Roo.form.Action.Load,'submit':Roo.form.Action.Submit};
+//Roo/form/Layout.js
 Roo.form.Layout=function(A){var B=[];if(A.items){B=A.items;delete A.items;}
 Roo.form.Layout.superclass.constructor.call(this,A);this.stack=[];Roo.each(B,this.addxtype,this);};Roo.extend(Roo.form.Layout,Roo.Component,{clear:true,labelSeparator:':',hideLabels:false,defaultAutoCreate:{tag:'div',cls:'x-form-ct'},isLayout:true,onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);}else {var B=this.getAutoCreate();this.el=ct.createChild(B,A);}if(this.style){this.el.applyStyles(this.style);}if(this.labelAlign){this.el.addClass('x-form-label-'+this.labelAlign);}if(this.hideLabels){this.labelStyle="display:none";this.elementStyle="padding-left:0;";}else {if(typeof this.labelWidth=='number'){this.labelStyle="width:"+this.labelWidth+"px;";this.elementStyle="padding-left:"+((this.labelWidth+(typeof this.labelPad=='number'?this.labelPad:5))+'px')+";";}if(this.labelAlign=='top'){this.labelStyle="width:auto;";this.elementStyle="padding-left:0;";}}var C=this.stack;var D=C.length;if(D>0){if(!this.fieldTpl){var t=new Roo.Template('<div class="x-form-item {5}">','<label for="{0}" style="{2}">{1}{4}</label>','<div class="x-form-element" id="x-form-el-{0}" style="{3}">','</div>','</div><div class="x-form-clear-left"></div>');t.disableFormats=true;t.compile();Roo.form.Layout.prototype.fieldTpl=t;}for(var i=0;i<D;i++){if(C[i].isFormField){this.renderField(C[i]);}else {this.renderComponent(C[i]);}}}if(this.clear){this.el.createChild({cls:'x-form-clear'});}},renderField:function(f){f.fieldEl=Roo.get(this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||'',this.elementStyle||'',typeof f.labelSeparator=='undefined'?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||''],true).getPrevSibling());},renderComponent:function(c){c.render(c.isLayout?this.el:this.el.createChild());},addxtype:function(o){o.form=this.form;var fe=Roo.factory(o,Roo.form);this.form.allItems.push(fe);this.stack.push(fe);if(fe.isFormField){this.form.items.add(fe);}return fe;}});Roo.form.Column=function(A){Roo.form.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Column,Roo.form.Layout,{defaultAutoCreate:{tag:'div',cls:'x-form-ct x-form-column'},onRender:function(ct,A){Roo.form.Column.superclass.onRender.call(this,ct,A);if(this.width){this.el.setWidth(this.width);}}});Roo.form.Row=function(A){Roo.form.Row.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Row,Roo.form.Layout,{defaultAutoCreate:{tag:'div',cls:'x-form-ct x-form-row'},padWidth:20,onRender:function(ct,A){if(!this.rowTpl){var t=new Roo.Template('<div class="x-form-item {5}" style="float:left;width:{6}px">','<label for="{0}" style="{2}">{1}{4}</label>','<div class="x-form-element" id="x-form-el-{0}" style="{3}">','</div>','</div>');t.disableFormats=true;t.compile();Roo.form.Layout.prototype.rowTpl=t;}
 this.fieldTpl=this.rowTpl;var B=100;if((this.labelAlign!='top')){if(typeof this.labelWidth=='number'){B=this.labelWidth}
 this.padWidth=20+B;}
 Roo.form.Column.superclass.onRender.call(this,ct,A);if(this.width){this.el.setWidth(this.width);}if(this.height){this.el.setHeight(this.height);}},renderField:function(f){f.fieldEl=this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||'',this.elementStyle||'',typeof f.labelSeparator=='undefined'?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||'',f.width?f.width+this.padWidth:160+this.padWidth],true);}});Roo.form.FieldSet=function(A){Roo.form.FieldSet.superclass.constructor.call(this,A);};Roo.extend(Roo.form.FieldSet,Roo.form.Layout,{defaultAutoCreate:{tag:'fieldset',cn:{tag:'legend'}},onRender:function(ct,A){Roo.form.FieldSet.superclass.onRender.call(this,ct,A);if(this.legend){this.setLegend(this.legend);}},setLegend:function(A){if(this.rendered){this.el.child('legend').update(A);}}});
+//Roo/form/VTypes.js
 Roo.form.VTypes=function(){var A=/^[a-zA-Z_]+$/;var B=/^[a-zA-Z0-9_]+$/;var C=/^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;var D=/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;return {'email':function(v){return C.test(v);},'emailText':'This field should be an e-mail address in the format "user@domain.com"','emailMask':/[a-z0-9_\.\-@]/i,'url':function(v){return D.test(v);},'urlText':'This field should be a URL in the format "http:/'+'/www.domain.com"','alpha':function(v){return A.test(v);},'alphaText':'This field should only contain letters and _','alphaMask':/[a-z_]/i,'alphanum':function(v){return B.test(v);},'alphanumText':'This field should only contain letters, numbers and _','alphanumMask':/[a-z0-9_]/i};}();
+//Roo/form/FCKeditor.js
 Roo.form.FCKeditor=function(A){Roo.form.FCKeditor.superclass.constructor.call(this,A);this.addEvents({editorinit:true});};Roo.form.FCKeditor.editors={};Roo.extend(Roo.form.FCKeditor,Roo.form.TextArea,{fckconfig:false,toolbarSet:'Basic',basePath:'/fckeditor/',frame:false,value:'',onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"off"};}
 Roo.form.FCKeditor.superclass.onRender.call(this,ct,A);Roo.form.FCKeditor.editors[this.getId()]=this;this.replaceTextarea();},getEditor:function(){return this.fckEditor;},setValue:function(A){if(typeof(A)=='undefined'){return;}
 Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);if(!this.getEditor()){return;}
 this.getEditor().SetData(A);},getValue:function(){if(this.frame&&this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.getValue.call(this);}if(!this.el||!this.getEditor()){return this.value;}var A=this.getEditor().GetData();Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getValue.call(this);},getRawValue:function(){if(this.frame&&this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.getRawValue.call(this);}if(!this.el||!this.getEditor()){return this.value;return;}var A=this.getEditor().GetData();Roo.form.FCKeditor.superclass.setRawValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getRawValue.call(this);},setSize:function(w,h){Roo.form.FCKeditor.superclass.setSize.apply(this,[w,h]);this.frame.dom.setAttribute('width',w);this.frame.dom.setAttribute('height',h);this.frame.setSize(w,h);},toggleSourceEdit:function(A){this.el.dom.style.display=A?'':'none';this.frame.dom.style.display=A?'none':'';},focus:function(A){if(this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.focus.call(this);}if(!this.el||!this.getEditor()){this.focus.defer(100,this,[A]);return;}var B=this.getEditor().EditorDocument.getElementsByTagName(A);this.getEditor().Focus();if(B.length){if(!this.getEditor().Selection.GetSelection()){this.focus.defer(100,this,[A]);return;}var r=this.getEditor().EditorDocument.createRange();r.setStart(B[0],0);r.setEnd(B[0],0);this.getEditor().Selection.GetSelection().removeAllRanges();this.getEditor().Selection.GetSelection().addRange(r);this.getEditor().Focus();}},replaceTextarea:function(){if(document.getElementById(this.getId()+'___Frame'))return;var A=document.getElementById(this.getId());var B=document.getElementsByName(this.getId());A.style.display='none';if(A.tabIndex){this.TabIndex=A.tabIndex;}
 this._insertHtmlBefore(this._getConfigHtml(),A);this._insertHtmlBefore(this._getIFrameHtml(),A);this.frame=Roo.get(this.getId()+'___Frame')},_getConfigHtml:function(){var A='';for(var o in this.fckconfig){A+=A.length>0?'&amp;':'';A+=encodeURIComponent(o)+'='+encodeURIComponent(this.fckconfig[o]);}return '<input type="hidden" id="'+this.getId()+'___Config" value="'+A+'" style="display:none" />';},_getIFrameHtml:function(){var A='fckeditor.html';var B=this.basePath+'editor/'+A+'?InstanceName='+encodeURIComponent(this.getId());B+=this.toolbarSet?('&amp;Toolbar='+this.toolbarSet):'';var C='<iframe id="'+this.getId()+'___Frame" src="'+B+'" width="'+this.width+'" height="'+this.height+'"'+(this.tabIndex?' tabindex="'+this.tabIndex+'"':'')+' frameborder="0" scrolling="no"></iframe>';return C;},_insertHtmlBefore:function(A,B){if(B.insertAdjacentHTML){B.insertAdjacentHTML('beforeBegin',A);}else {var C=document.createRange();C.setStartBefore(B);var D=C.createContextualFragment(A);B.parentNode.insertBefore(D,B);}}});function FCKeditor_OnComplete(A){var f=Roo.form.FCKeditor.editors[A.Name];f.fckEditor=A;f.fireEvent('editorinit',f,A);}
+//Roo/form/GridField.js
 Roo.form.GridField=function(A){Roo.form.GridField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.GridField,Roo.form.Field,{width:100,height:50,xgrid:false,defaultAutoCreate:{tag:'input',type:'hidden',autocomplete:'off'},addTitle:false,onResize:function(){Roo.form.Field.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){this.style=this.style||'overflow: hidden; border:1px solid #c3daf9;';var B=this.style;delete this.style;Roo.form.GridField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:''});this.viewEl=this.wrap.createChild({tag:'div'});if(B){this.viewEl.applyStyles(B);}if(this.width){this.viewEl.setWidth(this.width);}if(this.height){this.viewEl.setHeight(this.height);}
 this.grid=new Roo.grid[this.xgrid.xtype](this.viewEl,this.xgrid);this.grid.render();this.grid.getDataSource().on('remove',this.refreshValue,this);this.grid.getDataSource().on('update',this.refreshValue,this);this.grid.on('afteredit',this.refreshValue,this);},setValue:function(v){v=v||[];if(this.grid&&this.grid.getDataSource()&&typeof(v)!='undefined'){var ds=this.grid.getDataSource();var A={}
 A[ds.reader.meta.root]=typeof(v)=='string'?Roo.decode(v):v;ds.loadData(A);}if(this.grid.sm){this.grid.sm.clearSelections();}
 Roo.form.GridField.superclass.setValue.call(this,v);this.refreshValue();},refreshValue:function(){var A=[];this.grid.getDataSource().each(function(r){A.push(r.data);});this.el.dom.value=Roo.encode(A);}});
+//Roo/form/DisplayField.js
 Roo.form.DisplayField=function(A){Roo.form.DisplayField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DisplayField,Roo.form.TextField,{inputType:'hidden',allowBlank:true,readOnly:true,focusClass:undefined,fieldClass:'x-form-field',valueRenderer:undefined,width:100,onResize:function(){Roo.form.DisplayField.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.DisplayField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap();this.viewEl=this.wrap.createChild({tag:'div',cls:'x-form-displayfield'});if(this.bodyStyle){this.viewEl.applyStyles(this.bodyStyle);}
 this.setValue(this.value);},onClick:function(){},setValue:function(v){this.value=v;var A=this.valueRenderer?this.valueRenderer(v):String.format('{0}',v);if(!this.viewEl){return;}
 this.viewEl.dom.innerHTML=A;Roo.form.DisplayField.superclass.setValue.call(this,v);}});
+//Roo/form/DayPicker.js
 Roo.form.DayPicker=function(A){Roo.form.DayPicker.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DayPicker,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},actionMode:'viewEl',inputType:'hidden',inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-form-daypick-item '});var r1='<table><tr>';var r2='<tr class="x-form-daypick-icons">';for(var i=0;i<7;i++){r1+='<td><div>'+Date.dayNames[i].substring(0,3)+'</div></td>';r2+='<td><img class="x-menu-item-icon" src="'+Roo.BLANK_IMAGE_URL+'"></td>';}var B=this.wrap.createChild(r1+'</tr>'+r2+'</tr></table>');B.select('img').on('click',this.onClick,this);this.viewEl=B;this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);},initValue:Roo.emptyFn,getValue:function(){return this.el.dom.value;},onClick:function(e){Roo.get(e.target).toggleClass('x-menu-item-checked');this.refreshValue();},refreshValue:function(){var A='';this.viewEl.select('img',true).each(function(e,i,n){A+=e.is(".x-menu-item-checked")?String(n):'';});this.setValue(A,true);},setValue:function(v,A){if(!this.el.dom){return;}var B=this.el.dom.value;this.el.dom.value=v;if(A){return;}
 this.viewEl.select('img',true).each(function(e,i,n){var on=e.is(".x-menu-item-checked");var C=v.indexOf(String(n))>-1;if(on!=C){e.toggleClass('x-menu-item-checked');}});this.fireEvent('change',this,v,B);},setFromHidden:function(){if(!this.el){return;}
 this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}
 Roo.form.DayPicker.superclass.onDestroy.call(this);}});
+//Roo/form/ComboCheck.js
 Roo.form.ComboCheck=function(A){Roo.form.ComboCheck.superclass.constructor.call(this,A);var B=['hiddenName','displayField','valueField'];var _t=this;Roo.each(B,function(e){if((typeof(_t[e])=='undefined')||!_t[e].length){throw "Roo.form.ComboCheck : missing value for: "+e;}});};Roo.extend(Roo.form.ComboCheck,Roo.form.ComboBox,{editable:false,selectedClass:'x-menu-item-checked',onRender:function(ct,A){var _t=this;if(!this.tpl){var B='x-combo-list';this.tpl=new Roo.Template({html:'<div class="'+B+'-item x-menu-check-item">'+'<img class="x-menu-item-icon" style="margin: 0px;" src="'+Roo.BLANK_IMAGE_URL+'">'+'<span>{'+this.displayField+'}</span>'+'</div>'});}
 Roo.form.ComboCheck.superclass.onRender.call(this,ct,A);this.view.singleSelect=false;this.view.multiSelect=true;this.view.toggleSelect=true;this.pageTb.add(new Roo.Toolbar.Fill(),{text:'Done',handler:function(){_t.collapse();}});},onViewOver:function(e,t){return;},onViewClick:function(A,B){return;},select:function(){},selectByValue:function(xv,A){var ar=this.getValueArray();var B=[];Roo.each(ar,function(v){if(v===undefined||v===null){return;}var r=this.findRecord(this.valueField,v);if(r){B.push(this.store.indexOf(r))}},this);this.view.select(B);return false;},onSelect:function(A,B){this.view.clearSelections();this.setValue('[]');if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);}},getValueArray:function(){var ar=[];try{if(typeof(this.value)=='undefined'){return [];}var ar=Roo.decode(this.value);return ar instanceof Array?ar:[];}catch(e){Roo.log(e+"\nRoo.form.ComboCheck:getValueArray  invalid data:"+this.getValue());return [];}},expand:function(){Roo.form.ComboCheck.superclass.expand.call(this);this.valueBefore=this.value;},collapse:function(){Roo.form.ComboCheck.superclass.collapse.call(this);var sl=this.view.getSelectedIndexes();var st=this.store;var nv=[];var tv=[];var r;Roo.each(sl,function(i){r=st.getAt(i);nv.push(r.get(this.valueField));},this);this.setValue(Roo.encode(nv));if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);}},setValue:function(v){this.value=v;var A=this.getValueArray();var tv=[];Roo.each(A,function(k){var r=this.findRecord(this.valueField,k);if(r){tv.push(r.data[this.displayField]);}else if(this.valueNotFoundText!==undefined){tv.push(this.valueNotFoundText);}},this);Roo.form.ComboBox.superclass.setValue.call(this,tv.join(', '));this.hiddenField.value=v;this.value=v;}});
+//Roo/DDView.js
 Roo.DDView=function(A,B,C){Roo.DDView.superclass.constructor.apply(this,arguments);this.getEl().setStyle("outline","0px none");this.getEl().unselectable();if(this.dragGroup){this.setDraggable(this.dragGroup.split(","));}if(this.dropGroup){this.setDroppable(this.dropGroup.split(","));}if(this.deletable){this.setDeletable();}
 this.isDirtyFlag=false;this.addEvents({"drop":true});};Roo.extend(Roo.DDView,Roo.View,{isFormField:true,reset:Roo.emptyFn,clearInvalid:Roo.form.Field.prototype.clearInvalid,validate:function(){return true;},destroy:function(){this.purgeListeners();this.getEl.removeAllListeners();this.getEl().remove();if(this.dragZone){if(this.dragZone.destroy){this.dragZone.destroy();}}if(this.dropZone){if(this.dropZone.destroy){this.dropZone.destroy();}}},getName:function(){return this.name;},setValue:function(v){if(!this.store){throw "DDView.setValue(). DDView must be constructed with a valid Store";}var A={};A[this.store.reader.meta.root]=v?[].concat(v):[];this.store.proxy=new Roo.data.MemoryProxy(A);this.store.load();},getValue:function(){var A='(';this.store.each(function(B){A+=B.id+',';});return A.substr(0,A.length-1)+')';},getIds:function(){var i=0,A=new Array(this.store.getCount());this.store.each(function(B){A[i++]=B.id;});return A;},isDirty:function(){return this.isDirtyFlag;},getTargetFromEvent:function(e){var A=e.getTarget();while((A!==null)&&(A.parentNode!=this.el.dom)){A=A.parentNode;}if(!A){A=this.el.dom.lastChild||this.el.dom;}return A;},getDragData:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.handleSelection(e);var B=this.getSelectedNodes();var C={source:this,copy:this.copy||(this.allowCopy&&e.ctrlKey),nodes:B,records:[]};var D=this.getSelectedIndexes();for(var i=0;i<D.length;i++){C.records.push(this.store.getAt(D[i]));}if(B.length==1){C.ddel=A.cloneNode(true);}else {var E=document.createElement('div');E.className='multi-proxy';for(var i=0,F=B.length;i<F;i++){E.appendChild(B[i].cloneNode(true));}
 C.ddel=E;}return C;}return false;},setDraggable:function(A){if(A instanceof Array){Roo.each(A,this.setDraggable,this);return;}if(this.dragZone){this.dragZone.addToGroup(A);}else {this.dragZone=new Roo.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:A});if(!this.multiSelect){this.singleSelect=true;}
 this.dragZone.getDragData=this.getDragData.createDelegate(this);}},setDroppable:function(A){if(A instanceof Array){Roo.each(A,this.setDroppable,this);return;}if(this.dropZone){this.dropZone.addToGroup(A);}else {this.dropZone=new Roo.dd.DropZone(this.getEl(),{containerScroll:true,ddGroup:A});this.dropZone.getTargetFromEvent=this.getTargetFromEvent.createDelegate(this);this.dropZone.onNodeEnter=this.onNodeEnter.createDelegate(this);this.dropZone.onNodeOver=this.onNodeOver.createDelegate(this);this.dropZone.onNodeOut=this.onNodeOut.createDelegate(this);this.dropZone.onNodeDrop=this.onNodeDrop.createDelegate(this);}},getDropPoint:function(e,n,dd){if(n==this.el.dom){return "above";}var t=Roo.lib.Dom.getY(n),b=t+n.offsetHeight;var c=t+(b-t)/2;var y=Roo.lib.Event.getPageY(e);if(y<=c){return "above";}else {return "below";}},onNodeEnter:function(n,dd,e,A){return false;},onNodeOver:function(n,dd,e,A){var pt=this.getDropPoint(e,n,dd);var B=this.dropNotAllowed;if(pt){var C;if(pt=="above"){B=n.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";C="x-view-drag-insert-above";}else {B=n.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";C="x-view-drag-insert-below";}if(this.lastInsertClass!=C){Roo.fly(n).replaceClass(this.lastInsertClass,C);this.lastInsertClass=C;}}return B;},onNodeOut:function(n,dd,e,A){this.removeDropIndicators(n);},onNodeDrop:function(n,dd,e,A){if(this.fireEvent("drop",this,n,dd,e,A)===false){return false;}var pt=this.getDropPoint(e,n,dd);var B=(n==this.el.dom)?this.nodes.length:n.nodeIndex;if(pt=="below"){B++;}for(var i=0;i<A.records.length;i++){var r=A.records[i];var C=this.store.getById(r.id);if(C&&(dd!=this.dragZone)){Roo.fly(this.getNode(this.store.indexOf(C))).frame("red",1);}else {if(A.copy){this.store.insert(B++,r.copy());}else {A.source.isDirtyFlag=true;r.store.remove(r);this.store.insert(B++,r);}
 this.isDirtyFlag=true;}}
 this.dragZone.cachedTarget=null;return true;},removeDropIndicators:function(n){if(n){Roo.fly(n).removeClass(["x-view-drag-insert-above","x-view-drag-insert-below"]);this.lastInsertClass="_noclass";}},setDeletable:function(A){if(!this.singleSelect&&!this.multiSelect){this.singleSelect=true;}var c=this.getContextMenu();this.contextMenu.on("itemclick",function(B){switch(B.id){case "delete":this.remove(this.getSelectedIndexes());break;}},this);this.contextMenu.add({icon:A,id:"delete",text:'Delete'});},getContextMenu:function(){if(!this.contextMenu){this.contextMenu=new Roo.menu.Menu({id:this.id+"-contextmenu"});this.el.on("contextmenu",this.showContextMenu,this);}return this.contextMenu;},disableContextMenu:function(){if(this.contextMenu){this.el.un("contextmenu",this.showContextMenu,this);}},showContextMenu:function(e,A){A=this.findItemFromChild(e.getTarget());if(A){e.stopEvent();this.select(this.getNode(A),this.multiSelect&&e.ctrlKey,true);this.contextMenu.showAt(e.getXY());}},remove:function(A){A=[].concat(A);for(var i=0;i<A.length;i++){var B=this.store.getAt(A[i]);this.store.remove(B);}},onDblClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){if(this.fireEvent("dblclick",this,this.indexOf(A),A,e)===false){return false;}if(this.dragGroup){var B=Roo.dd.DragDropMgr.getRelated(this.dragZone,true);while(B.indexOf(this.dropZone)>-1){B.remove(this.dropZone);}if(B.length==1){this.dragZone.cachedTarget=null;var el=Roo.get(B[0].getEl());var C=el.getBox(true);B[0].onNodeDrop(el.dom,{target:el.dom,xy:[C.x,C.y+C.height-1]},null,this.getDragData(e));}}}},handleSelection:function(e){this.dragZone.cachedTarget=null;var A=this.findItemFromChild(e.getTarget());if(!A){this.clearSelections(true);return;}if(A&&(this.multiSelect||this.singleSelect)){if(this.multiSelect&&e.shiftKey&&(!e.ctrlKey)&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),A.nodeIndex),false);}else if(this.isSelected(this.getNode(A))&&e.ctrlKey){this.unselect(A);}else {this.select(A,this.multiSelect&&e.ctrlKey);this.lastSelection=A;}}},onItemClick:function(A,B,e){if(this.fireEvent("beforeclick",this,B,A,e)===false){return false;}return true;},unselect:function(A,B){var C=this.getNode(A);if(C&&this.isSelected(C)){if(this.fireEvent("beforeselect",this,C,this.selections)!==false){Roo.fly(C).removeClass(this.selectedClass);this.selections.remove(C);if(!B){this.fireEvent("selectionchange",this,this.selections);}}}}});
+//Roo/LayoutManager.js
 Roo.LayoutManager=function(A,B){Roo.LayoutManager.superclass.constructor.call(this);this.el=Roo.get(A);if(this.el.dom==document.body&&Roo.isIE&&!B.allowScroll){document.body.scroll="no";}else if(this.el.dom!=document.body&&this.el.getStyle('position')=='static'){this.el.position('relative');}
 this.id=this.el.id;this.el.addClass("x-layout-container");this.monitorWindowResize=true;this.regions={};this.addEvents({"layout":true,"regionresized":true,"regioncollapsed":true,"regionexpanded":true});this.updating=false;Roo.EventManager.onWindowResize(this.onWindowResize,this,true);};Roo.extend(Roo.LayoutManager,Roo.util.Observable,{isUpdating:function(){return this.updating;},beginUpdate:function(){this.updating=true;},endUpdate:function(A){this.updating=false;if(!A){this.layout();}},layout:function(){},onRegionResized:function(A,B){this.fireEvent("regionresized",A,B);this.layout();},onRegionCollapsed:function(A){this.fireEvent("regioncollapsed",A);},onRegionExpanded:function(A){this.fireEvent("regionexpanded",A);},getViewSize:function(){var A;if(this.el.dom!=document.body){A=this.el.getSize();}else {A={width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()};}
 A.width-=this.el.getBorderWidth("lr")-this.el.getPadding("lr");A.height-=this.el.getBorderWidth("tb")-this.el.getPadding("tb");return A;},getEl:function(){return this.el;},getRegion:function(A){return this.regions[A.toLowerCase()];},onWindowResize:function(){if(this.monitorWindowResize){this.layout();}}});
+//Roo/BorderLayout.js
 Roo.BorderLayout=function(A,B){B=B||{};Roo.BorderLayout.superclass.constructor.call(this,A,B);this.factory=B.factory||Roo.BorderLayout.RegionFactory;for(var i=0,C=this.factory.validRegions.length;i<C;i++){var D=this.factory.validRegions[i];if(B[D]){this.addRegion(D,B[D]);}}};Roo.extend(Roo.BorderLayout,Roo.LayoutManager,{addRegion:function(A,B){if(!this.regions[A]){var r=this.factory.create(A,this,B);this.bindRegion(A,r);}return this.regions[A];},bindRegion:function(A,r){this.regions[A]=r;r.on("visibilitychange",this.layout,this);r.on("paneladded",this.layout,this);r.on("panelremoved",this.layout,this);r.on("invalidated",this.layout,this);r.on("resized",this.onRegionResized,this);r.on("collapsed",this.onRegionCollapsed,this);r.on("expanded",this.onRegionExpanded,this);},layout:function(){if(this.updating)return;var A=this.getViewSize();var w=A.width;var h=A.height;var B=w;var C=h;var D=0;var E=0;var rs=this.regions;var F=rs["north"];var G=rs["south"];var H=rs["west"];var I=rs["east"];var J=rs["center"];if(F&&F.isVisible()){var b=F.getBox();var m=F.getMargins();b.width=w-(m.left+m.right);b.x=m.left;b.y=m.top;D=b.height+b.y+m.bottom;C-=D;F.updateBox(this.safeBox(b));}if(G&&G.isVisible()){var b=G.getBox();var m=G.getMargins();b.width=w-(m.left+m.right);b.x=m.left;var K=(b.height+m.top+m.bottom);b.y=h-K+m.top;C-=K;G.updateBox(this.safeBox(b));}if(H&&H.isVisible()){var b=H.getBox();var m=H.getMargins();b.height=C-(m.top+m.bottom);b.x=m.left;b.y=D+m.top;var L=(b.width+m.left+m.right);E+=L;B-=L;H.updateBox(this.safeBox(b));}if(I&&I.isVisible()){var b=I.getBox();var m=I.getMargins();b.height=C-(m.top+m.bottom);var L=(b.width+m.left+m.right);b.x=w-L+m.left;b.y=D+m.top;B-=L;I.updateBox(this.safeBox(b));}if(J){var m=J.getMargins();var M={x:E+m.left,y:D+m.top,width:B-(m.left+m.right),height:C-(m.top+m.bottom)};J.updateBox(this.safeBox(M));}
 this.el.repaint();this.fireEvent("layout",this);},safeBox:function(A){A.width=Math.max(0,A.width);A.height=Math.max(0,A.height);return A;},add:function(A,B){A=A.toLowerCase();return this.regions[A].add(B);},remove:function(A,B){A=A.toLowerCase();return this.regions[A].remove(B);},findPanel:function(A){var rs=this.regions;for(var B in rs){if(typeof rs[B]!="function"){var p=rs[B].getPanel(A);if(p){return p;}}}return null;},showPanel:function(A){var rs=this.regions;for(var B in rs){var r=rs[B];if(typeof r!="function"){if(r.hasPanel(A)){return r.showPanel(A);}}}return null;},restoreState:function(A){if(!A){A=Roo.state.Manager;}var sm=new Roo.LayoutStateManager();sm.init(this,A);},batchAdd:function(A){this.beginUpdate();for(var B in A){var lr=this.regions[B];if(lr){this.addTypedPanels(lr,A[B]);}}
 this.endUpdate();},addTypedPanels:function(lr,ps){if(typeof ps=='string'){lr.add(new Roo.ContentPanel(ps));}else if(ps instanceof Array){for(var i=0,A=ps.length;i<A;i++){this.addTypedPanels(lr,ps[i]);}}else if(!ps.events){var el=ps.el;delete ps.el;lr.add(new Roo.ContentPanel(el||Roo.id(),ps));}else {lr.add(ps);}},addxtype:function(A){if(!A.xtype.match(/Panel$/)){return false;}var B=false;if(typeof(A.region)=='undefined'){Roo.log("Failed to add Panel, region was not set");Roo.log(A);return false;}var C=A.region;delete A.region;var D=[];if(A.items){D=A.items;delete A.items;}var nb=false;switch(A.xtype){case 'ContentPanel':case 'ScrollPanel':if(A.autoCreate){B=new Roo[A.xtype](A);}else {var el=this.el.createChild();B=new Roo[A.xtype](el,A);}
@@ -813,11 +912,13 @@ this.add(C,B);break;case 'TreePanel':A.el=this.el.createChild();B=new Roo[A.xtyp
 B=new Roo[A.xtype](G,A);this.add(C,B);if(A.background){B.on('activate',function(gp){if(!gp.grid.rendered){gp.grid.render();}});}else {G.render();}break;default:alert("Can not add '"+A.xtype+"' to BorderLayout");return null;}
 this.beginUpdate();var C='';var H={};Roo.each(D,function(i){C=nb&&i.region?i.region:false;var I=B.addxtype(i);if(C){nb[C]=nb[C]==undefined?0:nb[C]+1;if(!i.background){H[C]=nb[C];}}});this.endUpdate();if(nb){for(var r in H){C=this.getRegion(r);if(C){C.showPanel(H[r]);}}}return B;}});Roo.BorderLayout.create=function(A,B){var C=new Roo.BorderLayout(B||document.body,A);C.beginUpdate();var D=Roo.BorderLayout.RegionFactory.validRegions;for(var j=0,E=D.length;j<E;j++){var lr=D[j];if(C.regions[lr]&&A[lr].panels){var r=C.regions[lr];var ps=A[lr].panels;C.addTypedPanels(r,ps);}}
 C.endUpdate();return C;};Roo.BorderLayout.RegionFactory={validRegions:["north","south","east","west","center"],create:function(A,B,C){A=A.toLowerCase();if(C.lightweight||C.basic){return new Roo.BasicLayoutRegion(B,C,A);}switch(A){case "north":return new Roo.NorthLayoutRegion(B,C);case "south":return new Roo.SouthLayoutRegion(B,C);case "east":return new Roo.EastLayoutRegion(B,C);case "west":return new Roo.WestLayoutRegion(B,C);case "center":return new Roo.CenterLayoutRegion(B,C);}throw 'Layout region "'+A+'" not supported.';}};
+//Roo/BasicLayoutRegion.js
 Roo.BasicLayoutRegion=function(A,B,C,D){this.mgr=A;this.position=C;this.events={"beforeremove":true,"invalidated":true,"visibilitychange":true,"paneladded":true,"panelremoved":true,"collapsed":true,"expanded":true,"slideshow":true,"slidehide":true,"panelactivated":true,"resized":true};this.panels=new Roo.util.MixedCollection();this.panels.getKey=this.getPanelId.createDelegate(this);this.box=null;this.activePanel=null;if(B.listeners||B.events){Roo.BasicLayoutRegion.superclass.constructor.call(this,{listeners:B.listeners||{},events:B.events||{}});}if(D!==true){this.applyConfig(B);}};Roo.extend(Roo.BasicLayoutRegion,Roo.util.Observable,{getPanelId:function(p){return p.getId();},applyConfig:function(A){this.margins=A.margins||this.margins||{top:0,left:0,right:0,bottom:0};this.config=A;},resizeTo:function(A){var el=this.el?this.el:(this.activePanel?this.activePanel.getEl():null);if(el){switch(this.position){case "east":case "west":el.setWidth(A);this.fireEvent("resized",this,A);break;case "north":case "south":el.setHeight(A);this.fireEvent("resized",this,A);break;}}},getBox:function(){return this.activePanel?this.activePanel.getEl().getBox(false,true):null;},getMargins:function(){return this.margins;},updateBox:function(A){this.box=A;var el=this.activePanel.getEl();el.dom.style.left=A.x+"px";el.dom.style.top=A.y+"px";this.activePanel.setSize(A.width,A.height);},getEl:function(){return this.activePanel;},isVisible:function(){return this.activePanel?true:false;},setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);this.activePanel.getEl().setLeftTop(-10000,-10000);}
 this.activePanel=A;A.setActiveState(true);if(this.box){A.setSize(this.box.width,this.box.height);}
 this.fireEvent("panelactivated",this,A);this.fireEvent("invalidated");},showPanel:function(A){if(A=this.getPanel(A)){this.setActivePanel(A);}return A;},getActivePanel:function(){return this.activePanel;},add:function(A){if(arguments.length>1){for(var i=0,B=arguments.length;i<B;i++){this.add(arguments[i]);}return null;}if(this.hasPanel(A)){this.showPanel(A);return A;}var el=A.getEl();if(el.dom.parentNode!=this.mgr.el.dom){this.mgr.el.dom.appendChild(el.dom);}if(A.setRegion){A.setRegion(this);}
 this.panels.add(A);el.setStyle("position","absolute");if(!A.background){this.setActivePanel(A);if(this.config.initialSize&&this.panels.getCount()==1){this.resizeTo(this.config.initialSize);}}
 this.fireEvent("paneladded",this,A);return A;},hasPanel:function(A){if(typeof A=="object"){A=A.getId();}return this.getPanel(A)?true:false;},remove:function(A,B){A=this.getPanel(A);if(!A){return null;}var e={};this.fireEvent("beforeremove",this,A,e);if(e.cancel===true){return null;}var C=A.getId();this.panels.removeKey(C);return A;},getPanel:function(id){if(typeof id=="object"){return id;}return this.panels.get(id);},getPosition:function(){return this.position;}});
+//Roo/LayoutRegion.js
 Roo.LayoutRegion=function(A,B,C){Roo.LayoutRegion.superclass.constructor.call(this,A,B,C,true);var dh=Roo.DomHelper;this.el=dh.append(A.el.dom,{tag:"div",cls:"x-layout-panel x-layout-panel-"+this.position},true);this.titleEl=dh.append(this.el.dom,{tag:"div",unselectable:"on",cls:"x-unselectable x-layout-panel-hd x-layout-title-"+this.position,children:[{tag:"span",cls:"x-unselectable x-layout-panel-hd-text",unselectable:"on",html:"&#160;"},{tag:"div",cls:"x-unselectable x-layout-panel-hd-tools",unselectable:"on"}]},true);this.titleEl.enableDisplayMode();this.titleTextEl=this.titleEl.dom.firstChild;this.tools=Roo.get(this.titleEl.dom.childNodes[1],true);this.closeBtn=this.createTool(this.tools.dom,"x-layout-close");this.closeBtn.enableDisplayMode();this.closeBtn.on("click",this.closeClicked,this);this.closeBtn.hide();this.createBody(B);this.visible=true;this.collapsed=false;if(B.hideWhenEmpty){this.hide();this.on("paneladded",this.validateVisibility,this);this.on("panelremoved",this.validateVisibility,this);}
 this.applyConfig(B);};Roo.extend(Roo.LayoutRegion,Roo.BasicLayoutRegion,{createBody:function(){this.bodyEl=this.el.createChild({tag:"div",cls:"x-layout-panel-body"});},applyConfig:function(c){if(c.collapsible&&this.position!="center"&&!this.collapsedEl){var dh=Roo.DomHelper;if(c.titlebar!==false){this.collapseBtn=this.createTool(this.tools.dom,"x-layout-collapse-"+this.position);this.collapseBtn.on("click",this.collapse,this);this.collapseBtn.enableDisplayMode();if(c.showPin===true||this.showPin){this.stickBtn=this.createTool(this.tools.dom,"x-layout-stick");this.stickBtn.enableDisplayMode();this.stickBtn.on("click",this.expand,this);this.stickBtn.hide();}}
 this.collapsedEl=dh.append(this.mgr.el.dom,{cls:"x-layout-collapsed x-layout-collapsed-"+this.position,children:[{cls:"x-layout-collapsed-tools",children:[{cls:"x-layout-ctools-inner"}]}]},true);if(c.floatable!==false){this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.collapseClick,this);}if(c.collapsedTitle&&(this.position=="north"||this.position=="south")){this.collapsedTitleTextEl=dh.append(this.collapsedEl.dom,{tag:"div",cls:"x-unselectable x-layout-panel-hd-text",id:"message",unselectable:"on",style:{"float":"left"}});this.collapsedTitleTextEl.innerHTML=c.collapsedTitle;}
@@ -841,6 +942,7 @@ this.fireEvent("paneladded",this,A);return A;},hidePanel:function(A){if(this.tab
 B=(typeof B!="undefined"?B:(this.config.preservePanels===true||A.preserve===true));var C=A.getId();this.panels.removeKey(C);if(B){document.body.appendChild(A.getEl().dom);}if(this.tabs){this.tabs.removeTab(A.getEl().id);}else if(!B){this.bodyEl.dom.removeChild(A.getEl().dom);}if(this.panels.getCount()==1&&this.tabs&&!this.config.alwaysShowTabs){var p=this.panels.first();var D=document.createElement("div");D.appendChild(p.getEl().dom);this.bodyEl.update("");this.bodyEl.dom.appendChild(p.getEl().dom);D=null;this.updateTitle(p.getTitle());this.tabs=null;this.bodyEl.setStyle("overflow",this.config.autoScroll?"auto":"hidden");this.setActivePanel(p);}
 A.setRegion(null);if(this.activePanel==A){this.activePanel=null;}if(this.config.autoDestroy!==false&&B!==true){try{A.destroy();}catch(e){}}
 this.fireEvent("panelremoved",this,A);return A;},getTabs:function(){return this.tabs;},createTool:function(A,B){var C=Roo.DomHelper.append(A,{tag:"div",cls:"x-layout-tools-button",children:[{tag:"div",cls:"x-layout-tools-button-inner "+B,html:"&#160;"}]},true);C.addClassOnOver("x-layout-tools-button-over");return C;}});
+//Roo/SplitLayoutRegion.js
 Roo.SplitLayoutRegion=function(A,B,C,D){this.cursor=D;Roo.SplitLayoutRegion.superclass.constructor.call(this,A,B,C);};Roo.extend(Roo.SplitLayoutRegion,Roo.LayoutRegion,{splitTip:"Drag to resize.",collapsibleSplitTip:"Drag to resize. Double click to hide.",useSplitTips:false,applyConfig:function(A){Roo.SplitLayoutRegion.superclass.applyConfig.call(this,A);if(A.split){if(!this.split){var B=Roo.DomHelper.append(this.mgr.el.dom,{tag:"div",id:this.el.id+"-split",cls:"x-layout-split x-layout-split-"+this.position,html:"&#160;"});this.split=new Roo.SplitBar(B,this.el,this.orientation);this.split.on("moved",this.onSplitMove,this);this.split.useShim=A.useShim===true;this.split.getMaximumSize=this[this.position=='north'||this.position=='south'?'getVMaxSize':'getHMaxSize'].createDelegate(this);if(this.useSplitTips){this.split.el.dom.title=A.collapsible?this.collapsibleSplitTip:this.splitTip;}if(A.collapsible){this.split.el.on("dblclick",this.collapse,this);}}if(typeof A.minSize!="undefined"){this.split.minSize=A.minSize;}if(typeof A.maxSize!="undefined"){this.split.maxSize=A.maxSize;}if(A.hideWhenEmpty||A.hidden||A.collapsed){this.hideSplitter();}}},getHMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");return Math.min(A,(this.el.getWidth()+B.getEl().getWidth())-B.getMinWidth());},getVMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");return Math.min(A,(this.el.getHeight()+B.getEl().getHeight())-B.getMinHeight());},onSplitMove:function(A,B){this.fireEvent("resized",this,B);},getSplitBar:function(){return this.split;},hide:function(){this.hideSplitter();Roo.SplitLayoutRegion.superclass.hide.call(this);},hideSplitter:function(){if(this.split){this.split.el.setLocation(-2000,-2000);this.split.el.hide();}},show:function(){if(this.split){this.split.el.show();}
 Roo.SplitLayoutRegion.superclass.show.call(this);},beforeSlide:function(){if(Roo.isGecko){this.bodyEl.clip();if(this.tabs)this.tabs.bodyEl.clip();if(this.activePanel){this.activePanel.getEl().clip();if(this.activePanel.beforeSlide){this.activePanel.beforeSlide();}}}},afterSlide:function(){if(Roo.isGecko){this.bodyEl.unclip();if(this.tabs)this.tabs.bodyEl.unclip();if(this.activePanel){this.activePanel.getEl().unclip();if(this.activePanel.afterSlide){this.activePanel.afterSlide();}}}},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){var st=new Roo.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(){Roo.get(document).un("click",this.slideInIf,this);},slideOut:function(){if(this.isSlid||this.el.hasActiveFx()){return;}
@@ -851,14 +953,17 @@ this.closeBtn.setStyle('display',this.closeBtnState);if(this.stickBtn){this.stic
 this.fireEvent("slidehide",this);},slideIn:function(cb){if(!this.isSlid||this.el.hasActiveFx()){Roo.callback(cb);return;}
 this.isSlid=false;this.beforeSlide();this.el.slideOut(this.getSlideAnchor(),{callback:function(){this.el.setLeftTop(-10000,-10000);this.afterSlide();this.afterSlideIn();Roo.callback(cb);},scope:this,block:true});},slideInIf:function(e){if(!e.within(this.el)){this.slideIn();}},animateCollapse:function(){this.beforeSlide();this.el.setStyle("z-index",20000);var A=this.getSlideAnchor();this.el.slideOut(A,{callback:function(){this.el.setStyle("z-index","");this.collapsedEl.slideIn(A,{duration:.3});this.afterSlide();this.el.setLocation(-10000,-10000);this.el.hide();this.fireEvent("collapsed",this);},scope:this,block:true});},animateExpand:function(){this.beforeSlide();this.el.alignTo(this.collapsedEl,this.getCollapseAnchor(),this.getExpandAdj());this.el.setStyle("z-index",20000);this.collapsedEl.hide({duration:.1});this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.el.setStyle("z-index","");this.afterSlide();if(this.split){this.split.el.show();}
 this.fireEvent("invalidated",this);this.fireEvent("expanded",this);},scope:this,block:true});},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;}}});
+//Roo/CenterLayoutRegion.js
 Roo.CenterLayoutRegion=function(A,B){Roo.LayoutRegion.call(this,A,B,"center");this.visible=true;this.minWidth=B.minWidth||20;this.minHeight=B.minHeight||20;};Roo.extend(Roo.CenterLayoutRegion,Roo.LayoutRegion,{hide:function(){},show:function(){},getMinWidth:function(){return this.minWidth;},getMinHeight:function(){return this.minHeight;}});Roo.NorthLayoutRegion=function(A,B){Roo.LayoutRegion.call(this,A,B,"north","n-resize");if(this.split){this.split.placement=Roo.SplitBar.TOP;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v");}var C=B.initialSize||B.height;if(typeof C!="undefined"){this.el.setHeight(C);}};Roo.extend(Roo.NorthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){A.height+=this.split.el.getHeight();}return A;},updateBox:function(A){if(this.split&&!this.collapsed){A.height-=this.split.el.getHeight();this.split.el.setLeft(A.x);this.split.el.setTop(A.y+A.height);this.split.el.setWidth(A.width);}if(this.collapsed){this.updateBody(A.width,null);}
 Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.SouthLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"south","s-resize");if(this.split){this.split.placement=Roo.SplitBar.BOTTOM;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v");}var C=B.initialSize||B.height;if(typeof C!="undefined"){this.el.setHeight(C);}};Roo.extend(Roo.SouthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){var sh=this.split.el.getHeight();A.height+=sh;A.y-=sh;}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sh=this.split.el.getHeight();A.height-=sh;A.y+=sh;this.split.el.setLeft(A.x);this.split.el.setTop(A.y-sh);this.split.el.setWidth(A.width);}if(this.collapsed){this.updateBody(A.width,null);}
 Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.EastLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"east","e-resize");if(this.split){this.split.placement=Roo.SplitBar.RIGHT;this.split.orientation=Roo.SplitBar.HORIZONTAL;this.split.el.addClass("x-layout-split-h");}var C=B.initialSize||B.width;if(typeof C!="undefined"){this.el.setWidth(C);}};Roo.extend(Roo.EastLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){var sw=this.split.el.getWidth();A.width+=sw;A.x-=sw;}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x);this.split.el.setTop(A.y);this.split.el.setHeight(A.height);A.x+=sw;}if(this.collapsed){this.updateBody(null,A.height);}
 Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.WestLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"west","w-resize");if(this.split){this.split.placement=Roo.SplitBar.LEFT;this.split.orientation=Roo.SplitBar.HORIZONTAL;this.split.el.addClass("x-layout-split-h");}var C=B.initialSize||B.width;if(typeof C!="undefined"){this.el.setWidth(C);}};Roo.extend(Roo.WestLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){A.width+=this.split.el.getWidth();}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x+A.width);this.split.el.setTop(A.y);this.split.el.setHeight(A.height);}if(this.collapsed){this.updateBody(null,A.height);}
 Roo.LayoutRegion.prototype.updateBox.call(this,A);}});
+//Roo/LayoutStateManager.js
 Roo.LayoutStateManager=function(A){this.state={north:{},south:{},east:{},west:{}};};Roo.LayoutStateManager.prototype={init:function(A,B){this.provider=B;var C=B.get(A.id+"-layout-state");if(C){var D=A.isUpdating();if(!D){A.beginUpdate();}for(var E in C){if(typeof C[E]!="function"){var F=C[E];var r=A.getRegion(E);if(r&&F){if(F.size){r.resizeTo(F.size);}if(F.collapsed==true){r.collapse(true);}else {r.expand(null,true);}}}}if(!D){A.endUpdate();}
 this.state=C;}
 this.layout=A;A.on("regionresized",this.onRegionResized,this);A.on("regioncollapsed",this.onRegionCollapsed,this);A.on("regionexpanded",this.onRegionExpanded,this);},storeState:function(){this.provider.set(this.layout.id+"-layout-state",this.state);},onRegionResized:function(A,B){this.state[A.getPosition()].size=B;this.storeState();},onRegionCollapsed:function(A){this.state[A.getPosition()].collapsed=true;this.storeState();},onRegionExpanded:function(A){this.state[A.getPosition()].collapsed=false;this.storeState();}};
+//Roo/ContentPanel.js
 Roo.ContentPanel=function(el,A,B){if(el.autoCreate){A=el;el=Roo.id();}
 this.el=Roo.get(el);if(!this.el&&A&&A.autoCreate){if(typeof A.autoCreate=="object"){if(!A.autoCreate.id){A.autoCreate.id=A.id||el;}
 this.el=Roo.DomHelper.append(document.body,A.autoCreate,true);}else {this.el=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-inactive-content",id:A.id||el},true);}}
@@ -871,7 +976,9 @@ A.monitorWindowResize=false;A.autoHeight=false;A.autoWidth=false;this.grid=A;thi
 this.fireEvent("activate",this);if(!this.layout){return;}var B=false;for(var r in this.layout.regions){B=this.layout.getRegion(r);if(B.getActivePanel()){B.setActivePanel(B.getActivePanel());continue;}if(!B.panels.length){continue;}
 B.showPanel(B.getPanel(0));}},getLayout:function(){return this.layout;},addxtype:function(A){return this.layout.addxtype(A);}});Roo.ScrollPanel=function(el,A,B){A=A||{};A.fitToFrame=true;Roo.ScrollPanel.superclass.constructor.call(this,el,A,B);this.el.dom.style.overflow="hidden";var C=this.el.wrap({cls:"x-scroller x-layout-inactive-content"});this.el.removeClass("x-layout-inactive-content");this.el.on("mousewheel",this.onWheel,this);var up=C.createChild({cls:"x-scroller-up",html:"&#160;"},this.el.dom);var D=C.createChild({cls:"x-scroller-down",html:"&#160;"});up.unselectable();D.unselectable();up.on("click",this.scrollUp,this);D.on("click",this.scrollDown,this);up.addClassOnOver("x-scroller-btn-over");D.addClassOnOver("x-scroller-btn-over");up.addClassOnClick("x-scroller-btn-click");D.addClassOnClick("x-scroller-btn-click");this.adjustments=[0,-(up.getHeight()+D.getHeight())];this.resizeEl=this.el;this.el=C;this.up=up;this.down=D;};Roo.extend(Roo.ScrollPanel,Roo.ContentPanel,{increment:100,wheelIncrement:5,scrollUp:function(){this.resizeEl.scroll("up",this.increment,{callback:this.afterScroll,scope:this});},scrollDown:function(){this.resizeEl.scroll("down",this.increment,{callback:this.afterScroll,scope:this});},afterScroll:function(){var el=this.resizeEl;var t=el.dom.scrollTop,h=el.dom.scrollHeight,ch=el.dom.clientHeight;this.up[t==0?"addClass":"removeClass"]("x-scroller-btn-disabled");this.down[h-t<=ch?"addClass":"removeClass"]("x-scroller-btn-disabled");},setSize:function(){Roo.ScrollPanel.superclass.setSize.apply(this,arguments);this.afterScroll();},onWheel:function(e){var d=e.getWheelDelta();this.resizeEl.dom.scrollTop-=(d*this.wheelIncrement);this.afterScroll();e.stopEvent();},setContent:function(A,B){this.resizeEl.update(A,B);}});Roo.TreePanel=function(A){var el=A.el;var B=A.tree;delete A.tree;delete A.el;var C=el.createChild();A.resizeEl=C;Roo.TreePanel.superclass.constructor.call(this,el,A);this.tree=new Roo.tree.TreePanel(C,B);this.on('activate',function(){if(this.tree.rendered){return;}
 this.tree.render();});this.on('resize',function(cp,w,h){this.tree.innerCt.setWidth(w);this.tree.innerCt.setHeight(h);this.tree.innerCt.setStyle('overflow-y','auto');});};Roo.extend(Roo.TreePanel,Roo.ContentPanel,{fitToFrame:true,autoScroll:true});
+//Roo/ReaderLayout.js
 Roo.ReaderLayout=function(A,B){var c=A||{size:{}};Roo.ReaderLayout.superclass.constructor.call(this,B||document.body,{north:c.north!==false?Roo.apply({split:false,initialSize:32,titlebar:false},c.north):false,west:c.west!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:5,right:0,bottom:5,top:5},cmargins:{left:5,right:5,bottom:5,top:5}},c.west):false,east:c.east!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:0,right:5,bottom:5,top:5},cmargins:{left:5,right:5,bottom:5,top:5}},c.east):false,center:Roo.apply({tabPosition:'top',autoScroll:false,closeOnTab:true,titlebar:false,margins:{left:c.west!==false?0:5,right:c.east!==false?0:5,bottom:5,top:2}},c.center)});this.el.addClass('x-reader');this.beginUpdate();var C=new Roo.BorderLayout(Roo.get(document.body).createChild(),{south:c.preview!==false?Roo.apply({split:true,initialSize:200,minSize:100,autoScroll:true,collapsible:true,titlebar:true,cmargins:{top:5,left:0,right:0,bottom:0}},c.preview):false,center:Roo.apply({autoScroll:false,titlebar:false,minHeight:200},c.listView)});this.add('center',new Roo.NestedLayoutPanel(C,Roo.apply({title:c.mainTitle||'',tabTip:''},c.innerPanelCfg)));this.endUpdate();this.regions.preview=C.getRegion('south');this.regions.listView=C.getRegion('center');};Roo.extend(Roo.ReaderLayout,Roo.BorderLayout);
+//Roo/grid/Grid.js
 Roo.grid.Grid=function(A,B){this.container=Roo.get(A);this.container.update("");this.container.setStyle("overflow","hidden");this.container.addClass('x-grid-container');this.id=this.container.id;Roo.apply(this,B);if(this.ds){this.dataSource=this.ds;delete this.ds;}if(this.cm){this.colModel=this.cm;delete this.cm;}if(this.sm){this.selModel=this.sm;delete this.sm;}if(this.selModel){this.selModel=Roo.factory(this.selModel,Roo.grid);this.sm=this.selModel;this.sm.xmodule=this.xmodule||false;}if(typeof(this.colModel.config)=='undefined'){this.colModel=new Roo.grid.ColumnModel(this.colModel);this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;}if(this.dataSource){this.dataSource=Roo.factory(this.dataSource,Roo.data);this.ds=this.dataSource;this.ds.xmodule=this.xmodule||false;}if(this.width){this.container.setWidth(this.width);}if(this.height){this.container.setHeight(this.height);}
 this.addEvents({"click":true,"dblclick":true,"contextmenu":true,"mousedown":true,"mouseup":true,"mouseover":true,"mouseout":true,"keypress":true,"keydown":true,"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclick":true,"headerclick":true,"headerdblclick":true,"rowcontextmenu":true,"cellcontextmenu":true,"headercontextmenu":true,"bodyscroll":true,"columnresize":true,"columnmove":true,"startdrag":true,"enddrag":true,"dragdrop":true,"dragover":true,"dragenter":true,"dragout":true,'rowclass':true,'render':true});Roo.grid.Grid.superclass.constructor.call(this);};Roo.extend(Roo.grid.Grid,Roo.util.Observable,{minColumnWidth:25,autoSizeColumns:false,autoSizeHeaders:true,monitorWindowResize:true,maxRowsToMeasure:0,trackMouseOver:true,enableDragDrop:false,enableColumnMove:true,enableColumnHide:true,enableRowHeightSync:false,stripeRows:true,autoHeight:false,autoExpandColumn:false,autoExpandMin:50,autoExpandMax:1000,view:null,loadMask:false,dropTarget:false,rendered:false,render:function(){var c=this.container;if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){this.autoHeight=true;}var A=this.getView();A.init(this);c.on("click",this.onClick,this);c.on("dblclick",this.onDblClick,this);c.on("contextmenu",this.onContextMenu,this);c.on("keydown",this.onKeyDown,this);this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource},this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true);this.footer=Roo.factory(this.footer,Roo);}if(this.dropTarget&&this.dropTarget.xtype){delete this.dropTarget.xtype;this.dropTarget=new Ext.dd.DropTarget(this.getView().mainBody,this.dropTarget);}
 this.rendered=true;this.fireEvent('render',this);return this;},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}
@@ -883,15 +990,19 @@ A--;}}else {if(B>=E){A++;G=false;}while(A<F){if(!G){B=0;}
 G=false;while(B<E){if(fn.call(D||this,A,B,cm)===true){return [A,B];}
 B++;}
 A++;}}return null;},getSelections:function(){return this.selModel.getSelections();},autoSize:function(){if(this.rendered){this.view.layout();if(this.view.adjustForScroll){this.view.adjustForScroll();}}},getGridEl:function(){return this.container;},stopEditing:function(){},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.grid.RowSelectionModel();}return this.selModel;},getDataSource:function(){return this.dataSource;},getColumnModel:function(){return this.colModel;},getView:function(){if(!this.view){this.view=new Roo.grid.GridView(this.viewConfig);}return this.view;},getDragDropText:function(){var A=this.selModel.getCount();return String.format(this.ddText,A,A==1?'':'s');}});Roo.grid.Grid.prototype.ddText="{0} selected row{1}";
+//Roo/grid/AbstractGridView.js
 Roo.grid.AbstractGridView=function(){this.grid=null;this.events={"beforerowremoved":true,"beforerowsinserted":true,"beforerefresh":true,"rowremoved":true,"rowsinserted":true,"rowupdated":true,"refresh":true};Roo.grid.AbstractGridView.superclass.constructor.call(this);};Roo.extend(Roo.grid.AbstractGridView,Roo.util.Observable,{rowClass:"x-grid-row",cellClass:"x-grid-cell",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-hd-split",init:function(A){this.grid=A;var B=this.grid.getGridEl().id;this.colSelector="#"+B+" ."+this.cellClass+"-";this.tdSelector="#"+B+" ."+this.tdClass+"-";this.hdSelector="#"+B+" ."+this.hdClass+"-";this.splitSelector="#"+B+" ."+this.splitClass+"-";},getColumnRenderers:function(){var A=[];var cm=this.grid.colModel;var B=cm.getColumnCount();for(var i=0;i<B;i++){A[i]=cm.getRenderer(i);}return A;},getColumnIds:function(){var A=[];var cm=this.grid.colModel;var B=cm.getColumnCount();for(var i=0;i<B;i++){A[i]=cm.getColumnId(i);}return A;},getDataIndexes:function(){if(!this.indexMap){this.indexMap=this.buildIndexMap();}return this.indexMap.colToData;},getColumnIndexByDataIndex:function(A){if(!this.indexMap){this.indexMap=this.buildIndexMap();}return this.indexMap.dataToCol[A];},setCSSStyle:function(A,B,C){var D="#"+this.grid.id+" .x-grid-col-"+A;Roo.util.CSS.updateRule(D,B,C);},generateRules:function(cm){var A=[],B=this.grid.id+'-cssrules';Roo.util.CSS.removeStyleSheet(B);for(var i=0,C=cm.getColumnCount();i<C;i++){var D=cm.getColumnId(i);A.push(this.colSelector,D," {\n",cm.config[i].css,"}\n",this.tdSelector,D," {\n}\n",this.hdSelector,D," {\n}\n",this.splitSelector,D," {\n}\n");}return Roo.util.CSS.createStyleSheet(A.join(""),B);}});
+//Roo/grid/HeaderDragZone.js
 Roo.grid.HeaderDragZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDragZone.superclass.constructor.call(this,hd);if(B){this.setHandleElId(Roo.id(hd));this.setOuterHandleElId(Roo.id(B));}
 this.scroll=false;};Roo.extend(Roo.grid.HeaderDragZone,Roo.dd.DragZone,{maxDragWidth:120,getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var h=this.view.findHeaderCell(t);if(h){return {ddel:h.firstChild,header:h};}return false;},onInitDrag:function(e){this.view.headersDisabled=true;var A=this.dragData.ddel.cloneNode(true);A.id=Roo.id();A.style.width=Math.min(this.dragData.header.offsetWidth,this.maxDragWidth)+"px";this.proxy.update(A);return true;},afterValidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;},50);},afterInvalidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;},50);}});
+//Roo/grid/HeaderDropZone.js
 Roo.grid.HeaderDropZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.proxyTop=Roo.DomHelper.append(document.body,{cls:"col-move-top",html:"&#160;"},true);this.proxyBottom=Roo.DomHelper.append(document.body,{cls:"col-move-bottom",html:"&#160;"},true);this.proxyTop.hide=this.proxyBottom.hide=function(){this.setLeftTop(-100,-100);this.setStyle("visibility","hidden");};this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDropZone.superclass.constructor.call(this,A.getGridEl().dom);};Roo.extend(Roo.grid.HeaderDropZone,Roo.dd.DropZone,{proxyOffsets:[-4,-9],fly:Roo.Element.fly,getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);var A=this.view.findCellIndex(t);if(A!==false){return this.view.getHeaderCell(A);}return null;},nextVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.nextSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}
 h=h.nextSibling;}return null;},prevVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.prevSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}
 h=h.prevSibling;}return null;},positionIndicator:function(h,n,e){var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);var px,pt,py=r.top+this.proxyOffsets[1];if((r.right-x)<=(r.right-r.left)/2){px=r.right+this.view.borderWidth;pt="after";}else {px=r.left;pt="before";}var A=this.view.getCellIndex(h);var B=this.view.getCellIndex(n);if(this.grid.colModel.isFixed(B)){return false;}var C=this.grid.colModel.isLocked(B);if(pt=="after"){B++;}if(A<B){B--;}if(A==B&&(C==this.grid.colModel.isLocked(A))){return false;}
 px+=this.proxyOffsets[0];this.proxyTop.setLeftTop(px,py);this.proxyTop.show();if(!this.bottomOffset){this.bottomOffset=this.view.mainHd.getHeight();}
 this.proxyBottom.setLeftTop(px,py+this.proxyTop.dom.offsetHeight+this.bottomOffset);this.proxyBottom.show();return pt;},onNodeEnter:function(n,dd,e,A){if(A.header!=n){this.positionIndicator(A.header,n,e);}},onNodeOver:function(n,dd,e,A){var B=false;if(A.header!=n){B=this.positionIndicator(A.header,n,e);}if(!B){this.proxyTop.hide();this.proxyBottom.hide();}return B?this.dropAllowed:this.dropNotAllowed;},onNodeOut:function(n,dd,e,A){this.proxyTop.hide();this.proxyBottom.hide();},onNodeDrop:function(n,dd,e,A){var h=A.header;if(h!=n){var cm=this.grid.colModel;var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);var pt=(r.right-x)<=((r.right-r.left)/2)?"after":"before";var B=this.view.getCellIndex(h);var C=this.view.getCellIndex(n);var D=cm.isLocked(C);if(pt=="after"){C++;}if(B<C){C--;}if(B==C&&(D==cm.isLocked(B))){return false;}
 cm.setLocked(B,D,true);cm.moveColumn(B,C);this.grid.fireEvent("columnmove",B,C);return true;}return false;}});
+//Roo/grid/GridView.js
 Roo.grid.GridView=function(A){Roo.grid.GridView.superclass.constructor.call(this);this.el=null;Roo.apply(this,A);};Roo.extend(Roo.grid.GridView,Roo.grid.AbstractGridView,{rowClass:"x-grid-row",cellClass:"x-grid-col",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-split",sortClasses:["sort-asc","sort-desc"],enableMoveAnim:false,hlColor:"C3DAF9",dh:Roo.DomHelper,fly:Roo.Element.fly,css:Roo.util.CSS,borderWidth:1,splitOffset:3,scrollIncrement:22,cellRE:/(?:.*?)x-grid-(?:hd|cell|csplit)-(?:[\d]+)-([\d]+)(?:.*?)/,findRE:/\s?(?:x-grid-hd|x-grid-col|x-grid-csplit)\s/,bind:function(ds,cm){if(this.ds){this.ds.un("load",this.onLoad,this);this.ds.un("datachanged",this.onDataChange,this);this.ds.un("add",this.onAdd,this);this.ds.un("remove",this.onRemove,this);this.ds.un("update",this.onUpdate,this);this.ds.un("clear",this.onClear,this);}if(ds){ds.on("load",this.onLoad,this);ds.on("datachanged",this.onDataChange,this);ds.on("add",this.onAdd,this);ds.on("remove",this.onRemove,this);ds.on("update",this.onUpdate,this);ds.on("clear",this.onClear,this);}
 this.ds=ds;if(this.cm){this.cm.un("widthchange",this.onColWidthChange,this);this.cm.un("headerchange",this.onHeaderChange,this);this.cm.un("hiddenchange",this.onHiddenChange,this);this.cm.un("columnmoved",this.onColumnMove,this);this.cm.un("columnlockchange",this.onColumnLock,this);}if(cm){this.generateRules(cm);cm.on("widthchange",this.onColWidthChange,this);cm.on("headerchange",this.onHeaderChange,this);cm.on("hiddenchange",this.onHiddenChange,this);cm.on("columnmoved",this.onColumnMove,this);cm.on("columnlockchange",this.onColumnLock,this);}
 this.cm=cm;},init:function(A){Roo.grid.GridView.superclass.init.call(this,A);this.bind(A.dataSource,A.colModel);A.on("headerclick",this.handleHeaderClick,this);if(A.trackMouseOver){A.on("mouseover",this.onRowOver,this);A.on("mouseout",this.onRowOut,this);}
@@ -937,14 +1048,19 @@ this.updateHeaderSortState();this.beforeInitialResize();this.layout(true);this.r
 c.setHeight(I);}if(g.autoWidth){c.setWidth(cm.getTotalWidth()+c.getBorderWidth('lr'));}var s=this.scroller;var J=c.getSize(true);this.el.setSize(J.width,J.height);this.headerPanel.setWidth(J.width);this.footerPanel.setWidth(J.width);var K=this.mainHd.getHeight();var vw=J.width;var vh=J.height-(G+H);s.setSize(vw,vh);var bt=this.getBodyTable();var L=F?Math.max(this.getLockedTable().offsetWidth,this.lockedHd.dom.firstChild.offsetWidth):0;var M=bt.offsetHeight;var N=L+bt.offsetWidth;var O=false,P=false;this.scrollSizer.setSize(N,M+K);var lw=this.lockedWrap,mw=this.mainWrap;var lb=this.lockedBody,mb=this.mainBody;setTimeout(function(){var t=s.dom.offsetTop;var w=s.dom.clientWidth,h=s.dom.clientHeight;lw.setTop(t);lw.setSize(L,h);mw.setLeftTop(L,t);mw.setSize(w-L,h);lb.setHeight(h-K);mb.setHeight(h-K);if(B!==true&&!gv.userResized&&E){var ci=cm.getIndexById(E);if(ci<0){ci=cm.findColumnIndex(E);}
 ci=Math.max(0,ci);var Q=cm.getColumnId(ci);var tw=cm.getTotalWidth(false);var R=cm.getColumnWidth(ci);var cw=Math.min(Math.max(((w-tw)+R-2)-(w<=s.dom.offsetWidth?0:18),g.autoExpandMin),g.autoExpandMax);if(R!=cw){cm.setColumnWidth(ci,cw,true);gv.css.updateRule(gv.colSelector+gv.idToCssName(Q),"width",(cw-gv.borderWidth)+"px");gv.css.updateRule(gv.hdSelector+gv.idToCssName(Q),"width",(cw-gv.borderWidth)+"px");gv.updateSplitters();gv.layout(false,true);}}if(A){lw.show();mw.show();}},10);},onWindowResize:function(){if(!this.grid.monitorWindowResize||this.grid.autoHeight){return;}
 this.layout();},appendFooter:function(A){return null;},sortAscText:"Sort Ascending",sortDescText:"Sort Descending",lockText:"Lock Column",unlockText:"Unlock Column",columnsText:"Columns"});Roo.grid.GridView.ColumnDragZone=function(A,hd){Roo.grid.GridView.ColumnDragZone.superclass.constructor.call(this,A,hd,null);this.proxy.el.addClass('x-grid3-col-dd');};Roo.extend(Roo.grid.GridView.ColumnDragZone,Roo.grid.HeaderDragZone,{handleMouseDown:function(e){},callHandleMouseDown:function(e){Roo.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this,e);}});
+//Roo/grid/SplitDragZone.js
 Roo.grid.SplitDragZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.proxy=this.view.resizeProxy;Roo.grid.SplitDragZone.superclass.constructor.call(this,hd,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Roo.id(this.proxy.dom),resizeFrame:false});this.setHandleElId(Roo.id(hd));this.setOuterHandleElId(Roo.id(B));this.scroll=false;};Roo.extend(Roo.grid.SplitDragZone,Roo.dd.DDProxy,{fly:Roo.Element.fly,b4StartDrag:function(x,y){this.view.headersDisabled=true;this.proxy.setHeight(this.view.mainWrap.getHeight());var w=this.cm.getColumnWidth(this.cellIndex);var A=Math.max(w-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(A,1000);this.setYConstraint(0,0);this.minX=x-A;this.maxX=x+1000;this.startPos=x;Roo.dd.DDProxy.prototype.b4StartDrag.call(this,x,y);},handleMouseDown:function(e){ev=Roo.EventObject.setEvent(e);var t=this.fly(ev.getTarget());if(t.hasClass("x-grid-split")){this.cellIndex=this.view.getCellIndex(t.dom);this.split=t.dom;this.cm=this.grid.colModel;if(this.cm.isResizable(this.cellIndex)&&!this.cm.isFixed(this.cellIndex)){Roo.grid.SplitDragZone.superclass.handleMouseDown.apply(this,arguments);}}},endDrag:function(e){this.view.headersDisabled=false;var A=Math.max(this.minX,Roo.lib.Event.getPageX(e));var B=A-this.startPos;this.view.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+B);},autoOffset:function(){this.setDelta(0,0);}});
+//Roo/grid/GridDragZone.js
 Roo.grid.GridDragZone=function(A,B){this.view=A.getView();Roo.grid.GridDragZone.superclass.constructor.call(this,this.view.mainBody.dom,B);if(this.view.lockedBody){this.setHandleElId(Roo.id(this.view.mainBody.dom));this.setOuterHandleElId(Roo.id(this.view.lockedBody.dom));}
 this.scroll=false;this.grid=A;this.ddel=document.createElement('div');this.ddel.className='x-grid-dd-wrap';};Roo.extend(Roo.grid.GridDragZone,Roo.dd.DragZone,{ddGroup:"GridDD",getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var A=this.view.findRowIndex(t);if(A!==false){var sm=this.grid.selModel;if(e.hasModifier()){sm.handleMouseDown(e,t);}return {grid:this.grid,ddel:this.ddel,rowIndex:A,selections:sm.getSelections()};}return false;},onInitDrag:function(e){var A=this.dragData;this.ddel.innerHTML=this.grid.getDragDropText();this.proxy.update(this.ddel);},afterRepair:function(){this.dragging=false;},getRepairXY:function(e,A){return false;},onEndDrag:function(A,e){},onValidDrop:function(dd,e,id){this.hideProxy();},beforeInvalidDrop:function(e,id){}});
+//Roo/grid/ColumnModel.js
 Roo.grid.ColumnModel=function(A){this.config=A;this.lookup={};for(var i=0,B=A.length;i<B;i++){var c=A[i];if(typeof c.dataIndex=="undefined"){c.dataIndex=i;}if(typeof c.renderer=="string"){c.renderer=Roo.util.Format[c.renderer];}if(typeof c.id=="undefined"){c.id=Roo.id();}if(c.editor&&c.editor.xtype){c.editor=Roo.factory(c.editor,Roo.grid);}if(c.editor&&c.editor.isFormField){c.editor=new Roo.grid.GridEditor(c.editor);}
 this.lookup[c.id]=c;}
 this.defaultWidth=100;this.defaultSortable=false;this.addEvents({"widthchange":true,"headerchange":true,"hiddenchange":true,"columnmoved":true,"columnlockchange":true});Roo.grid.ColumnModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.ColumnModel,Roo.util.Observable,{getColumnId:function(A){return this.config[A].id;},getColumnById:function(id){return this.lookup[id];},getColumnByDataIndex:function(A){var B=this.findColumnIndex(A);return B>-1?this.config[B]:false;},getIndexById:function(id){for(var i=0,A=this.config.length;i<A;i++){if(this.config[i].id==id){return i;}}return -1;},findColumnIndex:function(A){for(var i=0,B=this.config.length;i<B;i++){if(this.config[i].dataIndex==A){return i;}}return -1;},moveColumn:function(A,B){var c=this.config[A];this.config.splice(A,1);this.config.splice(B,0,c);this.dataMap=null;this.fireEvent("columnmoved",this,A,B);},isLocked:function(A){return this.config[A].locked===true;},setLocked:function(A,B,C){if(this.isLocked(A)==B){return;}
 this.config[A].locked=B;if(!C){this.fireEvent("columnlockchange",this,A,B);}},getTotalLockedWidth:function(){var A=0;for(var i=0;i<this.config.length;i++){if(this.isLocked(i)&&!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}return A;},getLockedCount:function(){for(var i=0,A=this.config.length;i<A;i++){if(!this.isLocked(i)){return i;}}},getColumnCount:function(A){if(A===true){var c=0;for(var i=0,B=this.config.length;i<B;i++){if(!this.isHidden(i)){c++;}}return c;}return this.config.length;},getColumnsBy:function(fn,A){var r=[];for(var i=0,B=this.config.length;i<B;i++){var c=this.config[i];if(fn.call(A||this,c,i)===true){r[r.length]=c;}}return r;},isSortable:function(A){if(typeof this.config[A].sortable=="undefined"){return this.defaultSortable;}return this.config[A].sortable;},getRenderer:function(A){if(!this.config[A].renderer){return Roo.grid.ColumnModel.defaultRenderer;}return this.config[A].renderer;},setRenderer:function(A,fn){this.config[A].renderer=fn;},getColumnWidth:function(A){return this.config[A].width*1||this.defaultWidth;},setColumnWidth:function(A,B,C){this.config[A].width=B;this.totalWidth=null;if(!C){this.fireEvent("widthchange",this,A,B);}},getTotalWidth:function(A){if(!this.totalWidth){this.totalWidth=0;for(var i=0,B=this.config.length;i<B;i++){if(A||!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}}return this.totalWidth;},getColumnHeader:function(A){return this.config[A].header;},setColumnHeader:function(A,B){this.config[A].header=B;this.fireEvent("headerchange",this,A,B);},getColumnTooltip:function(A){return this.config[A].tooltip;},setColumnTooltip:function(A,B){this.config[A].tooltip=B;},getDataIndex:function(A){return this.config[A].dataIndex;},setDataIndex:function(A,B){this.config[A].dataIndex=B;},isCellEditable:function(A,B){return (this.config[A].editable||(typeof this.config[A].editable=="undefined"&&this.config[A].editor))?true:false;},getCellEditor:function(A,B){return this.config[A].editor;},setEditable:function(A,B){this.config[A].editable=B;},isHidden:function(A){return this.config[A].hidden;},isFixed:function(A){return this.config[A].fixed;},isResizable:function(A){return A>=0&&this.config[A].resizable!==false&&this.config[A].fixed!==true;},setHidden:function(A,B){this.config[A].hidden=B;this.totalWidth=null;this.fireEvent("hiddenchange",this,A,B);},setEditor:function(A,B){this.config[A].editor=B;}});Roo.grid.ColumnModel.defaultRenderer=function(A){if(typeof A=="string"&&A.length<1){return "&#160;";}return A;};Roo.grid.DefaultColumnModel=Roo.grid.ColumnModel;
+//Roo/grid/AbstractSelectionModel.js
 Roo.grid.AbstractSelectionModel=function(){this.locked=false;Roo.grid.AbstractSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.AbstractSelectionModel,Roo.util.Observable,{init:function(A){this.grid=A;this.initEvents();},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;}});
+//Roo/grid/RowSelectionModel.js
 Roo.grid.RowSelectionModel=function(A){Roo.apply(this,A);this.selections=new Roo.util.MixedCollection(false,function(o){return o.id;});this.last=false;this.lastActive=false;this.addEvents({"selectionchange":true,"afterselectionchange":true,"beforerowselect":true,"rowselect":true,"rowdeselect":true});Roo.grid.RowSelectionModel.superclass.constructor.call(this);this.locked=false;};Roo.extend(Roo.grid.RowSelectionModel,Roo.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("mousedown",this.handleMouseDown,this);}else {this.grid.on("rowclick",this.handleDragableRowClick,this);}
 this.rowNav=new Roo.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
 this.fireEvent("afterselectionchange",this);},"down":function(e){if(!e.shiftKey){this.selectNext(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
@@ -953,26 +1069,33 @@ this.last=false;},selectAll:function(){if(this.locked)return;this.selections.cle
 this.fireEvent("afterselectionchange",this);},handleDragableRowClick:function(A,B,e){if(e.button===0&&!e.shiftKey&&!e.ctrlKey){this.selectRow(B,false);A.view.focusRow(B);this.fireEvent("afterselectionchange",this);}},selectRows:function(A,B){if(!B){this.clearSelections();}for(var i=0,C=A.length;i<C;i++){this.selectRow(A[i],true);}},selectRange:function(A,B,C){if(this.locked)return;if(!C){this.clearSelections();}if(A<=B){for(var i=A;i<=B;i++){this.selectRow(i,true);}}else {for(var i=A;i>=B;i--){this.selectRow(i,true);}}},deselectRange:function(A,B,C){if(this.locked)return;for(var i=A;i<=B;i++){this.deselectRow(i,C);}},selectRow:function(A,B,C){if(this.locked||(A<0||A>=this.grid.dataSource.getCount()))return;if(this.fireEvent("beforerowselect",this,A,B)!==false){if(!B||this.singleSelect){this.clearSelections();}var r=this.grid.dataSource.getAt(A);this.selections.add(r);this.last=this.lastActive=A;if(!C){this.grid.getView().onRowSelect(A);}
 this.fireEvent("rowselect",this,A,r);this.fireEvent("selectionchange",this);}},deselectRow:function(A,B){if(this.locked)return;if(this.last==A){this.last=false;}if(this.lastActive==A){this.lastActive=false;}var r=this.grid.dataSource.getAt(A);this.selections.remove(r);if(!B){this.grid.getView().onRowDeselect(A);}
 this.fireEvent("rowdeselect",this,A);this.fireEvent("selectionchange",this);},restoreLast:function(){if(this._last){this.last=this._last;}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(k==e.TAB){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}}else if(k==e.ENTER&&!e.ctrlKey){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row-1,ed.col,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row+1,ed.col,1,this.acceptsNav,this);}}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing(B[0],B[1]);}}});
+//Roo/grid/CellSelectionModel.js
 Roo.grid.CellSelectionModel=function(A){Roo.apply(this,A);this.selection=null;this.addEvents({"beforecellselect":true,"cellselect":true,"selectionchange":true,"tabend":true});Roo.grid.CellSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.CellSelectionModel,Roo.grid.AbstractSelectionModel,{enter_is_tab:false,initEvents:function(){this.grid.on("mousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Roo.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this);}},beforeEdit:function(e){this.select(e.row,e.column,false,true,e.record);},onRowUpdated:function(v,A,r){if(this.selection&&this.selection.record==r){v.onCellSelect(A,this.selection.cell[1]);}},onViewChange:function(){this.clearSelections(true);},getSelectedCell:function(){return this.selection?this.selection.cell:null;},clearSelections:function(A){var s=this.selection;if(s){if(A!==true){this.grid.view.onCellDeselect(s.cell[0],s.cell[1]);}
 this.selection=null;this.fireEvent("selectionchange",this,null);}},hasSelection:function(){return this.selection?true:false;},handleMouseDown:function(e,t){var v=this.grid.getView();if(this.isLocked()){return;};var A=v.findRowIndex(t);var B=v.findCellIndex(t);if(A!==false&&B!==false){this.select(A,B);}},select:function(A,B,C,D,r){if(this.fireEvent("beforecellselect",this,A,B)!==false){this.clearSelections();r=r||this.grid.dataSource.getAt(A);this.selection={record:r,cell:[A,B]};if(!C){var v=this.grid.getView();v.onCellSelect(A,B);if(D!==true){v.focusCell(A,B);}}
 this.fireEvent("cellselect",this,A,B);this.fireEvent("selectionchange",this,this.selection);}},isSelectable:function(A,B,cm){return !cm.isHidden(B);},handleKeyDown:function(e){if(!e.isNavKeyPress()){return;}var g=this.grid,s=this.selection;if(!s){e.stopEvent();var A=g.walkCells(0,0,1,this.isSelectable,this);if(A){this.select(A[0],A[1]);}return;}var sm=this;var B=function(D,E,F){return g.walkCells(D,E,F,sm.isSelectable,sm);};var k=e.getKey(),r=s.cell[0],c=s.cell[1];var C;switch(k){case e.TAB:if(g.isEditor&&g.editing){return;}if(e.shiftKey){C=B(r,c-1,-1);}else {C=B(r,c+1,1);}break;case e.DOWN:C=B(r+1,c,1);break;case e.UP:C=B(r-1,c,-1);break;case e.RIGHT:C=B(r,c+1,1);break;case e.LEFT:C=B(r,c-1,-1);break;case e.ENTER:if(g.isEditor&&!g.editing){g.startEditing(r,c);e.stopEvent();return;}break;};if(C){this.select(C[0],C[1]);e.stopEvent();}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor,C=false;if(this.enter_is_tab&&k==e.ENTER){k=e.TAB;}if(k==e.TAB){if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);C=true;}
 e.stopEvent();}else if(k==e.ENTER&&!e.ctrlKey){ed.completeEdit();e.stopEvent();B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing.defer(100,g,[B[0],B[1]]);}else if(C){this.fireEvent.defer(100,this,['tabend',this]);}}});
+//Roo/grid/EditorGrid.js
 Roo.grid.EditorGrid=function(A,B){Roo.grid.EditorGrid.superclass.constructor.call(this,A,B);this.getGridEl().addClass("xedit-grid");if(!this.selModel){this.selModel=new Roo.grid.CellSelectionModel();}
 this.activeEditor=null;this.addEvents({"beforeedit":true,"afteredit":true,"validateedit":true});this.on("bodyscroll",this.stopEditing,this);this.on(this.clicksToEdit==1?"cellclick":"celldblclick",this.onCellDblClick,this);};Roo.extend(Roo.grid.EditorGrid,Roo.grid.Grid,{clicksToEdit:2,isEditor:true,trackMouseOver:false,onCellDblClick:function(g,A,B){this.startEditing(A,B);},onEditComplete:function(ed,A,B){this.editing=false;this.activeEditor=null;ed.un("specialkey",this.selModel.onEditorKey,this.selModel);var r=ed.record;var C=this.colModel.getDataIndex(ed.col);var e={grid:this,record:r,field:C,originalValue:B,value:A,row:ed.row,column:ed.col,cancel:false,editor:ed};var D=Roo.get(this.view.getCell(ed.row,ed.col))
 D.show();if(String(A)!==String(B)){if(this.fireEvent("validateedit",e)!==false&&!e.cancel){r.set(C,e.value);if(ed.field.displayField&&ed.field.name){r.set(ed.field.name,ed.field.el.dom.value);}delete e.cancel;this.fireEvent("afteredit",e);}}else {this.fireEvent("afteredit",e);}
 this.view.focusCell(ed.row,ed.col);},startEditing:function(A,B){this.stopEditing();if(this.colModel.isCellEditable(B,A)){this.view.ensureVisible(A,B,true);var r=this.dataSource.getAt(A);var C=this.colModel.getDataIndex(B);var D=Roo.get(this.view.getCell(A,B));var e={grid:this,record:r,field:C,value:r.data[C],row:A,column:B,cancel:false};if(this.fireEvent("beforeedit",e)!==false&&!e.cancel){this.editing=true;var ed=this.colModel.getCellEditor(B,A);if(!ed){return;}if(!ed.rendered){ed.render(ed.parentEl||document.body);}
 ed.field.reset();D.hide();(function(){ed.row=A;ed.col=B;ed.record=r;ed.on("complete",this.onEditComplete,this,{single:true});ed.on("specialkey",this.selModel.onEditorKey,this.selModel);this.activeEditor=ed;var v=r.data[C];ed.startEdit(this.view.getCell(A,B),v);if(ed.field.displayField&&ed.field.name){ed.field.el.dom.value=r.data[ed.field.name];}}).defer(50,this);}}},stopEditing:function(){if(this.activeEditor){this.activeEditor.completeEdit();}
 this.activeEditor=null;}});
+//Roo/grid/GridEditor.js
 Roo.grid.GridEditor=function(A,B){if(!B&&A.field){B=A;A=Roo.factory(B.field,Roo.form);}
 Roo.grid.GridEditor.superclass.constructor.call(this,A,B);A.monitorTab=false;};Roo.extend(Roo.grid.GridEditor,Roo.Editor,{alignment:"tl-tl",autoSize:"width",hideEl:false,cls:"x-small-editor x-grid-editor",shim:false,shadow:"frame"});
+//Roo/grid/PropertyGrid.js
 Roo.grid.PropertyRecord=Roo.data.Record.create([{name:'name',type:'string'},'value']);Roo.grid.PropertyStore=function(A,B){this.grid=A;this.store=new Roo.data.Store({recordType:Roo.grid.PropertyRecord});this.store.on('update',this.onUpdate,this);if(B){this.setSource(B);}
 Roo.grid.PropertyStore.superclass.constructor.call(this);};Roo.extend(Roo.grid.PropertyStore,Roo.util.Observable,{setSource:function(o){this.source=o;this.store.removeAll();var A=[];for(var k in o){if(this.isEditableValue(o[k])){A.push(new Roo.grid.PropertyRecord({name:k,value:o[k]},k));}}
 this.store.loadRecords({records:A},{},true);},onUpdate:function(ds,A,B){if(B==Roo.data.Record.EDIT){var v=A.data['value'];var C=A.modified['value'];if(this.grid.fireEvent('beforepropertychange',this.source,A.id,v,C)!==false){this.source[A.id]=v;A.commit();this.grid.fireEvent('propertychange',this.source,A.id,v,C);}else {A.reject();}}},getProperty:function(A){return this.store.getAt(A);},isEditableValue:function(A){if(A&&A instanceof Date){return true;}else if(typeof A=='object'||typeof A=='function'){return false;}return true;},setValue:function(A,B){this.source[A]=B;this.store.getById(A).set('value',B);},getSource:function(){return this.source;}});Roo.grid.PropertyColumnModel=function(A,B){this.grid=A;var g=Roo.grid;g.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,sortable:true,dataIndex:'name',id:'name'},{header:this.valueText,resizable:false,dataIndex:'value',id:'value'}]);this.store=B;this.bselect=Roo.DomHelper.append(document.body,{tag:'select',style:'display:none',cls:'x-grid-editor',children:[{tag:'option',value:'true',html:'true'},{tag:'option',value:'false',html:'false'}]});Roo.id(this.bselect);var f=Roo.form;this.editors={'date':new g.GridEditor(new f.DateField({selectOnFocus:true})),'string':new g.GridEditor(new f.TextField({selectOnFocus:true})),'number':new g.GridEditor(new f.NumberField({selectOnFocus:true,style:'text-align:left;'})),'int':new g.GridEditor(new f.NumberField({selectOnFocus:true,allowDecimals:false,style:'text-align:left;'})),'boolean':new g.GridEditor(new f.Field({el:this.bselect,selectOnFocus:true}))};this.renderCellDelegate=this.renderCell.createDelegate(this);this.renderPropDelegate=this.renderProp.createDelegate(this);};Roo.extend(Roo.grid.PropertyColumnModel,Roo.grid.ColumnModel,{nameText:'Name',valueText:'Value',dateFormat:'m/j/Y',renderDate:function(A){return A.dateFormat(this.dateFormat);},renderBool:function(A){return A?'true':'false';},isCellEditable:function(A,B){return A==1;},getRenderer:function(A){return A==1?this.renderCellDelegate:this.renderPropDelegate;},renderProp:function(v){return this.getPropertyName(v);},renderCell:function(A){var rv=A;if(A instanceof Date){rv=this.renderDate(A);}else if(typeof A=='boolean'){rv=this.renderBool(A);}return Roo.util.Format.htmlEncode(rv);},getPropertyName:function(A){var pn=this.grid.propertyNames;return pn&&pn[A]?pn[A]:A;},getCellEditor:function(A,B){var p=this.store.getProperty(B);var n=p.data['name'],C=p.data['value'];if(typeof(this.grid.customEditors[n])=='string'){return this.editors[this.grid.customEditors[n]];}if(typeof(this.grid.customEditors[n])!='undefined'){return this.grid.customEditors[n];}if(C instanceof Date){return this.editors['date'];}else if(typeof C=='number'){return this.editors['number'];}else if(typeof C=='boolean'){return this.editors['boolean'];}else {return this.editors['string'];}}});Roo.grid.PropertyGrid=function(A,B){B=B||{};var C=new Roo.grid.PropertyStore(this);this.store=C;var cm=new Roo.grid.PropertyColumnModel(this,C);C.store.sort('name','ASC');Roo.grid.PropertyGrid.superclass.constructor.call(this,A,Roo.apply({ds:C.store,cm:cm,enableColLock:false,enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1},B));this.getGridEl().addClass('x-props-grid');this.lastEditRow=null;this.on('columnresize',this.onColumnResize,this);this.addEvents({"beforepropertychange":true,"propertychange":true});this.customEditors=this.customEditors||{};};Roo.extend(Roo.grid.PropertyGrid,Roo.grid.EditorGrid,{render:function(){Roo.grid.PropertyGrid.superclass.render.call(this);this.autoSize.defer(100,this);},autoSize:function(){Roo.grid.PropertyGrid.superclass.autoSize.call(this);if(this.view){this.view.fitColumns();}},onColumnResize:function(){this.colModel.setColumnWidth(1,this.container.getWidth(true)-this.colModel.getColumnWidth(0));this.autoSize();},setSource:function(A){this.store.setSource(A);},getSource:function(){return this.store.getSource();}});
+//Roo/LoadMask.js
 Roo.LoadMask=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(this.store){this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoadException,this);this.removeMask=false;}else {var um=this.el.getUpdateManager();um.showLoadIndicator=false;um.on('beforeupdate',this.onBeforeLoad,this);um.on('update',this.onLoad,this);um.on('failure',this.onLoad,this);this.removeMask=true;}};Roo.LoadMask.prototype={msg:'Loading...',msgCls:'x-mask-loading',disabled:false,disable:function(){this.disabled=true;},enable:function(){this.disabled=false;},onLoadException:function(){if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg);}
 this.el.unmask(this.removeMask);},onLoad:function(){this.el.unmask(this.removeMask);},onBeforeLoad:function(){if(!this.disabled){this.el.mask(this.msg,this.msgCls);}},destroy:function(){if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoadException,this);}else {var um=this.el.getUpdateManager();um.un('beforeupdate',this.onBeforeLoad,this);um.un('update',this.onLoad,this);um.un('failure',this.onLoad,this);}}};
+//Roo/XTemplate.js
 Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,arguments);var s=this.html;s=['<tpl>',s,'</tpl>'].join('');var re=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var A=/^<tpl\b[^>]*?for="(.*?)"/;var B=/^<tpl\b[^>]*?if="(.*?)"/;var C=/^<tpl\b[^>]*?exec="(.*?)"/;var m,id=0;var D=[];while(m=s.match(re)){var m2=m[0].match(A);var m3=m[0].match(B);var m4=m[0].match(C);var E=null,fn=null,F=null;var G=m2&&m2[1]?m2[1]:'';if(m3){E=m3&&m3[1]?m3[1]:null;if(E){fn=new Function('values','parent','with(values){ return '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(m4){E=m4&&m4[1]?m4[1]:null;if(E){F=new Function('values','parent','with(values){ '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(G){switch(G){case '.':G=new Function('values','parent','with(values){ return values; }');break;case '..':G=new Function('values','parent','with(values){ return parent; }');break;default:G=new Function('values','parent','with(values){ return '+G+'; }');}}
 D.push({id:id,target:G,exec:F,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}for(var i=D.length-1;i>=0;--i){this.compileTpl(D[i]);}
 this.master=D[D.length-1];this.tpls=D;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){C[C.length]=t.compiled.call(this,vs[i],B);}return C.join('');}return t.compiled.call(this,vs,B);},compileTpl:function(A){var fm=Roo.util.Format;var B=this.disableFormats!==true;var C=Roo.isGecko?"+":",";var fn=function(m,E,F,G){if(E.substr(0,4)=='xtpl'){return "'"+C+'this.applySubTemplate('+E.substr(4)+', values, parent)'+C+"'";}var v;if(E.indexOf('.')!=-1){v=E;}else {v="values['"+E+"']";}if(F&&B){G=G?','+G:"";if(F.substr(0,5)!="this."){F="fm."+F+'(';}else {F='this.call("'+F.substr(5)+'", ';G=", values";}}else {G='';F="("+v+" === undefined ? '' : ";}return "'"+C+F+v+G+")"+C+"'";};var D;if(Roo.isGecko){D="tpl.compiled = function(values, parent){ return '"+A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {D=["tpl.compiled = function(values, parent){ return ['"];D.push(A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));D.push("'].join('');};");D=D.join('');}eval(D);return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});var s=this.subs;},apply:function(){return this.applyTemplate.apply(this,arguments);},compile:function(){return this;}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
+//Roo/XComponent.js
 Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true,'buildcomplete':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;}
 Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,render:function(el){el=el||false;var hp=this.parent?1:0;if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1)
 this.parent=false;el=Roo.get(A);if(!el){Roo.log("Warning - element can not be found :#"+A);return;}}if(!this.parent){el=el?Roo.get(el):false;this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})}}var B=this.tree();B.region=B.region||this.region;this.el=this.parent.el.addxtype(B);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;}});Roo.apply(Roo.XComponent,{buildCompleted:false,topModule:false,modules:[],elmodules:[],register:function(A){this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;}var ar=str.split('.');var rt,o;rt=ar.shift();try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;}
@@ -982,6 +1105,7 @@ A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=functio
 Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();if(C.topModule){C.topModule.fireEvent('buildcomplete',C.topModule);}return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();}
 m.render();return D.defer(10,C);}
 D.defer(1,C);}});
+//Roo/Login.js
 Roo.Login=function(A){this.addEvents({'refreshed':true});Roo.apply(this,A);Roo.onReady(function(){this.onLoad();},this);Roo.Login.superclass.constructor.call(this,this);}
 Roo.extend(Roo.Login,Roo.LayoutDialog,{method:'POST',url:'',user:false,checkFails:0,intervalID:0,onLoad:function(){if(Roo.get('loading')){Roo.get('loading').remove();}
 this.check({success:function(A,B){var C=this.processResponse(A);this.checkFails=0;if(!C.success){this.checkFails=5;return this.failure(A,B);}if(!C.data.id){return this.show();}
index c75bd8d..1ff1f90 100644 (file)
@@ -21132,6 +21132,8 @@ Roo.data.Node = function(attributes){
         this.id = Roo.id(null, "ynode-");
         this.attributes.id = this.id;
     }
+     
+    
     /**
      * All child nodes of this node. @type Array
      */
@@ -31341,8 +31343,8 @@ Roo.extend(Roo.tree.TreePanel, Roo.data.Tree, {
         }
         this.getSelectionModel().init(this);
         if (!this.root) {
-            console.log("ROOT not set in tree");
-            return;
+            Roo.log("ROOT not set in tree");
+            return this;
         }
         this.root.render();
         if(!this.rootVisible){
@@ -31833,6 +31835,18 @@ Roo.tree.TreeNode = function(attributes){
      * @type TreeNodeUI
      */
     this.ui = new uiClass(this);
+    
+    // finally support items[]
+    if (typeof(this.attributes.items) == 'undefined' || !this.attributes.items) {
+        return;
+    }
+    
+    Roo.each(this.attributes.items, function(c) {
+        this.appendChild(Roo.factory(c,Roo.Tree));
+    }, this)
+    
+    
+    
 };
 Roo.extend(Roo.tree.TreeNode, Roo.data.Node, {
     preventHScroll: true,
@@ -31878,7 +31892,8 @@ Roo.extend(Roo.tree.TreeNode, Roo.data.Node, {
 
     // these methods are overridden to provide lazy rendering support
     // private override
-    appendChild : function(){
+    appendChild : function()
+    {
         var node = Roo.tree.TreeNode.superclass.appendChild.apply(this, arguments);
         if(node && this.childrenRendered){
             node.render();
index 5079995..4fc2393 100644 (file)
@@ -25398,4 +25398,13498 @@ Roo.form.HtmlEditor.swapCodes   =[
     [    8230, "..." ]
 ]; 
 
-    
\ No newline at end of file
+    // <script type="text/javascript">
+/*
+ * Based on
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *  
+ */
+
+/**
+ * @class Roo.form.HtmlEditorToolbar1
+ * Basic Toolbar
+ * 
+ * Usage:
+ *
+ new Roo.form.HtmlEditor({
+    ....
+    toolbars : [
+        new Roo.form.HtmlEditorToolbar1({
+            disable : { fonts: 1 , format: 1, ..., ... , ...],
+            btns : [ .... ]
+        })
+    }
+     
+ * 
+ * @cfg {Object} disable List of elements to disable..
+ * @cfg {Array} btns List of additional buttons.
+ * 
+ * 
+ * NEEDS Extra CSS? 
+ * .x-html-editor-tb .x-edit-none .x-btn-text { background: none; }
+ */
+Roo.form.HtmlEditor.ToolbarStandard = function(config)
+{
+    
+    Roo.apply(this, config);
+    
+    // default disabled, based on 'good practice'..
+    this.disable = this.disable || {};
+    Roo.applyIf(this.disable, {
+        fontSize : true,
+        colors : true,
+        specialElements : true
+    });
+    
+    
+    //Roo.form.HtmlEditorToolbar1.superclass.constructor.call(this, editor.wrap.dom.firstChild, [], config);
+    // dont call parent... till later.
+}
+
+Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype,  {
+    
+    tb: false,
+    
+    rendered: false,
+    
+    editor : false,
+    /**
+     * @cfg {Object} disable  List of toolbar elements to disable
+         
+     */
+    disable : false,
+      /**
+     * @cfg {Array} fontFamilies An array of available font families
+     */
+    fontFamilies : [
+        'Arial',
+        'Courier New',
+        'Tahoma',
+        'Times New Roman',
+        'Verdana'
+    ],
+    
+    specialChars : [
+           "&#169;",
+          "&#174;",     
+          "&#8482;",    
+          "&#163;" ,    
+         // "&#8212;",    
+          "&#8230;",    
+          "&#247;" ,    
+        //  "&#225;" ,     ?? a acute?
+           "&#8364;"    , //Euro
+       //   "&#8220;"    ,
+        //  "&#8221;"    ,
+        //  "&#8226;"    ,
+          "&#176;"  //   , // degrees
+
+         // "&#233;"     , // e ecute
+         // "&#250;"     , // u ecute?
+    ],
+    
+    specialElements : [
+        {
+            text: "Insert Table",
+            xtype: 'MenuItem',
+            xns : Roo.Menu,
+            ihtml :  '<table><tr><td>Cell</td></tr></table>' 
+                
+        },
+        {    
+            text: "Insert Image",
+            xtype: 'MenuItem',
+            xns : Roo.Menu,
+            ihtml : '<img src="about:blank"/>'
+            
+        }
+        
+         
+    ],
+    
+    
+    inputElements : [ 
+            "form", "input:text", "input:hidden", "input:checkbox", "input:radio", "input:password", 
+            "input:submit", "input:button", "select", "textarea", "label" ],
+    formats : [
+        ["p"] ,  
+        ["h1"],["h2"],["h3"],["h4"],["h5"],["h6"], 
+        ["pre"],[ "code"], 
+        ["abbr"],[ "acronym"],[ "address"],[ "cite"],[ "samp"],[ "var"]
+    ],
+     /**
+     * @cfg {String} defaultFont default font to use.
+     */
+    defaultFont: 'tahoma',
+   
+    fontSelect : false,
+    
+    
+    formatCombo : false,
+    
+    init : function(editor)
+    {
+        this.editor = editor;
+        
+        
+        var fid = editor.frameId;
+        var etb = this;
+        function btn(id, toggle, handler){
+            var xid = fid + '-'+ id ;
+            return {
+                id : xid,
+                cmd : id,
+                cls : 'x-btn-icon x-edit-'+id,
+                enableToggle:toggle !== false,
+                scope: editor, // was editor...
+                handler:handler||editor.relayBtnCmd,
+                clickEvent:'mousedown',
+                tooltip: etb.buttonTips[id] || undefined, ///tips ???
+                tabIndex:-1
+            };
+        }
+        
+        
+        
+        var tb = new Roo.Toolbar(editor.wrap.dom.firstChild);
+        this.tb = tb;
+         // stop form submits
+        tb.el.on('click', function(e){
+            e.preventDefault(); // what does this do?
+        });
+
+        if(!this.disable.font && !Roo.isSafari){
+            /* why no safari for fonts
+            editor.fontSelect = tb.el.createChild({
+                tag:'select',
+                tabIndex: -1,
+                cls:'x-font-select',
+                html: editor.createFontOptions()
+            });
+            editor.fontSelect.on('change', function(){
+                var font = editor.fontSelect.dom.value;
+                editor.relayCmd('fontname', font);
+                editor.deferFocus();
+            }, editor);
+            tb.add(
+                editor.fontSelect.dom,
+                '-'
+            );
+            */
+        };
+        if(!this.disable.formats){
+            this.formatCombo = new Roo.form.ComboBox({
+                store: new Roo.data.SimpleStore({
+                    id : 'tag',
+                    fields: ['tag'],
+                    data : this.formats // from states.js
+                }),
+                blockFocus : true,
+                //autoCreate : {tag: "div",  size: "20"},
+                displayField:'tag',
+                typeAhead: false,
+                mode: 'local',
+                editable : false,
+                triggerAction: 'all',
+                emptyText:'Add tag',
+                selectOnFocus:true,
+                width:135,
+                listeners : {
+                    'select': function(c, r, i) {
+                        editor.insertTag(r.get('tag'));
+                        editor.focus();
+                    }
+                }
+
+            });
+            tb.addField(this.formatCombo);
+            
+        }
+        
+        if(!this.disable.format){
+            tb.add(
+                btn('bold'),
+                btn('italic'),
+                btn('underline')
+            );
+        };
+        if(!this.disable.fontSize){
+            tb.add(
+                '-',
+                
+                
+                btn('increasefontsize', false, editor.adjustFont),
+                btn('decreasefontsize', false, editor.adjustFont)
+            );
+        };
+        
+        
+        if(!this.disable.colors){
+            tb.add(
+                '-', {
+                    id:editor.frameId +'-forecolor',
+                    cls:'x-btn-icon x-edit-forecolor',
+                    clickEvent:'mousedown',
+                    tooltip: this.buttonTips['forecolor'] || undefined,
+                    tabIndex:-1,
+                    menu : new Roo.menu.ColorMenu({
+                        allowReselect: true,
+                        focus: Roo.emptyFn,
+                        value:'000000',
+                        plain:true,
+                        selectHandler: function(cp, color){
+                            editor.execCmd('forecolor', Roo.isSafari || Roo.isIE ? '#'+color : color);
+                            editor.deferFocus();
+                        },
+                        scope: editor,
+                        clickEvent:'mousedown'
+                    })
+                }, {
+                    id:editor.frameId +'backcolor',
+                    cls:'x-btn-icon x-edit-backcolor',
+                    clickEvent:'mousedown',
+                    tooltip: this.buttonTips['backcolor'] || undefined,
+                    tabIndex:-1,
+                    menu : new Roo.menu.ColorMenu({
+                        focus: Roo.emptyFn,
+                        value:'FFFFFF',
+                        plain:true,
+                        allowReselect: true,
+                        selectHandler: function(cp, color){
+                            if(Roo.isGecko){
+                                editor.execCmd('useCSS', false);
+                                editor.execCmd('hilitecolor', color);
+                                editor.execCmd('useCSS', true);
+                                editor.deferFocus();
+                            }else{
+                                editor.execCmd(Roo.isOpera ? 'hilitecolor' : 'backcolor', 
+                                    Roo.isSafari || Roo.isIE ? '#'+color : color);
+                                editor.deferFocus();
+                            }
+                        },
+                        scope:editor,
+                        clickEvent:'mousedown'
+                    })
+                }
+            );
+        };
+        // now add all the items...
+        
+
+        if(!this.disable.alignments){
+            tb.add(
+                '-',
+                btn('justifyleft'),
+                btn('justifycenter'),
+                btn('justifyright')
+            );
+        };
+
+        //if(!Roo.isSafari){
+            if(!this.disable.links){
+                tb.add(
+                    '-',
+                    btn('createlink', false, editor.createLink)    /// MOVE TO HERE?!!?!?!?!
+                );
+            };
+
+            if(!this.disable.lists){
+                tb.add(
+                    '-',
+                    btn('insertorderedlist'),
+                    btn('insertunorderedlist')
+                );
+            }
+            if(!this.disable.sourceEdit){
+                tb.add(
+                    '-',
+                    btn('sourceedit', true, function(btn){
+                        this.toggleSourceEdit(btn.pressed);
+                    })
+                );
+            }
+        //}
+        
+        var smenu = { };
+        // special menu.. - needs to be tidied up..
+        if (!this.disable.special) {
+            smenu = {
+                text: "&#169;",
+                cls: 'x-edit-none',
+                
+                menu : {
+                    items : []
+                }
+            };
+            for (var i =0; i < this.specialChars.length; i++) {
+                smenu.menu.items.push({
+                    
+                    html: this.specialChars[i],
+                    handler: function(a,b) {
+                        editor.insertAtCursor(String.fromCharCode(a.html.replace('&#','').replace(';', '')));
+                        
+                    },
+                    tabIndex:-1
+                });
+            }
+            
+            
+            tb.add(smenu);
+            
+            
+        }
+         
+        if (!this.disable.specialElements) {
+            var semenu = {
+                text: "Other;",
+                cls: 'x-edit-none',
+                menu : {
+                    items : []
+                }
+            };
+            for (var i =0; i < this.specialElements.length; i++) {
+                semenu.menu.items.push(
+                    Roo.apply({ 
+                        handler: function(a,b) {
+                            editor.insertAtCursor(this.ihtml);
+                        }
+                    }, this.specialElements[i])
+                );
+                    
+            }
+            
+            tb.add(semenu);
+            
+            
+        }
+         
+        
+        if (this.btns) {
+            for(var i =0; i< this.btns.length;i++) {
+                var b = this.btns[i];
+                b.cls =  'x-edit-none';
+                b.scope = editor;
+                tb.add(b);
+            }
+        
+        }
+        
+        
+        
+        // disable everything...
+        
+        this.tb.items.each(function(item){
+           if(item.id != editor.frameId+ '-sourceedit'){
+                item.disable();
+            }
+        });
+        this.rendered = true;
+        
+        // the all the btns;
+        editor.on('editorevent', this.updateToolbar, this);
+        // other toolbars need to implement this..
+        //editor.on('editmodechange', this.updateToolbar, this);
+    },
+    
+    
+    
+    /**
+     * Protected method that will not generally be called directly. It triggers
+     * a toolbar update by reading the markup state of the current selection in the editor.
+     */
+    updateToolbar: function(){
+
+        if(!this.editor.activated){
+            this.editor.onFirstFocus();
+            return;
+        }
+
+        var btns = this.tb.items.map, 
+            doc = this.editor.doc,
+            frameId = this.editor.frameId;
+
+        if(!this.disable.font && !Roo.isSafari){
+            /*
+            var name = (doc.queryCommandValue('FontName')||this.editor.defaultFont).toLowerCase();
+            if(name != this.fontSelect.dom.value){
+                this.fontSelect.dom.value = name;
+            }
+            */
+        }
+        if(!this.disable.format){
+            btns[frameId + '-bold'].toggle(doc.queryCommandState('bold'));
+            btns[frameId + '-italic'].toggle(doc.queryCommandState('italic'));
+            btns[frameId + '-underline'].toggle(doc.queryCommandState('underline'));
+        }
+        if(!this.disable.alignments){
+            btns[frameId + '-justifyleft'].toggle(doc.queryCommandState('justifyleft'));
+            btns[frameId + '-justifycenter'].toggle(doc.queryCommandState('justifycenter'));
+            btns[frameId + '-justifyright'].toggle(doc.queryCommandState('justifyright'));
+        }
+        if(!Roo.isSafari && !this.disable.lists){
+            btns[frameId + '-insertorderedlist'].toggle(doc.queryCommandState('insertorderedlist'));
+            btns[frameId + '-insertunorderedlist'].toggle(doc.queryCommandState('insertunorderedlist'));
+        }
+        
+        var ans = this.editor.getAllAncestors();
+        if (this.formatCombo) {
+            
+            
+            var store = this.formatCombo.store;
+            this.formatCombo.setValue("");
+            for (var i =0; i < ans.length;i++) {
+                if (ans[i] && store.query('tag',ans[i].tagName.toLowerCase(), false).length) {
+                    // select it..
+                    this.formatCombo.setValue(ans[i].tagName.toLowerCase());
+                    break;
+                }
+            }
+        }
+        
+        
+        
+        // hides menus... - so this cant be on a menu...
+        Roo.menu.MenuMgr.hideAll();
+
+        //this.editorsyncValue();
+    },
+   
+    
+    createFontOptions : function(){
+        var buf = [], fs = this.fontFamilies, ff, lc;
+        for(var i = 0, len = fs.length; i< len; i++){
+            ff = fs[i];
+            lc = ff.toLowerCase();
+            buf.push(
+                '<option value="',lc,'" style="font-family:',ff,';"',
+                    (this.defaultFont == lc ? ' selected="true">' : '>'),
+                    ff,
+                '</option>'
+            );
+        }
+        return buf.join('');
+    },
+    
+    toggleSourceEdit : function(sourceEditMode){
+        if(sourceEditMode === undefined){
+            sourceEditMode = !this.sourceEditMode;
+        }
+        this.sourceEditMode = sourceEditMode === true;
+        var btn = this.tb.items.get(this.editor.frameId +'-sourceedit');
+        // just toggle the button?
+        if(btn.pressed !== this.editor.sourceEditMode){
+            btn.toggle(this.editor.sourceEditMode);
+            return;
+        }
+        
+        if(this.sourceEditMode){
+            this.tb.items.each(function(item){
+                if(item.cmd != 'sourceedit'){
+                    item.disable();
+                }
+            });
+          
+        }else{
+            if(this.initialized){
+                this.tb.items.each(function(item){
+                    item.enable();
+                });
+            }
+            
+        }
+        // tell the editor that it's been pressed..
+        this.editor.toggleSourceEdit(sourceEditMode);
+       
+    },
+     /**
+     * Object collection of toolbar tooltips for the buttons in the editor. The key
+     * is the command id associated with that button and the value is a valid QuickTips object.
+     * For example:
+<pre><code>
+{
+    bold : {
+        title: 'Bold (Ctrl+B)',
+        text: 'Make the selected text bold.',
+        cls: 'x-html-editor-tip'
+    },
+    italic : {
+        title: 'Italic (Ctrl+I)',
+        text: 'Make the selected text italic.',
+        cls: 'x-html-editor-tip'
+    },
+    ...
+</code></pre>
+    * @type Object
+     */
+    buttonTips : {
+        bold : {
+            title: 'Bold (Ctrl+B)',
+            text: 'Make the selected text bold.',
+            cls: 'x-html-editor-tip'
+        },
+        italic : {
+            title: 'Italic (Ctrl+I)',
+            text: 'Make the selected text italic.',
+            cls: 'x-html-editor-tip'
+        },
+        underline : {
+            title: 'Underline (Ctrl+U)',
+            text: 'Underline the selected text.',
+            cls: 'x-html-editor-tip'
+        },
+        increasefontsize : {
+            title: 'Grow Text',
+            text: 'Increase the font size.',
+            cls: 'x-html-editor-tip'
+        },
+        decreasefontsize : {
+            title: 'Shrink Text',
+            text: 'Decrease the font size.',
+            cls: 'x-html-editor-tip'
+        },
+        backcolor : {
+            title: 'Text Highlight Color',
+            text: 'Change the background color of the selected text.',
+            cls: 'x-html-editor-tip'
+        },
+        forecolor : {
+            title: 'Font Color',
+            text: 'Change the color of the selected text.',
+            cls: 'x-html-editor-tip'
+        },
+        justifyleft : {
+            title: 'Align Text Left',
+            text: 'Align text to the left.',
+            cls: 'x-html-editor-tip'
+        },
+        justifycenter : {
+            title: 'Center Text',
+            text: 'Center text in the editor.',
+            cls: 'x-html-editor-tip'
+        },
+        justifyright : {
+            title: 'Align Text Right',
+            text: 'Align text to the right.',
+            cls: 'x-html-editor-tip'
+        },
+        insertunorderedlist : {
+            title: 'Bullet List',
+            text: 'Start a bulleted list.',
+            cls: 'x-html-editor-tip'
+        },
+        insertorderedlist : {
+            title: 'Numbered List',
+            text: 'Start a numbered list.',
+            cls: 'x-html-editor-tip'
+        },
+        createlink : {
+            title: 'Hyperlink',
+            text: 'Make the selected text a hyperlink.',
+            cls: 'x-html-editor-tip'
+        },
+        sourceedit : {
+            title: 'Source Edit',
+            text: 'Switch to source editing mode.',
+            cls: 'x-html-editor-tip'
+        }
+    },
+    // private
+    onDestroy : function(){
+        if(this.rendered){
+            
+            this.tb.items.each(function(item){
+                if(item.menu){
+                    item.menu.removeAll();
+                    if(item.menu.el){
+                        item.menu.el.destroy();
+                    }
+                }
+                item.destroy();
+            });
+             
+        }
+    },
+    onFirstFocus: function() {
+        this.tb.items.each(function(item){
+           item.enable();
+        });
+    }
+});
+
+
+
+
+// <script type="text/javascript">
+/*
+ * Based on
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *  
+ */
+
+/**
+ * @class Roo.form.HtmlEditor.ToolbarContext
+ * Context Toolbar
+ * 
+ * Usage:
+ *
+ new Roo.form.HtmlEditor({
+    ....
+    toolbars : [
+        { xtype: 'ToolbarStandard', styles : {} }
+        { xtype: 'ToolbarContext', disable : {} }
+    ]
+})
+
+     
+ * 
+ * @config : {Object} disable List of elements to disable.. (not done yet.)
+ * @config : {Object} styles  Map of styles available.
+ * 
+ */
+
+Roo.form.HtmlEditor.ToolbarContext = function(config)
+{
+    
+    Roo.apply(this, config);
+    //Roo.form.HtmlEditorToolbar1.superclass.constructor.call(this, editor.wrap.dom.firstChild, [], config);
+    // dont call parent... till later.
+    this.styles = this.styles || {};
+}
+Roo.form.HtmlEditor.ToolbarContext.types = {
+    'IMG' : {
+        width : {
+            title: "Width",
+            width: 40
+        },
+        height:  {
+            title: "Height",
+            width: 40
+        },
+        align: {
+            title: "Align",
+            opts : [ [""],[ "left"],[ "right"],[ "center"],[ "top"]],
+            width : 80
+            
+        },
+        border: {
+            title: "Border",
+            width: 40
+        },
+        alt: {
+            title: "Alt",
+            width: 120
+        },
+        src : {
+            title: "Src",
+            width: 220
+        }
+        
+    },
+    'A' : {
+        name : {
+            title: "Name",
+            width: 50
+        },
+        href:  {
+            title: "Href",
+            width: 220
+        } // border?
+        
+    },
+    'TABLE' : {
+        rows : {
+            title: "Rows",
+            width: 20
+        },
+        cols : {
+            title: "Cols",
+            width: 20
+        },
+        width : {
+            title: "Width",
+            width: 40
+        },
+        height : {
+            title: "Height",
+            width: 40
+        },
+        border : {
+            title: "Border",
+            width: 20
+        }
+    },
+    'TD' : {
+        width : {
+            title: "Width",
+            width: 40
+        },
+        height : {
+            title: "Height",
+            width: 40
+        },   
+        align: {
+            title: "Align",
+            opts : [[""],[ "left"],[ "center"],[ "right"],[ "justify"],[ "char"]],
+            width: 80
+        },
+        valign: {
+            title: "Valign",
+            opts : [[""],[ "top"],[ "middle"],[ "bottom"],[ "baseline"]],
+            width: 80
+        },
+        colspan: {
+            title: "Colspan",
+            width: 20
+            
+        }
+    },
+    'INPUT' : {
+        name : {
+            title: "name",
+            width: 120
+        },
+        value : {
+            title: "Value",
+            width: 120
+        },
+        width : {
+            title: "Width",
+            width: 40
+        }
+    },
+    'LABEL' : {
+        'for' : {
+            title: "For",
+            width: 120
+        }
+    },
+    'TEXTAREA' : {
+          name : {
+            title: "name",
+            width: 120
+        },
+        rows : {
+            title: "Rows",
+            width: 20
+        },
+        cols : {
+            title: "Cols",
+            width: 20
+        }
+    },
+    'SELECT' : {
+        name : {
+            title: "name",
+            width: 120
+        },
+        selectoptions : {
+            title: "Options",
+            width: 200
+        }
+    },
+    
+    // should we really allow this??
+    // should this just be 
+    'BODY' : {
+        title : {
+            title: "title",
+            width: 200,
+            disabled : true
+        }
+    },
+    '*' : {
+        // empty..
+    }
+};
+
+
+
+Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
+    
+    tb: false,
+    
+    rendered: false,
+    
+    editor : false,
+    /**
+     * @cfg {Object} disable  List of toolbar elements to disable
+         
+     */
+    disable : false,
+    /**
+     * @cfg {Object} styles List of styles 
+     *    eg. { '*' : [ 'headline' ] , 'TD' : [ 'underline', 'double-underline' ] } 
+     *
+     * These must be defined in the page, so they get rendered correctly..
+     * .headline { }
+     * TD.underline { }
+     * 
+     */
+    styles : false,
+    
+    
+    
+    toolbars : false,
+    
+    init : function(editor)
+    {
+        this.editor = editor;
+        
+        
+        var fid = editor.frameId;
+        var etb = this;
+        function btn(id, toggle, handler){
+            var xid = fid + '-'+ id ;
+            return {
+                id : xid,
+                cmd : id,
+                cls : 'x-btn-icon x-edit-'+id,
+                enableToggle:toggle !== false,
+                scope: editor, // was editor...
+                handler:handler||editor.relayBtnCmd,
+                clickEvent:'mousedown',
+                tooltip: etb.buttonTips[id] || undefined, ///tips ???
+                tabIndex:-1
+            };
+        }
+        // create a new element.
+        var wdiv = editor.wrap.createChild({
+                tag: 'div'
+            }, editor.wrap.dom.firstChild.nextSibling, true);
+        
+        // can we do this more than once??
+        
+         // stop form submits
+      
+        // disable everything...
+        var ty= Roo.form.HtmlEditor.ToolbarContext.types;
+        this.toolbars = {};
+           
+        for (var i in  ty) {
+          
+            this.toolbars[i] = this.buildToolbar(ty[i],i);
+        }
+        this.tb = this.toolbars.BODY;
+        this.tb.el.show();
+        this.buildFooter();
+        this.footer.show();
+         
+        this.rendered = true;
+        
+        // the all the btns;
+        editor.on('editorevent', this.updateToolbar, this);
+        // other toolbars need to implement this..
+        //editor.on('editmodechange', this.updateToolbar, this);
+    },
+    
+    
+    
+    /**
+     * Protected method that will not generally be called directly. It triggers
+     * a toolbar update by reading the markup state of the current selection in the editor.
+     */
+    updateToolbar: function(ignore_a,ignore_b,sel){
+
+        
+        if(!this.editor.activated){
+             this.editor.onFirstFocus();
+            return;
+        }
+        var updateFooter = sel ? false : true;
+        
+        
+        var ans = this.editor.getAllAncestors();
+        
+        // pick
+        var ty= Roo.form.HtmlEditor.ToolbarContext.types;
+        
+        if (!sel) { 
+            sel = ans.length ? (ans[0] ?  ans[0]  : ans[1]) : this.editor.doc.body;
+            sel = sel ? sel : this.editor.doc.body;
+            sel = sel.tagName.length ? sel : this.editor.doc.body;
+            
+        }
+        // pick a menu that exists..
+        var tn = sel.tagName.toUpperCase();
+        //sel = typeof(ty[tn]) != 'undefined' ? sel : this.editor.doc.body;
+        
+        tn = sel.tagName.toUpperCase();
+        
+        var lastSel = this.tb.selectedNode
+        
+        this.tb.selectedNode = sel;
+        
+        // if current menu does not match..
+        if ((this.tb.name != tn) || (lastSel != this.tb.selectedNode)) {
+                
+            this.tb.el.hide();
+            ///console.log("show: " + tn);
+            this.tb =  typeof(ty[tn]) != 'undefined' ? this.toolbars[tn] : this.toolbars['*'];
+            this.tb.el.show();
+            // update name
+            this.tb.items.first().el.innerHTML = tn + ':&nbsp;';
+            
+            
+            // update attributes
+            if (this.tb.fields) {
+                this.tb.fields.each(function(e) {
+                   e.setValue(sel.getAttribute(e.name));
+                });
+            }
+            
+            // update styles
+            var st = this.tb.fields.item(0);
+            st.store.removeAll();
+            var cn = sel.className.split(/\s+/);
+            
+            var avs = [];
+            if (this.styles['*']) {
+                
+                Roo.each(this.styles['*'], function(v) {
+                    avs.push( [ v , cn.indexOf(v) > -1 ? 1 : 0 ] );         
+                });
+            }
+            if (this.styles[tn]) { 
+                Roo.each(this.styles[tn], function(v) {
+                    avs.push( [ v , cn.indexOf(v) > -1 ? 1 : 0 ] );         
+                });
+            }
+            
+            st.store.loadData(avs);
+            st.collapse();
+            st.setValue(cn);
+            
+            // flag our selected Node.
+            this.tb.selectedNode = sel;
+           
+           
+            Roo.menu.MenuMgr.hideAll();
+
+        }
+        
+        if (!updateFooter) {
+            return;
+        }
+        // update the footer
+        //
+        var html = '';
+        
+        this.footerEls = ans.reverse();
+        Roo.each(this.footerEls, function(a,i) {
+            if (!a) { return; }
+            html += html.length ? ' &gt; '  :  '';
+            
+            html += '<span class="x-ed-loc-' + i + '">' + a.tagName + '</span>';
+            
+        });
+       
+        // 
+        var sz = this.footDisp.up('td').getSize();
+        this.footDisp.dom.style.width = (sz.width -10) + 'px';
+        this.footDisp.dom.style.marginLeft = '5px';
+        
+        this.footDisp.dom.style.overflow = 'hidden';
+        
+        this.footDisp.dom.innerHTML = html;
+            
+        //this.editorsyncValue();
+    },
+   
+       
+    // private
+    onDestroy : function(){
+        if(this.rendered){
+            
+            this.tb.items.each(function(item){
+                if(item.menu){
+                    item.menu.removeAll();
+                    if(item.menu.el){
+                        item.menu.el.destroy();
+                    }
+                }
+                item.destroy();
+            });
+             
+        }
+    },
+    onFirstFocus: function() {
+        // need to do this for all the toolbars..
+        this.tb.items.each(function(item){
+           item.enable();
+        });
+    },
+    buildToolbar: function(tlist, nm)
+    {
+        var editor = this.editor;
+         // create a new element.
+        var wdiv = editor.wrap.createChild({
+                tag: 'div'
+            }, editor.wrap.dom.firstChild.nextSibling, true);
+        
+       
+        var tb = new Roo.Toolbar(wdiv);
+        // add the name..
+        
+        tb.add(nm+ ":&nbsp;");
+        
+        // styles...
+        if (this.styles) {
+            
+            // this needs a multi-select checkbox...
+            tb.addField( new Roo.form.ComboBox({
+                store: new Roo.data.SimpleStore({
+                    id : 'val',
+                    fields: ['val', 'selected'],
+                    data : [] 
+                }),
+                name : 'className',
+                displayField:'val',
+                typeAhead: false,
+                mode: 'local',
+                editable : false,
+                triggerAction: 'all',
+                emptyText:'Select Style',
+                selectOnFocus:true,
+                width: 130,
+                listeners : {
+                    'select': function(c, r, i) {
+                        // initial support only for on class per el..
+                        tb.selectedNode.className =  r ? r.get('val') : '';
+                    }
+                }
+    
+            }));
+        }
+            
+        
+        
+        for (var i in tlist) {
+            
+            var item = tlist[i];
+            tb.add(item.title + ":&nbsp;");
+            
+            
+            
+            
+            if (item.opts) {
+                // opts == pulldown..
+                tb.addField( new Roo.form.ComboBox({
+                    store: new Roo.data.SimpleStore({
+                        id : 'val',
+                        fields: ['val'],
+                        data : item.opts  
+                    }),
+                    name : i,
+                    displayField:'val',
+                    typeAhead: false,
+                    mode: 'local',
+                    editable : false,
+                    triggerAction: 'all',
+                    emptyText:'Select',
+                    selectOnFocus:true,
+                    width: item.width ? item.width  : 130,
+                    listeners : {
+                        'select': function(c, r, i) {
+                            tb.selectedNode.setAttribute(c.name, r.get('val'));
+                        }
+                    }
+
+                }));
+                continue;
+                    
+                 
+                
+                tb.addField( new Roo.form.TextField({
+                    name: i,
+                    width: 100,
+                    //allowBlank:false,
+                    value: ''
+                }));
+                continue;
+            }
+            tb.addField( new Roo.form.TextField({
+                name: i,
+                width: item.width,
+                //allowBlank:true,
+                value: '',
+                listeners: {
+                    'change' : function(f, nv, ov) {
+                        tb.selectedNode.setAttribute(f.name, nv);
+                    }
+                }
+            }));
+             
+        }
+        tb.el.on('click', function(e){
+            e.preventDefault(); // what does this do?
+        });
+        tb.el.setVisibilityMode( Roo.Element.DISPLAY);
+        tb.el.hide();
+        tb.name = nm;
+        // dont need to disable them... as they will get hidden
+        return tb;
+         
+        
+    },
+    buildFooter : function()
+    {
+        
+        var fel = this.editor.wrap.createChild();
+        this.footer = new Roo.Toolbar(fel);
+        // toolbar has scrolly on left / right?
+        var footDisp= new Roo.Toolbar.Fill();
+        var _t = this;
+        this.footer.add(
+            {
+                text : '&lt;',
+                xtype: 'Button',
+                handler : function() {
+                    _t.footDisp.scrollTo('left',0,true)
+                }
+            }
+        );
+        this.footer.add( footDisp );
+        this.footer.add( 
+            {
+                text : '&gt;',
+                xtype: 'Button',
+                handler : function() {
+                    // no animation..
+                    _t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);
+                }
+            }
+        );
+        var fel = Roo.get(footDisp.el);
+        fel.addClass('x-editor-context');
+        this.footDispWrap = fel; 
+        this.footDispWrap.overflow  = 'hidden';
+        
+        this.footDisp = fel.createChild();
+        this.footDispWrap.on('click', this.onContextClick, this)
+        
+        
+    },
+    onContextClick : function (ev,dom)
+    {
+        ev.preventDefault();
+        var  cn = dom.className;
+        Roo.log(cn);
+        if (!cn.match(/x-ed-loc-/)) {
+            return;
+        }
+        var n = cn.split('-').pop();
+        var ans = this.footerEls;
+        var sel = ans[n];
+        
+         // pick
+        var range = this.editor.createRange();
+        
+        range.selectNodeContents(sel);
+        //range.selectNode(sel);
+        
+        
+        var selection = this.editor.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+        
+        
+        
+        this.updateToolbar(null, null, sel);
+        
+        
+    }
+    
+    
+    
+    
+    
+});
+
+
+
+
+
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.form.BasicForm
+ * @extends Roo.util.Observable
+ * Supplies the functionality to do "actions" on forms and initialize Roo.form.Field types on existing markup.
+ * @constructor
+ * @param {String/HTMLElement/Roo.Element} el The form element or its id
+ * @param {Object} config Configuration options
+ */
+Roo.form.BasicForm = function(el, config){
+    this.allItems = [];
+    this.childForms = [];
+    Roo.apply(this, config);
+    /*
+     * The Roo.form.Field items in this form.
+     * @type MixedCollection
+     */
+     
+     
+    this.items = new Roo.util.MixedCollection(false, function(o){
+        return o.id || (o.id = Roo.id());
+    });
+    this.addEvents({
+        /**
+         * @event beforeaction
+         * Fires before any action is performed. Return false to cancel the action.
+         * @param {Form} this
+         * @param {Action} action The action to be performed
+         */
+        beforeaction: true,
+        /**
+         * @event actionfailed
+         * Fires when an action fails.
+         * @param {Form} this
+         * @param {Action} action The action that failed
+         */
+        actionfailed : true,
+        /**
+         * @event actioncomplete
+         * Fires when an action is completed.
+         * @param {Form} this
+         * @param {Action} action The action that completed
+         */
+        actioncomplete : true
+    });
+    if(el){
+        this.initEl(el);
+    }
+    Roo.form.BasicForm.superclass.constructor.call(this);
+};
+
+Roo.extend(Roo.form.BasicForm, Roo.util.Observable, {
+    /**
+     * @cfg {String} method
+     * The request method to use (GET or POST) for form actions if one isn't supplied in the action options.
+     */
+    /**
+     * @cfg {DataReader} reader
+     * An Roo.data.DataReader (e.g. {@link Roo.data.XmlReader}) to be used to read data when executing "load" actions.
+     * This is optional as there is built-in support for processing JSON.
+     */
+    /**
+     * @cfg {DataReader} errorReader
+     * An Roo.data.DataReader (e.g. {@link Roo.data.XmlReader}) to be used to read data when reading validation errors on "submit" actions.
+     * This is completely optional as there is built-in support for processing JSON.
+     */
+    /**
+     * @cfg {String} url
+     * The URL to use for form actions if one isn't supplied in the action options.
+     */
+    /**
+     * @cfg {Boolean} fileUpload
+     * Set to true if this form is a file upload.
+     */
+     
+    /**
+     * @cfg {Object} baseParams
+     * Parameters to pass with all requests. e.g. baseParams: {id: '123', foo: 'bar'}.
+     */
+     /**
+     
+    /**
+     * @cfg {Number} timeout Timeout for form actions in seconds (default is 30 seconds).
+     */
+    timeout: 30,
+
+    // private
+    activeAction : null,
+
+    /**
+     * @cfg {Boolean} trackResetOnLoad If set to true, form.reset() resets to the last loaded
+     * or setValues() data instead of when the form was first created.
+     */
+    trackResetOnLoad : false,
+    
+    
+    /**
+     * childForms - used for multi-tab forms
+     * @type {Array}
+     */
+    childForms : false,
+    
+    /**
+     * allItems - full list of fields.
+     * @type {Array}
+     */
+    allItems : false,
+    
+    /**
+     * By default wait messages are displayed with Roo.MessageBox.wait. You can target a specific
+     * element by passing it or its id or mask the form itself by passing in true.
+     * @type Mixed
+     */
+    waitMsgTarget : false,
+
+    // private
+    initEl : function(el){
+        this.el = Roo.get(el);
+        this.id = this.el.id || Roo.id();
+        this.el.on('submit', this.onSubmit, this);
+        this.el.addClass('x-form');
+    },
+
+    // private
+    onSubmit : function(e){
+        e.stopEvent();
+    },
+
+    /**
+     * Returns true if client-side validation on the form is successful.
+     * @return Boolean
+     */
+    isValid : function(){
+        var valid = true;
+        this.items.each(function(f){
+           if(!f.validate()){
+               valid = false;
+           }
+        });
+        return valid;
+    },
+
+    /**
+     * Returns true if any fields in this form have changed since their original load.
+     * @return Boolean
+     */
+    isDirty : function(){
+        var dirty = false;
+        this.items.each(function(f){
+           if(f.isDirty()){
+               dirty = true;
+               return false;
+           }
+        });
+        return dirty;
+    },
+
+    /**
+     * Performs a predefined action (submit or load) or custom actions you define on this form.
+     * @param {String} actionName The name of the action type
+     * @param {Object} options (optional) The options to pass to the action.  All of the config options listed
+     * below are supported by both the submit and load actions unless otherwise noted (custom actions could also
+     * accept other config options):
+     * <pre>
+Property          Type             Description
+----------------  ---------------  ----------------------------------------------------------------------------------
+url               String           The url for the action (defaults to the form's url)
+method            String           The form method to use (defaults to the form's method, or POST if not defined)
+params            String/Object    The params to pass (defaults to the form's baseParams, or none if not defined)
+clientValidation  Boolean          Applies to submit only.  Pass true to call form.isValid() prior to posting to
+                                   validate the form on the client (defaults to false)
+     * </pre>
+     * @return {BasicForm} this
+     */
+    doAction : function(action, options){
+        if(typeof action == 'string'){
+            action = new Roo.form.Action.ACTION_TYPES[action](this, options);
+        }
+        if(this.fireEvent('beforeaction', this, action) !== false){
+            this.beforeAction(action);
+            action.run.defer(100, action);
+        }
+        return this;
+    },
+
+    /**
+     * Shortcut to do a submit action.
+     * @param {Object} options The options to pass to the action (see {@link #doAction} for details)
+     * @return {BasicForm} this
+     */
+    submit : function(options){
+        this.doAction('submit', options);
+        return this;
+    },
+
+    /**
+     * Shortcut to do a load action.
+     * @param {Object} options The options to pass to the action (see {@link #doAction} for details)
+     * @return {BasicForm} this
+     */
+    load : function(options){
+        this.doAction('load', options);
+        return this;
+    },
+
+    /**
+     * Persists the values in this form into the passed Roo.data.Record object in a beginEdit/endEdit block.
+     * @param {Record} record The record to edit
+     * @return {BasicForm} this
+     */
+    updateRecord : function(record){
+        record.beginEdit();
+        var fs = record.fields;
+        fs.each(function(f){
+            var field = this.findField(f.name);
+            if(field){
+                record.set(f.name, field.getValue());
+            }
+        }, this);
+        record.endEdit();
+        return this;
+    },
+
+    /**
+     * Loads an Roo.data.Record into this form.
+     * @param {Record} record The record to load
+     * @return {BasicForm} this
+     */
+    loadRecord : function(record){
+        this.setValues(record.data);
+        return this;
+    },
+
+    // private
+    beforeAction : function(action){
+        var o = action.options;
+        
+       
+        if(this.waitMsgTarget === true){
+            this.el.mask(o.waitMsg || "Sending", 'x-mask-loading');
+        }else if(this.waitMsgTarget){
+            this.waitMsgTarget = Roo.get(this.waitMsgTarget);
+            this.waitMsgTarget.mask(o.waitMsg || "Sending", 'x-mask-loading');
+        }else {
+            Roo.MessageBox.wait(o.waitMsg || "Sending", o.waitTitle || this.waitTitle || 'Please Wait...');
+        }
+         
+    },
+
+    // private
+    afterAction : function(action, success){
+        this.activeAction = null;
+        var o = action.options;
+        
+        if(this.waitMsgTarget === true){
+            this.el.unmask();
+        }else if(this.waitMsgTarget){
+            this.waitMsgTarget.unmask();
+        }else{
+            Roo.MessageBox.updateProgress(1);
+            Roo.MessageBox.hide();
+        }
+         
+        if(success){
+            if(o.reset){
+                this.reset();
+            }
+            Roo.callback(o.success, o.scope, [this, action]);
+            this.fireEvent('actioncomplete', this, action);
+            
+        }else{
+            Roo.callback(o.failure, o.scope, [this, action]);
+            // show an error message if no failed handler is set..
+            if (!this.hasListener('actionfailed')) {
+                Roo.MessageBox.alert("Error",
+                    (typeof(action.result) != 'undefined' && typeof(action.result.errorMsg) != 'undefined') ?
+                        action.result.errorMsg :
+                        "Saving Failed, please check your entries"
+                );
+            }
+            
+            this.fireEvent('actionfailed', this, action);
+        }
+        
+    },
+
+    /**
+     * Find a Roo.form.Field in this form by id, dataIndex, name or hiddenName
+     * @param {String} id The value to search for
+     * @return Field
+     */
+    findField : function(id){
+        var field = this.items.get(id);
+        if(!field){
+            this.items.each(function(f){
+                if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){
+                    field = f;
+                    return false;
+                }
+            });
+        }
+        return field || null;
+    },
+
+    /**
+     * Add a secondary form to this one, 
+     * Used to provide tabbed forms. One form is primary, with hidden values 
+     * which mirror the elements from the other forms.
+     * 
+     * @param {Roo.form.Form} form to add.
+     * 
+     */
+    addForm : function(form)
+    {
+       
+        if (this.childForms.indexOf(form) > -1) {
+            // already added..
+            return;
+        }
+        this.childForms.push(form);
+        var n = '';
+        Roo.each(form.allItems, function (fe) {
+            
+            n = typeof(fe.getName) == 'undefined' ? fe.name : fe.getName();
+            if (this.findField(n)) { // already added..
+                return;
+            }
+            var add = new Roo.form.Hidden({
+                name : n
+            });
+            add.render(this.el);
+            
+            this.add( add );
+        }, this);
+        
+    },
+    /**
+     * Mark fields in this form invalid in bulk.
+     * @param {Array/Object} errors Either an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2}
+     * @return {BasicForm} this
+     */
+    markInvalid : function(errors){
+        if(errors instanceof Array){
+            for(var i = 0, len = errors.length; i < len; i++){
+                var fieldError = errors[i];
+                var f = this.findField(fieldError.id);
+                if(f){
+                    f.markInvalid(fieldError.msg);
+                }
+            }
+        }else{
+            var field, id;
+            for(id in errors){
+                if(typeof errors[id] != 'function' && (field = this.findField(id))){
+                    field.markInvalid(errors[id]);
+                }
+            }
+        }
+        Roo.each(this.childForms || [], function (f) {
+            f.markInvalid(errors);
+        });
+        
+        return this;
+    },
+
+    /**
+     * Set values for fields in this form in bulk.
+     * @param {Array/Object} values Either an array in the form [{id:'fieldId', value:'foo'},...] or an object hash of {id: value, id2: value2}
+     * @return {BasicForm} this
+     */
+    setValues : function(values){
+        if(values instanceof Array){ // array of objects
+            for(var i = 0, len = values.length; i < len; i++){
+                var v = values[i];
+                var f = this.findField(v.id);
+                if(f){
+                    f.setValue(v.value);
+                    if(this.trackResetOnLoad){
+                        f.originalValue = f.getValue();
+                    }
+                }
+            }
+        }else{ // object hash
+            var field, id;
+            for(id in values){
+                if(typeof values[id] != 'function' && (field = this.findField(id))){
+                    
+                    if (field.setFromData && 
+                        field.valueField && 
+                        field.displayField &&
+                        // combos' with local stores can 
+                        // be queried via setValue()
+                        // to set their value..
+                        (field.store && !field.store.isLocal)
+                        ) {
+                        // it's a combo
+                        var sd = { };
+                        sd[field.valueField] = typeof(values[field.hiddenName]) == 'undefined' ? '' : values[field.hiddenName];
+                        sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name];
+                        field.setFromData(sd);
+                        
+                    } else {
+                        field.setValue(values[id]);
+                    }
+                    
+                    
+                    if(this.trackResetOnLoad){
+                        field.originalValue = field.getValue();
+                    }
+                }
+            }
+        }
+         
+        Roo.each(this.childForms || [], function (f) {
+            f.setValues(values);
+        });
+                
+        return this;
+    },
+
+    /**
+     * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
+     * they are returned as an array.
+     * @param {Boolean} asString
+     * @return {Object}
+     */
+    getValues : function(asString){
+        if (this.childForms) {
+            // copy values from the child forms
+            Roo.each(this.childForms, function (f) {
+                this.setValues(f.getValues());
+            }, this);
+        }
+        
+        
+        
+        var fs = Roo.lib.Ajax.serializeForm(this.el.dom);
+        if(asString === true){
+            return fs;
+        }
+        return Roo.urlDecode(fs);
+    },
+    
+    /**
+     * Returns the fields in this form as an object with key/value pairs. 
+     * This differs from getValues as it calls getValue on each child item, rather than using dom data.
+     * @return {Object}
+     */
+    getFieldValues : function(with_hidden)
+    {
+        if (this.childForms) {
+            // copy values from the child forms
+            // should this call getFieldValues - probably not as we do not currently copy
+            // hidden fields when we generate..
+            Roo.each(this.childForms, function (f) {
+                this.setValues(f.getValues());
+            }, this);
+        }
+        
+        var ret = {};
+        this.items.each(function(f){
+            if (!f.getName()) {
+                return;
+            }
+            var v = f.getValue();
+            // not sure if this supported any more..
+            if ((typeof(v) == 'object') && f.getRawValue) {
+                v = f.getRawValue() ; // dates..
+            }
+            // combo boxes where name != hiddenName...
+            if (f.name != f.getName()) {
+                ret[f.name] = f.getRawValue();
+            }
+            ret[f.getName()] = v;
+        });
+        
+        return ret;
+    },
+
+    /**
+     * Clears all invalid messages in this form.
+     * @return {BasicForm} this
+     */
+    clearInvalid : function(){
+        this.items.each(function(f){
+           f.clearInvalid();
+        });
+        
+        Roo.each(this.childForms || [], function (f) {
+            f.clearInvalid();
+        });
+        
+        
+        return this;
+    },
+
+    /**
+     * Resets this form.
+     * @return {BasicForm} this
+     */
+    reset : function(){
+        this.items.each(function(f){
+            f.reset();
+        });
+        
+        Roo.each(this.childForms || [], function (f) {
+            f.reset();
+        });
+       
+        
+        return this;
+    },
+
+    /**
+     * Add Roo.form components to this form.
+     * @param {Field} field1
+     * @param {Field} field2 (optional)
+     * @param {Field} etc (optional)
+     * @return {BasicForm} this
+     */
+    add : function(){
+        this.items.addAll(Array.prototype.slice.call(arguments, 0));
+        return this;
+    },
+
+
+    /**
+     * Removes a field from the items collection (does NOT remove its markup).
+     * @param {Field} field
+     * @return {BasicForm} this
+     */
+    remove : function(field){
+        this.items.remove(field);
+        return this;
+    },
+
+    /**
+     * Looks at the fields in this form, checks them for an id attribute,
+     * and calls applyTo on the existing dom element with that id.
+     * @return {BasicForm} this
+     */
+    render : function(){
+        this.items.each(function(f){
+            if(f.isFormField && !f.rendered && document.getElementById(f.id)){ // if the element exists
+                f.applyTo(f.id);
+            }
+        });
+        return this;
+    },
+
+    /**
+     * Calls {@link Ext#apply} for all fields in this form with the passed object.
+     * @param {Object} values
+     * @return {BasicForm} this
+     */
+    applyToFields : function(o){
+        this.items.each(function(f){
+           Roo.apply(f, o);
+        });
+        return this;
+    },
+
+    /**
+     * Calls {@link Ext#applyIf} for all field in this form with the passed object.
+     * @param {Object} values
+     * @return {BasicForm} this
+     */
+    applyIfToFields : function(o){
+        this.items.each(function(f){
+           Roo.applyIf(f, o);
+        });
+        return this;
+    }
+});
+
+// back compat
+Roo.BasicForm = Roo.form.BasicForm;/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.form.Form
+ * @extends Roo.form.BasicForm
+ * Adds the ability to dynamically render forms with JavaScript to {@link Roo.form.BasicForm}.
+ * @constructor
+ * @param {Object} config Configuration options
+ */
+Roo.form.Form = function(config){
+    var xitems =  [];
+    if (config.items) {
+        xitems = config.items;
+        delete config.items;
+    }
+   
+    
+    Roo.form.Form.superclass.constructor.call(this, null, config);
+    this.url = this.url || this.action;
+    if(!this.root){
+        this.root = new Roo.form.Layout(Roo.applyIf({
+            id: Roo.id()
+        }, config));
+    }
+    this.active = this.root;
+    /**
+     * Array of all the buttons that have been added to this form via {@link addButton}
+     * @type Array
+     */
+    this.buttons = [];
+    this.allItems = [];
+    this.addEvents({
+        /**
+         * @event clientvalidation
+         * If the monitorValid config option is true, this event fires repetitively to notify of valid state
+         * @param {Form} this
+         * @param {Boolean} valid true if the form has passed client-side validation
+         */
+        clientvalidation: true,
+        /**
+         * @event rendered
+         * Fires when the form is rendered
+         * @param {Roo.form.Form} form
+         */
+        rendered : true
+    });
+    
+    if (this.progressUrl) {
+            // push a hidden field onto the list of fields..
+            this.addxtype( {
+                    xns: Roo.form, 
+                    xtype : 'Hidden', 
+                    name : 'UPLOAD_IDENTIFIER' 
+            });
+        }
+        
+    
+    Roo.each(xitems, this.addxtype, this);
+    
+    
+    
+};
+
+Roo.extend(Roo.form.Form, Roo.form.BasicForm, {
+    /**
+     * @cfg {Number} labelWidth The width of labels. This property cascades to child containers.
+     */
+    /**
+     * @cfg {String} itemCls A css class to apply to the x-form-item of fields. This property cascades to child containers.
+     */
+    /**
+     * @cfg {String} buttonAlign Valid values are "left," "center" and "right" (defaults to "center")
+     */
+    buttonAlign:'center',
+
+    /**
+     * @cfg {Number} minButtonWidth Minimum width of all buttons in pixels (defaults to 75)
+     */
+    minButtonWidth:75,
+
+    /**
+     * @cfg {String} labelAlign Valid values are "left," "top" and "right" (defaults to "left").
+     * This property cascades to child containers if not set.
+     */
+    labelAlign:'left',
+
+    /**
+     * @cfg {Boolean} monitorValid If true the form monitors its valid state <b>client-side</b> and
+     * fires a looping event with that state. This is required to bind buttons to the valid
+     * state using the config value formBind:true on the button.
+     */
+    monitorValid : false,
+
+    /**
+     * @cfg {Number} monitorPoll The milliseconds to poll valid state, ignored if monitorValid is not true (defaults to 200)
+     */
+    monitorPoll : 200,
+    
+    /**
+     * @cfg {String} progressUrl - Url to return progress data 
+     */
+    
+    progressUrl : false,
+  
+    /**
+     * Opens a new {@link Roo.form.Column} container in the layout stack. If fields are passed after the config, the
+     * fields are added and the column is closed. If no fields are passed the column remains open
+     * until end() is called.
+     * @param {Object} config The config to pass to the column
+     * @param {Field} field1 (optional)
+     * @param {Field} field2 (optional)
+     * @param {Field} etc (optional)
+     * @return Column The column container object
+     */
+    column : function(c){
+        var col = new Roo.form.Column(c);
+        this.start(col);
+        if(arguments.length > 1){ // duplicate code required because of Opera
+            this.add.apply(this, Array.prototype.slice.call(arguments, 1));
+            this.end();
+        }
+        return col;
+    },
+
+    /**
+     * Opens a new {@link Roo.form.FieldSet} container in the layout stack. If fields are passed after the config, the
+     * fields are added and the fieldset is closed. If no fields are passed the fieldset remains open
+     * until end() is called.
+     * @param {Object} config The config to pass to the fieldset
+     * @param {Field} field1 (optional)
+     * @param {Field} field2 (optional)
+     * @param {Field} etc (optional)
+     * @return FieldSet The fieldset container object
+     */
+    fieldset : function(c){
+        var fs = new Roo.form.FieldSet(c);
+        this.start(fs);
+        if(arguments.length > 1){ // duplicate code required because of Opera
+            this.add.apply(this, Array.prototype.slice.call(arguments, 1));
+            this.end();
+        }
+        return fs;
+    },
+
+    /**
+     * Opens a new {@link Roo.form.Layout} container in the layout stack. If fields are passed after the config, the
+     * fields are added and the container is closed. If no fields are passed the container remains open
+     * until end() is called.
+     * @param {Object} config The config to pass to the Layout
+     * @param {Field} field1 (optional)
+     * @param {Field} field2 (optional)
+     * @param {Field} etc (optional)
+     * @return Layout The container object
+     */
+    container : function(c){
+        var l = new Roo.form.Layout(c);
+        this.start(l);
+        if(arguments.length > 1){ // duplicate code required because of Opera
+            this.add.apply(this, Array.prototype.slice.call(arguments, 1));
+            this.end();
+        }
+        return l;
+    },
+
+    /**
+     * Opens the passed container in the layout stack. The container can be any {@link Roo.form.Layout} or subclass.
+     * @param {Object} container A Roo.form.Layout or subclass of Layout
+     * @return {Form} this
+     */
+    start : function(c){
+        // cascade label info
+        Roo.applyIf(c, {'labelAlign': this.active.labelAlign, 'labelWidth': this.active.labelWidth, 'itemCls': this.active.itemCls});
+        this.active.stack.push(c);
+        c.ownerCt = this.active;
+        this.active = c;
+        return this;
+    },
+
+    /**
+     * Closes the current open container
+     * @return {Form} this
+     */
+    end : function(){
+        if(this.active == this.root){
+            return this;
+        }
+        this.active = this.active.ownerCt;
+        return this;
+    },
+
+    /**
+     * Add Roo.form components to the current open container (e.g. column, fieldset, etc.).  Fields added via this method
+     * can also be passed with an additional property of fieldLabel, which if supplied, will provide the text to display
+     * as the label of the field.
+     * @param {Field} field1
+     * @param {Field} field2 (optional)
+     * @param {Field} etc. (optional)
+     * @return {Form} this
+     */
+    add : function(){
+        this.active.stack.push.apply(this.active.stack, arguments);
+        this.allItems.push.apply(this.allItems,arguments);
+        var r = [];
+        for(var i = 0, a = arguments, len = a.length; i < len; i++) {
+            if(a[i].isFormField){
+                r.push(a[i]);
+            }
+        }
+        if(r.length > 0){
+            Roo.form.Form.superclass.add.apply(this, r);
+        }
+        return this;
+    },
+    
+
+    
+    
+    
+     /**
+     * Find any element that has been added to a form, using it's ID or name
+     * This can include framesets, columns etc. along with regular fields..
+     * @param {String} id - id or name to find.
+     
+     * @return {Element} e - or false if nothing found.
+     */
+    findbyId : function(id)
+    {
+        var ret = false;
+        if (!id) {
+            return ret;
+        }
+        Roo.each(this.allItems, function(f){
+            if (f.id == id || f.name == id ){
+                ret = f;
+                return false;
+            }
+        });
+        return ret;
+    },
+
+    
+    
+    /**
+     * Render this form into the passed container. This should only be called once!
+     * @param {String/HTMLElement/Element} container The element this component should be rendered into
+     * @return {Form} this
+     */
+    render : function(ct)
+    {
+        
+        
+        
+        ct = Roo.get(ct);
+        var o = this.autoCreate || {
+            tag: 'form',
+            method : this.method || 'POST',
+            id : this.id || Roo.id()
+        };
+        this.initEl(ct.createChild(o));
+
+        this.root.render(this.el);
+        
+       
+             
+        this.items.each(function(f){
+            f.render('x-form-el-'+f.id);
+        });
+
+        if(this.buttons.length > 0){
+            // tables are required to maintain order and for correct IE layout
+            var tb = this.el.createChild({cls:'x-form-btns-ct', cn: {
+                cls:"x-form-btns x-form-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-form-btn-td';
+                b.render(tr.appendChild(td));
+            }
+        }
+        if(this.monitorValid){ // initialize after render
+            this.startMonitoring();
+        }
+        this.fireEvent('rendered', this);
+        return this;
+    },
+
+    /**
+     * Adds a button to the footer of the form - this <b>must</b> be called before the form is rendered.
+     * @param {String/Object} config A string becomes the button text, an object can either be a Button config
+     * object or a valid Roo.DomHelper element config
+     * @param {Function} handler The function called when the button is clicked
+     * @param {Object} scope (optional) The scope of the handler function
+     * @return {Roo.Button}
+     */
+    addButton : function(config, handler, scope){
+        var bc = {
+            handler: handler,
+            scope: scope,
+            minWidth: this.minButtonWidth,
+            hideParent:true
+        };
+        if(typeof config == "string"){
+            bc.text = config;
+        }else{
+            Roo.apply(bc, config);
+        }
+        var btn = new Roo.Button(null, bc);
+        this.buttons.push(btn);
+        return btn;
+    },
+
+     /**
+     * Adds a series of form elements (using the xtype property as the factory method.
+     * Valid xtypes are:  TextField, TextArea .... Button, Layout, FieldSet, Column, (and 'end' to close a block)
+     * @param {Object} config 
+     */
+    
+    addxtype : function()
+    {
+        var ar = Array.prototype.slice.call(arguments, 0);
+        var ret = false;
+        for(var i = 0; i < ar.length; i++) {
+            if (!ar[i]) {
+                continue; // skip -- if this happends something invalid got sent, we 
+                // should ignore it, as basically that interface element will not show up
+                // and that should be pretty obvious!!
+            }
+            
+            if (Roo.form[ar[i].xtype]) {
+                ar[i].form = this;
+                var fe = Roo.factory(ar[i], Roo.form);
+                if (!ret) {
+                    ret = fe;
+                }
+                fe.form = this;
+                if (fe.store) {
+                    fe.store.form = this;
+                }
+                if (fe.isLayout) {  
+                         
+                    this.start(fe);
+                    this.allItems.push(fe);
+                    if (fe.items && fe.addxtype) {
+                        fe.addxtype.apply(fe, fe.items);
+                        delete fe.items;
+                    }
+                     this.end();
+                    continue;
+                }
+                
+                
+                 
+                this.add(fe);
+              //  console.log('adding ' + ar[i].xtype);
+            }
+            if (ar[i].xtype == 'Button') {  
+                //console.log('adding button');
+                //console.log(ar[i]);
+                this.addButton(ar[i]);
+                this.allItems.push(fe);
+                continue;
+            }
+            
+            if (ar[i].xtype == 'end') { // so we can add fieldsets... / layout etc.
+                alert('end is not supported on xtype any more, use items');
+            //    this.end();
+            //    //console.log('adding end');
+            }
+            
+        }
+        return ret;
+    },
+    
+    /**
+     * Starts monitoring of the valid state of this form. Usually this is done by passing the config
+     * option "monitorValid"
+     */
+    startMonitoring : function(){
+        if(!this.bound){
+            this.bound = true;
+            Roo.TaskMgr.start({
+                run : this.bindHandler,
+                interval : this.monitorPoll || 200,
+                scope: this
+            });
+        }
+    },
+
+    /**
+     * Stops monitoring of the valid state of this form
+     */
+    stopMonitoring : function(){
+        this.bound = false;
+    },
+
+    // private
+    bindHandler : function(){
+        if(!this.bound){
+            return false; // stops binding
+        }
+        var valid = true;
+        this.items.each(function(f){
+            if(!f.isValid(true)){
+                valid = false;
+                return false;
+            }
+        });
+        for(var i = 0, len = this.buttons.length; i < len; i++){
+            var btn = this.buttons[i];
+            if(btn.formBind === true && btn.disabled === valid){
+                btn.setDisabled(!valid);
+            }
+        }
+        this.fireEvent('clientvalidation', this, valid);
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+});
+
+
+// back compat
+Roo.Form = Roo.form.Form;
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+ /**
+ * @class Roo.form.Action
+ * Internal Class used to handle form actions
+ * @constructor
+ * @param {Roo.form.BasicForm} el The form element or its id
+ * @param {Object} config Configuration options
+ */
+// define the action interface
+Roo.form.Action = function(form, options){
+    this.form = form;
+    this.options = options || {};
+};
+/**
+ * Client Validation Failed
+ * @const 
+ */
+Roo.form.Action.CLIENT_INVALID = 'client';
+/**
+ * Server Validation Failed
+ * @const 
+ */
+ Roo.form.Action.SERVER_INVALID = 'server';
+ /**
+ * Connect to Server Failed
+ * @const 
+ */
+Roo.form.Action.CONNECT_FAILURE = 'connect';
+/**
+ * Reading Data from Server Failed
+ * @const 
+ */
+Roo.form.Action.LOAD_FAILURE = 'load';
+
+Roo.form.Action.prototype = {
+    type : 'default',
+    failureType : undefined,
+    response : undefined,
+    result : undefined,
+
+    // interface method
+    run : function(options){
+
+    },
+
+    // interface method
+    success : function(response){
+
+    },
+
+    // interface method
+    handleResponse : function(response){
+
+    },
+
+    // default connection failure
+    failure : function(response){
+        
+        this.response = response;
+        this.failureType = Roo.form.Action.CONNECT_FAILURE;
+        this.form.afterAction(this, false);
+    },
+
+    processResponse : function(response){
+        this.response = response;
+        if(!response.responseText){
+            return true;
+        }
+        this.result = this.handleResponse(response);
+        return this.result;
+    },
+
+    // utility functions used internally
+    getUrl : function(appendParams){
+        var url = this.options.url || this.form.url || this.form.el.dom.action;
+        if(appendParams){
+            var p = this.getParams();
+            if(p){
+                url += (url.indexOf('?') != -1 ? '&' : '?') + p;
+            }
+        }
+        return url;
+    },
+
+    getMethod : function(){
+        return (this.options.method || this.form.method || this.form.el.dom.method || 'POST').toUpperCase();
+    },
+
+    getParams : function(){
+        var bp = this.form.baseParams;
+        var p = this.options.params;
+        if(p){
+            if(typeof p == "object"){
+                p = Roo.urlEncode(Roo.applyIf(p, bp));
+            }else if(typeof p == 'string' && bp){
+                p += '&' + Roo.urlEncode(bp);
+            }
+        }else if(bp){
+            p = Roo.urlEncode(bp);
+        }
+        return p;
+    },
+
+    createCallback : function(){
+        return {
+            success: this.success,
+            failure: this.failure,
+            scope: this,
+            timeout: (this.form.timeout*1000),
+            upload: this.form.fileUpload ? this.success : undefined
+        };
+    }
+};
+
+Roo.form.Action.Submit = function(form, options){
+    Roo.form.Action.Submit.superclass.constructor.call(this, form, options);
+};
+
+Roo.extend(Roo.form.Action.Submit, Roo.form.Action, {
+    type : 'submit',
+
+    haveProgress : false,
+    uploadComplete : false,
+    
+    // uploadProgress indicator.
+    uploadProgress : function()
+    {
+        if (!this.form.progressUrl) {
+            return;
+        }
+        
+        if (!this.haveProgress) {
+            Roo.MessageBox.progress("Uploading", "Uploading");
+        }
+        if (this.uploadComplete) {
+           Roo.MessageBox.hide();
+           return;
+        }
+        
+        this.haveProgress = true;
+   
+        var uid = this.form.findField('UPLOAD_IDENTIFIER').getValue();
+        
+        var c = new Roo.data.Connection();
+        c.request({
+            url : this.form.progressUrl,
+            params: {
+                id : uid
+            },
+            method: 'GET',
+            success : function(req){
+               //console.log(data);
+                var rdata = false;
+                var edata;
+                try  {
+                   rdata = Roo.decode(req.responseText)
+                } catch (e) {
+                    Roo.log("Invalid data from server..");
+                    Roo.log(edata);
+                    return;
+                }
+                if (!rdata || !rdata.success) {
+                    Roo.log(rdata);
+                    return;
+                }
+                var data = rdata.data;
+                
+                if (this.uploadComplete) {
+                   Roo.MessageBox.hide();
+                   return;
+                }
+                   
+                if (data){
+                    Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
+                       Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
+                    );
+                }
+                this.uploadProgress.defer(2000,this);
+            },
+       
+            failure: function(data) {
+                Roo.log('progress url failed ');
+                Roo.log(data);
+            },
+            scope : this
+        });
+           
+    },
+    
+    
+    run : function()
+    {
+        // run get Values on the form, so it syncs any secondary forms.
+        this.form.getValues();
+        
+        var o = this.options;
+        var method = this.getMethod();
+        var isPost = method == 'POST';
+        if(o.clientValidation === false || this.form.isValid()){
+            
+            if (this.form.progressUrl) {
+                this.form.findField('UPLOAD_IDENTIFIER').setValue(
+                    (new Date() * 1) + '' + Math.random());
+                    
+            } 
+            
+            
+            Roo.Ajax.request(Roo.apply(this.createCallback(), {
+                form:this.form.el.dom,
+                url:this.getUrl(!isPost),
+                method: method,
+                params:isPost ? this.getParams() : null,
+                isUpload: this.form.fileUpload
+            }));
+            
+            this.uploadProgress();
+
+        }else if (o.clientValidation !== false){ // client validation failed
+            this.failureType = Roo.form.Action.CLIENT_INVALID;
+            this.form.afterAction(this, false);
+        }
+    },
+
+    success : function(response)
+    {
+        this.uploadComplete= true;
+        if (this.haveProgress) {
+            Roo.MessageBox.hide();
+        }
+        
+        
+        var result = this.processResponse(response);
+        if(result === true || result.success){
+            this.form.afterAction(this, true);
+            return;
+        }
+        if(result.errors){
+            this.form.markInvalid(result.errors);
+            this.failureType = Roo.form.Action.SERVER_INVALID;
+        }
+        this.form.afterAction(this, false);
+    },
+    failure : function(response)
+    {
+        this.uploadComplete= true;
+        if (this.haveProgress) {
+            Roo.MessageBox.hide();
+        }
+        
+        this.response = response;
+        this.failureType = Roo.form.Action.CONNECT_FAILURE;
+        this.form.afterAction(this, false);
+    },
+    
+    handleResponse : function(response){
+        if(this.form.errorReader){
+            var rs = this.form.errorReader.read(response);
+            var errors = [];
+            if(rs.records){
+                for(var i = 0, len = rs.records.length; i < len; i++) {
+                    var r = rs.records[i];
+                    errors[i] = r.data;
+                }
+            }
+            if(errors.length < 1){
+                errors = null;
+            }
+            return {
+                success : rs.success,
+                errors : errors
+            };
+        }
+        var ret = false;
+        try {
+            ret = Roo.decode(response.responseText);
+        } catch (e) {
+            ret = {
+                success: false,
+                errorMsg: "Failed to read server message: " + (response ? response.responseText : ' - no message'),
+                errors : []
+            };
+        }
+        return ret;
+        
+    }
+});
+
+
+Roo.form.Action.Load = function(form, options){
+    Roo.form.Action.Load.superclass.constructor.call(this, form, options);
+    this.reader = this.form.reader;
+};
+
+Roo.extend(Roo.form.Action.Load, Roo.form.Action, {
+    type : 'load',
+
+    run : function(){
+        
+        Roo.Ajax.request(Roo.apply(
+                this.createCallback(), {
+                    method:this.getMethod(),
+                    url:this.getUrl(false),
+                    params:this.getParams()
+        }));
+    },
+
+    success : function(response){
+        
+        var result = this.processResponse(response);
+        if(result === true || !result.success || !result.data){
+            this.failureType = Roo.form.Action.LOAD_FAILURE;
+            this.form.afterAction(this, false);
+            return;
+        }
+        this.form.clearInvalid();
+        this.form.setValues(result.data);
+        this.form.afterAction(this, true);
+    },
+
+    handleResponse : function(response){
+        if(this.form.reader){
+            var rs = this.form.reader.read(response);
+            var data = rs.records && rs.records[0] ? rs.records[0].data : null;
+            return {
+                success : rs.success,
+                data : data
+            };
+        }
+        return Roo.decode(response.responseText);
+    }
+});
+
+Roo.form.Action.ACTION_TYPES = {
+    'load' : Roo.form.Action.Load,
+    'submit' : Roo.form.Action.Submit
+};/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.form.Layout
+ * @extends Roo.Component
+ * Creates a container for layout and rendering of fields in an {@link Roo.form.Form}.
+ * @constructor
+ * @param {Object} config Configuration options
+ */
+Roo.form.Layout = function(config){
+    var xitems = [];
+    if (config.items) {
+        xitems = config.items;
+        delete config.items;
+    }
+    Roo.form.Layout.superclass.constructor.call(this, config);
+    this.stack = [];
+    Roo.each(xitems, this.addxtype, this);
+     
+};
+
+Roo.extend(Roo.form.Layout, Roo.Component, {
+    /**
+     * @cfg {String/Object} autoCreate
+     * A DomHelper element spec used to autocreate the layout (defaults to {tag: 'div', cls: 'x-form-ct'})
+     */
+    /**
+     * @cfg {String/Object/Function} style
+     * A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or
+     * a function which returns such a specification.
+     */
+    /**
+     * @cfg {String} labelAlign
+     * Valid values are "left," "top" and "right" (defaults to "left")
+     */
+    /**
+     * @cfg {Number} labelWidth
+     * Fixed width in pixels of all field labels (defaults to undefined)
+     */
+    /**
+     * @cfg {Boolean} clear
+     * True to add a clearing element at the end of this layout, equivalent to CSS clear: both (defaults to true)
+     */
+    clear : true,
+    /**
+     * @cfg {String} labelSeparator
+     * The separator to use after field labels (defaults to ':')
+     */
+    labelSeparator : ':',
+    /**
+     * @cfg {Boolean} hideLabels
+     * True to suppress the display of field labels in this layout (defaults to false)
+     */
+    hideLabels : false,
+
+    // private
+    defaultAutoCreate : {tag: 'div', cls: 'x-form-ct'},
+    
+    isLayout : true,
+    
+    // private
+    onRender : function(ct, position){
+        if(this.el){ // from markup
+            this.el = Roo.get(this.el);
+        }else {  // generate
+            var cfg = this.getAutoCreate();
+            this.el = ct.createChild(cfg, position);
+        }
+        if(this.style){
+            this.el.applyStyles(this.style);
+        }
+        if(this.labelAlign){
+            this.el.addClass('x-form-label-'+this.labelAlign);
+        }
+        if(this.hideLabels){
+            this.labelStyle = "display:none";
+            this.elementStyle = "padding-left:0;";
+        }else{
+            if(typeof this.labelWidth == 'number'){
+                this.labelStyle = "width:"+this.labelWidth+"px;";
+                this.elementStyle = "padding-left:"+((this.labelWidth+(typeof this.labelPad == 'number' ? this.labelPad : 5))+'px')+";";
+            }
+            if(this.labelAlign == 'top'){
+                this.labelStyle = "width:auto;";
+                this.elementStyle = "padding-left:0;";
+            }
+        }
+        var stack = this.stack;
+        var slen = stack.length;
+        if(slen > 0){
+            if(!this.fieldTpl){
+                var t = new Roo.Template(
+                    '<div class="x-form-item {5}">',
+                        '<label for="{0}" style="{2}">{1}{4}</label>',
+                        '<div class="x-form-element" id="x-form-el-{0}" style="{3}">',
+                        '</div>',
+                    '</div><div class="x-form-clear-left"></div>'
+                );
+                t.disableFormats = true;
+                t.compile();
+                Roo.form.Layout.prototype.fieldTpl = t;
+            }
+            for(var i = 0; i < slen; i++) {
+                if(stack[i].isFormField){
+                    this.renderField(stack[i]);
+                }else{
+                    this.renderComponent(stack[i]);
+                }
+            }
+        }
+        if(this.clear){
+            this.el.createChild({cls:'x-form-clear'});
+        }
+    },
+
+    // private
+    renderField : function(f){
+        f.fieldEl = Roo.get(this.fieldTpl.append(this.el, [
+               f.id, //0
+               f.fieldLabel, //1
+               f.labelStyle||this.labelStyle||'', //2
+               this.elementStyle||'', //3
+               typeof f.labelSeparator == 'undefined' ? this.labelSeparator : f.labelSeparator, //4
+               f.itemCls||this.itemCls||''  //5
+       ], true).getPrevSibling());
+    },
+
+    // private
+    renderComponent : function(c){
+        c.render(c.isLayout ? this.el : this.el.createChild());    
+    },
+    /**
+     * Adds a object form elements (using the xtype property as the factory method.)
+     * Valid xtypes are:  TextField, TextArea .... Button, Layout, FieldSet, Column
+     * @param {Object} config 
+     */
+    addxtype : function(o)
+    {
+        // create the lement.
+        o.form = this.form;
+        var fe = Roo.factory(o, Roo.form);
+        this.form.allItems.push(fe);
+        this.stack.push(fe);
+        
+        if (fe.isFormField) {
+            this.form.items.add(fe);
+        }
+         
+        return fe;
+    }
+});
+
+/**
+ * @class Roo.form.Column
+ * @extends Roo.form.Layout
+ * Creates a column container for layout and rendering of fields in an {@link Roo.form.Form}.
+ * @constructor
+ * @param {Object} config Configuration options
+ */
+Roo.form.Column = function(config){
+    Roo.form.Column.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.form.Column, Roo.form.Layout, {
+    /**
+     * @cfg {Number/String} width
+     * The fixed width of the column in pixels or CSS value (defaults to "auto")
+     */
+    /**
+     * @cfg {String/Object} autoCreate
+     * A DomHelper element spec used to autocreate the column (defaults to {tag: 'div', cls: 'x-form-ct x-form-column'})
+     */
+
+    // private
+    defaultAutoCreate : {tag: 'div', cls: 'x-form-ct x-form-column'},
+
+    // private
+    onRender : function(ct, position){
+        Roo.form.Column.superclass.onRender.call(this, ct, position);
+        if(this.width){
+            this.el.setWidth(this.width);
+        }
+    }
+});
+
+
+/**
+ * @class Roo.form.Row
+ * @extends Roo.form.Layout
+ * Creates a row container for layout and rendering of fields in an {@link Roo.form.Form}.
+ * @constructor
+ * @param {Object} config Configuration options
+ */
+
+Roo.form.Row = function(config){
+    Roo.form.Row.superclass.constructor.call(this, config);
+};
+Roo.extend(Roo.form.Row, Roo.form.Layout, {
+      /**
+     * @cfg {Number/String} width
+     * The fixed width of the column in pixels or CSS value (defaults to "auto")
+     */
+    /**
+     * @cfg {Number/String} height
+     * The fixed height of the column in pixels or CSS value (defaults to "auto")
+     */
+    defaultAutoCreate : {tag: 'div', cls: 'x-form-ct x-form-row'},
+    
+    padWidth : 20,
+    // private
+    onRender : function(ct, position){
+        //console.log('row render');
+        if(!this.rowTpl){
+            var t = new Roo.Template(
+                '<div class="x-form-item {5}" style="float:left;width:{6}px">',
+                    '<label for="{0}" style="{2}">{1}{4}</label>',
+                    '<div class="x-form-element" id="x-form-el-{0}" style="{3}">',
+                    '</div>',
+                '</div>'
+            );
+            t.disableFormats = true;
+            t.compile();
+            Roo.form.Layout.prototype.rowTpl = t;
+        }
+        this.fieldTpl = this.rowTpl;
+        
+        //console.log('lw' + this.labelWidth +', la:' + this.labelAlign);
+        var labelWidth = 100;
+        
+        if ((this.labelAlign != 'top')) {
+            if (typeof this.labelWidth == 'number') {
+                labelWidth = this.labelWidth
+            }
+            this.padWidth =  20 + labelWidth;
+            
+        }
+        
+        Roo.form.Column.superclass.onRender.call(this, ct, position);
+        if(this.width){
+            this.el.setWidth(this.width);
+        }
+        if(this.height){
+            this.el.setHeight(this.height);
+        }
+    },
+    
+    // private
+    renderField : function(f){
+        f.fieldEl = this.fieldTpl.append(this.el, [
+               f.id, f.fieldLabel,
+               f.labelStyle||this.labelStyle||'',
+               this.elementStyle||'',
+               typeof f.labelSeparator == 'undefined' ? this.labelSeparator : f.labelSeparator,
+               f.itemCls||this.itemCls||'',
+               f.width ? f.width + this.padWidth : 160 + this.padWidth
+       ],true);
+    }
+});
+
+/**
+ * @class Roo.form.FieldSet
+ * @extends Roo.form.Layout
+ * Creates a fieldset container for layout and rendering of fields in an {@link Roo.form.Form}.
+ * @constructor
+ * @param {Object} config Configuration options
+ */
+Roo.form.FieldSet = function(config){
+    Roo.form.FieldSet.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.form.FieldSet, Roo.form.Layout, {
+    /**
+     * @cfg {String} legend
+     * The text to display as the legend for the FieldSet (defaults to '')
+     */
+    /**
+     * @cfg {String/Object} autoCreate
+     * A DomHelper element spec used to autocreate the fieldset (defaults to {tag: 'fieldset', cn: {tag:'legend'}})
+     */
+
+    // private
+    defaultAutoCreate : {tag: 'fieldset', cn: {tag:'legend'}},
+
+    // private
+    onRender : function(ct, position){
+        Roo.form.FieldSet.superclass.onRender.call(this, ct, position);
+        if(this.legend){
+            this.setLegend(this.legend);
+        }
+    },
+
+    // private
+    setLegend : function(text){
+        if(this.rendered){
+            this.el.child('legend').update(text);
+        }
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.form.VTypes
+ * Overridable validation definitions. The validations provided are basic and intended to be easily customizable and extended.
+ * @singleton
+ */
+Roo.form.VTypes = function(){
+    // closure these in so they are only created once.
+    var alpha = /^[a-zA-Z_]+$/;
+    var alphanum = /^[a-zA-Z0-9_]+$/;
+    var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;
+    var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
+
+    // All these messages and functions are configurable
+    return {
+        /**
+         * The function used to validate email addresses
+         * @param {String} value The email address
+         */
+        'email' : function(v){
+            return email.test(v);
+        },
+        /**
+         * The error text to display when the email validation function returns false
+         * @type String
+         */
+        'emailText' : 'This field should be an e-mail address in the format "user@domain.com"',
+        /**
+         * The keystroke filter mask to be applied on email input
+         * @type RegExp
+         */
+        'emailMask' : /[a-z0-9_\.\-@]/i,
+
+        /**
+         * The function used to validate URLs
+         * @param {String} value The URL
+         */
+        'url' : function(v){
+            return url.test(v);
+        },
+        /**
+         * The error text to display when the url validation function returns false
+         * @type String
+         */
+        'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"',
+        
+        /**
+         * The function used to validate alpha values
+         * @param {String} value The value
+         */
+        'alpha' : function(v){
+            return alpha.test(v);
+        },
+        /**
+         * The error text to display when the alpha validation function returns false
+         * @type String
+         */
+        'alphaText' : 'This field should only contain letters and _',
+        /**
+         * The keystroke filter mask to be applied on alpha input
+         * @type RegExp
+         */
+        'alphaMask' : /[a-z_]/i,
+
+        /**
+         * The function used to validate alphanumeric values
+         * @param {String} value The value
+         */
+        'alphanum' : function(v){
+            return alphanum.test(v);
+        },
+        /**
+         * The error text to display when the alphanumeric validation function returns false
+         * @type String
+         */
+        'alphanumText' : 'This field should only contain letters, numbers and _',
+        /**
+         * The keystroke filter mask to be applied on alphanumeric input
+         * @type RegExp
+         */
+        'alphanumMask' : /[a-z0-9_]/i
+    };
+}();//<script type="text/javascript">
+
+/**
+ * @class Roo.form.FCKeditor
+ * @extends Roo.form.TextArea
+ * Wrapper around the FCKEditor http://www.fckeditor.net
+ * @constructor
+ * Creates a new FCKeditor
+ * @param {Object} config Configuration options
+ */
+Roo.form.FCKeditor = function(config){
+    Roo.form.FCKeditor.superclass.constructor.call(this, config);
+    this.addEvents({
+         /**
+         * @event editorinit
+         * Fired when the editor is initialized - you can add extra handlers here..
+         * @param {FCKeditor} this
+         * @param {Object} the FCK object.
+         */
+        editorinit : true
+    });
+    
+    
+};
+Roo.form.FCKeditor.editors = { };
+Roo.extend(Roo.form.FCKeditor, Roo.form.TextArea,
+{
+    //defaultAutoCreate : {
+    //    tag : "textarea",style   : "width:100px;height:60px;" ,autocomplete    : "off"
+    //},
+    // private
+    /**
+     * @cfg {Object} fck options - see fck manual for details.
+     */
+    fckconfig : false,
+    
+    /**
+     * @cfg {Object} fck toolbar set (Basic or Default)
+     */
+    toolbarSet : 'Basic',
+    /**
+     * @cfg {Object} fck BasePath
+     */ 
+    basePath : '/fckeditor/',
+    
+    
+    frame : false,
+    
+    value : '',
+    
+   
+    onRender : function(ct, position)
+    {
+        if(!this.el){
+            this.defaultAutoCreate = {
+                tag: "textarea",
+                style:"width:300px;height:60px;",
+                autocomplete: "off"
+            };
+        }
+        Roo.form.FCKeditor.superclass.onRender.call(this, ct, position);
+        /*
+        if(this.grow){
+            this.textSizeEl = Roo.DomHelper.append(document.body, {tag: "pre", cls: "x-form-grow-sizer"});
+            if(this.preventScrollbars){
+                this.el.setStyle("overflow", "hidden");
+            }
+            this.el.setHeight(this.growMin);
+        }
+        */
+        //console.log('onrender' + this.getId() );
+        Roo.form.FCKeditor.editors[this.getId()] = this;
+         
+
+        this.replaceTextarea() ;
+        
+    },
+    
+    getEditor : function() {
+        return this.fckEditor;
+    },
+    /**
+     * Sets a data value into the field and validates it.  To set the value directly without validation see {@link #setRawValue}.
+     * @param {Mixed} value The value to set
+     */
+    
+    
+    setValue : function(value)
+    {
+        //console.log('setValue: ' + value);
+        
+        if(typeof(value) == 'undefined') { // not sure why this is happending...
+            return;
+        }
+        Roo.form.FCKeditor.superclass.setValue.apply(this,[value]);
+        
+        //if(!this.el || !this.getEditor()) {
+        //    this.value = value;
+            //this.setValue.defer(100,this,[value]);    
+        //    return;
+        //} 
+        
+        if(!this.getEditor()) {
+            return;
+        }
+        
+        this.getEditor().SetData(value);
+        
+        //
+
+    },
+
+    /**
+     * Returns the normalized data value (undefined or emptyText will be returned as '').  To return the raw value see {@link #getRawValue}.
+     * @return {Mixed} value The field value
+     */
+    getValue : function()
+    {
+        
+        if (this.frame && this.frame.dom.style.display == 'none') {
+            return Roo.form.FCKeditor.superclass.getValue.call(this);
+        }
+        
+        if(!this.el || !this.getEditor()) {
+           
+           // this.getValue.defer(100,this); 
+            return this.value;
+        }
+       
+        
+        var value=this.getEditor().GetData();
+        Roo.form.FCKeditor.superclass.setValue.apply(this,[value]);
+        return Roo.form.FCKeditor.superclass.getValue.call(this);
+        
+
+    },
+
+    /**
+     * Returns the raw data value which may or may not be a valid, defined value.  To return a normalized value see {@link #getValue}.
+     * @return {Mixed} value The field value
+     */
+    getRawValue : function()
+    {
+        if (this.frame && this.frame.dom.style.display == 'none') {
+            return Roo.form.FCKeditor.superclass.getRawValue.call(this);
+        }
+        
+        if(!this.el || !this.getEditor()) {
+            //this.getRawValue.defer(100,this); 
+            return this.value;
+            return;
+        }
+        
+        
+        
+        var value=this.getEditor().GetData();
+        Roo.form.FCKeditor.superclass.setRawValue.apply(this,[value]);
+        return Roo.form.FCKeditor.superclass.getRawValue.call(this);
+         
+    },
+    
+    setSize : function(w,h) {
+        
+        
+        
+        //if (this.frame && this.frame.dom.style.display == 'none') {
+        //    Roo.form.FCKeditor.superclass.setSize.apply(this, [w, h]);
+        //    return;
+        //}
+        //if(!this.el || !this.getEditor()) {
+        //    this.setSize.defer(100,this, [w,h]); 
+        //    return;
+        //}
+        
+        
+        
+        Roo.form.FCKeditor.superclass.setSize.apply(this, [w, h]);
+        
+        this.frame.dom.setAttribute('width', w);
+        this.frame.dom.setAttribute('height', h);
+        this.frame.setSize(w,h);
+        
+    },
+    
+    toggleSourceEdit : function(value) {
+        
+      
+         
+        this.el.dom.style.display = value ? '' : 'none';
+        this.frame.dom.style.display = value ?  'none' : '';
+        
+    },
+    
+    
+    focus: function(tag)
+    {
+        if (this.frame.dom.style.display == 'none') {
+            return Roo.form.FCKeditor.superclass.focus.call(this);
+        }
+        if(!this.el || !this.getEditor()) {
+            this.focus.defer(100,this, [tag]); 
+            return;
+        }
+        
+        
+        
+        
+        var tgs = this.getEditor().EditorDocument.getElementsByTagName(tag);
+        this.getEditor().Focus();
+        if (tgs.length) {
+            if (!this.getEditor().Selection.GetSelection()) {
+                this.focus.defer(100,this, [tag]); 
+                return;
+            }
+            
+            
+            var r = this.getEditor().EditorDocument.createRange();
+            r.setStart(tgs[0],0);
+            r.setEnd(tgs[0],0);
+            this.getEditor().Selection.GetSelection().removeAllRanges();
+            this.getEditor().Selection.GetSelection().addRange(r);
+            this.getEditor().Focus();
+        }
+        
+    },
+    
+    
+    
+    replaceTextarea : function()
+    {
+        if ( document.getElementById( this.getId() + '___Frame' ) )
+            return ;
+        //if ( !this.checkBrowser || this._isCompatibleBrowser() )
+        //{
+            // We must check the elements firstly using the Id and then the name.
+        var oTextarea = document.getElementById( this.getId() );
+        
+        var colElementsByName = document.getElementsByName( this.getId() ) ;
+         
+        oTextarea.style.display = 'none' ;
+
+        if ( oTextarea.tabIndex ) {            
+            this.TabIndex = oTextarea.tabIndex ;
+        }
+        
+        this._insertHtmlBefore( this._getConfigHtml(), oTextarea ) ;
+        this._insertHtmlBefore( this._getIFrameHtml(), oTextarea ) ;
+        this.frame = Roo.get(this.getId() + '___Frame')
+    },
+    
+    _getConfigHtml : function()
+    {
+        var sConfig = '' ;
+
+        for ( var o in this.fckconfig ) {
+            sConfig += sConfig.length > 0  ? '&amp;' : '';
+            sConfig += encodeURIComponent( o ) + '=' + encodeURIComponent( this.fckconfig[o] ) ;
+        }
+
+        return '<input type="hidden" id="' + this.getId() + '___Config" value="' + sConfig + '" style="display:none" />' ;
+    },
+    
+    
+    _getIFrameHtml : function()
+    {
+        var sFile = 'fckeditor.html' ;
+        /* no idea what this is about..
+        try
+        {
+            if ( (/fcksource=true/i).test( window.top.location.search ) )
+                sFile = 'fckeditor.original.html' ;
+        }
+        catch (e) { 
+        */
+
+        var sLink = this.basePath + 'editor/' + sFile + '?InstanceName=' + encodeURIComponent( this.getId() ) ;
+        sLink += this.toolbarSet ? ( '&amp;Toolbar=' + this.toolbarSet)  : '';
+        
+        
+        var html = '<iframe id="' + this.getId() +
+            '___Frame" src="' + sLink +
+            '" width="' + this.width +
+            '" height="' + this.height + '"' +
+            (this.tabIndex ?  ' tabindex="' + this.tabIndex + '"' :'' ) +
+            ' frameborder="0" scrolling="no"></iframe>' ;
+
+        return html ;
+    },
+    
+    _insertHtmlBefore : function( html, element )
+    {
+        if ( element.insertAdjacentHTML )      {
+            // IE
+            element.insertAdjacentHTML( 'beforeBegin', html ) ;
+        } else { // Gecko
+            var oRange = document.createRange() ;
+            oRange.setStartBefore( element ) ;
+            var oFragment = oRange.createContextualFragment( html );
+            element.parentNode.insertBefore( oFragment, element ) ;
+        }
+    }
+    
+    
+  
+    
+    
+    
+    
+
+});
+
+//Roo.reg('fckeditor', Roo.form.FCKeditor);
+
+function FCKeditor_OnComplete(editorInstance){
+    var f = Roo.form.FCKeditor.editors[editorInstance.Name];
+    f.fckEditor = editorInstance;
+    //console.log("loaded");
+    f.fireEvent('editorinit', f, editorInstance);
+} 
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//<script type="text/javascript">
+/**
+ * @class Roo.form.GridField
+ * @extends Roo.form.Field
+ * Embed a grid (or editable grid into a form)
+ * STATUS ALPHA
+ * 
+ * This embeds a grid in a form, the value of the field should be the json encoded array of rows
+ * it needs 
+ * xgrid.store = Roo.data.Store
+ * xgrid.store.proxy = Roo.data.MemoryProxy (data = [] )
+ * xgrid.store.reader = Roo.data.JsonReader 
+ * 
+ * 
+ * @constructor
+ * Creates a new GridField
+ * @param {Object} config Configuration options
+ */
+Roo.form.GridField = function(config){
+    Roo.form.GridField.superclass.constructor.call(this, config);
+     
+};
+
+Roo.extend(Roo.form.GridField, Roo.form.Field,  {
+    /**
+     * @cfg {Number} width  - used to restrict width of grid..
+     */
+    width : 100,
+    /**
+     * @cfg {Number} height - used to restrict height of grid..
+     */
+    height : 50,
+     /**
+     * @cfg {Object} xgrid (xtype'd description of grid) { xtype : 'Grid', dataSource: .... }
+         * 
+         *}
+     */
+    xgrid : false, 
+    /**
+     * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
+     * {tag: "input", type: "checkbox", autocomplete: "off"})
+     */
+   // defaultAutoCreate : { tag: 'div' },
+    defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'off'},
+    /**
+     * @cfg {String} addTitle Text to include for adding a title.
+     */
+    addTitle : false,
+    //
+    onResize : function(){
+        Roo.form.Field.superclass.onResize.apply(this, arguments);
+    },
+
+    initEvents : function(){
+        // Roo.form.Checkbox.superclass.initEvents.call(this);
+        // has no events...
+       
+    },
+
+
+    getResizeEl : function(){
+        return this.wrap;
+    },
+
+    getPositionEl : function(){
+        return this.wrap;
+    },
+
+    // private
+    onRender : function(ct, position){
+        
+        this.style = this.style || 'overflow: hidden; border:1px solid #c3daf9;';
+        var style = this.style;
+        delete this.style;
+        
+        Roo.form.GridField.superclass.onRender.call(this, ct, position);
+        this.wrap = this.el.wrap({cls: ''}); // not sure why ive done thsi...
+        this.viewEl = this.wrap.createChild({ tag: 'div' });
+        if (style) {
+            this.viewEl.applyStyles(style);
+        }
+        if (this.width) {
+            this.viewEl.setWidth(this.width);
+        }
+        if (this.height) {
+            this.viewEl.setHeight(this.height);
+        }
+        //if(this.inputValue !== undefined){
+        //this.setValue(this.value);
+        
+        
+        this.grid = new Roo.grid[this.xgrid.xtype](this.viewEl, this.xgrid);
+        
+        
+        this.grid.render();
+        this.grid.getDataSource().on('remove', this.refreshValue, this);
+        this.grid.getDataSource().on('update', this.refreshValue, this);
+        this.grid.on('afteredit', this.refreshValue, this);
+    },
+     
+    
+    /**
+     * Sets the value of the item. 
+     * @param {String} either an object  or a string..
+     */
+    setValue : function(v){
+        //this.value = v;
+        v = v || []; // empty set..
+        // this does not seem smart - it really only affects memoryproxy grids..
+        if (this.grid && this.grid.getDataSource() && typeof(v) != 'undefined') {
+            var ds = this.grid.getDataSource();
+            // assumes a json reader..
+            var data = {}
+            data[ds.reader.meta.root ] =  typeof(v) == 'string' ? Roo.decode(v) : v;
+            ds.loadData( data);
+        }
+        // clear selection so it does not get stale.
+        if (this.grid.sm) { 
+            this.grid.sm.clearSelections();
+        }
+        
+        Roo.form.GridField.superclass.setValue.call(this, v);
+        this.refreshValue();
+        // should load data in the grid really....
+    },
+    
+    // private
+    refreshValue: function() {
+         var val = [];
+        this.grid.getDataSource().each(function(r) {
+            val.push(r.data);
+        });
+        this.el.dom.value = Roo.encode(val);
+    }
+    
+     
+    
+    
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.form.DisplayField
+ * @extends Roo.form.Field
+ * A generic Field to display non-editable data.
+ * @constructor
+ * Creates a new Display Field item.
+ * @param {Object} config Configuration options
+ */
+Roo.form.DisplayField = function(config){
+    Roo.form.DisplayField.superclass.constructor.call(this, config);
+    
+};
+
+Roo.extend(Roo.form.DisplayField, Roo.form.TextField,  {
+    inputType:      'hidden',
+    allowBlank:     true,
+    readOnly:         true,
+    
+    /**
+     * @cfg {String} focusClass The CSS class to use when the checkbox receives focus (defaults to undefined)
+     */
+    focusClass : undefined,
+    /**
+     * @cfg {String} fieldClass The default CSS class for the checkbox (defaults to "x-form-field")
+     */
+    fieldClass: 'x-form-field',
+    
+     /**
+     * @cfg {Function} valueRenderer The renderer for the field (so you can reformat output). should return raw HTML
+     */
+    valueRenderer: undefined,
+    
+    width: 100,
+    /**
+     * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
+     * {tag: "input", type: "checkbox", autocomplete: "off"})
+     */
+     
+ //   defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'off'},
+
+    onResize : function(){
+        Roo.form.DisplayField.superclass.onResize.apply(this, arguments);
+        
+    },
+
+    initEvents : function(){
+        // Roo.form.Checkbox.superclass.initEvents.call(this);
+        // has no events...
+       
+    },
+
+
+    getResizeEl : function(){
+        return this.wrap;
+    },
+
+    getPositionEl : function(){
+        return this.wrap;
+    },
+
+    // private
+    onRender : function(ct, position){
+        
+        Roo.form.DisplayField.superclass.onRender.call(this, ct, position);
+        //if(this.inputValue !== undefined){
+        this.wrap = this.el.wrap();
+        
+        this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
+        
+        if (this.bodyStyle) {
+            this.viewEl.applyStyles(this.bodyStyle);
+        }
+        //this.viewEl.setStyle('padding', '2px');
+        
+        this.setValue(this.value);
+        
+    },
+/*
+    // private
+    initValue : Roo.emptyFn,
+
+  */
+
+       // private
+    onClick : function(){
+        
+    },
+
+    /**
+     * Sets the checked state of the checkbox.
+     * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
+     */
+    setValue : function(v){
+        this.value = v;
+        var html = this.valueRenderer ?  this.valueRenderer(v) : String.format('{0}', v);
+        // this might be called before we have a dom element..
+        if (!this.viewEl) {
+            return;
+        }
+        this.viewEl.dom.innerHTML = html;
+        Roo.form.DisplayField.superclass.setValue.call(this, v);
+
+    }
+});/*
+ * 
+ * Licence- LGPL
+ * 
+ */
+
+/**
+ * @class Roo.form.DayPicker
+ * @extends Roo.form.Field
+ * A Day picker show [M] [T] [W] ....
+ * @constructor
+ * Creates a new Day Picker
+ * @param {Object} config Configuration options
+ */
+Roo.form.DayPicker= function(config){
+    Roo.form.DayPicker.superclass.constructor.call(this, config);
+     
+};
+
+Roo.extend(Roo.form.DayPicker, Roo.form.Field,  {
+    /**
+     * @cfg {String} focusClass The CSS class to use when the checkbox receives focus (defaults to undefined)
+     */
+    focusClass : undefined,
+    /**
+     * @cfg {String} fieldClass The default CSS class for the checkbox (defaults to "x-form-field")
+     */
+    fieldClass: "x-form-field",
+   
+    /**
+     * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
+     * {tag: "input", type: "checkbox", autocomplete: "off"})
+     */
+    defaultAutoCreate : { tag: "input", type: 'hidden', autocomplete: "off"},
+    
+   
+    actionMode : 'viewEl', 
+    //
+    // private
+    inputType : 'hidden',
+    
+     
+    inputElement: false, // real input element?
+    basedOn: false, // ????
+    
+    isFormField: true, // not sure where this is needed!!!!
+
+    onResize : function(){
+        Roo.form.Checkbox.superclass.onResize.apply(this, arguments);
+        if(!this.boxLabel){
+            this.el.alignTo(this.wrap, 'c-c');
+        }
+    },
+
+    initEvents : function(){
+        Roo.form.Checkbox.superclass.initEvents.call(this);
+        this.el.on("click", this.onClick,  this);
+        this.el.on("change", this.onClick,  this);
+    },
+
+
+    getResizeEl : function(){
+        return this.wrap;
+    },
+
+    getPositionEl : function(){
+        return this.wrap;
+    },
+
+    
+    // private
+    onRender : function(ct, position){
+        Roo.form.Checkbox.superclass.onRender.call(this, ct, position);
+       
+        this.wrap = this.el.wrap({cls: 'x-form-daypick-item '});
+        
+        var r1 = '<table><tr>';
+        var r2 = '<tr class="x-form-daypick-icons">';
+        for (var i=0; i < 7; i++) {
+            r1+= '<td><div>' + Date.dayNames[i].substring(0,3) + '</div></td>';
+            r2+= '<td><img class="x-menu-item-icon" src="' + Roo.BLANK_IMAGE_URL  +'"></td>';
+        }
+        
+        var viewEl = this.wrap.createChild( r1 + '</tr>' + r2 + '</tr></table>');
+        viewEl.select('img').on('click', this.onClick, this);
+        this.viewEl = viewEl;   
+        
+        
+        // this will not work on Chrome!!!
+        this.el.on('DOMAttrModified', this.setFromHidden,  this); //ff
+        this.el.on('propertychange', this.setFromHidden,  this);  //ie
+        
+        
+          
+
+    },
+
+    // private
+    initValue : Roo.emptyFn,
+
+    /**
+     * Returns the checked state of the checkbox.
+     * @return {Boolean} True if checked, else false
+     */
+    getValue : function(){
+        return this.el.dom.value;
+        
+    },
+
+       // private
+    onClick : function(e){ 
+        //this.setChecked(!this.checked);
+        Roo.get(e.target).toggleClass('x-menu-item-checked');
+        this.refreshValue();
+        //if(this.el.dom.checked != this.checked){
+        //    this.setValue(this.el.dom.checked);
+       // }
+    },
+    
+    // private
+    refreshValue : function()
+    {
+        var val = '';
+        this.viewEl.select('img',true).each(function(e,i,n)  {
+            val += e.is(".x-menu-item-checked") ? String(n) : '';
+        });
+        this.setValue(val, true);
+    },
+
+    /**
+     * Sets the checked state of the checkbox.
+     * On is always based on a string comparison between inputValue and the param.
+     * @param {Boolean/String} value - the value to set 
+     * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
+     */
+    setValue : function(v,suppressEvent){
+        if (!this.el.dom) {
+            return;
+        }
+        var old = this.el.dom.value ;
+        this.el.dom.value = v;
+        if (suppressEvent) {
+            return ;
+        }
+         
+        // update display..
+        this.viewEl.select('img',true).each(function(e,i,n)  {
+            
+            var on = e.is(".x-menu-item-checked");
+            var newv = v.indexOf(String(n)) > -1;
+            if (on != newv) {
+                e.toggleClass('x-menu-item-checked');
+            }
+            
+        });
+        
+        
+        this.fireEvent('change', this, v, old);
+        
+        
+    },
+   
+    // handle setting of hidden value by some other method!!?!?
+    setFromHidden: function()
+    {
+        if(!this.el){
+            return;
+        }
+        //console.log("SET FROM HIDDEN");
+        //alert('setFrom hidden');
+        this.setValue(this.el.dom.value);
+    },
+    
+    onDestroy : function()
+    {
+        if(this.viewEl){
+            Roo.get(this.viewEl).remove();
+        }
+         
+        Roo.form.DayPicker.superclass.onDestroy.call(this);
+    }
+
+});/*
+ * RooJS Library 1.1.1
+ * Copyright(c) 2008-2011  Alan Knowles
+ *
+ * License - LGPL
+ */
+
+/**
+ * @class Roo.form.ComboCheck
+ * @extends Roo.form.ComboBox
+ * A combobox for multiple select items.
+ *
+ * FIXME - could do with a reset button..
+ * 
+ * @constructor
+ * Create a new ComboCheck
+ * @param {Object} config Configuration options
+ */
+Roo.form.ComboCheck = function(config){
+    Roo.form.ComboCheck.superclass.constructor.call(this, config);
+    // should verify some data...
+    // like
+    // hiddenName = required..
+    // displayField = required
+    // valudField == required
+    var req= [ 'hiddenName', 'displayField', 'valueField' ];
+    var _t = this;
+    Roo.each(req, function(e) {
+        if ((typeof(_t[e]) == 'undefined' ) || !_t[e].length) {
+            throw "Roo.form.ComboCheck : missing value for: " + e;
+        }
+    });
+    
+    
+};
+
+Roo.extend(Roo.form.ComboCheck, Roo.form.ComboBox, {
+     
+     
+    editable : false,
+     
+    selectedClass: 'x-menu-item-checked', 
+    
+    // private
+    onRender : function(ct, position){
+        var _t = this;
+        
+        
+        
+        if(!this.tpl){
+            var cls = 'x-combo-list';
+
+            
+            this.tpl =  new Roo.Template({
+                html :  '<div class="'+cls+'-item x-menu-check-item">' +
+                   '<img class="x-menu-item-icon" style="margin: 0px;" src="' + Roo.BLANK_IMAGE_URL + '">' + 
+                   '<span>{' + this.displayField + '}</span>' +
+                    '</div>' 
+                
+            });
+        }
+        
+        Roo.form.ComboCheck.superclass.onRender.call(this, ct, position);
+        this.view.singleSelect = false;
+        this.view.multiSelect = true;
+        this.view.toggleSelect = true;
+        this.pageTb.add(new Roo.Toolbar.Fill(), {
+            
+            text: 'Done',
+            handler: function()
+            {
+                _t.collapse();
+            }
+        });
+    },
+    
+    onViewOver : function(e, t){
+        // do nothing...
+        return;
+        
+    },
+    
+    onViewClick : function(doFocus,index){
+        return;
+        
+    },
+    select: function () {
+        //Roo.log("SELECT CALLED");
+    },
+     
+    selectByValue : function(xv, scrollIntoView){
+        var ar = this.getValueArray();
+        var sels = [];
+        
+        Roo.each(ar, function(v) {
+            if(v === undefined || v === null){
+                return;
+            }
+            var r = this.findRecord(this.valueField, v);
+            if(r){
+                sels.push(this.store.indexOf(r))
+                
+            }
+        },this);
+        this.view.select(sels);
+        return false;
+    },
+    
+    
+    
+    onSelect : function(record, index){
+       // Roo.log("onselect Called");
+       // this is only called by the clear button now..
+        this.view.clearSelections();
+        this.setValue('[]');
+        if (this.value != this.valueBefore) {
+            this.fireEvent('change', this, this.value, this.valueBefore);
+        }
+    },
+    getValueArray : function()
+    {
+        var ar = [] ;
+        
+        try {
+            //Roo.log(this.value);
+            if (typeof(this.value) == 'undefined') {
+                return [];
+            }
+            var ar = Roo.decode(this.value);
+            return  ar instanceof Array ? ar : []; //?? valid?
+            
+        } catch(e) {
+            Roo.log(e + "\nRoo.form.ComboCheck:getValueArray  invalid data:" + this.getValue());
+            return [];
+        }
+         
+    },
+    expand : function ()
+    {
+        Roo.form.ComboCheck.superclass.expand.call(this);
+        this.valueBefore = this.value;
+        
+
+    },
+    
+    collapse : function(){
+        Roo.form.ComboCheck.superclass.collapse.call(this);
+        var sl = this.view.getSelectedIndexes();
+        var st = this.store;
+        var nv = [];
+        var tv = [];
+        var r;
+        Roo.each(sl, function(i) {
+            r = st.getAt(i);
+            nv.push(r.get(this.valueField));
+        },this);
+        this.setValue(Roo.encode(nv));
+        if (this.value != this.valueBefore) {
+
+            this.fireEvent('change', this, this.value, this.valueBefore);
+        }
+        
+    },
+    
+    setValue : function(v){
+        // Roo.log(v);
+        this.value = v;
+        
+        var vals = this.getValueArray();
+        var tv = [];
+        Roo.each(vals, function(k) {
+            var r = this.findRecord(this.valueField, k);
+            if(r){
+                tv.push(r.data[this.displayField]);
+            }else if(this.valueNotFoundText !== undefined){
+                tv.push( this.valueNotFoundText );
+            }
+        },this);
+       // Roo.log(tv);
+        
+        Roo.form.ComboBox.superclass.setValue.call(this, tv.join(', '));
+        this.hiddenField.value = v;
+        this.value = v;
+    }
+    
+});//<script type="text/javasscript">
+
+/**
+ * @class Roo.DDView
+ * A DnD enabled version of Roo.View.
+ * @param {Element/String} container The Element in which to create the View.
+ * @param {String} tpl The template string used to create the markup for each element of the View
+ * @param {Object} config The configuration properties. These include all the config options of
+ * {@link Roo.View} plus some specific to this class.<br>
+ * <p>
+ * Drag/drop is implemented by adding {@link Roo.data.Record}s to the target DDView. If copying is
+ * not being performed, the original {@link Roo.data.Record} is removed from the source DDView.<br>
+ * <p>
+ * The following extra CSS rules are needed to provide insertion point highlighting:<pre><code>
+.x-view-drag-insert-above {
+       border-top:1px dotted #3366cc;
+}
+.x-view-drag-insert-below {
+       border-bottom:1px dotted #3366cc;
+}
+</code></pre>
+ * 
+ */
+Roo.DDView = function(container, tpl, config) {
+    Roo.DDView.superclass.constructor.apply(this, arguments);
+    this.getEl().setStyle("outline", "0px none");
+    this.getEl().unselectable();
+    if (this.dragGroup) {
+               this.setDraggable(this.dragGroup.split(","));
+    }
+    if (this.dropGroup) {
+               this.setDroppable(this.dropGroup.split(","));
+    }
+    if (this.deletable) {
+       this.setDeletable();
+    }
+    this.isDirtyFlag = false;
+       this.addEvents({
+               "drop" : true
+       });
+};
+
+Roo.extend(Roo.DDView, Roo.View, {
+/**    @cfg {String/Array} dragGroup The ddgroup name(s) for the View's DragZone. */
+/**    @cfg {String/Array} dropGroup The ddgroup name(s) for the View's DropZone. */
+/**    @cfg {Boolean} copy Causes drag operations to copy nodes rather than move. */
+/**    @cfg {Boolean} allowCopy Causes ctrl/drag operations to copy nodes rather than move. */
+
+       isFormField: true,
+
+       reset: Roo.emptyFn,
+       
+       clearInvalid: Roo.form.Field.prototype.clearInvalid,
+
+       validate: function() {
+               return true;
+       },
+       
+       destroy: function() {
+               this.purgeListeners();
+               this.getEl.removeAllListeners();
+               this.getEl().remove();
+               if (this.dragZone) {
+                       if (this.dragZone.destroy) {
+                               this.dragZone.destroy();
+                       }
+               }
+               if (this.dropZone) {
+                       if (this.dropZone.destroy) {
+                               this.dropZone.destroy();
+                       }
+               }
+       },
+
+/**    Allows this class to be an Roo.form.Field so it can be found using {@link Roo.form.BasicForm#findField}. */
+       getName: function() {
+               return this.name;
+       },
+
+/**    Loads the View from a JSON string representing the Records to put into the Store. */
+       setValue: function(v) {
+               if (!this.store) {
+                       throw "DDView.setValue(). DDView must be constructed with a valid Store";
+               }
+               var data = {};
+               data[this.store.reader.meta.root] = v ? [].concat(v) : [];
+               this.store.proxy = new Roo.data.MemoryProxy(data);
+               this.store.load();
+       },
+
+/**    @return {String} a parenthesised list of the ids of the Records in the View. */
+       getValue: function() {
+               var result = '(';
+               this.store.each(function(rec) {
+                       result += rec.id + ',';
+               });
+               return result.substr(0, result.length - 1) + ')';
+       },
+       
+       getIds: function() {
+               var i = 0, result = new Array(this.store.getCount());
+               this.store.each(function(rec) {
+                       result[i++] = rec.id;
+               });
+               return result;
+       },
+       
+       isDirty: function() {
+               return this.isDirtyFlag;
+       },
+
+/**
+ *     Part of the Roo.dd.DropZone interface. If no target node is found, the
+ *     whole Element becomes the target, and this causes the drop gesture to append.
+ */
+    getTargetFromEvent : function(e) {
+               var target = e.getTarget();
+               while ((target !== null) && (target.parentNode != this.el.dom)) {
+               target = target.parentNode;
+               }
+               if (!target) {
+                       target = this.el.dom.lastChild || this.el.dom;
+               }
+               return target;
+    },
+
+/**
+ *     Create the drag data which consists of an object which has the property "ddel" as
+ *     the drag proxy element. 
+ */
+    getDragData : function(e) {
+        var target = this.findItemFromChild(e.getTarget());
+               if(target) {
+                       this.handleSelection(e);
+                       var selNodes = this.getSelectedNodes();
+            var dragData = {
+                source: this,
+                copy: this.copy || (this.allowCopy && e.ctrlKey),
+                nodes: selNodes,
+                records: []
+                       };
+                       var selectedIndices = this.getSelectedIndexes();
+                       for (var i = 0; i < selectedIndices.length; i++) {
+                               dragData.records.push(this.store.getAt(selectedIndices[i]));
+                       }
+                       if (selNodes.length == 1) {
+                               dragData.ddel = target.cloneNode(true); // the div element
+                       } else {
+                               var div = document.createElement('div'); // create the multi element drag "ghost"
+                               div.className = 'multi-proxy';
+                               for (var i = 0, len = selNodes.length; i < len; i++) {
+                                       div.appendChild(selNodes[i].cloneNode(true));
+                               }
+                               dragData.ddel = div;
+                       }
+            //console.log(dragData)
+            //console.log(dragData.ddel.innerHTML)
+                       return dragData;
+               }
+        //console.log('nodragData')
+               return false;
+    },
+    
+/**    Specify to which ddGroup items in this DDView may be dragged. */
+    setDraggable: function(ddGroup) {
+       if (ddGroup instanceof Array) {
+               Roo.each(ddGroup, this.setDraggable, this);
+               return;
+       }
+       if (this.dragZone) {
+               this.dragZone.addToGroup(ddGroup);
+       } else {
+                       this.dragZone = new Roo.dd.DragZone(this.getEl(), {
+                               containerScroll: true,
+                               ddGroup: ddGroup 
+
+                       });
+//                     Draggability implies selection. DragZone's mousedown selects the element.
+                       if (!this.multiSelect) { this.singleSelect = true; }
+
+//                     Wire the DragZone's handlers up to methods in *this*
+                       this.dragZone.getDragData = this.getDragData.createDelegate(this);
+               }
+    },
+
+/**    Specify from which ddGroup this DDView accepts drops. */
+    setDroppable: function(ddGroup) {
+       if (ddGroup instanceof Array) {
+               Roo.each(ddGroup, this.setDroppable, this);
+               return;
+       }
+       if (this.dropZone) {
+               this.dropZone.addToGroup(ddGroup);
+       } else {
+                       this.dropZone = new Roo.dd.DropZone(this.getEl(), {
+                               containerScroll: true,
+                               ddGroup: ddGroup
+                       });
+
+//                     Wire the DropZone's handlers up to methods in *this*
+                       this.dropZone.getTargetFromEvent = this.getTargetFromEvent.createDelegate(this);
+                       this.dropZone.onNodeEnter = this.onNodeEnter.createDelegate(this);
+                       this.dropZone.onNodeOver = this.onNodeOver.createDelegate(this);
+                       this.dropZone.onNodeOut = this.onNodeOut.createDelegate(this);
+                       this.dropZone.onNodeDrop = this.onNodeDrop.createDelegate(this);
+               }
+    },
+
+/**    Decide whether to drop above or below a View node. */
+    getDropPoint : function(e, n, dd){
+       if (n == this.el.dom) { return "above"; }
+               var t = Roo.lib.Dom.getY(n), b = t + n.offsetHeight;
+               var c = t + (b - t) / 2;
+               var y = Roo.lib.Event.getPageY(e);
+               if(y <= c) {
+                       return "above";
+               }else{
+                       return "below";
+               }
+    },
+
+    onNodeEnter : function(n, dd, e, data){
+               return false;
+    },
+    
+    onNodeOver : function(n, dd, e, data){
+               var pt = this.getDropPoint(e, n, dd);
+               // set the insert point style on the target node
+               var dragElClass = this.dropNotAllowed;
+               if (pt) {
+                       var targetElClass;
+                       if (pt == "above"){
+                               dragElClass = n.previousSibling ? "x-tree-drop-ok-between" : "x-tree-drop-ok-above";
+                               targetElClass = "x-view-drag-insert-above";
+                       } else {
+                               dragElClass = n.nextSibling ? "x-tree-drop-ok-between" : "x-tree-drop-ok-below";
+                               targetElClass = "x-view-drag-insert-below";
+                       }
+                       if (this.lastInsertClass != targetElClass){
+                               Roo.fly(n).replaceClass(this.lastInsertClass, targetElClass);
+                               this.lastInsertClass = targetElClass;
+                       }
+               }
+               return dragElClass;
+       },
+
+    onNodeOut : function(n, dd, e, data){
+               this.removeDropIndicators(n);
+    },
+
+    onNodeDrop : function(n, dd, e, data){
+       if (this.fireEvent("drop", this, n, dd, e, data) === false) {
+               return false;
+       }
+       var pt = this.getDropPoint(e, n, dd);
+               var insertAt = (n == this.el.dom) ? this.nodes.length : n.nodeIndex;
+               if (pt == "below") { insertAt++; }
+               for (var i = 0; i < data.records.length; i++) {
+                       var r = data.records[i];
+                       var dup = this.store.getById(r.id);
+                       if (dup && (dd != this.dragZone)) {
+                               Roo.fly(this.getNode(this.store.indexOf(dup))).frame("red", 1);
+                       } else {
+                               if (data.copy) {
+                                       this.store.insert(insertAt++, r.copy());
+                               } else {
+                                       data.source.isDirtyFlag = true;
+                                       r.store.remove(r);
+                                       this.store.insert(insertAt++, r);
+                               }
+                               this.isDirtyFlag = true;
+                       }
+               }
+               this.dragZone.cachedTarget = null;
+               return true;
+    },
+
+    removeDropIndicators : function(n){
+               if(n){
+                       Roo.fly(n).removeClass([
+                               "x-view-drag-insert-above",
+                               "x-view-drag-insert-below"]);
+                       this.lastInsertClass = "_noclass";
+               }
+    },
+
+/**
+ *     Utility method. Add a delete option to the DDView's context menu.
+ *     @param {String} imageUrl The URL of the "delete" icon image.
+ */
+       setDeletable: function(imageUrl) {
+               if (!this.singleSelect && !this.multiSelect) {
+                       this.singleSelect = true;
+               }
+               var c = this.getContextMenu();
+               this.contextMenu.on("itemclick", function(item) {
+                       switch (item.id) {
+                               case "delete":
+                                       this.remove(this.getSelectedIndexes());
+                                       break;
+                       }
+               }, this);
+               this.contextMenu.add({
+                       icon: imageUrl,
+                       id: "delete",
+                       text: 'Delete'
+               });
+       },
+       
+/**    Return the context menu for this DDView. */
+       getContextMenu: function() {
+               if (!this.contextMenu) {
+//                     Create the View's context menu
+                       this.contextMenu = new Roo.menu.Menu({
+                               id: this.id + "-contextmenu"
+                       });
+                       this.el.on("contextmenu", this.showContextMenu, this);
+               }
+               return this.contextMenu;
+       },
+       
+       disableContextMenu: function() {
+               if (this.contextMenu) {
+                       this.el.un("contextmenu", this.showContextMenu, this);
+               }
+       },
+
+       showContextMenu: function(e, item) {
+        item = this.findItemFromChild(e.getTarget());
+               if (item) {
+                       e.stopEvent();
+                       this.select(this.getNode(item), this.multiSelect && e.ctrlKey, true);
+                       this.contextMenu.showAt(e.getXY());
+           }
+    },
+
+/**
+ *     Remove {@link Roo.data.Record}s at the specified indices.
+ *     @param {Array/Number} selectedIndices The index (or Array of indices) of Records to remove.
+ */
+    remove: function(selectedIndices) {
+               selectedIndices = [].concat(selectedIndices);
+               for (var i = 0; i < selectedIndices.length; i++) {
+                       var rec = this.store.getAt(selectedIndices[i]);
+                       this.store.remove(rec);
+               }
+    },
+
+/**
+ *     Double click fires the event, but also, if this is draggable, and there is only one other
+ *     related DropZone, it transfers the selected node.
+ */
+    onDblClick : function(e){
+        var item = this.findItemFromChild(e.getTarget());
+        if(item){
+            if (this.fireEvent("dblclick", this, this.indexOf(item), item, e) === false) {
+               return false;
+            }
+            if (this.dragGroup) {
+                   var targets = Roo.dd.DragDropMgr.getRelated(this.dragZone, true);
+                   while (targets.indexOf(this.dropZone) > -1) {
+                           targets.remove(this.dropZone);
+                               }
+                   if (targets.length == 1) {
+                                       this.dragZone.cachedTarget = null;
+                       var el = Roo.get(targets[0].getEl());
+                       var box = el.getBox(true);
+                       targets[0].onNodeDrop(el.dom, {
+                               target: el.dom,
+                               xy: [box.x, box.y + box.height - 1]
+                       }, null, this.getDragData(e));
+                   }
+               }
+        }
+    },
+    
+    handleSelection: function(e) {
+               this.dragZone.cachedTarget = null;
+        var item = this.findItemFromChild(e.getTarget());
+        if (!item) {
+               this.clearSelections(true);
+               return;
+        }
+               if (item && (this.multiSelect || this.singleSelect)){
+                       if(this.multiSelect && e.shiftKey && (!e.ctrlKey) && this.lastSelection){
+                               this.select(this.getNodes(this.indexOf(this.lastSelection), item.nodeIndex), false);
+                       }else if (this.isSelected(this.getNode(item)) && e.ctrlKey){
+                               this.unselect(item);
+                       } else {
+                               this.select(item, this.multiSelect && e.ctrlKey);
+                               this.lastSelection = item;
+                       }
+               }
+    },
+
+    onItemClick : function(item, index, e){
+               if(this.fireEvent("beforeclick", this, index, item, e) === false){
+                       return false;
+               }
+               return true;
+    },
+
+    unselect : function(nodeInfo, suppressEvent){
+               var node = this.getNode(nodeInfo);
+               if(node && this.isSelected(node)){
+                       if(this.fireEvent("beforeselect", this, node, this.selections) !== false){
+                               Roo.fly(node).removeClass(this.selectedClass);
+                               this.selections.remove(node);
+                               if(!suppressEvent){
+                                       this.fireEvent("selectionchange", this, this.selections);
+                               }
+                       }
+               }
+    }
+});
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.LayoutManager
+ * @extends Roo.util.Observable
+ * Base class for layout managers.
+ */
+Roo.LayoutManager = function(container, config){
+    Roo.LayoutManager.superclass.constructor.call(this);
+    this.el = Roo.get(container);
+    // ie scrollbar fix
+    if(this.el.dom == document.body && Roo.isIE && !config.allowScroll){
+        document.body.scroll = "no";
+    }else if(this.el.dom != document.body && this.el.getStyle('position') == 'static'){
+        this.el.position('relative');
+    }
+    this.id = this.el.id;
+    this.el.addClass("x-layout-container");
+    /** false to disable window resize monitoring @type Boolean */
+    this.monitorWindowResize = true;
+    this.regions = {};
+    this.addEvents({
+        /**
+         * @event layout
+         * Fires when a layout is performed. 
+         * @param {Roo.LayoutManager} this
+         */
+        "layout" : true,
+        /**
+         * @event regionresized
+         * Fires when the user resizes a region. 
+         * @param {Roo.LayoutRegion} region The resized region
+         * @param {Number} newSize The new size (width for east/west, height for north/south)
+         */
+        "regionresized" : true,
+        /**
+         * @event regioncollapsed
+         * Fires when a region is collapsed. 
+         * @param {Roo.LayoutRegion} region The collapsed region
+         */
+        "regioncollapsed" : true,
+        /**
+         * @event regionexpanded
+         * Fires when a region is expanded.  
+         * @param {Roo.LayoutRegion} region The expanded region
+         */
+        "regionexpanded" : true
+    });
+    this.updating = false;
+    Roo.EventManager.onWindowResize(this.onWindowResize, this, true);
+};
+
+Roo.extend(Roo.LayoutManager, Roo.util.Observable, {
+    /**
+     * Returns true if this layout is currently being updated
+     * @return {Boolean}
+     */
+    isUpdating : function(){
+        return this.updating; 
+    },
+    
+    /**
+     * Suspend the LayoutManager from doing auto-layouts while
+     * making multiple add or remove calls
+     */
+    beginUpdate : function(){
+        this.updating = true;    
+    },
+    
+    /**
+     * Restore auto-layouts and optionally disable the manager from performing a layout
+     * @param {Boolean} noLayout true to disable a layout update 
+     */
+    endUpdate : function(noLayout){
+        this.updating = false;
+        if(!noLayout){
+            this.layout();
+        }    
+    },
+    
+    layout: function(){
+        
+    },
+    
+    onRegionResized : function(region, newSize){
+        this.fireEvent("regionresized", region, newSize);
+        this.layout();
+    },
+    
+    onRegionCollapsed : function(region){
+        this.fireEvent("regioncollapsed", region);
+    },
+    
+    onRegionExpanded : function(region){
+        this.fireEvent("regionexpanded", region);
+    },
+        
+    /**
+     * Returns the size of the current view. This method normalizes document.body and element embedded layouts and
+     * performs box-model adjustments.
+     * @return {Object} The size as an object {width: (the width), height: (the height)}
+     */
+    getViewSize : function(){
+        var size;
+        if(this.el.dom != document.body){
+            size = this.el.getSize();
+        }else{
+            size = {width: Roo.lib.Dom.getViewWidth(), height: Roo.lib.Dom.getViewHeight()};
+        }
+        size.width -= this.el.getBorderWidth("lr")-this.el.getPadding("lr");
+        size.height -= this.el.getBorderWidth("tb")-this.el.getPadding("tb");
+        return size;
+    },
+    
+    /**
+     * Returns the Element this layout is bound to.
+     * @return {Roo.Element}
+     */
+    getEl : function(){
+        return this.el;
+    },
+    
+    /**
+     * Returns the specified region.
+     * @param {String} target The region key ('center', 'north', 'south', 'east' or 'west')
+     * @return {Roo.LayoutRegion}
+     */
+    getRegion : function(target){
+        return this.regions[target.toLowerCase()];
+    },
+    
+    onWindowResize : function(){
+        if(this.monitorWindowResize){
+            this.layout();
+        }
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.BorderLayout
+ * @extends Roo.LayoutManager
+ * This class represents a common layout manager used in desktop applications. For screenshots and more details,
+ * please see: <br><br>
+ * <a href="http://www.jackslocum.com/yui/2006/10/19/cross-browser-web-20-layouts-with-yahoo-ui/">Cross Browser Layouts - Part 1</a><br>
+ * <a href="http://www.jackslocum.com/yui/2006/10/28/cross-browser-web-20-layouts-part-2-ajax-feed-viewer-20/">Cross Browser Layouts - Part 2</a><br><br>
+ * Example:
+ <pre><code>
+ var layout = new Roo.BorderLayout(document.body, {
+    north: {
+        initialSize: 25,
+        titlebar: false
+    },
+    west: {
+        split:true,
+        initialSize: 200,
+        minSize: 175,
+        maxSize: 400,
+        titlebar: true,
+        collapsible: true
+    },
+    east: {
+        split:true,
+        initialSize: 202,
+        minSize: 175,
+        maxSize: 400,
+        titlebar: true,
+        collapsible: true
+    },
+    south: {
+        split:true,
+        initialSize: 100,
+        minSize: 100,
+        maxSize: 200,
+        titlebar: true,
+        collapsible: true
+    },
+    center: {
+        titlebar: true,
+        autoScroll:true,
+        resizeTabs: true,
+        minTabWidth: 50,
+        preferredTabWidth: 150
+    }
+});
+
+// shorthand
+var CP = Roo.ContentPanel;
+
+layout.beginUpdate();
+layout.add("north", new CP("north", "North"));
+layout.add("south", new CP("south", {title: "South", closable: true}));
+layout.add("west", new CP("west", {title: "West"}));
+layout.add("east", new CP("autoTabs", {title: "Auto Tabs", closable: true}));
+layout.add("center", new CP("center1", {title: "Close Me", closable: true}));
+layout.add("center", new CP("center2", {title: "Center Panel", closable: false}));
+layout.getRegion("center").showPanel("center1");
+layout.endUpdate();
+</code></pre>
+
+<b>The container the layout is rendered into can be either the body element or any other element.
+If it is not the body element, the container needs to either be an absolute positioned element,
+or you will need to add "position:relative" to the css of the container.  You will also need to specify
+the container size if it is not the body element.</b>
+
+* @constructor
+* Create a new BorderLayout
+* @param {String/HTMLElement/Element} container The container this layout is bound to
+* @param {Object} config Configuration options
+ */
+Roo.BorderLayout = function(container, config){
+    config = config || {};
+    Roo.BorderLayout.superclass.constructor.call(this, container, config);
+    this.factory = config.factory || Roo.BorderLayout.RegionFactory;
+    for(var i = 0, len = this.factory.validRegions.length; i < len; i++) {
+       var target = this.factory.validRegions[i];
+       if(config[target]){
+           this.addRegion(target, config[target]);
+       }
+    }
+};
+
+Roo.extend(Roo.BorderLayout, Roo.LayoutManager, {
+    /**
+     * Creates and adds a new region if it doesn't already exist.
+     * @param {String} target The target region key (north, south, east, west or center).
+     * @param {Object} config The regions config object
+     * @return {BorderLayoutRegion} The new region
+     */
+    addRegion : function(target, config){
+        if(!this.regions[target]){
+            var r = this.factory.create(target, this, config);
+           this.bindRegion(target, r);
+        }
+        return this.regions[target];
+    },
+
+    // private (kinda)
+    bindRegion : function(name, r){
+        this.regions[name] = r;
+        r.on("visibilitychange", this.layout, this);
+        r.on("paneladded", this.layout, this);
+        r.on("panelremoved", this.layout, this);
+        r.on("invalidated", this.layout, this);
+        r.on("resized", this.onRegionResized, this);
+        r.on("collapsed", this.onRegionCollapsed, this);
+        r.on("expanded", this.onRegionExpanded, this);
+    },
+
+    /**
+     * Performs a layout update.
+     */
+    layout : function(){
+        if(this.updating) return;
+        var size = this.getViewSize();
+        var w = size.width;
+        var h = size.height;
+        var centerW = w;
+        var centerH = h;
+        var centerY = 0;
+        var centerX = 0;
+        //var x = 0, y = 0;
+
+        var rs = this.regions;
+        var north = rs["north"];
+        var south = rs["south"]; 
+        var west = rs["west"];
+        var east = rs["east"];
+        var center = rs["center"];
+        //if(this.hideOnLayout){ // not supported anymore
+            //c.el.setStyle("display", "none");
+        //}
+        if(north && north.isVisible()){
+            var b = north.getBox();
+            var m = north.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;
+            north.updateBox(this.safeBox(b));
+        }
+        if(south && south.isVisible()){
+            var b = south.getBox();
+            var m = south.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;
+            south.updateBox(this.safeBox(b));
+        }
+        if(west && west.isVisible()){
+            var b = west.getBox();
+            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.updateBox(this.safeBox(b));
+        }
+        if(east && east.isVisible()){
+            var b = east.getBox();
+            var m = east.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;
+            east.updateBox(this.safeBox(b));
+        }
+        if(center){
+            var m = center.getMargins();
+            var centerBox = {
+                x: centerX + m.left,
+                y: centerY + m.top,
+                width: centerW - (m.left+m.right),
+                height: centerH - (m.top+m.bottom)
+            };
+            //if(this.hideOnLayout){
+                //center.el.setStyle("display", "block");
+            //}
+            center.updateBox(this.safeBox(centerBox));
+        }
+        this.el.repaint();
+        this.fireEvent("layout", this);
+    },
+
+    // private
+    safeBox : function(box){
+        box.width = Math.max(0, box.width);
+        box.height = Math.max(0, box.height);
+        return box;
+    },
+
+    /**
+     * Adds a ContentPanel (or subclass) to this layout.
+     * @param {String} target The target region key (north, south, east, west or center).
+     * @param {Roo.ContentPanel} panel The panel to add
+     * @return {Roo.ContentPanel} The added panel
+     */
+    add : function(target, panel){
+         
+        target = target.toLowerCase();
+        return this.regions[target].add(panel);
+    },
+
+    /**
+     * Remove a ContentPanel (or subclass) to this layout.
+     * @param {String} target The target region key (north, south, east, west or center).
+     * @param {Number/String/Roo.ContentPanel} panel The index, id or panel to remove
+     * @return {Roo.ContentPanel} The removed panel
+     */
+    remove : function(target, panel){
+        target = target.toLowerCase();
+        return this.regions[target].remove(panel);
+    },
+
+    /**
+     * Searches all regions for a panel with the specified id
+     * @param {String} panelId
+     * @return {Roo.ContentPanel} The panel or null if it wasn't found
+     */
+    findPanel : function(panelId){
+        var rs = this.regions;
+        for(var target in rs){
+            if(typeof rs[target] != "function"){
+                var p = rs[target].getPanel(panelId);
+                if(p){
+                    return p;
+                }
+            }
+        }
+        return null;
+    },
+
+    /**
+     * Searches all regions for a panel with the specified id and activates (shows) it.
+     * @param {String/ContentPanel} panelId The panels id or the panel itself
+     * @return {Roo.ContentPanel} The shown panel or null
+     */
+    showPanel : function(panelId) {
+      var rs = this.regions;
+      for(var target in rs){
+         var r = rs[target];
+         if(typeof r != "function"){
+            if(r.hasPanel(panelId)){
+               return r.showPanel(panelId);
+            }
+         }
+      }
+      return null;
+   },
+
+   /**
+     * Restores this layout's state using Roo.state.Manager or the state provided by the passed provider.
+     * @param {Roo.state.Provider} provider (optional) An alternate state provider
+     */
+    restoreState : function(provider){
+        if(!provider){
+            provider = Roo.state.Manager;
+        }
+        var sm = new Roo.LayoutStateManager();
+        sm.init(this, provider);
+    },
+
+    /**
+     * Adds a batch of multiple ContentPanels dynamically by passing a special regions config object.  This config
+     * object should contain properties for each region to add ContentPanels to, and each property's value should be
+     * a valid ContentPanel config object.  Example:
+     * <pre><code>
+// Create the main layout
+var layout = new Roo.BorderLayout('main-ct', {
+    west: {
+        split:true,
+        minSize: 175,
+        titlebar: true
+    },
+    center: {
+        title:'Components'
+    }
+}, 'main-ct');
+
+// Create and add multiple ContentPanels at once via configs
+layout.batchAdd({
+   west: {
+       id: 'source-files',
+       autoCreate:true,
+       title:'Ext Source Files',
+       autoScroll:true,
+       fitToFrame:true
+   },
+   center : {
+       el: cview,
+       autoScroll:true,
+       fitToFrame:true,
+       toolbar: tb,
+       resizeEl:'cbody'
+   }
+});
+</code></pre>
+     * @param {Object} regions An object containing ContentPanel configs by region name
+     */
+    batchAdd : function(regions){
+        this.beginUpdate();
+        for(var rname in regions){
+            var lr = this.regions[rname];
+            if(lr){
+                this.addTypedPanels(lr, regions[rname]);
+            }
+        }
+        this.endUpdate();
+    },
+
+    // private
+    addTypedPanels : function(lr, ps){
+        if(typeof ps == 'string'){
+            lr.add(new Roo.ContentPanel(ps));
+        }
+        else if(ps instanceof Array){
+            for(var i =0, len = ps.length; i < len; i++){
+                this.addTypedPanels(lr, ps[i]);
+            }
+        }
+        else if(!ps.events){ // raw config?
+            var el = ps.el;
+            delete ps.el; // prevent conflict
+            lr.add(new Roo.ContentPanel(el || Roo.id(), ps));
+        }
+        else {  // panel object assumed!
+            lr.add(ps);
+        }
+    },
+    /**
+     * Adds a xtype elements to the layout.
+     * <pre><code>
+
+layout.addxtype({
+       xtype : 'ContentPanel',
+       region: 'west',
+       items: [ .... ]
+   }
+);
+
+layout.addxtype({
+        xtype : 'NestedLayoutPanel',
+        region: 'west',
+        layout: {
+           center: { },
+           west: { }   
+        },
+        items : [ ... list of content panels or nested layout panels.. ]
+   }
+);
+</code></pre>
+     * @param {Object} cfg Xtype definition of item to add.
+     */
+    addxtype : function(cfg)
+    {
+        // basically accepts a pannel...
+        // can accept a layout region..!?!?
+        //Roo.log('Roo.BorderLayout add ' + cfg.xtype)
+        
+        if (!cfg.xtype.match(/Panel$/)) {
+            return false;
+        }
+        var ret = false;
+        
+        if (typeof(cfg.region) == 'undefined') {
+            Roo.log("Failed to add Panel, region was not set");
+            Roo.log(cfg);
+            return false;
+        }
+        var region = cfg.region;
+        delete cfg.region;
+        
+          
+        var xitems = [];
+        if (cfg.items) {
+            xitems = cfg.items;
+            delete cfg.items;
+        }
+        var nb = false;
+        
+        switch(cfg.xtype) 
+        {
+            case 'ContentPanel':  // ContentPanel (el, cfg)
+            case 'ScrollPanel':  // ContentPanel (el, cfg)
+                if(cfg.autoCreate) {
+                    ret = new Roo[cfg.xtype](cfg); // new panel!!!!!
+                } else {
+                    var el = this.el.createChild();
+                    ret = new Roo[cfg.xtype](el, cfg); // new panel!!!!!
+                }
+                
+                this.add(region, ret);
+                break;
+            
+            
+            case 'TreePanel': // our new panel!
+                cfg.el = this.el.createChild();
+                ret = new Roo[cfg.xtype](cfg); // new panel!!!!!
+                this.add(region, ret);
+                break;
+            
+            case 'NestedLayoutPanel': 
+                // create a new Layout (which is  a Border Layout...
+                var el = this.el.createChild();
+                var clayout = cfg.layout;
+                delete cfg.layout;
+                clayout.items   = clayout.items  || [];
+                // replace this exitems with the clayout ones..
+                xitems = clayout.items;
+                 
+                
+                if (region == 'center' && this.active && this.getRegion('center').panels.length < 1) {
+                    cfg.background = false;
+                }
+                var layout = new Roo.BorderLayout(el, clayout);
+                
+                ret = new Roo[cfg.xtype](layout, cfg); // new panel!!!!!
+                //console.log('adding nested layout panel '  + cfg.toSource());
+                this.add(region, ret);
+                nb = {}; /// find first...
+                break;
+                
+            case 'GridPanel': 
+            
+                // needs grid and region
+                
+                //var el = this.getRegion(region).el.createChild();
+                var el = this.el.createChild();
+                // create the grid first...
+                
+                var grid = new Roo.grid[cfg.grid.xtype](el, cfg.grid);
+                delete cfg.grid;
+                if (region == 'center' && this.active ) {
+                    cfg.background = false;
+                }
+                ret = new Roo[cfg.xtype](grid, cfg); // new panel!!!!!
+                
+                this.add(region, ret);
+                if (cfg.background) {
+                    ret.on('activate', function(gp) {
+                        if (!gp.grid.rendered) {
+                            gp.grid.render();
+                        }
+                    });
+                } else {
+                    grid.render();
+                }
+                break;
+           
+               
+                
+                
+            default: 
+                alert("Can not add '" + cfg.xtype + "' to BorderLayout");
+                return null;
+             // GridPanel (grid, cfg)
+            
+        }
+        this.beginUpdate();
+        // add children..
+        var region = '';
+        var abn = {};
+        Roo.each(xitems, function(i)  {
+            region = nb && i.region ? i.region : false;
+            
+            var add = ret.addxtype(i);
+           
+            if (region) {
+                nb[region] = nb[region] == undefined ? 0 : nb[region]+1;
+                if (!i.background) {
+                    abn[region] = nb[region] ;
+                }
+            }
+            
+        });
+        this.endUpdate();
+
+        // make the last non-background panel active..
+        //if (nb) { Roo.log(abn); }
+        if (nb) {
+            
+            for(var r in abn) {
+                region = this.getRegion(r);
+                if (region) {
+                    // tried using nb[r], but it does not work..
+                     
+                    region.showPanel(abn[r]);
+                   
+                }
+            }
+        }
+        return ret;
+        
+    }
+});
+
+/**
+ * Shortcut for creating a new BorderLayout object and adding one or more ContentPanels to it in a single step, handling
+ * the beginUpdate and endUpdate calls internally.  The key to this method is the <b>panels</b> property that can be
+ * provided with each region config, which allows you to add ContentPanel configs in addition to the region configs
+ * during creation.  The following code is equivalent to the constructor-based example at the beginning of this class:
+ * <pre><code>
+// shorthand
+var CP = Roo.ContentPanel;
+
+var layout = Roo.BorderLayout.create({
+    north: {
+        initialSize: 25,
+        titlebar: false,
+        panels: [new CP("north", "North")]
+    },
+    west: {
+        split:true,
+        initialSize: 200,
+        minSize: 175,
+        maxSize: 400,
+        titlebar: true,
+        collapsible: true,
+        panels: [new CP("west", {title: "West"})]
+    },
+    east: {
+        split:true,
+        initialSize: 202,
+        minSize: 175,
+        maxSize: 400,
+        titlebar: true,
+        collapsible: true,
+        panels: [new CP("autoTabs", {title: "Auto Tabs", closable: true})]
+    },
+    south: {
+        split:true,
+        initialSize: 100,
+        minSize: 100,
+        maxSize: 200,
+        titlebar: true,
+        collapsible: true,
+        panels: [new CP("south", {title: "South", closable: true})]
+    },
+    center: {
+        titlebar: true,
+        autoScroll:true,
+        resizeTabs: true,
+        minTabWidth: 50,
+        preferredTabWidth: 150,
+        panels: [
+            new CP("center1", {title: "Close Me", closable: true}),
+            new CP("center2", {title: "Center Panel", closable: false})
+        ]
+    }
+}, document.body);
+
+layout.getRegion("center").showPanel("center1");
+</code></pre>
+ * @param config
+ * @param targetEl
+ */
+Roo.BorderLayout.create = function(config, targetEl){
+    var layout = new Roo.BorderLayout(targetEl || document.body, config);
+    layout.beginUpdate();
+    var regions = Roo.BorderLayout.RegionFactory.validRegions;
+    for(var j = 0, jlen = regions.length; j < jlen; j++){
+        var lr = regions[j];
+        if(layout.regions[lr] && config[lr].panels){
+            var r = layout.regions[lr];
+            var ps = config[lr].panels;
+            layout.addTypedPanels(r, ps);
+        }
+    }
+    layout.endUpdate();
+    return layout;
+};
+
+// private
+Roo.BorderLayout.RegionFactory = {
+    // private
+    validRegions : ["north","south","east","west","center"],
+
+    // private
+    create : function(target, mgr, config){
+        target = target.toLowerCase();
+        if(config.lightweight || config.basic){
+            return new Roo.BasicLayoutRegion(mgr, config, target);
+        }
+        switch(target){
+            case "north":
+                return new Roo.NorthLayoutRegion(mgr, config);
+            case "south":
+                return new Roo.SouthLayoutRegion(mgr, config);
+            case "east":
+                return new Roo.EastLayoutRegion(mgr, config);
+            case "west":
+                return new Roo.WestLayoutRegion(mgr, config);
+            case "center":
+                return new Roo.CenterLayoutRegion(mgr, config);
+        }
+        throw 'Layout region "'+target+'" not supported.';
+    }
+};/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.BasicLayoutRegion
+ * @extends Roo.util.Observable
+ * This class represents a lightweight region in a layout manager. This region does not move dom nodes
+ * and does not have a titlebar, tabs or any other features. All it does is size and position 
+ * panels. To create a BasicLayoutRegion, add lightweight:true or basic:true to your regions config.
+ */
+Roo.BasicLayoutRegion = function(mgr, config, pos, skipConfig){
+    this.mgr = mgr;
+    this.position  = pos;
+    this.events = {
+        /**
+         * @scope Roo.BasicLayoutRegion
+         */
+        
+        /**
+         * @event beforeremove
+         * Fires before a panel is removed (or closed). To cancel the removal set "e.cancel = true" on the event argument.
+         * @param {Roo.LayoutRegion} this
+         * @param {Roo.ContentPanel} panel The panel
+         * @param {Object} e The cancel event object
+         */
+        "beforeremove" : true,
+        /**
+         * @event invalidated
+         * Fires when the layout for this region is changed.
+         * @param {Roo.LayoutRegion} this
+         */
+        "invalidated" : true,
+        /**
+         * @event visibilitychange
+         * Fires when this region is shown or hidden 
+         * @param {Roo.LayoutRegion} this
+         * @param {Boolean} visibility true or false
+         */
+        "visibilitychange" : true,
+        /**
+         * @event paneladded
+         * Fires when a panel is added. 
+         * @param {Roo.LayoutRegion} this
+         * @param {Roo.ContentPanel} panel The panel
+         */
+        "paneladded" : true,
+        /**
+         * @event panelremoved
+         * Fires when a panel is removed. 
+         * @param {Roo.LayoutRegion} this
+         * @param {Roo.ContentPanel} panel The panel
+         */
+        "panelremoved" : true,
+        /**
+         * @event collapsed
+         * Fires when this region is collapsed.
+         * @param {Roo.LayoutRegion} this
+         */
+        "collapsed" : true,
+        /**
+         * @event expanded
+         * Fires when this region is expanded.
+         * @param {Roo.LayoutRegion} this
+         */
+        "expanded" : true,
+        /**
+         * @event slideshow
+         * Fires when this region is slid into view.
+         * @param {Roo.LayoutRegion} this
+         */
+        "slideshow" : true,
+        /**
+         * @event slidehide
+         * Fires when this region slides out of view. 
+         * @param {Roo.LayoutRegion} this
+         */
+        "slidehide" : true,
+        /**
+         * @event panelactivated
+         * Fires when a panel is activated. 
+         * @param {Roo.LayoutRegion} this
+         * @param {Roo.ContentPanel} panel The activated panel
+         */
+        "panelactivated" : true,
+        /**
+         * @event resized
+         * Fires when the user resizes this region. 
+         * @param {Roo.LayoutRegion} this
+         * @param {Number} newSize The new size (width for east/west, height for north/south)
+         */
+        "resized" : true
+    };
+    /** A collection of panels in this region. @type Roo.util.MixedCollection */
+    this.panels = new Roo.util.MixedCollection();
+    this.panels.getKey = this.getPanelId.createDelegate(this);
+    this.box = null;
+    this.activePanel = null;
+    // ensure listeners are added...
+    
+    if (config.listeners || config.events) {
+        Roo.BasicLayoutRegion.superclass.constructor.call(this, {
+            listeners : config.listeners || {},
+            events : config.events || {}
+        });
+    }
+    
+    if(skipConfig !== true){
+        this.applyConfig(config);
+    }
+};
+
+Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, {
+    getPanelId : function(p){
+        return p.getId();
+    },
+    
+    applyConfig : function(config){
+        this.margins = config.margins || this.margins || {top: 0, left: 0, right:0, bottom: 0};
+        this.config = config;
+        
+    },
+    
+    /**
+     * Resizes the region to the specified size. For vertical regions (west, east) this adjusts 
+     * the width, for horizontal (north, south) the height.
+     * @param {Number} newSize The new width or height
+     */
+    resizeTo : function(newSize){
+        var el = this.el ? this.el :
+                 (this.activePanel ? this.activePanel.getEl() : null);
+        if(el){
+            switch(this.position){
+                case "east":
+                case "west":
+                    el.setWidth(newSize);
+                    this.fireEvent("resized", this, newSize);
+                break;
+                case "north":
+                case "south":
+                    el.setHeight(newSize);
+                    this.fireEvent("resized", this, newSize);
+                break;                
+            }
+        }
+    },
+    
+    getBox : function(){
+        return this.activePanel ? this.activePanel.getEl().getBox(false, true) : null;
+    },
+    
+    getMargins : function(){
+        return this.margins;
+    },
+    
+    updateBox : function(box){
+        this.box = box;
+        var el = this.activePanel.getEl();
+        el.dom.style.left = box.x + "px";
+        el.dom.style.top = box.y + "px";
+        this.activePanel.setSize(box.width, box.height);
+    },
+    
+    /**
+     * Returns the container element for this region.
+     * @return {Roo.Element}
+     */
+    getEl : function(){
+        return this.activePanel;
+    },
+    
+    /**
+     * Returns true if this region is currently visible.
+     * @return {Boolean}
+     */
+    isVisible : function(){
+        return this.activePanel ? true : false;
+    },
+    
+    setActivePanel : function(panel){
+        panel = this.getPanel(panel);
+        if(this.activePanel && this.activePanel != panel){
+            this.activePanel.setActiveState(false);
+            this.activePanel.getEl().setLeftTop(-10000,-10000);
+        }
+        this.activePanel = panel;
+        panel.setActiveState(true);
+        if(this.box){
+            panel.setSize(this.box.width, this.box.height);
+        }
+        this.fireEvent("panelactivated", this, panel);
+        this.fireEvent("invalidated");
+    },
+    
+    /**
+     * Show the specified panel.
+     * @param {Number/String/ContentPanel} panelId The panels index, id or the panel itself
+     * @return {Roo.ContentPanel} The shown panel or null
+     */
+    showPanel : function(panel){
+        if(panel = this.getPanel(panel)){
+            this.setActivePanel(panel);
+        }
+        return panel;
+    },
+    
+    /**
+     * Get the active panel for this region.
+     * @return {Roo.ContentPanel} The active panel or null
+     */
+    getActivePanel : function(){
+        return this.activePanel;
+    },
+    
+    /**
+     * Add the passed ContentPanel(s)
+     * @param {ContentPanel...} panel The ContentPanel(s) to add (you can pass more than one)
+     * @return {Roo.ContentPanel} The panel added (if only one was added)
+     */
+    add : function(panel){
+        if(arguments.length > 1){
+            for(var i = 0, len = arguments.length; i < len; i++) {
+               this.add(arguments[i]);
+            }
+            return null;
+        }
+        if(this.hasPanel(panel)){
+            this.showPanel(panel);
+            return panel;
+        }
+        var el = panel.getEl();
+        if(el.dom.parentNode != this.mgr.el.dom){
+            this.mgr.el.dom.appendChild(el.dom);
+        }
+        if(panel.setRegion){
+            panel.setRegion(this);
+        }
+        this.panels.add(panel);
+        el.setStyle("position", "absolute");
+        if(!panel.background){
+            this.setActivePanel(panel);
+            if(this.config.initialSize && this.panels.getCount()==1){
+                this.resizeTo(this.config.initialSize);
+            }
+        }
+        this.fireEvent("paneladded", this, panel);
+        return panel;
+    },
+    
+    /**
+     * Returns true if the panel is in this region.
+     * @param {Number/String/ContentPanel} panel The panels index, id or the panel itself
+     * @return {Boolean}
+     */
+    hasPanel : function(panel){
+        if(typeof panel == "object"){ // must be panel obj
+            panel = panel.getId();
+        }
+        return this.getPanel(panel) ? true : false;
+    },
+    
+    /**
+     * Removes the specified panel. If preservePanel is not true (either here or in the config), the panel is destroyed.
+     * @param {Number/String/ContentPanel} panel The panels index, id or the panel itself
+     * @param {Boolean} preservePanel Overrides the config preservePanel option
+     * @return {Roo.ContentPanel} The panel that was removed
+     */
+    remove : function(panel, preservePanel){
+        panel = this.getPanel(panel);
+        if(!panel){
+            return null;
+        }
+        var e = {};
+        this.fireEvent("beforeremove", this, panel, e);
+        if(e.cancel === true){
+            return null;
+        }
+        var panelId = panel.getId();
+        this.panels.removeKey(panelId);
+        return panel;
+    },
+    
+    /**
+     * Returns the panel specified or null if it's not in this region.
+     * @param {Number/String/ContentPanel} panel The panels index, id or the panel itself
+     * @return {Roo.ContentPanel}
+     */
+    getPanel : function(id){
+        if(typeof id == "object"){ // must be panel obj
+            return id;
+        }
+        return this.panels.get(id);
+    },
+    
+    /**
+     * Returns this regions position (north/south/east/west/center).
+     * @return {String} 
+     */
+    getPosition: function(){
+        return this.position;    
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.LayoutRegion
+ * @extends Roo.BasicLayoutRegion
+ * This class represents a region in a layout manager.
+ * @cfg {Boolean}   collapsible     False to disable collapsing (defaults to true)
+ * @cfg {Boolean}   collapsed       True to set the initial display to collapsed (defaults to false)
+ * @cfg {Boolean}   floatable       False to disable floating (defaults to true)
+ * @cfg {Object}    margins         Margins for the element (defaults to {top: 0, left: 0, right:0, bottom: 0})
+ * @cfg {Object}    cmargins        Margins for the element when collapsed (defaults to: north/south {top: 2, left: 0, right:0, bottom: 2} or east/west {top: 0, left: 2, right:2, bottom: 0})
+ * @cfg {String}    tabPosition     "top" or "bottom" (defaults to "bottom")
+ * @cfg {String}    collapsedTitle  Optional string message to display in the collapsed block of a north or south region
+ * @cfg {Boolean}   alwaysShowTabs  True to always display tabs even when there is only 1 panel (defaults to false)
+ * @cfg {Boolean}   autoScroll      True to enable overflow scrolling (defaults to false)
+ * @cfg {Boolean}   titlebar        True to display a title bar (defaults to true)
+ * @cfg {String}    title           The title for the region (overrides panel titles)
+ * @cfg {Boolean}   animate         True to animate expand/collapse (defaults to false)
+ * @cfg {Boolean}   autoHide        False to disable auto hiding when the mouse leaves the "floated" region (defaults to true)
+ * @cfg {Boolean}   preservePanels  True to preserve removed panels so they can be readded later (defaults to false)
+ * @cfg {Boolean}   closeOnTab      True to place the close icon on the tabs instead of the region titlebar (defaults to false)
+ * @cfg {Boolean}   hideTabs        True to hide the tab strip (defaults to false)
+ * @cfg {Boolean}   resizeTabs      True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within
+ *                      the space available, similar to FireFox 1.5 tabs (defaults to false)
+ * @cfg {Number}    minTabWidth     The minimum tab width (defaults to 40)
+ * @cfg {Number}    preferredTabWidth The preferred tab width (defaults to 150)
+ * @cfg {Boolean}   showPin         True to show a pin button
+ * @cfg {Boolean}   hidden          True to start the region hidden (defaults to false)
+ * @cfg {Boolean}   hideWhenEmpty   True to hide the region when it has no panels
+ * @cfg {Boolean}   disableTabTips  True to disable tab tooltips
+ * @cfg {Number}    width           For East/West panels
+ * @cfg {Number}    height          For North/South panels
+ * @cfg {Boolean}   split           To show the splitter
+ * @cfg {Boolean}   toolbar         xtype configuration for a toolbar - shows on right of tabbar
+ */
+Roo.LayoutRegion = function(mgr, config, pos){
+    Roo.LayoutRegion.superclass.constructor.call(this, mgr, config, pos, true);
+    var dh = Roo.DomHelper;
+    /** This region's container element 
+    * @type Roo.Element */
+    this.el = dh.append(mgr.el.dom, {tag: "div", cls: "x-layout-panel x-layout-panel-" + this.position}, true);
+    /** This region's title element 
+    * @type Roo.Element */
+
+    this.titleEl = dh.append(this.el.dom, {tag: "div", unselectable: "on", cls: "x-unselectable x-layout-panel-hd x-layout-title-"+this.position, children:[
+        {tag: "span", cls: "x-unselectable x-layout-panel-hd-text", unselectable: "on", html: "&#160;"},
+        {tag: "div", cls: "x-unselectable x-layout-panel-hd-tools", unselectable: "on"}
+    ]}, true);
+    this.titleEl.enableDisplayMode();
+    /** This region's title text element 
+    * @type HTMLElement */
+    this.titleTextEl = this.titleEl.dom.firstChild;
+    this.tools = Roo.get(this.titleEl.dom.childNodes[1], true);
+    this.closeBtn = this.createTool(this.tools.dom, "x-layout-close");
+    this.closeBtn.enableDisplayMode();
+    this.closeBtn.on("click", this.closeClicked, this);
+    this.closeBtn.hide();
+
+    this.createBody(config);
+    this.visible = true;
+    this.collapsed = false;
+
+    if(config.hideWhenEmpty){
+        this.hide();
+        this.on("paneladded", this.validateVisibility, this);
+        this.on("panelremoved", this.validateVisibility, this);
+    }
+    this.applyConfig(config);
+};
+
+Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, {
+
+    createBody : function(){
+        /** This region's body element 
+        * @type Roo.Element */
+        this.bodyEl = this.el.createChild({tag: "div", cls: "x-layout-panel-body"});
+    },
+
+    applyConfig : function(c){
+        if(c.collapsible && this.position != "center" && !this.collapsedEl){
+            var dh = Roo.DomHelper;
+            if(c.titlebar !== false){
+                this.collapseBtn = this.createTool(this.tools.dom, "x-layout-collapse-"+this.position);
+                this.collapseBtn.on("click", this.collapse, this);
+                this.collapseBtn.enableDisplayMode();
+
+                if(c.showPin === true || this.showPin){
+                    this.stickBtn = this.createTool(this.tools.dom, "x-layout-stick");
+                    this.stickBtn.enableDisplayMode();
+                    this.stickBtn.on("click", this.expand, this);
+                    this.stickBtn.hide();
+                }
+            }
+            /** This region's collapsed element
+            * @type Roo.Element */
+            this.collapsedEl = dh.append(this.mgr.el.dom, {cls: "x-layout-collapsed x-layout-collapsed-"+this.position, children:[
+                {cls: "x-layout-collapsed-tools", children:[{cls: "x-layout-ctools-inner"}]}
+            ]}, true);
+            if(c.floatable !== false){
+               this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
+               this.collapsedEl.on("click", this.collapseClick, this);
+            }
+
+            if(c.collapsedTitle && (this.position == "north" || this.position== "south")) {
+                this.collapsedTitleTextEl = dh.append(this.collapsedEl.dom, {tag: "div", cls: "x-unselectable x-layout-panel-hd-text",
+                   id: "message", unselectable: "on", style:{"float":"left"}});
+               this.collapsedTitleTextEl.innerHTML = c.collapsedTitle;
+             }
+            this.expandBtn = this.createTool(this.collapsedEl.dom.firstChild.firstChild, "x-layout-expand-"+this.position);
+            this.expandBtn.on("click", this.expand, this);
+        }
+        if(this.collapseBtn){
+            this.collapseBtn.setVisible(c.collapsible == true);
+        }
+        this.cmargins = c.cmargins || this.cmargins ||
+                         (this.position == "west" || this.position == "east" ?
+                             {top: 0, left: 2, right:2, bottom: 0} :
+                             {top: 2, left: 0, right:0, bottom: 2});
+        this.margins = c.margins || this.margins || {top: 0, left: 0, right:0, bottom: 0};
+        this.bottomTabs = c.tabPosition != "top";
+        this.autoScroll = c.autoScroll || false;
+        if(this.autoScroll){
+            this.bodyEl.setStyle("overflow", "auto");
+        }else{
+            this.bodyEl.setStyle("overflow", "hidden");
+        }
+        //if(c.titlebar !== false){
+            if((!c.titlebar && !c.title) || c.titlebar === false){
+                this.titleEl.hide();
+            }else{
+                this.titleEl.show();
+                if(c.title){
+                    this.titleTextEl.innerHTML = c.title;
+                }
+            }
+        //}
+        this.duration = c.duration || .30;
+        this.slideDuration = c.slideDuration || .45;
+        this.config = c;
+        if(c.collapsed){
+            this.collapse(true);
+        }
+        if(c.hidden){
+            this.hide();
+        }
+    },
+    /**
+     * Returns true if this region is currently visible.
+     * @return {Boolean}
+     */
+    isVisible : function(){
+        return this.visible;
+    },
+
+    /**
+     * Updates the title for collapsed north/south regions (used with {@link #collapsedTitle} config option)
+     * @param {String} title (optional) The title text (accepts HTML markup, defaults to the numeric character reference for a non-breaking space, "&amp;#160;")
+     */
+    setCollapsedTitle : function(title){
+        title = title || "&#160;";
+        if(this.collapsedTitleTextEl){
+            this.collapsedTitleTextEl.innerHTML = title;
+        }
+    },
+
+    getBox : function(){
+        var b;
+        if(!this.collapsed){
+            b = this.el.getBox(false, true);
+        }else{
+            b = this.collapsedEl.getBox(false, true);
+        }
+        return b;
+    },
+
+    getMargins : function(){
+        return this.collapsed ? this.cmargins : this.margins;
+    },
+
+    highlight : function(){
+        this.el.addClass("x-layout-panel-dragover");
+    },
+
+    unhighlight : function(){
+        this.el.removeClass("x-layout-panel-dragover");
+    },
+
+    updateBox : function(box){
+        this.box = box;
+        if(!this.collapsed){
+            this.el.dom.style.left = box.x + "px";
+            this.el.dom.style.top = box.y + "px";
+            this.updateBody(box.width, box.height);
+        }else{
+            this.collapsedEl.dom.style.left = box.x + "px";
+            this.collapsedEl.dom.style.top = box.y + "px";
+            this.collapsedEl.setSize(box.width, box.height);
+        }
+        if(this.tabs){
+            this.tabs.autoSizeTabs();
+        }
+    },
+
+    updateBody : function(w, h){
+        if(w !== null){
+            this.el.setWidth(w);
+            w -= this.el.getBorderWidth("rl");
+            if(this.config.adjustments){
+                w += this.config.adjustments[0];
+            }
+        }
+        if(h !== null){
+            this.el.setHeight(h);
+            h = this.titleEl && this.titleEl.isDisplayed() ? h - (this.titleEl.getHeight()||0) : h;
+            h -= this.el.getBorderWidth("tb");
+            if(this.config.adjustments){
+                h += this.config.adjustments[1];
+            }
+            this.bodyEl.setHeight(h);
+            if(this.tabs){
+                h = this.tabs.syncHeight(h);
+            }
+        }
+        if(this.panelSize){
+            w = w !== null ? w : this.panelSize.width;
+            h = h !== null ? h : this.panelSize.height;
+        }
+        if(this.activePanel){
+            var el = this.activePanel.getEl();
+            w = w !== null ? w : el.getWidth();
+            h = h !== null ? h : el.getHeight();
+            this.panelSize = {width: w, height: h};
+            this.activePanel.setSize(w, h);
+        }
+        if(Roo.isIE && this.tabs){
+            this.tabs.el.repaint();
+        }
+    },
+
+    /**
+     * Returns the container element for this region.
+     * @return {Roo.Element}
+     */
+    getEl : function(){
+        return this.el;
+    },
+
+    /**
+     * Hides this region.
+     */
+    hide : function(){
+        if(!this.collapsed){
+            this.el.dom.style.left = "-2000px";
+            this.el.hide();
+        }else{
+            this.collapsedEl.dom.style.left = "-2000px";
+            this.collapsedEl.hide();
+        }
+        this.visible = false;
+        this.fireEvent("visibilitychange", this, false);
+    },
+
+    /**
+     * Shows this region if it was previously hidden.
+     */
+    show : function(){
+        if(!this.collapsed){
+            this.el.show();
+        }else{
+            this.collapsedEl.show();
+        }
+        this.visible = true;
+        this.fireEvent("visibilitychange", this, true);
+    },
+
+    closeClicked : function(){
+        if(this.activePanel){
+            this.remove(this.activePanel);
+        }
+    },
+
+    collapseClick : function(e){
+        if(this.isSlid){
+           e.stopPropagation();
+           this.slideIn();
+        }else{
+           e.stopPropagation();
+           this.slideOut();
+        }
+    },
+
+    /**
+     * Collapses this region.
+     * @param {Boolean} skipAnim (optional) true to collapse the element without animation (if animate is true)
+     */
+    collapse : function(skipAnim){
+        if(this.collapsed) return;
+        this.collapsed = true;
+        if(this.split){
+            this.split.el.hide();
+        }
+        if(this.config.animate && skipAnim !== true){
+            this.fireEvent("invalidated", this);
+            this.animateCollapse();
+        }else{
+            this.el.setLocation(-20000,-20000);
+            this.el.hide();
+            this.collapsedEl.show();
+            this.fireEvent("collapsed", this);
+            this.fireEvent("invalidated", this);
+        }
+    },
+
+    animateCollapse : function(){
+        // overridden
+    },
+
+    /**
+     * Expands this region if it was previously collapsed.
+     * @param {Roo.EventObject} e The event that triggered the expand (or null if calling manually)
+     * @param {Boolean} skipAnim (optional) true to expand the element without animation (if animate is true)
+     */
+    expand : function(e, skipAnim){
+        if(e) e.stopPropagation();
+        if(!this.collapsed || this.el.hasActiveFx()) return;
+        if(this.isSlid){
+            this.afterSlideIn();
+            skipAnim = true;
+        }
+        this.collapsed = false;
+        if(this.config.animate && skipAnim !== true){
+            this.animateExpand();
+        }else{
+            this.el.show();
+            if(this.split){
+                this.split.el.show();
+            }
+            this.collapsedEl.setLocation(-2000,-2000);
+            this.collapsedEl.hide();
+            this.fireEvent("invalidated", this);
+            this.fireEvent("expanded", this);
+        }
+    },
+
+    animateExpand : function(){
+        // overridden
+    },
+
+    initTabs : function()
+    {
+        this.bodyEl.setStyle("overflow", "hidden");
+        var ts = new Roo.TabPanel(
+                this.bodyEl.dom,
+                {
+                    tabPosition: this.bottomTabs ? 'bottom' : 'top',
+                    disableTooltips: this.config.disableTabTips,
+                    toolbar : this.config.toolbar
+                }
+        );
+        if(this.config.hideTabs){
+            ts.stripWrap.setDisplayed(false);
+        }
+        this.tabs = ts;
+        ts.resizeTabs = this.config.resizeTabs === true;
+        ts.minTabWidth = this.config.minTabWidth || 40;
+        ts.maxTabWidth = this.config.maxTabWidth || 250;
+        ts.preferredTabWidth = this.config.preferredTabWidth || 150;
+        ts.monitorResize = false;
+        ts.bodyEl.setStyle("overflow", this.config.autoScroll ? "auto" : "hidden");
+        ts.bodyEl.addClass('x-layout-tabs-body');
+        this.panels.each(this.initPanelAsTab, this);
+    },
+
+    initPanelAsTab : function(panel){
+        var ti = this.tabs.addTab(panel.getEl().id, panel.getTitle(), null,
+                    this.config.closeOnTab && panel.isClosable());
+        if(panel.tabTip !== undefined){
+            ti.setTooltip(panel.tabTip);
+        }
+        ti.on("activate", function(){
+              this.setActivePanel(panel);
+        }, this);
+        if(this.config.closeOnTab){
+            ti.on("beforeclose", function(t, e){
+                e.cancel = true;
+                this.remove(panel);
+            }, this);
+        }
+        return ti;
+    },
+
+    updatePanelTitle : function(panel, title){
+        if(this.activePanel == panel){
+            this.updateTitle(title);
+        }
+        if(this.tabs){
+            var ti = this.tabs.getTab(panel.getEl().id);
+            ti.setText(title);
+            if(panel.tabTip !== undefined){
+                ti.setTooltip(panel.tabTip);
+            }
+        }
+    },
+
+    updateTitle : function(title){
+        if(this.titleTextEl && !this.config.title){
+            this.titleTextEl.innerHTML = (typeof title != "undefined" && title.length > 0 ? title : "&#160;");
+        }
+    },
+
+    setActivePanel : function(panel){
+        panel = this.getPanel(panel);
+        if(this.activePanel && this.activePanel != panel){
+            this.activePanel.setActiveState(false);
+        }
+        this.activePanel = panel;
+        panel.setActiveState(true);
+        if(this.panelSize){
+            panel.setSize(this.panelSize.width, this.panelSize.height);
+        }
+        if(this.closeBtn){
+            this.closeBtn.setVisible(!this.config.closeOnTab && !this.isSlid && panel.isClosable());
+        }
+        this.updateTitle(panel.getTitle());
+        if(this.tabs){
+            this.fireEvent("invalidated", this);
+        }
+        this.fireEvent("panelactivated", this, panel);
+    },
+
+    /**
+     * Shows the specified panel.
+     * @param {Number/String/ContentPanel} panelId The panel's index, id or the panel itself
+     * @return {Roo.ContentPanel} The shown panel, or null if a panel could not be found from panelId
+     */
+    showPanel : function(panel){
+        if(panel = this.getPanel(panel)){
+            if(this.tabs){
+                var tab = this.tabs.getTab(panel.getEl().id);
+                if(tab.isHidden()){
+                    this.tabs.unhideTab(tab.id);
+                }
+                tab.activate();
+            }else{
+                this.setActivePanel(panel);
+            }
+        }
+        return panel;
+    },
+
+    /**
+     * Get the active panel for this region.
+     * @return {Roo.ContentPanel} The active panel or null
+     */
+    getActivePanel : function(){
+        return this.activePanel;
+    },
+
+    validateVisibility : function(){
+        if(this.panels.getCount() < 1){
+            this.updateTitle("&#160;");
+            this.closeBtn.hide();
+            this.hide();
+        }else{
+            if(!this.isVisible()){
+                this.show();
+            }
+        }
+    },
+
+    /**
+     * Adds the passed ContentPanel(s) to this region.
+     * @param {ContentPanel...} panel The ContentPanel(s) to add (you can pass more than one)
+     * @return {Roo.ContentPanel} The panel added (if only one was added; null otherwise)
+     */
+    add : function(panel){
+        if(arguments.length > 1){
+            for(var i = 0, len = arguments.length; i < len; i++) {
+                this.add(arguments[i]);
+            }
+            return null;
+        }
+        if(this.hasPanel(panel)){
+            this.showPanel(panel);
+            return panel;
+        }
+        panel.setRegion(this);
+        this.panels.add(panel);
+        if(this.panels.getCount() == 1 && !this.config.alwaysShowTabs){
+            this.bodyEl.dom.appendChild(panel.getEl().dom);
+            if(panel.background !== true){
+                this.setActivePanel(panel);
+            }
+            this.fireEvent("paneladded", this, panel);
+            return panel;
+        }
+        if(!this.tabs){
+            this.initTabs();
+        }else{
+            this.initPanelAsTab(panel);
+        }
+        if(panel.background !== true){
+            this.tabs.activate(panel.getEl().id);
+        }
+        this.fireEvent("paneladded", this, panel);
+        return panel;
+    },
+
+    /**
+     * Hides the tab for the specified panel.
+     * @param {Number/String/ContentPanel} panel The panel's index, id or the panel itself
+     */
+    hidePanel : function(panel){
+        if(this.tabs && (panel = this.getPanel(panel))){
+            this.tabs.hideTab(panel.getEl().id);
+        }
+    },
+
+    /**
+     * Unhides the tab for a previously hidden panel.
+     * @param {Number/String/ContentPanel} panel The panel's index, id or the panel itself
+     */
+    unhidePanel : function(panel){
+        if(this.tabs && (panel = this.getPanel(panel))){
+            this.tabs.unhideTab(panel.getEl().id);
+        }
+    },
+
+    clearPanels : function(){
+        while(this.panels.getCount() > 0){
+             this.remove(this.panels.first());
+        }
+    },
+
+    /**
+     * Removes the specified panel. If preservePanel is not true (either here or in the config), the panel is destroyed.
+     * @param {Number/String/ContentPanel} panel The panel's index, id or the panel itself
+     * @param {Boolean} preservePanel Overrides the config preservePanel option
+     * @return {Roo.ContentPanel} The panel that was removed
+     */
+    remove : function(panel, preservePanel){
+        panel = this.getPanel(panel);
+        if(!panel){
+            return null;
+        }
+        var e = {};
+        this.fireEvent("beforeremove", this, panel, e);
+        if(e.cancel === true){
+            return null;
+        }
+        preservePanel = (typeof preservePanel != "undefined" ? preservePanel : (this.config.preservePanels === true || panel.preserve === true));
+        var panelId = panel.getId();
+        this.panels.removeKey(panelId);
+        if(preservePanel){
+            document.body.appendChild(panel.getEl().dom);
+        }
+        if(this.tabs){
+            this.tabs.removeTab(panel.getEl().id);
+        }else if (!preservePanel){
+            this.bodyEl.dom.removeChild(panel.getEl().dom);
+        }
+        if(this.panels.getCount() == 1 && this.tabs && !this.config.alwaysShowTabs){
+            var p = this.panels.first();
+            var tempEl = document.createElement("div"); // temp holder to keep IE from deleting the node
+            tempEl.appendChild(p.getEl().dom);
+            this.bodyEl.update("");
+            this.bodyEl.dom.appendChild(p.getEl().dom);
+            tempEl = null;
+            this.updateTitle(p.getTitle());
+            this.tabs = null;
+            this.bodyEl.setStyle("overflow", this.config.autoScroll ? "auto" : "hidden");
+            this.setActivePanel(p);
+        }
+        panel.setRegion(null);
+        if(this.activePanel == panel){
+            this.activePanel = null;
+        }
+        if(this.config.autoDestroy !== false && preservePanel !== true){
+            try{panel.destroy();}catch(e){}
+        }
+        this.fireEvent("panelremoved", this, panel);
+        return panel;
+    },
+
+    /**
+     * Returns the TabPanel component used by this region
+     * @return {Roo.TabPanel}
+     */
+    getTabs : function(){
+        return this.tabs;
+    },
+
+    createTool : function(parentEl, className){
+        var btn = Roo.DomHelper.append(parentEl, {tag: "div", cls: "x-layout-tools-button",
+            children: [{tag: "div", cls: "x-layout-tools-button-inner " + className, html: "&#160;"}]}, true);
+        btn.addClassOnOver("x-layout-tools-button-over");
+        return btn;
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+
+/**
+ * @class Roo.SplitLayoutRegion
+ * @extends Roo.LayoutRegion
+ * Adds a splitbar and other (private) useful functionality to a {@link Roo.LayoutRegion}.
+ */
+Roo.SplitLayoutRegion = function(mgr, config, pos, cursor){
+    this.cursor = cursor;
+    Roo.SplitLayoutRegion.superclass.constructor.call(this, mgr, config, pos);
+};
+
+Roo.extend(Roo.SplitLayoutRegion, Roo.LayoutRegion, {
+    splitTip : "Drag to resize.",
+    collapsibleSplitTip : "Drag to resize. Double click to hide.",
+    useSplitTips : false,
+
+    applyConfig : function(config){
+        Roo.SplitLayoutRegion.superclass.applyConfig.call(this, config);
+        if(config.split){
+            if(!this.split){
+                var splitEl = Roo.DomHelper.append(this.mgr.el.dom, 
+                        {tag: "div", id: this.el.id + "-split", cls: "x-layout-split x-layout-split-"+this.position, html: "&#160;"});
+                /** The SplitBar for this region 
+                * @type Roo.SplitBar */
+                this.split = new Roo.SplitBar(splitEl, this.el, this.orientation);
+                this.split.on("moved", this.onSplitMove, this);
+                this.split.useShim = config.useShim === true;
+                this.split.getMaximumSize = this[this.position == 'north' || this.position == 'south' ? 'getVMaxSize' : 'getHMaxSize'].createDelegate(this);
+                if(this.useSplitTips){
+                    this.split.el.dom.title = config.collapsible ? this.collapsibleSplitTip : this.splitTip;
+                }
+                if(config.collapsible){
+                    this.split.el.on("dblclick", this.collapse,  this);
+                }
+            }
+            if(typeof config.minSize != "undefined"){
+                this.split.minSize = config.minSize;
+            }
+            if(typeof config.maxSize != "undefined"){
+                this.split.maxSize = config.maxSize;
+            }
+            if(config.hideWhenEmpty || config.hidden || config.collapsed){
+                this.hideSplitter();
+            }
+        }
+    },
+
+    getHMaxSize : function(){
+         var cmax = this.config.maxSize || 10000;
+         var center = this.mgr.getRegion("center");
+         return Math.min(cmax, (this.el.getWidth()+center.getEl().getWidth())-center.getMinWidth());
+    },
+
+    getVMaxSize : function(){
+         var cmax = this.config.maxSize || 10000;
+         var center = this.mgr.getRegion("center");
+         return Math.min(cmax, (this.el.getHeight()+center.getEl().getHeight())-center.getMinHeight());
+    },
+
+    onSplitMove : function(split, newSize){
+        this.fireEvent("resized", this, newSize);
+    },
+    
+    /** 
+     * Returns the {@link Roo.SplitBar} for this region.
+     * @return {Roo.SplitBar}
+     */
+    getSplitBar : function(){
+        return this.split;
+    },
+    
+    hide : function(){
+        this.hideSplitter();
+        Roo.SplitLayoutRegion.superclass.hide.call(this);
+    },
+
+    hideSplitter : function(){
+        if(this.split){
+            this.split.el.setLocation(-2000,-2000);
+            this.split.el.hide();
+        }
+    },
+
+    show : function(){
+        if(this.split){
+            this.split.el.show();
+        }
+        Roo.SplitLayoutRegion.superclass.show.call(this);
+    },
+    
+    beforeSlide: function(){
+        if(Roo.isGecko){// firefox overflow auto bug workaround
+            this.bodyEl.clip();
+            if(this.tabs) this.tabs.bodyEl.clip();
+            if(this.activePanel){
+                this.activePanel.getEl().clip();
+                
+                if(this.activePanel.beforeSlide){
+                    this.activePanel.beforeSlide();
+                }
+            }
+        }
+    },
+    
+    afterSlide : function(){
+        if(Roo.isGecko){// firefox overflow auto bug workaround
+            this.bodyEl.unclip();
+            if(this.tabs) this.tabs.bodyEl.unclip();
+            if(this.activePanel){
+                this.activePanel.getEl().unclip();
+                if(this.activePanel.afterSlide){
+                    this.activePanel.afterSlide();
+                }
+            }
+        }
+    },
+
+    initAutoHide : function(){
+        if(this.autoHide !== false){
+            if(!this.autoHideHd){
+                var st = new Roo.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(){
+        Roo.get(document).un("click", this.slideInIf, this);
+    },
+
+    // these names are backwards but not changed for compat
+    slideOut : function(){
+        if(this.isSlid || this.el.hasActiveFx()){
+            return;
+        }
+        this.isSlid = true;
+        if(this.collapseBtn){
+            this.collapseBtn.hide();
+        }
+        this.closeBtnState = this.closeBtn.getStyle('display');
+        this.closeBtn.hide();
+        if(this.stickBtn){
+            this.stickBtn.show();
+        }
+        this.el.show();
+        this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());
+        this.beforeSlide();
+        this.el.setStyle("z-index", 10001);
+        this.el.slideIn(this.getSlideAnchor(), {
+            callback: function(){
+                this.afterSlide();
+                this.initAutoHide();
+                Roo.get(document).on("click", this.slideInIf, this);
+                this.fireEvent("slideshow", this);
+            },
+            scope: this,
+            block: true
+        });
+    },
+
+    afterSlideIn : function(){
+        this.clearAutoHide();
+        this.isSlid = false;
+        this.clearMonitor();
+        this.el.setStyle("z-index", "");
+        if(this.collapseBtn){
+            this.collapseBtn.show();
+        }
+        this.closeBtn.setStyle('display', this.closeBtnState);
+        if(this.stickBtn){
+            this.stickBtn.hide();
+        }
+        this.fireEvent("slidehide", this);
+    },
+
+    slideIn : function(cb){
+        if(!this.isSlid || this.el.hasActiveFx()){
+            Roo.callback(cb);
+            return;
+        }
+        this.isSlid = false;
+        this.beforeSlide();
+        this.el.slideOut(this.getSlideAnchor(), {
+            callback: function(){
+                this.el.setLeftTop(-10000, -10000);
+                this.afterSlide();
+                this.afterSlideIn();
+                Roo.callback(cb);
+            },
+            scope: this,
+            block: true
+        });
+    },
+    
+    slideInIf : function(e){
+        if(!e.within(this.el)){
+            this.slideIn();
+        }
+    },
+
+    animateCollapse : function(){
+        this.beforeSlide();
+        this.el.setStyle("z-index", 20000);
+        var anchor = this.getSlideAnchor();
+        this.el.slideOut(anchor, {
+            callback : function(){
+                this.el.setStyle("z-index", "");
+                this.collapsedEl.slideIn(anchor, {duration:.3});
+                this.afterSlide();
+                this.el.setLocation(-10000,-10000);
+                this.el.hide();
+                this.fireEvent("collapsed", this);
+            },
+            scope: this,
+            block: true
+        });
+    },
+
+    animateExpand : function(){
+        this.beforeSlide();
+        this.el.alignTo(this.collapsedEl, this.getCollapseAnchor(), this.getExpandAdj());
+        this.el.setStyle("z-index", 20000);
+        this.collapsedEl.hide({
+            duration:.1
+        });
+        this.el.slideIn(this.getSlideAnchor(), {
+            callback : function(){
+                this.el.setStyle("z-index", "");
+                this.afterSlide();
+                if(this.split){
+                    this.split.el.show();
+                }
+                this.fireEvent("invalidated", this);
+                this.fireEvent("expanded", this);
+            },
+            scope: this,
+            block: true
+        });
+    },
+
+    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;
+        }
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/*
+ * These classes are private internal classes
+ */
+Roo.CenterLayoutRegion = function(mgr, config){
+    Roo.LayoutRegion.call(this, mgr, config, "center");
+    this.visible = true;
+    this.minWidth = config.minWidth || 20;
+    this.minHeight = config.minHeight || 20;
+};
+
+Roo.extend(Roo.CenterLayoutRegion, Roo.LayoutRegion, {
+    hide : function(){
+        // center panel can't be hidden
+    },
+    
+    show : function(){
+        // center panel can't be hidden
+    },
+    
+    getMinWidth: function(){
+        return this.minWidth;
+    },
+    
+    getMinHeight: function(){
+        return this.minHeight;
+    }
+});
+
+
+Roo.NorthLayoutRegion = function(mgr, config){
+    Roo.LayoutRegion.call(this, mgr, config, "north", "n-resize");
+    if(this.split){
+        this.split.placement = Roo.SplitBar.TOP;
+        this.split.orientation = Roo.SplitBar.VERTICAL;
+        this.split.el.addClass("x-layout-split-v");
+    }
+    var size = config.initialSize || config.height;
+    if(typeof size != "undefined"){
+        this.el.setHeight(size);
+    }
+};
+Roo.extend(Roo.NorthLayoutRegion, Roo.SplitLayoutRegion, {
+    orientation: Roo.SplitBar.VERTICAL,
+    getBox : function(){
+        if(this.collapsed){
+            return this.collapsedEl.getBox();
+        }
+        var box = this.el.getBox();
+        if(this.split){
+            box.height += this.split.el.getHeight();
+        }
+        return box;
+    },
+    
+    updateBox : function(box){
+        if(this.split && !this.collapsed){
+            box.height -= this.split.el.getHeight();
+            this.split.el.setLeft(box.x);
+            this.split.el.setTop(box.y+box.height);
+            this.split.el.setWidth(box.width);
+        }
+        if(this.collapsed){
+            this.updateBody(box.width, null);
+        }
+        Roo.LayoutRegion.prototype.updateBox.call(this, box);
+    }
+});
+
+Roo.SouthLayoutRegion = function(mgr, config){
+    Roo.SplitLayoutRegion.call(this, mgr, config, "south", "s-resize");
+    if(this.split){
+        this.split.placement = Roo.SplitBar.BOTTOM;
+        this.split.orientation = Roo.SplitBar.VERTICAL;
+        this.split.el.addClass("x-layout-split-v");
+    }
+    var size = config.initialSize || config.height;
+    if(typeof size != "undefined"){
+        this.el.setHeight(size);
+    }
+};
+Roo.extend(Roo.SouthLayoutRegion, Roo.SplitLayoutRegion, {
+    orientation: Roo.SplitBar.VERTICAL,
+    getBox : function(){
+        if(this.collapsed){
+            return this.collapsedEl.getBox();
+        }
+        var box = this.el.getBox();
+        if(this.split){
+            var sh = this.split.el.getHeight();
+            box.height += sh;
+            box.y -= sh;
+        }
+        return box;
+    },
+    
+    updateBox : function(box){
+        if(this.split && !this.collapsed){
+            var sh = this.split.el.getHeight();
+            box.height -= sh;
+            box.y += sh;
+            this.split.el.setLeft(box.x);
+            this.split.el.setTop(box.y-sh);
+            this.split.el.setWidth(box.width);
+        }
+        if(this.collapsed){
+            this.updateBody(box.width, null);
+        }
+        Roo.LayoutRegion.prototype.updateBox.call(this, box);
+    }
+});
+
+Roo.EastLayoutRegion = function(mgr, config){
+    Roo.SplitLayoutRegion.call(this, mgr, config, "east", "e-resize");
+    if(this.split){
+        this.split.placement = Roo.SplitBar.RIGHT;
+        this.split.orientation = Roo.SplitBar.HORIZONTAL;
+        this.split.el.addClass("x-layout-split-h");
+    }
+    var size = config.initialSize || config.width;
+    if(typeof size != "undefined"){
+        this.el.setWidth(size);
+    }
+};
+Roo.extend(Roo.EastLayoutRegion, Roo.SplitLayoutRegion, {
+    orientation: Roo.SplitBar.HORIZONTAL,
+    getBox : function(){
+        if(this.collapsed){
+            return this.collapsedEl.getBox();
+        }
+        var box = this.el.getBox();
+        if(this.split){
+            var sw = this.split.el.getWidth();
+            box.width += sw;
+            box.x -= sw;
+        }
+        return box;
+    },
+
+    updateBox : function(box){
+        if(this.split && !this.collapsed){
+            var sw = this.split.el.getWidth();
+            box.width -= sw;
+            this.split.el.setLeft(box.x);
+            this.split.el.setTop(box.y);
+            this.split.el.setHeight(box.height);
+            box.x += sw;
+        }
+        if(this.collapsed){
+            this.updateBody(null, box.height);
+        }
+        Roo.LayoutRegion.prototype.updateBox.call(this, box);
+    }
+});
+
+Roo.WestLayoutRegion = function(mgr, config){
+    Roo.SplitLayoutRegion.call(this, mgr, config, "west", "w-resize");
+    if(this.split){
+        this.split.placement = Roo.SplitBar.LEFT;
+        this.split.orientation = Roo.SplitBar.HORIZONTAL;
+        this.split.el.addClass("x-layout-split-h");
+    }
+    var size = config.initialSize || config.width;
+    if(typeof size != "undefined"){
+        this.el.setWidth(size);
+    }
+};
+Roo.extend(Roo.WestLayoutRegion, Roo.SplitLayoutRegion, {
+    orientation: Roo.SplitBar.HORIZONTAL,
+    getBox : function(){
+        if(this.collapsed){
+            return this.collapsedEl.getBox();
+        }
+        var box = this.el.getBox();
+        if(this.split){
+            box.width += this.split.el.getWidth();
+        }
+        return box;
+    },
+    
+    updateBox : function(box){
+        if(this.split && !this.collapsed){
+            var sw = this.split.el.getWidth();
+            box.width -= sw;
+            this.split.el.setLeft(box.x+box.width);
+            this.split.el.setTop(box.y);
+            this.split.el.setHeight(box.height);
+        }
+        if(this.collapsed){
+            this.updateBody(null, box.height);
+        }
+        Roo.LayoutRegion.prototype.updateBox.call(this, box);
+    }
+});
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/*
+ * Private internal class for reading and applying state
+ */
+Roo.LayoutStateManager = function(layout){
+     // default empty state
+     this.state = {
+        north: {},
+        south: {},
+        east: {},
+        west: {}       
+    };
+};
+
+Roo.LayoutStateManager.prototype = {
+    init : function(layout, provider){
+        this.provider = provider;
+        var state = provider.get(layout.id+"-layout-state");
+        if(state){
+            var wasUpdating = layout.isUpdating();
+            if(!wasUpdating){
+                layout.beginUpdate();
+            }
+            for(var key in state){
+                if(typeof state[key] != "function"){
+                    var rstate = state[key];
+                    var r = layout.getRegion(key);
+                    if(r && rstate){
+                        if(rstate.size){
+                            r.resizeTo(rstate.size);
+                        }
+                        if(rstate.collapsed == true){
+                            r.collapse(true);
+                        }else{
+                            r.expand(null, true);
+                        }
+                    }
+                }
+            }
+            if(!wasUpdating){
+                layout.endUpdate();
+            }
+            this.state = state; 
+        }
+        this.layout = layout;
+        layout.on("regionresized", this.onRegionResized, this);
+        layout.on("regioncollapsed", this.onRegionCollapsed, this);
+        layout.on("regionexpanded", this.onRegionExpanded, this);
+    },
+    
+    storeState : function(){
+        this.provider.set(this.layout.id+"-layout-state", this.state);
+    },
+    
+    onRegionResized : function(region, newSize){
+        this.state[region.getPosition()].size = newSize;
+        this.storeState();
+    },
+    
+    onRegionCollapsed : function(region){
+        this.state[region.getPosition()].collapsed = true;
+        this.storeState();
+    },
+    
+    onRegionExpanded : function(region){
+        this.state[region.getPosition()].collapsed = false;
+        this.storeState();
+    }
+};/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.ContentPanel
+ * @extends Roo.util.Observable
+ * A basic ContentPanel element.
+ * @cfg {Boolean}   fitToFrame    True for this panel to adjust its size to fit when the region resizes  (defaults to false)
+ * @cfg {Boolean}   fitContainer   When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container  (defaults to false)
+ * @cfg {Boolean/Object} autoCreate True to auto generate the DOM element for this panel, or a {@link Roo.DomHelper} config of the element to create
+ * @cfg {Boolean}   closable      True if the panel can be closed/removed
+ * @cfg {Boolean}   background    True if the panel should not be activated when it is added (defaults to false)
+ * @cfg {String/HTMLElement/Element} resizeEl An element to resize if {@link #fitToFrame} is true (instead of this panel's element)
+ * @cfg {Toolbar}   toolbar       A toolbar for this panel
+ * @cfg {Boolean} autoScroll    True to scroll overflow in this panel (use with {@link #fitToFrame})
+ * @cfg {String} title          The title for this panel
+ * @cfg {Array} adjustments     Values to <b>add</b> to the width/height when doing a {@link #fitToFrame} (default is [0, 0])
+ * @cfg {String} url            Calls {@link #setUrl} with this value
+ * @cfg {String} region         (center|north|south|east|west) which region to put this panel on (when used with xtype constructors)
+ * @cfg {String/Object} params  When used with {@link #url}, calls {@link #setUrl} with this value
+ * @cfg {Boolean} loadOnce      When used with {@link #url}, calls {@link #setUrl} with this value
+ * @cfg {String}    content        Raw content to fill content panel with (uses setContent on construction.)
+
+ * @constructor
+ * Create a new ContentPanel.
+ * @param {String/HTMLElement/Roo.Element} el The container element for this panel
+ * @param {String/Object} config A string to set only the title or a config object
+ * @param {String} content (optional) Set the HTML content for this panel
+ * @param {String} region (optional) Used by xtype constructors to add to regions. (values center,east,west,south,north)
+ */
+Roo.ContentPanel = function(el, config, content){
+    
+     
+    /*
+    if(el.autoCreate || el.xtype){ // xtype is available if this is called from factory
+        config = el;
+        el = Roo.id();
+    }
+    if (config && config.parentLayout) { 
+        el = config.parentLayout.el.createChild(); 
+    }
+    */
+    if(el.autoCreate){ // xtype is available if this is called from factory
+        config = el;
+        el = Roo.id();
+    }
+    this.el = Roo.get(el);
+    if(!this.el && config && config.autoCreate){
+        if(typeof config.autoCreate == "object"){
+            if(!config.autoCreate.id){
+                config.autoCreate.id = config.id||el;
+            }
+            this.el = Roo.DomHelper.append(document.body,
+                        config.autoCreate, true);
+        }else{
+            this.el = Roo.DomHelper.append(document.body,
+                        {tag: "div", cls: "x-layout-inactive-content", id: config.id||el}, true);
+        }
+    }
+    this.closable = false;
+    this.loaded = false;
+    this.active = false;
+    if(typeof config == "string"){
+        this.title = config;
+    }else{
+        Roo.apply(this, config);
+    }
+    
+    if (this.toolbar && !this.toolbar.el && this.toolbar.xtype) {
+        this.wrapEl = this.el.wrap();
+        this.toolbar.container = this.el.insertSibling(false, 'before');
+        this.toolbar = new Roo.Toolbar(this.toolbar);
+    }
+    
+    
+    
+    if(this.resizeEl){
+        this.resizeEl = Roo.get(this.resizeEl, true);
+    }else{
+        this.resizeEl = this.el;
+    }
+    this.addEvents({
+        /**
+         * @event activate
+         * Fires when this panel is activated. 
+         * @param {Roo.ContentPanel} this
+         */
+        "activate" : true,
+        /**
+         * @event deactivate
+         * Fires when this panel is activated. 
+         * @param {Roo.ContentPanel} this
+         */
+        "deactivate" : true,
+
+        /**
+         * @event resize
+         * Fires when this panel is resized if fitToFrame is true.
+         * @param {Roo.ContentPanel} this
+         * @param {Number} width The width after any component adjustments
+         * @param {Number} height The height after any component adjustments
+         */
+        "resize" : true,
+        
+         /**
+         * @event render
+         * Fires when this tab is created
+         * @param {Roo.ContentPanel} this
+         */
+        "render" : true
+        
+        
+        
+    });
+    if(this.autoScroll){
+        this.resizeEl.setStyle("overflow", "auto");
+    } else {
+        // fix randome scrolling
+        this.el.on('scroll', function() {
+            Roo.log('fix random scolling');
+            this.scrollTo('top',0); 
+        });
+    }
+    content = content || this.content;
+    if(content){
+        this.setContent(content);
+    }
+    if(config && config.url){
+        this.setUrl(this.url, this.params, this.loadOnce);
+    }
+    
+    
+    
+    Roo.ContentPanel.superclass.constructor.call(this);
+    
+    this.fireEvent('render', this);
+};
+
+Roo.extend(Roo.ContentPanel, Roo.util.Observable, {
+    tabTip:'',
+    setRegion : function(region){
+        this.region = region;
+        if(region){
+           this.el.replaceClass("x-layout-inactive-content", "x-layout-active-content");
+        }else{
+           this.el.replaceClass("x-layout-active-content", "x-layout-inactive-content");
+        } 
+    },
+    
+    /**
+     * Returns the toolbar for this Panel if one was configured. 
+     * @return {Roo.Toolbar} 
+     */
+    getToolbar : function(){
+        return this.toolbar;
+    },
+    
+    setActiveState : function(active){
+        this.active = active;
+        if(!active){
+            this.fireEvent("deactivate", this);
+        }else{
+            this.fireEvent("activate", this);
+        }
+    },
+    /**
+     * Updates this panel's element
+     * @param {String} content The new content
+     * @param {Boolean} loadScripts (optional) true to look for and process scripts
+    */
+    setContent : function(content, loadScripts){
+        this.el.update(content, loadScripts);
+    },
+
+    ignoreResize : function(w, h){
+        if(this.lastSize && this.lastSize.width == w && this.lastSize.height == h){
+            return true;
+        }else{
+            this.lastSize = {width: w, height: h};
+            return false;
+        }
+    },
+    /**
+     * Get the {@link Roo.UpdateManager} for this panel. Enables you to perform Ajax updates.
+     * @return {Roo.UpdateManager} The UpdateManager
+     */
+    getUpdateManager : function(){
+        return this.el.getUpdateManager();
+    },
+     /**
+     * Loads this content panel immediately with content from XHR. Note: to delay loading until the panel is activated, use {@link #setUrl}.
+     * @param {Object/String/Function} url The url for this request or a function to call to get the url or a config object containing any of the following options:
+<pre><code>
+panel.load({
+    url: "your-url.php",
+    params: {param1: "foo", param2: "bar"}, // or a URL encoded string
+    callback: yourFunction,
+    scope: yourObject, //(optional scope)
+    discardUrl: false,
+    nocache: false,
+    text: "Loading...",
+    timeout: 30,
+    scripts: false
+});
+</code></pre>
+     * The only required property is <i>url</i>. The optional properties <i>nocache</i>, <i>text</i> and <i>scripts</i>
+     * are shorthand for <i>disableCaching</i>, <i>indicatorText</i> and <i>loadScripts</i> and are used to set their associated property on this panel UpdateManager instance.
+     * @param {String/Object} params (optional) The parameters to pass as either a URL encoded string "param1=1&amp;param2=2" or an object {param1: 1, param2: 2}
+     * @param {Function} callback (optional) Callback when transaction is complete -- called with signature (oElement, bSuccess, oResponse)
+     * @param {Boolean} discardUrl (optional) By default when you execute an update the defaultUrl is changed to the last used URL. If true, it will not store the URL.
+     * @return {Roo.ContentPanel} this
+     */
+    load : function(){
+        var um = this.el.getUpdateManager();
+        um.update.apply(um, arguments);
+        return this;
+    },
+
+
+    /**
+     * Set a URL to be used to load the content for this panel. When this panel is activated, the content will be loaded from that URL.
+     * @param {String/Function} url The URL to load the content from or a function to call to get the URL
+     * @param {String/Object} params (optional) The string params for the update call or an object of the params. See {@link Roo.UpdateManager#update} for more details. (Defaults to null)
+     * @param {Boolean} loadOnce (optional) Whether to only load the content once. If this is false it makes the Ajax call every time this panel is activated. (Defaults to false)
+     * @return {Roo.UpdateManager} The UpdateManager
+     */
+    setUrl : function(url, params, loadOnce){
+        if(this.refreshDelegate){
+            this.removeListener("activate", this.refreshDelegate);
+        }
+        this.refreshDelegate = this._handleRefresh.createDelegate(this, [url, params, loadOnce]);
+        this.on("activate", this.refreshDelegate);
+        return this.el.getUpdateManager();
+    },
+    
+    _handleRefresh : function(url, params, loadOnce){
+        if(!loadOnce || !this.loaded){
+            var updater = this.el.getUpdateManager();
+            updater.update(url, params, this._setLoaded.createDelegate(this));
+        }
+    },
+    
+    _setLoaded : function(){
+        this.loaded = true;
+    }, 
+    
+    /**
+     * Returns this panel's id
+     * @return {String} 
+     */
+    getId : function(){
+        return this.el.id;
+    },
+    
+    /** 
+     * Returns this panel's element - used by regiosn to add.
+     * @return {Roo.Element} 
+     */
+    getEl : function(){
+        return this.wrapEl || this.el;
+    },
+    
+    adjustForComponents : function(width, height){
+        if(this.resizeEl != this.el){
+            width -= this.el.getFrameWidth('lr');
+            height -= this.el.getFrameWidth('tb');
+        }
+        if(this.toolbar){
+            var te = this.toolbar.getEl();
+            height -= te.getHeight();
+            te.setWidth(width);
+        }
+        if(this.adjustments){
+            width += this.adjustments[0];
+            height += this.adjustments[1];
+        }
+        return {"width": width, "height": height};
+    },
+    
+    setSize : function(width, height){
+        if(this.fitToFrame && !this.ignoreResize(width, height)){
+            if(this.fitContainer && this.resizeEl != this.el){
+                this.el.setSize(width, height);
+            }
+            var size = this.adjustForComponents(width, height);
+            this.resizeEl.setSize(this.autoWidth ? "auto" : size.width, this.autoHeight ? "auto" : size.height);
+            this.fireEvent('resize', this, size.width, size.height);
+        }
+    },
+    
+    /**
+     * Returns this panel's title
+     * @return {String} 
+     */
+    getTitle : function(){
+        return this.title;
+    },
+    
+    /**
+     * Set this panel's title
+     * @param {String} title
+     */
+    setTitle : function(title){
+        this.title = title;
+        if(this.region){
+            this.region.updatePanelTitle(this, title);
+        }
+    },
+    
+    /**
+     * Returns true is this panel was configured to be closable
+     * @return {Boolean} 
+     */
+    isClosable : function(){
+        return this.closable;
+    },
+    
+    beforeSlide : function(){
+        this.el.clip();
+        this.resizeEl.clip();
+    },
+    
+    afterSlide : function(){
+        this.el.unclip();
+        this.resizeEl.unclip();
+    },
+    
+    /**
+     *   Force a content refresh from the URL specified in the {@link #setUrl} method.
+     *   Will fail silently if the {@link #setUrl} method has not been called.
+     *   This does not activate the panel, just updates its content.
+     */
+    refresh : function(){
+        if(this.refreshDelegate){
+           this.loaded = false;
+           this.refreshDelegate();
+        }
+    },
+    
+    /**
+     * Destroys this panel
+     */
+    destroy : function(){
+        this.el.removeAllListeners();
+        var tempEl = document.createElement("span");
+        tempEl.appendChild(this.el.dom);
+        tempEl.innerHTML = "";
+        this.el.remove();
+        this.el = null;
+    },
+    
+    /**
+     * form - if the content panel contains a form - this is a reference to it.
+     * @type {Roo.form.Form}
+     */
+    form : false,
+    /**
+     * view - if the content panel contains a view (Roo.DatePicker / Roo.View / Roo.JsonView)
+     *    This contains a reference to it.
+     * @type {Roo.View}
+     */
+    view : false,
+    
+      /**
+     * Adds a xtype elements to the panel - currently only supports Forms, View, JsonView.
+     * <pre><code>
+
+layout.addxtype({
+       xtype : 'Form',
+       items: [ .... ]
+   }
+);
+
+</code></pre>
+     * @param {Object} cfg Xtype definition of item to add.
+     */
+    
+    addxtype : function(cfg) {
+        // add form..
+        if (cfg.xtype.match(/^Form$/)) {
+            var el = this.el.createChild();
+
+            this.form = new  Roo.form.Form(cfg);
+            
+            
+            if ( this.form.allItems.length) this.form.render(el.dom);
+            return this.form;
+        }
+        // should only have one of theses..
+        if (['View', 'JsonView', 'DatePicker'].indexOf(cfg.xtype) > -1) {
+            // views..
+            cfg.el = this.el.appendChild(document.createElement("div"));
+            // factory?
+            
+            var ret = new Roo.factory(cfg);
+            ret.render && ret.render(false, ''); // render blank..
+            this.view = ret;
+            return ret;
+        }
+        return false;
+    }
+});
+
+/**
+ * @class Roo.GridPanel
+ * @extends Roo.ContentPanel
+ * @constructor
+ * Create a new GridPanel.
+ * @param {Roo.grid.Grid} grid The grid for this panel
+ * @param {String/Object} config A string to set only the panel's title, or a config object
+ */
+Roo.GridPanel = function(grid, config){
+    
+  
+    this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
+        {tag: "div", cls: "x-layout-grid-wrapper x-layout-inactive-content"}, true);
+        
+    this.wrapper.dom.appendChild(grid.getGridEl().dom);
+    
+    Roo.GridPanel.superclass.constructor.call(this, this.wrapper, config);
+    
+    if(this.toolbar){
+        this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);
+    }
+    // xtype created footer. - not sure if will work as we normally have to render first..
+    if (this.footer && !this.footer.el && this.footer.xtype) {
+        
+        this.footer.container = this.grid.getView().getFooterPanel(true);
+        this.footer.dataSource = this.grid.dataSource;
+        this.footer = Roo.factory(this.footer, Roo);
+        
+    }
+    
+    grid.monitorWindowResize = false; // turn off autosizing
+    grid.autoHeight = false;
+    grid.autoWidth = false;
+    this.grid = grid;
+    this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
+};
+
+Roo.extend(Roo.GridPanel, Roo.ContentPanel, {
+    getId : function(){
+        return this.grid.id;
+    },
+    
+    /**
+     * Returns the grid for this panel
+     * @return {Roo.grid.Grid} 
+     */
+    getGrid : function(){
+        return this.grid;    
+    },
+    
+    setSize : function(width, height){
+        if(!this.ignoreResize(width, height)){
+            var grid = this.grid;
+            var size = this.adjustForComponents(width, height);
+            grid.getGridEl().setSize(size.width, size.height);
+            grid.autoSize();
+        }
+    },
+    
+    beforeSlide : function(){
+        this.grid.getView().scroller.clip();
+    },
+    
+    afterSlide : function(){
+        this.grid.getView().scroller.unclip();
+    },
+    
+    destroy : function(){
+        this.grid.destroy();
+        delete this.grid;
+        Roo.GridPanel.superclass.destroy.call(this); 
+    }
+});
+
+
+/**
+ * @class Roo.NestedLayoutPanel
+ * @extends Roo.ContentPanel
+ * @constructor
+ * Create a new NestedLayoutPanel.
+ * 
+ * 
+ * @param {Roo.BorderLayout} layout The layout for this panel
+ * @param {String/Object} config A string to set only the title or a config object
+ */
+Roo.NestedLayoutPanel = function(layout, config)
+{
+    // construct with only one argument..
+    /* FIXME - implement nicer consturctors
+    if (layout.layout) {
+        config = layout;
+        layout = config.layout;
+        delete config.layout;
+    }
+    if (layout.xtype && !layout.getEl) {
+        // then layout needs constructing..
+        layout = Roo.factory(layout, Roo);
+    }
+    */
+    
+    
+    Roo.NestedLayoutPanel.superclass.constructor.call(this, layout.getEl(), config);
+    
+    layout.monitorWindowResize = false; // turn off autosizing
+    this.layout = layout;
+    this.layout.getEl().addClass("x-layout-nested-layout");
+    
+    
+    
+    
+};
+
+Roo.extend(Roo.NestedLayoutPanel, Roo.ContentPanel, {
+
+    setSize : function(width, height){
+        if(!this.ignoreResize(width, height)){
+            var size = this.adjustForComponents(width, height);
+            var el = this.layout.getEl();
+            el.setSize(size.width, size.height);
+            var touch = el.dom.offsetWidth;
+            this.layout.layout();
+            // ie requires a double layout on the first pass
+            if(Roo.isIE && !this.initialized){
+                this.initialized = true;
+                this.layout.layout();
+            }
+        }
+    },
+    
+    // activate all subpanels if not currently active..
+    
+    setActiveState : function(active){
+        this.active = active;
+        if(!active){
+            this.fireEvent("deactivate", this);
+            return;
+        }
+        
+        this.fireEvent("activate", this);
+        // not sure if this should happen before or after..
+        if (!this.layout) {
+            return; // should not happen..
+        }
+        var reg = false;
+        for (var r in this.layout.regions) {
+            reg = this.layout.getRegion(r);
+            if (reg.getActivePanel()) {
+                //reg.showPanel(reg.getActivePanel()); // force it to activate.. 
+                reg.setActivePanel(reg.getActivePanel());
+                continue;
+            }
+            if (!reg.panels.length) {
+                continue;
+            }
+            reg.showPanel(reg.getPanel(0));
+        }
+        
+        
+        
+        
+    },
+    
+    /**
+     * Returns the nested BorderLayout for this panel
+     * @return {Roo.BorderLayout} 
+     */
+    getLayout : function(){
+        return this.layout;
+    },
+    
+     /**
+     * Adds a xtype elements to the layout of the nested panel
+     * <pre><code>
+
+panel.addxtype({
+       xtype : 'ContentPanel',
+       region: 'west',
+       items: [ .... ]
+   }
+);
+
+panel.addxtype({
+        xtype : 'NestedLayoutPanel',
+        region: 'west',
+        layout: {
+           center: { },
+           west: { }   
+        },
+        items : [ ... list of content panels or nested layout panels.. ]
+   }
+);
+</code></pre>
+     * @param {Object} cfg Xtype definition of item to add.
+     */
+    addxtype : function(cfg) {
+        return this.layout.addxtype(cfg);
+    
+    }
+});
+
+Roo.ScrollPanel = function(el, config, content){
+    config = config || {};
+    config.fitToFrame = true;
+    Roo.ScrollPanel.superclass.constructor.call(this, el, config, content);
+    
+    this.el.dom.style.overflow = "hidden";
+    var wrap = this.el.wrap({cls: "x-scroller x-layout-inactive-content"});
+    this.el.removeClass("x-layout-inactive-content");
+    this.el.on("mousewheel", this.onWheel, this);
+
+    var up = wrap.createChild({cls: "x-scroller-up", html: "&#160;"}, this.el.dom);
+    var down = wrap.createChild({cls: "x-scroller-down", html: "&#160;"});
+    up.unselectable(); down.unselectable();
+    up.on("click", this.scrollUp, this);
+    down.on("click", this.scrollDown, this);
+    up.addClassOnOver("x-scroller-btn-over");
+    down.addClassOnOver("x-scroller-btn-over");
+    up.addClassOnClick("x-scroller-btn-click");
+    down.addClassOnClick("x-scroller-btn-click");
+    this.adjustments = [0, -(up.getHeight() + down.getHeight())];
+
+    this.resizeEl = this.el;
+    this.el = wrap; this.up = up; this.down = down;
+};
+
+Roo.extend(Roo.ScrollPanel, Roo.ContentPanel, {
+    increment : 100,
+    wheelIncrement : 5,
+    scrollUp : function(){
+        this.resizeEl.scroll("up", this.increment, {callback: this.afterScroll, scope: this});
+    },
+
+    scrollDown : function(){
+        this.resizeEl.scroll("down", this.increment, {callback: this.afterScroll, scope: this});
+    },
+
+    afterScroll : function(){
+        var el = this.resizeEl;
+        var t = el.dom.scrollTop, h = el.dom.scrollHeight, ch = el.dom.clientHeight;
+        this.up[t == 0 ? "addClass" : "removeClass"]("x-scroller-btn-disabled");
+        this.down[h - t <= ch ? "addClass" : "removeClass"]("x-scroller-btn-disabled");
+    },
+
+    setSize : function(){
+        Roo.ScrollPanel.superclass.setSize.apply(this, arguments);
+        this.afterScroll();
+    },
+
+    onWheel : function(e){
+        var d = e.getWheelDelta();
+        this.resizeEl.dom.scrollTop -= (d*this.wheelIncrement);
+        this.afterScroll();
+        e.stopEvent();
+    },
+
+    setContent : function(content, loadScripts){
+        this.resizeEl.update(content, loadScripts);
+    }
+
+});
+
+
+
+
+
+
+
+
+
+/**
+ * @class Roo.TreePanel
+ * @extends Roo.ContentPanel
+ * @constructor
+ * Create a new TreePanel. - defaults to fit/scoll contents.
+ * @param {String/Object} config A string to set only the panel's title, or a config object
+ * @cfg {Roo.tree.TreePanel} tree The tree TreePanel, with config etc.
+ */
+Roo.TreePanel = function(config){
+    var el = config.el;
+    var tree = config.tree;
+    delete config.tree; 
+    delete config.el; // hopefull!
+    
+    // wrapper for IE7 strict & safari scroll issue
+    
+    var treeEl = el.createChild();
+    config.resizeEl = treeEl;
+    
+    
+    
+    Roo.TreePanel.superclass.constructor.call(this, el, config);
+    this.tree = new Roo.tree.TreePanel(treeEl , tree);
+    //console.log(tree);
+    this.on('activate', function()
+    {
+        if (this.tree.rendered) {
+            return;
+        }
+        //console.log('render tree');
+        this.tree.render();
+    });
+    
+    this.on('resize',  function (cp, w, h) {
+            this.tree.innerCt.setWidth(w);
+            this.tree.innerCt.setHeight(h);
+            this.tree.innerCt.setStyle('overflow-y', 'auto');
+    });
+
+        
+    
+};
+
+Roo.extend(Roo.TreePanel, Roo.ContentPanel, {   
+    fitToFrame : true,
+    autoScroll : true
+});
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.ReaderLayout
+ * @extends Roo.BorderLayout
+ * This is a pre-built layout that represents a classic, 5-pane application.  It consists of a header, a primary
+ * center region containing two nested regions (a top one for a list view and one for item preview below),
+ * and regions on either side that can be used for navigation, application commands, informational displays, etc.
+ * The setup and configuration work exactly the same as it does for a {@link Roo.BorderLayout} - this class simply
+ * expedites the setup of the overall layout and regions for this common application style.
+ * Example:
+ <pre><code>
+var reader = new Roo.ReaderLayout();
+var CP = Roo.ContentPanel;  // shortcut for adding
+
+reader.beginUpdate();
+reader.add("north", new CP("north", "North"));
+reader.add("west", new CP("west", {title: "West"}));
+reader.add("east", new CP("east", {title: "East"}));
+
+reader.regions.listView.add(new CP("listView", "List"));
+reader.regions.preview.add(new CP("preview", "Preview"));
+reader.endUpdate();
+</code></pre>
+* @constructor
+* Create a new ReaderLayout
+* @param {Object} config Configuration options
+* @param {String/HTMLElement/Element} container (optional) The container this layout is bound to (defaults to
+* document.body if omitted)
+*/
+Roo.ReaderLayout = function(config, renderTo){
+    var c = config || {size:{}};
+    Roo.ReaderLayout.superclass.constructor.call(this, renderTo || document.body, {
+        north: c.north !== false ? Roo.apply({
+            split:false,
+            initialSize: 32,
+            titlebar: false
+        }, c.north) : false,
+        west: c.west !== false ? Roo.apply({
+            split:true,
+            initialSize: 200,
+            minSize: 175,
+            maxSize: 400,
+            titlebar: true,
+            collapsible: true,
+            animate: true,
+            margins:{left:5,right:0,bottom:5,top:5},
+            cmargins:{left:5,right:5,bottom:5,top:5}
+        }, c.west) : false,
+        east: c.east !== false ? Roo.apply({
+            split:true,
+            initialSize: 200,
+            minSize: 175,
+            maxSize: 400,
+            titlebar: true,
+            collapsible: true,
+            animate: true,
+            margins:{left:0,right:5,bottom:5,top:5},
+            cmargins:{left:5,right:5,bottom:5,top:5}
+        }, c.east) : false,
+        center: Roo.apply({
+            tabPosition: 'top',
+            autoScroll:false,
+            closeOnTab: true,
+            titlebar:false,
+            margins:{left:c.west!==false ? 0 : 5,right:c.east!==false ? 0 : 5,bottom:5,top:2}
+        }, c.center)
+    });
+
+    this.el.addClass('x-reader');
+
+    this.beginUpdate();
+
+    var inner = new Roo.BorderLayout(Roo.get(document.body).createChild(), {
+        south: c.preview !== false ? Roo.apply({
+            split:true,
+            initialSize: 200,
+            minSize: 100,
+            autoScroll:true,
+            collapsible:true,
+            titlebar: true,
+            cmargins:{top:5,left:0, right:0, bottom:0}
+        }, c.preview) : false,
+        center: Roo.apply({
+            autoScroll:false,
+            titlebar:false,
+            minHeight:200
+        }, c.listView)
+    });
+    this.add('center', new Roo.NestedLayoutPanel(inner,
+            Roo.apply({title: c.mainTitle || '',tabTip:''},c.innerPanelCfg)));
+
+    this.endUpdate();
+
+    this.regions.preview = inner.getRegion('south');
+    this.regions.listView = inner.getRegion('center');
+};
+
+Roo.extend(Roo.ReaderLayout, Roo.BorderLayout);/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.grid.Grid
+ * @extends Roo.util.Observable
+ * This class represents the primary interface of a component based grid control.
+ * <br><br>Usage:<pre><code>
+ var grid = new Roo.grid.Grid("my-container-id", {
+     ds: myDataStore,
+     cm: myColModel,
+     selModel: mySelectionModel,
+     autoSizeColumns: true,
+     monitorWindowResize: false,
+     trackMouseOver: true
+ });
+ // set any options
+ grid.render();
+ * </code></pre>
+ * <b>Common Problems:</b><br/>
+ * - Grid does not resize properly when going smaller: Setting overflow hidden on the container
+ * element will correct this<br/>
+ * - If you get el.style[camel]= NaNpx or -2px or something related, be certain you have given your container element
+ * dimensions. The grid adapts to your container's size, if your container has no size defined then the results
+ * are unpredictable.<br/>
+ * - Do not render the grid into an element with display:none. Try using visibility:hidden. Otherwise there is no way for the
+ * grid to calculate dimensions/offsets.<br/>
+  * @constructor
+ * @param {String/HTMLElement/Roo.Element} container The element into which this grid will be rendered -
+ * The container MUST have some type of size defined for the grid to fill. The container will be
+ * automatically set to position relative if it isn't already.
+ * @param {Object} config A config object that sets properties on this grid.
+ */
+Roo.grid.Grid = function(container, config){
+       // initialize the container
+       this.container = Roo.get(container);
+       this.container.update("");
+       this.container.setStyle("overflow", "hidden");
+    this.container.addClass('x-grid-container');
+
+    this.id = this.container.id;
+
+    Roo.apply(this, config);
+    // check and correct shorthanded configs
+    if(this.ds){
+        this.dataSource = this.ds;
+        delete this.ds;
+    }
+    if(this.cm){
+        this.colModel = this.cm;
+        delete this.cm;
+    }
+    if(this.sm){
+        this.selModel = this.sm;
+        delete this.sm;
+    }
+
+    if (this.selModel) {
+        this.selModel = Roo.factory(this.selModel, Roo.grid);
+        this.sm = this.selModel;
+        this.sm.xmodule = this.xmodule || false;
+    }
+    if (typeof(this.colModel.config) == 'undefined') {
+        this.colModel = new Roo.grid.ColumnModel(this.colModel);
+        this.cm = this.colModel;
+        this.cm.xmodule = this.xmodule || false;
+    }
+    if (this.dataSource) {
+        this.dataSource= Roo.factory(this.dataSource, Roo.data);
+        this.ds = this.dataSource;
+        this.ds.xmodule = this.xmodule || false;
+         
+    }
+    
+    
+    
+    if(this.width){
+        this.container.setWidth(this.width);
+    }
+
+    if(this.height){
+        this.container.setHeight(this.height);
+    }
+    /** @private */
+       this.addEvents({
+        // raw events
+        /**
+         * @event click
+         * The raw click event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "click" : true,
+        /**
+         * @event dblclick
+         * The raw dblclick event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "dblclick" : true,
+        /**
+         * @event contextmenu
+         * The raw contextmenu event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "contextmenu" : true,
+        /**
+         * @event mousedown
+         * The raw mousedown event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "mousedown" : true,
+        /**
+         * @event mouseup
+         * The raw mouseup event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "mouseup" : true,
+        /**
+         * @event mouseover
+         * The raw mouseover event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "mouseover" : true,
+        /**
+         * @event mouseout
+         * The raw mouseout event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "mouseout" : true,
+        /**
+         * @event keypress
+         * The raw keypress event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "keypress" : true,
+        /**
+         * @event keydown
+         * The raw keydown event for the entire grid.
+         * @param {Roo.EventObject} e
+         */
+        "keydown" : true,
+
+        // custom events
+
+        /**
+         * @event cellclick
+         * Fires when a cell is clicked
+         * @param {Grid} this
+         * @param {Number} rowIndex
+         * @param {Number} columnIndex
+         * @param {Roo.EventObject} e
+         */
+        "cellclick" : true,
+        /**
+         * @event celldblclick
+         * Fires when a cell is double clicked
+         * @param {Grid} this
+         * @param {Number} rowIndex
+         * @param {Number} columnIndex
+         * @param {Roo.EventObject} e
+         */
+        "celldblclick" : true,
+        /**
+         * @event rowclick
+         * Fires when a row is clicked
+         * @param {Grid} this
+         * @param {Number} rowIndex
+         * @param {Roo.EventObject} e
+         */
+        "rowclick" : true,
+        /**
+         * @event rowdblclick
+         * Fires when a row is double clicked
+         * @param {Grid} this
+         * @param {Number} rowIndex
+         * @param {Roo.EventObject} e
+         */
+        "rowdblclick" : true,
+        /**
+         * @event headerclick
+         * Fires when a header is clicked
+         * @param {Grid} this
+         * @param {Number} columnIndex
+         * @param {Roo.EventObject} e
+         */
+        "headerclick" : true,
+        /**
+         * @event headerdblclick
+         * Fires when a header cell is double clicked
+         * @param {Grid} this
+         * @param {Number} columnIndex
+         * @param {Roo.EventObject} e
+         */
+        "headerdblclick" : true,
+        /**
+         * @event rowcontextmenu
+         * Fires when a row is right clicked
+         * @param {Grid} this
+         * @param {Number} rowIndex
+         * @param {Roo.EventObject} e
+         */
+        "rowcontextmenu" : true,
+        /**
+         * @event cellcontextmenu
+         * Fires when a cell is right clicked
+         * @param {Grid} this
+         * @param {Number} rowIndex
+         * @param {Number} cellIndex
+         * @param {Roo.EventObject} e
+         */
+         "cellcontextmenu" : true,
+        /**
+         * @event headercontextmenu
+         * Fires when a header is right clicked
+         * @param {Grid} this
+         * @param {Number} columnIndex
+         * @param {Roo.EventObject} e
+         */
+        "headercontextmenu" : true,
+        /**
+         * @event bodyscroll
+         * Fires when the body element is scrolled
+         * @param {Number} scrollLeft
+         * @param {Number} scrollTop
+         */
+        "bodyscroll" : true,
+        /**
+         * @event columnresize
+         * Fires when the user resizes a column
+         * @param {Number} columnIndex
+         * @param {Number} newSize
+         */
+        "columnresize" : true,
+        /**
+         * @event columnmove
+         * Fires when the user moves a column
+         * @param {Number} oldIndex
+         * @param {Number} newIndex
+         */
+        "columnmove" : true,
+        /**
+         * @event startdrag
+         * Fires when row(s) start being dragged
+         * @param {Grid} this
+         * @param {Roo.GridDD} dd The drag drop object
+         * @param {event} e The raw browser event
+         */
+        "startdrag" : true,
+        /**
+         * @event enddrag
+         * Fires when a drag operation is complete
+         * @param {Grid} this
+         * @param {Roo.GridDD} dd The drag drop object
+         * @param {event} e The raw browser event
+         */
+        "enddrag" : true,
+        /**
+         * @event dragdrop
+         * Fires when dragged row(s) are dropped on a valid DD target
+         * @param {Grid} this
+         * @param {Roo.GridDD} dd The drag drop object
+         * @param {String} targetId The target drag drop object
+         * @param {event} e The raw browser event
+         */
+        "dragdrop" : true,
+        /**
+         * @event dragover
+         * Fires while row(s) are being dragged. "targetId" is the id of the Yahoo.util.DD object the selected rows are being dragged over.
+         * @param {Grid} this
+         * @param {Roo.GridDD} dd The drag drop object
+         * @param {String} targetId The target drag drop object
+         * @param {event} e The raw browser event
+         */
+        "dragover" : true,
+        /**
+         * @event dragenter
+         *  Fires when the dragged row(s) first cross another DD target while being dragged
+         * @param {Grid} this
+         * @param {Roo.GridDD} dd The drag drop object
+         * @param {String} targetId The target drag drop object
+         * @param {event} e The raw browser event
+         */
+        "dragenter" : true,
+        /**
+         * @event dragout
+         * Fires when the dragged row(s) leave another DD target while being dragged
+         * @param {Grid} this
+         * @param {Roo.GridDD} dd The drag drop object
+         * @param {String} targetId The target drag drop object
+         * @param {event} e The raw browser event
+         */
+        "dragout" : true,
+        /**
+         * @event rowclass
+         * Fires when a row is rendered, so you can change add a style to it.
+         * @param {GridView} gridview   The grid view
+         * @param {Object} rowcfg   contains record  rowIndex and rowClass - set rowClass to add a style.
+         */
+        'rowclass' : true,
+
+        /**
+         * @event render
+         * Fires when the grid is rendered
+         * @param {Grid} grid
+         */
+        'render' : true
+    });
+
+    Roo.grid.Grid.superclass.constructor.call(this);
+};
+Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
+    
+    /**
+     * @cfg {String} ddGroup - drag drop group.
+     */
+
+    /**
+     * @cfg {Number} minColumnWidth The minimum width a column can be resized to. Default is 25.
+     */
+    minColumnWidth : 25,
+
+    /**
+     * @cfg {Boolean} autoSizeColumns True to automatically resize the columns to fit their content
+     * <b>on initial render.</b> It is more efficient to explicitly size the columns
+     * through the ColumnModel's {@link Roo.grid.ColumnModel#width} config option.  Default is false.
+     */
+    autoSizeColumns : false,
+
+    /**
+     * @cfg {Boolean} autoSizeHeaders True to measure headers with column data when auto sizing columns. Default is true.
+     */
+    autoSizeHeaders : true,
+
+    /**
+     * @cfg {Boolean} monitorWindowResize True to autoSize the grid when the window resizes. Default is true.
+     */
+    monitorWindowResize : true,
+
+    /**
+     * @cfg {Boolean} maxRowsToMeasure If autoSizeColumns is on, maxRowsToMeasure can be used to limit the number of
+     * rows measured to get a columns size. Default is 0 (all rows).
+     */
+    maxRowsToMeasure : 0,
+
+    /**
+     * @cfg {Boolean} trackMouseOver True to highlight rows when the mouse is over. Default is true.
+     */
+    trackMouseOver : true,
+
+    /**
+    * @cfg {Boolean} enableDrag  True to enable drag of rows. Default is false. (double check if this is needed?)
+    */
+    
+    /**
+    * @cfg {Boolean} enableDragDrop True to enable drag and drop of rows. Default is false.
+    */
+    enableDragDrop : false,
+    
+    /**
+    * @cfg {Boolean} enableColumnMove True to enable drag and drop reorder of columns. Default is true.
+    */
+    enableColumnMove : true,
+    
+    /**
+    * @cfg {Boolean} enableColumnHide True to enable hiding of columns with the header context menu. Default is true.
+    */
+    enableColumnHide : true,
+    
+    /**
+    * @cfg {Boolean} enableRowHeightSync True to manually sync row heights across locked and not locked rows. Default is false.
+    */
+    enableRowHeightSync : false,
+    
+    /**
+    * @cfg {Boolean} stripeRows True to stripe the rows.  Default is true.
+    */
+    stripeRows : true,
+    
+    /**
+    * @cfg {Boolean} autoHeight True to fit the height of the grid container to the height of the data. Default is false.
+    */
+    autoHeight : false,
+
+    /**
+     * @cfg {String} autoExpandColumn The id (or dataIndex) of a column in this grid that should expand to fill unused space. This id can not be 0. Default is false.
+     */
+    autoExpandColumn : false,
+
+    /**
+    * @cfg {Number} autoExpandMin The minimum width the autoExpandColumn can have (if enabled).
+    * Default is 50.
+    */
+    autoExpandMin : 50,
+
+    /**
+    * @cfg {Number} autoExpandMax The maximum width the autoExpandColumn can have (if enabled). Default is 1000.
+    */
+    autoExpandMax : 1000,
+
+    /**
+    * @cfg {Object} view The {@link Roo.grid.GridView} used by the grid. This can be set before a call to render().
+    */
+    view : null,
+
+    /**
+    * @cfg {Object} loadMask An {@link Roo.LoadMask} config or true to mask the grid while loading. Default is false.
+    */
+    loadMask : false,
+    /**
+    * @cfg {Roo.dd.DropTarget} dragTarget An {@link Roo.dd.DragTarget} config
+    */
+    dropTarget: false,
+    
+   
+    
+    // private
+    rendered : false,
+
+    /**
+    * @cfg {Boolean} autoWidth True to set the grid's width to the default total width of the grid's columns instead
+    * of a fixed width. Default is false.
+    */
+    /**
+    * @cfg {Number} maxHeight Sets the maximum height of the grid - ignored if autoHeight is not on.
+    */
+    /**
+     * Called once after all setup has been completed and the grid is ready to be rendered.
+     * @return {Roo.grid.Grid} this
+     */
+    render : function()
+    {
+        var c = this.container;
+        // try to detect autoHeight/width mode
+        if((!c.dom.offsetHeight || c.dom.offsetHeight < 20) || c.getStyle("height") == "auto"){
+           this.autoHeight = true;
+       }
+       var view = this.getView();
+        view.init(this);
+
+        c.on("click", this.onClick, this);
+        c.on("dblclick", this.onDblClick, this);
+        c.on("contextmenu", this.onContextMenu, this);
+        c.on("keydown", this.onKeyDown, this);
+
+        this.relayEvents(c, ["mousedown","mouseup","mouseover","mouseout","keypress"]);
+
+        this.getSelectionModel().init(this);
+
+        view.render();
+
+        if(this.loadMask){
+            this.loadMask = new Roo.LoadMask(this.container,
+                    Roo.apply({store:this.dataSource}, this.loadMask));
+        }
+        
+        
+        if (this.toolbar && this.toolbar.xtype) {
+            this.toolbar.container = this.getView().getHeaderPanel(true);
+            this.toolbar = new Roo.Toolbar(this.toolbar);
+        }
+        if (this.footer && this.footer.xtype) {
+            this.footer.dataSource = this.getDataSource();
+            this.footer.container = this.getView().getFooterPanel(true);
+            this.footer = Roo.factory(this.footer, Roo);
+        }
+        if (this.dropTarget && this.dropTarget.xtype) {
+            delete this.dropTarget.xtype;
+            this.dropTarget =  new Ext.dd.DropTarget(this.getView().mainBody, this.dropTarget);
+        }
+        
+        
+        this.rendered = true;
+        this.fireEvent('render', this);
+        return this;
+    },
+
+       /**
+        * Reconfigures the grid to use a different Store and Column Model.
+        * The View will be bound to the new objects and refreshed.
+        * @param {Roo.data.Store} dataSource The new {@link Roo.data.Store} object
+        * @param {Roo.grid.ColumnModel} The new {@link Roo.grid.ColumnModel} object
+        */
+    reconfigure : function(dataSource, colModel){
+        if(this.loadMask){
+            this.loadMask.destroy();
+            this.loadMask = new Roo.LoadMask(this.container,
+                    Roo.apply({store:dataSource}, this.loadMask));
+        }
+        this.view.bind(dataSource, colModel);
+        this.dataSource = dataSource;
+        this.colModel = colModel;
+        this.view.refresh(true);
+    },
+
+    // private
+    onKeyDown : function(e){
+        this.fireEvent("keydown", e);
+    },
+
+    /**
+     * Destroy this grid.
+     * @param {Boolean} removeEl True to remove the element
+     */
+    destroy : function(removeEl, keepListeners){
+        if(this.loadMask){
+            this.loadMask.destroy();
+        }
+        var c = this.container;
+        c.removeAllListeners();
+        this.view.destroy();
+        this.colModel.purgeListeners();
+        if(!keepListeners){
+            this.purgeListeners();
+        }
+        c.update("");
+        if(removeEl === true){
+            c.remove();
+        }
+    },
+
+    // private
+    processEvent : function(name, e){
+        this.fireEvent(name, e);
+        var t = e.getTarget();
+        var v = this.view;
+        var header = v.findHeaderIndex(t);
+        if(header !== false){
+            this.fireEvent("header" + name, this, header, e);
+        }else{
+            var row = v.findRowIndex(t);
+            var cell = v.findCellIndex(t);
+            if(row !== false){
+                this.fireEvent("row" + name, this, row, e);
+                if(cell !== false){
+                    this.fireEvent("cell" + name, this, row, cell, e);
+                }
+            }
+        }
+    },
+
+    // private
+    onClick : function(e){
+        this.processEvent("click", e);
+    },
+
+    // private
+    onContextMenu : function(e, t){
+        this.processEvent("contextmenu", e);
+    },
+
+    // private
+    onDblClick : function(e){
+        this.processEvent("dblclick", e);
+    },
+
+    // private
+    walkCells : function(row, col, step, fn, scope){
+        var cm = this.colModel, clen = cm.getColumnCount();
+        var ds = this.dataSource, rlen = ds.getCount(), first = true;
+        if(step < 0){
+            if(col < 0){
+                row--;
+                first = false;
+            }
+            while(row >= 0){
+                if(!first){
+                    col = clen-1;
+                }
+                first = false;
+                while(col >= 0){
+                    if(fn.call(scope || this, row, col, cm) === true){
+                        return [row, col];
+                    }
+                    col--;
+                }
+                row--;
+            }
+        } else {
+            if(col >= clen){
+                row++;
+                first = false;
+            }
+            while(row < rlen){
+                if(!first){
+                    col = 0;
+                }
+                first = false;
+                while(col < clen){
+                    if(fn.call(scope || this, row, col, cm) === true){
+                        return [row, col];
+                    }
+                    col++;
+                }
+                row++;
+            }
+        }
+        return null;
+    },
+
+    // private
+    getSelections : function(){
+        return this.selModel.getSelections();
+    },
+
+    /**
+     * Causes the grid to manually recalculate its dimensions. Generally this is done automatically,
+     * but if manual update is required this method will initiate it.
+     */
+    autoSize : function(){
+        if(this.rendered){
+            this.view.layout();
+            if(this.view.adjustForScroll){
+                this.view.adjustForScroll();
+            }
+        }
+    },
+
+    /**
+     * Returns the grid's underlying element.
+     * @return {Element} The element
+     */
+    getGridEl : function(){
+        return this.container;
+    },
+
+    // private for compatibility, overridden by editor grid
+    stopEditing : function(){},
+
+    /**
+     * Returns the grid's SelectionModel.
+     * @return {SelectionModel}
+     */
+    getSelectionModel : function(){
+        if(!this.selModel){
+            this.selModel = new Roo.grid.RowSelectionModel();
+        }
+        return this.selModel;
+    },
+
+    /**
+     * Returns the grid's DataSource.
+     * @return {DataSource}
+     */
+    getDataSource : function(){
+        return this.dataSource;
+    },
+
+    /**
+     * Returns the grid's ColumnModel.
+     * @return {ColumnModel}
+     */
+    getColumnModel : function(){
+        return this.colModel;
+    },
+
+    /**
+     * Returns the grid's GridView object.
+     * @return {GridView}
+     */
+    getView : function(){
+        if(!this.view){
+            this.view = new Roo.grid.GridView(this.viewConfig);
+        }
+        return this.view;
+    },
+    /**
+     * Called to get grid's drag proxy text, by default returns this.ddText.
+     * @return {String}
+     */
+    getDragDropText : function(){
+        var count = this.selModel.getCount();
+        return String.format(this.ddText, count, count == 1 ? '' : 's');
+    }
+});
+/**
+ * Configures the text is the drag proxy (defaults to "%0 selected row(s)").
+ * %0 is replaced with the number of selected rows.
+ * @type String
+ */
+Roo.grid.Grid.prototype.ddText = "{0} selected row{1}";/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+Roo.grid.AbstractGridView = function(){
+       this.grid = null;
+       
+       this.events = {
+           "beforerowremoved" : true,
+           "beforerowsinserted" : true,
+           "beforerefresh" : true,
+           "rowremoved" : true,
+           "rowsinserted" : true,
+           "rowupdated" : true,
+           "refresh" : true
+       };
+    Roo.grid.AbstractGridView.superclass.constructor.call(this);
+};
+
+Roo.extend(Roo.grid.AbstractGridView, Roo.util.Observable, {
+    rowClass : "x-grid-row",
+    cellClass : "x-grid-cell",
+    tdClass : "x-grid-td",
+    hdClass : "x-grid-hd",
+    splitClass : "x-grid-hd-split",
+    
+       init: function(grid){
+        this.grid = grid;
+               var cid = this.grid.getGridEl().id;
+        this.colSelector = "#" + cid + " ." + this.cellClass + "-";
+        this.tdSelector = "#" + cid + " ." + this.tdClass + "-";
+        this.hdSelector = "#" + cid + " ." + this.hdClass + "-";
+        this.splitSelector = "#" + cid + " ." + this.splitClass + "-";
+       },
+       
+       getColumnRenderers : function(){
+       var renderers = [];
+       var cm = this.grid.colModel;
+        var colCount = cm.getColumnCount();
+        for(var i = 0; i < colCount; i++){
+            renderers[i] = cm.getRenderer(i);
+        }
+        return renderers;
+    },
+    
+    getColumnIds : function(){
+       var ids = [];
+       var cm = this.grid.colModel;
+        var colCount = cm.getColumnCount();
+        for(var i = 0; i < colCount; i++){
+            ids[i] = cm.getColumnId(i);
+        }
+        return ids;
+    },
+    
+    getDataIndexes : function(){
+       if(!this.indexMap){
+            this.indexMap = this.buildIndexMap();
+        }
+        return this.indexMap.colToData;
+    },
+    
+    getColumnIndexByDataIndex : function(dataIndex){
+        if(!this.indexMap){
+            this.indexMap = this.buildIndexMap();
+        }
+       return this.indexMap.dataToCol[dataIndex];
+    },
+    
+    /**
+     * Set a css style for a column dynamically. 
+     * @param {Number} colIndex The index of the column
+     * @param {String} name The css property name
+     * @param {String} value The css value
+     */
+    setCSSStyle : function(colIndex, name, value){
+        var selector = "#" + this.grid.id + " .x-grid-col-" + colIndex;
+        Roo.util.CSS.updateRule(selector, name, value);
+    },
+    
+    generateRules : function(cm){
+        var ruleBuf = [], rulesId = this.grid.id + '-cssrules';
+        Roo.util.CSS.removeStyleSheet(rulesId);
+        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+            var cid = cm.getColumnId(i);
+            ruleBuf.push(this.colSelector, cid, " {\n", cm.config[i].css, "}\n",
+                         this.tdSelector, cid, " {\n}\n",
+                         this.hdSelector, cid, " {\n}\n",
+                         this.splitSelector, cid, " {\n}\n");
+        }
+        return Roo.util.CSS.createStyleSheet(ruleBuf.join(""), rulesId);
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+// private
+// This is a support class used internally by the Grid components
+Roo.grid.HeaderDragZone = function(grid, hd, hd2){
+    this.grid = grid;
+    this.view = grid.getView();
+    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
+    Roo.grid.HeaderDragZone.superclass.constructor.call(this, hd);
+    if(hd2){
+        this.setHandleElId(Roo.id(hd));
+        this.setOuterHandleElId(Roo.id(hd2));
+    }
+    this.scroll = false;
+};
+Roo.extend(Roo.grid.HeaderDragZone, Roo.dd.DragZone, {
+    maxDragWidth: 120,
+    getDragData : function(e){
+        var t = Roo.lib.Event.getTarget(e);
+        var h = this.view.findHeaderCell(t);
+        if(h){
+            return {ddel: h.firstChild, header:h};
+        }
+        return false;
+    },
+
+    onInitDrag : function(e){
+        this.view.headersDisabled = true;
+        var clone = this.dragData.ddel.cloneNode(true);
+        clone.id = Roo.id();
+        clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px";
+        this.proxy.update(clone);
+        return true;
+    },
+
+    afterValidDrop : function(){
+        var v = this.view;
+        setTimeout(function(){
+            v.headersDisabled = false;
+        }, 50);
+    },
+
+    afterInvalidDrop : function(){
+        var v = this.view;
+        setTimeout(function(){
+            v.headersDisabled = false;
+        }, 50);
+    }
+});
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+// private
+// This is a support class used internally by the Grid components
+Roo.grid.HeaderDropZone = function(grid, hd, hd2){
+    this.grid = grid;
+    this.view = grid.getView();
+    // split the proxies so they don't interfere with mouse events
+    this.proxyTop = Roo.DomHelper.append(document.body, {
+        cls:"col-move-top", html:"&#160;"
+    }, true);
+    this.proxyBottom = Roo.DomHelper.append(document.body, {
+        cls:"col-move-bottom", html:"&#160;"
+    }, true);
+    this.proxyTop.hide = this.proxyBottom.hide = function(){
+        this.setLeftTop(-100,-100);
+        this.setStyle("visibility", "hidden");
+    };
+    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
+    // temporarily disabled
+    //Roo.dd.ScrollManager.register(this.view.scroller.dom);
+    Roo.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);
+};
+Roo.extend(Roo.grid.HeaderDropZone, Roo.dd.DropZone, {
+    proxyOffsets : [-4, -9],
+    fly: Roo.Element.fly,
+
+    getTargetFromEvent : function(e){
+        var t = Roo.lib.Event.getTarget(e);
+        var cindex = this.view.findCellIndex(t);
+        if(cindex !== false){
+            return this.view.getHeaderCell(cindex);
+        }
+        return null;
+    },
+
+    nextVisible : function(h){
+        var v = this.view, cm = this.grid.colModel;
+        h = h.nextSibling;
+        while(h){
+            if(!cm.isHidden(v.getCellIndex(h))){
+                return h;
+            }
+            h = h.nextSibling;
+        }
+        return null;
+    },
+
+    prevVisible : function(h){
+        var v = this.view, cm = this.grid.colModel;
+        h = h.prevSibling;
+        while(h){
+            if(!cm.isHidden(v.getCellIndex(h))){
+                return h;
+            }
+            h = h.prevSibling;
+        }
+        return null;
+    },
+
+    positionIndicator : function(h, n, e){
+        var x = Roo.lib.Event.getPageX(e);
+        var r = Roo.lib.Dom.getRegion(n.firstChild);
+        var px, pt, py = r.top + this.proxyOffsets[1];
+        if((r.right - x) <= (r.right-r.left)/2){
+            px = r.right+this.view.borderWidth;
+            pt = "after";
+        }else{
+            px = r.left;
+            pt = "before";
+        }
+        var oldIndex = this.view.getCellIndex(h);
+        var newIndex = this.view.getCellIndex(n);
+
+        if(this.grid.colModel.isFixed(newIndex)){
+            return false;
+        }
+
+        var locked = this.grid.colModel.isLocked(newIndex);
+
+        if(pt == "after"){
+            newIndex++;
+        }
+        if(oldIndex < newIndex){
+            newIndex--;
+        }
+        if(oldIndex == newIndex && (locked == this.grid.colModel.isLocked(oldIndex))){
+            return false;
+        }
+        px +=  this.proxyOffsets[0];
+        this.proxyTop.setLeftTop(px, py);
+        this.proxyTop.show();
+        if(!this.bottomOffset){
+            this.bottomOffset = this.view.mainHd.getHeight();
+        }
+        this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset);
+        this.proxyBottom.show();
+        return pt;
+    },
+
+    onNodeEnter : function(n, dd, e, data){
+        if(data.header != n){
+            this.positionIndicator(data.header, n, e);
+        }
+    },
+
+    onNodeOver : function(n, dd, e, data){
+        var result = false;
+        if(data.header != n){
+            result = this.positionIndicator(data.header, n, e);
+        }
+        if(!result){
+            this.proxyTop.hide();
+            this.proxyBottom.hide();
+        }
+        return result ? this.dropAllowed : this.dropNotAllowed;
+    },
+
+    onNodeOut : function(n, dd, e, data){
+        this.proxyTop.hide();
+        this.proxyBottom.hide();
+    },
+
+    onNodeDrop : function(n, dd, e, data){
+        var h = data.header;
+        if(h != n){
+            var cm = this.grid.colModel;
+            var x = Roo.lib.Event.getPageX(e);
+            var r = Roo.lib.Dom.getRegion(n.firstChild);
+            var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";
+            var oldIndex = this.view.getCellIndex(h);
+            var newIndex = this.view.getCellIndex(n);
+            var locked = cm.isLocked(newIndex);
+            if(pt == "after"){
+                newIndex++;
+            }
+            if(oldIndex < newIndex){
+                newIndex--;
+            }
+            if(oldIndex == newIndex && (locked == cm.isLocked(oldIndex))){
+                return false;
+            }
+            cm.setLocked(oldIndex, locked, true);
+            cm.moveColumn(oldIndex, newIndex);
+            this.grid.fireEvent("columnmove", oldIndex, newIndex);
+            return true;
+        }
+        return false;
+    }
+});
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+  
+/**
+ * @class Roo.grid.GridView
+ * @extends Roo.util.Observable
+ *
+ * @constructor
+ * @param {Object} config
+ */
+Roo.grid.GridView = function(config){
+    Roo.grid.GridView.superclass.constructor.call(this);
+    this.el = null;
+
+    Roo.apply(this, config);
+};
+
+Roo.extend(Roo.grid.GridView, Roo.grid.AbstractGridView, {
+
+    /**
+     * Override this function to apply custom css classes to rows during rendering
+     * @param {Record} record The record
+     * @param {Number} index
+     * @method getRowClass
+     */
+    rowClass : "x-grid-row",
+
+    cellClass : "x-grid-col",
+
+    tdClass : "x-grid-td",
+
+    hdClass : "x-grid-hd",
+
+    splitClass : "x-grid-split",
+
+    sortClasses : ["sort-asc", "sort-desc"],
+
+    enableMoveAnim : false,
+
+    hlColor: "C3DAF9",
+
+    dh : Roo.DomHelper,
+
+    fly : Roo.Element.fly,
+
+    css : Roo.util.CSS,
+
+    borderWidth: 1,
+
+    splitOffset: 3,
+
+    scrollIncrement : 22,
+
+    cellRE: /(?:.*?)x-grid-(?:hd|cell|csplit)-(?:[\d]+)-([\d]+)(?:.*?)/,
+
+    findRE: /\s?(?:x-grid-hd|x-grid-col|x-grid-csplit)\s/,
+
+    bind : function(ds, cm){
+        if(this.ds){
+            this.ds.un("load", this.onLoad, this);
+            this.ds.un("datachanged", this.onDataChange, this);
+            this.ds.un("add", this.onAdd, this);
+            this.ds.un("remove", this.onRemove, this);
+            this.ds.un("update", this.onUpdate, this);
+            this.ds.un("clear", this.onClear, this);
+        }
+        if(ds){
+            ds.on("load", this.onLoad, this);
+            ds.on("datachanged", this.onDataChange, this);
+            ds.on("add", this.onAdd, this);
+            ds.on("remove", this.onRemove, this);
+            ds.on("update", this.onUpdate, this);
+            ds.on("clear", this.onClear, this);
+        }
+        this.ds = ds;
+
+        if(this.cm){
+            this.cm.un("widthchange", this.onColWidthChange, this);
+            this.cm.un("headerchange", this.onHeaderChange, this);
+            this.cm.un("hiddenchange", this.onHiddenChange, this);
+            this.cm.un("columnmoved", this.onColumnMove, this);
+            this.cm.un("columnlockchange", this.onColumnLock, this);
+        }
+        if(cm){
+            this.generateRules(cm);
+            cm.on("widthchange", this.onColWidthChange, this);
+            cm.on("headerchange", this.onHeaderChange, this);
+            cm.on("hiddenchange", this.onHiddenChange, this);
+            cm.on("columnmoved", this.onColumnMove, this);
+            cm.on("columnlockchange", this.onColumnLock, this);
+        }
+        this.cm = cm;
+    },
+
+    init: function(grid){
+        Roo.grid.GridView.superclass.init.call(this, grid);
+
+        this.bind(grid.dataSource, grid.colModel);
+
+        grid.on("headerclick", this.handleHeaderClick, this);
+
+        if(grid.trackMouseOver){
+            grid.on("mouseover", this.onRowOver, this);
+            grid.on("mouseout", this.onRowOut, this);
+        }
+        grid.cancelTextSelection = function(){};
+        this.gridId = grid.id;
+
+        var tpls = this.templates || {};
+
+        if(!tpls.master){
+            tpls.master = new Roo.Template(
+               '<div class="x-grid" hidefocus="true">',
+                '<a href="#" class="x-grid-focus" tabIndex="-1"></a>',
+                  '<div class="x-grid-topbar"></div>',
+                  '<div class="x-grid-scroller"><div></div></div>',
+                  '<div class="x-grid-locked">',
+                      '<div class="x-grid-header">{lockedHeader}</div>',
+                      '<div class="x-grid-body">{lockedBody}</div>',
+                  "</div>",
+                  '<div class="x-grid-viewport">',
+                      '<div class="x-grid-header">{header}</div>',
+                      '<div class="x-grid-body">{body}</div>',
+                  "</div>",
+                  '<div class="x-grid-bottombar"></div>',
+                 
+                  '<div class="x-grid-resize-proxy">&#160;</div>',
+               "</div>"
+            );
+            tpls.master.disableformats = true;
+        }
+
+        if(!tpls.header){
+            tpls.header = new Roo.Template(
+               '<table border="0" cellspacing="0" cellpadding="0">',
+               '<tbody><tr class="x-grid-hd-row">{cells}</tr></tbody>',
+               "</table>{splits}"
+            );
+            tpls.header.disableformats = true;
+        }
+        tpls.header.compile();
+
+        if(!tpls.hcell){
+            tpls.hcell = new Roo.Template(
+                '<td class="x-grid-hd x-grid-td-{id} {cellId}"><div title="{title}" class="x-grid-hd-inner x-grid-hd-{id}">',
+                '<div class="x-grid-hd-text" unselectable="on">{value}<img class="x-grid-sort-icon" src="', Roo.BLANK_IMAGE_URL, '" /></div>',
+                "</div></td>"
+             );
+             tpls.hcell.disableFormats = true;
+        }
+        tpls.hcell.compile();
+
+        if(!tpls.hsplit){
+            tpls.hsplit = new Roo.Template('<div class="x-grid-split {splitId} x-grid-split-{id}" style="{style}" unselectable="on">&#160;</div>');
+            tpls.hsplit.disableFormats = true;
+        }
+        tpls.hsplit.compile();
+
+        if(!tpls.body){
+            tpls.body = new Roo.Template(
+               '<table border="0" cellspacing="0" cellpadding="0">',
+               "<tbody>{rows}</tbody>",
+               "</table>"
+            );
+            tpls.body.disableFormats = true;
+        }
+        tpls.body.compile();
+
+        if(!tpls.row){
+            tpls.row = new Roo.Template('<tr class="x-grid-row {alt}">{cells}</tr>');
+            tpls.row.disableFormats = true;
+        }
+        tpls.row.compile();
+
+        if(!tpls.cell){
+            tpls.cell = new Roo.Template(
+                '<td class="x-grid-col x-grid-td-{id} {cellId} {css}" tabIndex="0">',
+                '<div class="x-grid-col-{id} x-grid-cell-inner"><div class="x-grid-cell-text" unselectable="on" {attr}>{value}</div></div>',
+                "</td>"
+            );
+            tpls.cell.disableFormats = true;
+        }
+        tpls.cell.compile();
+
+        this.templates = tpls;
+    },
+
+    // remap these for backwards compat
+    onColWidthChange : function(){
+        this.updateColumns.apply(this, arguments);
+    },
+    onHeaderChange : function(){
+        this.updateHeaders.apply(this, arguments);
+    }, 
+    onHiddenChange : function(){
+        this.handleHiddenChange.apply(this, arguments);
+    },
+    onColumnMove : function(){
+        this.handleColumnMove.apply(this, arguments);
+    },
+    onColumnLock : function(){
+        this.handleLockChange.apply(this, arguments);
+    },
+
+    onDataChange : function(){
+        this.refresh();
+        this.updateHeaderSortState();
+    },
+
+    onClear : function(){
+        this.refresh();
+    },
+
+    onUpdate : function(ds, record){
+        this.refreshRow(record);
+    },
+
+    refreshRow : function(record){
+        var ds = this.ds, index;
+        if(typeof record == 'number'){
+            index = record;
+            record = ds.getAt(index);
+        }else{
+            index = ds.indexOf(record);
+        }
+        this.insertRows(ds, index, index, true);
+        this.onRemove(ds, record, index+1, true);
+        this.syncRowHeights(index, index);
+        this.layout();
+        this.fireEvent("rowupdated", this, index, record);
+    },
+
+    onAdd : function(ds, records, index){
+        this.insertRows(ds, index, index + (records.length-1));
+    },
+
+    onRemove : function(ds, record, index, isUpdate){
+        if(isUpdate !== true){
+            this.fireEvent("beforerowremoved", this, index, record);
+        }
+        var bt = this.getBodyTable(), lt = this.getLockedTable();
+        if(bt.rows[index]){
+            bt.firstChild.removeChild(bt.rows[index]);
+        }
+        if(lt.rows[index]){
+            lt.firstChild.removeChild(lt.rows[index]);
+        }
+        if(isUpdate !== true){
+            this.stripeRows(index);
+            this.syncRowHeights(index, index);
+            this.layout();
+            this.fireEvent("rowremoved", this, index, record);
+        }
+    },
+
+    onLoad : function(){
+        this.scrollToTop();
+    },
+
+    /**
+     * Scrolls the grid to the top
+     */
+    scrollToTop : function(){
+        if(this.scroller){
+            this.scroller.dom.scrollTop = 0;
+            this.syncScroll();
+        }
+    },
+
+    /**
+     * Gets a panel in the header of the grid that can be used for toolbars etc.
+     * After modifying the contents of this panel a call to grid.autoSize() may be
+     * required to register any changes in size.
+     * @param {Boolean} doShow By default the header is hidden. Pass true to show the panel
+     * @return Roo.Element
+     */
+    getHeaderPanel : function(doShow){
+        if(doShow){
+            this.headerPanel.show();
+        }
+        return this.headerPanel;
+    },
+
+    /**
+     * Gets a panel in the footer of the grid that can be used for toolbars etc.
+     * After modifying the contents of this panel a call to grid.autoSize() may be
+     * required to register any changes in size.
+     * @param {Boolean} doShow By default the footer is hidden. Pass true to show the panel
+     * @return Roo.Element
+     */
+    getFooterPanel : function(doShow){
+        if(doShow){
+            this.footerPanel.show();
+        }
+        return this.footerPanel;
+    },
+
+    initElements : function(){
+        var E = Roo.Element;
+        var el = this.grid.getGridEl().dom.firstChild;
+        var cs = el.childNodes;
+
+        this.el = new E(el);
+        
+         this.focusEl = new E(el.firstChild);
+        this.focusEl.swallowEvent("click", true);
+        
+        this.headerPanel = new E(cs[1]);
+        this.headerPanel.enableDisplayMode("block");
+
+        this.scroller = new E(cs[2]);
+        this.scrollSizer = new E(this.scroller.dom.firstChild);
+
+        this.lockedWrap = new E(cs[3]);
+        this.lockedHd = new E(this.lockedWrap.dom.firstChild);
+        this.lockedBody = new E(this.lockedWrap.dom.childNodes[1]);
+
+        this.mainWrap = new E(cs[4]);
+        this.mainHd = new E(this.mainWrap.dom.firstChild);
+        this.mainBody = new E(this.mainWrap.dom.childNodes[1]);
+
+        this.footerPanel = new E(cs[5]);
+        this.footerPanel.enableDisplayMode("block");
+
+        this.resizeProxy = new E(cs[6]);
+
+        this.headerSelector = String.format(
+           '#{0} td.x-grid-hd, #{1} td.x-grid-hd',
+           this.lockedHd.id, this.mainHd.id
+        );
+
+        this.splitterSelector = String.format(
+           '#{0} div.x-grid-split, #{1} div.x-grid-split',
+           this.idToCssName(this.lockedHd.id), this.idToCssName(this.mainHd.id)
+        );
+    },
+    idToCssName : function(s)
+    {
+        return s.replace(/[^a-z0-9]+/ig, '-');
+    },
+
+    getHeaderCell : function(index){
+        return Roo.DomQuery.select(this.headerSelector)[index];
+    },
+
+    getHeaderCellMeasure : function(index){
+        return this.getHeaderCell(index).firstChild;
+    },
+
+    getHeaderCellText : function(index){
+        return this.getHeaderCell(index).firstChild.firstChild;
+    },
+
+    getLockedTable : function(){
+        return this.lockedBody.dom.firstChild;
+    },
+
+    getBodyTable : function(){
+        return this.mainBody.dom.firstChild;
+    },
+
+    getLockedRow : function(index){
+        return this.getLockedTable().rows[index];
+    },
+
+    getRow : function(index){
+        return this.getBodyTable().rows[index];
+    },
+
+    getRowComposite : function(index){
+        if(!this.rowEl){
+            this.rowEl = new Roo.CompositeElementLite();
+        }
+        var els = [], lrow, mrow;
+        if(lrow = this.getLockedRow(index)){
+            els.push(lrow);
+        }
+        if(mrow = this.getRow(index)){
+            els.push(mrow);
+        }
+        this.rowEl.elements = els;
+        return this.rowEl;
+    },
+    /**
+     * Gets the 'td' of the cell
+     * 
+     * @param {Integer} rowIndex row to select
+     * @param {Integer} colIndex column to select
+     * 
+     * @return {Object} 
+     */
+    getCell : function(rowIndex, colIndex){
+        var locked = this.cm.getLockedCount();
+        var source;
+        if(colIndex < locked){
+            source = this.lockedBody.dom.firstChild;
+        }else{
+            source = this.mainBody.dom.firstChild;
+            colIndex -= locked;
+        }
+        return source.rows[rowIndex].childNodes[colIndex];
+    },
+
+    getCellText : function(rowIndex, colIndex){
+        return this.getCell(rowIndex, colIndex).firstChild.firstChild;
+    },
+
+    getCellBox : function(cell){
+        var b = this.fly(cell).getBox();
+        if(Roo.isOpera){ // opera fails to report the Y
+            b.y = cell.offsetTop + this.mainBody.getY();
+        }
+        return b;
+    },
+
+    getCellIndex : function(cell){
+        var id = String(cell.className).match(this.cellRE);
+        if(id){
+            return parseInt(id[1], 10);
+        }
+        return 0;
+    },
+
+    findHeaderIndex : function(n){
+        var r = Roo.fly(n).findParent("td." + this.hdClass, 6);
+        return r ? this.getCellIndex(r) : false;
+    },
+
+    findHeaderCell : function(n){
+        var r = Roo.fly(n).findParent("td." + this.hdClass, 6);
+        return r ? r : false;
+    },
+
+    findRowIndex : function(n){
+        if(!n){
+            return false;
+        }
+        var r = Roo.fly(n).findParent("tr." + this.rowClass, 6);
+        return r ? r.rowIndex : false;
+    },
+
+    findCellIndex : function(node){
+        var stop = this.el.dom;
+        while(node && node != stop){
+            if(this.findRE.test(node.className)){
+                return this.getCellIndex(node);
+            }
+            node = node.parentNode;
+        }
+        return false;
+    },
+
+    getColumnId : function(index){
+        return this.cm.getColumnId(index);
+    },
+
+    getSplitters : function()
+    {
+        if(this.splitterSelector){
+           return Roo.DomQuery.select(this.splitterSelector);
+        }else{
+            return null;
+      }
+    },
+
+    getSplitter : function(index){
+        return this.getSplitters()[index];
+    },
+
+    onRowOver : function(e, t){
+        var row;
+        if((row = this.findRowIndex(t)) !== false){
+            this.getRowComposite(row).addClass("x-grid-row-over");
+        }
+    },
+
+    onRowOut : function(e, t){
+        var row;
+        if((row = this.findRowIndex(t)) !== false && row !== this.findRowIndex(e.getRelatedTarget())){
+            this.getRowComposite(row).removeClass("x-grid-row-over");
+        }
+    },
+
+    renderHeaders : function(){
+        var cm = this.cm;
+        var ct = this.templates.hcell, ht = this.templates.header, st = this.templates.hsplit;
+        var cb = [], lb = [], sb = [], lsb = [], p = {};
+        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+            p.cellId = "x-grid-hd-0-" + i;
+            p.splitId = "x-grid-csplit-0-" + i;
+            p.id = cm.getColumnId(i);
+            p.title = cm.getColumnTooltip(i) || "";
+            p.value = cm.getColumnHeader(i) || "";
+            p.style = (this.grid.enableColumnResize === false || !cm.isResizable(i) || cm.isFixed(i)) ? 'cursor:default' : '';
+            if(!cm.isLocked(i)){
+                cb[cb.length] = ct.apply(p);
+                sb[sb.length] = st.apply(p);
+            }else{
+                lb[lb.length] = ct.apply(p);
+                lsb[lsb.length] = st.apply(p);
+            }
+        }
+        return [ht.apply({cells: lb.join(""), splits:lsb.join("")}),
+                ht.apply({cells: cb.join(""), splits:sb.join("")})];
+    },
+
+    updateHeaders : function(){
+        var html = this.renderHeaders();
+        this.lockedHd.update(html[0]);
+        this.mainHd.update(html[1]);
+    },
+
+    /**
+     * Focuses the specified row.
+     * @param {Number} row The row index
+     */
+    focusRow : function(row)
+    {
+        //Roo.log('GridView.focusRow');
+        var x = this.scroller.dom.scrollLeft;
+        this.focusCell(row, 0, false);
+        this.scroller.dom.scrollLeft = x;
+    },
+
+    /**
+     * Focuses the specified cell.
+     * @param {Number} row The row index
+     * @param {Number} col The column index
+     * @param {Boolean} hscroll false to disable horizontal scrolling
+     */
+    focusCell : function(row, col, hscroll)
+    {
+        //Roo.log('GridView.focusCell');
+        var el = this.ensureVisible(row, col, hscroll);
+        this.focusEl.alignTo(el, "tl-tl");
+        if(Roo.isGecko){
+            this.focusEl.focus();
+        }else{
+            this.focusEl.focus.defer(1, this.focusEl);
+        }
+    },
+
+    /**
+     * Scrolls the specified cell into view
+     * @param {Number} row The row index
+     * @param {Number} col The column index
+     * @param {Boolean} hscroll false to disable horizontal scrolling
+     */
+    ensureVisible : function(row, col, hscroll)
+    {
+        //Roo.log('GridView.ensureVisible,' + row + ',' + col);
+        //return null; //disable for testing.
+        if(typeof row != "number"){
+            row = row.rowIndex;
+        }
+        if(row < 0 && row >= this.ds.getCount()){
+            return  null;
+        }
+        col = (col !== undefined ? col : 0);
+        var cm = this.grid.colModel;
+        while(cm.isHidden(col)){
+            col++;
+        }
+
+        var el = this.getCell(row, col);
+        if(!el){
+            return null;
+        }
+        var c = this.scroller.dom;
+
+        var ctop = parseInt(el.offsetTop, 10);
+        var cleft = parseInt(el.offsetLeft, 10);
+        var cbot = ctop + el.offsetHeight;
+        var cright = cleft + el.offsetWidth;
+        
+        var ch = c.clientHeight - this.mainHd.dom.offsetHeight;
+        var stop = parseInt(c.scrollTop, 10);
+        var sleft = parseInt(c.scrollLeft, 10);
+        var sbot = stop + ch;
+        var sright = sleft + c.clientWidth;
+        /*
+        Roo.log('GridView.ensureVisible:' +
+                ' ctop:' + ctop +
+                ' c.clientHeight:' + c.clientHeight +
+                ' this.mainHd.dom.offsetHeight:' + this.mainHd.dom.offsetHeight +
+                ' stop:' + stop +
+                ' cbot:' + cbot +
+                ' sbot:' + sbot +
+                ' ch:' + ch  
+                );
+        */
+        if(ctop < stop){
+             c.scrollTop = ctop;
+            //Roo.log("set scrolltop to ctop DISABLE?");
+        }else if(cbot > sbot){
+            //Roo.log("set scrolltop to cbot-ch");
+            c.scrollTop = cbot-ch;
+        }
+        
+        if(hscroll !== false){
+            if(cleft < sleft){
+                c.scrollLeft = cleft;
+            }else if(cright > sright){
+                c.scrollLeft = cright-c.clientWidth;
+            }
+        }
+         
+        return el;
+    },
+
+    updateColumns : function(){
+        this.grid.stopEditing();
+        var cm = this.grid.colModel, colIds = this.getColumnIds();
+        //var totalWidth = cm.getTotalWidth();
+        var pos = 0;
+        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+            //if(cm.isHidden(i)) continue;
+            var w = cm.getColumnWidth(i);
+            this.css.updateRule(this.colSelector+this.idToCssName(colIds[i]), "width", (w - this.borderWidth) + "px");
+            this.css.updateRule(this.hdSelector+this.idToCssName(colIds[i]), "width", (w - this.borderWidth) + "px");
+        }
+        this.updateSplitters();
+    },
+
+    generateRules : function(cm){
+        var ruleBuf = [], rulesId = this.idToCssName(this.grid.id)+ '-cssrules';
+        Roo.util.CSS.removeStyleSheet(rulesId);
+        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+            var cid = cm.getColumnId(i);
+            var align = '';
+            if(cm.config[i].align){
+                align = 'text-align:'+cm.config[i].align+';';
+            }
+            var hidden = '';
+            if(cm.isHidden(i)){
+                hidden = 'display:none;';
+            }
+            var width = "width:" + (cm.getColumnWidth(i) - this.borderWidth) + "px;";
+            ruleBuf.push(
+                    this.colSelector, cid, " {\n", cm.config[i].css, align, width, "\n}\n",
+                    this.hdSelector, cid, " {\n", align, width, "}\n",
+                    this.tdSelector, cid, " {\n",hidden,"\n}\n",
+                    this.splitSelector, cid, " {\n", hidden , "\n}\n");
+        }
+        return Roo.util.CSS.createStyleSheet(ruleBuf.join(""), rulesId);
+    },
+
+    updateSplitters : function(){
+        var cm = this.cm, s = this.getSplitters();
+        if(s){ // splitters not created yet
+            var pos = 0, locked = true;
+            for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+                if(cm.isHidden(i)) continue;
+                var w = cm.getColumnWidth(i); // make sure it's a number
+                if(!cm.isLocked(i) && locked){
+                    pos = 0;
+                    locked = false;
+                }
+                pos += w;
+                s[i].style.left = (pos-this.splitOffset) + "px";
+            }
+        }
+    },
+
+    handleHiddenChange : function(colModel, colIndex, hidden){
+        if(hidden){
+            this.hideColumn(colIndex);
+        }else{
+            this.unhideColumn(colIndex);
+        }
+    },
+
+    hideColumn : function(colIndex){
+        var cid = this.getColumnId(colIndex);
+        this.css.updateRule(this.tdSelector+this.idToCssName(cid), "display", "none");
+        this.css.updateRule(this.splitSelector+this.idToCssName(cid), "display", "none");
+        if(Roo.isSafari){
+            this.updateHeaders();
+        }
+        this.updateSplitters();
+        this.layout();
+    },
+
+    unhideColumn : function(colIndex){
+        var cid = this.getColumnId(colIndex);
+        this.css.updateRule(this.tdSelector+this.idToCssName(cid), "display", "");
+        this.css.updateRule(this.splitSelector+this.idToCssName(cid), "display", "");
+
+        if(Roo.isSafari){
+            this.updateHeaders();
+        }
+        this.updateSplitters();
+        this.layout();
+    },
+
+    insertRows : function(dm, firstRow, lastRow, isUpdate){
+        if(firstRow == 0 && lastRow == dm.getCount()-1){
+            this.refresh();
+        }else{
+            if(!isUpdate){
+                this.fireEvent("beforerowsinserted", this, firstRow, lastRow);
+            }
+            var s = this.getScrollState();
+            var markup = this.renderRows(firstRow, lastRow);
+            this.bufferRows(markup[0], this.getLockedTable(), firstRow);
+            this.bufferRows(markup[1], this.getBodyTable(), firstRow);
+            this.restoreScroll(s);
+            if(!isUpdate){
+                this.fireEvent("rowsinserted", this, firstRow, lastRow);
+                this.syncRowHeights(firstRow, lastRow);
+                this.stripeRows(firstRow);
+                this.layout();
+            }
+        }
+    },
+
+    bufferRows : function(markup, target, index){
+        var before = null, trows = target.rows, tbody = target.tBodies[0];
+        if(index < trows.length){
+            before = trows[index];
+        }
+        var b = document.createElement("div");
+        b.innerHTML = "<table><tbody>"+markup+"</tbody></table>";
+        var rows = b.firstChild.rows;
+        for(var i = 0, len = rows.length; i < len; i++){
+            if(before){
+                tbody.insertBefore(rows[0], before);
+            }else{
+                tbody.appendChild(rows[0]);
+            }
+        }
+        b.innerHTML = "";
+        b = null;
+    },
+
+    deleteRows : function(dm, firstRow, lastRow){
+        if(dm.getRowCount()<1){
+            this.fireEvent("beforerefresh", this);
+            this.mainBody.update("");
+            this.lockedBody.update("");
+            this.fireEvent("refresh", this);
+        }else{
+            this.fireEvent("beforerowsdeleted", this, firstRow, lastRow);
+            var bt = this.getBodyTable();
+            var tbody = bt.firstChild;
+            var rows = bt.rows;
+            for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
+                tbody.removeChild(rows[firstRow]);
+            }
+            this.stripeRows(firstRow);
+            this.fireEvent("rowsdeleted", this, firstRow, lastRow);
+        }
+    },
+
+    updateRows : function(dataSource, firstRow, lastRow){
+        var s = this.getScrollState();
+        this.refresh();
+        this.restoreScroll(s);
+    },
+
+    handleSort : function(dataSource, sortColumnIndex, sortDir, noRefresh){
+        if(!noRefresh){
+           this.refresh();
+        }
+        this.updateHeaderSortState();
+    },
+
+    getScrollState : function(){
+        
+        var sb = this.scroller.dom;
+        return {left: sb.scrollLeft, top: sb.scrollTop};
+    },
+
+    stripeRows : function(startRow){
+        if(!this.grid.stripeRows || this.ds.getCount() < 1){
+            return;
+        }
+        startRow = startRow || 0;
+        var rows = this.getBodyTable().rows;
+        var lrows = this.getLockedTable().rows;
+        var cls = ' x-grid-row-alt ';
+        for(var i = startRow, len = rows.length; i < len; i++){
+            var row = rows[i], lrow = lrows[i];
+            var isAlt = ((i+1) % 2 == 0);
+            var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1;
+            if(isAlt == hasAlt){
+                continue;
+            }
+            if(isAlt){
+                row.className += " x-grid-row-alt";
+            }else{
+                row.className = row.className.replace("x-grid-row-alt", "");
+            }
+            if(lrow){
+                lrow.className = row.className;
+            }
+        }
+    },
+
+    restoreScroll : function(state){
+        //Roo.log('GridView.restoreScroll');
+        var sb = this.scroller.dom;
+        sb.scrollLeft = state.left;
+        sb.scrollTop = state.top;
+        this.syncScroll();
+    },
+
+    syncScroll : function(){
+        //Roo.log('GridView.syncScroll');
+        var sb = this.scroller.dom;
+        var sh = this.mainHd.dom;
+        var bs = this.mainBody.dom;
+        var lv = this.lockedBody.dom;
+        sh.scrollLeft = bs.scrollLeft = sb.scrollLeft;
+        lv.scrollTop = bs.scrollTop = sb.scrollTop;
+    },
+
+    handleScroll : function(e){
+        this.syncScroll();
+        var sb = this.scroller.dom;
+        this.grid.fireEvent("bodyscroll", sb.scrollLeft, sb.scrollTop);
+        e.stopEvent();
+    },
+
+    handleWheel : function(e){
+        var d = e.getWheelDelta();
+        this.scroller.dom.scrollTop -= d*22;
+        // set this here to prevent jumpy scrolling on large tables
+        this.lockedBody.dom.scrollTop = this.mainBody.dom.scrollTop = this.scroller.dom.scrollTop;
+        e.stopEvent();
+    },
+
+    renderRows : function(startRow, endRow){
+        // pull in all the crap needed to render rows
+        var g = this.grid, cm = g.colModel, ds = g.dataSource, stripe = g.stripeRows;
+        var colCount = cm.getColumnCount();
+
+        if(ds.getCount() < 1){
+            return ["", ""];
+        }
+
+        // build a map for all the columns
+        var cs = [];
+        for(var i = 0; i < colCount; i++){
+            var name = cm.getDataIndex(i);
+            cs[i] = {
+                name : typeof name == 'undefined' ? ds.fields.get(i).name : name,
+                renderer : cm.getRenderer(i),
+                id : cm.getColumnId(i),
+                locked : cm.isLocked(i)
+            };
+        }
+
+        startRow = startRow || 0;
+        endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;
+
+        // records to render
+        var rs = ds.getRange(startRow, endRow);
+
+        return this.doRender(cs, rs, ds, startRow, colCount, stripe);
+    },
+
+    // As much as I hate to duplicate code, this was branched because FireFox really hates
+    // [].join("") on strings. The performance difference was substantial enough to
+    // branch this function
+    doRender : Roo.isGecko ?
+            function(cs, rs, ds, startRow, colCount, stripe){
+                var ts = this.templates, ct = ts.cell, rt = ts.row;
+                // buffers
+                var buf = "", lbuf = "", cb, lcb, c, p = {}, rp = {}, r, rowIndex;
+                
+                var hasListener = this.grid.hasListener('rowclass');
+                var rowcfg = {};
+                for(var j = 0, len = rs.length; j < len; j++){
+                    r = rs[j]; cb = ""; lcb = ""; rowIndex = (j+startRow);
+                    for(var i = 0; i < colCount; i++){
+                        c = cs[i];
+                        p.cellId = "x-grid-cell-" + rowIndex + "-" + i;
+                        p.id = c.id;
+                        p.css = p.attr = "";
+                        p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
+                        if(p.value == undefined || p.value === "") p.value = "&#160;";
+                        if(r.dirty && typeof r.modified[c.name] !== 'undefined'){
+                            p.css += p.css ? ' x-grid-dirty-cell' : 'x-grid-dirty-cell';
+                        }
+                        var markup = ct.apply(p);
+                        if(!c.locked){
+                            cb+= markup;
+                        }else{
+                            lcb+= markup;
+                        }
+                    }
+                    var alt = [];
+                    if(stripe && ((rowIndex+1) % 2 == 0)){
+                        alt.push("x-grid-row-alt")
+                    }
+                    if(r.dirty){
+                        alt.push(  " x-grid-dirty-row");
+                    }
+                    rp.cells = lcb;
+                    if(this.getRowClass){
+                        alt.push(this.getRowClass(r, rowIndex));
+                    }
+                    if (hasListener) {
+                        rowcfg = {
+                             
+                            record: r,
+                            rowIndex : rowIndex,
+                            rowClass : ''
+                        }
+                        this.grid.fireEvent('rowclass', this, rowcfg);
+                        alt.push(rowcfg.rowClass);
+                    }
+                    rp.alt = alt.join(" ");
+                    lbuf+= rt.apply(rp);
+                    rp.cells = cb;
+                    buf+=  rt.apply(rp);
+                }
+                return [lbuf, buf];
+            } :
+            function(cs, rs, ds, startRow, colCount, stripe){
+                var ts = this.templates, ct = ts.cell, rt = ts.row;
+                // buffers
+                var buf = [], lbuf = [], cb, lcb, c, p = {}, rp = {}, r, rowIndex;
+                var hasListener = this.grid.hasListener('rowclass');
+                var rowcfg = {};
+                for(var j = 0, len = rs.length; j < len; j++){
+                    r = rs[j]; cb = []; lcb = []; rowIndex = (j+startRow);
+                    for(var i = 0; i < colCount; i++){
+                        c = cs[i];
+                        p.cellId = "x-grid-cell-" + rowIndex + "-" + i;
+                        p.id = c.id;
+                        p.css = p.attr = "";
+                        p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
+                        if(p.value == undefined || p.value === "") p.value = "&#160;";
+                        if(r.dirty && typeof r.modified[c.name] !== 'undefined'){
+                            p.css += p.css ? ' x-grid-dirty-cell' : 'x-grid-dirty-cell';
+                        }
+                        var markup = ct.apply(p);
+                        if(!c.locked){
+                            cb[cb.length] = markup;
+                        }else{
+                            lcb[lcb.length] = markup;
+                        }
+                    }
+                    var alt = [];
+                    if(stripe && ((rowIndex+1) % 2 == 0)){
+                        alt.push( "x-grid-row-alt");
+                    }
+                    if(r.dirty){
+                        alt.push(" x-grid-dirty-row");
+                    }
+                    rp.cells = lcb;
+                    if(this.getRowClass){
+                        alt.push( this.getRowClass(r, rowIndex));
+                    }
+                    if (hasListener) {
+                        rowcfg = {
+                             
+                            record: r,
+                            rowIndex : rowIndex,
+                            rowClass : ''
+                        }
+                        this.grid.fireEvent('rowclass', this, rowcfg);
+                        alt.push(rowcfg.rowClass);
+                    }
+                    rp.alt = alt.join(" ");
+                    rp.cells = lcb.join("");
+                    lbuf[lbuf.length] = rt.apply(rp);
+                    rp.cells = cb.join("");
+                    buf[buf.length] =  rt.apply(rp);
+                }
+                return [lbuf.join(""), buf.join("")];
+            },
+
+    renderBody : function(){
+        var markup = this.renderRows();
+        var bt = this.templates.body;
+        return [bt.apply({rows: markup[0]}), bt.apply({rows: markup[1]})];
+    },
+
+    /**
+     * Refreshes the grid
+     * @param {Boolean} headersToo
+     */
+    refresh : function(headersToo){
+        this.fireEvent("beforerefresh", this);
+        this.grid.stopEditing();
+        var result = this.renderBody();
+        this.lockedBody.update(result[0]);
+        this.mainBody.update(result[1]);
+        if(headersToo === true){
+            this.updateHeaders();
+            this.updateColumns();
+            this.updateSplitters();
+            this.updateHeaderSortState();
+        }
+        this.syncRowHeights();
+        this.layout();
+        this.fireEvent("refresh", this);
+    },
+
+    handleColumnMove : function(cm, oldIndex, newIndex){
+        this.indexMap = null;
+        var s = this.getScrollState();
+        this.refresh(true);
+        this.restoreScroll(s);
+        this.afterMove(newIndex);
+    },
+
+    afterMove : function(colIndex){
+        if(this.enableMoveAnim && Roo.enableFx){
+            this.fly(this.getHeaderCell(colIndex).firstChild).highlight(this.hlColor);
+        }
+        // if multisort - fix sortOrder, and reload..
+        if (this.grid.dataSource.multiSort) {
+            // the we can call sort again..
+            var dm = this.grid.dataSource;
+            var cm = this.grid.colModel;
+            var so = [];
+            for(var i = 0; i < cm.config.length; i++ ) {
+                
+                if ((typeof(dm.sortToggle[cm.config[i].dataIndex]) == 'undefined')) {
+                    continue; // dont' bother, it's not in sort list or being set.
+                }
+                
+                so.push(cm.config[i].dataIndex);
+            };
+            dm.sortOrder = so;
+            dm.load(dm.lastOptions);
+            
+            
+        }
+        
+    },
+
+    updateCell : function(dm, rowIndex, dataIndex){
+        var colIndex = this.getColumnIndexByDataIndex(dataIndex);
+        if(typeof colIndex == "undefined"){ // not present in grid
+            return;
+        }
+        var cm = this.grid.colModel;
+        var cell = this.getCell(rowIndex, colIndex);
+        var cellText = this.getCellText(rowIndex, colIndex);
+
+        var p = {
+            cellId : "x-grid-cell-" + rowIndex + "-" + colIndex,
+            id : cm.getColumnId(colIndex),
+            css: colIndex == cm.getColumnCount()-1 ? "x-grid-col-last" : ""
+        };
+        var renderer = cm.getRenderer(colIndex);
+        var val = renderer(dm.getValueAt(rowIndex, dataIndex), p, rowIndex, colIndex, dm);
+        if(typeof val == "undefined" || val === "") val = "&#160;";
+        cellText.innerHTML = val;
+        cell.className = this.cellClass + " " + this.idToCssName(p.cellId) + " " + p.css;
+        this.syncRowHeights(rowIndex, rowIndex);
+    },
+
+    calcColumnWidth : function(colIndex, maxRowsToMeasure){
+        var maxWidth = 0;
+        if(this.grid.autoSizeHeaders){
+            var h = this.getHeaderCellMeasure(colIndex);
+            maxWidth = Math.max(maxWidth, h.scrollWidth);
+        }
+        var tb, index;
+        if(this.cm.isLocked(colIndex)){
+            tb = this.getLockedTable();
+            index = colIndex;
+        }else{
+            tb = this.getBodyTable();
+            index = colIndex - this.cm.getLockedCount();
+        }
+        if(tb && tb.rows){
+            var rows = tb.rows;
+            var stopIndex = Math.min(maxRowsToMeasure || rows.length, rows.length);
+            for(var i = 0; i < stopIndex; i++){
+                var cell = rows[i].childNodes[index].firstChild;
+                maxWidth = Math.max(maxWidth, cell.scrollWidth);
+            }
+        }
+        return maxWidth + /*margin for error in IE*/ 5;
+    },
+    /**
+     * Autofit a column to its content.
+     * @param {Number} colIndex
+     * @param {Boolean} forceMinSize true to force the column to go smaller if possible
+     */
+     autoSizeColumn : function(colIndex, forceMinSize, suppressEvent){
+         if(this.cm.isHidden(colIndex)){
+             return; // can't calc a hidden column
+         }
+        if(forceMinSize){
+            var cid = this.cm.getColumnId(colIndex);
+            this.css.updateRule(this.colSelector +this.idToCssName( cid), "width", this.grid.minColumnWidth + "px");
+           if(this.grid.autoSizeHeaders){
+               this.css.updateRule(this.hdSelector + this.idToCssName(cid), "width", this.grid.minColumnWidth + "px");
+           }
+        }
+        var newWidth = this.calcColumnWidth(colIndex);
+        this.cm.setColumnWidth(colIndex,
+            Math.max(this.grid.minColumnWidth, newWidth), suppressEvent);
+        if(!suppressEvent){
+            this.grid.fireEvent("columnresize", colIndex, newWidth);
+        }
+    },
+
+    /**
+     * Autofits all columns to their content and then expands to fit any extra space in the grid
+     */
+     autoSizeColumns : function(){
+        var cm = this.grid.colModel;
+        var colCount = cm.getColumnCount();
+        for(var i = 0; i < colCount; i++){
+            this.autoSizeColumn(i, true, true);
+        }
+        if(cm.getTotalWidth() < this.scroller.dom.clientWidth){
+            this.fitColumns();
+        }else{
+            this.updateColumns();
+            this.layout();
+        }
+    },
+
+    /**
+     * Autofits all columns to the grid's width proportionate with their current size
+     * @param {Boolean} reserveScrollSpace Reserve space for a scrollbar
+     */
+    fitColumns : function(reserveScrollSpace){
+        var cm = this.grid.colModel;
+        var colCount = cm.getColumnCount();
+        var cols = [];
+        var width = 0;
+        var i, w;
+        for (i = 0; i < colCount; i++){
+            if(!cm.isHidden(i) && !cm.isFixed(i)){
+                w = cm.getColumnWidth(i);
+                cols.push(i);
+                cols.push(w);
+                width += w;
+            }
+        }
+        var avail = Math.min(this.scroller.dom.clientWidth, this.el.getWidth());
+        if(reserveScrollSpace){
+            avail -= 17;
+        }
+        var frac = (avail - cm.getTotalWidth())/width;
+        while (cols.length){
+            w = cols.pop();
+            i = cols.pop();
+            cm.setColumnWidth(i, Math.floor(w + w*frac), true);
+        }
+        this.updateColumns();
+        this.layout();
+    },
+
+    onRowSelect : function(rowIndex){
+        var row = this.getRowComposite(rowIndex);
+        row.addClass("x-grid-row-selected");
+    },
+
+    onRowDeselect : function(rowIndex){
+        var row = this.getRowComposite(rowIndex);
+        row.removeClass("x-grid-row-selected");
+    },
+
+    onCellSelect : function(row, col){
+        var cell = this.getCell(row, col);
+        if(cell){
+            Roo.fly(cell).addClass("x-grid-cell-selected");
+        }
+    },
+
+    onCellDeselect : function(row, col){
+        var cell = this.getCell(row, col);
+        if(cell){
+            Roo.fly(cell).removeClass("x-grid-cell-selected");
+        }
+    },
+
+    updateHeaderSortState : function(){
+        
+        // sort state can be single { field: xxx, direction : yyy}
+        // or   { xxx=>ASC , yyy : DESC ..... }
+        
+        var mstate = {};
+        if (!this.ds.multiSort) { 
+            var state = this.ds.getSortState();
+            if(!state){
+                return;
+            }
+            mstate[state.field] = state.direction;
+            // FIXME... - this is not used here.. but might be elsewhere..
+            this.sortState = state;
+            
+        } else {
+            mstate = this.ds.sortToggle;
+        }
+        //remove existing sort classes..
+        
+        var sc = this.sortClasses;
+        var hds = this.el.select(this.headerSelector).removeClass(sc);
+        
+        for(var f in mstate) {
+        
+            var sortColumn = this.cm.findColumnIndex(f);
+            
+            if(sortColumn != -1){
+                var sortDir = mstate[f];        
+                hds.item(sortColumn).addClass(sc[sortDir == "DESC" ? 1 : 0]);
+            }
+        }
+        
+         
+        
+    },
+
+
+    handleHeaderClick : function(g, index){
+        if(this.headersDisabled){
+            return;
+        }
+        var dm = g.dataSource, cm = g.colModel;
+        if(!cm.isSortable(index)){
+            return;
+        }
+        g.stopEditing();
+        
+        if (dm.multiSort) {
+            // update the sortOrder
+            var so = [];
+            for(var i = 0; i < cm.config.length; i++ ) {
+                
+                if ((typeof(dm.sortToggle[cm.config[i].dataIndex]) == 'undefined') && (index != i)) {
+                    continue; // dont' bother, it's not in sort list or being set.
+                }
+                
+                so.push(cm.config[i].dataIndex);
+            };
+            dm.sortOrder = so;
+        }
+        
+        
+        dm.sort(cm.getDataIndex(index));
+    },
+
+
+    destroy : function(){
+        if(this.colMenu){
+            this.colMenu.removeAll();
+            Roo.menu.MenuMgr.unregister(this.colMenu);
+            this.colMenu.getEl().remove();
+            delete this.colMenu;
+        }
+        if(this.hmenu){
+            this.hmenu.removeAll();
+            Roo.menu.MenuMgr.unregister(this.hmenu);
+            this.hmenu.getEl().remove();
+            delete this.hmenu;
+        }
+        if(this.grid.enableColumnMove){
+            var dds = Roo.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
+            if(dds){
+                for(var dd in dds){
+                    if(!dds[dd].config.isTarget && dds[dd].dragElId){
+                        var elid = dds[dd].dragElId;
+                        dds[dd].unreg();
+                        Roo.get(elid).remove();
+                    } else if(dds[dd].config.isTarget){
+                        dds[dd].proxyTop.remove();
+                        dds[dd].proxyBottom.remove();
+                        dds[dd].unreg();
+                    }
+                    if(Roo.dd.DDM.locationCache[dd]){
+                        delete Roo.dd.DDM.locationCache[dd];
+                    }
+                }
+                delete Roo.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
+            }
+        }
+        Roo.util.CSS.removeStyleSheet(this.idToCssName(this.grid.id) + '-cssrules');
+        this.bind(null, null);
+        Roo.EventManager.removeResizeListener(this.onWindowResize, this);
+    },
+
+    handleLockChange : function(){
+        this.refresh(true);
+    },
+
+    onDenyColumnLock : function(){
+
+    },
+
+    onDenyColumnHide : function(){
+
+    },
+
+    handleHdMenuClick : function(item){
+        var index = this.hdCtxIndex;
+        var cm = this.cm, ds = this.ds;
+        switch(item.id){
+            case "asc":
+                ds.sort(cm.getDataIndex(index), "ASC");
+                break;
+            case "desc":
+                ds.sort(cm.getDataIndex(index), "DESC");
+                break;
+            case "lock":
+                var lc = cm.getLockedCount();
+                if(cm.getColumnCount(true) <= lc+1){
+                    this.onDenyColumnLock();
+                    return;
+                }
+                if(lc != index){
+                    cm.setLocked(index, true, true);
+                    cm.moveColumn(index, lc);
+                    this.grid.fireEvent("columnmove", index, lc);
+                }else{
+                    cm.setLocked(index, true);
+                }
+            break;
+            case "unlock":
+                var lc = cm.getLockedCount();
+                if((lc-1) != index){
+                    cm.setLocked(index, false, true);
+                    cm.moveColumn(index, lc-1);
+                    this.grid.fireEvent("columnmove", index, lc-1);
+                }else{
+                    cm.setLocked(index, false);
+                }
+            break;
+            default:
+                index = cm.getIndexById(item.id.substr(4));
+                if(index != -1){
+                    if(item.checked && cm.getColumnCount(true) <= 1){
+                        this.onDenyColumnHide();
+                        return false;
+                    }
+                    cm.setHidden(index, item.checked);
+                }
+        }
+        return true;
+    },
+
+    beforeColMenuShow : function(){
+        var cm = this.cm,  colCount = cm.getColumnCount();
+        this.colMenu.removeAll();
+        for(var i = 0; i < colCount; i++){
+            this.colMenu.add(new Roo.menu.CheckItem({
+                id: "col-"+cm.getColumnId(i),
+                text: cm.getColumnHeader(i),
+                checked: !cm.isHidden(i),
+                hideOnClick:false
+            }));
+        }
+    },
+
+    handleHdCtx : function(g, index, e){
+        e.stopEvent();
+        var hd = this.getHeaderCell(index);
+        this.hdCtxIndex = index;
+        var ms = this.hmenu.items, cm = this.cm;
+        ms.get("asc").setDisabled(!cm.isSortable(index));
+        ms.get("desc").setDisabled(!cm.isSortable(index));
+        if(this.grid.enableColLock !== false){
+            ms.get("lock").setDisabled(cm.isLocked(index));
+            ms.get("unlock").setDisabled(!cm.isLocked(index));
+        }
+        this.hmenu.show(hd, "tl-bl");
+    },
+
+    handleHdOver : function(e){
+        var hd = this.findHeaderCell(e.getTarget());
+        if(hd && !this.headersDisabled){
+            if(this.grid.colModel.isSortable(this.getCellIndex(hd))){
+               this.fly(hd).addClass("x-grid-hd-over");
+            }
+        }
+    },
+
+    handleHdOut : function(e){
+        var hd = this.findHeaderCell(e.getTarget());
+        if(hd){
+            this.fly(hd).removeClass("x-grid-hd-over");
+        }
+    },
+
+    handleSplitDblClick : function(e, t){
+        var i = this.getCellIndex(t);
+        if(this.grid.enableColumnResize !== false && this.cm.isResizable(i) && !this.cm.isFixed(i)){
+            this.autoSizeColumn(i, true);
+            this.layout();
+        }
+    },
+
+    render : function(){
+
+        var cm = this.cm;
+        var colCount = cm.getColumnCount();
+
+        if(this.grid.monitorWindowResize === true){
+            Roo.EventManager.onWindowResize(this.onWindowResize, this, true);
+        }
+        var header = this.renderHeaders();
+        var body = this.templates.body.apply({rows:""});
+        var html = this.templates.master.apply({
+            lockedBody: body,
+            body: body,
+            lockedHeader: header[0],
+            header: header[1]
+        });
+
+        //this.updateColumns();
+
+        this.grid.getGridEl().dom.innerHTML = html;
+
+        this.initElements();
+        
+        // a kludge to fix the random scolling effect in webkit
+        this.el.on("scroll", function() {
+            this.el.dom.scrollTop=0; // hopefully not recursive..
+        },this);
+
+        this.scroller.on("scroll", this.handleScroll, this);
+        this.lockedBody.on("mousewheel", this.handleWheel, this);
+        this.mainBody.on("mousewheel", this.handleWheel, this);
+
+        this.mainHd.on("mouseover", this.handleHdOver, this);
+        this.mainHd.on("mouseout", this.handleHdOut, this);
+        this.mainHd.on("dblclick", this.handleSplitDblClick, this,
+                {delegate: "."+this.splitClass});
+
+        this.lockedHd.on("mouseover", this.handleHdOver, this);
+        this.lockedHd.on("mouseout", this.handleHdOut, this);
+        this.lockedHd.on("dblclick", this.handleSplitDblClick, this,
+                {delegate: "."+this.splitClass});
+
+        if(this.grid.enableColumnResize !== false && Roo.grid.SplitDragZone){
+            new Roo.grid.SplitDragZone(this.grid, this.lockedHd.dom, this.mainHd.dom);
+        }
+
+        this.updateSplitters();
+
+        if(this.grid.enableColumnMove && Roo.grid.HeaderDragZone){
+            new Roo.grid.HeaderDragZone(this.grid, this.lockedHd.dom, this.mainHd.dom);
+            new Roo.grid.HeaderDropZone(this.grid, this.lockedHd.dom, this.mainHd.dom);
+        }
+
+        if(this.grid.enableCtxMenu !== false && Roo.menu.Menu){
+            this.hmenu = new Roo.menu.Menu({id: this.grid.id + "-hctx"});
+            this.hmenu.add(
+                {id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},
+                {id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}
+            );
+            if(this.grid.enableColLock !== false){
+                this.hmenu.add('-',
+                    {id:"lock", text: this.lockText, cls: "xg-hmenu-lock"},
+                    {id:"unlock", text: this.unlockText, cls: "xg-hmenu-unlock"}
+                );
+            }
+            if(this.grid.enableColumnHide !== false){
+
+                this.colMenu = new Roo.menu.Menu({id:this.grid.id + "-hcols-menu"});
+                this.colMenu.on("beforeshow", this.beforeColMenuShow, this);
+                this.colMenu.on("itemclick", this.handleHdMenuClick, this);
+
+                this.hmenu.add('-',
+                    {id:"columns", text: this.columnsText, menu: this.colMenu}
+                );
+            }
+            this.hmenu.on("itemclick", this.handleHdMenuClick, this);
+
+            this.grid.on("headercontextmenu", this.handleHdCtx, this);
+        }
+
+        if((this.grid.enableDragDrop || this.grid.enableDrag) && Roo.grid.GridDragZone){
+            this.dd = new Roo.grid.GridDragZone(this.grid, {
+                ddGroup : this.grid.ddGroup || 'GridDD'
+            });
+        }
+
+        /*
+        for(var i = 0; i < colCount; i++){
+            if(cm.isHidden(i)){
+                this.hideColumn(i);
+            }
+            if(cm.config[i].align){
+                this.css.updateRule(this.colSelector + i, "textAlign", cm.config[i].align);
+                this.css.updateRule(this.hdSelector + i, "textAlign", cm.config[i].align);
+            }
+        }*/
+        
+        this.updateHeaderSortState();
+
+        this.beforeInitialResize();
+        this.layout(true);
+
+        // two part rendering gives faster view to the user
+        this.renderPhase2.defer(1, this);
+    },
+
+    renderPhase2 : function(){
+        // render the rows now
+        this.refresh();
+        if(this.grid.autoSizeColumns){
+            this.autoSizeColumns();
+        }
+    },
+
+    beforeInitialResize : function(){
+
+    },
+
+    onColumnSplitterMoved : function(i, w){
+        this.userResized = true;
+        var cm = this.grid.colModel;
+        cm.setColumnWidth(i, w, true);
+        var cid = cm.getColumnId(i);
+        this.css.updateRule(this.colSelector + this.idToCssName(cid), "width", (w-this.borderWidth) + "px");
+        this.css.updateRule(this.hdSelector + this.idToCssName(cid), "width", (w-this.borderWidth) + "px");
+        this.updateSplitters();
+        this.layout();
+        this.grid.fireEvent("columnresize", i, w);
+    },
+
+    syncRowHeights : function(startIndex, endIndex){
+        if(this.grid.enableRowHeightSync === true && this.cm.getLockedCount() > 0){
+            startIndex = startIndex || 0;
+            var mrows = this.getBodyTable().rows;
+            var lrows = this.getLockedTable().rows;
+            var len = mrows.length-1;
+            endIndex = Math.min(endIndex || len, len);
+            for(var i = startIndex; i <= endIndex; i++){
+                var m = mrows[i], l = lrows[i];
+                var h = Math.max(m.offsetHeight, l.offsetHeight);
+                m.style.height = l.style.height = h + "px";
+            }
+        }
+    },
+
+    layout : function(initialRender, is2ndPass){
+        var g = this.grid;
+        var auto = g.autoHeight;
+        var scrollOffset = 16;
+        var c = g.getGridEl(), cm = this.cm,
+                expandCol = g.autoExpandColumn,
+                gv = this;
+        //c.beginMeasure();
+
+        if(!c.dom.offsetWidth){ // display:none?
+            if(initialRender){
+                this.lockedWrap.show();
+                this.mainWrap.show();
+            }
+            return;
+        }
+
+        var hasLock = this.cm.isLocked(0);
+
+        var tbh = this.headerPanel.getHeight();
+        var bbh = this.footerPanel.getHeight();
+
+        if(auto){
+            var ch = this.getBodyTable().offsetHeight + tbh + bbh + this.mainHd.getHeight();
+            var newHeight = ch + c.getBorderWidth("tb");
+            if(g.maxHeight){
+                newHeight = Math.min(g.maxHeight, newHeight);
+            }
+            c.setHeight(newHeight);
+        }
+
+        if(g.autoWidth){
+            c.setWidth(cm.getTotalWidth()+c.getBorderWidth('lr'));
+        }
+
+        var s = this.scroller;
+
+        var csize = c.getSize(true);
+
+        this.el.setSize(csize.width, csize.height);
+
+        this.headerPanel.setWidth(csize.width);
+        this.footerPanel.setWidth(csize.width);
+
+        var hdHeight = this.mainHd.getHeight();
+        var vw = csize.width;
+        var vh = csize.height - (tbh + bbh);
+
+        s.setSize(vw, vh);
+
+        var bt = this.getBodyTable();
+        var ltWidth = hasLock ?
+                      Math.max(this.getLockedTable().offsetWidth, this.lockedHd.dom.firstChild.offsetWidth) : 0;
+
+        var scrollHeight = bt.offsetHeight;
+        var scrollWidth = ltWidth + bt.offsetWidth;
+        var vscroll = false, hscroll = false;
+
+        this.scrollSizer.setSize(scrollWidth, scrollHeight+hdHeight);
+
+        var lw = this.lockedWrap, mw = this.mainWrap;
+        var lb = this.lockedBody, mb = this.mainBody;
+
+        setTimeout(function(){
+            var t = s.dom.offsetTop;
+            var w = s.dom.clientWidth,
+                h = s.dom.clientHeight;
+
+            lw.setTop(t);
+            lw.setSize(ltWidth, h);
+
+            mw.setLeftTop(ltWidth, t);
+            mw.setSize(w-ltWidth, h);
+
+            lb.setHeight(h-hdHeight);
+            mb.setHeight(h-hdHeight);
+
+            if(is2ndPass !== true && !gv.userResized && expandCol){
+                // high speed resize without full column calculation
+                
+                var ci = cm.getIndexById(expandCol);
+                if (ci < 0) {
+                    ci = cm.findColumnIndex(expandCol);
+                }
+                ci = Math.max(0, ci); // make sure it's got at least the first col.
+                var expandId = cm.getColumnId(ci);
+                var  tw = cm.getTotalWidth(false);
+                var currentWidth = cm.getColumnWidth(ci);
+                var cw = Math.min(Math.max(((w-tw)+currentWidth-2)-/*scrollbar*/(w <= s.dom.offsetWidth ? 0 : 18), g.autoExpandMin), g.autoExpandMax);
+                if(currentWidth != cw){
+                    cm.setColumnWidth(ci, cw, true);
+                    gv.css.updateRule(gv.colSelector+gv.idToCssName(expandId), "width", (cw - gv.borderWidth) + "px");
+                    gv.css.updateRule(gv.hdSelector+gv.idToCssName(expandId), "width", (cw - gv.borderWidth) + "px");
+                    gv.updateSplitters();
+                    gv.layout(false, true);
+                }
+            }
+
+            if(initialRender){
+                lw.show();
+                mw.show();
+            }
+            //c.endMeasure();
+        }, 10);
+    },
+
+    onWindowResize : function(){
+        if(!this.grid.monitorWindowResize || this.grid.autoHeight){
+            return;
+        }
+        this.layout();
+    },
+
+    appendFooter : function(parentEl){
+        return null;
+    },
+
+    sortAscText : "Sort Ascending",
+    sortDescText : "Sort Descending",
+    lockText : "Lock Column",
+    unlockText : "Unlock Column",
+    columnsText : "Columns"
+});
+
+
+Roo.grid.GridView.ColumnDragZone = function(grid, hd){
+    Roo.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);
+    this.proxy.el.addClass('x-grid3-col-dd');
+};
+
+Roo.extend(Roo.grid.GridView.ColumnDragZone, Roo.grid.HeaderDragZone, {
+    handleMouseDown : function(e){
+
+    },
+
+    callHandleMouseDown : function(e){
+        Roo.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e);
+    }
+});
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+// private
+// This is a support class used internally by the Grid components
+Roo.grid.SplitDragZone = function(grid, hd, hd2){
+    this.grid = grid;
+    this.view = grid.getView();
+    this.proxy = this.view.resizeProxy;
+    Roo.grid.SplitDragZone.superclass.constructor.call(this, hd,
+        "gridSplitters" + this.grid.getGridEl().id, {
+        dragElId : Roo.id(this.proxy.dom), resizeFrame:false
+    });
+    this.setHandleElId(Roo.id(hd));
+    this.setOuterHandleElId(Roo.id(hd2));
+    this.scroll = false;
+};
+Roo.extend(Roo.grid.SplitDragZone, Roo.dd.DDProxy, {
+    fly: Roo.Element.fly,
+
+    b4StartDrag : function(x, y){
+        this.view.headersDisabled = true;
+        this.proxy.setHeight(this.view.mainWrap.getHeight());
+        var w = this.cm.getColumnWidth(this.cellIndex);
+        var minw = Math.max(w-this.grid.minColumnWidth, 0);
+        this.resetConstraints();
+        this.setXConstraint(minw, 1000);
+        this.setYConstraint(0, 0);
+        this.minX = x - minw;
+        this.maxX = x + 1000;
+        this.startPos = x;
+        Roo.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
+    },
+
+
+    handleMouseDown : function(e){
+        ev = Roo.EventObject.setEvent(e);
+        var t = this.fly(ev.getTarget());
+        if(t.hasClass("x-grid-split")){
+            this.cellIndex = this.view.getCellIndex(t.dom);
+            this.split = t.dom;
+            this.cm = this.grid.colModel;
+            if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
+                Roo.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
+            }
+        }
+    },
+
+    endDrag : function(e){
+        this.view.headersDisabled = false;
+        var endX = Math.max(this.minX, Roo.lib.Event.getPageX(e));
+        var diff = endX - this.startPos;
+        this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
+    },
+
+    autoOffset : function(){
+        this.setDelta(0,0);
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+// private
+// This is a support class used internally by the Grid components
+Roo.grid.GridDragZone = function(grid, config){
+    this.view = grid.getView();
+    Roo.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);
+    if(this.view.lockedBody){
+        this.setHandleElId(Roo.id(this.view.mainBody.dom));
+        this.setOuterHandleElId(Roo.id(this.view.lockedBody.dom));
+    }
+    this.scroll = false;
+    this.grid = grid;
+    this.ddel = document.createElement('div');
+    this.ddel.className = 'x-grid-dd-wrap';
+};
+
+Roo.extend(Roo.grid.GridDragZone, Roo.dd.DragZone, {
+    ddGroup : "GridDD",
+
+    getDragData : function(e){
+        var t = Roo.lib.Event.getTarget(e);
+        var rowIndex = this.view.findRowIndex(t);
+        if(rowIndex !== false){
+            var sm = this.grid.selModel;
+            //if(!sm.isSelected(rowIndex) || e.hasModifier()){
+              //  sm.mouseDown(e, t);
+            //}
+            if (e.hasModifier()){
+                sm.handleMouseDown(e, t); // non modifier buttons are handled by row select.
+            }
+            return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()};
+        }
+        return false;
+    },
+
+    onInitDrag : function(e){
+        var data = this.dragData;
+        this.ddel.innerHTML = this.grid.getDragDropText();
+        this.proxy.update(this.ddel);
+        // fire start drag?
+    },
+
+    afterRepair : function(){
+        this.dragging = false;
+    },
+
+    getRepairXY : function(e, data){
+        return false;
+    },
+
+    onEndDrag : function(data, e){
+        // fire end drag?
+    },
+
+    onValidDrop : function(dd, e, id){
+        // fire drag drop?
+        this.hideProxy();
+    },
+
+    beforeInvalidDrop : function(e, id){
+
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.grid.ColumnModel
+ * @extends Roo.util.Observable
+ * This is the default implementation of a ColumnModel used by the Grid. It defines
+ * the columns in the grid.
+ * <br>Usage:<br>
+ <pre><code>
+ var colModel = new Roo.grid.ColumnModel([
+       {header: "Ticker", width: 60, sortable: true, locked: true},
+       {header: "Company Name", width: 150, sortable: true},
+       {header: "Market Cap.", width: 100, sortable: true},
+       {header: "$ Sales", width: 100, sortable: true, renderer: money},
+       {header: "Employees", width: 100, sortable: true, resizable: false}
+ ]);
+ </code></pre>
+ * <p>
+ * The config options listed for this class are options which may appear in each
+ * individual column definition.
+ * <br/>RooJS Fix - column id's are not sequential but use Roo.id() - fixes bugs with layouts.
+ * @constructor
+ * @param {Object} config An Array of column config objects. See this class's
+ * config objects for details.
+*/
+Roo.grid.ColumnModel = function(config){
+       /**
+     * The config passed into the constructor
+     */
+    this.config = config;
+    this.lookup = {};
+
+    // if no id, create one
+    // if the column does not have a dataIndex mapping,
+    // map it to the order it is in the config
+    for(var i = 0, len = config.length; i < len; i++){
+        var c = config[i];
+        if(typeof c.dataIndex == "undefined"){
+            c.dataIndex = i;
+        }
+        if(typeof c.renderer == "string"){
+            c.renderer = Roo.util.Format[c.renderer];
+        }
+        if(typeof c.id == "undefined"){
+            c.id = Roo.id();
+        }
+        if(c.editor && c.editor.xtype){
+            c.editor  = Roo.factory(c.editor, Roo.grid);
+        }
+        if(c.editor && c.editor.isFormField){
+            c.editor = new Roo.grid.GridEditor(c.editor);
+        }
+        this.lookup[c.id] = c;
+    }
+
+    /**
+     * The width of columns which have no width specified (defaults to 100)
+     * @type Number
+     */
+    this.defaultWidth = 100;
+
+    /**
+     * Default sortable of columns which have no sortable specified (defaults to false)
+     * @type Boolean
+     */
+    this.defaultSortable = false;
+
+    this.addEvents({
+        /**
+            * @event widthchange
+            * Fires when the width of a column changes.
+            * @param {ColumnModel} this
+            * @param {Number} columnIndex The column index
+            * @param {Number} newWidth The new width
+            */
+           "widthchange": true,
+        /**
+            * @event headerchange
+            * Fires when the text of a header changes.
+            * @param {ColumnModel} this
+            * @param {Number} columnIndex The column index
+            * @param {Number} newText The new header text
+            */
+           "headerchange": true,
+        /**
+            * @event hiddenchange
+            * Fires when a column is hidden or "unhidden".
+            * @param {ColumnModel} this
+            * @param {Number} columnIndex The column index
+            * @param {Boolean} hidden true if hidden, false otherwise
+            */
+           "hiddenchange": true,
+           /**
+         * @event columnmoved
+         * Fires when a column is moved.
+         * @param {ColumnModel} this
+         * @param {Number} oldIndex
+         * @param {Number} newIndex
+         */
+        "columnmoved" : true,
+        /**
+         * @event columlockchange
+         * Fires when a column's locked state is changed
+         * @param {ColumnModel} this
+         * @param {Number} colIndex
+         * @param {Boolean} locked true if locked
+         */
+        "columnlockchange" : true
+    });
+    Roo.grid.ColumnModel.superclass.constructor.call(this);
+};
+Roo.extend(Roo.grid.ColumnModel, Roo.util.Observable, {
+    /**
+     * @cfg {String} header The header text to display in the Grid view.
+     */
+    /**
+     * @cfg {String} dataIndex (Optional) The name of the field in the grid's {@link Roo.data.Store}'s
+     * {@link Roo.data.Record} definition from which to draw the column's value. If not
+     * specified, the column's index is used as an index into the Record's data Array.
+     */
+    /**
+     * @cfg {Number} width (Optional) The initial width in pixels of the column. Using this
+     * instead of {@link Roo.grid.Grid#autoSizeColumns} is more efficient.
+     */
+    /**
+     * @cfg {Boolean} sortable (Optional) True if sorting is to be allowed on this column.
+     * Defaults to the value of the {@link #defaultSortable} property.
+     * Whether local/remote sorting is used is specified in {@link Roo.data.Store#remoteSort}.
+     */
+    /**
+     * @cfg {Boolean} locked (Optional) True to lock the column in place while scrolling the Grid.  Defaults to false.
+     */
+    /**
+     * @cfg {Boolean} fixed (Optional) True if the column width cannot be changed.  Defaults to false.
+     */
+    /**
+     * @cfg {Boolean} resizable (Optional) False to disable column resizing. Defaults to true.
+     */
+    /**
+     * @cfg {Boolean} hidden (Optional) True to hide the column. Defaults to false.
+     */
+    /**
+     * @cfg {Function} renderer (Optional) A function used to generate HTML markup for a cell
+     * given the cell's data value. See {@link #setRenderer}. If not specified, the
+     * default renderer uses the raw data value.
+     */
+       /**
+     * @cfg {Roo.grid.GridEditor} editor (Optional) For grid editors - returns the grid editor 
+     */
+    /**
+     * @cfg {String} align (Optional) Set the CSS text-align property of the column.  Defaults to undefined.
+     */
+
+    /**
+     * Returns the id of the column at the specified index.
+     * @param {Number} index The column index
+     * @return {String} the id
+     */
+    getColumnId : function(index){
+        return this.config[index].id;
+    },
+
+    /**
+     * Returns the column for a specified id.
+     * @param {String} id The column id
+     * @return {Object} the column
+     */
+    getColumnById : function(id){
+        return this.lookup[id];
+    },
+
+    
+    /**
+     * Returns the column for a specified dataIndex.
+     * @param {String} dataIndex The column dataIndex
+     * @return {Object|Boolean} the column or false if not found
+     */
+    getColumnByDataIndex: function(dataIndex){
+        var index = this.findColumnIndex(dataIndex);
+        return index > -1 ? this.config[index] : false;
+    },
+    
+    /**
+     * Returns the index for a specified column id.
+     * @param {String} id The column id
+     * @return {Number} the index, or -1 if not found
+     */
+    getIndexById : function(id){
+        for(var i = 0, len = this.config.length; i < len; i++){
+            if(this.config[i].id == id){
+                return i;
+            }
+        }
+        return -1;
+    },
+    
+    /**
+     * Returns the index for a specified column dataIndex.
+     * @param {String} dataIndex The column dataIndex
+     * @return {Number} the index, or -1 if not found
+     */
+    
+    findColumnIndex : function(dataIndex){
+        for(var i = 0, len = this.config.length; i < len; i++){
+            if(this.config[i].dataIndex == dataIndex){
+                return i;
+            }
+        }
+        return -1;
+    },
+    
+    
+    moveColumn : function(oldIndex, newIndex){
+        var c = this.config[oldIndex];
+        this.config.splice(oldIndex, 1);
+        this.config.splice(newIndex, 0, c);
+        this.dataMap = null;
+        this.fireEvent("columnmoved", this, oldIndex, newIndex);
+    },
+
+    isLocked : function(colIndex){
+        return this.config[colIndex].locked === true;
+    },
+
+    setLocked : function(colIndex, value, suppressEvent){
+        if(this.isLocked(colIndex) == value){
+            return;
+        }
+        this.config[colIndex].locked = value;
+        if(!suppressEvent){
+            this.fireEvent("columnlockchange", this, colIndex, value);
+        }
+    },
+
+    getTotalLockedWidth : function(){
+        var totalWidth = 0;
+        for(var i = 0; i < this.config.length; i++){
+            if(this.isLocked(i) && !this.isHidden(i)){
+                this.totalWidth += this.getColumnWidth(i);
+            }
+        }
+        return totalWidth;
+    },
+
+    getLockedCount : function(){
+        for(var i = 0, len = this.config.length; i < len; i++){
+            if(!this.isLocked(i)){
+                return i;
+            }
+        }
+    },
+
+    /**
+     * Returns the number of columns.
+     * @return {Number}
+     */
+    getColumnCount : function(visibleOnly){
+        if(visibleOnly === true){
+            var c = 0;
+            for(var i = 0, len = this.config.length; i < len; i++){
+                if(!this.isHidden(i)){
+                    c++;
+                }
+            }
+            return c;
+        }
+        return this.config.length;
+    },
+
+    /**
+     * Returns the column configs that return true by the passed function that is called with (columnConfig, index)
+     * @param {Function} fn
+     * @param {Object} scope (optional)
+     * @return {Array} result
+     */
+    getColumnsBy : function(fn, scope){
+        var r = [];
+        for(var i = 0, len = this.config.length; i < len; i++){
+            var c = this.config[i];
+            if(fn.call(scope||this, c, i) === true){
+                r[r.length] = c;
+            }
+        }
+        return r;
+    },
+
+    /**
+     * Returns true if the specified column is sortable.
+     * @param {Number} col The column index
+     * @return {Boolean}
+     */
+    isSortable : function(col){
+        if(typeof this.config[col].sortable == "undefined"){
+            return this.defaultSortable;
+        }
+        return this.config[col].sortable;
+    },
+
+    /**
+     * Returns the rendering (formatting) function defined for the column.
+     * @param {Number} col The column index.
+     * @return {Function} The function used to render the cell. See {@link #setRenderer}.
+     */
+    getRenderer : function(col){
+        if(!this.config[col].renderer){
+            return Roo.grid.ColumnModel.defaultRenderer;
+        }
+        return this.config[col].renderer;
+    },
+
+    /**
+     * Sets the rendering (formatting) function for a column.
+     * @param {Number} col The column index
+     * @param {Function} fn The function to use to process the cell's raw data
+     * to return HTML markup for the grid view. The render function is called with
+     * the following parameters:<ul>
+     * <li>Data value.</li>
+     * <li>Cell metadata. An object in which you may set the following attributes:<ul>
+     * <li>css A CSS style string to apply to the table cell.</li>
+     * <li>attr An HTML attribute definition string to apply to the data container element <i>within</i> the table cell.</li></ul>
+     * <li>The {@link Roo.data.Record} from which the data was extracted.</li>
+     * <li>Row index</li>
+     * <li>Column index</li>
+     * <li>The {@link Roo.data.Store} object from which the Record was extracted</li></ul>
+     */
+    setRenderer : function(col, fn){
+        this.config[col].renderer = fn;
+    },
+
+    /**
+     * Returns the width for the specified column.
+     * @param {Number} col The column index
+     * @return {Number}
+     */
+    getColumnWidth : function(col){
+        return this.config[col].width * 1 || this.defaultWidth;
+    },
+
+    /**
+     * Sets the width for a column.
+     * @param {Number} col The column index
+     * @param {Number} width The new width
+     */
+    setColumnWidth : function(col, width, suppressEvent){
+        this.config[col].width = width;
+        this.totalWidth = null;
+        if(!suppressEvent){
+             this.fireEvent("widthchange", this, col, width);
+        }
+    },
+
+    /**
+     * Returns the total width of all columns.
+     * @param {Boolean} includeHidden True to include hidden column widths
+     * @return {Number}
+     */
+    getTotalWidth : function(includeHidden){
+        if(!this.totalWidth){
+            this.totalWidth = 0;
+            for(var i = 0, len = this.config.length; i < len; i++){
+                if(includeHidden || !this.isHidden(i)){
+                    this.totalWidth += this.getColumnWidth(i);
+                }
+            }
+        }
+        return this.totalWidth;
+    },
+
+    /**
+     * Returns the header for the specified column.
+     * @param {Number} col The column index
+     * @return {String}
+     */
+    getColumnHeader : function(col){
+        return this.config[col].header;
+    },
+
+    /**
+     * Sets the header for a column.
+     * @param {Number} col The column index
+     * @param {String} header The new header
+     */
+    setColumnHeader : function(col, header){
+        this.config[col].header = header;
+        this.fireEvent("headerchange", this, col, header);
+    },
+
+    /**
+     * Returns the tooltip for the specified column.
+     * @param {Number} col The column index
+     * @return {String}
+     */
+    getColumnTooltip : function(col){
+            return this.config[col].tooltip;
+    },
+    /**
+     * Sets the tooltip for a column.
+     * @param {Number} col The column index
+     * @param {String} tooltip The new tooltip
+     */
+    setColumnTooltip : function(col, tooltip){
+            this.config[col].tooltip = tooltip;
+    },
+
+    /**
+     * Returns the dataIndex for the specified column.
+     * @param {Number} col The column index
+     * @return {Number}
+     */
+    getDataIndex : function(col){
+        return this.config[col].dataIndex;
+    },
+
+    /**
+     * Sets the dataIndex for a column.
+     * @param {Number} col The column index
+     * @param {Number} dataIndex The new dataIndex
+     */
+    setDataIndex : function(col, dataIndex){
+        this.config[col].dataIndex = dataIndex;
+    },
+
+    
+    
+    /**
+     * Returns true if the cell is editable.
+     * @param {Number} colIndex The column index
+     * @param {Number} rowIndex The row index
+     * @return {Boolean}
+     */
+    isCellEditable : function(colIndex, rowIndex){
+        return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;
+    },
+
+    /**
+     * Returns the editor defined for the cell/column.
+     * return false or null to disable editing.
+     * @param {Number} colIndex The column index
+     * @param {Number} rowIndex The row index
+     * @return {Object}
+     */
+    getCellEditor : function(colIndex, rowIndex){
+        return this.config[colIndex].editor;
+    },
+
+    /**
+     * Sets if a column is editable.
+     * @param {Number} col The column index
+     * @param {Boolean} editable True if the column is editable
+     */
+    setEditable : function(col, editable){
+        this.config[col].editable = editable;
+    },
+
+
+    /**
+     * Returns true if the column is hidden.
+     * @param {Number} colIndex The column index
+     * @return {Boolean}
+     */
+    isHidden : function(colIndex){
+        return this.config[colIndex].hidden;
+    },
+
+
+    /**
+     * Returns true if the column width cannot be changed
+     */
+    isFixed : function(colIndex){
+        return this.config[colIndex].fixed;
+    },
+
+    /**
+     * Returns true if the column can be resized
+     * @return {Boolean}
+     */
+    isResizable : function(colIndex){
+        return colIndex >= 0 && this.config[colIndex].resizable !== false && this.config[colIndex].fixed !== true;
+    },
+    /**
+     * Sets if a column is hidden.
+     * @param {Number} colIndex The column index
+     * @param {Boolean} hidden True if the column is hidden
+     */
+    setHidden : function(colIndex, hidden){
+        this.config[colIndex].hidden = hidden;
+        this.totalWidth = null;
+        this.fireEvent("hiddenchange", this, colIndex, hidden);
+    },
+
+    /**
+     * Sets the editor for a column.
+     * @param {Number} col The column index
+     * @param {Object} editor The editor object
+     */
+    setEditor : function(col, editor){
+        this.config[col].editor = editor;
+    }
+});
+
+Roo.grid.ColumnModel.defaultRenderer = function(value){
+       if(typeof value == "string" && value.length < 1){
+           return "&#160;";
+       }
+       return value;
+};
+
+// Alias for backwards compatibility
+Roo.grid.DefaultColumnModel = Roo.grid.ColumnModel;
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.grid.AbstractSelectionModel
+ * @extends Roo.util.Observable
+ * Abstract base class for grid SelectionModels.  It provides the interface that should be
+ * implemented by descendant classes.  This class should not be directly instantiated.
+ * @constructor
+ */
+Roo.grid.AbstractSelectionModel = function(){
+    this.locked = false;
+    Roo.grid.AbstractSelectionModel.superclass.constructor.call(this);
+};
+
+Roo.extend(Roo.grid.AbstractSelectionModel, Roo.util.Observable,  {
+    /** @ignore Called by the grid automatically. Do not call directly. */
+    init : function(grid){
+        this.grid = grid;
+        this.initEvents();
+    },
+
+    /**
+     * Locks the selections.
+     */
+    lock : function(){
+        this.locked = true;
+    },
+
+    /**
+     * Unlocks the selections.
+     */
+    unlock : function(){
+        this.locked = false;
+    },
+
+    /**
+     * Returns true if the selections are locked.
+     * @return {Boolean}
+     */
+    isLocked : function(){
+        return this.locked;
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @extends Roo.grid.AbstractSelectionModel
+ * @class Roo.grid.RowSelectionModel
+ * The default SelectionModel used by {@link Roo.grid.Grid}.
+ * It supports multiple selections and keyboard selection/navigation. 
+ * @constructor
+ * @param {Object} config
+ */
+Roo.grid.RowSelectionModel = function(config){
+    Roo.apply(this, config);
+    this.selections = new Roo.util.MixedCollection(false, function(o){
+        return o.id;
+    });
+
+    this.last = false;
+    this.lastActive = false;
+
+    this.addEvents({
+        /**
+            * @event selectionchange
+            * Fires when the selection changes
+            * @param {SelectionModel} this
+            */
+           "selectionchange" : true,
+        /**
+            * @event afterselectionchange
+            * Fires after the selection changes (eg. by key press or clicking)
+            * @param {SelectionModel} this
+            */
+           "afterselectionchange" : true,
+        /**
+            * @event beforerowselect
+            * Fires when a row is selected being selected, return false to cancel.
+            * @param {SelectionModel} this
+            * @param {Number} rowIndex The selected index
+            * @param {Boolean} keepExisting False if other selections will be cleared
+            */
+           "beforerowselect" : true,
+        /**
+            * @event rowselect
+            * Fires when a row is selected.
+            * @param {SelectionModel} this
+            * @param {Number} rowIndex The selected index
+            * @param {Roo.data.Record} r The record
+            */
+           "rowselect" : true,
+        /**
+            * @event rowdeselect
+            * Fires when a row is deselected.
+            * @param {SelectionModel} this
+            * @param {Number} rowIndex The selected index
+            */
+        "rowdeselect" : true
+    });
+    Roo.grid.RowSelectionModel.superclass.constructor.call(this);
+    this.locked = false;
+};
+
+Roo.extend(Roo.grid.RowSelectionModel, Roo.grid.AbstractSelectionModel,  {
+    /**
+     * @cfg {Boolean} singleSelect
+     * True to allow selection of only one row at a time (defaults to false)
+     */
+    singleSelect : false,
+
+    // private
+    initEvents : function(){
+
+        if(!this.grid.enableDragDrop && !this.grid.enableDrag){
+            this.grid.on("mousedown", this.handleMouseDown, this);
+        }else{ // allow click to work like normal
+            this.grid.on("rowclick", this.handleDragableRowClick, this);
+        }
+
+        this.rowNav = new Roo.KeyNav(this.grid.getGridEl(), {
+            "up" : function(e){
+                if(!e.shiftKey){
+                    this.selectPrevious(e.shiftKey);
+                }else if(this.last !== false && this.lastActive !== false){
+                    var last = this.last;
+                    this.selectRange(this.last,  this.lastActive-1);
+                    this.grid.getView().focusRow(this.lastActive);
+                    if(last !== false){
+                        this.last = last;
+                    }
+                }else{
+                    this.selectFirstRow();
+                }
+                this.fireEvent("afterselectionchange", this);
+            },
+            "down" : function(e){
+                if(!e.shiftKey){
+                    this.selectNext(e.shiftKey);
+                }else if(this.last !== false && this.lastActive !== false){
+                    var last = this.last;
+                    this.selectRange(this.last,  this.lastActive+1);
+                    this.grid.getView().focusRow(this.lastActive);
+                    if(last !== false){
+                        this.last = last;
+                    }
+                }else{
+                    this.selectFirstRow();
+                }
+                this.fireEvent("afterselectionchange", this);
+            },
+            scope: this
+        });
+
+        var view = this.grid.view;
+        view.on("refresh", this.onRefresh, this);
+        view.on("rowupdated", this.onRowUpdated, this);
+        view.on("rowremoved", this.onRemove, this);
+    },
+
+    // private
+    onRefresh : function(){
+        var ds = this.grid.dataSource, i, v = this.grid.view;
+        var s = this.selections;
+        s.each(function(r){
+            if((i = ds.indexOfId(r.id)) != -1){
+                v.onRowSelect(i);
+            }else{
+                s.remove(r);
+            }
+        });
+    },
+
+    // private
+    onRemove : function(v, index, r){
+        this.selections.remove(r);
+    },
+
+    // private
+    onRowUpdated : function(v, index, r){
+        if(this.isSelected(r)){
+            v.onRowSelect(index);
+        }
+    },
+
+    /**
+     * Select records.
+     * @param {Array} records The records to select
+     * @param {Boolean} keepExisting (optional) True to keep existing selections
+     */
+    selectRecords : function(records, keepExisting){
+        if(!keepExisting){
+            this.clearSelections();
+        }
+        var ds = this.grid.dataSource;
+        for(var i = 0, len = records.length; i < len; i++){
+            this.selectRow(ds.indexOf(records[i]), true);
+        }
+    },
+
+    /**
+     * Gets the number of selected rows.
+     * @return {Number}
+     */
+    getCount : function(){
+        return this.selections.length;
+    },
+
+    /**
+     * Selects the first row in the grid.
+     */
+    selectFirstRow : function(){
+        this.selectRow(0);
+    },
+
+    /**
+     * Select the last row.
+     * @param {Boolean} keepExisting (optional) True to keep existing selections
+     */
+    selectLastRow : function(keepExisting){
+        this.selectRow(this.grid.dataSource.getCount() - 1, keepExisting);
+    },
+
+    /**
+     * Selects the row immediately following the last selected row.
+     * @param {Boolean} keepExisting (optional) True to keep existing selections
+     */
+    selectNext : function(keepExisting){
+        if(this.last !== false && (this.last+1) < this.grid.dataSource.getCount()){
+            this.selectRow(this.last+1, keepExisting);
+            this.grid.getView().focusRow(this.last);
+        }
+    },
+
+    /**
+     * Selects the row that precedes the last selected row.
+     * @param {Boolean} keepExisting (optional) True to keep existing selections
+     */
+    selectPrevious : function(keepExisting){
+        if(this.last){
+            this.selectRow(this.last-1, keepExisting);
+            this.grid.getView().focusRow(this.last);
+        }
+    },
+
+    /**
+     * Returns the selected records
+     * @return {Array} Array of selected records
+     */
+    getSelections : function(){
+        return [].concat(this.selections.items);
+    },
+
+    /**
+     * Returns the first selected record.
+     * @return {Record}
+     */
+    getSelected : function(){
+        return this.selections.itemAt(0);
+    },
+
+
+    /**
+     * Clears all selections.
+     */
+    clearSelections : function(fast){
+        if(this.locked) return;
+        if(fast !== true){
+            var ds = this.grid.dataSource;
+            var s = this.selections;
+            s.each(function(r){
+                this.deselectRow(ds.indexOfId(r.id));
+            }, this);
+            s.clear();
+        }else{
+            this.selections.clear();
+        }
+        this.last = false;
+    },
+
+
+    /**
+     * Selects all rows.
+     */
+    selectAll : function(){
+        if(this.locked) return;
+        this.selections.clear();
+        for(var i = 0, len = this.grid.dataSource.getCount(); i < len; i++){
+            this.selectRow(i, true);
+        }
+    },
+
+    /**
+     * Returns True if there is a selection.
+     * @return {Boolean}
+     */
+    hasSelection : function(){
+        return this.selections.length > 0;
+    },
+
+    /**
+     * Returns True if the specified row is selected.
+     * @param {Number/Record} record The record or index of the record to check
+     * @return {Boolean}
+     */
+    isSelected : function(index){
+        var r = typeof index == "number" ? this.grid.dataSource.getAt(index) : index;
+        return (r && this.selections.key(r.id) ? true : false);
+    },
+
+    /**
+     * Returns True if the specified record id is selected.
+     * @param {String} id The id of record to check
+     * @return {Boolean}
+     */
+    isIdSelected : function(id){
+        return (this.selections.key(id) ? true : false);
+    },
+
+    // private
+    handleMouseDown : function(e, t){
+        var view = this.grid.getView(), rowIndex;
+        if(this.isLocked() || (rowIndex = view.findRowIndex(t)) === false){
+            return;
+        };
+        if(e.shiftKey && this.last !== false){
+            var last = this.last;
+            this.selectRange(last, rowIndex, e.ctrlKey);
+            this.last = last; // reset the last
+            view.focusRow(rowIndex);
+        }else{
+            var isSelected = this.isSelected(rowIndex);
+            if(e.button !== 0 && isSelected){
+                view.focusRow(rowIndex);
+            }else if(e.ctrlKey && isSelected){
+                this.deselectRow(rowIndex);
+            }else if(!isSelected){
+                this.selectRow(rowIndex, e.button === 0 && (e.ctrlKey || e.shiftKey));
+                view.focusRow(rowIndex);
+            }
+        }
+        this.fireEvent("afterselectionchange", this);
+    },
+    // private
+    handleDragableRowClick :  function(grid, rowIndex, e) 
+    {
+        if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {
+            this.selectRow(rowIndex, false);
+            grid.view.focusRow(rowIndex);
+             this.fireEvent("afterselectionchange", this);
+        }
+    },
+    
+    /**
+     * Selects multiple rows.
+     * @param {Array} rows Array of the indexes of the row to select
+     * @param {Boolean} keepExisting (optional) True to keep existing selections
+     */
+    selectRows : function(rows, keepExisting){
+        if(!keepExisting){
+            this.clearSelections();
+        }
+        for(var i = 0, len = rows.length; i < len; i++){
+            this.selectRow(rows[i], true);
+        }
+    },
+
+    /**
+     * Selects a range of rows. All rows in between startRow and endRow are also selected.
+     * @param {Number} startRow The index of the first row in the range
+     * @param {Number} endRow The index of the last row in the range
+     * @param {Boolean} keepExisting (optional) True to retain existing selections
+     */
+    selectRange : function(startRow, endRow, keepExisting){
+        if(this.locked) return;
+        if(!keepExisting){
+            this.clearSelections();
+        }
+        if(startRow <= endRow){
+            for(var i = startRow; i <= endRow; i++){
+                this.selectRow(i, true);
+            }
+        }else{
+            for(var i = startRow; i >= endRow; i--){
+                this.selectRow(i, true);
+            }
+        }
+    },
+
+    /**
+     * Deselects a range of rows. All rows in between startRow and endRow are also deselected.
+     * @param {Number} startRow The index of the first row in the range
+     * @param {Number} endRow The index of the last row in the range
+     */
+    deselectRange : function(startRow, endRow, preventViewNotify){
+        if(this.locked) return;
+        for(var i = startRow; i <= endRow; i++){
+            this.deselectRow(i, preventViewNotify);
+        }
+    },
+
+    /**
+     * Selects a row.
+     * @param {Number} row The index of the row to select
+     * @param {Boolean} keepExisting (optional) True to keep existing selections
+     */
+    selectRow : function(index, keepExisting, preventViewNotify){
+        if(this.locked || (index < 0 || index >= this.grid.dataSource.getCount())) return;
+        if(this.fireEvent("beforerowselect", this, index, keepExisting) !== false){
+            if(!keepExisting || this.singleSelect){
+                this.clearSelections();
+            }
+            var r = this.grid.dataSource.getAt(index);
+            this.selections.add(r);
+            this.last = this.lastActive = index;
+            if(!preventViewNotify){
+                this.grid.getView().onRowSelect(index);
+            }
+            this.fireEvent("rowselect", this, index, r);
+            this.fireEvent("selectionchange", this);
+        }
+    },
+
+    /**
+     * Deselects a row.
+     * @param {Number} row The index of the row to deselect
+     */
+    deselectRow : function(index, preventViewNotify){
+        if(this.locked) return;
+        if(this.last == index){
+            this.last = false;
+        }
+        if(this.lastActive == index){
+            this.lastActive = false;
+        }
+        var r = this.grid.dataSource.getAt(index);
+        this.selections.remove(r);
+        if(!preventViewNotify){
+            this.grid.getView().onRowDeselect(index);
+        }
+        this.fireEvent("rowdeselect", this, index);
+        this.fireEvent("selectionchange", this);
+    },
+
+    // private
+    restoreLast : function(){
+        if(this._last){
+            this.last = this._last;
+        }
+    },
+
+    // private
+    acceptsNav : function(row, col, cm){
+        return !cm.isHidden(col) && cm.isCellEditable(col, row);
+    },
+
+    // private
+    onEditorKey : function(field, e){
+        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
+        if(k == e.TAB){
+            e.stopEvent();
+            ed.completeEdit();
+            if(e.shiftKey){
+                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
+            }else{
+                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
+            }
+        }else if(k == e.ENTER && !e.ctrlKey){
+            e.stopEvent();
+            ed.completeEdit();
+            if(e.shiftKey){
+                newCell = g.walkCells(ed.row-1, ed.col, -1, this.acceptsNav, this);
+            }else{
+                newCell = g.walkCells(ed.row+1, ed.col, 1, this.acceptsNav, this);
+            }
+        }else if(k == e.ESC){
+            ed.cancelEdit();
+        }
+        if(newCell){
+            g.startEditing(newCell[0], newCell[1]);
+        }
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.grid.CellSelectionModel
+ * @extends Roo.grid.AbstractSelectionModel
+ * This class provides the basic implementation for cell selection in a grid.
+ * @constructor
+ * @param {Object} config The object containing the configuration of this model.
+ * @cfg {Boolean} enter_is_tab Enter behaves the same as tab. (eg. goes to next cell) default: false
+ */
+Roo.grid.CellSelectionModel = function(config){
+    Roo.apply(this, config);
+
+    this.selection = null;
+
+    this.addEvents({
+        /**
+            * @event beforerowselect
+            * Fires before a cell is selected.
+            * @param {SelectionModel} this
+            * @param {Number} rowIndex The selected row index
+            * @param {Number} colIndex The selected cell index
+            */
+           "beforecellselect" : true,
+        /**
+            * @event cellselect
+            * Fires when a cell is selected.
+            * @param {SelectionModel} this
+            * @param {Number} rowIndex The selected row index
+            * @param {Number} colIndex The selected cell index
+            */
+           "cellselect" : true,
+        /**
+            * @event selectionchange
+            * Fires when the active selection changes.
+            * @param {SelectionModel} this
+            * @param {Object} selection null for no selection or an object (o) with two properties
+               <ul>
+               <li>o.record: the record object for the row the selection is in</li>
+               <li>o.cell: An array of [rowIndex, columnIndex]</li>
+               </ul>
+            */
+           "selectionchange" : true,
+        /**
+            * @event tabend
+            * Fires when the tab (or enter) was pressed on the last editable cell
+            * You can use this to trigger add new row.
+            * @param {SelectionModel} this
+            */
+           "tabend" : true
+    });
+    Roo.grid.CellSelectionModel.superclass.constructor.call(this);
+};
+
+Roo.extend(Roo.grid.CellSelectionModel, Roo.grid.AbstractSelectionModel,  {
+    
+    enter_is_tab: false,
+
+    /** @ignore */
+    initEvents : function(){
+        this.grid.on("mousedown", this.handleMouseDown, this);
+        this.grid.getGridEl().on(Roo.isIE ? "keydown" : "keypress", this.handleKeyDown, this);
+        var view = this.grid.view;
+        view.on("refresh", this.onViewChange, this);
+        view.on("rowupdated", this.onRowUpdated, this);
+        view.on("beforerowremoved", this.clearSelections, this);
+        view.on("beforerowsinserted", this.clearSelections, this);
+        if(this.grid.isEditor){
+            this.grid.on("beforeedit", this.beforeEdit,  this);
+        }
+    },
+
+       //private
+    beforeEdit : function(e){
+        this.select(e.row, e.column, false, true, e.record);
+    },
+
+       //private
+    onRowUpdated : function(v, index, r){
+        if(this.selection && this.selection.record == r){
+            v.onCellSelect(index, this.selection.cell[1]);
+        }
+    },
+
+       //private
+    onViewChange : function(){
+        this.clearSelections(true);
+    },
+
+       /**
+        * Returns the currently selected cell,.
+        * @return {Array} The selected cell (row, column) or null if none selected.
+        */
+    getSelectedCell : function(){
+        return this.selection ? this.selection.cell : null;
+    },
+
+    /**
+     * Clears all selections.
+     * @param {Boolean} true to prevent the gridview from being notified about the change.
+     */
+    clearSelections : function(preventNotify){
+        var s = this.selection;
+        if(s){
+            if(preventNotify !== true){
+                this.grid.view.onCellDeselect(s.cell[0], s.cell[1]);
+            }
+            this.selection = null;
+            this.fireEvent("selectionchange", this, null);
+        }
+    },
+
+    /**
+     * Returns true if there is a selection.
+     * @return {Boolean}
+     */
+    hasSelection : function(){
+        return this.selection ? true : false;
+    },
+
+    /** @ignore */
+    handleMouseDown : function(e, t){
+        var v = this.grid.getView();
+        if(this.isLocked()){
+            return;
+        };
+        var row = v.findRowIndex(t);
+        var cell = v.findCellIndex(t);
+        if(row !== false && cell !== false){
+            this.select(row, cell);
+        }
+    },
+
+    /**
+     * Selects a cell.
+     * @param {Number} rowIndex
+     * @param {Number} collIndex
+     */
+    select : function(rowIndex, colIndex, preventViewNotify, preventFocus, /*internal*/ r){
+        if(this.fireEvent("beforecellselect", this, rowIndex, colIndex) !== false){
+            this.clearSelections();
+            r = r || this.grid.dataSource.getAt(rowIndex);
+            this.selection = {
+                record : r,
+                cell : [rowIndex, colIndex]
+            };
+            if(!preventViewNotify){
+                var v = this.grid.getView();
+                v.onCellSelect(rowIndex, colIndex);
+                if(preventFocus !== true){
+                    v.focusCell(rowIndex, colIndex);
+                }
+            }
+            this.fireEvent("cellselect", this, rowIndex, colIndex);
+            this.fireEvent("selectionchange", this, this.selection);
+        }
+    },
+
+       //private
+    isSelectable : function(rowIndex, colIndex, cm){
+        return !cm.isHidden(colIndex);
+    },
+
+    /** @ignore */
+    handleKeyDown : function(e){
+        //Roo.log('Cell Sel Model handleKeyDown');
+        if(!e.isNavKeyPress()){
+            return;
+        }
+        var g = this.grid, s = this.selection;
+        if(!s){
+            e.stopEvent();
+            var cell = g.walkCells(0, 0, 1, this.isSelectable,  this);
+            if(cell){
+                this.select(cell[0], cell[1]);
+            }
+            return;
+        }
+        var sm = this;
+        var walk = function(row, col, step){
+            return g.walkCells(row, col, step, sm.isSelectable,  sm);
+        };
+        var k = e.getKey(), r = s.cell[0], c = s.cell[1];
+        var newCell;
+
+      
+
+        switch(k){
+            case e.TAB:
+                // handled by onEditorKey
+                if (g.isEditor && g.editing) {
+                    return;
+                }
+                if(e.shiftKey) {
+                    newCell = walk(r, c-1, -1);
+                } else {
+                    newCell = walk(r, c+1, 1);
+                }
+                break;
+            
+            case e.DOWN:
+               newCell = walk(r+1, c, 1);
+                break;
+            
+            case e.UP:
+                newCell = walk(r-1, c, -1);
+                break;
+            
+            case e.RIGHT:
+                newCell = walk(r, c+1, 1);
+                break;
+            
+            case e.LEFT:
+                newCell = walk(r, c-1, -1);
+                break;
+            
+            case e.ENTER:
+                
+                if(g.isEditor && !g.editing){
+                   g.startEditing(r, c);
+                   e.stopEvent();
+                   return;
+                }
+                
+                
+             break;
+        };
+        if(newCell){
+            this.select(newCell[0], newCell[1]);
+            e.stopEvent();
+            
+        }
+    },
+
+    acceptsNav : function(row, col, cm){
+        return !cm.isHidden(col) && cm.isCellEditable(col, row);
+    },
+    /**
+     * Selects a cell.
+     * @param {Number} field (not used) - as it's normally used as a listener
+     * @param {Number} e - event - fake it by using
+     *
+     * var e = Roo.EventObjectImpl.prototype;
+     * e.keyCode = e.TAB
+     *
+     * 
+     */
+    onEditorKey : function(field, e){
+        
+        var k = e.getKey(),
+            newCell,
+            g = this.grid,
+            ed = g.activeEditor,
+            forward = false;
+        ///Roo.log('onEditorKey' + k);
+        
+        
+        if (this.enter_is_tab && k == e.ENTER) {
+            k = e.TAB;
+        }
+        
+        if(k == e.TAB){
+            if(e.shiftKey){
+                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
+            }else{
+                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
+                forward = true;
+            }
+            
+            e.stopEvent();
+            
+        }else if(k == e.ENTER &&  !e.ctrlKey){
+            ed.completeEdit();
+            e.stopEvent();
+            newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
+        }else if(k == e.ESC){
+            ed.cancelEdit();
+        }
+        
+        
+        if(newCell){
+            //Roo.log('next cell after edit');
+            g.startEditing.defer(100, g, [newCell[0], newCell[1]]);
+        } else if (forward) {
+            // tabbed past last
+            this.fireEvent.defer(100, this, ['tabend',this]);
+        }
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.grid.EditorGrid
+ * @extends Roo.grid.Grid
+ * Class for creating and editable grid.
+ * @param {String/HTMLElement/Roo.Element} container The element into which this grid will be rendered - 
+ * The container MUST have some type of size defined for the grid to fill. The container will be 
+ * automatically set to position relative if it isn't already.
+ * @param {Object} dataSource The data model to bind to
+ * @param {Object} colModel The column model with info about this grid's columns
+ */
+Roo.grid.EditorGrid = function(container, config){
+    Roo.grid.EditorGrid.superclass.constructor.call(this, container, config);
+    this.getGridEl().addClass("xedit-grid");
+
+    if(!this.selModel){
+        this.selModel = new Roo.grid.CellSelectionModel();
+    }
+
+    this.activeEditor = null;
+
+       this.addEvents({
+           /**
+            * @event beforeedit
+            * Fires before cell editing is triggered. The edit event object has the following properties <br />
+            * <ul style="padding:5px;padding-left:16px;">
+            * <li>grid - This grid</li>
+            * <li>record - The record being edited</li>
+            * <li>field - The field name being edited</li>
+            * <li>value - The value for the field being edited.</li>
+            * <li>row - The grid row index</li>
+            * <li>column - The grid column index</li>
+            * <li>cancel - Set this to true to cancel the edit or return false from your handler.</li>
+            * </ul>
+            * @param {Object} e An edit event (see above for description)
+            */
+           "beforeedit" : true,
+           /**
+            * @event afteredit
+            * Fires after a cell is edited. <br />
+            * <ul style="padding:5px;padding-left:16px;">
+            * <li>grid - This grid</li>
+            * <li>record - The record being edited</li>
+            * <li>field - The field name being edited</li>
+            * <li>value - The value being set</li>
+            * <li>originalValue - The original value for the field, before the edit.</li>
+            * <li>row - The grid row index</li>
+            * <li>column - The grid column index</li>
+            * </ul>
+            * @param {Object} e An edit event (see above for description)
+            */
+           "afteredit" : true,
+           /**
+            * @event validateedit
+            * Fires after a cell is edited, but before the value is set in the record. 
+         * You can use this to modify the value being set in the field, Return false
+            * to cancel the change. The edit event object has the following properties <br />
+            * <ul style="padding:5px;padding-left:16px;">
+         * <li>editor - This editor</li>
+            * <li>grid - This grid</li>
+            * <li>record - The record being edited</li>
+            * <li>field - The field name being edited</li>
+            * <li>value - The value being set</li>
+            * <li>originalValue - The original value for the field, before the edit.</li>
+            * <li>row - The grid row index</li>
+            * <li>column - The grid column index</li>
+            * <li>cancel - Set this to true to cancel the edit or return false from your handler.</li>
+            * </ul>
+            * @param {Object} e An edit event (see above for description)
+            */
+           "validateedit" : true
+       });
+    this.on("bodyscroll", this.stopEditing,  this);
+    this.on(this.clicksToEdit == 1 ? "cellclick" : "celldblclick", this.onCellDblClick,  this);
+};
+
+Roo.extend(Roo.grid.EditorGrid, Roo.grid.Grid, {
+    /**
+     * @cfg {Number} clicksToEdit
+     * The number of clicks on a cell required to display the cell's editor (defaults to 2)
+     */
+    clicksToEdit: 2,
+
+    // private
+    isEditor : true,
+    // private
+    trackMouseOver: false, // causes very odd FF errors
+
+    onCellDblClick : function(g, row, col){
+        this.startEditing(row, col);
+    },
+
+    onEditComplete : function(ed, value, startValue){
+        this.editing = false;
+        this.activeEditor = null;
+        ed.un("specialkey", this.selModel.onEditorKey, this.selModel);
+        var r = ed.record;
+        var field = this.colModel.getDataIndex(ed.col);
+        var e = {
+            grid: this,
+            record: r,
+            field: field,
+            originalValue: startValue,
+            value: value,
+            row: ed.row,
+            column: ed.col,
+            cancel:false,
+            editor: ed
+        };
+        var cell = Roo.get(this.view.getCell(ed.row,ed.col))
+        cell.show();
+          
+        if(String(value) !== String(startValue)){
+            
+            if(this.fireEvent("validateedit", e) !== false && !e.cancel){
+                r.set(field, e.value);
+                // if we are dealing with a combo box..
+                // then we also set the 'name' colum to be the displayField
+                if (ed.field.displayField && ed.field.name) {
+                    r.set(ed.field.name, ed.field.el.dom.value);
+                }
+                
+                delete e.cancel; //?? why!!!
+                this.fireEvent("afteredit", e);
+            }
+        } else {
+            this.fireEvent("afteredit", e); // always fire it!
+        }
+        this.view.focusCell(ed.row, ed.col);
+    },
+
+    /**
+     * Starts editing the specified for the specified row/column
+     * @param {Number} rowIndex
+     * @param {Number} colIndex
+     */
+    startEditing : function(row, col){
+        this.stopEditing();
+        if(this.colModel.isCellEditable(col, row)){
+            this.view.ensureVisible(row, col, true);
+          
+            var r = this.dataSource.getAt(row);
+            var field = this.colModel.getDataIndex(col);
+            var cell = Roo.get(this.view.getCell(row,col));
+            var e = {
+                grid: this,
+                record: r,
+                field: field,
+                value: r.data[field],
+                row: row,
+                column: col,
+                cancel:false 
+            };
+            if(this.fireEvent("beforeedit", e) !== false && !e.cancel){
+                this.editing = true;
+                var ed = this.colModel.getCellEditor(col, row);
+                
+                if (!ed) {
+                    return;
+                }
+                if(!ed.rendered){
+                    ed.render(ed.parentEl || document.body);
+                }
+                ed.field.reset();
+               
+                cell.hide();
+                
+                (function(){ // complex but required for focus issues in safari, ie and opera
+                    ed.row = row;
+                    ed.col = col;
+                    ed.record = r;
+                    ed.on("complete",   this.onEditComplete,        this,       {single: true});
+                    ed.on("specialkey", this.selModel.onEditorKey,  this.selModel);
+                    this.activeEditor = ed;
+                    var v = r.data[field];
+                    ed.startEdit(this.view.getCell(row, col), v);
+                    // combo's with 'displayField and name set
+                    if (ed.field.displayField && ed.field.name) {
+                        ed.field.el.dom.value = r.data[ed.field.name];
+                    }
+                    
+                    
+                }).defer(50, this);
+            }
+        }
+    },
+        
+    /**
+     * Stops any active editing
+     */
+    stopEditing : function(){
+        if(this.activeEditor){
+            this.activeEditor.completeEdit();
+        }
+        this.activeEditor = null;
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+// private - not really -- you end up using it !
+// This is a support class used internally by the Grid components
+
+/**
+ * @class Roo.grid.GridEditor
+ * @extends Roo.Editor
+ * Class for creating and editable grid elements.
+ * @param {Object} config any settings (must include field)
+ */
+Roo.grid.GridEditor = function(field, config){
+    if (!config && field.field) {
+        config = field;
+        field = Roo.factory(config.field, Roo.form);
+    }
+    Roo.grid.GridEditor.superclass.constructor.call(this, field, config);
+    field.monitorTab = false;
+};
+
+Roo.extend(Roo.grid.GridEditor, Roo.Editor, {
+    
+    /**
+     * @cfg {Roo.form.Field} field Field to wrap (or xtyped)
+     */
+    
+    alignment: "tl-tl",
+    autoSize: "width",
+    hideEl : false,
+    cls: "x-small-editor x-grid-editor",
+    shim:false,
+    shadow:"frame"
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+  
+
+  
+Roo.grid.PropertyRecord = Roo.data.Record.create([
+    {name:'name',type:'string'},  'value'
+]);
+
+
+Roo.grid.PropertyStore = function(grid, source){
+    this.grid = grid;
+    this.store = new Roo.data.Store({
+        recordType : Roo.grid.PropertyRecord
+    });
+    this.store.on('update', this.onUpdate,  this);
+    if(source){
+        this.setSource(source);
+    }
+    Roo.grid.PropertyStore.superclass.constructor.call(this);
+};
+
+
+
+Roo.extend(Roo.grid.PropertyStore, Roo.util.Observable, {
+    setSource : function(o){
+        this.source = o;
+        this.store.removeAll();
+        var data = [];
+        for(var k in o){
+            if(this.isEditableValue(o[k])){
+                data.push(new Roo.grid.PropertyRecord({name: k, value: o[k]}, k));
+            }
+        }
+        this.store.loadRecords({records: data}, {}, true);
+    },
+
+    onUpdate : function(ds, record, type){
+        if(type == Roo.data.Record.EDIT){
+            var v = record.data['value'];
+            var oldValue = record.modified['value'];
+            if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !== false){
+                this.source[record.id] = v;
+                record.commit();
+                this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue);
+            }else{
+                record.reject();
+            }
+        }
+    },
+
+    getProperty : function(row){
+       return this.store.getAt(row);
+    },
+
+    isEditableValue: function(val){
+        if(val && val instanceof Date){
+            return true;
+        }else if(typeof val == 'object' || typeof val == 'function'){
+            return false;
+        }
+        return true;
+    },
+
+    setValue : function(prop, value){
+        this.source[prop] = value;
+        this.store.getById(prop).set('value', value);
+    },
+
+    getSource : function(){
+        return this.source;
+    }
+});
+
+Roo.grid.PropertyColumnModel = function(grid, store){
+    this.grid = grid;
+    var g = Roo.grid;
+    g.PropertyColumnModel.superclass.constructor.call(this, [
+        {header: this.nameText, sortable: true, dataIndex:'name', id: 'name'},
+        {header: this.valueText, resizable:false, dataIndex: 'value', id: 'value'}
+    ]);
+    this.store = store;
+    this.bselect = Roo.DomHelper.append(document.body, {
+        tag: 'select', style:'display:none', cls: 'x-grid-editor', children: [
+            {tag: 'option', value: 'true', html: 'true'},
+            {tag: 'option', value: 'false', html: 'false'}
+        ]
+    });
+    Roo.id(this.bselect);
+    var f = Roo.form;
+    this.editors = {
+        'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),
+        'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),
+        'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),
+        'int' : new g.GridEditor(new f.NumberField({selectOnFocus:true, allowDecimals:false, style:'text-align:left;'})),
+        'boolean' : new g.GridEditor(new f.Field({el:this.bselect,selectOnFocus:true}))
+    };
+    this.renderCellDelegate = this.renderCell.createDelegate(this);
+    this.renderPropDelegate = this.renderProp.createDelegate(this);
+};
+
+Roo.extend(Roo.grid.PropertyColumnModel, Roo.grid.ColumnModel, {
+    
+    
+    nameText : 'Name',
+    valueText : 'Value',
+    
+    dateFormat : 'm/j/Y',
+    
+    
+    renderDate : function(dateVal){
+        return dateVal.dateFormat(this.dateFormat);
+    },
+
+    renderBool : function(bVal){
+        return bVal ? 'true' : 'false';
+    },
+
+    isCellEditable : function(colIndex, rowIndex){
+        return colIndex == 1;
+    },
+
+    getRenderer : function(col){
+        return col == 1 ?
+            this.renderCellDelegate : this.renderPropDelegate;
+    },
+
+    renderProp : function(v){
+        return this.getPropertyName(v);
+    },
+
+    renderCell : function(val){
+        var rv = val;
+        if(val instanceof Date){
+            rv = this.renderDate(val);
+        }else if(typeof val == 'boolean'){
+            rv = this.renderBool(val);
+        }
+        return Roo.util.Format.htmlEncode(rv);
+    },
+
+    getPropertyName : function(name){
+        var pn = this.grid.propertyNames;
+        return pn && pn[name] ? pn[name] : name;
+    },
+
+    getCellEditor : function(colIndex, rowIndex){
+        var p = this.store.getProperty(rowIndex);
+        var n = p.data['name'], val = p.data['value'];
+        
+        if(typeof(this.grid.customEditors[n]) == 'string'){
+            return this.editors[this.grid.customEditors[n]];
+        }
+        if(typeof(this.grid.customEditors[n]) != 'undefined'){
+            return this.grid.customEditors[n];
+        }
+        if(val instanceof Date){
+            return this.editors['date'];
+        }else if(typeof val == 'number'){
+            return this.editors['number'];
+        }else if(typeof val == 'boolean'){
+            return this.editors['boolean'];
+        }else{
+            return this.editors['string'];
+        }
+    }
+});
+
+/**
+ * @class Roo.grid.PropertyGrid
+ * @extends Roo.grid.EditorGrid
+ * This class represents the  interface of a component based property grid control.
+ * <br><br>Usage:<pre><code>
+ var grid = new Roo.grid.PropertyGrid("my-container-id", {
+      
+ });
+ // set any options
+ grid.render();
+ * </code></pre>
+  
+ * @constructor
+ * @param {String/HTMLElement/Roo.Element} container The element into which this grid will be rendered -
+ * The container MUST have some type of size defined for the grid to fill. The container will be
+ * automatically set to position relative if it isn't already.
+ * @param {Object} config A config object that sets properties on this grid.
+ */
+Roo.grid.PropertyGrid = function(container, config){
+    config = config || {};
+    var store = new Roo.grid.PropertyStore(this);
+    this.store = store;
+    var cm = new Roo.grid.PropertyColumnModel(this, store);
+    store.store.sort('name', 'ASC');
+    Roo.grid.PropertyGrid.superclass.constructor.call(this, container, Roo.apply({
+        ds: store.store,
+        cm: cm,
+        enableColLock:false,
+        enableColumnMove:false,
+        stripeRows:false,
+        trackMouseOver: false,
+        clicksToEdit:1
+    }, config));
+    this.getGridEl().addClass('x-props-grid');
+    this.lastEditRow = null;
+    this.on('columnresize', this.onColumnResize, this);
+    this.addEvents({
+         /**
+            * @event beforepropertychange
+            * Fires before a property changes (return false to stop?)
+            * @param {Roo.grid.PropertyGrid} grid property grid? (check could be store)
+            * @param {String} id Record Id
+            * @param {String} newval New Value
+         * @param {String} oldval Old Value
+            */
+        "beforepropertychange": true,
+        /**
+            * @event propertychange
+            * Fires after a property changes
+            * @param {Roo.grid.PropertyGrid} grid property grid? (check could be store)
+            * @param {String} id Record Id
+            * @param {String} newval New Value
+         * @param {String} oldval Old Value
+            */
+        "propertychange": true
+    });
+    this.customEditors = this.customEditors || {};
+};
+Roo.extend(Roo.grid.PropertyGrid, Roo.grid.EditorGrid, {
+    
+     /**
+     * @cfg {Object} customEditors map of colnames=> custom editors.
+     * the custom editor can be one of the standard ones (date|string|number|int|boolean), or a
+     * grid editor eg. Roo.grid.GridEditor(new Roo.form.TextArea({selectOnFocus:true})),
+     * false disables editing of the field.
+        */
+    
+      /**
+     * @cfg {Object} propertyNames map of property Names to their displayed value
+        */
+    
+    render : function(){
+        Roo.grid.PropertyGrid.superclass.render.call(this);
+        this.autoSize.defer(100, this);
+    },
+
+    autoSize : function(){
+        Roo.grid.PropertyGrid.superclass.autoSize.call(this);
+        if(this.view){
+            this.view.fitColumns();
+        }
+    },
+
+    onColumnResize : function(){
+        this.colModel.setColumnWidth(1, this.container.getWidth(true)-this.colModel.getColumnWidth(0));
+        this.autoSize();
+    },
+    /**
+     * Sets the data for the Grid
+     * accepts a Key => Value object of all the elements avaiable.
+     * @param {Object} data  to appear in grid.
+     */
+    setSource : function(source){
+        this.store.setSource(source);
+        //this.autoSize();
+    },
+    /**
+     * Gets all the data from the grid.
+     * @return {Object} data  data stored in grid
+     */
+    getSource : function(){
+        return this.store.getSource();
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.LoadMask
+ * A simple utility class for generically masking elements while loading data.  If the element being masked has
+ * an underlying {@link Roo.data.Store}, the masking will be automatically synchronized with the store's loading
+ * process and the mask element will be cached for reuse.  For all other elements, this mask will replace the
+ * element's UpdateManager load indicator and will be destroyed after the initial load.
+ * @constructor
+ * Create a new LoadMask
+ * @param {String/HTMLElement/Roo.Element} el The element or DOM node, or its id
+ * @param {Object} config The config object
+ */
+Roo.LoadMask = function(el, config){
+    this.el = Roo.get(el);
+    Roo.apply(this, config);
+    if(this.store){
+        this.store.on('beforeload', this.onBeforeLoad, this);
+        this.store.on('load', this.onLoad, this);
+        this.store.on('loadexception', this.onLoadException, this);
+        this.removeMask = false;
+    }else{
+        var um = this.el.getUpdateManager();
+        um.showLoadIndicator = false; // disable the default indicator
+        um.on('beforeupdate', this.onBeforeLoad, this);
+        um.on('update', this.onLoad, this);
+        um.on('failure', this.onLoad, this);
+        this.removeMask = true;
+    }
+};
+
+Roo.LoadMask.prototype = {
+    /**
+     * @cfg {Boolean} removeMask
+     * True to create a single-use mask that is automatically destroyed after loading (useful for page loads),
+     * False to persist the mask element reference for multiple uses (e.g., for paged data widgets).  Defaults to false.
+     */
+    /**
+     * @cfg {String} msg
+     * The text to display in a centered loading message box (defaults to 'Loading...')
+     */
+    msg : 'Loading...',
+    /**
+     * @cfg {String} msgCls
+     * The CSS class to apply to the loading message element (defaults to "x-mask-loading")
+     */
+    msgCls : 'x-mask-loading',
+
+    /**
+     * Read-only. True if the mask is currently disabled so that it will not be displayed (defaults to false)
+     * @type Boolean
+     */
+    disabled: false,
+
+    /**
+     * Disables the mask to prevent it from being displayed
+     */
+    disable : function(){
+       this.disabled = true;
+    },
+
+    /**
+     * Enables the mask so that it can be displayed
+     */
+    enable : function(){
+        this.disabled = false;
+    },
+    
+    onLoadException : function()
+    {
+        if (this.store && typeof(this.store.reader.jsonData.errorMsg) != 'undefined') {
+            Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg);
+        }
+        this.el.unmask(this.removeMask);
+    },
+    // private
+    onLoad : function()
+    {
+        this.el.unmask(this.removeMask);
+    },
+
+    // private
+    onBeforeLoad : function(){
+        if(!this.disabled){
+            this.el.mask(this.msg, this.msgCls);
+        }
+    },
+
+    // private
+    destroy : function(){
+        if(this.store){
+            this.store.un('beforeload', this.onBeforeLoad, this);
+            this.store.un('load', this.onLoad, this);
+            this.store.un('loadexception', this.onLoadException, this);
+        }else{
+            var um = this.el.getUpdateManager();
+            um.un('beforeupdate', this.onBeforeLoad, this);
+            um.un('update', this.onLoad, this);
+            um.un('failure', this.onLoad, this);
+        }
+    }
+};/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+Roo.XTemplate = function(){
+    Roo.XTemplate.superclass.constructor.apply(this, arguments);
+    var s = this.html;
+
+    s = ['<tpl>', s, '</tpl>'].join('');
+
+    var re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;
+
+    var nameRe = /^<tpl\b[^>]*?for="(.*?)"/;
+    var ifRe = /^<tpl\b[^>]*?if="(.*?)"/;
+    var execRe = /^<tpl\b[^>]*?exec="(.*?)"/;
+    var m, id = 0;
+    var tpls = [];
+
+    while(m = s.match(re)){
+       var m2 = m[0].match(nameRe);
+       var m3 = m[0].match(ifRe);
+       var m4 = m[0].match(execRe);
+       var exp = null, fn = null, exec = null;
+       var name = m2 && m2[1] ? m2[1] : '';
+       if(m3){
+           exp = m3 && m3[1] ? m3[1] : null;
+           if(exp){
+               fn = new Function('values', 'parent', 'with(values){ return '+(Roo.util.Format.htmlDecode(exp))+'; }');
+           }
+       }
+       if(m4){
+           exp = m4 && m4[1] ? m4[1] : null;
+           if(exp){
+               exec = new Function('values', 'parent', 'with(values){ '+(Roo.util.Format.htmlDecode(exp))+'; }');
+           }
+       }
+       if(name){
+           switch(name){
+               case '.': name = new Function('values', 'parent', 'with(values){ return values; }'); break;
+               case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break;
+               default: name = new Function('values', 'parent', 'with(values){ return '+name+'; }');
+           }
+       }
+       tpls.push({
+            id: id,
+            target: name,
+            exec: exec,
+            test: fn,
+            body: m[1]||''
+        });
+       s = s.replace(m[0], '{xtpl'+ id + '}');
+       ++id;
+    }
+    for(var i = tpls.length-1; i >= 0; --i){
+        this.compileTpl(tpls[i]);
+    }
+    this.master = tpls[tpls.length-1];
+    this.tpls = tpls;
+};
+Roo.extend(Roo.XTemplate, Roo.Template, {
+
+    re : /\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
+
+    applySubTemplate : function(id, values, parent){
+        var t = this.tpls[id];
+        if(t.test && !t.test.call(this, values, parent)){
+            return '';
+        }
+        if(t.exec && t.exec.call(this, values, parent)){
+            return '';
+        }
+        var vs = t.target ? t.target.call(this, values, parent) : values;
+        parent = t.target ? values : parent;
+        if(t.target && vs instanceof Array){
+            var buf = [];
+            for(var i = 0, len = vs.length; i < len; i++){
+                buf[buf.length] = t.compiled.call(this, vs[i], parent);
+            }
+            return buf.join('');
+        }
+        return t.compiled.call(this, vs, parent);
+    },
+
+    compileTpl : function(tpl){
+        var fm = Roo.util.Format;
+        var useF = this.disableFormats !== true;
+        var sep = Roo.isGecko ? "+" : ",";
+        var fn = function(m, name, format, args){
+            if(name.substr(0, 4) == 'xtpl'){
+                return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent)'+sep+"'";
+            }
+            var v;
+            if(name.indexOf('.') != -1){
+                v = name;
+            }else{
+                v = "values['" + name + "']";
+            }
+            if(format && useF){
+                args = args ? ',' + args : "";
+                if(format.substr(0, 5) != "this."){
+                    format = "fm." + format + '(';
+                }else{
+                    format = 'this.call("'+ format.substr(5) + '", ';
+                    args = ", values";
+                }
+            }else{
+                args= ''; format = "("+v+" === undefined ? '' : ";
+            }
+            return "'"+ sep + format + v + args + ")"+sep+"'";
+        };
+        var body;
+        // branched to use + in gecko and [].join() in others
+        if(Roo.isGecko){
+            body = "tpl.compiled = function(values, parent){ return '" +
+                   tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
+                    "';};";
+        }else{
+            body = ["tpl.compiled = function(values, parent){ return ['"];
+            body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
+            body.push("'].join('');};");
+            body = body.join('');
+        }
+        /** eval:var:zzzzzzz */
+        eval(body);
+        return this;
+    },
+
+    applyTemplate : function(values){
+        return this.master.compiled.call(this, values, {});
+        var s = this.subs;
+    },
+
+    apply : function(){
+        return this.applyTemplate.apply(this, arguments);
+    },
+
+    compile : function(){return this;}
+});
+
+Roo.XTemplate.from = function(el){
+    el = Roo.getDom(el);
+    return new Roo.XTemplate(el.value || el.innerHTML);
+};/*
+ * Original code for Roojs - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.XComponent
+ * A delayed Element creator...
+ * Or a way to group chunks of interface together.
+ * 
+ * Mypart.xyx = new Roo.XComponent({
+
+    parent : 'Mypart.xyz', // empty == document.element.!!
+    order : '001',
+    name : 'xxxx'
+    region : 'xxxx'
+    disabled : function() {} 
+     
+    tree : function() { // return an tree of xtype declared components
+        var MODULE = this;
+        return 
+        {
+            xtype : 'NestedLayoutPanel',
+            // technicall
+        }
+     ]
+ *})
+ *
+ *
+ * It can be used to build a big heiracy, with parent etc.
+ * or you can just use this to render a single compoent to a dom element
+ * MYPART.render(Roo.Element | String(id) | dom_element )
+ * 
+ * @extends Roo.util.Observable
+ * @constructor
+ * @param cfg {Object} configuration of component
+ * 
+ */
+Roo.XComponent = function(cfg) {
+    Roo.apply(this, cfg);
+    this.addEvents({ 
+        /**
+            * @event built
+            * Fires when this the componnt is built
+            * @param {Roo.XComponent} c the component
+            */
+        'built' : true,
+        /**
+            * @event buildcomplete
+            * Fires on the top level element when all elements have been built
+            * @param {Roo.XComponent} c the top level component.
+         */
+        'buildcomplete' : true
+        
+    });
+    this.region = this.region || 'center'; // default..
+    Roo.XComponent.register(this);
+    this.modules = false;
+    this.el = false; // where the layout goes..
+    
+    
+}
+Roo.extend(Roo.XComponent, Roo.util.Observable, {
+    /**
+     * @property el
+     * The created element (with Roo.factory())
+     * @type {Roo.Layout}
+     */
+    el  : false,
+    
+    /**
+     * @property el
+     * for BC  - use el in new code
+     * @type {Roo.Layout}
+     */
+    panel : false,
+    
+    /**
+     * @property layout
+     * for BC  - use el in new code
+     * @type {Roo.Layout}
+     */
+    layout : false,
+    
+     /**
+     * @cfg {Function|boolean} disabled
+     * If this module is disabled by some rule, return true from the funtion
+     */
+    disabled : false,
+    
+    /**
+     * @cfg {String} parent 
+     * Name of parent element which it get xtype added to..
+     */
+    parent: false,
+    
+    /**
+     * @cfg {String} order
+     * Used to set the order in which elements are created (usefull for multiple tabs)
+     */
+    
+    order : false,
+    /**
+     * @cfg {String} name
+     * String to display while loading.
+     */
+    name : false,
+    /**
+     * @cfg {String} region
+     * Region to render component to (defaults to center)
+     */
+    region : 'center',
+    
+    /**
+     * @cfg {Array} items
+     * A single item array - the first element is the root of the tree..
+     * It's done this way to stay compatible with the Xtype system...
+     */
+    items : false,
+    
+    
+     /**
+     * render
+     * render element to dom or tree
+     * @param {Roo.Element|String|DomElement} optional render to if parent is not set.
+     */
+    
+    render : function(el)
+    {
+        
+        el = el || false;
+        var hp = this.parent ? 1 : 0;
+        
+        if (!el && typeof(this.parent) == 'string' && this.parent.substring(0,1) == '#') {
+            // if parent is a '#.....' string, then let's use that..
+            var ename = this.parent.substr(1)
+            this.parent = false;
+            el = Roo.get(ename);
+            if (!el) {
+                Roo.log("Warning - element can not be found :#" + ename );
+                return;
+            }
+        }
+        
+        
+        if (!this.parent) {
+            
+            el = el ? Roo.get(el) : false;
+            
+            // it's a top level one..
+            this.parent =  {
+                el : new Roo.BorderLayout(el || document.body, {
+                
+                     center: {
+                         titlebar: false,
+                         autoScroll:false,
+                         closeOnTab: true,
+                         tabPosition: 'top',
+                          //resizeTabs: true,
+                         alwaysShowTabs: el && hp? false :  true,
+                         hideTabs: el || !hp ? true :  false,
+                         minTabWidth: 140
+                     }
+                 })
+            }
+        }
+        
+        
+            
+        var tree = this.tree();
+        tree.region = tree.region || this.region;
+        this.el = this.parent.el.addxtype(tree);
+        this.fireEvent('built', this);
+        
+        this.panel = this.el;
+        this.layout = this.panel.layout;    
+         
+    }
+    
+});
+
+Roo.apply(Roo.XComponent, {
+    
+    /**
+     * @property  buildCompleted
+     * True when the builder has completed building the interface.
+     * @type Boolean
+     */
+    buildCompleted : false,
+     
+    /**
+     * @property  topModule
+     * the upper most module - uses document.element as it's constructor.
+     * @type Object
+     */
+     
+    topModule  : false,
+      
+    /**
+     * @property  modules
+     * array of modules to be created by registration system.
+     * @type {Array} of Roo.XComponent
+     */
+    
+    modules : [],
+    /**
+     * @property  elmodules
+     * array of modules to be created by which use #ID 
+     * @type {Array} of Roo.XComponent
+     */
+     
+    elmodules : [],
+
+    
+    /**
+     * Register components to be built later.
+     *
+     * This solves the following issues
+     * - Building is not done on page load, but after an authentication process has occured.
+     * - Interface elements are registered on page load
+     * - Parent Interface elements may not be loaded before child, so this handles that..
+     * 
+     *
+     * example:
+     * 
+     * MyApp.register({
+          order : '000001',
+          module : 'Pman.Tab.projectMgr',
+          region : 'center',
+          parent : 'Pman.layout',
+          disabled : false,  // or use a function..
+        })
+     
+     * * @param {Object} details about module
+     */
+    register : function(obj) {
+        this.modules.push(obj);
+         
+    },
+    /**
+     * convert a string to an object..
+     * eg. 'AAA.BBB' -> finds AAA.BBB
+
+     */
+    
+    toObject : function(str)
+    {
+        if (!str || typeof(str) == 'object') {
+            return str;
+        }
+        if (str.substring(0,1) == '#') {
+            return str;
+        }
+
+        var ar = str.split('.');
+        var rt, o;
+        rt = ar.shift();
+            /** eval:var:o */
+        try {
+            eval('if (typeof ' + rt + ' == "undefined"){ o = false;} o = ' + rt + ';');
+        } catch (e) {
+            throw "Module not found : " + str;
+        }
+        
+        if (o === false) {
+            throw "Module not found : " + str;
+        }
+        Roo.each(ar, function(e) {
+            if (typeof(o[e]) == 'undefined') {
+                throw "Module not found : " + str;
+            }
+            o = o[e];
+        });
+        
+        return o;
+        
+    },
+    
+    
+    /**
+     * move modules into their correct place in the tree..
+     * 
+     */
+    preBuild : function ()
+    {
+        var _t = this;
+        Roo.each(this.modules , function (obj)
+        {
+            var opar = obj.parent;
+            try { 
+                obj.parent = this.toObject(opar);
+            } catch(e) {
+                Roo.log(e.toString());
+                return;
+            }
+            
+            if (!obj.parent) {
+                this.topModule = obj;
+                return;
+            }
+            if (typeof(obj.parent) == 'string') {
+                this.elmodules.push(obj);
+                return;
+            }
+            if (obj.parent.constructor != Roo.XComponent) {
+                Roo.log("Object Parent is not instance of XComponent:" + obj.name)
+            }
+            if (!obj.parent.modules) {
+                obj.parent.modules = new Roo.util.MixedCollection(false, 
+                    function(o) { return o.order + '' }
+                );
+            }
+            
+            obj.parent.modules.add(obj);
+        }, this);
+    },
+    
+     /**
+     * make a list of modules to build.
+     * @return {Array} list of modules. 
+     */ 
+    
+    buildOrder : function()
+    {
+        var _this = this;
+        var cmp = function(a,b) {   
+            return String(a).toUpperCase() > String(b).toUpperCase() ? 1 : -1;
+        };
+        if ((!this.topModule || !this.topModule.modules) && !this.elmodules.length) {
+            throw "No top level modules to build";
+        }
+        
+        // make a flat list in order of modules to build.
+        var mods = this.topModule ? [ this.topModule ] : [];
+        Roo.each(this.elmodules,function(e) { mods.push(e) });
+
+        
+        // add modules to their parents..
+        var addMod = function(m) {
+           // Roo.debug && Roo.log(m.modKey);
+            
+            mods.push(m);
+            if (m.modules) {
+                m.modules.keySort('ASC',  cmp );
+                m.modules.each(addMod);
+            }
+            // not sure if this is used any more..
+            if (m.finalize) {
+                m.finalize.name = m.name + " (clean up) ";
+                mods.push(m.finalize);
+            }
+            
+        }
+        if (this.topModule) { 
+            this.topModule.modules.keySort('ASC',  cmp );
+            this.topModule.modules.each(addMod);
+        }
+        return mods;
+    },
+    
+     /**
+     * Build the registered modules.
+     * @param {Object} parent element.
+     * @param {Function} optional method to call after module has been added.
+     * 
+     */ 
+   
+    build : function() 
+    {
+        
+        this.preBuild();
+        var mods = this.buildOrder();
+      
+        //this.allmods = mods;
+        //Roo.debug && Roo.log(mods);
+        //return;
+        if (!mods.length) { // should not happen
+            throw "NO modules!!!";
+        }
+        
+        
+        
+        // flash it up as modal - so we store the mask!?
+        Roo.MessageBox.show({ title: 'loading' });
+        Roo.MessageBox.show({
+           title: "Please wait...",
+           msg: "Building Interface...",
+           width:450,
+           progress:true,
+           closable:false,
+           modal: false
+          
+        });
+        var total = mods.length;
+        
+        var _this = this;
+        var progressRun = function() {
+            if (!mods.length) {
+                Roo.debug && Roo.log('hide?');
+                Roo.MessageBox.hide();
+                if (_this.topModule) { 
+                    _this.topModule.fireEvent('buildcomplete', _this.topModule);
+                }
+                // THE END...
+                return false;   
+            }
+            
+            var m = mods.shift();
+            
+            
+            Roo.debug && Roo.log(m);
+            // not sure if this is supported any more.. - modules that are are just function
+            if (typeof(m) == 'function') { 
+                m.call(this);
+                return progressRun.defer(10, _this);
+            } 
+            
+            
+            
+            Roo.MessageBox.updateProgress(
+                (total  - mods.length)/total,  "Building Interface " + (total  - mods.length) + 
+                    " of " + total + 
+                    (m.name ? (' - ' + m.name) : '')
+                    );
+            
+         
+            // is the module disabled?
+            var disabled = (typeof(m.disabled) == 'function') ?
+                m.disabled.call(m.module.disabled) : m.disabled;    
+            
+            
+            if (disabled) {
+                return progressRun(); // we do not update the display!
+            }
+            
+            // now build 
+            
+            m.render();
+            // it's 10 on top level, and 1 on others??? why...
+            return progressRun.defer(10, _this);
+             
+        }
+        progressRun.defer(1, _this);
+     
+        
+        
+    }
+    
+     
+   
+    
+    
+});
+ //<script type="text/javascript">
+
+
+/**
+ * @class Roo.Login
+ * @extends Roo.LayoutDialog
+ * A generic Login Dialog..... - only one needed in theory!?!?
+ *
+ * Fires XComponent builder on success...
+ * 
+ * Sends 
+ *    username,password, lang = for login actions.
+ *    check = 1 for periodic checking that sesion is valid.
+ *    passwordRequest = email request password
+ *    logout = 1 = to logout
+ * 
+ * Affects: (this id="????" elements)
+ *   loading  (removed) (used to indicate application is loading)
+ *   loading-mask (hides) (used to hide application when it's building loading)
+ *   
+ * 
+ * Usage: 
+ *    
+ * 
+ * Myapp.login = Roo.Login({
+     url: xxxx,
+   
+     realm : 'Myapp', 
+     
+     
+     method : 'POST',
+     
+     
+     * 
+ })
+ * 
+ * 
+ * 
+ **/
+Roo.Login = function(cfg)
+{
+    this.addEvents({
+        'refreshed' : true
+    });
+    
+    Roo.apply(this,cfg);
+    
+    Roo.onReady(function() {
+        this.onLoad();
+    }, this);
+    // call parent..
+    
+   
+    Roo.Login.superclass.constructor.call(this, this);
+    //this.addxtype(this.items[0]);
+    
+    
+}
+
+
+Roo.extend(Roo.Login, Roo.LayoutDialog, {
+    
+    /**
+     * @cfg {String} method
+     * Method used to query for login details.
+     */
+    
+    method : 'POST',
+    /**
+     * @cfg {String} url
+     * URL to query login data. - eg. baseURL + '/Login.php'
+     */
+    url : '',
+    
+    /**
+     * @property user
+     * The user data - if user.id < 0 then login will be bypassed. (used for inital setup situation.
+     * @type {Object} 
+     */
+    user : false,
+    /**
+     * @property checkFails
+     * Number of times we have attempted to get authentication check, and failed.
+     * @type {Number} 
+     */
+    checkFails : 0,
+      /**
+     * @property intervalID
+     * The window interval that does the constant login checking.
+     * @type {Number} 
+     */
+    intervalID : 0,
+    
+    
+    onLoad : function() // called on page load...
+    {
+        // load 
+         
+        if (Roo.get('loading')) { // clear any loading indicator..
+            Roo.get('loading').remove();
+        }
+        
+        //this.switchLang('en'); // set the language to english..
+       
+        this.check({
+            success:  function(response, opts)  {  // check successfull...
+            
+                var res = this.processResponse(response);
+                this.checkFails =0;
+                if (!res.success) { // error!
+                    this.checkFails = 5;
+                    //console.log('call failure');
+                    return this.failure(response,opts);
+                }
+                
+                if (!res.data.id) { // id=0 == login failure.
+                    return this.show();
+                }
+                
+                              
+                        //console.log(success);
+                this.fillAuth(res.data);   
+                this.checkFails =0;
+                Roo.XComponent.build();
+            },
+            failure : this.show
+        });
+        
+    }, 
+    
+    
+    check: function(cfg) // called every so often to refresh cookie etc..
+    {
+        if (cfg.again) { // could be undefined..
+            this.checkFails++;
+        } else {
+            this.checkFails = 0;
+        }
+        var _this = this;
+        if (this.sending) {
+            if ( this.checkFails > 4) {
+                Roo.MessageBox.alert("Error",  
+                    "Error getting authentication status. - try reloading, or wait a while", function() {
+                        _this.sending = false;
+                    }); 
+                return;
+            }
+            cfg.again = true;
+            _this.check.defer(10000, _this, [ cfg ]); // check in 10 secs.
+            return;
+        }
+        this.sending = true;
+        
+        Roo.Ajax.request({  
+            url: this.url,
+            params: {
+                getAuthUser: true
+            },  
+            method: this.method,
+            success:  cfg.success || this.success,
+            failure : cfg.failure || this.failure,
+            scope : this,
+            callCfg : cfg
+              
+        });  
+    }, 
+    
+    
+    logout: function()
+    {
+        window.onbeforeunload = function() { }; // false does not work for IE..
+        this.user = false;
+        var _this = this;
+        
+        Roo.Ajax.request({  
+            url: this.url,
+            params: {
+                logout: 1
+            },  
+            method: 'GET',
+            failure : function() {
+                Roo.MessageBox.alert("Error", "Error logging out. - continuing anyway.", function() {
+                    document.location = document.location.toString() + '?ts=' + Math.random();
+                });
+                
+            },
+            success : function() {
+                _this.user = false;
+                this.checkFails =0;
+                // fixme..
+                document.location = document.location.toString() + '?ts=' + Math.random();
+            }
+              
+              
+        }); 
+    },
+    
+    processResponse : function (response)
+    {
+        var res = '';
+        try {
+            res = Roo.decode(response.responseText);
+            // oops...
+            if (typeof(res) != 'object') {
+                res = { success : false, errorMsg : res, errors : true };
+            }
+            if (typeof(res.success) == 'undefined') {
+                res.success = false;
+            }
+            
+        } catch(e) {
+            res = { success : false,  errorMsg : response.responseText, errors : true };
+        }
+        return res;
+    },
+    
+    success : function(response, opts)  // check successfull...
+    {  
+        this.sending = false;
+        var res = this.processResponse(response);
+        if (!res.success) {
+            return this.failure(response, opts);
+        }
+        if (!res.data || !res.data.id) {
+            return this.failure(response,opts);
+        }
+        //console.log(res);
+        this.fillAuth(res.data);
+        
+        this.checkFails =0;
+        
+    },
+    
+    
+    failure : function (response, opts) // called if login 'check' fails.. (causes re-check)
+    {
+        this.authUser = -1;
+        this.sending = false;
+        var res = this.processResponse(response);
+        //console.log(res);
+        if ( this.checkFails > 2) {
+        
+            Roo.MessageBox.alert("Error", res.errorMsg ? res.errorMsg : 
+                "Error getting authentication status. - try reloading"); 
+            return;
+        }
+        opts.callCfg.again = true;
+        this.check.defer(1000, this, [ opts.callCfg ]);
+        return;  
+    },
+    
+    
+    
+    fillAuth: function(au) {
+        this.startAuthCheck();
+        this.authUserId = au.id;
+        this.authUser = au;
+        this.lastChecked = new Date();
+        this.fireEvent('refreshed', au);
+        //Pman.Tab.FaxQueue.newMaxId(au.faxMax);
+        //Pman.Tab.FaxTab.setTitle(au.faxNumPending);
+        au.lang = au.lang || 'en';
+        //this.switchLang(Roo.state.Manager.get('Pman.Login.lang', 'en'));
+        Roo.state.Manager.set( this.realm + 'lang' , au.lang);
+        this.switchLang(au.lang );
+        
+     
+        // open system... - -on setyp..
+        if (this.authUserId  < 0) {
+            Roo.MessageBox.alert("Warning", 
+                "This is an open system - please set up a admin user with a password.");  
+        }
+         
+        //Pman.onload(); // which should do nothing if it's a re-auth result...
+        
+             
+    },
+    
+    startAuthCheck : function() // starter for timeout checking..
+    {
+        if (this.intervalID) { // timer already in place...
+            return false;
+        }
+        var _this = this;
+        this.intervalID =  window.setInterval(function() {
+              _this.check(false);
+            }, 120000); // every 120 secs = 2mins..
+        
+        
+    },
+         
+    
+    switchLang : function (lang) 
+    {
+        _T = typeof(_T) == 'undefined' ? false : _T;
+          if (!_T || !lang.length) {
+            return;
+        }
+        
+        if (!_T && lang != 'en') {
+            Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')');
+            return;
+        }
+        
+        if (typeof(_T.en) == 'undefined') {
+            _T.en = {};
+            Roo.apply(_T.en, _T);
+        }
+        
+        if (typeof(_T[lang]) == 'undefined') {
+            Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')');
+            return;
+        }
+        
+        
+        Roo.apply(_T, _T[lang]);
+        // just need to set the text values for everything...
+        var _this = this;
+        /* this will not work ...
+        if (this.form) { 
+            
+               
+            function formLabel(name, val) {
+                _this.form.findField(name).fieldEl.child('label').dom.innerHTML  = val;
+            }
+            
+            formLabel('password', "Password"+':');
+            formLabel('username', "Email Address"+':');
+            formLabel('lang', "Language"+':');
+            this.dialog.setTitle("Login");
+            this.dialog.buttons[0].setText("Forgot Password");
+            this.dialog.buttons[1].setText("Login");
+        }
+        */
+        
+        
+    },
+    
+    
+    title: "Login",
+    modal: true,
+    width:  350,
+    //height: 230,
+    height: 180,
+    shadow: true,
+    minWidth:200,
+    minHeight:180,
+    //proxyDrag: true,
+    closable: false,
+    draggable: false,
+    collapsible: false,
+    resizable: false,
+    center: {  // needed??
+        autoScroll:false,
+        titlebar: false,
+       // tabPosition: 'top',
+        hideTabs: true,
+        closeOnTab: true,
+        alwaysShowTabs: false
+    } ,
+    listeners : {
+        
+        show  : function(dlg)
+        {
+            //console.log(this);
+            this.form = this.layout.getRegion('center').activePanel.form;
+            this.form.dialog = dlg;
+            this.buttons[0].form = this.form;
+            this.buttons[0].dialog = dlg;
+            this.buttons[1].form = this.form;
+            this.buttons[1].dialog = dlg;
+           
+           //this.resizeToLogo.defer(1000,this);
+            // this is all related to resizing for logos..
+            //var sz = Roo.get(Pman.Login.form.el.query('img')[0]).getSize();
+           //// if (!sz) {
+             //   this.resizeToLogo.defer(1000,this);
+             //   return;
+           // }
+            //var w = Ext.lib.Dom.getViewWidth() - 100;
+            //var h = Ext.lib.Dom.getViewHeight() - 100;
+            //this.resizeTo(Math.max(350, Math.min(sz.width + 30, w)),Math.min(sz.height+200, h));
+            //this.center();
+            if (this.disabled) {
+                this.hide();
+                return;
+            }
+            
+            if (this.user.id < 0) { // used for inital setup situations.
+                return;
+            }
+            
+            if (this.intervalID) {
+                // remove the timer
+                window.clearInterval(this.intervalID);
+                this.intervalID = false;
+            }
+            
+            
+            if (Roo.get('loading')) {
+                Roo.get('loading').remove();
+            }
+            if (Roo.get('loading-mask')) {
+                Roo.get('loading-mask').hide();
+            }
+            
+            //incomming._node = tnode;
+            this.form.reset();
+            //this.dialog.modal = !modal;
+            //this.dialog.show();
+            this.el.unmask(); 
+            
+            
+            this.form.setValues({
+                'username' : Roo.state.Manager.get(this.realm + '.username', ''),
+                'lang' : Roo.state.Manager.get(this.realm + '.lang', 'en')
+            });
+            
+            this.switchLang(Roo.state.Manager.get(this.realm + '.lang', 'en'));
+            if (this.form.findField('username').getValue().length > 0 ){
+                this.form.findField('password').focus();
+            } else {
+               this.form.findField('username').focus();
+            }
+    
+        }
+    },
+    items : [
+         {
+       
+            xtype : 'ContentPanel',
+            xns : Roo,
+            region: 'center',
+            fitToFrame : true,
+            
+            items : [
+    
+                {
+               
+                    xtype : 'Form',
+                    xns : Roo.form,
+                    labelWidth: 100,
+                    style : 'margin: 10px;',
+                    
+                    listeners : {
+                        actionfailed : function(f, act) {
+                            // form can return { errors: .... }
+                                
+                            //act.result.errors // invalid form element list...
+                            //act.result.errorMsg// invalid form element list...
+                            
+                            this.dialog.el.unmask();
+                            Roo.MessageBox.alert("Error", act.result.errorMsg ? act.result.errorMsg : 
+                                        "Login failed - communication error - try again.");
+                                      
+                        },
+                        actioncomplete: function(re, act) {
+                             
+                            Roo.state.Manager.set(
+                                this.dialog.realm + '.username',  
+                                    this.findField('username').getValue()
+                            );
+                            Roo.state.Manager.set(
+                                this.dialog.realm + '.lang',  
+                                this.findField('lang').getValue() 
+                            );
+                            
+                            this.dialog.fillAuth(act.result.data);
+                              
+                            this.dialog.hide();
+                            
+                            if (Roo.get('loading-mask')) {
+                                Roo.get('loading-mask').show();
+                            }
+                            Roo.XComponent.build();
+                            
+                             
+                            
+                        }
+                    },
+                    items : [
+                        {
+                            xtype : 'TextField',
+                            xns : Roo.form,
+                            fieldLabel: "Email Address",
+                            name: 'username',
+                            width:200,
+                            autoCreate : {tag: "input", type: "text", size: "20"}
+                        },
+                        {
+                            xtype : 'TextField',
+                            xns : Roo.form,
+                            fieldLabel: "Password",
+                            inputType: 'password',
+                            name: 'password',
+                            width:200,
+                            autoCreate : {tag: "input", type: "text", size: "20"},
+                            listeners : {
+                                specialkey : function(e,ev) {
+                                    if (ev.keyCode == 13) {
+                                        this.form.dialog.el.mask("Logging in");
+                                        this.form.doAction('submit', {
+                                            url: this.form.dialog.url,
+                                            method: this.form.dialog.method
+                                        });
+                                    }
+                                }
+                            }  
+                        },
+                        {
+                            xtype : 'ComboBox',
+                            xns : Roo.form,
+                            fieldLabel: "Language",
+                            name : 'langdisp',
+                            store: {
+                                xtype : 'SimpleStore',
+                                fields: ['lang', 'ldisp'],
+                                data : [
+                                    [ 'en', 'English' ],
+                                    [ 'zh_HK' , '\u7E41\u4E2D' ],
+                                    [ 'zh_CN', '\u7C21\u4E2D' ]
+                                ]
+                            },
+                            
+                            valueField : 'lang',
+                            hiddenName:  'lang',
+                            width: 200,
+                            displayField:'ldisp',
+                            typeAhead: false,
+                            editable: false,
+                            mode: 'local',
+                            triggerAction: 'all',
+                            emptyText:'Select a Language...',
+                            selectOnFocus:true,
+                            listeners : {
+                                select :  function(cb, rec, ix) {
+                                    this.form.switchLang(rec.data.lang);
+                                }
+                            }
+                        
+                        }
+                    ]
+                }
+                  
+                
+            ]
+        }
+    ],
+    buttons : [
+        {
+            xtype : 'Button',
+            xns : 'Roo',
+            text : "Forgot Password",
+            listeners : {
+                click : function() {
+                    //console.log(this);
+                    var n = this.form.findField('username').getValue();
+                    if (!n.length) {
+                        Roo.MessageBox.alert("Error", "Fill in your email address");
+                        return;
+                    }
+                    Roo.Ajax.request({
+                        url: this.dialog.url,
+                        params: {
+                            passwordRequest: n
+                        },
+                        method: this.dialog.method,
+                        success:  function(response, opts)  {  // check successfull...
+                        
+                            var res = this.dialog.processResponse(response);
+                            if (!res.success) { // error!
+                               Roo.MessageBox.alert("Error" ,
+                                    res.errorMsg ? res.errorMsg  : "Problem Requesting Password Reset");
+                               return;
+                            }
+                            Roo.MessageBox.alert("Notice" ,
+                                "Please check you email for the Password Reset message");
+                        },
+                        failure : function() {
+                            Roo.MessageBox.alert("Error" , "Problem Requesting Password Reset");
+                        }
+                        
+                    });
+                }
+            }
+        },
+        {
+            xtype : 'Button',
+            xns : 'Roo',
+            text : "Login",
+            listeners : {
+                
+                click : function () {
+                        
+                    this.dialog.el.mask("Logging in");
+                    this.form.doAction('submit', {
+                            url: this.dialog.url,
+                            method: this.dialog.method
+                    });
+                }
+            }
+        }
+    ]
+  
+  
+})
+
+
+   
\ No newline at end of file
index e69de29..71f86c7 100644 (file)
@@ -0,0 +1,873 @@
+//Roo/dd/DragDrop.js
+(function(){var A=Roo.EventManager;var B=Roo.lib.Dom;Roo.dd.DragDrop=function(id,C,D){if(id){this.init(id,C,D);}};Roo.extend(Roo.dd.DragDrop,Roo.util.Observable,{id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(C,D,E){if(typeof D=="number"){D={left:D,right:D,top:D,bottom:D};}
+D=D||this.defaultPadding;var b=Roo.get(this.getEl()).getBox();var ce=Roo.get(C);var s=ce.getScroll();var c,cd=ce.dom;if(cd==document.body){c={x:s.left,y:s.top,width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()};}else {xy=ce.getXY();c={x:xy[0]+s.left,y:xy[1]+s.top,width:cd.clientWidth,height:cd.clientHeight};}var F=b.y-c.y;var G=b.x-c.x;this.resetConstraints();this.setXConstraint(G-(D.left||0),c.width-G-b.width-(D.right||0));this.setYConstraint(F-(D.top||0),c.height-F-b.height-(D.bottom||0));},getEl:function(){if(!this._domRef){this._domRef=Roo.getDom(this.id);}return this._domRef;},getDragEl:function(){return Roo.getDom(this.dragElId);},init:function(id,C,D){this.initTarget(id,C,D);A.on(this.id,"mousedown",this.handleMouseDown,this);},initTarget:function(id,C,D){this.config=D||{};this.DDM=Roo.dd.DDM;this.groups={};if(typeof id!=="string"){id=Roo.id(id);}
+this.id=id;this.addToGroup((C)?C:"default");this.handleElId=id;this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();this.handleOnAvailable();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(C,D,E,F){if(!D&&0!==D){this.padding=[C,C,C,C];}else if(!E&&0!==E){this.padding=[C,D,C,D];}else {this.padding=[C,D,E,F];}},setInitPosition:function(C,D){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}var dx=C||0;var dy=D||0;var p=B.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(C){var p=C||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C);},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C];}
+this.DDM.removeDDFromGroup(this,C);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){id=Roo.id(id);}
+this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Roo.id(id);}
+A.on(id,"mousedown",this.handleMouseDown,this);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){A.un(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},destroy:function(){this.unreg();},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,C){if(this.primaryButtonOnly&&e.button!=0){return;}if(this.isLocked()){return;}
+this.DDM.refreshCache(this.groups);var pt=new Roo.lib.Point(Roo.lib.Event.getPageX(e),Roo.lib.Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else {if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else {}}},clickValidator:function(e){var C=e.getTarget();return (this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)));},addInvalidHandleType:function(C){var D=C.toUpperCase();this.invalidHandleTypes[D]=D;},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Roo.id(id);}
+this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C);},removeInvalidHandleType:function(C){var D=C.toUpperCase();delete this.invalidHandleTypes[D];},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Roo.id(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(C){for(var i=0,D=this.invalidHandleClasses.length;i<D;++i){if(this.invalidHandleClasses[i]==C){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(C){var D=true;var E;try{E=C.nodeName.toUpperCase();}catch(e){nodeName=node.nodeName;}
+D=D&&!this.invalidHandleTypes[E];D=D&&!this.invalidHandleIds[C.id];for(var i=0,F=this.invalidHandleClasses.length;D&&i<F;++i){D=!B.hasClass(C,this.invalidHandleClasses[i]);}return D;},setXTicks:function(C,D){this.xTicks=[];this.xTickSize=D;var E={};for(var i=this.initPageX;i>=this.minX;i=i-D){if(!E[i]){this.xTicks[this.xTicks.length]=i;E[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+D){if(!E[i]){this.xTicks[this.xTicks.length]=i;E[i]=true;}}
+this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(C,D){this.yTicks=[];this.yTickSize=D;var E={};for(var i=this.initPageY;i>=this.minY;i=i-D){if(!E[i]){this.yTicks[this.yTicks.length]=i;E[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+D){if(!E[i]){this.yTicks[this.yTicks.length]=i;E[i]=true;}}
+this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(C,D,E){this.leftConstraint=C;this.rightConstraint=D;this.minX=this.initPageX-C;this.maxX=this.initPageX+D;if(E){this.setXTicks(this.initPageX,E);}
+this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(C,D,E){this.topConstraint=C;this.bottomConstraint=D;this.minY=this.initPageY-C;this.maxY=this.initPageY+D;if(E){this.setYTicks(this.initPageY,E);}
+this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else {this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(C,D){if(!D){return C;}else if(D[0]>=C){return D[0];}else {for(var i=0,E=D.length;i<E;++i){var F=i+1;if(D[F]&&D[F]>=C){var G=C-D[i];var H=D[F]-C;return (H>G)?D[i]:D[F];}}return D[D.length-1];}},toString:function(){return ("DragDrop "+this.id);}});})();
+//Roo/dd/DragDropMgr.js
+if(!Roo.dd.DragDropMgr){Roo.dd.DragDropMgr=function(){var A=Roo.EventManager;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(B,C){for(var i in this.ids){for(var j in this.ids[i]){var D=this.ids[i][j];if(!this.isTypeOfDD(D)){continue;}
+D[B].apply(D,C);}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(B,C){if(!this.initialized){this.init();}if(!this.ids[C]){this.ids[C]={};}
+this.ids[C][B.id]=B;},removeDDFromGroup:function(B,C){if(!this.ids[C]){this.ids[C]={};}var D=this.ids[C];if(D&&D[B.id]){delete D[B.id];}},_remove:function(B){for(var g in B.groups){if(g&&this.ids[g][B.id]){delete this.ids[g][B.id];}}delete this.handleIds[B.id];},regHandle:function(B,C){if(!this.handleIds[B]){this.handleIds[B]={};}
+this.handleIds[B][C]=C;},isDragDrop:function(id){return (this.getDDById(id))?true:false;},getRelated:function(B,C){var D=[];for(var i in B.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!C||dd.isTarget){D[D.length]=dd;}}}return D;},isLegalTarget:function(B,C){var D=this.getRelated(B,true);for(var i=0,E=D.length;i<E;++i){if(D[i].id==C.id){return true;}}return false;},isTypeOfDD:function(B){return (B&&B.__ygDragDrop);},isHandle:function(B,C){return (this.handleIds[B]&&this.handleIds[B][C]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}return null;},handleMouseDown:function(e,B){if(Roo.QuickTips){Roo.QuickTips.disable();}
+this.currentTarget=e.getTarget();this.dragCurrent=B;var el=B.getEl();this.startX=e.getPageX();this.startY=e.getPageY();this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var C=Roo.dd.DDM;C.startDrag(C.startX,C.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}
+this.dragThreshMet=true;},handleMouseUp:function(e){if(Roo.QuickTips){Roo.QuickTips.enable();}if(!this.dragCurrent){return;}
+clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else {}
+this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){e.stopPropagation();}if(this.preventDefault){e.preventDefault();}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}
+this.dragCurrent.onMouseUp(e);}
+this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;}if(Roo.isIE&&(e.button!==0&&e.button!==1&&e.button!==2)){this.stopEvent(e);return this.handleMouseUp(e);}if(!this.dragThreshMet){var B=Math.abs(this.startX-e.getPageX());var C=Math.abs(this.startY-e.getPageY());if(B>this.clickPixelThresh||C>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);if(!this.dragCurrent.moveOnly){this.fireEvents(e,false);}}
+this.stopEvent(e);return true;},fireEvents:function(e,B){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var pt=e.getPoint();var C=[];var D=[];var E=[];var F=[];var G=[];for(var i in this.dragOvers){var H=this.dragOvers[i];if(!this.isTypeOfDD(H)){continue;}if(!this.isOverTarget(pt,H,this.mode)){D.push(H);}
+C[i]=true;delete this.dragOvers[i];}for(var I in dc.groups){if("string"!=typeof I){continue;}for(i in this.ids[I]){var J=this.ids[I][i];if(!this.isTypeOfDD(J)){continue;}if(J.isTarget&&!J.isLocked()&&J!=dc){if(this.isOverTarget(pt,J,this.mode)){if(B){F.push(J);}else {if(!C[J.id]){G.push(J);}else {E.push(J);}
+this.dragOvers[J.id]=J;}}}}}if(this.mode){if(D.length){dc.b4DragOut(e,D);dc.onDragOut(e,D);}if(G.length){dc.onDragEnter(e,G);}if(E.length){dc.b4DragOver(e,E);dc.onDragOver(e,E);}if(F.length){dc.b4DragDrop(e,F);dc.onDragDrop(e,F);}}else {var K=0;for(i=0,K=D.length;i<K;++i){dc.b4DragOut(e,D[i].id);dc.onDragOut(e,D[i].id);}for(i=0,K=G.length;i<K;++i){dc.onDragEnter(e,G[i].id);}for(i=0,K=E.length;i<K;++i){dc.b4DragOver(e,E[i].id);dc.onDragOver(e,E[i].id);}for(i=0,K=F.length;i<K;++i){dc.b4DragDrop(e,F[i].id);dc.onDragDrop(e,F[i].id);}}if(B&&!F.length){dc.onInvalidDrop(e);}},getBestMatch:function(B){var C=null;var D=B.length;if(D==1){C=B[0];}else {for(var i=0;i<D;++i){var dd=B[i];if(dd.cursorIsOver){C=dd;break;}else {if(!C||C.overlap.getArea()<dd.overlap.getArea()){C=dd;}}}}return C;},refreshCache:function(B){for(var C in B){if("string"!=typeof C){continue;}for(var i in this.ids[C]){var D=this.ids[C][i];if(this.isTypeOfDD(D)){var E=this.getLocation(D);if(E){this.locationCache[D.id]=E;}else {delete this.locationCache[D.id];}}}}},verifyEl:function(el){if(el){var B;if(Roo.isIE){try{B=el.offsetParent;}catch(e){}}else {B=el.offsetParent;}if(B){return true;}}return false;},getLocation:function(B){if(!this.isTypeOfDD(B)){return null;}var el=B.getEl(),C,x1,x2,y1,y2,t,r,b,l;try{C=Roo.lib.Dom.getXY(el);}catch(e){}if(!C){return null;}
+x1=C[0];x2=x1+el.offsetWidth;y1=C[1];y2=y1+el.offsetHeight;t=y1-B.padding[0];r=x2+B.padding[1];b=y2+B.padding[2];l=x1-B.padding[3];return new Roo.lib.Region(t,r,b,l);},isOverTarget:function(pt,B,C){var D=this.locationCache[B.id];if(!D||!this.useCache){D=this.getLocation(B);this.locationCache[B.id]=D;}if(!D){return false;}
+B.cursorIsOver=D.contains(pt);var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord||(!C&&!dc.constrainX&&!dc.constrainY)){return B.cursorIsOver;}
+B.overlap=null;var E=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var F=new Roo.lib.Region(E.y,E.x+el.offsetWidth,E.y+el.offsetHeight,E.x);var G=F.intersect(D);if(G){B.overlap=G;return (C)?true:B.cursorIsOver;}else {return false;}},_onUnload:function(e,me){Roo.dd.DragDropMgr.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}
+this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}
+this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var B=this.elementCache[id];if(!B||!B.el){B=this.elementCache[id]=new this.ElementWrapper(Roo.getDom(id));}return B;},getElement:function(id){return Roo.getDom(id);},getCss:function(id){var el=Roo.getDom(id);return (el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return Roo.lib.Dom.getX(el);},getPosY:function(el){return Roo.lib.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else {var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else {n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}},getScroll:function(){var t,l,B=document.documentElement,db=document.body;if(B&&(B.scrollTop||B.scrollLeft)){t=B.scrollTop;l=B.scrollLeft;}else if(db){t=db.scrollTop;l=db.scrollLeft;}else {}return {top:t,left:l};},getStyle:function(el,B){return Roo.fly(el).getStyle(B);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(B,C){var D=Roo.lib.Dom.getXY(C);Roo.lib.Dom.setXY(B,D);},numericSort:function(a,b){return (a-b);},_timeoutCount:0,_addListeners:function(){var B=Roo.dd.DDM;if(Roo.lib.Event&&document){B._onLoad();}else {if(B._timeoutCount>2000){}else {setTimeout(B._addListeners,10);if(document&&document.body){B._timeoutCount+=1;}}}},handleWasClicked:function(B,id){if(this.isHandle(id,B.id)){return true;}else {var p=B.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else {p=p.parentNode;}}}return false;}};}();Roo.dd.DDM=Roo.dd.DragDropMgr;Roo.dd.DDM._addListeners();}
+//Roo/dd/DD.js
+Roo.dd.DD=function(id,A,B){if(id){this.init(id,A,B);}};Roo.extend(Roo.dd.DD,Roo.dd.DragDrop,{scroll:true,autoOffset:function(A,B){var x=A-this.startPageX;var y=B-this.startPageY;this.setDelta(x,y);},setDelta:function(A,B){this.deltaX=A;this.deltaY=B;},setDragElPos:function(A,B){var el=this.getDragEl();this.alignElWithMouse(el,A,B);},alignElWithMouse:function(el,A,B){var C=this.getTargetCoord(A,B);var D=el.dom?el:Roo.fly(el);if(!this.deltaSetXY){var E=[C.x,C.y];D.setXY(E);var F=D.getLeft(true);var G=D.getTop(true);this.deltaSetXY=[F-C.x,G-C.y];}else {D.setLeftTop(C.x+this.deltaSetXY[0],C.y+this.deltaSetXY[1]);}
+this.cachePosition(C.x,C.y);this.autoScroll(C.x,C.y,el.offsetHeight,el.offsetWidth);return C;},cachePosition:function(A,B){if(A){this.lastPageX=A;this.lastPageY=B;}else {var C=Roo.lib.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var A=Roo.lib.Dom.getViewWidth();var B=Roo.lib.Dom.getViewHeight();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var C=h+y;var D=w+x;var E=(A+st-y-this.deltaY);var F=(B+sl-x-this.deltaX);var G=40;var H=(document.all)?80:30;if(C>A&&E<G){window.scrollTo(sl,st+H);}if(y<st&&st>0&&y-st<G){window.scrollTo(sl,st-H);}if(D>B&&F<G){window.scrollTo(sl+H,st);}if(x<sl&&sl>0&&x-sl<G){window.scrollTo(sl-H,st);}}},getTargetCoord:function(A,B){var x=A-this.deltaX;var y=B-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}if(x>this.maxX){x=this.maxX;}}if(this.constrainY){if(y<this.minY){y=this.minY;}if(y>this.maxY){y=this.maxY;}}
+x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){Roo.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(e.getPageX(),e.getPageY());},b4Drag:function(e){this.setDragElPos(e.getPageX(),e.getPageY());},toString:function(){return ("DD "+this.id);}});
+//Roo/dd/DDProxy.js
+Roo.dd.DDProxy=function(id,A,B){if(id){this.init(id,A,B);this.initFrame();}};Roo.dd.DDProxy.dragElId="ygddfdiv";Roo.extend(Roo.dd.DDProxy,Roo.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var A=this;var B=document.body;if(!B||!B.firstChild){setTimeout(function(){A.createFrame();},50);return;}var C=this.getDragEl();if(!C){C=document.createElement("div");C.id=this.dragElId;var s=C.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;B.insertBefore(C,B.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){Roo.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Roo.dd.DDProxy.dragElId);},showFrame:function(A,B){var el=this.getEl();var C=this.getDragEl();var s=C.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}
+this.setDragElPos(A,B);Roo.fly(C).show();},_resizeProxy:function(){if(this.resizeFrame){var el=this.getEl();Roo.fly(this.getDragEl()).setSize(el.offsetWidth,el.offsetHeight);}},b4MouseDown:function(e){var x=e.getPageX();var y=e.getPageY();this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){Roo.fly(this.getDragEl()).hide();},endDrag:function(e){var A=this.getEl();var B=this.getDragEl();B.style.visibility="";this.beforeMove();A.style.visibility="hidden";Roo.dd.DDM.moveToEl(A,B);B.style.visibility="hidden";A.style.visibility="";this.afterDrag();},beforeMove:function(){},afterDrag:function(){},toString:function(){return ("DDProxy "+this.id);}});
+//Roo/dd/DDTarget.js
+Roo.dd.DDTarget=function(id,A,B){if(id){this.initTarget(id,A,B);}if(B.listeners||B.events){Roo.dd.DragDrop.superclass.constructor.call(this,{listeners:B.listeners||{},events:B.events||{}});}};Roo.extend(Roo.dd.DDTarget,Roo.dd.DragDrop,{toString:function(){return ("DDTarget "+this.id);}});
+//Roo/dd/ScrollManager.js
+Roo.dd.ScrollManager=function(){var A=Roo.dd.DragDropMgr;var B={};var C=null;var D={};var E=function(e){C=null;H();};var F=function(){if(A.dragCurrent){A.refreshCache(A.dragCurrent.groups);}};var G=function(){if(A.dragCurrent){var K=Roo.dd.ScrollManager;if(!K.animate){if(D.el.scroll(D.dir,K.increment)){F();}}else {D.el.scroll(D.dir,K.increment,true,K.animDuration,F);}}};var H=function(){if(D.id){clearInterval(D.id);}
+D.id=0;D.el=null;D.dir="";};var I=function(el,K){H();D.el=el;D.dir=K;D.id=setInterval(G,Roo.dd.ScrollManager.frequency);};var J=function(e,K){if(K||!A.dragCurrent){return;}var L=Roo.dd.ScrollManager;if(!C||C!=A.dragCurrent){C=A.dragCurrent;L.refreshCache();}var xy=Roo.lib.Event.getXY(e);var pt=new Roo.lib.Point(xy[0],xy[1]);for(var id in B){var el=B[id],r=el._region;if(r&&r.contains(pt)&&el.isScrollable()){if(r.bottom-pt.y<=L.thresh){if(D.el!=el){I(el,"down");}return;}else if(r.right-pt.x<=L.thresh){if(D.el!=el){I(el,"left");}return;}else if(pt.y-r.top<=L.thresh){if(D.el!=el){I(el,"up");}return;}else if(pt.x-r.left<=L.thresh){if(D.el!=el){I(el,"right");}return;}}}
+H();};A.fireEvents=A.fireEvents.createSequence(J,A);A.stopDrag=A.stopDrag.createSequence(E,A);return {register:function(el){if(el instanceof Array){for(var i=0,K=el.length;i<K;i++){this.register(el[i]);}}else {el=Roo.get(el);B[el.id]=el;}},unregister:function(el){if(el instanceof Array){for(var i=0,K=el.length;i<K;i++){this.unregister(el[i]);}}else {el=Roo.get(el);delete B[el.id];}},thresh:25,increment:100,frequency:500,animate:true,animDuration:.4,refreshCache:function(){for(var id in B){if(typeof B[id]=='object'){B[id]._region=B[id].getRegion();}}}};}();
+//Roo/dd/Registry.js
+Roo.dd.Registry=function(){var A={};var B={};var C=0;var D=function(el,E){if(typeof el=="string"){return el;}var id=el.id;if(!id&&E!==false){id="roodd-"+(++C);el.id=id;}return id;};return {register:function(el,E){E=E||{};if(typeof el=="string"){el=document.getElementById(el);}
+E.ddel=el;A[D(el)]=E;if(E.isHandle!==false){B[E.ddel.id]=E;}if(E.handles){var hs=E.handles;for(var i=0,F=hs.length;i<F;i++){B[D(hs[i])]=E;}}},unregister:function(el){var id=D(el,false);var E=A[id];if(E){delete A[id];if(E.handles){var hs=E.handles;for(var i=0,F=hs.length;i<F;i++){delete B[D(hs[i],false)];}}}},getHandle:function(id){if(typeof id!="string"){id=id.id;}return B[id];},getHandleFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?B[t.id]:null;},getTarget:function(id){if(typeof id!="string"){id=id.id;}return A[id];},getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?A[t.id]||B[t.id]:null;}};}();
+//Roo/dd/StatusProxy.js
+Roo.dd.StatusProxy=function(A){Roo.apply(this,A);this.id=this.id||Roo.id();this.el=new Roo.Layer({dh:{id:this.id,tag:"div",cls:"x-dd-drag-proxy "+this.dropNotAllowed,children:[{tag:"div",cls:"x-dd-drop-icon"},{tag:"div",cls:"x-dd-drag-ghost"}]},shadow:!A||A.shadow!==false});this.ghost=Roo.get(this.el.dom.childNodes[1]);this.dropStatus=this.dropNotAllowed;};Roo.dd.StatusProxy.prototype={dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",setStatus:function(A){A=A||this.dropNotAllowed;if(this.dropStatus!=A){this.el.replaceClass(this.dropStatus,A);this.dropStatus=A;}},reset:function(A){this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;this.dropStatus=this.dropNotAllowed;if(A){this.ghost.update("");}},update:function(A){if(typeof A=="string"){this.ghost.update(A);}else {this.ghost.update("");A.style.margin="0";this.ghost.dom.appendChild(A);}var el=this.ghost.dom.firstChild;if(el){Roo.fly(el).setStyle('float','none');}},getEl:function(){return this.el;},getGhost:function(){return this.ghost;},hide:function(A){this.el.hide();if(A){this.reset(true);}},stop:function(){if(this.anim&&this.anim.isAnimated&&this.anim.isAnimated()){this.anim.stop();}},show:function(){this.el.show();},sync:function(){this.el.sync();},repair:function(xy,A,B){this.callback=A;this.scope=B;if(xy&&this.animRepair!==false){this.el.addClass("x-dd-drag-repair");this.el.hideUnders(true);this.anim=this.el.shift({duration:this.repairDuration||.5,easing:'easeOut',xy:xy,stopFx:true,callback:this.afterRepair,scope:this});}else {this.afterRepair();}},afterRepair:function(){this.hide(true);if(typeof this.callback=="function"){this.callback.call(this.scope||this);}
+this.callback=null;this.scope=null;}};
+//Roo/dd/DragSource.js
+Roo.dd.DragSource=function(el,A){this.el=Roo.get(el);this.dragData={};Roo.apply(this,A);if(!this.proxy){this.proxy=new Roo.dd.StatusProxy();}
+Roo.dd.DragSource.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{dragElId:this.proxy.id,resizeFrame:false,isTarget:false,scroll:this.scroll===true});this.dragging=false;};Roo.extend(Roo.dd.DragSource,Roo.dd.DDProxy,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",getDragData:function(e){return this.dragData;},onDragEnter:function(e,id){var A=Roo.dd.DragDropMgr.getDDById(id);this.cachedTarget=A;if(this.beforeDragEnter(A,e,id)!==false){if(A.isNotifyTarget){var B=A.notifyEnter(this,e,this.dragData);this.proxy.setStatus(B);}else {this.proxy.setStatus(this.dropAllowed);}if(this.afterDragEnter){this.afterDragEnter(A,e,id);}}},beforeDragEnter:function(A,e,id){return true;},alignElWithMouse:function(){Roo.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);this.proxy.sync();},onDragOver:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOver(A,e,id)!==false){if(A.isNotifyTarget){var B=A.notifyOver(this,e,this.dragData);this.proxy.setStatus(B);}if(this.afterDragOver){this.afterDragOver(A,e,id);}}},beforeDragOver:function(A,e,id){return true;},onDragOut:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOut(A,e,id)!==false){if(A.isNotifyTarget){A.notifyOut(this,e,this.dragData);}
+this.proxy.reset();if(this.afterDragOut){this.afterDragOut(A,e,id);}}
+this.cachedTarget=null;},beforeDragOut:function(A,e,id){return true;},onDragDrop:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragDrop(A,e,id)!==false){if(A.isNotifyTarget){if(A.notifyDrop(this,e,this.dragData)){this.onValidDrop(A,e,id);}else {this.onInvalidDrop(A,e,id);}}else {this.onValidDrop(A,e,id);}if(this.afterDragDrop){this.afterDragDrop(A,e,id);}}delete this.cachedTarget;},beforeDragDrop:function(A,e,id){return true;},onValidDrop:function(A,e,id){this.hideProxy();if(this.afterValidDrop){this.afterValidDrop(A,e,id);}},getRepairXY:function(e,A){return this.el.getXY();},onInvalidDrop:function(A,e,id){this.beforeInvalidDrop(A,e,id);if(this.cachedTarget){if(this.cachedTarget.isNotifyTarget){this.cachedTarget.notifyOut(this,e,this.dragData);}
+this.cacheTarget=null;}
+this.proxy.repair(this.getRepairXY(e,this.dragData),this.afterRepair,this);if(this.afterInvalidDrop){this.afterInvalidDrop(e,id);}},afterRepair:function(){if(Roo.enableFx){this.el.highlight(this.hlColor||"c3daf9");}
+this.dragging=false;},beforeInvalidDrop:function(A,e,id){return true;},handleMouseDown:function(e){if(this.dragging){return;}var A=this.getDragData(e);if(A&&this.onBeforeDrag(A,e)!==false){this.dragData=A;this.proxy.stop();Roo.dd.DragSource.superclass.handleMouseDown.apply(this,arguments);}},onBeforeDrag:function(A,e){return true;},onStartDrag:Roo.emptyFn,startDrag:function(x,y){this.proxy.reset();this.dragging=true;this.proxy.update("");this.onInitDrag(x,y);this.proxy.show();},onInitDrag:function(x,y){var A=this.el.dom.cloneNode(true);A.id=Roo.id();this.proxy.update(A);this.onStartDrag(x,y);return true;},getProxy:function(){return this.proxy;},hideProxy:function(){this.proxy.hide();this.proxy.reset(true);this.dragging=false;},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups);},b4EndDrag:function(e){},endDrag:function(e){this.onEndDrag(this.dragData,e);},onEndDrag:function(A,e){},autoOffset:function(x,y){this.setDelta(-12,-20);}});
+//Roo/dd/DropTarget.js
+Roo.dd.DropTarget=function(el,A){this.el=Roo.get(el);var B=false;;if(A&&A.listeners){B=A.listeners;delete A.listeners;}
+Roo.apply(this,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}
+this.addEvents({"enter":true,"over":true,"out":true,"drop":true});Roo.dd.DropTarget.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{isTarget:true,listeners:B||{}});};Roo.extend(Roo.dd.DropTarget,Roo.dd.DDTarget,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",success:false,valid:false,isTarget:true,isNotifyTarget:true,notifyEnter:function(dd,e,A){this.valid=true;this.fireEvent('enter',dd,e,A);if(this.overClass){this.el.addClass(this.overClass);}return typeof(this.valid)=='string'?'x-dd-drop-'+this.valid:(this.valid?this.dropAllowed:this.dropNotAllowed);},notifyOver:function(dd,e,A){this.valid=true;this.fireEvent('over',dd,e,A);return typeof(this.valid)=='string'?'x-dd-drop-'+this.valid:(this.valid?this.dropAllowed:this.dropNotAllowed);},notifyOut:function(dd,e,A){this.fireEvent('out',dd,e,A);if(this.overClass){this.el.removeClass(this.overClass);}},notifyDrop:function(dd,e,A){this.success=false;this.fireEvent('drop',dd,e,A);return this.success;}});
+//Roo/dd/DragZone.js
+Roo.dd.DragZone=function(el,A){Roo.dd.DragZone.superclass.constructor.call(this,el,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}};Roo.extend(Roo.dd.DragZone,Roo.dd.DragSource,{getDragData:function(e){return Roo.dd.Registry.getHandleFromEvent(e);},onInitDrag:function(x,y){this.proxy.update(this.dragData.ddel.cloneNode(true));this.onStartDrag(x,y);return true;},afterRepair:function(){if(Roo.enableFx){Roo.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");}
+this.dragging=false;},getRepairXY:function(e){return Roo.Element.fly(this.dragData.ddel).getXY();}});
+//Roo/dd/DropZone.js
+Roo.dd.DropZone=function(el,A){Roo.dd.DropZone.superclass.constructor.call(this,el,A);};Roo.extend(Roo.dd.DropZone,Roo.dd.DropTarget,{getTargetFromEvent:function(e){return Roo.dd.Registry.getTargetFromEvent(e);},onNodeEnter:function(n,dd,e,A){},onNodeOver:function(n,dd,e,A){return this.dropAllowed;},onNodeOut:function(n,dd,e,A){},onNodeDrop:function(n,dd,e,A){return false;},onContainerOver:function(dd,e,A){return this.dropNotAllowed;},onContainerDrop:function(dd,e,A){return false;},notifyEnter:function(dd,e,A){return this.dropNotAllowed;},notifyOver:function(dd,e,A){var n=this.getTargetFromEvent(e);if(!n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}return this.onContainerOver(dd,e,A);}if(this.lastOverNode!=n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);}
+this.onNodeEnter(n,dd,e,A);this.lastOverNode=n;}return this.onNodeOver(n,dd,e,A);},notifyOut:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}},notifyDrop:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}var n=this.getTargetFromEvent(e);return n?this.onNodeDrop(n,dd,e,A):this.onContainerDrop(dd,e,A);},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups);}});
+//Roo/data/SortTypes.js
+Roo.data.SortTypes={none:function(s){return s;},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"");},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"");},asUCString:function(s){return String(s).toUpperCase();},asDate:function(s){if(!s){return 0;}if(s instanceof Date){return s.getTime();}return Date.parse(String(s));},asFloat:function(s){var A=parseFloat(String(s).replace(/,/g,""));if(isNaN(A))A=0;return A;},asInt:function(s){var A=parseInt(String(s).replace(/,/g,""));if(isNaN(A))A=0;return A;}};
+//Roo/data/Record.js
+Roo.data.Record=function(A,id){this.id=(id||id===0)?id:++Roo.data.Record.AUTO_ID;this.data=A;};Roo.data.Record.create=function(o){var f=function(){f.superclass.constructor.apply(this,arguments);};Roo.extend(f,Roo.data.Record);var p=f.prototype;p.fields=new Roo.util.MixedCollection(false,function(B){return B.name;});for(var i=0,A=o.length;i<A;i++){p.fields.add(new Roo.data.Field(o[i]));}
+f.getField=function(B){return p.fields.get(B);};return f;};Roo.data.Record.AUTO_ID=1000;Roo.data.Record.EDIT='edit';Roo.data.Record.REJECT='reject';Roo.data.Record.COMMIT='commit';Roo.data.Record.prototype={dirty:false,editing:false,error:null,modified:null,join:function(A){this.store=A;},set:function(A,B){if(this.data[A]==B){return;}
+this.dirty=true;if(!this.modified){this.modified={};}if(typeof this.modified[A]=='undefined'){this.modified[A]=this.data[A];}
+this.data[A]=B;if(!this.editing&&this.store){this.store.afterEdit(this);}},get:function(A){return this.data[A];},beginEdit:function(){this.editing=true;this.modified={};},cancelEdit:function(){this.editing=false;delete this.modified;},endEdit:function(){this.editing=false;if(this.dirty&&this.store){this.store.afterEdit(this);}},reject:function(){var m=this.modified;for(var n in m){if(typeof m[n]!="function"){this.data[n]=m[n];}}
+this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterReject(this);}},commit:function(){this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterCommit(this);}},hasError:function(){return this.error!=null;},clearError:function(){this.error=null;},copy:function(A){return new this.constructor(Roo.apply({},this.data),A||this.id);}};
+//Roo/data/Store.js
+Roo.data.Store=function(A){this.data=new Roo.util.MixedCollection(false);this.data.getKey=function(o){return o.id;};this.baseParams={};this.paramNames={"start":"start","limit":"limit","sort":"sort","dir":"dir","multisort":"_multisort"};if(A&&A.data){this.inlineData=A.data;delete A.data;}
+Roo.apply(this,A);if(this.reader){this.reader=Roo.factory(this.reader,Roo.data);this.reader.xmodule=this.xmodule||false;if(!this.recordType){this.recordType=this.reader.recordType;}if(this.reader.onMetaChange){this.reader.onMetaChange=this.onMetaChange.createDelegate(this);}}if(this.recordType){this.fields=this.recordType.prototype.fields;}
+this.modified=[];this.addEvents({datachanged:true,metachange:true,add:true,remove:true,update:true,clear:true,beforeload:true,load:true,loadexception:true});if(this.proxy){this.proxy=Roo.factory(this.proxy,Roo.data);this.proxy.xmodule=this.xmodule||false;this.relayEvents(this.proxy,["loadexception"]);}
+this.sortToggle={};this.sortOrder=[];Roo.data.Store.superclass.constructor.call(this);if(this.inlineData){this.loadData(this.inlineData);delete this.inlineData;}};Roo.extend(Roo.data.Store,Roo.util.Observable,{multiSort:false,remoteSort:false,pruneModifiedRecords:false,lastOptions:null,add:function(A){A=[].concat(A);for(var i=0,B=A.length;i<B;i++){A[i].join(this);}var C=this.data.length;this.data.addAll(A);this.fireEvent("add",this,A,C);},remove:function(A){var B=this.data.indexOf(A);this.data.removeAt(B);if(this.pruneModifiedRecords){this.modified.remove(A);}
+this.fireEvent("remove",this,A,B);},removeAll:function(){this.data.clear();if(this.pruneModifiedRecords){this.modified=[];}
+this.fireEvent("clear",this);},insert:function(A,B){B=[].concat(B);for(var i=0,C=B.length;i<C;i++){this.data.insert(A,B[i]);B[i].join(this);}
+this.fireEvent("add",this,B,A);},indexOf:function(A){return this.data.indexOf(A);},indexOfId:function(id){return this.data.indexOfKey(id);},getById:function(id){return this.data.key(id);},getAt:function(A){return this.data.itemAt(A);},getRange:function(A,B){return this.data.getRange(A,B);},storeOptions:function(o){o=Roo.apply({},o);delete o.callback;delete o.scope;this.lastOptions=o;},load:function(A){A=A||{};if(this.fireEvent("beforeload",this,A)!==false){this.storeOptions(A);var p=Roo.apply(A.params||{},this.baseParams);if(!this.reader.metaFromRemote){p._requestMeta=1;}if(this.sortInfo&&this.remoteSort){var pn=this.paramNames;p[pn["sort"]]=this.sortInfo.field;p[pn["dir"]]=this.sortInfo.direction;}if(this.multiSort){var pn=this.paramNames;p[pn["multisort"]]=Roo.encode({sort:this.sortToggle,order:this.sortOrder});}
+this.proxy.load(p,this.reader,this.loadRecords,this,A);}},reload:function(A){this.load(Roo.applyIf(A||{},this.lastOptions));},loadRecords:function(o,A,B){if(!o||B===false){if(B!==false){this.fireEvent("load",this,[],A);}if(A.callback){A.callback.call(A.scope||this,[],A,false);}return;}if(o.success===false){if(!this.hasListener('loadexception')&&typeof(this.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.reader.jsonData.errorMsg);}
+this.fireEvent("loadexception",this,o,A,this.reader.jsonData);return;}var r=o.records,t=o.totalRecords||r.length;if(!A||A.add!==true){if(this.pruneModifiedRecords){this.modified=[];}for(var i=0,C=r.length;i<C;i++){r[i].join(this);}if(this.snapshot){this.data=this.snapshot;delete this.snapshot;}
+this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else {this.totalLength=Math.max(t,this.data.length+r.length);this.add(r);}
+this.fireEvent("load",this,r,A);if(A.callback){A.callback.call(A.scope||this,r,A,true);}},loadData:function(o,A){var r=this.reader.readRecords(o);this.loadRecords(r,{add:A},true);},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;},getSortState:function(){return this.sortInfo;},applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);};this.data.sort(s.direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(s.direction,fn);}}},setDefaultSort:function(A,B){this.sortInfo={field:A,direction:B?B.toUpperCase():"ASC"};},sort:function(A,B){var f=this.fields.get(A);if(!B){this.sortToggle[f.name]=this.sortToggle[f.name]||f.sortDir;if(this.multiSort||(this.sortInfo&&this.sortInfo.field==f.name)){B=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");}else {B=f.sortDir;}}
+this.sortToggle[f.name]=B;this.sortInfo={field:f.name,direction:B};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else {this.load(this.lastOptions);}},each:function(fn,A){this.data.each(fn,A);},getModifiedRecords:function(){return this.modified;},createFilterFn:function(A,B,C){if(!B.exec){B=String(B);if(B.length==0){return false;}
+B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}
+this.fireEvent("update",this,A,Roo.data.Record.EDIT);},afterReject:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.REJECT);},afterCommit:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].reject();}},onMetaChange:function(A,B,o){this.recordType=B;this.fields=B.prototype.fields;delete this.snapshot;this.sortInfo=A.sortInfo||this.sortInfo;this.modified=[];this.fireEvent('metachange',this,this.reader.meta);}});
+//Roo/data/SimpleStore.js
+Roo.data.SimpleStore=function(A){Roo.data.SimpleStore.superclass.constructor.call(this,{isLocal:true,reader:new Roo.data.ArrayReader({id:A.id},Roo.data.Record.create(A.fields)),proxy:new Roo.data.MemoryProxy(A.data)});this.load();};Roo.extend(Roo.data.SimpleStore,Roo.data.Store);
+//Roo/data/JsonStore.js
+Roo.data.JsonStore=function(c){Roo.data.JsonStore.superclass.constructor.call(this,Roo.apply(c,{proxy:!c.data?new Roo.data.HttpProxy({url:c.url}):undefined,reader:new Roo.data.JsonReader(c,c.fields)}));};Roo.extend(Roo.data.JsonStore,Roo.data.Store);
+//Roo/data/Field.js
+Roo.data.Field=function(A){if(typeof A=="string"){A={name:A};}
+Roo.apply(this,A);if(!this.type){this.type="auto";}var st=Roo.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType];}if(!this.sortType){switch(this.type){case "string":this.sortType=st.asUCString;break;case "date":this.sortType=st.asDate;break;default:this.sortType=st.none;}}var B=/[\$,%]/g;if(!this.convert){var cv,C=this.dateFormat;switch(this.type){case "":case "auto":case undefined:cv=function(v){return v;};break;case "string":cv=function(v){return (v===undefined||v===null)?'':String(v);};break;case "int":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseInt(String(v).replace(B,""),10):'';};break;case "float":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseFloat(String(v).replace(B,""),10):'';};break;case "bool":case "boolean":cv=function(v){return v===true||v==="true"||v==1;};break;case "date":cv=function(v){if(!v){return '';}if(v instanceof Date){return v;}if(C){if(C=="timestamp"){return new Date(v*1000);}return Date.parseDate(v,C);}var D=Date.parse(v);return D?new Date(D):null;};break;}
+this.convert=cv;}};Roo.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"};
+//Roo/data/DataReader.js
+Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){switch(c.type){case 'int':da[c.name]=0;break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break;case 'boolean':da[c.name]=false;break;default:da[c.name]="";break;}});return new this.recordType(Roo.apply(da,d));}};
+//Roo/data/DataProxy.js
+Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable);
+//Roo/data/MemoryProxy.js
+Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}
+Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,arg,null,e);callback.call(scope,null,arg,false);return;}
+C.call(D,F,E,true);},update:function(A,B){}});
+//Roo/data/HttpProxy.js
+Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{},request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}
+this.activeRequest=Roo.Ajax.request(o);}else {this.conn.request(o);}}else {C.call(D||this,null,E,false);}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){this.fireEvent("loadexception",this,o,response,e);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}
+this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){}});
+//Roo/data/ScriptTagProxy.js
+Roo.data.ScriptTagProxy=function(A){Roo.data.ScriptTagProxy.superclass.constructor.call(this);Roo.apply(this,A);this.head=document.getElementsByTagName("head")[0];};Roo.data.ScriptTagProxy.TRANS_ID=1000;Roo.extend(Roo.data.ScriptTagProxy,Roo.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var p=Roo.urlEncode(Roo.apply(A,this.extraParams));var F=this.url;F+=(F.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){F+="&_dc="+(new Date().getTime());}var G=++Roo.data.ScriptTagProxy.TRANS_ID;var H={id:G,cb:"stcCallback"+G,scriptId:"stcScript"+G,params:A,arg:E,url:F,callback:C,scope:D,reader:B};var I=this;window[H.cb]=function(o){I.handleResponse(o,H);};F+=String.format("&{0}={1}",this.callbackParam,H.cb);if(this.autoAbort!==false){this.abort();}
+H.timeoutId=this.handleFailure.defer(this.timeout,this,[H]);var J=document.createElement("script");J.setAttribute("src",F);J.setAttribute("type","text/javascript");J.setAttribute("id",H.scriptId);this.head.appendChild(J);this.trans=H;}else {C.call(D||this,null,E,false);}},isLoading:function(){return this.trans?true:false;},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans);}},destroyTrans:function(A,B){this.head.removeChild(document.getElementById(A.scriptId));clearTimeout(A.timeoutId);if(B){window[A.cb]=undefined;try{delete window[A.cb];}catch(e){}}else {window[A.cb]=function(){window[A.cb]=undefined;try{delete window[A.cb];}catch(e){}};}},handleResponse:function(o,A){this.trans=false;this.destroyTrans(A,true);var B;try{B=A.reader.readRecords(o);}catch(e){this.fireEvent("loadexception",this,o,trans.arg,e);trans.callback.call(trans.scope||window,null,trans.arg,false);return;}
+this.fireEvent("load",this,o,A.arg);A.callback.call(A.scope||window,B,A.arg,true);},handleFailure:function(A){this.trans=false;this.destroyTrans(A,false);this.fireEvent("loadexception",this,null,A.arg);A.callback.call(A.scope||window,null,A.arg,false);}});
+//Roo/data/JsonReader.js
+Roo.data.JsonReader=function(A,B){A=A||{};Roo.applyIf(A,{totalProperty:'total',successProperty:'success',root:'data',id:'id'});Roo.data.JsonReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.JsonReader,Roo.data.DataReader,{metaFromRemote:false,read:function(A){var B=A.responseText;var o=eval("("+B+")");if(!o){throw {message:"JsonReader.read: Json object not found"};}if(o.metaData){delete this.ef;this.metaFromRemote=true;this.meta=o.metaData;this.recordType=Roo.data.Record.create(o.metaData.fields);this.onMetaChange(this.meta,this.recordType,o);}return this.readRecords(o);},onMetaChange:function(A,B,o){},simpleAccess:function(A,B){return A[B];},getJsonAccessor:function(){var re=/[\[\.]/;return function(A){try{return (re.test(A))?new Function("obj","return obj."+A):function(B){return B[A];};}catch(e){}return Roo.emptyFn;};}(),readRecords:function(o){this.jsonData=o;var s=this.meta,A=this.recordType,f=A.prototype.fields,fi=f.items,fl=f.length;if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);}if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);}
+this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(I){var r=g(I);return (r===undefined||r==="")?null:r;};}else {this.getId=function(){return null;};}
+this.ef=[];for(var jj=0;jj<fl;jj++){f=fi[jj];var B=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[jj]=this.getJsonAccessor(B);}}var C=this.getRoot(o),c=C.length,D=c,E=true;if(s.totalProperty){var vt=parseInt(this.getTotal(o),10);if(!isNaN(vt)){D=vt;}}if(s.successProperty){var vs=this.getSuccess(o);if(vs===false||vs==='false'){E=false;}}var F=[];for(var i=0;i<c;i++){var n=C[i];var G={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);if(!f.convert){Roo.log('missing convert for '+f.name);Roo.log(f);continue;}
+G[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var H=new A(G,id);H.json=n;F[i]=H;}return {success:E,records:F,totalRecords:D};}});
+//Roo/data/XmlReader.js
+Roo.data.XmlReader=function(A,B){A=A||{};Roo.data.XmlReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.XmlReader,Roo.data.DataReader,{read:function(A){var B=A.responseXML;if(!B){throw {message:"XmlReader.read: XML Document not available"};}return this.readRecords(B);},readRecords:function(A){this.xmlData=A;var B=A.documentElement||A;var q=Roo.DomQuery;var C=this.recordType,D=C.prototype.fields;var E=this.meta.id;var F=0,G=true;if(this.meta.totalRecords){F=q.selectNumber(this.meta.totalRecords,B,0);}if(this.meta.success){var sv=q.selectValue(this.meta.success,B,true);G=sv!==false&&sv!=='false';}var H=[];var ns=q.select(this.meta.record,B);for(var i=0,I=ns.length;i<I;i++){var n=ns[i];var J={};var id=E?q.selectValue(E,n):undefined;for(var j=0,K=D.length;j<K;j++){var f=D.items[j];var v=q.selectValue(f.mapping||f.name,n,f.defaultValue);v=f.convert(v);J[f.name]=v;}var L=new C(J,id);L.node=n;H[H.length]=L;}return {success:G,records:H,totalRecords:F||H.length};}});
+//Roo/data/ArrayReader.js
+Roo.data.ArrayReader=function(A,B){Roo.data.ArrayReader.superclass.constructor.call(this,A,B);};Roo.extend(Roo.data.ArrayReader,Roo.data.JsonReader,{readRecords:function(o){var A=this.meta?this.meta.id:null;var B=this.recordType,C=B.prototype.fields;var D=[];var E=o;for(var i=0;i<E.length;i++){var n=E[i];var F={};var id=((A||A===0)&&n[A]!==undefined&&n[A]!==""?n[A]:null);for(var j=0,G=C.length;j<G;j++){var f=C.items[j];var k=f.mapping!==undefined&&f.mapping!==null?f.mapping:j;var v=n[k]!==undefined?n[k]:f.defaultValue;v=f.convert(v);F[f.name]=v;}var H=new B(F,id);H.json=n;D[D.length]=H;}return {records:D,totalRecords:D.length};}});
+//Roo/data/Tree.js
+Roo.data.Tree=function(A){this.nodeHash={};this.root=null;if(A){this.setRootNode(A);}
+this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true});Roo.data.Tree.superclass.constructor.call(this);};Roo.extend(Roo.data.Tree,Roo.util.Observable,{pathSeparator:"/",proxyNodeEvent:function(){return this.fireEvent.apply(this,arguments);},getRootNode:function(){return this.root;},setRootNode:function(A){this.root=A;A.ownerTree=this;A.isRoot=true;this.registerNode(A);return A;},getNodeById:function(id){return this.nodeHash[id];},registerNode:function(A){this.nodeHash[A.id]=A;},unregisterNode:function(A){delete this.nodeHash[A.id];},toString:function(){return "[Tree"+(this.id?" "+this.id:"")+"]";}});Roo.data.Node=function(A){this.attributes=A||{};this.leaf=this.attributes.leaf;this.id=this.attributes.id;if(!this.id){this.id=Roo.id(null,"ynode-");this.attributes.id=this.id;}
+this.childNodes=[];if(!this.childNodes.indexOf){this.childNodes.indexOf=function(o){for(var i=0,B=this.length;i<B;i++){if(this[i]==o){return i;}}return -1;};}
+this.parentNode=null;this.firstChild=null;this.lastChild=null;this.previousSibling=null;this.nextSibling=null;this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true});this.listeners=this.attributes.listeners;Roo.data.Node.superclass.constructor.call(this);};Roo.extend(Roo.data.Node,Roo.util.Observable,{fireEvent:function(A){if(Roo.data.Node.superclass.fireEvent.apply(this,arguments)===false){return false;}var ot=this.getOwnerTree();if(ot){if(ot.proxyNodeEvent.apply(ot,arguments)===false){return false;}}return true;},isLeaf:function(){return this.leaf===true;},setFirstChild:function(A){this.firstChild=A;},setLastChild:function(A){this.lastChild=A;},isLast:function(){return (!this.parentNode?true:this.parentNode.lastChild==this);},isFirst:function(){return (!this.parentNode?true:this.parentNode.firstChild==this);},hasChildNodes:function(){return !this.isLeaf()&&this.childNodes.length>0;},appendChild:function(A){var B=false;if(A instanceof Array){B=A;}else if(arguments.length>1){B=arguments;}if(B){for(var i=0,C=B.length;i<C;i++){this.appendChild(B[i]);}}else {if(this.fireEvent("beforeappend",this.ownerTree,this,A)===false){return false;}var D=this.childNodes.length;var E=A.parentNode;if(E){if(A.fireEvent("beforemove",A.getOwnerTree(),A,E,this,D)===false){return false;}
+E.removeChild(A);}
+D=this.childNodes.length;if(D==0){this.setFirstChild(A);}
+this.childNodes.push(A);A.parentNode=this;var ps=this.childNodes[D-1];if(ps){A.previousSibling=ps;ps.nextSibling=A;}else {A.previousSibling=null;}
+A.nextSibling=null;this.setLastChild(A);A.setOwnerTree(this.getOwnerTree());this.fireEvent("append",this.ownerTree,this,A,D);if(E){A.fireEvent("move",this.ownerTree,A,E,this,D);}return A;}},removeChild:function(A){var B=this.childNodes.indexOf(A);if(B==-1){return false;}if(this.fireEvent("beforeremove",this.ownerTree,this,A)===false){return false;}
+this.childNodes.splice(B,1);if(A.previousSibling){A.previousSibling.nextSibling=A.nextSibling;}if(A.nextSibling){A.nextSibling.previousSibling=A.previousSibling;}if(this.firstChild==A){this.setFirstChild(A.nextSibling);}if(this.lastChild==A){this.setLastChild(A.previousSibling);}
+A.setOwnerTree(null);A.parentNode=null;A.previousSibling=null;A.nextSibling=null;this.fireEvent("remove",this.ownerTree,this,A);return A;},insertBefore:function(A,B){if(!B){return this.appendChild(A);}if(A==B){return false;}if(this.fireEvent("beforeinsert",this.ownerTree,this,A,B)===false){return false;}var C=this.childNodes.indexOf(B);var D=A.parentNode;var E=C;if(D==this&&this.childNodes.indexOf(A)<C){E--;}if(D){if(A.fireEvent("beforemove",A.getOwnerTree(),A,D,this,C,B)===false){return false;}
+D.removeChild(A);}if(E==0){this.setFirstChild(A);}
+this.childNodes.splice(E,0,A);A.parentNode=this;var ps=this.childNodes[E-1];if(ps){A.previousSibling=ps;ps.nextSibling=A;}else {A.previousSibling=null;}
+A.nextSibling=B;B.previousSibling=A;A.setOwnerTree(this.getOwnerTree());this.fireEvent("insert",this.ownerTree,this,A,B);if(D){A.fireEvent("move",this.ownerTree,A,D,this,E,B);}return A;},item:function(A){return this.childNodes[A];},replaceChild:function(A,B){this.insertBefore(A,B);this.removeChild(B);return B;},indexOf:function(A){return this.childNodes.indexOf(A);},getOwnerTree:function(){if(!this.ownerTree){var p=this;while(p){if(p.ownerTree){this.ownerTree=p.ownerTree;break;}
+p=p.parentNode;}}return this.ownerTree;},getDepth:function(){var A=0;var p=this;while(p.parentNode){++A;p=p.parentNode;}return A;},setOwnerTree:function(A){if(A!=this.ownerTree){if(this.ownerTree){this.ownerTree.unregisterNode(this);}
+this.ownerTree=A;var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].setOwnerTree(A);}if(A){A.registerNode(this);}}},getPath:function(A){A=A||"id";var p=this.parentNode;var b=[this.attributes[A]];while(p){b.unshift(p.attributes[A]);p=p.parentNode;}var B=this.getOwnerTree().pathSeparator;return B+b.join(B);},bubble:function(fn,A,B){var p=this;while(p){if(fn.call(A||p,B||p)===false){break;}
+p=p.parentNode;}},cascade:function(fn,A,B){if(fn.call(A||this,B||this)!==false){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].cascade(fn,A,B);}}},eachChild:function(fn,A,B){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){if(fn.call(A||this,B||cs[i])===false){break;}}},findChild:function(A,B){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){if(cs[i].attributes[A]==B){return cs[i];}}return null;},findChildBy:function(fn,A){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){if(fn.call(A||cs[i],cs[i])===true){return cs[i];}}return null;},sort:function(fn,A){var cs=this.childNodes;var B=cs.length;if(B>0){var C=A?function(){fn.apply(A,arguments);}:fn;cs.sort(C);for(var i=0;i<B;i++){var n=cs[i];n.previousSibling=cs[i-1];n.nextSibling=cs[i+1];if(i==0){this.setFirstChild(n);}if(i==B-1){this.setLastChild(n);}}}},contains:function(A){return A.isAncestor(this);},isAncestor:function(A){var p=this.parentNode;while(p){if(p==A){return true;}
+p=p.parentNode;}return false;},toString:function(){return "[Node"+(this.id?" "+this.id:"")+"]";}});
+//Roo/ComponentMgr.js
+Roo.ComponentMgr=function(){var A=new Roo.util.MixedCollection();return {register:function(c){A.add(c);},unregister:function(c){A.remove(c);},get:function(id){return A.get(id);},onAvailable:function(id,fn,B){A.on("add",function(C,o){if(o.id==id){fn.call(B||o,o);A.un("add",fn,B);}});}};}();
+//Roo/Component.js
+Roo.Component=function(A){A=A||{};if(A.tagName||A.dom||typeof A=="string"){A={el:A,id:A.id||A};}
+this.initialConfig=A;Roo.apply(this,A);this.addEvents({disable:true,enable:true,beforeshow:true,show:true,beforehide:true,hide:true,beforerender:true,render:true,beforedestroy:true,destroy:true});if(!this.id){this.id="ext-comp-"+(++Roo.Component.AUTO_ID);}
+Roo.ComponentMgr.register(this);Roo.Component.superclass.constructor.call(this);this.initComponent();if(this.renderTo){this.render(this.renderTo);delete this.renderTo;}};Roo.Component.AUTO_ID=1000;Roo.extend(Roo.Component,Roo.util.Observable,{hidden:false,disabled:false,rendered:false,disabledClass:"x-item-disabled",allowDomMove:true,hideMode:'display',ctype:"Roo.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initComponent:Roo.emptyFn,render:function(A,B){if(!this.rendered&&this.fireEvent("beforerender",this)!==false){if(!A&&this.el){this.el=Roo.get(this.el);A=this.el.dom.parentNode;this.allowDomMove=false;}
+this.container=Roo.get(A);this.rendered=true;if(B!==undefined){if(typeof B=='number'){B=this.container.dom.childNodes[B];}else {B=Roo.getDom(B);}}
+this.onRender(this.container,B||null);if(this.cls){this.el.addClass(this.cls);delete this.cls;}if(this.style){this.el.applyStyles(this.style);delete this.style;}
+this.fireEvent("render",this);this.afterRender(this.container);if(this.hidden){this.hide();}if(this.disabled){this.disable();}}return this;},onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);if(this.allowDomMove!==false){ct.dom.insertBefore(this.el.dom,A);}}},getAutoCreate:function(){var A=typeof this.autoCreate=="object"?this.autoCreate:Roo.apply({},this.defaultAutoCreate);if(this.id&&!A.id){A.id=this.id;}return A;},afterRender:Roo.emptyFn,destroy:function(){if(this.fireEvent("beforedestroy",this)!==false){this.purgeListeners();this.beforeDestroy();if(this.rendered){this.el.removeAllListeners();this.el.remove();if(this.actionMode=="container"){this.container.remove();}}
+this.onDestroy();Roo.ComponentMgr.unregister(this);this.fireEvent("destroy",this);}},beforeDestroy:function(){},onDestroy:function(){},getEl:function(){return this.el;},getId:function(){return this.id;},focus:function(A){if(this.rendered){this.el.focus();if(A===true){this.el.dom.select();}}return this;},blur:function(){if(this.rendered){this.el.blur();}return this;},disable:function(){if(this.rendered){this.onDisable();}
+this.disabled=true;this.fireEvent("disable",this);return this;},onDisable:function(){this.getActionEl().addClass(this.disabledClass);this.el.dom.disabled=true;},enable:function(){if(this.rendered){this.onEnable();}
+this.disabled=false;this.fireEvent("enable",this);return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);this.el.dom.disabled=false;},setDisabled:function(A){this[A?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;if(this.rendered){this.onShow();}
+this.fireEvent("show",this);}return this;},onShow:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="visible";}else if(this.hideMode=='offsets'){ae.removeClass('x-hidden');}else {ae.dom.style.display="";}},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;if(this.rendered){this.onHide();}
+this.fireEvent("hide",this);}return this;},onHide:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="hidden";}else if(this.hideMode=='offsets'){ae.addClass('x-hidden');}else {ae.dom.style.display="none";}},setVisible:function(A){if(A){this.show();}else {this.hide();}return this;},isVisible:function(){return this.getActionEl().isVisible();},cloneConfig:function(A){A=A||{};var id=A.id||Roo.id();var B=Roo.applyIf(A,this.initialConfig);B.id=id;return new this.constructor(B);}});
+//Roo/Layer.js
+(function(){Roo.Layer=function(C,D){C=C||{};var dh=Roo.DomHelper;var cp=C.parentEl,E=cp?Roo.getDom(cp):document.body;if(D){this.dom=Roo.getDom(D);}if(!this.dom){var o=C.dh||{tag:"div",cls:"x-layer"};this.dom=dh.append(E,o);}if(C.cls){this.addClass(C.cls);}
+this.constrain=C.constrain!==false;this.visibilityMode=Roo.Element.VISIBILITY;if(C.id){this.id=this.dom.id=C.id;}else {this.id=Roo.id(this.dom);}
+this.zindex=C.zindex||this.getZIndex();this.position("absolute",this.zindex);if(C.shadow){this.shadowOffset=C.shadowOffset||4;this.shadow=new Roo.Shadow({offset:this.shadowOffset,mode:C.shadow});}else {this.shadowOffset=0;}
+this.useShim=C.shim!==false&&Roo.useShims;this.useDisplay=C.useDisplay;this.hide();};var A=Roo.Element.prototype;var B=[];Roo.extend(Roo.Layer,Roo.Element,{getZIndex:function(){return this.zindex||parseInt(this.getStyle("z-index"),10)||11000;},getShim:function(){if(!this.useShim){return null;}if(this.shim){return this.shim;}var C=B.shift();if(!C){C=this.createShim();C.enableDisplayMode('block');C.dom.style.display='none';C.dom.style.visibility='visible';}var pn=this.dom.parentNode;if(C.dom.parentNode!=pn){pn.insertBefore(C.dom,this.dom);}
+C.setStyle('z-index',this.getZIndex()-2);this.shim=C;return C;},hideShim:function(){if(this.shim){this.shim.setDisplayed(false);B.push(this.shim);delete this.shim;}},disableShadow:function(){if(this.shadow){this.shadowDisabled=true;this.shadow.hide();this.lastShadowOffset=this.shadowOffset;this.shadowOffset=0;}},enableShadow:function(C){if(this.shadow){this.shadowDisabled=false;this.shadowOffset=this.lastShadowOffset;delete this.lastShadowOffset;if(C){this.sync(true);}}},sync:function(C){var sw=this.shadow;if(!this.updating&&this.isVisible()&&(sw||this.useShim)){var sh=this.getShim();var w=this.getWidth(),h=this.getHeight();var l=this.getLeft(true),t=this.getTop(true);if(sw&&!this.shadowDisabled){if(C&&!sw.isVisible()){sw.show(this);}else {sw.realign(l,t,w,h);}if(sh){if(C){sh.show();}var a=sw.adjusts,s=sh.dom.style;s.left=(Math.min(l,l+a.l))+"px";s.top=(Math.min(t,t+a.t))+"px";s.width=(w+a.w)+"px";s.height=(h+a.h)+"px";}}else if(sh){if(C){sh.show();}
+sh.setSize(w,h);sh.setLeftTop(l,t);}}},destroy:function(){this.hideShim();if(this.shadow){this.shadow.hide();}
+this.removeAllListeners();var pn=this.dom.parentNode;if(pn){pn.removeChild(this.dom);}
+Roo.Element.uncache(this.id);},remove:function(){this.destroy();},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.sync(true);},hideUnders:function(C){if(this.shadow){this.shadow.hide();}
+this.hideShim();},constrainXY:function(){if(this.constrain){var vw=Roo.lib.Dom.getViewWidth(),vh=Roo.lib.Dom.getViewHeight();var s=Roo.get(document).getScroll();var xy=this.getXY();var x=xy[0],y=xy[1];var w=this.dom.offsetWidth+this.shadowOffset,h=this.dom.offsetHeight+this.shadowOffset;var C=false;if((x+w)>vw+s.left){x=vw-w-this.shadowOffset;C=true;}if((y+h)>vh+s.top){y=vh-h-this.shadowOffset;C=true;}if(x<s.left){x=s.left;C=true;}if(y<s.top){y=s.top;C=true;}if(C){if(this.avoidY){var ay=this.avoidY;if(y<=ay&&(y+h)>=ay){y=ay-h-5;}}
+xy=[x,y];this.storeXY(xy);A.setXY.call(this,xy);this.sync();}}},isVisible:function(){return this.visible;},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("");}else if(this.lastXY){A.setXY.call(this,this.lastXY);}else if(this.lastLT){A.setLeftTop.call(this,this.lastLT[0],this.lastLT[1]);}},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false);}else {this.setLeftTop(-10000,-10000);}},setVisible:function(v,a,d,c,e){if(v){this.showAction();}if(a&&v){var cb=function(){this.sync(true);if(c){c();}}.createDelegate(this);A.setVisible.call(this,true,true,d,cb,e);}else {if(!v){this.hideUnders(true);}var cb=c;if(a){cb=function(){this.hideAction();if(c){c();}}.createDelegate(this);}
+A.setVisible.call(this,v,a,d,cb,e);if(v){this.sync(true);}else if(!a){this.hideAction();}}},storeXY:function(xy){delete this.lastLT;this.lastXY=xy;},storeLeftTop:function(C,D){delete this.lastXY;this.lastLT=[C,D];},beforeFx:function(){this.beforeAction();return Roo.Layer.superclass.beforeFx.apply(this,arguments);},afterFx:function(){Roo.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible());},beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide();}},setLeft:function(C){this.storeLeftTop(C,this.getTop(true));A.setLeft.apply(this,arguments);this.sync();},setTop:function(C){this.storeLeftTop(this.getLeft(true),C);A.setTop.apply(this,arguments);this.sync();},setLeftTop:function(C,D){this.storeLeftTop(C,D);A.setLeftTop.apply(this,arguments);this.sync();},setXY:function(xy,a,d,c,e){this.fixDisplay();this.beforeAction();this.storeXY(xy);var cb=this.createCB(c);A.setXY.call(this,xy,a,d,cb,e);if(!a){cb();}},createCB:function(c){var el=this;return function(){el.constrainXY();el.sync(true);if(c){c();}};},setX:function(x,a,d,c,e){this.setXY([x,this.getY()],a,d,c,e);},setY:function(y,a,d,c,e){this.setXY([this.getX(),y],a,d,c,e);},setSize:function(w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setSize.call(this,w,h,a,d,cb,e);if(!a){cb();}},setWidth:function(w,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setWidth.call(this,w,a,d,cb,e);if(!a){cb();}},setHeight:function(h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setHeight.call(this,h,a,d,cb,e);if(!a){cb();}},setBounds:function(x,y,w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);if(!a){this.storeXY([x,y]);A.setXY.call(this,[x,y]);A.setSize.call(this,w,h,a,d,cb,e);cb();}else {A.setBounds.call(this,x,y,w,h,a,d,cb,e);}return this;},setZIndex:function(C){this.zindex=C;this.setStyle("z-index",C+2);if(this.shadow){this.shadow.setZIndex(C+1);}if(this.shim){this.shim.setStyle("z-index",C);}}});})();
+//Roo/Shadow.js
+Roo.Shadow=function(A){Roo.apply(this,A);if(typeof this.mode!="string"){this.mode=this.defaultMode;}var o=this.offset,a={h:0};var B=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case "drop":a.w=0;a.l=a.t=o;a.t-=1;if(Roo.isIE){a.l-=this.offset+B;a.t-=this.offset+B;a.w-=B;a.h-=B;a.t+=1;}break;case "sides":a.w=(o*2);a.l=-o;a.t=o-1;if(Roo.isIE){a.l-=(this.offset-B);a.t-=this.offset+B;a.l+=1;a.w-=(this.offset-B)*2;a.w-=B+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(Roo.isIE){a.l-=(this.offset-B);a.t-=(this.offset-B);a.l+=1;a.w-=(this.offset+B+1);a.h-=(this.offset+B);a.h+=1;}break;};this.adjusts=a;};Roo.Shadow.prototype={offset:4,defaultMode:"drop",show:function(A){A=Roo.get(A);if(!this.el){this.el=Roo.Shadow.Pool.pull();if(this.el.dom.nextSibling!=A.dom){this.el.insertBefore(A);}}
+this.el.setStyle("z-index",this.zIndex||parseInt(A.getStyle("z-index"),10)-1);if(Roo.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";}
+this.realign(A.getLeft(true),A.getTop(true),A.getWidth(),A.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 A=0;s.left=(l+a.l)+"px";s.top=(t+a.t)+"px";var sw=(w+a.w),sh=(h+a.h),B=sw+"px",C=sh+"px";if(s.width!=B||s.height!=C){s.width=B;s.height=C;if(!Roo.isIE){var cn=d.childNodes;var D=Math.max(0,(sw-12))+"px";cn[0].childNodes[1].style.width=D;cn[1].childNodes[1].style.width=D;cn[2].childNodes[1].style.width=D;cn[1].style.height=Math.max(0,(sh-12))+"px";}}},hide:function(){if(this.el){this.el.dom.style.display="none";Roo.Shadow.Pool.push(this.el);delete this.el;}},setZIndex:function(z){this.zIndex=z;if(this.el){this.el.setStyle("z-index",z);}}};Roo.Shadow.Pool=function(){var p=[];var A=Roo.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=Roo.get(Roo.DomHelper.insertHtml("beforeBegin",document.body.firstChild,A));sh.autoBoxAdjust=false;}return sh;},push:function(sh){p.push(sh);}};}();
+//Roo/BoxComponent.js
+Roo.BoxComponent=function(A){Roo.Component.call(this,A);this.addEvents({resize:true,move:true});};Roo.extend(Roo.BoxComponent,Roo.Component,{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 A=this.adjustSize(w,h);var aw=A.width,ah=A.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;},getSize:function(){return this.el.getSize();},getPosition:function(A){if(A===true){return [this.el.getLeft(true),this.el.getTop(true)];}return this.xy||this.el.getXY();},getBox:function(A){var s=this.el.getSize();if(A){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(A){this.setSize(A.width,A.height);this.setPagePosition(A.x,A.y);return this;},getResizeEl:function(){return this.resizeEl||this.el;},getPositionEl:function(){return this.positionEl||this.el;},setPosition:function(x,y){this.x=x;this.y=y;if(!this.boxReady){return this;}var A=this.adjustPosition(x,y);var ax=A.x,ay=A.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){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,A){Roo.BoxComponent.superclass.onRender.call(this,ct,A);if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl);}if(this.positionEl){this.positionEl=Roo.get(this.positionEl);}},afterRender:function(){Roo.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);}if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY);}},syncSize:function(){delete this.lastSize;this.setSize(this.el.getWidth(),this.el.getHeight());return this;},onResize:function(A,B,C,D){},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};}});
+//Roo/SplitBar.js
+Roo.SplitBar=function(A,B,C,D,E){this.el=Roo.get(A,true);this.el.dom.unselectable="on";this.resizingEl=Roo.get(B,true);this.orientation=C||Roo.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!E){this.proxy=Roo.SplitBar.createProxy(this.orientation);}else {this.proxy=Roo.get(E).dom;}
+this.dd=new Roo.dd.DDProxy(this.el.dom.id,"XSplitBars",{dragElId:this.proxy.id});this.dd.b4StartDrag=this.onStartProxyDrag.createDelegate(this);this.dd.endDrag=this.onEndProxyDrag.createDelegate(this);this.dragSpecs={};this.adapter=new Roo.SplitBar.BasicLayoutAdapter();this.adapter.init(this);if(this.orientation==Roo.SplitBar.HORIZONTAL){this.placement=D||(this.el.getX()>this.resizingEl.getX()?Roo.SplitBar.LEFT:Roo.SplitBar.RIGHT);this.el.addClass("x-splitbar-h");}else {this.placement=D||(this.el.getY()>this.resizingEl.getY()?Roo.SplitBar.TOP:Roo.SplitBar.BOTTOM);this.el.addClass("x-splitbar-v");}
+this.addEvents({"resize":true,"moved":true,"beforeresize":true,"beforeapply":true});Roo.util.Observable.call(this);};Roo.extend(Roo.SplitBar,Roo.util.Observable,{onStartProxyDrag:function(x,y){this.fireEvent("beforeresize",this);if(!this.overlay){var o=Roo.DomHelper.insertFirst(document.body,{cls:"x-drag-overlay",html:"&#160;"},true);o.unselectable();o.enableDisplayMode("block");Roo.SplitBar.prototype.overlay=o;}
+this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.overlay.show();Roo.get(this.proxy).setDisplayed("block");var A=this.adapter.getElementSize(this);this.activeMinSize=this.getMinimumSize();;this.activeMaxSize=this.getMaximumSize();;var c1=A-this.activeMinSize;var c2=Math.max(this.activeMaxSize-A,0);if(this.orientation==Roo.SplitBar.HORIZONTAL){this.dd.resetConstraints();this.dd.setXConstraint(this.placement==Roo.SplitBar.LEFT?c1:c2,this.placement==Roo.SplitBar.LEFT?c2:c1);this.dd.setYConstraint(0,0);}else {this.dd.resetConstraints();this.dd.setXConstraint(0,0);this.dd.setYConstraint(this.placement==Roo.SplitBar.TOP?c1:c2,this.placement==Roo.SplitBar.TOP?c2:c1);}
+this.dragSpecs.startSize=A;this.dragSpecs.startPoint=[x,y];Roo.dd.DDProxy.prototype.b4StartDrag.call(this.dd,x,y);},onEndProxyDrag:function(e){Roo.get(this.proxy).setDisplayed(false);var A=Roo.lib.Event.getXY(e);if(this.overlay){this.overlay.hide();}var B;if(this.orientation==Roo.SplitBar.HORIZONTAL){B=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.LEFT?A[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-A[0]);}else {B=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.TOP?A[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-A[1]);}
+B=Math.min(Math.max(B,this.activeMinSize),this.activeMaxSize);if(B!=this.dragSpecs.startSize){if(this.fireEvent('beforeapply',this,B)!==false){this.adapter.setElementSize(this,B);this.fireEvent("moved",this,B);this.fireEvent("resize",this,B);}}},getAdapter:function(){return this.adapter;},setAdapter:function(A){this.adapter=A;this.adapter.init(this);},getMinimumSize:function(){return this.minSize;},setMinimumSize:function(A){this.minSize=A;},getMaximumSize:function(){return this.maxSize;},setMaximumSize:function(A){this.maxSize=A;},setCurrentSize:function(A){var B=this.animate;this.animate=false;this.adapter.setElementSize(this,A);this.animate=B;},destroy:function(A){if(this.shim){this.shim.remove();}
+this.dd.unreg();this.proxy.parentNode.removeChild(this.proxy);if(A){this.el.remove();}}});Roo.SplitBar.createProxy=function(A){var B=new Roo.Element(document.createElement("div"));B.unselectable();var C='x-splitbar-proxy';B.addClass(C+' '+(A==Roo.SplitBar.HORIZONTAL?C+'-h':C+'-v'));document.body.appendChild(B.dom);return B.dom;};Roo.SplitBar.BasicLayoutAdapter=function(){};Roo.SplitBar.BasicLayoutAdapter.prototype={init:function(s){},getElementSize:function(s){if(s.orientation==Roo.SplitBar.HORIZONTAL){return s.resizingEl.getWidth();}else {return s.resizingEl.getHeight();}},setElementSize:function(s,A,B){if(s.orientation==Roo.SplitBar.HORIZONTAL){if(!s.animate){s.resizingEl.setWidth(A);if(B){B(s,A);}}else {s.resizingEl.setWidth(A,true,.1,B,'easeOut');}}else {if(!s.animate){s.resizingEl.setHeight(A);if(B){B(s,A);}}else {s.resizingEl.setHeight(A,true,.1,B,'easeOut');}}}};Roo.SplitBar.AbsoluteLayoutAdapter=function(A){this.basic=new Roo.SplitBar.BasicLayoutAdapter();this.container=Roo.get(A);};Roo.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(s){this.basic.init(s);},getElementSize:function(s){return this.basic.getElementSize(s);},setElementSize:function(s,A,B){this.basic.setElementSize(s,A,this.moveSplitter.createDelegate(this,[s]));},moveSplitter:function(s){var A=Roo.SplitBar;switch(s.placement){case A.LEFT:s.el.setX(s.resizingEl.getRight());break;case A.RIGHT:s.el.setStyle("right",(this.container.getWidth()-s.resizingEl.getLeft())+"px");break;case A.TOP:s.el.setY(s.resizingEl.getBottom());break;case A.BOTTOM:s.el.setY(s.resizingEl.getTop()-s.el.getHeight());break;}}};Roo.SplitBar.VERTICAL=1;Roo.SplitBar.HORIZONTAL=2;Roo.SplitBar.LEFT=1;Roo.SplitBar.RIGHT=2;Roo.SplitBar.TOP=3;Roo.SplitBar.BOTTOM=4;
+//Roo/View.js
+Roo.View=function(A,B,C){if(typeof(B)=='undefined'){Roo.apply(this,A);this.el=Roo.get(this.el);}else {this.el=Roo.get(A);this.tpl=B;Roo.apply(this,C);}if(typeof(this.tpl)=="string"){this.tpl=new Roo.Template(this.tpl);}else {this.tpl=new Roo.factory(this.tpl,Roo);}
+this.tpl.compile();this.addEvents({"beforeclick":true,"click":true,"dblclick":true,"contextmenu":true,"selectionchange":true,"beforeselect":true,"preparedata":true});this.el.on({"click":this.onClick,"dblclick":this.onDblClick,"contextmenu":this.onContextMenu,scope:this});this.selections=[];this.nodes=[];this.cmp=new Roo.CompositeElementLite([]);if(this.store){this.store=Roo.factory(this.store,Roo.data);this.setStore(this.store,true);}
+Roo.View.superclass.constructor.call(this);};Roo.extend(Roo.View,Roo.util.Observable,{store:false,el:'',tpl:false,selectedClass:"x-view-selected",emptyText:"",multiSelect:false,singleSelect:false,toggleSelect:false,getEl:function(){return this.el;},refresh:function(){var t=this.tpl;this.clearSelections();this.el.update("");var A=[];var B=this.store.getRange();if(B.length<1){this.el.update(this.emptyText);return;}for(var i=0,C=B.length;i<C;i++){var D=this.prepareData(B[i].data,i,B[i]);this.fireEvent("preparedata",this,D,i,B[i]);A[A.length]=t.apply(D);}
+this.el.update(A.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0);},prepareData:function(A){return A;},onUpdate:function(ds,A){this.clearSelections();var B=this.store.indexOf(A);var n=this.nodes[B];this.tpl.insertBefore(n,this.prepareData(A.data));n.parentNode.removeChild(n);this.updateIndexes(B,B);},onAdd:function(ds,A,B){this.clearSelections();if(this.nodes.length==0){this.refresh();return;}var n=this.nodes[B];for(var i=0,C=A.length;i<C;i++){var d=this.prepareData(A[i].data);if(n){this.tpl.insertBefore(n,d);}else {this.tpl.append(this.el,d);}}
+this.updateIndexes(B);},onRemove:function(ds,A,B){this.clearSelections();this.el.dom.removeChild(this.nodes[B]);this.updateIndexes(B);},refreshNode:function(A){this.onUpdate(this.store,this.store.getAt(A));},updateIndexes:function(A,B){var ns=this.nodes;A=A||0;B=B||ns.length-1;for(var i=A;i<=B;i++){ns[i].nodeIndex=i;}},setStore:function(A,B){if(!B&&this.store){this.store.un("datachanged",this.refresh);this.store.un("add",this.onAdd);this.store.un("remove",this.onRemove);this.store.un("update",this.onUpdate);this.store.un("clear",this.refresh);}if(A){A.on("datachanged",this.refresh,this);A.on("add",this.onAdd,this);A.on("remove",this.onRemove,this);A.on("update",this.onUpdate,this);A.on("clear",this.refresh,this);}if(A){this.refresh();}},findItemFromChild:function(A){var el=this.el.dom;if(!A||A.parentNode==el){return A;}var p=A.parentNode;while(p&&p!=el){if(p.parentNode==el){return p;}
+p=p.parentNode;}return null;},onClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){var B=this.indexOf(A);if(this.onItemClick(A,B,e)!==false){this.fireEvent("click",this,B,A,e);}}else {this.clearSelections();}},onContextMenu:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.fireEvent("contextmenu",this,this.indexOf(A),A,e);}},onDblClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.fireEvent("dblclick",this,this.indexOf(A),A,e);}},onItemClick:function(A,B,e){if(this.fireEvent("beforeclick",this,B,A,e)===false){return false;}if(this.toggleSelect){var m=this.isSelected(A)?'unselect':'select';Roo.log(m);var _t=this;_t[m](A,true,false);return true;}if(this.multiSelect||this.singleSelect){if(this.multiSelect&&e.shiftKey&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),B),false);}else {this.select(A,this.multiSelect&&e.ctrlKey);this.lastSelection=A;}
+e.preventDefault();}return true;},getSelectionCount:function(){return this.selections.length;},getSelectedNodes:function(){return this.selections;},getSelectedIndexes:function(){var A=[],s=this.selections;for(var i=0,B=s.length;i<B;i++){A.push(s[i].nodeIndex);}return A;},clearSelections:function(A){if(this.nodes&&(this.multiSelect||this.singleSelect)&&this.selections.length>0){this.cmp.elements=this.selections;this.cmp.removeClass(this.selectedClass);this.selections=[];if(!A){this.fireEvent("selectionchange",this,this.selections);}}},isSelected:function(A){var s=this.selections;if(s.length<1){return false;}
+A=this.getNode(A);return s.indexOf(A)!==-1;},select:function(A,B,C){if(A instanceof Array){if(!B){this.clearSelections(true);}for(var i=0,D=A.length;i<D;i++){this.select(A[i],true,true);}return;}var E=this.getNode(A);if(!E||this.isSelected(E)){return;}if(!B){this.clearSelections(true);}if(this.fireEvent("beforeselect",this,E,this.selections)!==false){Roo.fly(E).addClass(this.selectedClass);this.selections.push(E);if(!C){this.fireEvent("selectionchange",this,this.selections);}}},unselect:function(A,B,C){if(A instanceof Array){Roo.each(this.selections,function(s){this.unselect(s,A);},this);return;}var D=this.getNode(A);if(!D||!this.isSelected(D)){Roo.log("not selected");return;}var ns=[];Roo.each(this.selections,function(s){if(s==D){Roo.fly(D).removeClass(this.selectedClass);return;}
+ns.push(s);},this);this.selections=ns;this.fireEvent("selectionchange",this,this.selections);},getNode:function(A){if(typeof A=="string"){return document.getElementById(A);}else if(typeof A=="number"){return this.nodes[A];}return A;},getNodes:function(A,B){var ns=this.nodes;A=A||0;B=typeof B=="undefined"?ns.length-1:B;var C=[];if(A<=B){for(var i=A;i<=B;i++){C.push(ns[i]);}}else {for(var i=A;i>=B;i--){C.push(ns[i]);}}return C;},indexOf:function(A){A=this.getNode(A);if(typeof A.nodeIndex=="number"){return A.nodeIndex;}var ns=this.nodes;for(var i=0,B=ns.length;i<B;i++){if(ns[i]==A){return i;}}return -1;}});
+//Roo/JsonView.js
+Roo.JsonView=function(A,B,C){Roo.JsonView.superclass.constructor.call(this,A,B,C);var um=this.el.getUpdateManager();um.setRenderer(this);um.on("update",this.onLoad,this);um.on("failure",this.onLoadException,this);this.addEvents({'beforerender':true,'load':true,'loadexception':true});};Roo.extend(Roo.JsonView,Roo.View,{jsonRoot:"",refresh:function(){this.clearSelections();this.el.update("");var A=[];var o=this.jsonData;if(o&&o.length>0){for(var i=0,B=o.length;i<B;i++){var C=this.prepareData(o[i],i,o);A[A.length]=this.tpl.apply(C);}}else {A.push(this.emptyText);}
+this.el.update(A.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0);},load:function(){var um=this.el.getUpdateManager();um.update.apply(um,arguments);},render:function(el,A){this.clearSelections();this.el.update("");var o;try{o=Roo.util.JSON.decode(A.responseText);if(this.jsonRoot){o=o[this.jsonRoot];}}catch(e){}
+this.jsonData=o;this.beforeRender();this.refresh();},getCount:function(){return this.jsonData?this.jsonData.length:0;},getNodeData:function(A){if(A instanceof Array){var B=[];for(var i=0,C=A.length;i<C;i++){B.push(this.getNodeData(A[i]));}return B;}return this.jsonData[this.indexOf(A)]||null;},beforeRender:function(){this.snapshot=this.jsonData;if(this.sortInfo){this.sort.apply(this,this.sortInfo);}
+this.fireEvent("beforerender",this,this.jsonData);},onLoad:function(el,o){this.fireEvent("load",this,this.jsonData,o);},onLoadException:function(el,o){this.fireEvent("loadexception",this,o);},filter:function(A,B){if(this.jsonData){var C=[];var ss=this.snapshot;if(typeof B=="string"){var D=B.length;if(D==0){this.clearFilter();return;}
+B=B.toLowerCase();for(var i=0,E=ss.length;i<E;i++){var o=ss[i];if(o[A].substr(0,D).toLowerCase()==B){C.push(o);}}}else if(B.exec){for(var i=0,E=ss.length;i<E;i++){var o=ss[i];if(B.test(o[A])){C.push(o);}}}else {return;}
+this.jsonData=C;this.refresh();}},filterBy:function(fn,A){if(this.jsonData){var B=[];var ss=this.snapshot;for(var i=0,C=ss.length;i<C;i++){var o=ss[i];if(fn.call(A||this,o)){B.push(o);}}
+this.jsonData=B;this.refresh();}},clearFilter:function(){if(this.snapshot&&this.jsonData!=this.snapshot){this.jsonData=this.snapshot;this.refresh();}},sort:function(A,B,C){this.sortInfo=Array.prototype.slice.call(arguments,0);if(this.jsonData){var p=A;var D=B&&B.toLowerCase()=="desc";var f=function(o1,o2){var v1=C?C(o1[p]):o1[p];var v2=C?C(o2[p]):o2[p];;if(v1<v2){return D?+1:-1;}else if(v1>v2){return D?-1:+1;}else {return 0;}};this.jsonData.sort(f);this.refresh();if(this.jsonData!=this.snapshot){this.snapshot.sort(f);}}}});
+//Roo/ColorPalette.js
+Roo.ColorPalette=function(A){Roo.ColorPalette.superclass.constructor.call(this,A);this.addEvents({select:true});if(this.handler){this.on("select",this.handler,this.scope,true);}};Roo.extend(Roo.ColorPalette,Roo.Component,{itemCls:"x-color-palette",value:null,clickEvent:'click',ctype:"Roo.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(A,B){var t=new Roo.MasterTemplate('<tpl><a href="#" class="color-{0}" hidefocus="on"><em><span style="background:#{0}" unselectable="on">&#160;</span></em></a></tpl>');var c=this.colors;for(var i=0,C=c.length;i<C;i++){t.add([c[i]]);}var el=document.createElement("div");el.className=this.itemCls;t.overwrite(el);A.dom.insertBefore(el,B);this.el=Roo.get(el);this.el.on(this.clickEvent,this.handleClick,this,{delegate:"a"});if(this.clickEvent!='click'){this.el.on('click',Roo.emptyFn,this,{delegate:"a",preventDefault:true});}},afterRender:function(){Roo.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(A){A=A.replace("#","");if(A!=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-"+A).addClass("x-color-palette-sel");this.value=A;this.fireEvent("select",this,A);}}});
+//Roo/DatePicker.js
+Roo.DatePicker=function(A){Roo.DatePicker.superclass.constructor.call(this,A);this.value=A&&A.value?A.value.clearTime():new Date().clearTime();this.addEvents({'select':true,'monthchange':true});if(this.handler){this.on("select",this.handler,this.scope||this);}if(!this.disabledDatesRE&&this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|";}
+this.disabledDatesRE=new RegExp(re+")");}};Roo.extend(Roo.DatePicker,Roo.Component,{todayText:"Today",okText:"&#160;OK&#160;",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minDate:null,maxDate:null,minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDays:null,disabledDaysText:"",disabledDatesRE:null,disabledDatesText:"",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:'Next Month (Control+Right)',prevText:'Previous Month (Control+Left)',monthYearText:'Choose a month (Control+Up/Down to move years)',startDay:0,showClear:false,setValue:function(A){var B=this.value;this.value=A.clearTime(true);if(this.el){this.update(this.value);}},getValue:function(){return this.value;},focus:function(){if(this.el){this.update(this.activeDate);}},onRender:function(A,B){var m=['<table cellspacing="0">','<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>','<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];var dn=this.dayNames;for(var i=0;i<7;i++){var d=this.startDay+i;if(d>6){d=d-7;}
+m.push("<th><span>",dn[d].substr(0,1),"</span></th>");}
+m[m.length]="</tr></thead><tbody><tr>";for(var i=0;i<42;i++){if(i%7==0&&i!=0){m[m.length]="</tr><tr>";}
+m[m.length]='<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';}
+m[m.length]='</tr></tbody></table></td></tr><tr>'+'<td colspan="3" class="x-date-bottom" align="center"></td></tr></table><div class="x-date-mp"></div>';var el=document.createElement("div");el.className="x-date-picker";el.innerHTML=m.join("");A.dom.insertBefore(el,B);this.el=Roo.get(el);this.eventEl=Roo.get(el.firstChild);new Roo.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});new Roo.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true});this.eventEl.on("mousewheel",this.handleMouseWheel,this);this.monthPicker=this.el.down('div.x-date-mp');this.monthPicker.enableDisplayMode('block');var kn=new Roo.KeyNav(this.eventEl,{"left":function(e){e.ctrlKey?this.showPrevMonth():this.update(this.activeDate.add("d",-1));},"right":function(e){e.ctrlKey?this.showNextMonth():this.update(this.activeDate.add("d",1));},"up":function(e){e.ctrlKey?this.showNextYear():this.update(this.activeDate.add("d",-7));},"down":function(e){e.ctrlKey?this.showPrevYear():this.update(this.activeDate.add("d",7));},"pageUp":function(e){this.showNextMonth();},"pageDown":function(e){this.showPrevMonth();},"enter":function(e){e.stopPropagation();return true;},scope:this});this.eventEl.on("click",this.handleDateClick,this,{delegate:"a.x-date-date"});this.eventEl.addKeyListener(Roo.EventObject.SPACE,this.selectToday,this);this.el.unselectable();this.cells=this.el.select("table.x-date-inner tbody td");this.textNodes=this.el.query("table.x-date-inner tbody span");this.mbtn=new Roo.Button(this.el.child("td.x-date-middle",true),{text:"&#160;",tooltip:this.monthYearText});this.mbtn.on('click',this.showMonthPicker,this);this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");var C=(new Date()).dateFormat(this.format);var D=new Roo.Toolbar(this.el.child("td.x-date-bottom",true));if(this.showClear){D.add(new Roo.Toolbar.Fill());}
+D.add({text:String.format(this.todayText,C),tooltip:String.format(this.todayTip,C),handler:this.selectToday,scope:this});if(this.showClear){D.add(new Roo.Toolbar.Fill());D.add({text:'&#160;',cls:'x-btn-icon x-btn-clear',handler:function(){this.fireEvent("select",this,'');},scope:this});}if(Roo.isIE){this.el.repaint();}
+this.update(this.value);},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var A=['<table border="0" cellspacing="0">'];for(var i=0;i<6;i++){A.push('<tr><td class="x-date-mp-month"><a href="#">',this.monthNames[i].substr(0,3),'</a></td>','<td class="x-date-mp-month x-date-mp-sep"><a href="#">',this.monthNames[i+6].substr(0,3),'</a></td>',i==0?'<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>':'<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>');}
+A.push('<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',this.okText,'</button><button type="button" class="x-date-mp-cancel">',this.cancelText,'</button></td></tr>','</table>');this.monthPicker.update(A.join(''));this.monthPicker.on('click',this.onMonthClick,this);this.monthPicker.on('dblclick',this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select('td.x-date-mp-month');this.mpYears=this.monthPicker.select('td.x-date-mp-year');this.mpMonths.each(function(m,a,i){i+=1;if((i%2)==0){m.dom.xmonth=5+Math.round(i*.5);}else {m.dom.xmonth=Math.round((i-1)*.5);}});}},showMonthPicker:function(){this.createMonthPicker();var A=this.el.getSize();this.monthPicker.setSize(A);this.monthPicker.child('table').setSize(A);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn('t',{duration:.2});},updateMPYear:function(y){this.mpyear=y;var ys=this.mpYears.elements;for(var i=1;i<=10;i++){var td=ys[i-1],y2;if((i%2)==0){y2=y+Math.round(i*.5);td.firstChild.innerHTML=y2;td.xyear=y2;}else {y2=y-(5-Math.round(i*.5));td.firstChild.innerHTML=y2;td.xyear=y2;}
+this.mpYears.item(i-1)[y2==this.mpSelYear?'addClass':'removeClass']('x-date-mp-sel');}},updateMPMonth:function(sm){this.mpMonths.each(function(m,a,i){m[m.dom.xmonth==sm?'addClass':'removeClass']('x-date-mp-sel');});},selectMPMonth:function(m){},onMonthClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(el.is('button.x-date-mp-cancel')){this.hideMonthPicker();}else if(el.is('button.x-date-mp-ok')){this.update(new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else if(pn=el.up('td.x-date-mp-month',2)){this.mpMonths.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');this.mpSelMonth=pn.dom.xmonth;}else if(pn=el.up('td.x-date-mp-year',2)){this.mpYears.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');this.mpSelYear=pn.dom.xyear;}else if(el.is('a.x-date-mp-prev')){this.updateMPYear(this.mpyear-10);}else if(el.is('a.x-date-mp-next')){this.updateMPYear(this.mpyear+10);}},onMonthDblClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(pn=el.up('td.x-date-mp-month',2)){this.update(new Date(this.mpSelYear,pn.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else if(pn=el.up('td.x-date-mp-year',2)){this.update(new Date(pn.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}},hideMonthPicker:function(A){if(this.monthPicker){if(A===true){this.monthPicker.hide();}else {this.monthPicker.slideOut('t',{duration:.2});}}},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1));},showNextMonth:function(e){this.update(this.activeDate.add("mo",1));},showPrevYear:function(){this.update(this.activeDate.add("y",-1));},showNextYear:function(){this.update(this.activeDate.add("y",1));},handleMouseWheel:function(e){var A=e.getWheelDelta();if(A>0){this.showPrevMonth();e.stopEvent();}else if(A<0){this.showNextMonth();e.stopEvent();}},handleDateClick:function(e,t){e.stopEvent();if(t.dateValue&&!Roo.fly(t.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(t.dateValue));this.fireEvent("select",this,this.value);}},selectToday:function(){this.setValue(new Date().clearTime());this.fireEvent("select",this,this.value);},update:function(A){var vd=this.activeDate;this.activeDate=A;if(vd&&this.el){var t=A.getTime();if(vd.getMonth()==A.getMonth()&&vd.getFullYear()==A.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(c){if(c.dom.firstChild.dateValue==t){c.addClass("x-date-selected");setTimeout(function(){try{c.dom.firstChild.focus();}catch(e){}},50);return false;}});return;}}var B=A.getDaysInMonth();var C=A.getFirstDateOfMonth();var D=C.getDay()-this.startDay;if(D<=this.startDay){D+=7;}var pm=A.add("mo",-1);var E=pm.getDaysInMonth()-D;var F=this.cells.elements;var G=this.textNodes;B+=D;var H=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),E)).clearTime();var I=new Date().clearTime().getTime();var J=A.clearTime().getTime();var K=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var L=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var M=this.disabledDatesRE;var N=this.disabledDatesText;var O=this.disabledDays?this.disabledDays.join(""):false;var P=this.disabledDaysText;var Q=this.format;var R=function(U,V){V.title="";var t=d.getTime();V.firstChild.dateValue=t;if(t==I){V.className+=" x-date-today";V.title=U.todayText;}if(t==J){V.className+=" x-date-selected";setTimeout(function(){try{V.firstChild.focus();}catch(e){}},50);}if(t<K){V.className=" x-date-disabled";V.title=U.minText;return;}if(t>L){V.className=" x-date-disabled";V.title=U.maxText;return;}if(O){if(O.indexOf(d.getDay())!=-1){V.title=P;V.className=" x-date-disabled";}}if(M&&Q){var W=d.dateFormat(Q);if(M.test(W)){V.title=N.replace("%0",W);V.className=" x-date-disabled";}}};var i=0;for(;i<D;i++){G[i].innerHTML=(++E);d.setDate(d.getDate()+1);F[i].className="x-date-prevday";R(this,F[i]);}for(;i<B;i++){intDay=i-D+1;G[i].innerHTML=(intDay);d.setDate(d.getDate()+1);F[i].className="x-date-active";R(this,F[i]);}var S=0;for(;i<42;i++){G[i].innerHTML=(++S);d.setDate(d.getDate()+1);F[i].className="x-date-nextday";R(this,F[i]);}
+this.mbtn.setText(this.monthNames[A.getMonth()]+" "+A.getFullYear());this.fireEvent('monthchange',this,A);if(!this.internalRender){var T=this.el.dom.firstChild;var w=T.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Roo.fly(T).setWidth(w);this.internalRender=true;if(Roo.isOpera&&!this.secondPass){T.rows[0].cells[1].style.width=(w-(T.rows[0].cells[0].offsetWidth+T.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[A]);}}}});
+//Roo/TabPanel.js
+Roo.TabPanel=function(A,B){this.el=Roo.get(A,true);if(B){if(typeof B=="boolean"){this.tabPosition=B?"bottom":"top";}else {Roo.apply(this,B);}}if(this.tabPosition=="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-bottom");}
+this.stripWrap=Roo.get(this.createStrip(this.el.dom),true);this.stripEl=Roo.get(this.createStripList(this.stripWrap.dom),true);this.stripBody=Roo.get(this.stripWrap.dom.firstChild.firstChild,true);if(Roo.isIE){Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x","hidden");}if(this.tabPosition!="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-top");}
+this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,"beforetabchange":true});Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;if(this.toolbar){var C=this.toolbar;C.container=this.stripEl.child('td.x-tab-strip-toolbar');this.toolbar=new Roo.Toolbar(C);if(Roo.isSafari){var D=C.container.child('table',true);D.setAttribute('width','100%');}}
+Roo.TabPanel.superclass.constructor.call(this);};Roo.extend(Roo.TabPanel,Roo.util.Observable,{tabPosition:"top",currentTabWidth:0,minTabWidth:40,maxTabWidth:250,preferredTabWidth:175,resizeTabs:false,monitorResize:true,toolbar:false,addTab:function(id,A,B,C){var D=new Roo.TabPanelItem(this,id,A,C);this.addTabItem(D);if(B){D.setContent(B);}return D;},getTab:function(id){return this.items[id];},hideTab:function(id){var t=this.items[id];if(!t.isHidden()){t.setHidden(true);this.hiddenCount++;this.autoSizeTabs();}},unhideTab:function(id){var t=this.items[id];if(t.isHidden()){t.setHidden(false);this.hiddenCount--;this.autoSizeTabs();}},addTabItem:function(A){this.items[A.id]=A;this.items.push(A);if(this.resizeTabs){A.setWidth(this.currentTabWidth||this.preferredTabWidth);this.autoSizeTabs();}else {A.autoSize();}},removeTab:function(id){var A=this.items;var B=A[id];if(!B){return;}var C=A.indexOf(B);if(this.active==B&&A.length>1){var D=this.getNextAvailable(C);if(D){D.activate();}}
+this.stripEl.dom.removeChild(B.pnode.dom);if(B.bodyEl.dom.parentNode==this.bodyEl.dom){this.bodyEl.dom.removeChild(B.bodyEl.dom);}
+A.splice(C,1);delete this.items[B.id];B.fireEvent("close",B);B.purgeListeners();this.autoSizeTabs();},getNextAvailable:function(A){var B=this.items;var C=A;while(C<B.length){var D=B[++C];if(D&&!D.isHidden()){return D;}}
+C=A;while(C>=0){var D=B[--C];if(D&&!D.isHidden()){return D;}}return null;},disableTab:function(id){var A=this.items[id];if(A&&this.active!=A){A.disable();}},enableTab:function(id){var A=this.items[id];A.enable();},activate:function(id){var A=this.items[id];if(!A){return null;}if(A==this.active||A.disabled){return A;}var e={};this.fireEvent("beforetabchange",this,e,A);if(e.cancel!==true&&!A.disabled){if(this.active){this.active.hide();}
+this.active=this.items[id];this.active.show();this.fireEvent("tabchange",this,this.active);}return A;},getActiveTab:function(){return this.active;},syncHeight:function(A){var B=(A||this.el.getHeight())-this.el.getBorderWidth("tb")-this.el.getPadding("tb");var bm=this.bodyEl.getMargins();var C=B-(this.stripWrap.getHeight()||0)-(bm.top+bm.bottom);this.bodyEl.setHeight(C);return C;},onResize:function(){if(this.monitorResize){this.autoSizeTabs();}},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.autoSizeTabs();},autoSizeTabs:function(){var A=this.items.length;var B=A-this.hiddenCount;if(!this.resizeTabs||A<1||B<1||this.updating)return;var w=Math.max(this.el.getWidth()-this.cpad,10);var C=Math.floor(w/B);var b=this.stripBody;if(b.getWidth()>w){var D=this.items;this.setTabWidth(Math.max(C,this.minTabWidth)-2);if(C<this.minTabWidth){}}else {if(this.currentTabWidth<this.preferredTabWidth){this.setTabWidth(Math.min(C,this.preferredTabWidth)-2);}}},getCount:function(){return this.items.length;},setTabWidth:function(A){this.currentTabWidth=A;for(var i=0,B=this.items.length;i<B;i++){if(!this.items[i].isHidden())this.items[i].setWidth(A);}},destroy:function(A){Roo.EventManager.removeResizeListener(this.onResize,this);for(var i=0,B=this.items.length;i<B;i++){this.items[i].purgeListeners();}if(A===true){this.el.update("");this.el.remove();}}});Roo.TabPanelItem=function(A,id,B,C){this.tabPanel=A;this.id=id;this.disabled=false;this.text=B;this.loaded=false;this.closable=C;this.bodyEl=Roo.get(A.createItemBody(A.bodyEl.dom,id));this.bodyEl.setVisibilityMode(Roo.Element.VISIBILITY);this.bodyEl.setStyle("display","block");this.bodyEl.setStyle("zoom","1");this.hideAction();var D=A.createStripElements(A.stripEl.dom,B,C);this.el=Roo.get(D.el,true);this.inner=Roo.get(D.inner,true);this.textEl=Roo.get(this.el.dom.firstChild.firstChild.firstChild,true);this.pnode=Roo.get(D.el.parentNode,true);this.el.on("mousedown",this.onTabMouseDown,this);this.el.on("click",this.onTabClick,this);if(C){var c=Roo.get(D.close,true);c.dom.title=this.closeText;c.addClassOnOver("close-over");c.on("click",this.closeClick,this);}
+this.addEvents({"activate":true,"beforeclose":true,"close":true,"deactivate":true});this.hidden=false;Roo.TabPanelItem.superclass.constructor.call(this);};Roo.extend(Roo.TabPanelItem,Roo.util.Observable,{purgeListeners:function(){Roo.util.Observable.prototype.purgeListeners.call(this);this.el.removeAllListeners();},show:function(){this.pnode.addClass("on");this.showAction();if(Roo.isOpera){this.tabPanel.stripWrap.repaint();}
+this.fireEvent("activate",this.tabPanel,this);},isActive:function(){return this.tabPanel.getActiveTab()==this;},hide:function(){this.pnode.removeClass("on");this.hideAction();this.fireEvent("deactivate",this.tabPanel,this);},hideAction:function(){this.bodyEl.hide();this.bodyEl.setStyle("position","absolute");this.bodyEl.setLeft("-20000px");this.bodyEl.setTop("-20000px");},showAction:function(){this.bodyEl.setStyle("position","relative");this.bodyEl.setTop("");this.bodyEl.setLeft("");this.bodyEl.show();},setTooltip:function(A){if(Roo.QuickTips&&Roo.QuickTips.isEnabled()){this.textEl.dom.qtip=A;this.textEl.dom.removeAttribute('title');}else {this.textEl.dom.title=A;}},onTabClick:function(e){e.preventDefault();this.tabPanel.activate(this.id);},onTabMouseDown:function(e){e.preventDefault();this.tabPanel.activate(this.id);},getWidth:function(){return this.inner.getWidth();},setWidth:function(A){var B=A-this.pnode.getPadding("lr");this.inner.setWidth(B);this.textEl.setWidth(B-this.inner.getPadding("lr"));this.pnode.setWidth(A);},setHidden:function(A){this.hidden=A;this.pnode.setStyle("display",A?"none":"");},isHidden:function(){return this.hidden;},getText:function(){return this.text;},autoSize:function(){this.textEl.setWidth(1);this.setWidth(this.textEl.dom.scrollWidth+this.pnode.getPadding("lr")+this.inner.getPadding("lr"));},setText:function(A){this.text=A;this.textEl.update(A);this.setTooltip(A);if(!this.tabPanel.resizeTabs){this.autoSize();}},activate:function(){this.tabPanel.activate(this.id);},disable:function(){if(this.tabPanel.active!=this){this.disabled=true;this.pnode.addClass("disabled");}},enable:function(){this.disabled=false;this.pnode.removeClass("disabled");},setContent:function(A,B){this.bodyEl.update(A,B);},getUpdateManager:function(){return this.bodyEl.getUpdateManager();},setUrl:function(A,B,C){if(this.refreshDelegate){this.un('activate',this.refreshDelegate);}
+this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);return this.bodyEl.getUpdateManager();},_handleRefresh:function(A,B,C){if(!C||!this.loaded){var D=this.bodyEl.getUpdateManager();D.update(A,B,this._setLoaded.createDelegate(this));}},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();}},_setLoaded:function(){this.loaded=true;},closeClick:function(e){var o={};e.stopEvent();this.fireEvent("beforeclose",this,o);if(o.cancel!==true){this.tabPanel.removeTab(this.id);}},closeText:"Close this tab"});Roo.TabPanel.prototype.createStrip=function(A){var B=document.createElement("div");B.className="x-tabs-wrap";A.appendChild(B);return B;};Roo.TabPanel.prototype.createStripList=function(A){A.innerHTML='<div class="x-tabs-strip-wrap">'+'<table class="x-tabs-strip" cellspacing="0" cellpadding="0" border="0"><tbody><tr>'+'<td class="x-tab-strip-toolbar"></td></tr></tbody></table></div>';return A.firstChild.firstChild.firstChild.firstChild;};Roo.TabPanel.prototype.createBody=function(A){var B=document.createElement("div");Roo.id(B,"tab-body");Roo.fly(B).addClass("x-tabs-body");A.appendChild(B);return B;};Roo.TabPanel.prototype.createItemBody=function(A,id){var B=Roo.getDom(id);if(!B){B=document.createElement("div");B.id=id;}
+Roo.fly(B).addClass("x-tabs-item-body");A.insertBefore(B,A.firstChild);return B;};Roo.TabPanel.prototype.createStripElements=function(A,B,C){var td=document.createElement("td");A.insertBefore(td,A.childNodes[A.childNodes.length-1]);if(C){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template('<a href="#" class="x-tabs-right"><span class="x-tabs-left"><em class="x-tabs-inner">'+'<span unselectable="on"'+(this.disableTooltips?'':' title="{text}"')+' class="x-tabs-text">{text}</span>'+'<div unselectable="on" class="close-icon">&#160;</div></em></span></a>');}var el=this.closeTpl.overwrite(td,{"text":B});var D=el.getElementsByTagName("div")[0];var E=el.getElementsByTagName("em")[0];return {"el":el,"close":D,"inner":E};}else {if(!this.tabTpl){this.tabTpl=new Roo.Template('<a href="#" class="x-tabs-right"><span class="x-tabs-left"><em class="x-tabs-inner">'+'<span unselectable="on"'+(this.disableTooltips?'':' title="{text}"')+' class="x-tabs-text">{text}</span></em></span></a>');}var el=this.tabTpl.overwrite(td,{"text":B});var E=el.getElementsByTagName("em")[0];return {"el":el,"inner":E};}};
+//Roo/Button.js
+Roo.Button=function(A,B){if(!B){B=A;A=B.renderTo||false;}
+Roo.apply(this,B);this.addEvents({"click":true,"toggle":true,'mouseover':true,'mouseout':true,'render':true});if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);}
+Roo.util.Observable.call(this);if(A){this.render(A);}};Roo.extend(Roo.Button,Roo.util.Observable,{hidden:false,disabled:false,pressed:false,tabIndex:undefined,enableToggle:false,menu:undefined,menuAlign:"tl-bl?",iconCls:undefined,type:'button',menuClassTarget:'tr',clickEvent:'click',handleMouseEvents:true,tooltipType:'qtip',render:function(A){var B;if(this.hideParent){this.parentEl=Roo.get(A);}if(!this.dhconfig){if(!this.template){if(!Roo.Button.buttonTemplate){Roo.Button.buttonTemplate=new Roo.Template('<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>','<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>',"</tr></tbody></table>");}
+this.template=Roo.Button.buttonTemplate;}
+B=this.template.append(A,[this.text||'&#160;',this.type],true);var C=B.child("button:first");C.on('focus',this.onFocus,this);C.on('blur',this.onBlur,this);if(this.cls){B.addClass(this.cls);}if(this.icon){C.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){C.addClass(this.iconCls);if(!this.cls){B.addClass(this.text?'x-btn-text-icon':'x-btn-icon');}}if(this.tabIndex!==undefined){C.dom.tabIndex=this.tabIndex;}if(this.tooltip){if(typeof this.tooltip=='object'){Roo.QuickTips.tips(Roo.apply({target:C.id},this.tooltip));}else {C.dom[this.tooltipType]=this.tooltip;}}}else {B=Roo.DomHelper.append(Roo.get(A).dom,this.dhconfig,true);}
+this.el=B;if(this.id){this.el.dom.id=this.el.id=this.id;}if(this.menu){this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this);}
+B.addClass("x-btn");if(Roo.isIE&&!Roo.isIE7){this.autoWidth.defer(1,this);}else {this.autoWidth();}if(this.handleMouseEvents){B.on("mouseover",this.onMouseOver,this);B.on("mouseout",this.onMouseOut,this);B.on("mousedown",this.onMouseDown,this);}
+B.on(this.clickEvent,this.onClick,this);if(this.hidden){this.hide();}if(this.disabled){this.disable();}
+Roo.ButtonToggleMgr.register(this);if(this.pressed){this.el.addClass("x-btn-pressed");}if(this.repeat){var D=new Roo.util.ClickRepeater(B,typeof this.repeat=="object"?this.repeat:{});D.on("click",this.onClick,this);}
+this.fireEvent('render',this);},getEl:function(){return this.el;},destroy:function(){Roo.ButtonToggleMgr.unregister(this);this.el.removeAllListeners();this.purgeListeners();this.el.remove();},autoWidth:function(){if(this.el){this.el.setWidth("auto");if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if(this.el.getWidth()<this.minWidth){this.el.setWidth(this.minWidth);}if(this.hidden){this.el.endMeasure();}}}},setHandler:function(A,B){this.handler=A;this.scope=B;},setText:function(A){this.text=A;if(this.el){this.el.child("td.x-btn-center button.x-btn-text").update(A);}
+this.autoWidth();},getText:function(){return this.text;},show:function(){this.hidden=false;if(this.el){this[this.hideParent?'parentEl':'el'].setStyle("display","");}},hide:function(){this.hidden=true;if(this.el){this[this.hideParent?'parentEl':'el'].setStyle("display","none");}},setVisible:function(A){if(A){this.show();}else {this.hide();}},toggle:function(A){A=A===undefined?!this.pressed:A;if(A!=this.pressed){if(A){this.el.addClass("x-btn-pressed");this.pressed=true;this.fireEvent("toggle",this,true);}else {this.el.removeClass("x-btn-pressed");this.pressed=false;this.fireEvent("toggle",this,false);}if(this.toggleHandler){this.toggleHandler.call(this.scope||this,this,A);}}},focus:function(){this.el.child('button:first').focus();},disable:function(){if(this.el){this.el.addClass("x-btn-disabled");}
+this.disabled=true;},enable:function(){if(this.el){this.el.removeClass("x-btn-disabled");}
+this.disabled=false;},setDisabled:function(v){this[v!==true?"enable":"disable"]();},onClick:function(e){if(e){e.preventDefault();}if(e.button!=0){return;}if(!this.disabled){if(this.enableToggle){this.toggle();}if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);}
+this.fireEvent("click",this,e);if(this.handler){this.el.removeClass("x-btn-over");this.handler.call(this.scope||this,this,e);}}},onMouseOver:function(e){if(!this.disabled){this.el.addClass("x-btn-over");this.fireEvent('mouseover',this,e);}},onMouseOut:function(e){if(!e.within(this.el,true)){this.el.removeClass("x-btn-over");this.fireEvent('mouseout',this,e);}},onFocus:function(e){if(!this.disabled){this.el.addClass("x-btn-focus");}},onBlur:function(e){this.el.removeClass("x-btn-focus");},onMouseDown:function(e){if(!this.disabled&&e.button==0){this.el.addClass("x-btn-click");Roo.get(document).on('mouseup',this.onMouseUp,this);}},onMouseUp:function(e){if(e.button==0){this.el.removeClass("x-btn-click");Roo.get(document).un('mouseup',this.onMouseUp,this);}},onMenuShow:function(e){this.el.addClass("x-btn-menu-active");},onMenuHide:function(e){this.el.removeClass("x-btn-menu-active");}});Roo.ButtonToggleMgr=function(){var A={};function toggleGroup(B,C){if(C){var g=A[B.toggleGroup];for(var i=0,l=g.length;i<l;i++){if(g[i]!=B){g[i].toggle(false);}}}}return {register:function(B){if(!B.toggleGroup){return;}var g=A[B.toggleGroup];if(!g){g=A[B.toggleGroup]=[];}
+g.push(B);B.on("toggle",toggleGroup);},unregister:function(B){if(!B.toggleGroup){return;}var g=A[B.toggleGroup];if(g){g.remove(B);B.un("toggle",toggleGroup);}}};}();
+//Roo/SplitButton.js
+Roo.SplitButton=function(A,B){Roo.SplitButton.superclass.constructor.call(this,A,B);this.addEvents({"arrowclick":true});};Roo.extend(Roo.SplitButton,Roo.Button,{render:function(A){var B=new Roo.Template('<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>','<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>','<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',"</tbody></table></td><td>",'<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>','<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',"</tbody></table></td></tr></table>");var C=B.append(A,[this.text,this.type],true);var D=C.child("button");if(this.cls){C.addClass(this.cls);}if(this.icon){D.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){D.addClass(this.iconCls);if(!this.cls){C.addClass(this.text?'x-btn-text-icon':'x-btn-icon');}}
+this.el=C;if(this.handleMouseEvents){C.on("mouseover",this.onMouseOver,this);C.on("mouseout",this.onMouseOut,this);C.on("mousedown",this.onMouseDown,this);C.on("mouseup",this.onMouseUp,this);}
+C.on(this.clickEvent,this.onClick,this);if(this.tooltip){if(typeof this.tooltip=='object'){Roo.QuickTips.tips(Roo.apply({target:D.id},this.tooltip));}else {D.dom[this.tooltipType]=this.tooltip;}}if(this.arrowTooltip){C.child("button:nth(2)").dom[this.tooltipType]=this.arrowTooltip;}if(this.hidden){this.hide();}if(this.disabled){this.disable();}if(this.pressed){this.el.addClass("x-btn-pressed");}if(Roo.isIE&&!Roo.isIE7){this.autoWidth.defer(1,this);}else {this.autoWidth();}if(this.menu){this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this);}
+this.fireEvent('render',this);},autoWidth:function(){if(this.el){var A=this.el.child("table:first");var B=this.el.child("table:last");this.el.setWidth("auto");A.setWidth("auto");if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button:first');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if((A.getWidth()+B.getWidth())<this.minWidth){A.setWidth(this.minWidth-B.getWidth());}if(this.hidden){this.el.endMeasure();}}
+this.el.setWidth(A.getWidth()+B.getWidth());}},setHandler:function(A,B){this.handler=A;this.scope=B;},setArrowHandler:function(A,B){this.arrowHandler=A;this.scope=B;},focus:function(){if(this.el){this.el.child("button:first").focus();}},onClick:function(e){e.preventDefault();if(!this.disabled){if(e.getTarget(".x-btn-menu-arrow-wrap")){if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);}
+this.fireEvent("arrowclick",this,e);if(this.arrowHandler){this.arrowHandler.call(this.scope||this,this,e);}}else {this.fireEvent("click",this,e);if(this.handler){this.handler.call(this.scope||this,this,e);}}}},onMouseDown:function(e){if(!this.disabled){Roo.fly(e.getTarget("table")).addClass("x-btn-click");}},onMouseUp:function(e){Roo.fly(e.getTarget("table")).removeClass("x-btn-click");}});Roo.MenuButton=Roo.SplitButton;
+//Roo/Toolbar.js
+Roo.Toolbar=function(A,B,C){if(A instanceof Array){B=A;C=B;A=null;}if(typeof(A)=='object'&&A.xtype){C=A;A=C.container;B=C.buttons||[];}var D=[];if(C&&C.items){D=C.items;delete C.items;}
+Roo.apply(this,C);this.buttons=B;if(A){this.render(A);}
+this.xitems=D;Roo.each(D,function(b){this.add(b);},this);};Roo.Toolbar.prototype={render:function(ct){this.el=Roo.get(ct);if(this.cls){this.el.addClass(this.cls);}
+this.el.update('<div class="x-toolbar x-small-editor"><table cellspacing="0"><tr></tr></table></div>');this.tr=this.el.child("tr",true);var A=0;this.items=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++A));});if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons;}},add:function(){var a=arguments,l=a.length;for(var i=0;i<l;i++){this._add(a[i]);}},_add:function(el){if(el.xtype){el=Roo.factory(el,typeof(Roo.Toolbar[el.xtype])=='undefined'?Roo.form:Roo.Toolbar);}if(el.applyTo){return this.addField(el);}if(el.render){return this.addItem(el);}if(typeof el=="string"){if(el=="separator"||el=="-"){return this.addSeparator();}if(el==" "){return this.addSpacer();}if(el=="->"){return this.addFill();}return this.addText(el);}if(el.tagName){return this.addElement(el);}if(typeof el=="object"){return this.addButton(el);}return false;},addxtype:function(e){return this.add(e);},getEl:function(){return this.el;},addSeparator:function(){return this.addItem(new Roo.Toolbar.Separator());},addSpacer:function(){return this.addItem(new Roo.Toolbar.Spacer());},addFill:function(){return this.addItem(new Roo.Toolbar.Fill());},addElement:function(el){return this.addItem(new Roo.Toolbar.Item(el));},items:false,addItem:function(A){var td=this.nextBlock();A.render(td);this.items.add(A);return A;},addButton:function(A){if(A instanceof Array){var B=[];for(var i=0,C=A.length;i<C;i++){B.push(this.addButton(A[i]));}return B;}var b=A;if(!(A instanceof Roo.Toolbar.Button)){b=A.split?new Roo.Toolbar.SplitButton(A):new Roo.Toolbar.Button(A);}var td=this.nextBlock();b.render(td);this.items.add(b);return b;},addText:function(A){return this.addItem(new Roo.Toolbar.TextItem(A));},insertButton:function(A,B){if(B instanceof Array){var C=[];for(var i=0,D=B.length;i<D;i++){C.push(this.insertButton(A+i,B[i]));}return C;}if(!(B instanceof Roo.Toolbar.Button)){B=new Roo.Toolbar.Button(B);}var td=document.createElement("td");this.tr.insertBefore(td,this.tr.childNodes[A]);B.render(td);this.items.insert(A,B);return B;},addDom:function(A,B){var td=this.nextBlock();Roo.DomHelper.overwrite(td,A);var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);return ti;},fields:false,addField:function(A){if(!this.fields){var B=0;this.fields=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++B));});}var td=this.nextBlock();A.render(td);var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);this.fields.add(A);return ti;},hide:function(){this.el.child('div').setVisibilityMode(Roo.Element.DISPLAY);this.el.child('div').hide();},show:function(){this.el.child('div').show();},nextBlock:function(){var td=document.createElement("td");this.tr.appendChild(td);return td;},destroy:function(){if(this.items){Roo.destroy.apply(Roo,this.items.items);}if(this.fields){Roo.destroy.apply(Roo,this.fields.items);}
+Roo.Element.uncache(this.el,this.tr);}};Roo.Toolbar.Item=function(el){this.el=Roo.getDom(el);this.id=Roo.id(this.el);this.hidden=false;};Roo.Toolbar.Item.prototype={getEl:function(){return this.el;},render:function(td){this.td=td;td.appendChild(this.el);},destroy:function(){this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},setVisible:function(A){if(A){this.show();}else {this.hide();}},focus:function(){Roo.fly(this.el).focus();},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");this.disabled=true;this.el.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");this.disabled=false;this.el.disabled=false;}};Roo.Toolbar.Separator=function(){var s=document.createElement("span");s.className="ytb-sep";Roo.Toolbar.Separator.superclass.constructor.call(this,s);};Roo.extend(Roo.Toolbar.Separator,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Spacer=function(){var s=document.createElement("div");s.className="ytb-spacer";Roo.Toolbar.Spacer.superclass.constructor.call(this,s);};Roo.extend(Roo.Toolbar.Spacer,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Fill=Roo.extend(Roo.Toolbar.Spacer,{render:function(td){td.style.width='100%';Roo.Toolbar.Fill.superclass.render.call(this,td);}});Roo.Toolbar.TextItem=function(A){if(typeof(A)=='object'){A=A.text;}var s=document.createElement("span");s.className="ytb-text";s.innerHTML=A;Roo.Toolbar.TextItem.superclass.constructor.call(this,s);};Roo.extend(Roo.Toolbar.TextItem,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Button=function(A){Roo.Toolbar.Button.superclass.constructor.call(this,null,A);};Roo.extend(Roo.Toolbar.Button,Roo.Button,{render:function(td){this.td=td;Roo.Toolbar.Button.superclass.render.call(this,td);},destroy:function(){Roo.Toolbar.Button.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");this.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");this.disabled=false;}});Roo.ToolbarButton=Roo.Toolbar.Button;Roo.Toolbar.SplitButton=function(A){Roo.Toolbar.SplitButton.superclass.constructor.call(this,null,A);};Roo.extend(Roo.Toolbar.SplitButton,Roo.SplitButton,{render:function(td){this.td=td;Roo.Toolbar.SplitButton.superclass.render.call(this,td);},destroy:function(){Roo.Toolbar.SplitButton.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";}});Roo.Toolbar.MenuButton=Roo.Toolbar.SplitButton;
+//Roo/PagingToolbar.js
+Roo.PagingToolbar=function(el,ds,A){if(typeof(el)=='object'&&el.xtype){A=el;ds=el.dataSource;el=A.container;}var B=[];if(A.items){B=A.items;A.items=[];}
+Roo.PagingToolbar.superclass.constructor.call(this,el,null,A);this.ds=ds;this.cursor=0;this.renderButtons(this.el);this.bind(ds);Roo.each(B,function(e){this.add(Roo.factory(e));},this);};Roo.extend(Roo.PagingToolbar,Roo.Toolbar,{pageSize:20,displayMsg:'Displaying {0} - {1} of {2}',emptyMsg:'No data to display',beforePageText:"Page",afterPageText:"of {0}",firstText:"First Page",prevText:"Previous Page",nextText:"Next Page",lastText:"Last Page",refreshText:"Refresh",renderButtons:function(el){Roo.PagingToolbar.superclass.render.call(this,el);this.first=this.addButton({tooltip:this.firstText,cls:"x-btn-icon x-grid-page-first",disabled:true,handler:this.onClick.createDelegate(this,["first"])});this.prev=this.addButton({tooltip:this.prevText,cls:"x-btn-icon x-grid-page-prev",disabled:true,handler:this.onClick.createDelegate(this,["prev"])});this.add(this.beforePageText);this.field=Roo.get(this.addDom({tag:"input",type:"text",size:"3",value:"1",cls:"x-grid-page-number"}).el);this.field.on("keydown",this.onPagingKeydown,this);this.field.on("focus",function(){this.dom.select();});this.afterTextEl=this.addText(String.format(this.afterPageText,1));this.field.setHeight(18);this.next=this.addButton({tooltip:this.nextText,cls:"x-btn-icon x-grid-page-next",disabled:true,handler:this.onClick.createDelegate(this,["next"])});this.last=this.addButton({tooltip:this.lastText,cls:"x-btn-icon x-grid-page-last",disabled:true,handler:this.onClick.createDelegate(this,["last"])});this.loading=this.addButton({tooltip:this.refreshText,cls:"x-btn-icon x-grid-loading",handler:this.onClick.createDelegate(this,["refresh"])});if(this.displayInfo){this.displayEl=Roo.fly(this.el.dom.firstChild).createChild({cls:'x-paging-info'});}},updateInfo:function(){if(this.displayEl){var A=this.ds.getCount();var B=A==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+A,this.ds.getTotalCount());this.displayEl.update(B);}},onLoad:function(ds,r,o){this.cursor=o.params?o.params.start:0;var d=this.getPageData(),ap=d.activePage,ps=d.pages;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,d.pages);this.field.dom.value=ap;this.first.setDisabled(ap==1);this.prev.setDisabled(ap==1);this.next.setDisabled(ap==ps);this.last.setDisabled(ap==ps);this.loading.enable();this.updateInfo();},getPageData:function(){var A=this.ds.getTotalCount();return {total:A,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:A<this.pageSize?1:Math.ceil(A/this.pageSize)};},onLoadError:function(){this.loading.enable();},onPagingKeydown:function(e){var k=e.getKey();var d=this.getPageData();if(k==e.RETURN ){var v=this.field.dom.value,A;if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}
+A=Math.min(Math.max(1,A),d.pages)-1;this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.HOME||(k==e.UP&&e.ctrlKey)||(k==e.PAGEUP&&e.ctrlKey)||(k==e.RIGHT&&e.ctrlKey)||k==e.END||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey)){var A=(k==e.HOME||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey))?1:d.pages;this.field.dom.value=A;this.ds.load({params:{start:(A-1)*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.UP||k==e.RIGHT||k==e.PAGEUP||k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN){var v=this.field.dom.value,A;var B=(e.shiftKey)?10:1;if(k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN)B*=-1;if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}else if(parseInt(v,10)+B>=1&parseInt(v,10)+B<=d.pages){this.field.dom.value=parseInt(v,10)+B;A=Math.min(Math.max(1,A+B),d.pages)-1;this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}});}
+e.stopEvent();}},beforeLoad:function(){if(this.loading){this.loading.disable();}},onClick:function(A){var ds=this.ds;switch(A){case "first":ds.load({params:{start:0,limit:this.pageSize}});break;case "prev":ds.load({params:{start:Math.max(0,this.cursor-this.pageSize),limit:this.pageSize}});break;case "next":ds.load({params:{start:this.cursor+this.pageSize,limit:this.pageSize}});break;case "last":var B=ds.getTotalCount();var C=B%this.pageSize;var D=C?(B-C):B-this.pageSize;ds.load({params:{start:D,limit:this.pageSize}});break;case "refresh":ds.load({params:{start:this.cursor,limit:this.pageSize}});break;}},unbind:function(ds){ds.un("beforeload",this.beforeLoad,this);ds.un("load",this.onLoad,this);ds.un("loadexception",this.onLoadError,this);ds.un("remove",this.updateInfo,this);ds.un("add",this.updateInfo,this);this.ds=undefined;},bind:function(ds){ds.on("beforeload",this.beforeLoad,this);ds.on("load",this.onLoad,this);ds.on("loadexception",this.onLoadError,this);ds.on("remove",this.updateInfo,this);ds.on("add",this.updateInfo,this);this.ds=ds;}});
+//Roo/Resizable.js
+Roo.Resizable=function(el,A){this.el=Roo.get(el);if(A&&A.wrap){A.resizeChild=this.el;this.el=this.el.wrap(typeof A.wrap=="object"?A.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=A.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(A.resizeChild.getPositioning());A.resizeChild.clearPositioning();if(!A.width||!A.height){var B=A.resizeChild.getSize();this.el.setSize(B.width,B.height);}if(A.pinned&&!A.adjustments){A.adjustments="auto";}}
+this.proxy=this.el.createProxy({tag:"div",cls:"x-resizable-proxy",id:this.el.id+"-rzproxy"});this.proxy.unselectable();this.proxy.enableDisplayMode('block');Roo.apply(this,A);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned");}var C=this.el.getStyle("position");if(C!="absolute"&&C!="fixed"){this.el.setStyle("position","relative");}if(!this.handles){this.handles='s,e,se';if(this.multiDirectional){this.handles+=',n,w';}}if(this.handles=="all"){this.handles="n s e w ne nw se sw";}var hs=this.handles.split(/\s*?[,;]\s*?| /);var ps=Roo.Resizable.positions;for(var i=0,D=hs.length;i<D;i++){if(hs[i]&&ps[hs[i]]){var E=ps[hs[i]];this[E]=new Roo.Resizable.Handle(this,E,this.disableTrackOver,this.transparent);}}
+this.corner=this.southeast;if(this.handles.indexOf("n")!=-1||this.handles.indexOf("w")!=-1||this.handles.indexOf("hd")!=-1){this.updateBox=true;}
+this.activeHandle=null;if(this.resizeChild){if(typeof this.resizeChild=="boolean"){this.resizeChild=Roo.get(this.el.dom.firstChild,true);}else {this.resizeChild=Roo.get(this.resizeChild,true);}}if(this.adjustments=="auto"){var rc=this.resizeChild;var hw=this.west,he=this.east,hn=this.north,hs=this.south;if(rc&&(hw||hn)){rc.position("relative");rc.setLeft(hw?hw.el.getWidth():0);rc.setTop(hn?hn.el.getHeight():0);}
+this.adjustments=[(he?-he.el.getWidth():0)+(hw?-hw.el.getWidth():0),(hn?-hn.el.getHeight():0)+(hs?-hs.el.getHeight():0)-1];}if(this.draggable){this.dd=this.dynamic?this.el.initDD(null):this.el.initDDProxy(null,{dragElId:this.proxy.id});this.dd.setHandleElId(this.resizeChild?this.resizeChild.id:this.el.id);}
+this.addEvents({"beforeresize":true,"resize":true});if(this.width!==null&&this.height!==null){this.resizeTo(this.width,this.height);}else {this.updateChildSize();}if(Roo.isIE){this.el.dom.style.zoom=1;}
+Roo.Resizable.superclass.constructor.call(this);};Roo.extend(Roo.Resizable,Roo.util.Observable,{resizeChild:false,adjustments:[0,0],minWidth:5,minHeight:5,maxWidth:10000,maxHeight:10000,enabled:true,animate:false,duration:.35,dynamic:false,handles:false,multiDirectional:false,disableTrackOver:false,easing:'easeOutStrong',widthIncrement:0,heightIncrement:0,pinned:false,width:null,height:null,preserveRatio:false,transparent:false,minX:0,minY:0,draggable:false,constrainTo:undefined,resizeRegion:undefined,resizeTo:function(A,B){this.el.setSize(A,B);this.updateChildSize();this.fireEvent("resize",this,A,B,null);},startSizing:function(e,A){this.fireEvent("beforeresize",this,e);if(this.enabled){if(!this.overlay){this.overlay=this.el.createProxy({tag:"div",cls:"x-resizable-overlay",html:"&#160;"});this.overlay.unselectable();this.overlay.enableDisplayMode("block");this.overlay.on("mousemove",this.onMouseMove,this);this.overlay.on("mouseup",this.onMouseUp,this);}
+this.overlay.setStyle("cursor",A.el.getStyle("cursor"));this.resizing=true;this.startBox=this.el.getBox();this.startPoint=e.getXY();this.offsets=[(this.startBox.x+this.startBox.width)-this.startPoint[0],(this.startBox.y+this.startBox.height)-this.startPoint[1]];this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.overlay.show();if(this.constrainTo){var ct=Roo.get(this.constrainTo);this.resizeRegion=ct.getRegion().adjust(ct.getFrameWidth('t'),ct.getFrameWidth('l'),-ct.getFrameWidth('b'),-ct.getFrameWidth('r'));}
+this.proxy.setStyle('visibility','hidden');this.proxy.show();this.proxy.setBox(this.startBox);if(!this.dynamic){this.proxy.setStyle('visibility','visible');}}},onMouseDown:function(A,e){if(this.enabled){e.stopEvent();this.activeHandle=A;this.startSizing(e,A);}},onMouseUp:function(e){var A=this.resizeElement();this.resizing=false;this.handleOut();this.overlay.hide();this.proxy.hide();this.fireEvent("resize",this,A.width,A.height,e);},updateChildSize:function(){if(this.resizeChild){var el=this.el;var A=this.resizeChild;var B=this.adjustments;if(el.dom.offsetWidth){var b=el.getSize(true);A.setSize(b.width+B[0],b.height+B[1]);}if(Roo.isIE){setTimeout(function(){if(el.dom.offsetWidth){var b=el.getSize(true);A.setSize(b.width+B[0],b.height+B[1]);}},10);}}},snap:function(A,B,C){if(!B||!A)return A;var D=A;var m=A%B;if(m>0){if(m>(B/2)){D=A+(B-m);}else {D=A-m;}}return Math.max(C,D);},resizeElement:function(){var A=this.proxy.getBox();if(this.updateBox){this.el.setBox(A,false,this.animate,this.duration,null,this.easing);}else {this.el.setSize(A.width,A.height,this.animate,this.duration,null,this.easing);}
+this.updateChildSize();if(!this.dynamic){this.proxy.hide();}return A;},constrain:function(v,A,m,mx){if(v-A<m){A=v-m;}else if(v-A>mx){A=mx-v;}return A;},onMouseMove:function(e){if(this.enabled){try{if(this.resizeRegion&&!this.resizeRegion.contains(e.getPoint())){return;}var A=this.curSize||this.startBox;var x=this.startBox.x,y=this.startBox.y;var ox=x,oy=y;var w=A.width,h=A.height;var ow=w,oh=h;var mw=this.minWidth,mh=this.minHeight;var B=this.maxWidth,C=this.maxHeight;var wi=this.widthIncrement;var hi=this.heightIncrement;var D=e.getXY();var E=-(this.startPoint[0]-Math.max(this.minX,D[0]));var F=-(this.startPoint[1]-Math.max(this.minY,D[1]));var G=this.activeHandle.position;switch(G){case "east":w+=E;w=Math.min(Math.max(mw,w),B);break;case "south":h+=F;h=Math.min(Math.max(mh,h),C);break;case "southeast":w+=E;h+=F;w=Math.min(Math.max(mw,w),B);h=Math.min(Math.max(mh,h),C);break;case "north":F=this.constrain(h,F,mh,C);y+=F;h-=F;break;case "hdrag":if(wi){var H=Math.abs(E);var I=(H%wi);if(I>(wi/2)){E=(E>0)?E-I+wi:E+I-wi;}else {E=(E>0)?E-I:E+I;}}
+x+=E;x=Math.max(this.minX,x);break;case "west":E=this.constrain(w,E,mw,B);x+=E;w-=E;break;case "northeast":w+=E;w=Math.min(Math.max(mw,w),B);F=this.constrain(h,F,mh,C);y+=F;h-=F;break;case "northwest":E=this.constrain(w,E,mw,B);F=this.constrain(h,F,mh,C);y+=F;h-=F;x+=E;w-=E;break;case "southwest":E=this.constrain(w,E,mw,B);h+=F;h=Math.min(Math.max(mh,h),C);x+=E;w-=E;break;}var sw=this.snap(w,wi,mw);var sh=this.snap(h,hi,mh);if(sw!=w||sh!=h){switch(G){case "northeast":y-=sh-h;break;case "north":y-=sh-h;break;case "southwest":x-=sw-w;break;case "west":x-=sw-w;break;case "northwest":x-=sw-w;y-=sh-h;break;}
+w=sw;h=sh;}if(this.preserveRatio){switch(G){case "southeast":case "east":h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);w=ow*(h/oh);break;case "south":w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);break;case "northeast":w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);break;case "north":var tw=w;w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);x+=(tw-w)/2;break;case "southwest":h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);var tw=w;w=ow*(h/oh);x+=tw-w;break;case "west":var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);y+=(th-h)/2;var tw=w;w=ow*(h/oh);x+=tw-w;break;case "northwest":var tw=w;var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);w=ow*(h/oh);y+=th-h;x+=tw-w;break;}}if(G=='hdrag'){w=ow;}
+this.proxy.setBounds(x,y,w,h);if(this.dynamic){this.resizeElement();}}catch(e){}}},handleOver:function(){if(this.enabled){this.el.addClass("x-resizable-over");}},handleOut:function(){if(!this.resizing){this.el.removeClass("x-resizable-over");}},getEl:function(){return this.el;},getResizeChild:function(){return this.resizeChild;},destroy:function(A){this.proxy.remove();if(this.overlay){this.overlay.removeAllListeners();this.overlay.remove();}var ps=Roo.Resizable.positions;for(var k in ps){if(typeof ps[k]!="function"&&this[ps[k]]){var h=this[ps[k]];h.el.removeAllListeners();h.el.remove();}}if(A){this.el.update("");this.el.remove();}}});Roo.Resizable.positions={n:"north",s:"south",e:"east",w:"west",se:"southeast",sw:"southwest",nw:"northwest",ne:"northeast",hd:"hdrag"};Roo.Resizable.Handle=function(rz,A,B,C){if(!this.tpl){var D=Roo.DomHelper.createTemplate({tag:"div",cls:"x-resizable-handle x-resizable-handle-{0}"});D.compile();Roo.Resizable.Handle.prototype.tpl=D;}
+this.position=A;this.rz=rz;var E=A=='hdrag'?'north':A;this.el=this.tpl.append(rz.el.dom,[E],true);if(A=='hdrag'){this.el.setStyle('cursor','pointer');}
+this.el.unselectable();if(C){this.el.setOpacity(0);}
+this.el.on("mousedown",this.onMouseDown,this);if(!B){this.el.on("mouseover",this.onMouseOver,this);this.el.on("mouseout",this.onMouseOut,this);}};Roo.Resizable.Handle.prototype={afterResize:function(rz){},onMouseDown:function(e){this.rz.onMouseDown(this,e);},onMouseOver:function(e){this.rz.handleOver(this,e);},onMouseOut:function(e){this.rz.handleOut(this,e);}};
+//Roo/Editor.js
+Roo.Editor=function(A,B){Roo.Editor.superclass.constructor.call(this,B);this.field=A;this.addEvents({"beforestartedit":true,"startedit":true,"beforecomplete":true,"complete":true,"specialkey":true});};Roo.extend(Roo.Editor,Roo.Component,{value:"",alignment:"c-c?",shadow:"frame",constrain:false,completeOnEnter:false,cancelOnEsc:false,updateEl:false,onRender:function(ct,A){this.el=new Roo.Layer({shadow:this.shadow,cls:"x-editor",parentEl:ct,shim:this.shim,shadowOffset:4,id:this.id,constrain:this.constrain});this.el.setStyle("overflow",Roo.isGecko?"auto":"hidden");if(this.field.msgTarget!='title'){this.field.msgTarget='qtip';}
+this.field.render(this.el);if(Roo.isGecko){this.field.el.dom.setAttribute('autocomplete','off');}
+this.field.on("specialkey",this.onSpecialKey,this);if(this.swallowKeys){this.field.el.swallowEvent(['keydown','keypress']);}
+this.field.show();this.field.on("blur",this.onBlur,this);if(this.field.grow){this.field.on("autosize",this.el.sync,this.el,{delay:1});}},onSpecialKey:function(A,e){if(this.completeOnEnter&&e.getKey()==e.ENTER){e.stopEvent();this.completeEdit();return;}if(e.getKey()==e.ENTER){return;}if(this.cancelOnEsc&&e.getKey()==e.ESC){this.cancelEdit();return;}this.fireEvent('specialkey',A,e);},startEdit:function(el,A){if(this.editing){this.completeEdit();}
+this.boundEl=Roo.get(el);var v=A!==undefined?A:this.boundEl.dom.innerHTML;if(!this.rendered){this.render(this.parentEl||document.body);}if(this.fireEvent("beforestartedit",this,this.boundEl,v)===false){return;}
+this.startValue=v;this.field.setValue(v);if(this.autoSize){var sz=this.boundEl.getSize();switch(this.autoSize){case "width":this.setSize(sz.width,"");break;case "height":this.setSize("",sz.height);break;default:this.setSize(sz.width,sz.height);}}
+this.el.alignTo(this.boundEl,this.alignment);this.editing=true;if(Roo.QuickTips){Roo.QuickTips.disable();}
+this.show();},setSize:function(w,h){this.field.setSize(w,h);if(this.el){this.el.sync();}},realign:function(){this.el.alignTo(this.boundEl,this.alignment);},completeEdit:function(A){if(!this.editing){return;}var v=this.getValue();if(this.revertInvalid!==false&&!this.field.isValid()){v=this.startValue;this.cancelEdit(true);}if(String(v)===String(this.startValue)&&this.ignoreNoChange){this.editing=false;this.hide();return;}if(this.fireEvent("beforecomplete",this,v,this.startValue)!==false){this.editing=false;if(this.updateEl&&this.boundEl){this.boundEl.update(v);}if(A!==true){this.hide();}
+this.fireEvent("complete",this,v,this.startValue);}},onShow:function(){this.el.show();if(this.hideEl!==false){this.boundEl.hide();}
+this.field.show();if(Roo.isIE&&!this.fixIEFocus){this.fixIEFocus=true;this.deferredFocus.defer(50,this);}else {this.field.focus();}
+this.fireEvent("startedit",this.boundEl,this.startValue);},deferredFocus:function(){if(this.editing){this.field.focus();}},cancelEdit:function(A){if(this.editing){this.setValue(this.startValue);if(A!==true){this.hide();}}},onBlur:function(){if(this.allowBlur!==true&&this.editing){this.completeEdit();}},onHide:function(){if(this.editing){this.completeEdit();return;}
+this.field.blur();if(this.field.collapse){this.field.collapse();}
+this.el.hide();if(this.hideEl!==false){this.boundEl.show();}if(Roo.QuickTips){Roo.QuickTips.enable();}},setValue:function(v){this.field.setValue(v);},getValue:function(){return this.field.getValue();}});
+//Roo/BasicDialog.js
+Roo.BasicDialog=function(el,A){this.el=Roo.get(el);var dh=Roo.DomHelper;if(!this.el&&A&&A.autoCreate){if(typeof A.autoCreate=="object"){if(!A.autoCreate.id){A.autoCreate.id=el;}
+this.el=dh.append(document.body,A.autoCreate,true);}else {this.el=dh.append(document.body,{tag:"div",id:el,style:'visibility:hidden;'},true);}}
+el=this.el;el.setDisplayed(true);el.hide=this.hideAction;this.id=el.id;el.addClass("x-dlg");Roo.apply(this,A);this.proxy=el.createProxy("x-dlg-proxy");this.proxy.hide=this.hideAction;this.proxy.setOpacity(.5);this.proxy.hide();if(A.width){el.setWidth(A.width);}if(A.height){el.setHeight(A.height);}
+this.size=el.getSize();if(typeof A.x!="undefined"&&typeof A.y!="undefined"){this.xy=[A.x,A.y];}else {this.xy=el.getCenterXY(true);}
+this.header=el.child("> .x-dlg-hd");this.body=el.child("> .x-dlg-bd");this.footer=el.child("> .x-dlg-ft");if(!this.header){this.header=el.createChild({tag:"div",cls:"x-dlg-hd",html:"&#160;"},this.body?this.body.dom:null);}if(!this.body){this.body=el.createChild({tag:"div",cls:"x-dlg-bd"});}
+this.header.unselectable();if(this.title){this.header.update(this.title);}
+this.focusEl=el.createChild({tag:"a",href:"#",cls:"x-dlg-focus",tabIndex:"-1"});this.focusEl.swallowEvent("click",true);this.header.wrap({cls:"x-dlg-hd-right"}).wrap({cls:"x-dlg-hd-left"},true);this.bwrap=this.body.wrap({tag:"div",cls:"x-dlg-dlg-body"});if(this.footer){this.bwrap.dom.appendChild(this.footer.dom);}
+this.bg=this.el.createChild({tag:"div",cls:"x-dlg-bg",html:'<div class="x-dlg-bg-left"><div class="x-dlg-bg-right"><div class="x-dlg-bg-center">&#160;</div></div></div>'});this.centerBg=this.bg.child("div.x-dlg-bg-center");if(this.autoScroll!==false&&!this.autoTabs){this.body.setStyle("overflow","auto");}
+this.toolbox=this.el.createChild({cls:"x-dlg-toolbox"});if(this.closable!==false){this.el.addClass("x-dlg-closable");this.close=this.toolbox.createChild({cls:"x-dlg-close"});this.close.on("click",this.closeClick,this);this.close.addClassOnOver("x-dlg-close-over");}if(this.collapsible!==false){this.collapseBtn=this.toolbox.createChild({cls:"x-dlg-collapse"});this.collapseBtn.on("click",this.collapseClick,this);this.collapseBtn.addClassOnOver("x-dlg-collapse-over");this.header.on("dblclick",this.collapseClick,this);}if(this.resizable!==false){this.el.addClass("x-dlg-resizable");this.resizer=new Roo.Resizable(el,{minWidth:this.minWidth||80,minHeight:this.minHeight||80,handles:this.resizeHandles||"all",pinned:true});this.resizer.on("beforeresize",this.beforeResize,this);this.resizer.on("resize",this.onResize,this);}if(this.draggable!==false){el.addClass("x-dlg-draggable");if(!this.proxyDrag){var dd=new Roo.dd.DD(el.dom.id,"WindowDrag");}else {var dd=new Roo.dd.DDProxy(el.dom.id,"WindowDrag",{dragElId:this.proxy.id});}
+dd.setHandleElId(this.header.id);dd.endDrag=this.endMove.createDelegate(this);dd.startDrag=this.startMove.createDelegate(this);dd.onDrag=this.onDrag.createDelegate(this);dd.scroll=false;this.dd=dd;}if(this.modal){this.mask=dh.append(document.body,{tag:"div",cls:"x-dlg-mask"},true);this.mask.enableDisplayMode("block");this.mask.hide();this.el.addClass("x-dlg-modal");}if(this.shadow){this.shadow=new Roo.Shadow({mode:typeof this.shadow=="string"?this.shadow:"sides",offset:this.shadowOffset});}else {this.shadowOffset=0;}if(Roo.useShims&&this.shim!==false){this.shim=this.el.createShim();this.shim.hide=this.hideAction;this.shim.hide();}else {this.shim=false;}if(this.autoTabs){this.initTabs();}if(this.buttons){var B=this.buttons;this.buttons=[];Roo.each(B,function(b){this.addButton(b);},this);}
+this.addEvents({"keydown":true,"move":true,"resize":true,"beforehide":true,"hide":true,"beforeshow":true,"show":true});el.on("keydown",this.onKeyDown,this);el.on("mousedown",this.toFront,this);Roo.EventManager.onWindowResize(this.adjustViewport,this,true);this.el.hide();Roo.DialogManager.register(this);Roo.BasicDialog.superclass.constructor.call(this);};Roo.extend(Roo.BasicDialog,Roo.util.Observable,{shadowOffset:Roo.isIE?6:5,minHeight:80,minWidth:200,minButtonWidth:75,defaultButton:null,buttonAlign:"right",tabTag:'div',firstShow:true,setTitle:function(A){this.header.update(A);return this;},closeClick:function(){this.hide();},collapseClick:function(){this[this.collapsed?"expand":"collapse"]();},collapse:function(){if(!this.collapsed){this.collapsed=true;this.el.addClass("x-dlg-collapsed");this.restoreHeight=this.el.getHeight();this.resizeTo(this.el.getWidth(),this.header.getHeight());}},expand:function(){if(this.collapsed){this.collapsed=false;this.el.removeClass("x-dlg-collapsed");this.resizeTo(this.el.getWidth(),this.restoreHeight);}},initTabs:function(){var A=this.getTabs();while(A.getTab(0)){A.removeTab(0);}
+this.el.select(this.tabTag+'.x-dlg-tab').each(function(el){var B=el.dom;A.addTab(Roo.id(B),B.title);B.title="";});A.activate(0);return A;},beforeResize:function(){this.resizer.minHeight=Math.max(this.minHeight,this.getHeaderFooterHeight(true)+40);},onResize:function(){this.refreshSize();this.syncBodyHeight();this.adjustAssets();this.focus();this.fireEvent("resize",this,this.size.width,this.size.height);},onKeyDown:function(e){if(this.isVisible()){this.fireEvent("keydown",this,e);}},resizeTo:function(A,B){this.el.setSize(A,B);this.size={width:A,height:B};this.syncBodyHeight();if(this.fixedcenter){this.center();}if(this.isVisible()){this.constrainXY();this.adjustAssets();}
+this.fireEvent("resize",this,A,B);return this;},setContentSize:function(w,h){h+=this.getHeaderFooterHeight()+this.body.getMargins("tb");w+=this.body.getMargins("lr")+this.bwrap.getMargins("lr")+this.centerBg.getPadding("lr");h+=this.body.getPadding("tb")+this.bwrap.getBorderWidth("tb")+this.body.getBorderWidth("tb")+this.el.getBorderWidth("tb");w+=this.body.getPadding("lr")+this.bwrap.getBorderWidth("lr")+this.body.getBorderWidth("lr")+this.bwrap.getPadding("lr")+this.el.getBorderWidth("lr");if(this.tabs){h+=this.tabs.stripWrap.getHeight()+this.tabs.bodyEl.getMargins("tb")+this.tabs.bodyEl.getPadding("tb");w+=this.tabs.bodyEl.getMargins("lr")+this.tabs.bodyEl.getPadding("lr");}
+this.resizeTo(w,h);return this;},addKeyListener:function(A,fn,B){var C,D,E,F;if(typeof A=="object"&&!(A instanceof Array)){C=A["key"];D=A["shift"];E=A["ctrl"];F=A["alt"];}else {C=A;}var G=function(H,e){if((!D||e.shiftKey)&&(!E||e.ctrlKey)&&(!F||e.altKey)){var k=e.getKey();if(C instanceof Array){for(var i=0,I=C.length;i<I;i++){if(C[i]==k){fn.call(B||window,H,k,e);return;}}}else {if(k==C){fn.call(B||window,H,k,e);}}}};this.on("keydown",G);return this;},getTabs:function(){if(!this.tabs){this.el.addClass("x-dlg-auto-tabs");this.body.addClass(this.tabPosition=="bottom"?"x-tabs-bottom":"x-tabs-top");this.tabs=new Roo.TabPanel(this.body.dom,this.tabPosition=="bottom");}return this.tabs;},addButton:function(A,B,C){var dh=Roo.DomHelper;if(!this.footer){this.footer=dh.append(this.bwrap,{tag:"div",cls:"x-dlg-ft"},true);}if(!this.btnContainer){var tb=this.footer.createChild({cls:"x-dlg-btns x-dlg-btns-"+this.buttonAlign,html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'},null,true);this.btnContainer=tb.firstChild.firstChild.firstChild;}var D={handler:B,scope:C,minWidth:this.minButtonWidth,hideParent:true};if(typeof A=="string"){D.text=A;}else {if(A.tag){D.dhconfig=A;}else {Roo.apply(D,A);}}var fc=false;if((typeof(D.position)!='undefined')&&D.position<this.btnContainer.childNodes.length-1){D.position=Math.max(0,D.position);fc=this.btnContainer.childNodes[D.position];}var E=new Roo.Button(fc?this.btnContainer.insertBefore(document.createElement("td"),fc):this.btnContainer.appendChild(document.createElement("td")),D);this.syncBodyHeight();if(!this.buttons){this.buttons=[];}
+this.buttons.push(E);return E;},setDefaultButton:function(A){this.defaultButton=A;return this;},getHeaderFooterHeight:function(A){var B=0;if(this.header){B+=this.header.getHeight();}if(this.footer){var fm=this.footer.getMargins();B+=(this.footer.getHeight()+fm.top+fm.bottom);}
+B+=this.bwrap.getPadding("tb")+this.bwrap.getBorderWidth("tb");B+=this.centerBg.getPadding("tb");return B;},syncBodyHeight:function(){var bd=this.body,cb=this.centerBg,bw=this.bwrap;var A=this.size.height-this.getHeaderFooterHeight(false);bd.setHeight(A-bd.getMargins("tb"));var hh=this.header.getHeight();var h=this.size.height-hh;cb.setHeight(h);bw.setLeftTop(cb.getPadding("l"),hh+cb.getPadding("t"));bw.setHeight(h-cb.getPadding("tb"));bw.setWidth(this.el.getWidth(true)-cb.getPadding("lr"));bd.setWidth(bw.getWidth(true));if(this.tabs){this.tabs.syncHeight();if(Roo.isIE){this.tabs.el.repaint();}}},restoreState:function(){var A=Roo.state.Manager.get(this.stateId||(this.el.id+"-state"));if(A&&A.width){this.xy=[A.x,A.y];this.resizeTo(A.width,A.height);}return this;},beforeShow:function(){this.expand();if(this.fixedcenter){this.xy=this.el.getCenterXY(true);}if(this.modal){Roo.get(document.body).addClass("x-body-masked");this.mask.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.mask.show();}
+this.constrainXY();},animShow:function(){var b=Roo.get(this.animateTarget).getBox();this.proxy.setSize(b.width,b.height);this.proxy.setLocation(b.x,b.y);this.proxy.show();this.proxy.setBounds(this.xy[0],this.xy[1],this.size.width,this.size.height,true,.35,this.showEl.createDelegate(this));},show:function(A){if(this.fireEvent("beforeshow",this)===false){return;}if(this.syncHeightBeforeShow){this.syncBodyHeight();}else if(this.firstShow){this.firstShow=false;this.syncBodyHeight();}
+this.animateTarget=A||this.animateTarget;if(!this.el.isVisible()){this.beforeShow();if(this.animateTarget&&Roo.get(this.animateTarget)){this.animShow();}else {this.showEl();}}return this;},showEl:function(){this.proxy.hide();this.el.setXY(this.xy);this.el.show();this.adjustAssets(true);this.toFront();this.focus();if(Roo.isIE){this.el.repaint();}
+this.fireEvent("show",this);},focus:function(){if(this.defaultButton){this.defaultButton.focus();}else {this.focusEl.focus();}},constrainXY:function(){if(this.constraintoviewport!==false){if(!this.viewSize){if(this.container){var s=this.container.getSize();this.viewSize=[s.width,s.height];}else {this.viewSize=[Roo.lib.Dom.getViewWidth(),Roo.lib.Dom.getViewHeight()];}}var s=Roo.get(this.container||document).getScroll();var x=this.xy[0],y=this.xy[1];var w=this.size.width,h=this.size.height;var vw=this.viewSize[0],vh=this.viewSize[1];var A=false;if(x+w>vw+s.left){x=vw-w;A=true;}if(y+h>vh+s.top){y=vh-h;A=true;}if(x<s.left){x=s.left;A=true;}if(y<s.top){y=s.top;A=true;}if(A){this.xy=[x,y];if(this.isVisible()){this.el.setLocation(x,y);this.adjustAssets();}}}},onDrag:function(){if(!this.proxyDrag){this.xy=this.el.getXY();this.adjustAssets();}},adjustAssets:function(A){var x=this.xy[0],y=this.xy[1];var w=this.size.width,h=this.size.height;if(A===true){if(this.shadow){this.shadow.show(this.el);}if(this.shim){this.shim.show();}}if(this.shadow&&this.shadow.isVisible()){this.shadow.show(this.el);}if(this.shim&&this.shim.isVisible()){this.shim.setBounds(x,y,w,h);}},adjustViewport:function(w,h){if(!w||!h){w=Roo.lib.Dom.getViewWidth();h=Roo.lib.Dom.getViewHeight();}
+this.viewSize=[w,h];if(this.modal&&this.mask.isVisible()){this.mask.setSize(w,h);this.mask.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));}if(this.isVisible()){this.constrainXY();}},destroy:function(A){if(this.isVisible()){this.animateTarget=null;this.hide();}
+Roo.EventManager.removeResizeListener(this.adjustViewport,this);if(this.tabs){this.tabs.destroy(A);}
+Roo.destroy(this.shim,this.proxy,this.resizer,this.close,this.mask);if(this.dd){this.dd.unreg();}if(this.buttons){for(var i=0,B=this.buttons.length;i<B;i++){this.buttons[i].destroy();}}
+this.el.removeAllListeners();if(A===true){this.el.update("");this.el.remove();}
+Roo.DialogManager.unregister(this);},startMove:function(){if(this.proxyDrag){this.proxy.show();}if(this.constraintoviewport!==false){this.dd.constrainTo(document.body,{right:this.shadowOffset,bottom:this.shadowOffset});}},endMove:function(){if(!this.proxyDrag){Roo.dd.DD.prototype.endDrag.apply(this.dd,arguments);}else {Roo.dd.DDProxy.prototype.endDrag.apply(this.dd,arguments);this.proxy.hide();}
+this.refreshSize();this.adjustAssets();this.focus();this.fireEvent("move",this,this.xy[0],this.xy[1]);},toFront:function(){Roo.DialogManager.bringToFront(this);return this;},toBack:function(){Roo.DialogManager.sendToBack(this);return this;},center:function(){var xy=this.el.getCenterXY(true);this.moveTo(xy[0],xy[1]);return this;},moveTo:function(x,y){this.xy=[x,y];if(this.isVisible()){this.el.setXY(this.xy);this.adjustAssets();}return this;},alignTo:function(A,B,C){this.xy=this.el.getAlignToXY(A,B,C);if(this.isVisible()){this.el.setXY(this.xy);this.adjustAssets();}return this;},anchorTo:function(el,A,B,C){var D=function(){this.alignTo(el,A,B);};Roo.EventManager.onWindowResize(D,this);var tm=typeof C;if(tm!='undefined'){Roo.EventManager.on(window,'scroll',D,this,{buffer:tm=='number'?C:50});}
+D.call(this);return this;},isVisible:function(){return this.el.isVisible();},animHide:function(A){var b=Roo.get(this.animateTarget).getBox();this.proxy.show();this.proxy.setBounds(this.xy[0],this.xy[1],this.size.width,this.size.height);this.el.hide();this.proxy.setBounds(b.x,b.y,b.width,b.height,true,.35,this.hideEl.createDelegate(this,[A]));},hide:function(A){if(this.fireEvent("beforehide",this)===false){return;}if(this.shadow){this.shadow.hide();}if(this.shim){this.shim.hide();}if(this.animateTarget&&Roo.get(this.animateTarget)){this.animHide(A);}else {this.el.hide();this.hideEl(A);}return this;},hideEl:function(A){this.proxy.hide();if(this.modal){this.mask.hide();Roo.get(document.body).removeClass("x-body-masked");}
+this.fireEvent("hide",this);if(typeof A=="function"){A();}},hideAction:function(){this.setLeft("-10000px");this.setTop("-10000px");this.setStyle("visibility","hidden");},refreshSize:function(){this.size=this.el.getSize();this.xy=this.el.getXY();Roo.state.Manager.set(this.stateId||this.el.id+"-state",this.el.getBox());},setZIndex:function(A){if(this.modal){this.mask.setStyle("z-index",A);}if(this.shim){this.shim.setStyle("z-index",++A);}if(this.shadow){this.shadow.setZIndex(++A);}
+this.el.setStyle("z-index",++A);if(this.proxy){this.proxy.setStyle("z-index",++A);}if(this.resizer){this.resizer.proxy.setStyle("z-index",++A);}
+this.lastZIndex=A;},getEl:function(){return this.el;}});Roo.DialogManager=function(){var A={};var B=[];var C=null;var D=function(d1,d2){return (!d1._lastAccess||d1._lastAccess<d2._lastAccess)?-1:1;};var E=function(){B.sort(D);var F=Roo.DialogManager.zseed;for(var i=0,G=B.length;i<G;i++){var H=B[i];if(H){H.setZIndex(F+(i*10));}}};return {zseed:9000,register:function(F){A[F.id]=F;B.push(F);},unregister:function(F){delete A[F.id];var i=0;var G=0;if(!B.indexOf){for(i=0,G=B.length;i<G;i++){if(B[i]==F){B.splice(i,1);return;}}}else {i=B.indexOf(F);if(i!=-1){B.splice(i,1);}}},get:function(id){return typeof id=="object"?id:A[id];},bringToFront:function(F){F=this.get(F);if(F!=C){C=F;F._lastAccess=new Date().getTime();E();}return F;},sendToBack:function(F){F=this.get(F);F._lastAccess=-(new Date().getTime());E();return F;},hideAll:function(){for(var id in A){if(A[id]&&typeof A[id]!="function"&&A[id].isVisible()){A[id].hide();}}}};}();Roo.LayoutDialog=function(el,A){var B=A;if(typeof(A)=='undefined'){B=Roo.apply({},el);el=Roo.get(document.body||document.documentElement).createChild();}
+B.autoTabs=false;Roo.LayoutDialog.superclass.constructor.call(this,el,B);this.body.setStyle({overflow:"hidden",position:"relative"});this.layout=new Roo.BorderLayout(this.body.dom,B);this.layout.monitorWindowResize=false;this.el.addClass("x-dlg-auto-layout");this.center=Roo.BasicDialog.prototype.center;this.on("show",this.layout.layout,this.layout,true);if(B.items){var C=B.items;delete B.items;Roo.each(C,this.addxtype,this);}};Roo.extend(Roo.LayoutDialog,Roo.BasicDialog,{endUpdate:function(){this.layout.endUpdate();},beginUpdate:function(){this.layout.beginUpdate();},getLayout:function(){return this.layout;},showEl:function(){Roo.LayoutDialog.superclass.showEl.apply(this,arguments);if(Roo.isIE7){this.layout.layout();}},syncBodyHeight:function(){Roo.LayoutDialog.superclass.syncBodyHeight.call(this);if(this.layout){this.layout.layout();}},addxtype:function(c){return this.layout.addxtype(c);}});
+//Roo/MessageBox.js
+Roo.MessageBox=function(){var A,B,C,D;var E,F,G,H,I,pp;var J,K,L;var M=function(Q){A.hide();Roo.callback(B.fn,B.scope||window,[Q,K.dom.value],1);};var N=function(){if(B&&B.cls){A.el.removeClass(B.cls);}if(D){Roo.TaskMgr.stop(D);D=null;}};var O=function(b){var Q=0;if(!b){J["ok"].hide();J["cancel"].hide();J["yes"].hide();J["no"].hide();A.footer.dom.style.display='none';return Q;}
+A.footer.dom.style.display='';for(var k in J){if(typeof J[k]!="function"){if(b[k]){J[k].show();J[k].setText(typeof b[k]=="string"?b[k]:Roo.MessageBox.buttonText[k]);Q+=J[k].el.getWidth()+15;}else {J[k].hide();}}}return Q;};var P=function(d,k,e){if(B&&B.closable!==false){A.hide();}if(e){e.stopEvent();}};return {getDialog:function(){if(!A){A=new Roo.BasicDialog("x-msg-box",{autoCreate:true,shadow:true,draggable:true,resizable:false,constraintoviewport:false,fixedcenter:true,collapsible:false,shim:true,modal:true,width:400,height:100,buttonAlign:"center",closeClick:function(){if(B&&B.buttons&&B.buttons.no&&!B.buttons.cancel){M("no");}else {M("cancel");}}});A.on("hide",N);C=A.mask;A.addKeyListener(27,P);J={};var bt=this.buttonText;J["ok"]=A.addButton(bt["ok"],M.createCallback("ok"));J["yes"]=A.addButton(bt["yes"],M.createCallback("yes"));J["no"]=A.addButton(bt["no"],M.createCallback("no"));J["cancel"]=A.addButton(bt["cancel"],M.createCallback("cancel"));E=A.body.createChild({html:'<span class="roo-mb-text"></span><br /><input type="text" class="roo-mb-input" /><textarea class="roo-mb-textarea"></textarea><div class="roo-mb-progress-wrap"><div class="roo-mb-progress"><div class="roo-mb-progress-bar">&#160;</div></div></div>'});F=E.dom.firstChild;G=Roo.get(E.dom.childNodes[2]);G.enableDisplayMode();G.addKeyListener([10,13],function(){if(A.isVisible()&&B&&B.buttons){if(B.buttons.ok){M("ok");}else if(B.buttons.yes){M("yes");}}});H=Roo.get(E.dom.childNodes[3]);H.enableDisplayMode();I=Roo.get(E.dom.childNodes[4]);I.enableDisplayMode();var pf=I.dom.firstChild;if(pf){pp=Roo.get(pf.firstChild);pp.setHeight(pf.offsetHeight);}}return A;},updateText:function(Q){if(!A.isVisible()&&!B.width){A.resizeTo(this.maxWidth,100);}
+F.innerHTML=Q||'&#160;';var cw=Math.max(F.offsetWidth,F.parentNode.scrollWidth);var w=Math.max(Math.min(B.width||cw,this.maxWidth),Math.max(B.minWidth||this.minWidth,L));if(B.prompt){K.setWidth(w);}if(A.isVisible()){A.fixedcenter=false;}if(E.getHeight()>(Roo.lib.Dom.getViewHeight()-100)){E.setHeight(Roo.lib.Dom.getViewHeight()-100);E.dom.style.overflowY='auto'+(Roo.isIE?'':' !important');}else {E.dom.style.height='';E.dom.style.overflowY='';}if(cw>w){E.dom.style.get='auto'+(Roo.isIE?'':' !important');}else {E.dom.style.overflowX='';}
+A.setContentSize(w,E.getHeight());if(A.isVisible()){A.fixedcenter=true;}return this;},updateProgress:function(Q,R){if(R){this.updateText(R);}if(pp){pp.setWidth(Math.floor(Q*I.dom.firstChild.offsetWidth));}return this;},isVisible:function(){return A&&A.isVisible();},hide:function(){if(this.isVisible()){A.hide();}},show:function(Q){if(this.isVisible()){this.hide();Roo.log("Old Dialog Message:"+F.innerHTML)}var d=this.getDialog();B=Q;d.setTitle(B.title||"&#160;");d.close.setDisplayed(B.closable!==false);K=G;B.prompt=B.prompt||(B.multiline?true:false);if(B.prompt){if(B.multiline){G.hide();H.show();H.setHeight(typeof B.multiline=="number"?B.multiline:this.defaultTextHeight);K=H;}else {G.show();H.hide();}}else {G.hide();H.hide();}
+I.setDisplayed(B.progress===true);this.updateProgress(0);K.dom.value=B.value||"";if(B.prompt){A.setDefaultButton(K);}else {var bs=B.buttons;var db=null;if(bs&&bs.ok){db=J["ok"];}else if(bs&&bs.yes){db=J["yes"];}
+A.setDefaultButton(db);}
+L=O(B.buttons);this.updateText(B.msg);if(B.cls){d.el.addClass(B.cls);}
+d.proxyDrag=B.proxyDrag===true;d.modal=B.modal!==false;d.mask=B.modal!==false?C:false;if(!d.isVisible()){document.body.appendChild(A.el.dom);d.animateTarget=null;d.show(Q.animEl);}return this;},progress:function(Q,R){this.show({title:Q,msg:R,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,modal:true});return this;},alert:function(Q,R,fn,S){this.show({title:Q,msg:R,buttons:this.OK,fn:fn,scope:S,modal:true});return this;},wait:function(Q,R){this.show({title:R,msg:Q,buttons:false,closable:false,progress:true,modal:true,width:300,wait:true});D=Roo.TaskMgr.start({run:function(i){Roo.MessageBox.updateProgress(((((i+20)%20)+1)*5)*.01);},interval:1000});return this;},confirm:function(Q,R,fn,S){this.show({title:Q,msg:R,buttons:this.YESNO,fn:fn,scope:S,modal:true});return this;},prompt:function(Q,R,fn,S,T){this.show({title:Q,msg:R,buttons:this.OKCANCEL,fn:fn,minWidth:250,scope:S,prompt:true,multiline:T,modal:true});return this;},OK:{ok:true},YESNO:{yes:true,no:true},OKCANCEL:{ok:true,cancel:true},YESNOCANCEL:{yes:true,no:true,cancel:true},defaultTextHeight:75,maxWidth:600,minWidth:100,minProgressWidth:250,buttonText:{ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"}};}();Roo.Msg=Roo.MessageBox;
+//Roo/QuickTips.js
+Roo.QuickTips=function(){var el,A,B,C,tm,D,E,F={},G,H=null,I,J;var ce,bd,xy,dd;var K=false,L=true,M=false;var N=1,O=1,P=1,Q=[];var R=function(e){if(L){return;}var t=e.getTarget();if(!t||t.nodeType!==1||t==document||t==document.body){return;}if(ce&&t==ce.el){clearTimeout(O);return;}if(t&&F[t.id]){F[t.id].el=t;N=W.defer(tm.showDelay,tm,[F[t.id]]);return;}var a,et=Roo.fly(t);var ns=D.namespace;if(tm.interceptTitles&&t.title){a=t.title;t.qtip=a;t.removeAttribute("title");e.preventDefault();}else {a=t.qtip||et.getAttributeNS(ns,D.attribute);}if(a){N=W.defer(tm.showDelay,tm,[{el:t,text:a,width:et.getAttributeNS(ns,D.width),autoHide:et.getAttributeNS(ns,D.hide)!="user",title:et.getAttributeNS(ns,D.title),cls:et.getAttributeNS(ns,D.cls)}]);}};var S=function(e){clearTimeout(N);var t=e.getTarget();if(t&&ce&&ce.el==t&&(tm.autoHide&&ce.autoHide!==false)){O=setTimeout(Y,tm.hideDelay);}};var T=function(e){if(L){return;}
+xy=e.getXY();xy[1]+=18;if(tm.trackMouse&&ce){el.setXY(xy);}};var U=function(e){clearTimeout(N);clearTimeout(O);if(!e.within(el)){if(tm.hideOnClick){Y();tm.disable();tm.enable.defer(100,tm);}}};var V=function(){return 2;};var W=function(o){if(L){return;}
+clearTimeout(P);ce=o;if(H){el.removeClass(H);H=null;}if(ce.cls){el.addClass(ce.cls);H=ce.cls;}if(ce.title){C.update(ce.title);C.show();}else {C.update('');C.hide();}
+el.dom.style.width=tm.maxWidth+'px';B.update(o.text);var p=V(),w=ce.width;if(!w){var td=B.dom;var aw=Math.max(td.offsetWidth,td.clientWidth,td.scrollWidth);if(aw>tm.maxWidth){w=tm.maxWidth;}else if(aw<tm.minWidth){w=tm.minWidth;}else {w=aw;}}
+el.setWidth(parseInt(w,10)+p);if(ce.autoHide===false){E.setDisplayed(true);if(dd){dd.unlock();}}else {E.setDisplayed(false);if(dd){dd.lock();}}if(xy){el.avoidY=xy[1]-18;el.setXY(xy);}if(tm.animate){el.setOpacity(.1);el.setStyle("visibility","visible");el.fadeIn({callback:X});}else {X();}};var X=function(){if(ce){el.show();G.enable();if(tm.autoDismiss&&ce.autoHide!==false){P=setTimeout(Y,tm.autoDismissDelay);}}};var Y=function(a){clearTimeout(P);clearTimeout(O);ce=null;if(el.isVisible()){G.disable();if(a!==true&&tm.animate){el.fadeOut({callback:Z});}else {Z();}}};var Z=function(){el.hide();if(H){el.removeClass(H);H=null;}};return {minWidth:40,maxWidth:300,interceptTitles:false,trackMouse:false,hideOnClick:true,showDelay:500,hideDelay:200,autoHide:true,autoDismiss:true,autoDismissDelay:5000,animate:false,title:'',text:'',cls:'',width:null,init:function(){tm=Roo.QuickTips;D=tm.tagConfig;if(!M){if(!Roo.isReady){Roo.onReady(Roo.QuickTips.init,Roo.QuickTips);return;}
+el=new Roo.Layer({cls:"x-tip",shadow:"drop",shim:true,constrain:true,shadowOffset:4});el.fxDefaults={stopFx:true};el.update('<div class="x-tip-bd"><div class="x-tip-close"></div><h3></h3><div class="x-tip-bd-inner"></div><div class="x-clear"></div></div>');C=el.child('h3');C.enableDisplayMode("block");A=el.child('div.x-tip-bd');B=el.child('div.x-tip-bd-inner');E=el.child('div.x-tip-close');E.enableDisplayMode("block");E.on("click",Y);var d=Roo.get(document);d.on("mousedown",U);d.on("mouseover",R);d.on("mouseout",S);d.on("mousemove",T);G=d.addKeyListener(27,Y);G.disable();if(Roo.dd.DD){dd=el.initDD("default",null,{onDrag:function(){el.sync();}});dd.setHandleElId(C.id);dd.lock();}
+M=true;}
+this.enable();},register:function(a){var cs=a instanceof Array?a:arguments;for(var i=0,b=cs.length;i<b;i++){var c=cs[i];var d=c.target;if(d){if(d instanceof Array){for(var j=0,e=d.length;j<e;j++){F[d[j]]=c;}}else {F[typeof d=='string'?d:Roo.id(d)]=c;}}}},unregister:function(el){delete F[Roo.id(el)];},enable:function(){if(M&&L){Q.pop();if(Q.length<1){L=false;}}},disable:function(){L=true;clearTimeout(N);clearTimeout(O);clearTimeout(P);if(ce){Y(true);}
+Q.push(1);},isEnabled:function(){return !L;},tagConfig:{namespace:"ext",attribute:"qtip",width:"width",target:"target",title:"qtitle",hide:"hide",cls:"qclass"}};}();Roo.QuickTips.tips=Roo.QuickTips.register;
+//Roo/tree/TreePanel.js
+Roo.tree.TreePanel=function(el,A){var B=false;var C=false;if(A.root){B=A.root;delete A.root;}if(A.loader){C=A.loader;delete A.loader;}
+Roo.apply(this,A);Roo.tree.TreePanel.superclass.constructor.call(this);this.el=Roo.get(el);this.el.addClass('x-tree');if(B){this.setRootNode(Roo.factory(B,Roo.tree));}if(C){this.loader=Roo.factory(C,Roo.tree);}
+this.id=this.el.id;this.addEvents({"beforeload":true,"load":true,"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"checkchange":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true,"startdrag":true,"enddrag":true,"dragdrop":true,"beforenodedrop":true,"nodedrop":true,"nodedragover":true});if(this.singleExpand){this.on("beforeexpand",this.restrictExpand,this);}if(this.editor){this.editor.tree=this;this.editor=Roo.factory(this.editor,Roo.tree);}if(this.selModel){this.selModel=Roo.factory(this.selModel,Roo.tree);}};Roo.extend(Roo.tree.TreePanel,Roo.data.Tree,{rootVisible:true,animate:Roo.enableFx,lines:true,enableDD:false,hlDrop:Roo.enableFx,renderer:false,rendererTip:false,restrictExpand:function(A){var p=A.parentNode;if(p){if(p.expandedChild&&p.expandedChild.parentNode==p){p.expandedChild.collapse();}
+p.expandedChild=A;}},setRootNode:function(A){Roo.tree.TreePanel.superclass.setRootNode.call(this,A);if(!this.rootVisible){A.ui=new Roo.tree.RootTreeNodeUI(A);}return A;},getEl:function(){return this.el;},getLoader:function(){return this.loader;},expandAll:function(){this.root.expand(true);},collapseAll:function(){this.root.collapse(true);},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.tree.DefaultSelectionModel();}return this.selModel;},getChecked:function(a,A){A=A||this.root;var r=[];var f=function(){if(this.attributes.checked){r.push(!a?this:(a=='id'?this.id:this.attributes[a]));}}
+A.cascade(f);return r;},expandPath:function(A,B,C){B=B||"id";var D=A.split(this.pathSeparator);var E=this.root;if(E.attributes[B]!=D[1]){if(C){C(false,null);}return;}var F=1;var f=function(){if(++F==D.length){if(C){C(true,E);}return;}var c=E.findChild(B,D[F]);if(!c){if(C){C(false,E);}return;}
+E=c;c.expand(false,false,f);};E.expand(false,false,f);},selectPath:function(A,B,C){B=B||"id";var D=A.split(this.pathSeparator);var v=D.pop();if(D.length>0){var f=function(E,F){if(E&&F){var n=F.findChild(B,v);if(n){n.select();if(C){C(true,n);}}else if(C){C(false,n);}}else {if(C){C(false,n);}}};this.expandPath(D.join(this.pathSeparator),B,f);}else {this.root.select();if(C){C(true,this.root);}}},getTreeEl:function(){return this.el;},render:function(){if(this.innerCt){return this;}
+this.innerCt=this.el.createChild({tag:"ul",cls:"x-tree-root-ct "+(this.lines?"x-tree-lines":"x-tree-no-lines")});if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Roo.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true});}if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Roo.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll});}
+this.getSelectionModel().init(this);if(!this.root){Roo.log("ROOT not set in tree");return this;}
+this.root.render();if(!this.rootVisible){this.root.renderChildren();}return this;}});
+//Roo/tree/TreeSelectionModel.js
+Roo.tree.DefaultSelectionModel=function(A){this.selNode=null;this.addEvents({"selectionchange":true,"beforeselect":true});Roo.tree.DefaultSelectionModel.superclass.constructor.call(this,A);};Roo.extend(Roo.tree.DefaultSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this);},onNodeClick:function(A,e){if(e.ctrlKey&&this.selNode==A){this.unselect(A);return;}
+this.select(A);},select:function(A){var B=this.selNode;if(B!=A&&this.fireEvent('beforeselect',this,A,B)!==false){if(B){B.ui.onSelectedChange(false);}
+this.selNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,A,B);}return A;},unselect:function(A){if(this.selNode==A){this.clearSelections();}},clearSelections:function(){var n=this.selNode;if(n){n.ui.onSelectedChange(false);this.selNode=null;this.fireEvent("selectionchange",this,null);}return n;},getSelectedNode:function(){return this.selNode;},isSelected:function(A){return this.selNode==A;},selectPrevious:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}var ps=s.previousSibling;if(ps){if(!ps.isExpanded()||ps.childNodes.length<1){return this.select(ps);}else {var lc=ps.lastChild;while(lc&&lc.isExpanded()&&lc.childNodes.length>0){lc=lc.lastChild;}return this.select(lc);}}else if(s.parentNode&&(this.tree.rootVisible||!s.parentNode.isRoot)){return this.select(s.parentNode);}return null;},selectNext:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}if(s.firstChild&&s.isExpanded()){return this.select(s.firstChild);}else if(s.nextSibling){return this.select(s.nextSibling);}else if(s.parentNode){var A=null;s.parentNode.bubble(function(){if(this.nextSibling){A=this.getOwnerTree().selModel.select(this.nextSibling);return false;}});return A;}return null;},onKeyDown:function(e){var s=this.selNode||this.lastSelNode;var sm=this;if(!s){return;}var k=e.getKey();switch(k){case e.DOWN:e.stopEvent();this.selectNext();break;case e.UP:e.stopEvent();this.selectPrevious();break;case e.RIGHT:e.preventDefault();if(s.hasChildNodes()){if(!s.isExpanded()){s.expand();}else if(s.firstChild){this.select(s.firstChild,e);}}break;case e.LEFT:e.preventDefault();if(s.hasChildNodes()&&s.isExpanded()){s.collapse();}else if(s.parentNode&&(this.tree.rootVisible||s.parentNode!=this.tree.getRootNode())){this.select(s.parentNode,e);}break;};}});Roo.tree.MultiSelectionModel=function(){this.selNodes=[];this.selMap={};this.addEvents({"selectionchange":true});Roo.tree.MultiSelectionModel.superclass.constructor.call(this,cfg);};Roo.extend(Roo.tree.MultiSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this);},onNodeClick:function(A,e){this.select(A,e,e.ctrlKey);},select:function(A,e,B){if(B!==true){this.clearSelections(true);}if(this.isSelected(A)){this.lastSelNode=A;return A;}
+this.selNodes.push(A);this.selMap[A.id]=A;this.lastSelNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return A;},unselect:function(A){if(this.selMap[A.id]){A.ui.onSelectedChange(false);var sn=this.selNodes;var B=-1;if(sn.indexOf){B=sn.indexOf(A);}else {for(var i=0,C=sn.length;i<C;i++){if(sn[i]==A){B=i;break;}}}if(B!=-1){this.selNodes.splice(B,1);}delete this.selMap[A.id];this.fireEvent("selectionchange",this,this.selNodes);}},clearSelections:function(A){var sn=this.selNodes;if(sn.length>0){for(var i=0,B=sn.length;i<B;i++){sn[i].ui.onSelectedChange(false);}
+this.selNodes=[];this.selMap={};if(A!==true){this.fireEvent("selectionchange",this,this.selNodes);}}},isSelected:function(A){return this.selMap[A.id]?true:false;},getSelectedNodes:function(){return this.selNodes;},onKeyDown:Roo.tree.DefaultSelectionModel.prototype.onKeyDown,selectNext:Roo.tree.DefaultSelectionModel.prototype.selectNext,selectPrevious:Roo.tree.DefaultSelectionModel.prototype.selectPrevious});
+//Roo/tree/TreeNode.js
+Roo.tree.TreeNode=function(A){A=A||{};if(typeof A=="string"){A={text:A};}
+this.childrenRendered=false;this.rendered=false;Roo.tree.TreeNode.superclass.constructor.call(this,A);this.expanded=A.expanded===true;this.isTarget=A.isTarget!==false;this.draggable=A.draggable!==false&&A.allowDrag!==false;this.allowChildren=A.allowChildren!==false&&A.allowDrop!==false;this.text=A.text;this.disabled=A.disabled===true;this.addEvents({"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"checkchange":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true});var B=this.attributes.uiProvider||Roo.tree.TreeNodeUI;this.ui=new B(this);if(typeof(this.attributes.items)=='undefined'||!this.attributes.items){return;}
+Roo.each(this.attributes.items,function(c){this.appendChild(Roo.factory(c,Roo.Tree));},this)};Roo.extend(Roo.tree.TreeNode,Roo.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded;},getUI:function(){return this.ui;},setFirstChild:function(A){var of=this.firstChild;Roo.tree.TreeNode.superclass.setFirstChild.call(this,A);if(this.childrenRendered&&of&&A!=of){of.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},setLastChild:function(A){var ol=this.lastChild;Roo.tree.TreeNode.superclass.setLastChild.call(this,A);if(this.childrenRendered&&ol&&A!=ol){ol.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);}},appendChild:function(){var A=Roo.tree.TreeNode.superclass.appendChild.apply(this,arguments);if(A&&this.childrenRendered){A.render();}
+this.ui.updateExpandIcon();return A;},removeChild:function(A){this.ownerTree.getSelectionModel().unselect(A);Roo.tree.TreeNode.superclass.removeChild.apply(this,arguments);if(this.childrenRendered){A.ui.remove();}if(this.childNodes.length<1){this.collapse(false,false);}else {this.ui.updateExpandIcon();}if(!this.firstChild){this.childrenRendered=false;}return A;},insertBefore:function(A,B){var C=Roo.tree.TreeNode.superclass.insertBefore.apply(this,arguments);if(C&&B&&this.childrenRendered){A.render();}
+this.ui.updateExpandIcon();return C;},setText:function(A){var B=this.text;this.text=A;this.attributes.text=A;if(this.rendered){this.ui.onTextChange(this,A,B);}
+this.fireEvent("textchange",this,A,B);},select:function(){this.getOwnerTree().getSelectionModel().select(this);},unselect:function(){this.getOwnerTree().getSelectionModel().unselect(this);},isSelected:function(){return this.getOwnerTree().getSelectionModel().isSelected(this);},expand:function(A,B,C){if(!this.expanded){if(this.fireEvent("beforeexpand",this,A,B)===false){return;}if(!this.childrenRendered){this.renderChildren();}
+this.expanded=true;if(!this.isHiddenRoot()&&(this.getOwnerTree().animate&&B!==false)||B){this.ui.animExpand(function(){this.fireEvent("expand",this);if(typeof C=="function"){C(this);}if(A===true){this.expandChildNodes(true);}}.createDelegate(this));return;}else {this.ui.expand();this.fireEvent("expand",this);if(typeof C=="function"){C(this);}}}else {if(typeof C=="function"){C(this);}}if(A===true){this.expandChildNodes(true);}},isHiddenRoot:function(){return this.isRoot&&!this.getOwnerTree().rootVisible;},collapse:function(A,B){if(this.expanded&&!this.isHiddenRoot()){if(this.fireEvent("beforecollapse",this,A,B)===false){return;}
+this.expanded=false;if((this.getOwnerTree().animate&&B!==false)||B){this.ui.animCollapse(function(){this.fireEvent("collapse",this);if(A===true){this.collapseChildNodes(true);}}.createDelegate(this));return;}else {this.ui.collapse();this.fireEvent("collapse",this);}}if(A===true){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].collapse(true,false);}}},delayedExpand:function(A){if(!this.expandProcId){this.expandProcId=this.expand.defer(A,this);}},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);}
+this.expandProcId=false;},toggle:function(){if(this.expanded){this.collapse();}else {this.expand();}},ensureVisible:function(A){var B=this.getOwnerTree();B.expandPath(this.parentNode.getPath(),false,function(){B.getTreeEl().scrollChildIntoView(this.ui.anchor);Roo.callback(A);}.createDelegate(this));},expandChildNodes:function(A){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].expand(A);}},collapseChildNodes:function(A){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].collapse(A);}},disable:function(){this.disabled=true;this.unselect();if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,true);}
+this.fireEvent("disabledchange",this,true);},enable:function(){this.disabled=false;if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,false);}
+this.fireEvent("disabledchange",this,false);},renderChildren:function(A){if(A!==false){this.fireEvent("beforechildrenrendered",this);}var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].render(true);}
+this.childrenRendered=true;},sort:function(fn,A){Roo.tree.TreeNode.superclass.sort.apply(this,arguments);if(this.childrenRendered){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].render(true);}}},render:function(A){this.ui.render(A);if(!this.rendered){this.rendered=true;if(this.expanded){this.expanded=false;this.expand(false,false);}}},renderIndent:function(A,B){if(B){this.ui.childIndent=null;}
+this.ui.renderIndent();if(A===true&&this.childrenRendered){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].renderIndent(true,B);}}}});
+//Roo/tree/AsyncTreeNode.js
+Roo.tree.AsyncTreeNode=function(A){this.loaded=false;this.loading=false;Roo.tree.AsyncTreeNode.superclass.constructor.apply(this,arguments);this.addEvents({'beforeload':true,'load':true});};Roo.extend(Roo.tree.AsyncTreeNode,Roo.tree.TreeNode,{expand:function(A,B,C){if(this.loading){var D;var f=function(){if(!this.loading){clearInterval(D);this.expand(A,B,C);}}.createDelegate(this);D=setInterval(f,200);return;}if(!this.loaded){if(this.fireEvent("beforeload",this)===false){return;}
+this.loading=true;this.ui.beforeLoad(this);var E=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();if(E){E.load(this,this.loadComplete.createDelegate(this,[A,B,C]));return;}}
+Roo.tree.AsyncTreeNode.superclass.expand.call(this,A,B,C);},isLoading:function(){return this.loading;},loadComplete:function(A,B,C){this.loading=false;this.loaded=true;this.ui.afterLoad(this);this.fireEvent("load",this);this.expand(A,B,C);},isLoaded:function(){return this.loaded;},hasChildNodes:function(){if(!this.isLeaf()&&!this.loaded){return true;}else {return Roo.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);}},reload:function(A){this.collapse(false,false);while(this.firstChild){this.removeChild(this.firstChild);}
+this.childrenRendered=false;this.loaded=false;if(this.isHiddenRoot()){this.expanded=false;}
+this.expand(false,false,A);}});
+//Roo/tree/TreeNodeUI.js
+Roo.tree.TreeNodeUI=function(A){this.node=A;this.rendered=false;this.animating=false;this.emptyIcon=Roo.BLANK_IMAGE_URL;};Roo.tree.TreeNodeUI.prototype={removeChild:function(A){if(this.rendered){this.ctNode.removeChild(A.ui.getEl());}},beforeLoad:function(){this.addClass("x-tree-node-loading");},afterLoad:function(){this.removeClass("x-tree-node-loading");},onTextChange:function(A,B,C){if(this.rendered){this.textNode.innerHTML=B;}},onDisableChange:function(A,B){this.disabled=B;if(B){this.addClass("x-tree-node-disabled");}else {this.removeClass("x-tree-node-disabled");}},onSelectedChange:function(A){if(A){this.focus();this.addClass("x-tree-selected");}else {this.removeClass("x-tree-selected");}},onMove:function(A,B,C,D,E,F){this.childIndent=null;if(this.rendered){var G=D.ui.getContainer();if(!G){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);return;}var H=F?F.ui.getEl():null;if(H){G.insertBefore(this.wrap,H);}else {G.appendChild(this.wrap);}
+this.node.renderIndent(true);}},addClass:function(A){if(this.elNode){Roo.fly(this.elNode).addClass(A);}},removeClass:function(A){if(this.elNode){Roo.fly(this.elNode).removeClass(A);}},remove:function(){if(this.rendered){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);}},fireEvent:function(){return this.node.fireEvent.apply(this.node,arguments);},initEvents:function(){this.node.on("move",this.onMove,this);var E=Roo.EventManager;var a=this.anchor;var el=Roo.fly(a,'_treeui');if(Roo.isOpera){el.setStyle("text-decoration","none");}
+el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);if(this.checkbox){Roo.EventManager.on(this.checkbox,Roo.isIE?'click':'change',this.onCheckChange,this);}
+el.on("contextmenu",this.onContextMenu,this);var A=Roo.fly(this.iconNode);A.on("click",this.onClick,this);A.on("dblclick",this.onDblClick,this);A.on("contextmenu",this.onContextMenu,this);E.on(this.ecNode,"click",this.ecClick,this,true);if(this.node.disabled){this.addClass("x-tree-node-disabled");}if(this.node.hidden){this.addClass("x-tree-node-disabled");}var ot=this.node.getOwnerTree();var dd=ot.enableDD||ot.enableDrag||ot.enableDrop;if(dd&&(!this.node.isRoot||ot.rootVisible)){Roo.dd.Registry.register(this.elNode,{node:this.node,handles:this.getDDHandles(),isHandle:false});}},getDDHandles:function(){return [this.iconNode,this.textNode];},hide:function(){if(this.rendered){this.wrap.style.display="none";}},show:function(){if(this.rendered){this.wrap.style.display="";}},onContextMenu:function(e){if(this.node.hasListener("contextmenu")||this.node.getOwnerTree().hasListener("contextmenu")){e.preventDefault();this.focus();this.fireEvent("contextmenu",this.node,e);}},onClick:function(e){if(this.dropping){e.stopEvent();return;}if(this.fireEvent("beforeclick",this.node,e)!==false){if(!this.disabled&&this.node.attributes.href){this.fireEvent("click",this.node,e);return;}
+e.preventDefault();if(this.disabled){return;}if(this.node.attributes.singleClickExpand&&!this.animating&&this.node.hasChildNodes()){this.node.toggle();}
+this.fireEvent("click",this.node,e);}else {e.stopEvent();}},onDblClick:function(e){e.preventDefault();if(this.disabled){return;}if(this.checkbox){this.toggleCheck();}if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}
+this.fireEvent("dblclick",this.node,e);},onCheckChange:function(){var A=this.checkbox.checked;this.node.attributes.checked=A;this.fireEvent('checkchange',this.node,A);},ecClick:function(e){if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}},startDrop:function(){this.dropping=true;},endDrop:function(){setTimeout(function(){this.dropping=false;}.createDelegate(this),50);},expand:function(){this.updateExpandIcon();this.ctNode.style.display="";},focus:function(){if(!this.node.preventHScroll){try{this.anchor.focus();}catch(e){}}else if(!Roo.isIE){try{var A=this.node.getOwnerTree().getTreeEl().dom;var l=A.scrollLeft;this.anchor.focus();A.scrollLeft=l;}catch(e){}}},toggleCheck:function(A){var cb=this.checkbox;if(cb){cb.checked=(A===undefined?!cb.checked:A);}},blur:function(){try{this.anchor.blur();}catch(e){}},animExpand:function(A){var ct=Roo.get(this.ctNode);ct.stopFx();if(!this.node.hasChildNodes()){this.updateExpandIcon();this.ctNode.style.display="";Roo.callback(A);return;}
+this.animating=true;this.updateExpandIcon();ct.slideIn('t',{callback:function(){this.animating=false;Roo.callback(A);},scope:this,duration:this.node.ownerTree.duration||.25});},highlight:function(){var A=this.node.getOwnerTree();Roo.fly(this.wrap).highlight(A.hlColor||"C3DAF9",{endColor:A.hlBaseColor});},collapse:function(){this.updateExpandIcon();this.ctNode.style.display="none";},animCollapse:function(A){var ct=Roo.get(this.ctNode);ct.enableDisplayMode('block');ct.stopFx();this.animating=true;this.updateExpandIcon();ct.slideOut('t',{callback:function(){this.animating=false;Roo.callback(A);},scope:this,duration:this.node.ownerTree.duration||.25});},getContainer:function(){return this.ctNode;},getEl:function(){return this.wrap;},appendDDGhost:function(A){A.appendChild(this.elNode.cloneNode(true));},getDDRepairXY:function(){return Roo.lib.Dom.getXY(this.iconNode);},onRender:function(){this.render();},render:function(A){var n=this.node,a=n.attributes;var B=n.parentNode?n.parentNode.ui.getContainer():n.ownerTree.innerCt.dom;if(!this.rendered){this.rendered=true;this.renderElements(n,a,B,A);if(a.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle);}}else {this.textNode.setAttribute("ext:qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttribute("ext:qtitle",a.qtipTitle);}}}else if(a.qtipCfg){a.qtipCfg.target=Roo.id(this.textNode);Roo.QuickTips.register(a.qtipCfg);}
+this.initEvents();if(!this.node.expanded){this.updateExpandIcon();}}else {if(A===true){B.appendChild(this.wrap);}}},renderElements:function(n,a,A,B){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var t=n.getOwnerTree();var C=t.renderer?t.renderer(n.attributes):Roo.util.Format.htmlEncode(n.text);if(typeof(n.attributes.html)!='undefined'){C=n.attributes.html;}var D=t.rendererTip?t.rendererTip(n.attributes):C;var cb=typeof a.checked=='boolean';var E=a.href?a.href:Roo.isGecko?"":"#";var F=['<li class="x-tree-node"><div class="x-tree-node-el ',a.cls,'">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon" />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on" />',cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':' />')):'','<a hidefocus="on" href="',E,'" tabIndex="1" ',a.hrefTarget?' target="'+a.hrefTarget+'"':"",'><span unselectable="on" qtip="',D,'">',C,"</span></a></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"];if(B!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),F.join(""));}else {this.wrap=Roo.DomHelper.insertHtml("beforeEnd",A,F.join(""));}
+this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var G=3;if(cb){this.checkbox=cs[3];G++;}
+this.anchor=cs[G];this.textNode=cs[G].firstChild;},getAnchor:function(){return this.anchor;},getTextEl:function(){return this.textNode;},getIconEl:function(){return this.iconNode;},isChecked:function(){return this.checkbox?this.checkbox.checked:false;},updateExpandIcon:function(){if(this.rendered){var n=this.node,c1,c2;var A=n.isLast()?"x-tree-elbow-end":"x-tree-elbow";var B=n.hasChildNodes();if(B){if(n.expanded){A+="-minus";c1="x-tree-node-collapsed";c2="x-tree-node-expanded";}else {A+="-plus";c1="x-tree-node-expanded";c2="x-tree-node-collapsed";}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false;}if(this.c1!=c1||this.c2!=c2){Roo.fly(this.elNode).replaceClass(c1,c2);this.c1=c1;this.c2=c2;}}else {if(!this.wasLeaf&&this.node.leaf){Roo.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");delete this.c1;delete this.c2;this.wasLeaf=true;}}var C="x-tree-ec-icon "+A;if(this.ecc!=C){this.ecNode.className=C;this.ecc=C;}}},getChildIndent:function(){if(!this.childIndent){var A=[];var p=this.node;while(p){if(!p.isRoot||(p.isRoot&&p.ownerTree.rootVisible)){if(!p.isLast()){A.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');}else {A.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');}}
+p=p.parentNode;}
+this.childIndent=A.join("");}return this.childIndent;},renderIndent:function(){if(this.rendered){var A="";var p=this.node.parentNode;if(p){A=p.ui.getChildIndent();}if(this.indentMarkup!=A){this.indentNode.innerHTML=A;this.indentMarkup=A;}
+this.updateExpandIcon();}}};Roo.tree.RootTreeNodeUI=function(){Roo.tree.RootTreeNodeUI.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.tree.RootTreeNodeUI,Roo.tree.TreeNodeUI,{render:function(){if(!this.rendered){var A=this.node.ownerTree.innerCt.dom;this.node.expanded=true;A.innerHTML='<div class="x-tree-root-node"></div>';this.wrap=this.ctNode=A.firstChild;}},collapse:function(){},expand:function(){}});
+//Roo/tree/TreeLoader.js
+Roo.tree.TreeLoader=function(A){this.baseParams={};this.requestMethod="POST";Roo.apply(this,A);this.addEvents({beforeload:true,load:true,loadexception:true,create:true});Roo.tree.TreeLoader.superclass.constructor.call(this);};Roo.extend(Roo.tree.TreeLoader,Roo.util.Observable,{uiProviders:{},clearOnLoad:true,root:false,queryParam:false,load:function(A,B){if(this.clearOnLoad){while(A.firstChild){A.removeChild(A.firstChild);}}if(A.attributes.children){var cs=A.attributes.children;for(var i=0,C=cs.length;i<C;i++){A.appendChild(this.createNode(cs[i]));}if(typeof B=="function"){B();}}else if(this.dataUrl){this.requestData(A,B);}},getParams:function(A){var B=[],bp=this.baseParams;for(var C in bp){if(typeof bp[C]!="function"){B.push(encodeURIComponent(C),"=",encodeURIComponent(bp[C]),"&");}}var n=this.queryParam===false?'node':this.queryParam;B.push(n+"=",encodeURIComponent(A.id));return B.join("");},requestData:function(A,B){if(this.fireEvent("beforeload",this,A,B)!==false){this.transId=Roo.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:B,node:A},params:this.getParams(A)});}else {if(typeof B=="function"){B();}}},isLoading:function(){return this.transId?true:false;},abort:function(){if(this.isLoading()){Roo.Ajax.abort(this.transId);}},createNode:function(attr){if(this.baseAttrs){Roo.applyIf(attr,this.baseAttrs);}if(this.applyLoader!==false){attr.loader=this;}if(typeof(attr.uiProvider)=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}if(typeof(this.uiProviders['default'])!='undefined'){attr.uiProvider=this.uiProviders['default'];}
+this.fireEvent('create',this,attr);attr.leaf=typeof(attr.leaf)=='string'?attr.leaf*1:attr.leaf;return (attr.leaf?new Roo.tree.TreeNode(attr):new Roo.tree.AsyncTreeNode(attr));},processResponse:function(A,B,C){var D=A.responseText;try{var o=Roo.decode(D);if(!o.success){var a=A.argument;this.fireEvent("loadexception",this,a.node,A);Roo.log("Load failed - should have a handler really");return;}if(this.root!==false){o=o[this.root];}for(var i=0,E=o.length;i<E;i++){var n=this.createNode(o[i]);if(n){B.appendChild(n);}}if(typeof C=="function"){C(this,B);}}catch(e){this.handleFailure(response);}},handleResponse:function(A){this.transId=false;var a=A.argument;this.processResponse(A,a.node,a.callback);this.fireEvent("load",this,a.node,A);},handleFailure:function(A){this.transId=false;var a=A.argument;this.fireEvent("loadexception",this,a.node,A);if(typeof a.callback=="function"){a.callback(this,a.node);}}});
+//Roo/tree/TreeFilter.js
+Roo.tree.TreeFilter=function(A,B){this.tree=A;this.filtered={};Roo.apply(this,B);};Roo.tree.TreeFilter.prototype={clearBlank:false,reverse:false,autoClear:false,remove:false,filter:function(A,B,C){B=B||"text";var f;if(typeof A=="string"){var D=A.length;if(D==0&&this.clearBlank){this.clear();return;}
+A=A.toLowerCase();f=function(n){return n.attributes[B].substr(0,D).toLowerCase()==A;};}else if(A.exec){f=function(n){return A.test(n.attributes[B]);};}else {throw 'Illegal filter type, must be string or regex';}
+this.filterBy(f,null,C);},filterBy:function(fn,A,B){B=B||this.tree.root;if(this.autoClear){this.clear();}var af=this.filtered,rv=this.reverse;var f=function(n){if(n==B){return true;}if(af[n.id]){return false;}var m=fn.call(A||n,n);if(!m||rv){af[n.id]=n;n.ui.hide();return false;}return true;};B.cascade(f);if(this.remove){for(var id in af){if(typeof id!="function"){var n=af[id];if(n&&n.parentNode){n.parentNode.removeChild(n);}}}}},clear:function(){var t=this.tree;var af=this.filtered;for(var id in af){if(typeof id!="function"){var n=af[id];if(n){n.ui.show();}}}
+this.filtered={};}};
+//Roo/tree/TreeSorter.js
+Roo.tree.TreeSorter=function(A,B){Roo.apply(this,B);A.on("beforechildrenrendered",this.doSort,this);A.on("append",this.updateSort,this);A.on("insert",this.updateSort,this);var C=this.dir&&this.dir.toLowerCase()=="desc";var p=this.property||"text";var D=this.sortType;var fs=this.folderSort;var cs=this.caseSensitive===true;var E=this.leafAttr||'leaf';this.sortFn=function(n1,n2){if(fs){if(n1.attributes[E]&&!n2.attributes[E]){return 1;}if(!n1.attributes[E]&&n2.attributes[E]){return -1;}}var v1=D?D(n1):(cs?n1.attributes[p]:n1.attributes[p].toUpperCase());var v2=D?D(n2):(cs?n2.attributes[p]:n2.attributes[p].toUpperCase());if(v1<v2){return C?+1:-1;}else if(v1>v2){return C?-1:+1;}else {return 0;}};};Roo.tree.TreeSorter.prototype={doSort:function(A){A.sort(this.sortFn);},compareNodes:function(n1,n2){return (n1.text.toUpperCase()>n2.text.toUpperCase()?1:-1);},updateSort:function(A,B){if(B.childrenRendered){this.doSort.defer(1,this,[B]);}}};
+//Roo/tree/TreeDropZone.js
+if(Roo.dd.DropZone){Roo.tree.TreeDropZone=function(A,B){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Roo.tree.TreeDropZone.superclass.constructor.call(this,A.innerCt,B);this.tree=A;this.lastInsertClass="x-tree-no-status";this.dragOverData={};};Roo.extend(Roo.tree.TreeDropZone,Roo.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(A){if(A.hasChildNodes()&&!A.isExpanded()){A.expand(false,null,this.triggerCacheRefresh.createDelegate(this));}},queueExpand:function(A){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[A]);},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false;}},isValidDropPoint:function(n,pt,dd,e,A){if(!n||!A){return false;}var B=n.node;var C=A.node;if(!(B&&B.isTarget&&pt)){return false;}if(pt=="append"&&B.allowChildren===false){return false;}if((pt=="above"||pt=="below")&&(B.parentNode&&B.parentNode.allowChildren===false)){return false;}if(C&&(B==C||C.contains(B))){return false;}var D=this.dragOverData;D.tree=this.tree;D.target=B;D.data=A;D.point=pt;D.source=dd;D.rawEvent=e;D.dropNode=C;D.cancel=false;var E=this.tree.fireEvent("nodedragover",D);return D.cancel===false&&E!==false;},getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false;}var A=n.ddel;var t=Roo.lib.Dom.getY(A),b=t+A.offsetHeight;var y=Roo.lib.Event.getPageY(e);var B=tn.allowChildren===false;if(this.appendOnly||tn.parentNode.allowChildren===false){return B?false:"append";}var C=false;if(!this.allowParentInsert){C=tn.hasChildNodes()&&tn.isExpanded();}var q=(b-t)/(B?2:3);if(y>=t&&y<(t+q)){return "above";}else if(!C&&(B||y>=b-q&&y<=b)){return "below";}else {return "append";}},onNodeEnter:function(n,dd,e,A){this.cancelExpand();},onNodeOver:function(n,dd,e,A){var pt=this.getDropPoint(e,n,dd);var B=n.node;if(!this.expandProcId&&pt=="append"&&B.hasChildNodes()&&!n.node.isExpanded()){this.queueExpand(B);}else if(pt!="append"){this.cancelExpand();}var C=this.dropNotAllowed;if(this.isValidDropPoint(n,pt,dd,e,A)){if(pt){var el=n.ddel;var D;if(pt=="above"){C=n.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";D="x-tree-drag-insert-above";}else if(pt=="below"){C=n.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";D="x-tree-drag-insert-below";}else {C="x-tree-drop-ok-append";D="x-tree-drag-append";}if(this.lastInsertClass!=D){Roo.fly(el).replaceClass(this.lastInsertClass,D);this.lastInsertClass=D;}}}return C;},onNodeOut:function(n,dd,e,A){this.cancelExpand();this.removeDropIndicators(n);},onNodeDrop:function(n,dd,e,A){var B=this.getDropPoint(e,n,dd);var C=n.node;C.ui.startDrop();if(!this.isValidDropPoint(n,B,dd,e,A)){C.ui.endDrop();return false;}var D=A.node||(dd.getTreeNode?dd.getTreeNode(A,C,B,e):null);var E={tree:this.tree,target:C,data:A,point:B,source:dd,rawEvent:e,dropNode:D,cancel:!D};var F=this.tree.fireEvent("beforenodedrop",E);if(F===false||E.cancel===true||!E.dropNode){C.ui.endDrop();return false;}
+C=E.target;if(B=="append"&&!C.isExpanded()){C.expand(false,null,function(){this.completeDrop(E);}.createDelegate(this));}else {this.completeDrop(E);}return true;},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!(ns instanceof Array)){ns=[ns];}var n;for(var i=0,A=ns.length;i<A;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t);}else if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling);}else {t.appendChild(n);}}
+n.ui.focus();if(this.tree.hlDrop){n.ui.highlight();}
+t.ui.endDrop();this.tree.fireEvent("nodedrop",de);},afterNodeMoved:function(dd,A,e,B,C){if(this.tree.hlDrop){C.ui.focus();C.ui.highlight();}
+this.tree.fireEvent("nodedrop",this.tree,B,A,dd,e);},getTree:function(){return this.tree;},removeDropIndicators:function(n){if(n&&n.ddel){var el=n.ddel;Roo.fly(el).removeClass(["x-tree-drag-insert-above","x-tree-drag-insert-below","x-tree-drag-append"]);this.lastInsertClass="_noclass";}},beforeDragDrop:function(A,e,id){this.cancelExpand();return true;},afterRepair:function(A){if(A&&Roo.enableFx){A.node.ui.highlight();}
+this.hideProxy();}});}
+//Roo/tree/TreeDragZone.js
+if(Roo.dd.DragZone){Roo.tree.TreeDragZone=function(A,B){Roo.tree.TreeDragZone.superclass.constructor.call(this,A.getTreeEl(),B);this.tree=A;};Roo.extend(Roo.tree.TreeDragZone,Roo.dd.DragZone,{ddGroup:"TreeDD",onBeforeDrag:function(A,e){var n=A.node;return n&&n.draggable&&!n.disabled;},onInitDrag:function(e){var A=this.dragData;this.tree.getSelectionModel().select(A.node);this.proxy.update("");A.node.ui.appendDDGhost(this.proxy.ghost.dom);this.tree.fireEvent("startdrag",this.tree,A.node,e);},getRepairXY:function(e,A){return A.node.ui.getDDRepairXY();},onEndDrag:function(A,e){this.tree.fireEvent("enddrag",this.tree,A.node,e);},onValidDrop:function(dd,e,id){this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,dd,e);this.hideProxy();},beforeInvalidDrop:function(e,id){var sm=this.tree.getSelectionModel();sm.clearSelections();sm.select(this.dragData.node);}});}
+//Roo/tree/TreeEditor.js
+Roo.tree.TreeEditor=function(A,B){var C=A;var D;if(B){D=B.events?B:new Roo.form.TextField(B);}else {C=A.tree;A.field=A.field||{};A.field.xtype='TextField';D=Roo.factory(A.field,Roo.form);}
+A=A||{};this.addEvents({"beforenodeedit":true});Roo.tree.TreeEditor.superclass.constructor.call(this,D,A);this.tree=C;C.on('beforeclick',this.beforeNodeClick,this);C.getTreeEl().on('mousedown',this.hide,this);this.on('complete',this.updateNode,this);this.on('beforestartedit',this.fitToTree,this);this.on('startedit',this.bindScroll,this,{delay:10});this.on('specialkey',this.onSpecialKey,this);};Roo.extend(Roo.tree.TreeEditor,Roo.Editor,{alignment:"l-l",autoSize:false,hideEl:false,cls:"x-small-editor x-tree-editor",shim:false,shadow:"frame",maxWidth:250,editDelay:350,fitToTree:function(ed,el){var td=this.tree.getTreeEl().dom,nd=el.dom;if(td.scrollLeft>nd.offsetLeft){td.scrollLeft=nd.offsetLeft;}var w=Math.min(this.maxWidth,(td.clientWidth>20?td.clientWidth:td.offsetWidth)-Math.max(0,nd.offsetLeft-td.scrollLeft)-5);this.setSize(w,'');return this.fireEvent('beforenodeedit',this,this.editNode);},triggerEdit:function(A){this.completeEdit();this.editNode=A;this.startEdit(A.ui.textNode,A.text);},bindScroll:function(){this.tree.getTreeEl().on('scroll',this.cancelEdit,this);},beforeNodeClick:function(A,e){var B=(this.lastClick?this.lastClick.getElapsed():0);this.lastClick=new Date();if(B>this.editDelay&&this.tree.getSelectionModel().isSelected(A)){e.stopEvent();this.triggerEdit(A);return false;}return true;},updateNode:function(ed,A){this.tree.getTreeEl().un('scroll',this.cancelEdit,this);this.editNode.setText(A);},onHide:function(){Roo.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus();}},onSpecialKey:function(A,e){var k=e.getKey();if(k==e.ESC){e.stopEvent();this.cancelEdit();}else if(k==e.ENTER&&!e.hasModifier()){e.stopEvent();this.completeEdit();}}});
+//Roo/tree/ColumnNodeUI.js
+Roo.tree.ColumnNodeUI=Roo.extend(Roo.tree.TreeNodeUI,{renderElements:function(n,a,A,B){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var t=n.getOwnerTree();var C=Pman.Tab.Document_TypesTree.tree.el.id;var D=t.columns;var bw=t.borderWidth;var c=D[0];var E=a.href?a.href:Roo.isGecko?"":"#";var cb=typeof a.checked=="boolean";var tx=String.format('{0}',n.text||(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));var F='x-t-'+C+'-c0';var G=['<li class="x-tree-node">','<div class="x-tree-node-el ',a.cls,'">','<div class="x-tree-col ',F,'" style="width:',c.width-bw,'px;">','<span class="x-tree-node-indent">',this.indentMarkup,'</span>','<img src="',this.emptyIcon,'" class="x-tree-ec-icon  " />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?' x-tree-node-inline-icon':''),(a.iconCls?' '+a.iconCls:''),'" unselectable="on" />',(cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':' />')):''),'<a class="x-tree-node-anchor" hidefocus="on" href="',E,'" tabIndex="1" ',(a.hrefTarget?' target="'+a.hrefTarget+'"':''),'>','<span unselectable="on" qtip="'+tx+'">',tx,'</span></a>','</div>','<a class="x-tree-node-anchor" hidefocus="on" href="',E,'" tabIndex="1" ',(a.hrefTarget?' target="'+a.hrefTarget+'"':''),'>'];for(var i=1,H=D.length;i<H;i++){c=D[i];F='x-t-'+C+'-c'+i;tx=String.format('{0}',(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));G.push('<div class="x-tree-col ',F,' ',(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">','<div class="x-tree-col-text" qtip="'+tx+'">',tx,"</div>","</div>");}
+G.push('</a>','<div class="x-clear"></div></div>','<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>");if(B!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),G.join(""));}else {this.wrap=Roo.DomHelper.insertHtml("beforeEnd",A,G.join(""));}var el=this.wrap.firstChild;this.elRow=el;this.elNode=el.firstChild;this.ranchor=el.childNodes[1];this.ctNode=this.wrap.childNodes[1];var cs=el.firstChild.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var I=3;if(cb){this.checkbox=cs[3];I++;}
+this.anchor=cs[I];this.textNode=cs[I].firstChild;},initEvents:function(){Roo.tree.ColumnNodeUI.superclass.initEvents.call(this);var a=this.ranchor;var el=Roo.get(a);if(Roo.isOpera){el.setStyle("text-decoration","none");}
+el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);el.on("contextmenu",this.onContextMenu,this);},addClass:function(A){if(this.elRow){Roo.fly(this.elRow).addClass(A);}},removeClass:function(A){if(this.elRow){Roo.fly(this.elRow).removeClass(A);}}});
+//Roo/tree/ColumnTree.js
+Roo.tree.ColumnTree=function(el,A){Roo.tree.ColumnTree.superclass.constructor.call(this,el,A);this.addEvents({"resize":true});this.on('resize',this.onResize,this);};Roo.extend(Roo.tree.ColumnTree,Roo.tree.TreePanel,{borderWidth:Roo.isBorderBox?0:2,headEls:false,render:function(){Roo.tree.ColumnTree.superclass.render.apply(this);this.el.addClass('x-column-tree');this.headers=this.el.createChild({cls:'x-tree-headers'},this.innerCt.dom);var A=this.columns,c;var B=0;this.headEls=[];var C=A.length;for(var i=0;i<C;i++){c=A[i];B+=c.width;this.headEls.push(this.headers.createChild({cls:'x-tree-hd '+(c.cls?c.cls+'-hd':''),cn:{cls:'x-tree-hd-text',html:c.header},style:'width:'+(c.width-this.borderWidth)+'px;'}));}
+this.headers.createChild({cls:'x-clear'});this.headers.setWidth(B);this.innerCt.setStyle({overflow:'auto'});this.onResize(this.width,this.height);},onResize:function(w,h){this.height=h;this.width=w;this.innerCt.setWidth(this.width);this.innerCt.setHeight(this.height-20);var A=this.columns,c;var B=0;var C=false;var D=A.length;for(var i=0;i<D;i++){c=A[i];if(this.autoExpandColumn!==false&&c.dataIndex==this.autoExpandColumn){C=this.headEls[i];continue;}
+B+=c.width;}if(C){C.setWidth(((w-B)-this.borderWidth-20));}
+this.headers.setWidth(w-20);}});
+//Roo/menu/Menu.js
+Roo.menu.Menu=function(A){Roo.apply(this,A);this.id=this.id||Roo.id();this.addEvents({beforeshow:true,beforehide:true,show:true,hide:true,click:true,mouseover:true,mouseout:true,itemclick:true});if(this.registerMenu){Roo.menu.MenuMgr.register(this);}var B=this.items;this.items=new Roo.util.MixedCollection();if(B){this.add.apply(this,B);}};Roo.extend(Roo.menu.Menu,Roo.util.Observable,{minWidth:120,shadow:"sides",subMenuAlign:"tl-tr?",defaultAlign:"tl-bl?",allowOtherMenus:false,registerMenu:true,hidden:true,render:function(){if(this.el){return;}var el=this.el=new Roo.Layer({cls:"x-menu",shadow:this.shadow,constrain:false,parentEl:this.parentEl||document.body,zindex:15000});this.keyNav=new Roo.menu.MenuNav(this);if(this.plain){el.addClass("x-menu-plain");}if(this.cls){el.addClass(this.cls);}
+this.focusEl=el.createChild({tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"});var ul=el.createChild({tag:"ul",cls:"x-menu-list"});ul.on("click",this.onClick,this);ul.on("mouseover",this.onMouseOver,this);ul.on("mouseout",this.onMouseOut,this);this.items.each(function(A){var li=document.createElement("li");li.className="x-menu-list-item";ul.dom.appendChild(li);A.render(li,this);},this);this.ul=ul;this.autoWidth();},autoWidth:function(){var el=this.el,ul=this.ul;if(!el){return;}var w=this.width;if(w){el.setWidth(w);}else if(Roo.isIE){el.setWidth(this.minWidth);var t=el.dom.offsetWidth;el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));}},delayAutoWidth:function(){if(this.rendered){if(!this.awTask){this.awTask=new Roo.util.DelayedTask(this.autoWidth,this);}
+this.awTask.delay(20);}},findTargetItem:function(e){var t=e.getTarget(".x-menu-list-item",this.ul,true);if(t&&t.menuItemId){return this.items.get(t.menuItemId);}},onClick:function(e){var t;if(t=this.findTargetItem(e)){t.onClick(e);this.fireEvent("click",this,t,e);}},setActiveItem:function(A,B){if(A!=this.activeItem){if(this.activeItem){this.activeItem.deactivate();}
+this.activeItem=A;A.activate(B);}else if(B){A.expandMenu();}},tryActivate:function(A,B){var C=this.items;for(var i=A,D=C.length;i>=0&&i<D;i+=B){var E=C.get(i);if(!E.disabled&&E.canActivate){this.setActiveItem(E,false);return E;}}return false;},onMouseOver:function(e){var t;if(t=this.findTargetItem(e)){if(t.canActivate&&!t.disabled){this.setActiveItem(t,true);}}
+this.fireEvent("mouseover",this,e,t);},onMouseOut:function(e){var t;if(t=this.findTargetItem(e)){if(t==this.activeItem&&t.shouldDeactivate(e)){this.activeItem.deactivate();delete this.activeItem;}}
+this.fireEvent("mouseout",this,e,t);},isVisible:function(){return this.el&&!this.hidden;},show:function(el,A,B){this.parentMenu=B;if(!this.el){this.render();}
+this.fireEvent("beforeshow",this);this.showAt(this.el.getAlignToXY(el,A||this.defaultAlign),B,false);},showAt:function(xy,A,_e){this.parentMenu=A;if(!this.el){this.render();}if(_e!==false){this.fireEvent("beforeshow",this);xy=this.el.adjustForConstraints(xy);}
+this.el.setXY(xy);this.el.show();this.hidden=false;this.focus();this.fireEvent("show",this);},focus:function(){if(!this.hidden){this.doFocus.defer(50,this);}},doFocus:function(){if(!this.hidden){this.focusEl.focus();}},hide:function(A){if(this.el&&this.isVisible()){this.fireEvent("beforehide",this);if(this.activeItem){this.activeItem.deactivate();this.activeItem=null;}
+this.el.hide();this.hidden=true;this.fireEvent("hide",this);}if(A===true&&this.parentMenu){this.parentMenu.hide(true);}},add:function(){var a=arguments,l=a.length,A;for(var i=0;i<l;i++){var el=a[i];if((typeof(el)=="object")&&el.xtype&&el.xns){el=Roo.factory(el,Roo.menu);}if(el.render){A=this.addItem(el);}else if(typeof el=="string"){if(el=="separator"||el=="-"){A=this.addSeparator();}else {A=this.addText(el);}}else if(el.tagName||el.el){A=this.addElement(el);}else if(typeof el=="object"){A=this.addMenuItem(el);}}return A;},getEl:function(){if(!this.el){this.render();}return this.el;},addSeparator:function(){return this.addItem(new Roo.menu.Separator());},addElement:function(el){return this.addItem(new Roo.menu.BaseItem(el));},addItem:function(A){this.items.add(A);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.appendChild(li);A.render(li,this);this.delayAutoWidth();}return A;},addMenuItem:function(A){if(!(A instanceof Roo.menu.Item)){if(typeof A.checked=="boolean"){A=new Roo.menu.CheckItem(A);}else {A=new Roo.menu.Item(A);}}return this.addItem(A);},addText:function(A){return this.addItem(new Roo.menu.TextItem({text:A}));},insert:function(A,B){this.items.insert(A,B);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.insertBefore(li,this.ul.dom.childNodes[A]);B.render(li,this);this.delayAutoWidth();}return B;},remove:function(A){this.items.removeKey(A.id);A.destroy();},removeAll:function(){var f;while(f=this.items.first()){this.remove(f);}}});Roo.menu.MenuNav=function(A){Roo.menu.MenuNav.superclass.constructor.call(this,A.el);this.scope=this.menu=A;};Roo.extend(Roo.menu.MenuNav,Roo.KeyNav,{doRelay:function(e,h){var k=e.getKey();if(!this.menu.activeItem&&e.isNavKeyPress()&&k!=e.SPACE&&k!=e.RETURN ){this.menu.tryActivate(0,1);return false;}return h.call(this.scope||this,e,this.menu);},up:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)-1,-1)){m.tryActivate(m.items.length-1,-1);}},down:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)+1,1)){m.tryActivate(0,1);}},right:function(e,m){if(m.activeItem){m.activeItem.expandMenu(true);}},left:function(e,m){m.hide();if(m.parentMenu&&m.parentMenu.activeItem){m.parentMenu.activeItem.activate();}},enter:function(e,m){if(m.activeItem){e.stopPropagation();m.activeItem.onClick(e);m.fireEvent("click",this,m.activeItem);return true;}}});
+//Roo/menu/MenuMgr.js
+Roo.menu.MenuMgr=function(){var A,B,C={},D=false,E=new Date();function init(){A={};B=new Roo.util.MixedCollection();Roo.get(document).addKeyListener(27,function(){if(B.length>0){hideAll();}});}function hideAll(){if(B&&B.length>0){var c=B.clone();c.each(function(m){m.hide();});}}function onHide(m){B.remove(m);if(B.length<1){Roo.get(document).un("mousedown",onMouseDown);D=false;}}function onShow(m){var F=B.last();E=new Date();B.add(m);if(!D){Roo.get(document).on("mousedown",onMouseDown);D=true;}if(m.parentMenu){m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"),10)+3);m.parentMenu.activeChild=m;}else if(F&&F.isVisible()){m.getEl().setZIndex(parseInt(F.getEl().getStyle("z-index"),10)+3);}}function onBeforeHide(m){if(m.activeChild){m.activeChild.hide();}if(m.autoHideTimer){clearTimeout(m.autoHideTimer);delete m.autoHideTimer;}}function onBeforeShow(m){var pm=m.parentMenu;if(!pm&&!m.allowOtherMenus){hideAll();}else if(pm&&pm.activeChild&&B!=m){pm.activeChild.hide();}}function onMouseDown(e){if(E.getElapsed()>50&&B.length>0&&!e.getTarget(".x-menu")){hideAll();}}function onBeforeCheck(mi,F){if(F){var g=C[mi.group];for(var i=0,l=g.length;i<l;i++){if(g[i]!=mi){g[i].setChecked(false);}}}}return {hideAll:function(){hideAll();},register:function(F){if(!A){init();}
+A[F.id]=F;F.on("beforehide",onBeforeHide);F.on("hide",onHide);F.on("beforeshow",onBeforeShow);F.on("show",onShow);var g=F.group;if(g&&F.events["checkchange"]){if(!C[g]){C[g]=[];}
+C[g].push(F);F.on("checkchange",onCheck);}},get:function(F){if(typeof F=="string"){return A[F];}else if(F.events){return F;}else if(typeof F.length=='number'){return new Roo.menu.Menu({items:F});}else {return new Roo.menu.Menu(F);}},unregister:function(F){delete A[F.id];F.un("beforehide",onBeforeHide);F.un("hide",onHide);F.un("beforeshow",onBeforeShow);F.un("show",onShow);var g=F.group;if(g&&F.events["checkchange"]){C[g].remove(F);F.un("checkchange",onCheck);}},registerCheckable:function(F){var g=F.group;if(g){if(!C[g]){C[g]=[];}
+C[g].push(F);F.on("beforecheckchange",onBeforeCheck);}},unregisterCheckable:function(F){var g=F.group;if(g){C[g].remove(F);F.un("beforecheckchange",onBeforeCheck);}}};}();
+//Roo/menu/BaseItem.js
+Roo.menu.BaseItem=function(A){Roo.menu.BaseItem.superclass.constructor.call(this,A);this.addEvents({click:true,activate:true,deactivate:true});if(this.handler){this.on("click",this.handler,this.scope,true);}};Roo.extend(Roo.menu.BaseItem,Roo.Component,{canActivate:false,activeClass:"x-menu-item-active",hideOnClick:true,hideDelay:100,ctype:"Roo.menu.BaseItem",actionMode:"container",render:function(A,B){this.parentMenu=B;Roo.menu.BaseItem.superclass.render.call(this,A);this.container.menuItemId=this.id;},onRender:function(A,B){this.el=Roo.get(this.el);A.dom.appendChild(this.el.dom);},onClick:function(e){if(!this.disabled&&this.fireEvent("click",this,e)!==false&&this.parentMenu.fireEvent("itemclick",this,e)!==false){this.handleClick(e);}else {e.stopEvent();}},activate:function(){if(this.disabled){return false;}var li=this.container;li.addClass(this.activeClass);this.region=li.getRegion().adjust(2,2,-2,-2);this.fireEvent("activate",this);return true;},deactivate:function(){this.container.removeClass(this.activeClass);this.fireEvent("deactivate",this);},shouldDeactivate:function(e){return !this.region||!this.region.contains(e.getPoint());},handleClick:function(e){if(this.hideOnClick){this.parentMenu.hide.defer(this.hideDelay,this.parentMenu,[true]);}},expandMenu:function(A){},hideMenu:function(){}});
+//Roo/menu/Adapter.js
+Roo.menu.Adapter=function(A,B){Roo.menu.Adapter.superclass.constructor.call(this,B);this.component=A;};Roo.extend(Roo.menu.Adapter,Roo.menu.BaseItem,{canActivate:true,onRender:function(A,B){this.component.render(A);this.el=this.component.getEl();},activate:function(){if(this.disabled){return false;}
+this.component.focus();this.fireEvent("activate",this);return true;},deactivate:function(){this.fireEvent("deactivate",this);},disable:function(){this.component.disable();Roo.menu.Adapter.superclass.disable.call(this);},enable:function(){this.component.enable();Roo.menu.Adapter.superclass.enable.call(this);}});
+//Roo/menu/TextItem.js
+Roo.menu.TextItem=function(A){if(typeof(A)=='string'){this.text=A;}else {Roo.apply(this,A);}
+Roo.menu.TextItem.superclass.constructor.call(this);};Roo.extend(Roo.menu.TextItem,Roo.menu.BaseItem,{text:'',hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML=this.text;this.el=s;Roo.menu.TextItem.superclass.onRender.apply(this,arguments);}});
+//Roo/menu/Separator.js
+Roo.menu.Separator=function(A){Roo.menu.Separator.superclass.constructor.call(this,A);};Roo.extend(Roo.menu.Separator,Roo.menu.BaseItem,{itemCls:"x-menu-sep",hideOnClick:false,onRender:function(li){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML="&#160;";this.el=s;li.addClass("x-menu-sep-li");Roo.menu.Separator.superclass.onRender.apply(this,arguments);}});
+//Roo/menu/Item.js
+Roo.menu.Item=function(A){Roo.menu.Item.superclass.constructor.call(this,A);if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);}};Roo.extend(Roo.menu.Item,Roo.menu.BaseItem,{text:'',html:'',icon:undefined,itemCls:"x-menu-item",canActivate:true,showDelay:200,hideDelay:200,ctype:"Roo.menu.Item",onRender:function(A,B){var el=document.createElement("a");el.hideFocus=true;el.unselectable="on";el.href=this.href||"#";if(this.hrefTarget){el.target=this.hrefTarget;}
+el.className=this.itemCls+(this.menu?" x-menu-item-arrow":"")+(this.cls?" "+this.cls:"");var C=this.html.length?this.html:String.format('{0}',this.text);el.innerHTML=String.format('<img src="{0}" class="x-menu-item-icon {1}" />'+C,this.icon||Roo.BLANK_IMAGE_URL,this.iconCls||'');this.el=el;Roo.menu.Item.superclass.onRender.call(this,A,B);},setText:function(A,B){if(B){this.html=A;}else {this.text=A;this.html='';}if(this.rendered){var C=this.html.length?this.html:String.format('{0}',this.text);this.el.update(String.format('<img src="{0}" class="x-menu-item-icon {2}">'+C,this.icon||Roo.BLANK_IMAGE_URL,this.text,this.iconCls||''));this.parentMenu.autoWidth();}},handleClick:function(e){if(!this.href){e.stopEvent();}
+Roo.menu.Item.superclass.handleClick.apply(this,arguments);},activate:function(A){if(Roo.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(A){this.expandMenu();}}return true;},shouldDeactivate:function(e){if(Roo.menu.Item.superclass.shouldDeactivate.call(this,e)){if(this.menu&&this.menu.isVisible()){return !this.menu.getEl().getRegion().contains(e.getPoint());}return true;}return false;},deactivate:function(){Roo.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu();},expandMenu:function(A){if(!this.disabled&&this.menu){clearTimeout(this.hideTimer);delete this.hideTimer;if(!this.menu.isVisible()&&!this.showTimer){this.showTimer=this.deferExpand.defer(this.showDelay,this,[A]);}else if(this.menu.isVisible()&&A){this.menu.tryActivate(0,1);}}},deferExpand:function(A){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(A){this.menu.tryActivate(0,1);}},hideMenu:function(){clearTimeout(this.showTimer);delete this.showTimer;if(!this.hideTimer&&this.menu&&this.menu.isVisible()){this.hideTimer=this.deferHide.defer(this.hideDelay,this);}},deferHide:function(){delete this.hideTimer;this.menu.hide();}});
+//Roo/menu/CheckItem.js
+Roo.menu.CheckItem=function(A){Roo.menu.CheckItem.superclass.constructor.call(this,A);this.addEvents({"beforecheckchange":true,"checkchange":true});if(this.checkHandler){this.on('checkchange',this.checkHandler,this.scope);}};Roo.extend(Roo.menu.CheckItem,Roo.menu.Item,{itemCls:"x-menu-item x-menu-check-item",groupClass:"x-menu-group-item",checked:false,ctype:"Roo.menu.CheckItem",onRender:function(c){Roo.menu.CheckItem.superclass.onRender.apply(this,arguments);if(this.group){this.el.addClass(this.groupClass);}
+Roo.menu.MenuMgr.registerCheckable(this);if(this.checked){this.checked=false;this.setChecked(true,true);}},destroy:function(){if(this.rendered){Roo.menu.MenuMgr.unregisterCheckable(this);}
+Roo.menu.CheckItem.superclass.destroy.apply(this,arguments);},setChecked:function(A,B){if(this.checked!=A&&this.fireEvent("beforecheckchange",this,A)!==false){if(this.container){this.container[A?"addClass":"removeClass"]("x-menu-item-checked");}
+this.checked=A;if(B!==true){this.fireEvent("checkchange",this,A);}}},handleClick:function(e){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked);}
+Roo.menu.CheckItem.superclass.handleClick.apply(this,arguments);}});
+//Roo/menu/DateItem.js
+Roo.menu.DateItem=function(A){Roo.menu.DateItem.superclass.constructor.call(this,new Roo.DatePicker(A),A);this.picker=this.component;this.addEvents({select:true});this.picker.on("render",function(B){B.getEl().swallowEvent("click");B.container.addClass("x-menu-date-item");});this.picker.on("select",this.onSelect,this);};Roo.extend(Roo.menu.DateItem,Roo.menu.Adapter,{onSelect:function(A,B){this.fireEvent("select",this,B,A);Roo.menu.DateItem.superclass.handleClick.call(this);}});
+//Roo/menu/ColorItem.js
+Roo.menu.ColorItem=function(A){Roo.menu.ColorItem.superclass.constructor.call(this,new Roo.ColorPalette(A),A);this.palette=this.component;this.relayEvents(this.palette,["select"]);if(this.selectHandler){this.on('select',this.selectHandler,this.scope);}};Roo.extend(Roo.menu.ColorItem,Roo.menu.Adapter);
+//Roo/menu/DateMenu.js
+Roo.menu.DateMenu=function(A){Roo.menu.DateMenu.superclass.constructor.call(this,A);this.plain=true;var di=new Roo.menu.DateItem(A);this.add(di);this.picker=di.picker;this.relayEvents(di,["select"]);this.on('beforeshow',function(){if(this.picker){this.picker.hideMonthPicker(true);}},this);};Roo.extend(Roo.menu.DateMenu,Roo.menu.Menu,{cls:'x-date-menu'});
+//Roo/menu/ColorMenu.js
+Roo.menu.ColorMenu=function(A){Roo.menu.ColorMenu.superclass.constructor.call(this,A);this.plain=true;var ci=new Roo.menu.ColorItem(A);this.add(ci);this.palette=ci.palette;this.relayEvents(ci,["select"]);};Roo.extend(Roo.menu.ColorMenu,Roo.menu.Menu);
+//Roo/form/Field.js
+Roo.form.Field=function(A){Roo.form.Field.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Field,Roo.BoxComponent,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},fieldClass:"x-form-field",msgTarget:'qtip',msgFx:'normal',readOnly:false,disabled:false,inputType:undefined,tabIndex:undefined,isFormField:true,hasFocus:false,value:undefined,initComponent:function(){Roo.form.Field.superclass.initComponent.call(this);this.addEvents({focus:true,blur:true,specialkey:true,change:true,invalid:true,valid:true,keyup:true});},getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');},onRender:function(ct,A){Roo.form.Field.superclass.onRender.call(this,ct,A);if(!this.el){var B=this.getAutoCreate();if(!B.name){B.name=this.name||this.id;}if(this.inputType){B.type=this.inputType;}
+this.el=ct.createChild(B,A);}var C=this.el.dom.type;if(C){if(C=='password'){C='text';}
+this.el.addClass('x-form-'+C);}if(this.readOnly){this.el.dom.readOnly=true;}if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);}
+this.el.addClass([this.fieldClass,this.cls]);this.initValue();},applyTo:function(A){this.allowDomMove=false;this.el=Roo.get(A);this.render(this.el.dom.parentNode);return this;},initValue:function(){if(this.value!==undefined){this.setValue(this.value);}else if(this.el.dom.value.length>0){this.setValue(this.el.dom.value);}},isDirty:function(){if(this.disabled){return false;}return String(this.getValue())!==String(this.originalValue);},afterRender:function(){Roo.form.Field.superclass.afterRender.call(this);this.initEvents();},fireKey:function(e){if(e.isNavKeyPress()){this.fireEvent("specialkey",this,e);}},reset:function(){this.setValue(this.originalValue);this.clearInvalid();},initEvents:function(){this.el.on("keydown",this.fireKey,this);this.el.on("focus",this.onFocus,this);this.el.on("blur",this.onBlur,this);this.el.relayEvent('keyup',this);this.originalValue=this.getValue();},onFocus:function(){if(!Roo.isOpera&&this.focusClass){this.el.addClass(this.focusClass);}if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this);}},beforeBlur:Roo.emptyFn,onBlur:function(){this.beforeBlur();if(!Roo.isOpera&&this.focusClass){this.el.removeClass(this.focusClass);}
+this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();}var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue);}
+this.fireEvent("blur",this);},isValid:function(A){if(this.disabled){return true;}var B=this.preventMark;this.preventMark=A===true;var v=this.validateValue(this.processValue(this.getRawValue()));this.preventMark=B;return v;},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){this.clearInvalid();return true;}return false;},processValue:function(A){return A;},validateValue:function(A){return true;},markInvalid:function(A){if(!this.rendered||this.preventMark){return;}
+this.el.addClass(this.invalidClass);A=A||this.invalidText;switch(this.msgTarget){case 'qtip':this.el.dom.qtip=A;this.el.dom.qclass='x-form-invalid-tip';if(Roo.QuickTips){Roo.QuickTips.enable();}break;case 'title':this.el.dom.title=A;break;case 'under':if(!this.errorEl){var B=this.el.findParent('.x-form-element',5,true);this.errorEl=B.createChild({cls:'x-form-invalid-msg'});this.errorEl.setWidth(B.getWidth(true)-20);}
+this.errorEl.update(A);Roo.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case 'side':if(!this.errorIcon){var B=this.el.findParent('.x-form-element',5,true);this.errorIcon=B.createChild({cls:'x-form-invalid-icon'});}
+this.alignErrorIcon();this.errorIcon.dom.qtip=A;this.errorIcon.dom.qclass='x-form-invalid-tip';this.errorIcon.show();this.on('resize',this.alignErrorIcon,this);break;default:var t=Roo.getDom(this.msgTarget);t.innerHTML=A;t.style.display=this.msgDisplay;break;}
+this.fireEvent('invalid',this,A);},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,'tl-tr',[2,0]);},clearInvalid:function(){if(!this.rendered||this.preventMark){return;}
+this.el.removeClass(this.invalidClass);switch(this.msgTarget){case 'qtip':this.el.dom.qtip='';break;case 'title':this.el.dom.title='';break;case 'under':if(this.errorEl){Roo.form.Field.msgFx[this.msgFx].hide(this.errorEl,this);}break;case 'side':if(this.errorIcon){this.errorIcon.dom.qtip='';this.errorIcon.hide();this.un('resize',this.alignErrorIcon,this);}break;default:var t=Roo.getDom(this.msgTarget);t.innerHTML='';t.style.display='none';break;}
+this.fireEvent('valid',this);},getRawValue:function(){var v=this.el.getValue();if(v===this.emptyText){v='';}return v;},getValue:function(){var v=this.el.getValue();if(v===this.emptyText||v===undefined){v='';}return v;},setRawValue:function(v){return this.el.dom.value=(v===null||v===undefined?'':v);},setValue:function(v){this.value=v;if(this.rendered){this.el.dom.value=(v===null||v===undefined?'':v);this.validate();}},adjustSize:function(w,h){var s=Roo.form.Field.superclass.adjustSize.call(this,w,h);s.width=this.adjustWidth(this.el.dom.tagName,s.width);return s;},adjustWidth:function(A,w){A=A.toLowerCase();if(typeof w=='number'&&Roo.isStrict&&!Roo.isSafari){if(Roo.isIE&&(A=='input'||A=='textarea')){if(A=='input'){return w+2;}if(A='textarea'){return w-2;}}else if(Roo.isOpera){if(A=='input'){return w+2;}if(A='textarea'){return w-2;}}}return w;}});Roo.form.Field.msgFx={normal:{show:function(A,f){A.setDisplayed('block');},hide:function(A,f){A.setDisplayed(false).update('');}},slide:{show:function(A,f){A.slideIn('t',{stopFx:true});},hide:function(A,f){A.slideOut('t',{stopFx:true,useDisplay:true});}},slideRight:{show:function(A,f){A.fixDisplay();A.alignTo(f.el,'tl-tr');A.slideIn('l',{stopFx:true});},hide:function(A,f){A.slideOut('l',{stopFx:true,useDisplay:true});}}};
+//Roo/form/TextField.js
+Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(this,A);this.addEvents({autosize:true});};Roo.extend(Roo.form.TextField,Roo.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,emptyClass:'x-form-empty-field',initEvents:function(){Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay});}if(this.selectOnFocus||this.emptyText){this.on("focus",this.preFocus,this);if(this.emptyText){this.on('blur',this.postBlur,this);this.applyEmptyText();}}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this);}if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,'');if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},reset:function(){Roo.form.TextField.superclass.reset.call(this);this.applyEmptyText();},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass);}},preFocus:function(){if(this.emptyText){if(this.el.dom.value==this.emptyText){this.setRawValue('');}
+this.el.removeClass(this.emptyClass);}if(this.selectOnFocus){this.el.dom.select();}},postBlur:function(){this.applyEmptyText();},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE &&e.button==-1))){return;}var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){if(this.emptyText&&this.el&&v!==undefined&&v!==null&&v!==''){this.el.removeClass(this.emptyClass);}
+Roo.form.TextField.superclass.setValue.apply(this,arguments);this.applyEmptyText();this.autoSize();},validateValue:function(A){if(A.length<1||A===this.emptyText){if(this.allowBlank){this.clearInvalid();return true;}else {this.markInvalid(this.blankText);return false;}}if(A.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false;}if(A.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false;}if(this.vtype){var vt=Roo.form.VTypes;if(!vt[this.vtype](A,this)){this.markInvalid(this.vtypeText||vt[this.vtype+'Text']);return false;}}if(typeof this.validator=="function"){var B=this.validator(A);if(B!==true){this.markInvalid(B);return false;}}if(this.regex&&!this.regex.test(A)){this.markInvalid(this.regexText);return false;}return true;},selectText:function(A,B){var v=this.getRawValue();if(v.length>0){A=A===undefined?0:A;B=B===undefined?v.length:B;var d=this.el.dom;if(d.setSelectionRange){d.setSelectionRange(A,B);}else if(d.createTextRange){var C=d.createTextRange();C.moveStart("character",A);C.moveEnd("character",v.length-B);C.select();}}},autoSize:function(){if(!this.grow||!this.rendered){return;}if(!this.metrics){this.metrics=Roo.util.TextMetrics.createInstance(this.el);}var el=this.el;var v=el.dom.value;var d=document.createElement('div');d.appendChild(document.createTextNode(v));v=d.innerHTML;d=null;v+="&#160;";var w=Math.min(this.growMax,Math.max(this.metrics.getWidth(v)+10,this.growMin));this.el.setWidth(w);this.fireEvent("autosize",this,w);}});
+//Roo/form/Hidden.js
+Roo.form.Hidden=function(A){Roo.form.Hidden.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Hidden,Roo.form.TextField,{fieldLabel:'',inputType:'hidden',width:50,allowBlank:true,labelSeparator:'',hidden:true,itemCls:'x-form-item-display-none'});
+//Roo/form/TriggerField.js
+Roo.form.TriggerField=function(A){this.mimicing=false;Roo.form.TriggerField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.TriggerField,Roo.form.TextField,{defaultAutoCreate:{tag:"input",type:"text",size:"16",autocomplete:"off"},hideTrigger:false,autoSize:Roo.emptyFn,monitorTab:true,deferHeight:true,actionMode:'wrap',onResize:function(w,h){Roo.form.TriggerField.superclass.onResize.apply(this,arguments);if(typeof w=='number'){var x=w-this.trigger.getWidth();this.el.setWidth(this.adjustWidth('input',x));this.trigger.setStyle('left',x+'px');}},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,'tl-tr',[2,0]);},onRender:function(ct,A){Roo.form.TriggerField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:"x-form-field-wrap"});this.trigger=this.wrap.createChild(this.triggerConfig||{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});if(this.hideTrigger){this.trigger.setDisplayed(false);}
+this.initTrigger();if(!this.width){this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());}},initTrigger:function(){this.trigger.on("click",this.onTriggerClick,this,{preventDefault:true});this.trigger.addClassOnOver('x-form-trigger-over');this.trigger.addClassOnClick('x-form-trigger-click');},onDestroy:function(){if(this.trigger){this.trigger.removeAllListeners();this.trigger.remove();}if(this.wrap){this.wrap.remove();}
+Roo.form.TriggerField.superclass.onDestroy.call(this);},onFocus:function(){Roo.form.TriggerField.superclass.onFocus.call(this);if(!this.mimicing){this.wrap.addClass('x-trigger-wrap-focus');this.mimicing=true;Roo.get(Roo.isIE?document.body:document).on("mousedown",this.mimicBlur,this);if(this.monitorTab){this.el.on("keydown",this.checkTab,this);}}},checkTab:function(e){if(e.getKey()==e.TAB){this.triggerBlur();}},onBlur:function(){},mimicBlur:function(e,t){if(!this.wrap.contains(t)&&this.validateBlur()){this.triggerBlur();}},triggerBlur:function(){this.mimicing=false;Roo.get(Roo.isIE?document.body:document).un("mousedown",this.mimicBlur);if(this.monitorTab){this.el.un("keydown",this.checkTab,this);}
+this.wrap.removeClass('x-trigger-wrap-focus');Roo.form.TriggerField.superclass.onBlur.call(this);},validateBlur:function(e,t){return true;},onDisable:function(){Roo.form.TriggerField.superclass.onDisable.call(this);if(this.wrap){this.wrap.addClass('x-item-disabled');}},onEnable:function(){Roo.form.TriggerField.superclass.onEnable.call(this);if(this.wrap){this.wrap.removeClass('x-item-disabled');}},onShow:function(){var ae=this.getActionEl();if(ae){ae.dom.style.display='';ae.dom.style.visibility='visible';}},onHide:function(){var ae=this.getActionEl();ae.dom.style.display='none';},onTriggerClick:Roo.emptyFn});Roo.form.TwinTriggerField=Roo.extend(Roo.form.TriggerField,{initComponent:function(){Roo.form.TwinTriggerField.superclass.initComponent.call(this);this.triggerConfig={tag:'span',cls:'x-form-twin-triggers',cn:[{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]};},getTrigger:function(A){return this.triggers[A];},initTrigger:function(){var ts=this.trigger.select('.x-form-trigger',true);this.wrap.setStyle('overflow','hidden');var A=this;ts.each(function(t,B,C){t.hide=function(){var w=A.wrap.getWidth();this.dom.style.display='none';A.el.setWidth(w-A.trigger.getWidth());};t.show=function(){var w=A.wrap.getWidth();this.dom.style.display='';A.el.setWidth(w-A.trigger.getWidth());};var D='Trigger'+(C+1);if(this['hide'+D]){t.dom.style.display='none';}
+t.on("click",this['on'+D+'Click'],this,{preventDefault:true});t.addClassOnOver('x-form-trigger-over');t.addClassOnClick('x-form-trigger-click');},this);this.triggers=ts.elements;},onTrigger1Click:Roo.emptyFn,onTrigger2Click:Roo.emptyFn});
+//Roo/form/TextArea.js
+Roo.form.TextArea=function(A){Roo.form.TextArea.superclass.constructor.call(this,A);if(this.minHeight!==undefined){this.growMin=this.minHeight;}if(this.maxHeight!==undefined){this.growMax=this.maxHeight;}};Roo.extend(Roo.form.TextArea,Roo.form.TextField,{growMin:60,growMax:1000,preventScrollbars:false,onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"off"};}
+Roo.form.TextArea.superclass.onRender.call(this,ct,A);if(this.grow){this.textSizeEl=Roo.DomHelper.append(document.body,{tag:"pre",cls:"x-form-grow-sizer"});if(this.preventScrollbars){this.el.setStyle("overflow","hidden");}
+this.el.setHeight(this.growMin);}},onDestroy:function(){if(this.textSizeEl){this.textSizeEl.parentNode.removeChild(this.textSizeEl);}
+Roo.form.TextArea.superclass.onDestroy.call(this);},onKeyUp:function(e){if(!e.isNavKeyPress()||e.getKey()==e.ENTER){this.autoSize();}},autoSize:function(){if(!this.grow||!this.textSizeEl){return;}var el=this.el;var v=el.dom.value;var ts=this.textSizeEl;ts.innerHTML='';ts.appendChild(document.createTextNode(v));v=ts.innerHTML;Roo.fly(ts).setWidth(this.el.getWidth());if(v.length<1){v="&#160;&#160;";}else {if(Roo.isIE){v=v.replace(/\n/g,'<p>&#160;</p>');}
+v+="&#160;\n&#160;";}
+ts.innerHTML=v;var h=Math.min(this.growMax,Math.max(ts.offsetHeight,this.growMin));if(h!=this.lastHeight){this.lastHeight=h;this.el.setHeight(h);this.fireEvent("autosize",this,h);}}});
+//Roo/form/NumberField.js
+Roo.form.NumberField=function(A){Roo.form.NumberField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.NumberField,Roo.form.TextField,{fieldClass:"x-form-field x-form-num-field",allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",initEvents:function(){Roo.form.NumberField.superclass.initEvents.call(this);var A="0123456789";if(this.allowDecimals){A+=this.decimalSeparator;}if(this.allowNegative){A+="-";}
+this.stripCharsRe=new RegExp('[^'+A+']','gi');var B=function(e){var k=e.getKey();if(!Roo.isIE&&(e.isSpecialKey()||k==e.BACKSPACE||k==e.DELETE )){return;}var c=e.getCharCode();if(A.indexOf(String.fromCharCode(c))===-1){e.stopEvent();}};this.el.on("keypress",B,this);},validateValue:function(A){if(!Roo.form.NumberField.superclass.validateValue.call(this,A)){return false;}if(A.length<1){return true;}var B=this.parseValue(A);if(isNaN(B)){this.markInvalid(String.format(this.nanText,A));return false;}if(B<this.minValue){this.markInvalid(String.format(this.minText,this.minValue));return false;}if(B>this.maxValue){this.markInvalid(String.format(this.maxText,this.maxValue));return false;}return true;},getValue:function(){return this.fixPrecision(this.parseValue(Roo.form.NumberField.superclass.getValue.call(this)));},parseValue:function(A){A=parseFloat(String(A).replace(this.decimalSeparator,"."));return isNaN(A)?'':A;},fixPrecision:function(A){var B=isNaN(A);if(!this.allowDecimals||this.decimalPrecision==-1||B||!A){return B?'':A;}return parseFloat(A).toFixed(this.decimalPrecision);},setValue:function(v){v=this.fixPrecision(v);Roo.form.NumberField.superclass.setValue.call(this,String(v).replace(".",this.decimalSeparator));},decimalPrecisionFcn:function(v){return Math.floor(v);},beforeBlur:function(){var v=this.parseValue(this.getRawValue());if(v){this.setValue(v);}}});
+//Roo/form/DateField.js
+Roo.form.DateField=function(A){Roo.form.DateField.superclass.constructor.call(this,A);this.addEvents({'select':true});if(typeof this.minValue=="string")this.minValue=this.parseDate(this.minValue);if(typeof this.maxValue=="string")this.maxValue=this.parseDate(this.maxValue);this.ddMatch=null;if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|";}
+this.ddMatch=new RegExp(re+")");}};Roo.extend(Roo.form.DateField,Roo.form.TriggerField,{format:"m/d/y",altFormats:"m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d",disabledDays:null,disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:'x-form-date-trigger',useIso:false,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},hiddenField:false,onRender:function(ct,A){Roo.form.DateField.superclass.onRender.call(this,ct,A);if(this.useIso){this.el.dom.removeAttribute('name');this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.name},'before',true);this.hiddenField.value=this.formatDate(this.value,'Y-m-d');this.hiddenName=this.name;}},validateValue:function(A){A=this.formatDate(A);if(!Roo.form.DateField.superclass.validateValue.call(this,A)){return false;}if(A.length<1){return true;}var B=A;A=this.parseDate(A);if(!A){this.markInvalid(String.format(this.invalidText,B,this.format));return false;}var C=A.getTime();if(this.minValue&&C<this.minValue.getTime()){this.markInvalid(String.format(this.minText,this.formatDate(this.minValue)));return false;}if(this.maxValue&&C>this.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false;}if(this.disabledDays){var D=A.getDay();for(var i=0;i<this.disabledDays.length;i++){if(D===this.disabledDays[i]){this.markInvalid(this.disabledDaysText);return false;}}}var E=this.formatDate(A);if(this.ddMatch&&this.ddMatch.test(E)){this.markInvalid(String.format(this.disabledDatesText,E));return false;}return true;},validateBlur:function(){return !this.menu||!this.menu.isVisible();},getValue:function(){return this.hiddenField?this.hiddenField.value:this.parseDate(Roo.form.DateField.superclass.getValue.call(this))||"";},setValue:function(A){if(this.hiddenField){this.hiddenField.value=this.formatDate(this.parseDate(A),'Y-m-d');}
+Roo.form.DateField.superclass.setValue.call(this,this.formatDate(this.parseDate(A)));},parseDate:function(A){if(!A||A instanceof Date){return A;}var v=Date.parseDate(A,this.format);if(!v&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|");}for(var i=0,B=this.altFormatsArray.length;i<B&&!v;i++){v=Date.parseDate(A,this.altFormatsArray[i]);}}return v;},formatDate:function(A,B){return (!A||!(A instanceof Date))?A:A.dateFormat(B||this.format);},menuListeners:{select:function(m,d){this.setValue(d);this.fireEvent('select',this,d);},show:function(){this.onFocus();},hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);this.menu.un("hide",ml.hide,this);}},onTriggerClick:function(){if(this.disabled){return;}if(this.menu==null){this.menu=new Roo.menu.DateMenu();}
+Roo.apply(this.menu.picker,{showClear:this.allowBlank,minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.format,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))});this.menu.on(Roo.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?");},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v);}}});
+//Roo/form/ComboBox.js
+Roo.form.ComboBox=function(A){Roo.form.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true});if(this.transform){this.allowDomMove=false;var s=Roo.getDom(this.transform);if(!this.hiddenName){this.hiddenName=s.name;}if(!this.store){this.mode='local';var d=[],B=s.options;for(var i=0,C=B.length;i<C;i++){var o=B[i];var D=(Roo.isIE?o.getAttributeNode('value').specified:o.hasAttribute('value'))?o.value:o.text;if(o.selected){this.value=D;}
+d.push([D,o.text]);}
+this.store=new Roo.data.SimpleStore({'id':0,fields:['value','text'],data:d});this.valueField='value';this.displayField='text';}
+s.name=Roo.id();if(!this.lazyRender){this.target=true;this.el=Roo.DomHelper.insertBefore(s,this.autoCreate||this.defaultAutoCreate);s.parentNode.removeChild(s);this.render(this.el.parentNode);}else {s.parentNode.removeChild(s);}}if(this.store){this.store=Roo.factory(this.store,Roo.data);}
+this.selectedIndex=-1;if(this.mode=='local'){if(A.queryDelay===undefined){this.queryDelay=10;}if(A.minChars===undefined){this.minChars=0;}}};Roo.extend(Roo.form.ComboBox,Roo.form.TriggerField,{defaultAutoCreate:{tag:"input",type:"text",size:"24",autocomplete:"off"},listWidth:undefined,displayField:undefined,valueField:undefined,hiddenName:undefined,listClass:'',selectedClass:'x-combo-selected',triggerClass:'x-form-arrow-trigger',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,blockFocus:false,disableClear:false,alwaysQuery:false,addicon:false,editicon:false,onRender:function(ct,A){Roo.form.ComboBox.superclass.onRender.call(this,ct,A);if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.hiddenName,id:(this.hiddenId||this.hiddenName)},'before',true);this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');}if(Roo.isGecko){this.el.dom.setAttribute('autocomplete','off');}var B='x-combo-list';this.list=new Roo.Layer({shadow:this.shadow,cls:[B,this.listClass].join(' '),constrain:false});var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);this.list.setWidth(lw);this.list.swallowEvent('mousewheel');this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:B+'-hd',html:this.title});this.assetHeight+=this.header.getHeight();}
+this.innerList=this.list.createChild({cls:B+'-inner'});this.innerList.on('mouseover',this.onViewOver,this);this.innerList.on('mousemove',this.onViewMove,this);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));if(this.allowBlank&&!this.pageSize&&!this.disableClear){this.footer=this.list.createChild({cls:B+'-ft'});this.pageTb=new Roo.Toolbar(this.footer);}if(this.pageSize){this.footer=this.list.createChild({cls:B+'-ft'});this.pageTb=new Roo.PagingToolbar(this.footer,this.store,{pageSize:this.pageSize});}if(this.pageTb&&this.allowBlank&&!this.disableClear){var C=this;this.pageTb.add(new Roo.Toolbar.Fill(),{cls:'x-btn-icon x-btn-clear',text:'&#160;',handler:function(){C.collapse();C.clearValue();C.onSelect(false,-1);}});}if(this.footer){this.assetHeight+=this.footer.getHeight();}if(!this.tpl){this.tpl='<div class="'+B+'-item">{'+this.displayField+'}</div>';}
+this.view=new Roo.View(this.innerList,this.tpl,{singleSelect:true,store:this.store,selectedClass:this.selectedClass});this.view.on('click',this.onViewClick,this);this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoadException,this);if(this.resizable){this.resizer=new Roo.Resizable(this.list,{pinned:true,handles:'se'});this.resizer.on('resize',function(r,w,h){this.maxHeight=h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;this.listWidth=w;this.innerList.setWidth(w-this.list.getFrameWidth('lr'));this.restrictHeight();},this);this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom',this.handleHeight+'px');}if(!this.editable){this.editable=true;this.setEditable(false);}if(typeof(this.events.add.listeners)!='undefined'){this.addicon=this.wrap.createChild({tag:'img',src:Roo.BLANK_IMAGE_URL,cls:'x-form-combo-add'});this.addicon.on('click',function(e){this.fireEvent('add',this);},this);}if(typeof(this.events.edit.listeners)!='undefined'){this.editicon=this.wrap.createChild({tag:'img',src:Roo.BLANK_IMAGE_URL,cls:'x-form-combo-edit'});if(this.addicon){this.editicon.setStyle('margin-left','40px');}
+this.editicon.on('click',function(e){this.fireEvent('edit',this,this.lastData);},this);}},initEvents:function(){Roo.form.ComboBox.superclass.initEvents.call(this);this.keyNav=new Roo.KeyNav(this.el,{"up":function(e){this.inKeyMode=true;this.selectPrev();},"down":function(e){if(!this.isExpanded()){this.onTriggerClick();}else {this.inKeyMode=true;this.selectNext();}},"enter":function(e){this.onViewClick();},"esc":function(e){this.collapse();},"tab":function(e){this.onViewClick(false);this.fireEvent("specialkey",this,e);return true;},scope:this,doRelay:function(A,B,C){if(C=='down'||this.scope.isExpanded()){return Roo.KeyNav.prototype.doRelay.apply(this,arguments);}return true;},forceKeyDown:true});this.queryDelay=Math.max(this.queryDelay||10,this.mode=='local'?10:250);this.dqTask=new Roo.util.DelayedTask(this.initQuery,this);if(this.typeAhead){this.taTask=new Roo.util.DelayedTask(this.onTypeAhead,this);}if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this);}if(this.forceSelection){this.on('blur',this.doForce,this);}},onDestroy:function(){if(this.view){this.view.setStore(null);this.view.el.removeAllListeners();this.view.el.remove();this.view.purgeListeners();}if(this.list){this.list.destroy();}if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoadException,this);}
+Roo.form.ComboBox.superclass.onDestroy.call(this);},fireKey:function(e){if(e.isNavKeyPress()&&!this.list.isVisible()){this.fireEvent("specialkey",this,e);}},onResize:function(w,h){Roo.form.ComboBox.superclass.onResize.apply(this,arguments);if(typeof w!='number'){return;}var tw=this.trigger.getWidth();tw+=this.addicon?this.addicon.getWidth():0;tw+=this.editicon?this.editicon.getWidth():0;var x=w-tw;this.el.setWidth(this.adjustWidth('input',x));this.trigger.setStyle('left',x+'px');if(this.list&&this.listWidth===undefined){var lw=Math.max(x+this.trigger.getWidth(),this.minListWidth);this.list.setWidth(lw);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));}},setEditable:function(A){if(A==this.editable){return;}
+this.editable=A;if(!A){this.el.dom.setAttribute('readOnly',true);this.el.on('mousedown',this.onTriggerClick,this);this.el.addClass('x-combo-noedit');}else {this.el.dom.setAttribute('readOnly',false);this.el.un('mousedown',this.onTriggerClick,this);this.el.removeClass('x-combo-noedit');}},onBeforeLoad:function(){if(!this.hasFocus){return;}
+this.innerList.update(this.loadingText?'<div class="loading-indicator">'+this.loadingText+'</div>':'');this.restrictHeight();this.selectedIndex=-1;},onLoad:function(){if(!this.hasFocus){return;}if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select();}if(!this.selectByValue(this.value,true)){this.select(0,true);}}else {this.selectNext();if(this.typeAhead&&this.lastKey!=Roo.EventObject.BACKSPACE&&this.lastKey!=Roo.EventObject.DELETE ){this.taTask.delay(this.typeAheadDelay);}}}else {this.onEmptyResults();}},onLoadException:function(){this.collapse();Roo.log(this.store.reader.jsonData);if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg);}},onTypeAhead:function(){if(this.store.getCount()>0){var r=this.store.getAt(0);var A=r.data[this.displayField];var B=A.length;var C=this.getRawValue().length;if(C!=B){this.setRawValue(A);this.selectText(C,A.length);}}},onSelect:function(A,B){if(this.fireEvent('beforeselect',this,A,B)!==false){this.setFromData(B>-1?A.data:false);this.collapse();this.fireEvent('select',this,A,B);}},getValue:function(){if(this.valueField){return typeof this.value!='undefined'?this.value:'';}else {return Roo.form.ComboBox.superclass.getValue.call(this);}},clearValue:function(){if(this.hiddenField){this.hiddenField.value='';}
+this.value='';this.setRawValue('');this.lastSelectionText='';this.applyEmptyText();},setValue:function(v){var A=v;if(this.valueField){var r=this.findRecord(this.valueField,v);if(r){A=r.data[this.displayField];}else if(this.valueNotFoundText!==undefined){A=this.valueNotFoundText;}}
+this.lastSelectionText=A;if(this.hiddenField){this.hiddenField.value=v;}
+Roo.form.ComboBox.superclass.setValue.call(this,A);this.value=v;},lastData:false,setFromData:function(o){var dv='';var vv='';this.lastData=o;if(this.displayField){dv=!o||typeof(o[this.displayField])=='undefined'?'':o[this.displayField];}else {Roo.log('no  displayField value set for '+(this.name?this.name:this.id));}if(this.valueField){vv=!o||typeof(o[this.valueField])=='undefined'?dv:o[this.valueField];}if(this.hiddenField){this.hiddenField.value=vv;this.lastSelectionText=dv;Roo.form.ComboBox.superclass.setValue.call(this,dv);this.value=vv;return;}
+this.lastSelectionText=dv;Roo.form.ComboBox.superclass.setValue.call(this,dv);this.value=vv;},reset:function(){this.setValue(this.originalValue);this.clearInvalid();this.lastData=false;},findRecord:function(A,B){var C;if(this.store.getCount()>0){this.store.each(function(r){if(r.data[A]==B){C=r;return false;}return true;});}return C;},getName:function(){if(!this.rendered){return ''};return !this.hiddenName&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');},onViewMove:function(e,t){this.inKeyMode=false;},onViewOver:function(e,t){if(this.inKeyMode){return;}var A=this.view.findItemFromChild(t);if(A){var B=this.view.indexOf(A);this.select(B,false);}},onViewClick:function(A){var B=this.view.getSelectedIndexes()[0];var r=this.store.getAt(B);if(r){this.onSelect(r,B);}if(A!==false&&!this.blockFocus){this.el.focus();}},restrictHeight:function(){this.innerList.dom.style.height='';var A=this.innerList.dom;var h=Math.max(A.clientHeight,A.offsetHeight,A.scrollHeight);this.innerList.setHeight(h<this.maxHeight?'auto':this.maxHeight);this.list.beginUpdate();this.list.setHeight(this.innerList.getHeight()+this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight);this.list.alignTo(this.el,this.listAlign);this.list.endUpdate();},onEmptyResults:function(){this.collapse();},isExpanded:function(){return this.list.isVisible();},selectByValue:function(v,A){if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),A);return true;}}return false;},select:function(A,B){this.selectedIndex=A;this.view.select(A);if(B!==false){var el=this.view.getNode(A);if(el){this.innerList.scrollChildIntoView(el,false);}}},selectNext:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex<ct-1){this.select(this.selectedIndex+1);}}},selectPrev:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex!=0){this.select(this.selectedIndex-1);}}},onKeyUp:function(e){if(this.editable!==false&&!e.isSpecialKey()){this.lastKey=e.getKey();this.dqTask.delay(this.queryDelay);}},validateBlur:function(){return !this.list||!this.list.isVisible();},initQuery:function(){this.doQuery(this.getRawValue());},doForce:function(){if(this.el.dom.value.length>0){this.el.dom.value=this.lastSelectionText===undefined?'':this.lastSelectionText;this.applyEmptyText();}},doQuery:function(q,A){if(q===undefined||q===null){q='';}var qe={query:q,forceAll:A,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
+q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(A){this.store.clearFilter();}else {this.store.filter(this.displayField,q);}
+this.onLoad();}else {this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});this.expand();}}else {this.selectedIndex=-1;this.onLoad();}}},getParams:function(q){var p={};if(this.pageSize){p.start=0;p.limit=this.pageSize;}return p;},collapse:function(){if(!this.isExpanded()){return;}
+this.list.hide();Roo.get(document).un('mousedown',this.collapseIf,this);Roo.get(document).un('mousewheel',this.collapseIf,this);if(!this.editable){Roo.get(document).un('keydown',this.listKeyPress,this);}
+this.fireEvent('collapse',this);},collapseIf:function(e){if(!e.within(this.wrap)&&!e.within(this.list)){this.collapse();}},expand:function(){if(this.isExpanded()||!this.hasFocus){return;}
+this.list.alignTo(this.el,this.listAlign);this.list.show();Roo.get(document).on('mousedown',this.collapseIf,this);Roo.get(document).on('mousewheel',this.collapseIf,this);if(!this.editable){Roo.get(document).on('keydown',this.listKeyPress,this);}
+this.fireEvent('expand',this);},onTriggerClick:function(){if(this.disabled){return;}if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.el.focus();}}else {this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else {this.doQuery(this.getRawValue());}if(!this.blockFocus){this.el.focus();}}},listKeyPress:function(e){if(e.isSpecialKey()){return false;}var k=String.fromCharCode(e.getKey()).toUpperCase();var A=false;var B=this.view.getSelectedNodes();var C=false;if(B.length){var ix=this.view.indexOf(B[0]);C=this.store.getAt(ix);if(!C.get(this.displayField)||C.get(this.displayField).substring(0,1).toUpperCase()!=k){C=false;}}
+this.store.each(function(v){if(C){if(C.id==v.id){C=false;}return;}if(v.get(this.displayField)&&v.get(this.displayField).substring(0,1).toUpperCase()==k){A=this.store.indexOf(v);return false;}},this);if(A===false){return true;}
+this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0])
+sn.scrollIntoView(sn.dom.parentNode,false);}});
+//Roo/form/Checkbox.js
+Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},boxLabel:"",inputValue:'1',valueOff:'0',actionMode:'viewEl',itemCls:'x-menu-check-item x-form-item',groupClass:'x-menu-group-item',inputType:'hidden',inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-menu-check-item '});var B=this.wrap.createChild({tag:'img',cls:'x-menu-item-icon',style:'margin: 0px;',src:Roo.BLANK_IMAGE_URL});this.viewEl=B;this.wrap.on('click',this.onClick,this);this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel});}
+this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;}return this.valueOff;},onClick:function(){this.setChecked(!this.checked);},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);},setChecked:function(A,B){if(this.inSetChecked){this.checked=A;return;}if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked');}
+this.checked=A;if(B!==true){this.fireEvent('check',this,A);}
+this.inSetChecked=true;this.el.dom.value=A?this.inputValue:this.valueOff;this.inSetChecked=false;},setFromHidden:function(){if(!this.el){return;}
+this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}
+Roo.form.Checkbox.superclass.onDestroy.call(this);}});
+//Roo/form/Radio.js
+Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value;}});
+//Roo/form/HtmlEditor.js
+Roo.form.HtmlEditor=Roo.extend(Roo.form.Field,{toolbars:false,createLinkText:'Please enter the URL for the link:',defaultLinkValue:'http:/'+'/',resizable:false,height:300,width:500,stylesheets:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',defaultAutoCreate:{tag:"textarea",style:"width:500px;height:300px;",autocomplete:"off"},initComponent:function(){this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editmodechange:true,editorevent:true});this.defaultAutoCreate={tag:"textarea",style:'width: '+this.width+'px;height: '+this.height+'px;',autocomplete:"off"};},createToolbar:function(A){if(!A.toolbars||!A.toolbars.length){A.toolbars=[new Roo.form.HtmlEditor.ToolbarStandard()];}for(var i=0;i<A.toolbars.length;i++){A.toolbars[i]=Roo.factory(A.toolbars[i],Roo.form.HtmlEditor);A.toolbars[i].init(A);}},getDocMarkup:function(){var st='';if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(A){st+=A.dom.outerHTML||new XMLSerializer().serializeToString(A.dom);});Roo.get(document.head).select('link').each(function(A){st+=A.dom.outerHTML||new XMLSerializer().serializeToString(A.dom);});}else if(!this.stylesheets.length){st='<style type="text/css">'+'body{border:0;margin:0;padding:3px;height:98%;cursor:text;}'+'</style>';}else {Roo.each(this.stylesheets,function(s){st+='<link rel="stylesheet" type="text/css" href="'+s+'" />'});}return '<html><head>'+st+' </head><body></body></html>';},onRender:function(ct,A){var _t=this;Roo.form.HtmlEditor.superclass.onRender.call(this,ct,A);this.el.dom.style.border='0 none';this.el.dom.setAttribute('tabIndex',-1);this.el.addClass('x-hidden');if(Roo.isIE){this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')}
+this.wrap=this.el.wrap({cls:'x-html-editor-wrap',cn:{cls:'x-html-editor-tb'}});if(this.resizable){this.resizeEl=new Roo.Resizable(this.wrap,{pinned:true,wrap:true,dynamic:true,minHeight:this.height,height:this.height,handles:this.resizable,width:this.width,listeners:{resize:function(r,w,h){_t.onResize(w,h);}}});}
+this.frameId=Roo.id();this.createToolbar(this);var B=this.wrap.createChild({tag:'iframe',id:this.frameId,name:this.frameId,frameBorder:'no','src':Roo.SSL_SECURE_URL?Roo.SSL_SECURE_URL:"javascript:false"},this.el);this.iframe=B.dom;this.assignDocWin();this.doc.designMode='on';this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var C={run:function(){this.assignDocWin();if(this.doc.body||this.doc.readyState=='complete'){try{this.doc.designMode="on";}catch(e){return;}
+Roo.TaskMgr.stop(C);this.initEditor.defer(10,this);}},interval:10,duration:10000,scope:this};Roo.TaskMgr.start(C);if(!this.width){this.setSize(this.wrap.getSize());}if(this.resizeEl){this.resizeEl.resizeTo.defer(100,this.resizeEl,[this.width,this.height]);}},onResize:function(w,h){Roo.form.HtmlEditor.superclass.onResize.apply(this,arguments);if(this.el&&this.iframe){if(typeof w=='number'){var aw=w-this.wrap.getFrameWidth('lr');this.el.setWidth(this.adjustWidth('textarea',aw));this.iframe.style.width=aw+'px';}if(typeof h=='number'){var A=0;for(var i=0;i<this.toolbars.length;i++){A+=this.toolbars[i].tb.el.getHeight();if(this.toolbars[i].footer){A+=this.toolbars[i].footer.el.getHeight();}}var ah=h-this.wrap.getFrameWidth('tb')-A;ah-=5;this.el.setHeight(this.adjustWidth('textarea',ah));this.iframe.style.height=ah+'px';if(this.doc){(this.doc.body||this.doc.documentElement).style.height=(ah-(this.iframePad*2))+'px';}}}},toggleSourceEdit:function(A){this.sourceEditMode=A===true;if(this.sourceEditMode){this.syncValue();this.iframe.className='x-hidden';this.el.removeClass('x-hidden');this.el.dom.removeAttribute('tabIndex');this.el.focus();}else {this.pushValue();this.iframe.className='';this.el.addClass('x-hidden');this.el.dom.setAttribute('tabIndex',-1);this.deferFocus();}
+this.setSize(this.wrap.getSize());this.fireEvent('editmodechange',this,this.sourceEditMode);},createLink:function(){var A=prompt(this.createLinkText,this.defaultLinkValue);if(A&&A!='http:/'+'/'){this.relayCmd('createlink',A);}},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},initEvents:function(){this.originalValue=this.getValue();},markInvalid:Roo.emptyFn,clearInvalid:Roo.emptyFn,setValue:function(v){Roo.form.HtmlEditor.superclass.setValue.call(this,v);this.pushValue();},cleanHtml:function(A){A=String(A);if(A.length>5){if(Roo.isSafari){A=A.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,'');}}if(A=='&nbsp;'){A='';}return A;},syncValue:function(){if(this.initialized){var bd=(this.doc.body||this.doc.documentElement);var A=bd.innerHTML;if(Roo.isSafari){var bs=bd.getAttribute('style');var m=bs.match(/text-align:(.*?);/i);if(m&&m[1]){A='<div style="'+m[0]+'">'+A+'</div>';}}
+A=this.cleanHtml(A);if(this.fireEvent('beforesync',this,A)!==false){this.el.dom.value=A;this.fireEvent('sync',this,A);}}},pushValue:function(){if(this.initialized){var v=this.el.dom.value;if(v.length<1){v='&#160;';}if(this.fireEvent('beforepush',this,v)!==false){var d=(this.doc.body||this.doc.documentElement);d.innerHTML=v;this.cleanUpPaste();this.el.dom.value=d.innerHTML;this.fireEvent('push',this,v);}}},deferFocus:function(){this.focus.defer(10,this);},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus();}else {this.el.focus();}},assignDocWin:function(){var A=this.iframe;if(Roo.isIE){this.doc=A.contentWindow.document;this.win=A.contentWindow;}else {if(!Roo.get(this.frameId)){return;}
+this.doc=(A.contentDocument||Roo.get(this.frameId).dom.document);this.win=Roo.get(this.frameId).dom.contentWindow;}},initEditor:function(){this.assignDocWin();this.doc.designMode="on";this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var A=(this.doc.body||this.doc.documentElement);var ss=this.el.getStyles('font-size','background-image','background-repeat');ss['background-attachment']='fixed';A.bgProperties='fixed';Roo.DomHelper.applyStyles(A,ss);Roo.EventManager.on(this.doc,{'mouseup':this.onEditorEvent,'dblclick':this.onEditorEvent,'click':this.onEditorEvent,'keyup':this.onEditorEvent,buffer:100,scope:this});if(Roo.isGecko){Roo.EventManager.on(this.doc,'keypress',this.mozKeyPress,this);}if(Roo.isIE||Roo.isSafari||Roo.isOpera){Roo.EventManager.on(this.doc,'keydown',this.fixKeys,this);}
+this.initialized=true;this.fireEvent('initialize',this);this.pushValue();},onDestroy:function(){if(this.rendered){for(var i=0;i<this.toolbars.length;i++){this.toolbars[i].onDestroy();}
+this.wrap.dom.innerHTML='';this.wrap.remove();}},onFirstFocus:function(){this.assignDocWin();this.activated=true;for(var i=0;i<this.toolbars.length;i++){this.toolbars[i].onFirstFocus();}if(Roo.isGecko){this.win.focus();var s=this.win.getSelection();if(!s.focusNode||s.focusNode.nodeType!=3){var r=s.getRangeAt(0);r.selectNodeContents((this.doc.body||this.doc.documentElement));r.collapse(true);this.deferFocus();}try{this.execCmd('useCSS',true);this.execCmd('styleWithCSS',false);}catch(e){}}
+this.fireEvent('activate',this);},adjustFont:function(A){var B=A.cmd=='increasefontsize'?1:-1;var v=parseInt(this.doc.queryCommandValue('FontSize')||3,10);if(Roo.isSafari){var sm={10:1,13:2,16:3,18:4,24:5,32:6,48:7};v=(v<10)?10:v;v=(v>48)?48:v;v=typeof(sm[v])=='undefined'?1:sm[v];}
+v=Math.max(1,v+B);this.execCmd('FontSize',v);},onEditorEvent:function(e){this.fireEvent('editorevent',this,e);this.syncValue();},insertTag:function(tg){this.execCmd("formatblock",tg);},insertText:function(A){range=this.createRange();range.deleteContents();range.insertNode(this.doc.createTextNode(A));},relayBtnCmd:function(A){this.relayCmd(A.cmd);},relayCmd:function(A,B){this.win.focus();this.execCmd(A,B);this.fireEvent('editorevent',this);this.deferFocus();},execCmd:function(A,B){this.doc.execCommand(A,false,B===undefined?null:B);this.syncValue();},insertAtCursor:function(A){if(!this.activated){return;}if(Roo.isIE){this.win.focus();var r=this.doc.selection.createRange();if(r){r.collapse(true);r.pasteHTML(A);this.syncValue();this.deferFocus();}}else if(Roo.isGecko||Roo.isOpera||Roo.isSafari){this.win.focus();this.execCmd('InsertHTML',A);this.deferFocus();}},mozKeyPress:function(e){if(e.ctrlKey){var c=e.getCharCode(),A;if(c>0){c=String.fromCharCode(c).toLowerCase();switch(c){case 'b':A='bold';break;case 'i':A='italic';break;case 'u':A='underline';break;case 'v':this.cleanUpPaste.defer(100,this);return;break;}if(A){this.win.focus();this.execCmd(A);this.deferFocus();e.preventDefault();}}}},fixKeys:function(){if(Roo.isIE){return function(e){var k=e.getKey(),r;if(k==e.TAB){e.stopEvent();r=this.doc.selection.createRange();if(r){r.collapse(true);r.pasteHTML('&#160;&#160;&#160;&#160;');this.deferFocus();}return;}if(k==e.ENTER){r=this.doc.selection.createRange();if(r){var A=r.parentElement();if(!A||A.tagName.toLowerCase()!='li'){e.stopEvent();r.pasteHTML('<br />');r.collapse(false);r.select();}}}if(String.fromCharCode(k).toLowerCase()=='v'){this.cleanUpPaste.defer(100,this);return;}};}else if(Roo.isOpera){return function(e){var k=e.getKey();if(k==e.TAB){e.stopEvent();this.win.focus();this.execCmd('InsertHTML','&#160;&#160;&#160;&#160;');this.deferFocus();}if(String.fromCharCode(k).toLowerCase()=='v'){this.cleanUpPaste.defer(100,this);return;}};}else if(Roo.isSafari){return function(e){var k=e.getKey();if(k==e.TAB){e.stopEvent();this.execCmd('InsertText','\t');this.deferFocus();return;}if(String.fromCharCode(k).toLowerCase()=='v'){this.cleanUpPaste.defer(100,this);return;}};}}(),getAllAncestors:function(){var p=this.getSelectedNode();var a=[];if(!p){a.push(p);p=this.getParentElement();}while(p&&(p.nodeType==1)&&(p.tagName.toLowerCase()!='body')){a.push(p);p=p.parentNode;}
+a.push(this.doc.body);return a;},lastSel:false,lastSelNode:false,getSelection:function(){this.assignDocWin();return Roo.isIE?this.doc.selection:this.win.getSelection();},getSelectedNode:function(){var A=this.createRange(this.getSelection()).cloneRange();if(Roo.isIE){var B=A.parentElement();while(true){var C=A.duplicate();C.moveToElementText(B);if(C.inRange(A)){break;}if((B.nodeType!=1)||(B.tagName.toLowerCase()=='body')){break;}
+B=B.parentElement;}return B;}var ac=A.commonAncestorContainer;if(ac.nodeType==3){ac=ac.parentNode;}var ar=ac.childNodes;var D=[];var E=[];var F=false;for(var i=0;i<ar.length;i++){if((ar[i].nodeType==3)&&(!ar[i].data.length)){continue;}if(this.rangeIntersectsNode(A,ar[i])&&this.rangeCompareNode(A,ar[i])==3){D.push(ar[i]);continue;}if((ar[i].nodeType==1)&&this.rangeIntersectsNode(A,ar[i])&&(this.rangeCompareNode(A,ar[i])>0)){E.push(ar[i]);continue;}if(!this.rangeIntersectsNode(A,ar[i])||(this.rangeCompareNode(A,ar[i])==0)){continue;}
+F=true;}if(!D.length&&E.length){D=E;}if(F||!D.length||(D.length>1)){return false;}return D[0];},createRange:function(A){if(typeof A!="undefined"){try{return A.getRangeAt?A.getRangeAt(0):A.createRange();}catch(e){return this.doc.createRange();}}else {return this.doc.createRange();}},getParentElement:function(){this.assignDocWin();var A=Roo.isIE?this.doc.selection:this.win.getSelection();var B=this.createRange(A);try{var p=B.commonAncestorContainer;while(p.nodeType==3){p=p.parentNode;}return p;}catch(e){return null;}},rangeIntersectsNode:function(A,B){var C=B.ownerDocument.createRange();try{C.selectNode(B);}catch(e){nodeRange.selectNodeContents(node);}var D=A.cloneRange();D.collapse(true);var E=A.cloneRange();E.collapse(false);var F=C.cloneRange();F.collapse(true);var G=C.cloneRange();G.collapse(false);return D.compareBoundaryPoints(Range.START_TO_START,G)==-1&&E.compareBoundaryPoints(Range.START_TO_START,F)==1;},rangeCompareNode:function(A,B){var C=B.ownerDocument.createRange();try{C.selectNode(B);}catch(e){nodeRange.selectNodeContents(node);}
+A.collapse(true);C.collapse(true);var ss=A.compareBoundaryPoints(Range.START_TO_START,C);var ee=A.compareBoundaryPoints(Range.END_TO_END,C);var D=ss==1;var E=ee==-1;if(D&&E)return 0;if(!D&&E)return 1;if(D&&!E)return 2;return 3;},cleanUpPaste:function(){Roo.log('cleanuppaste');this.cleanUpChildren(this.doc.body);var A=this.cleanWordChars(this.doc.body.innerHTML);if(A!=this.doc.body.innerHTML){this.doc.body.innerHTML=A;}},cleanWordChars:function(A){var he=Roo.form.HtmlEditor;var B=A;Roo.each(he.swapCodes,function(sw){var C=new RegExp("\\u"+sw[0].toString(16),"g");B=B.replace(C,sw[1]);});return B;},cleanUpChildren:function(n){if(!n.childNodes.length){return;}for(var i=n.childNodes.length-1;i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}if(Roo.form.HtmlEditor.black.indexOf(A.tagName.toLowerCase())>-1){A.parentNode.removeChild(A);return;}var B=Roo.form.HtmlEditor.remove.indexOf(A.tagName.toLowerCase())>-1;if(A.tagName.toLowerCase()=='a'&&!A.hasAttribute('href')){B=true;}if(B){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);A.parentNode.insertBefore(cn,A);}
+A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)){return;}
+Roo.log("(REMOVE)"+A.tagName+'.'+n+'='+v);A.removeAttribute(n);}function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var C=v.split(/;/);Roo.each(C,function(p){p=p.replace(/\s+/g,'');if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');if(Roo.form.HtmlEditor.cwhite.indexOf(l)<0){Roo.log('(REMOVE)'+A.tagName+'.'+n+':'+l+'='+v);A.removeAttribute(n);return false;}return true;});}for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(Roo.form.HtmlEditor.ablack.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);return;}if(Roo.form.HtmlEditor.aclean.indexOf(a.name.toLowerCase())>-1){cleanAttr(a.name,a.value);return;}if(a.name=='style'){cleanStyle(a.name,a.value);}if(a.name=='class'){if(a.value.match(/^Mso/)){A.className='';}if(a.value.match(/body/)){A.className='';}}}
+this.cleanUpChildren(A);}});Roo.form.HtmlEditor.white=['area','br','img','input','hr','wbr','address','blockquote','center','dd','dir','div','dl','dt','h1','h2','h3','h4','h5','h6','hr','isindex','listing','marquee','menu','multicol','ol','p','plaintext','pre','table','ul','xmp','caption','col','colgroup','tbody','td','tfoot','th','thead','tr','dir','menu','ol','ul','dl','embed','object'];Roo.form.HtmlEditor.black=['applet','base','basefont','bgsound','blink','body','frame','frameset','head','html','ilayer','iframe','layer','link','meta','object','script','style','title','xml'];Roo.form.HtmlEditor.clean=['script','style','title','xml'];Roo.form.HtmlEditor.remove=['font'];Roo.form.HtmlEditor.ablack=['on'];Roo.form.HtmlEditor.aclean=['action','background','codebase','dynsrc','href','lowsrc'];Roo.form.HtmlEditor.pwhite=['http','https','mailto'];Roo.form.HtmlEditor.cwhite=['text-align','font-size'];Roo.form.HtmlEditor.swapCodes=[[8211,"--"],[8212,"--"],[8216,"'"],[8217,"'"],[8220,'"'],[8221,'"'],[8226,"*"],[8230,"..."]];
+//Roo/form/HtmlEditor/ToolbarStandard.js
+Roo.form.HtmlEditor.ToolbarStandard=function(A){Roo.apply(this,A);this.disable=this.disable||{};Roo.applyIf(this.disable,{fontSize:true,colors:true,specialElements:true});}
+Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype,{tb:false,rendered:false,editor:false,disable:false,fontFamilies:['Arial','Courier New','Tahoma','Times New Roman','Verdana'],specialChars:["&#169;","&#174;","&#8482;","&#163;","&#8230;","&#247;","&#8364;","&#176;"],specialElements:[{text:"Insert Table",xtype:'MenuItem',xns:Roo.Menu,ihtml:'<table><tr><td>Cell</td></tr></table>'},{text:"Insert Image",xtype:'MenuItem',xns:Roo.Menu,ihtml:'<img src="about:blank"/>'}],inputElements:["form","input:text","input:hidden","input:checkbox","input:radio","input:password","input:submit","input:button","select","textarea","label"],formats:[["p"],["h1"],["h2"],["h3"],["h4"],["h5"],["h6"],["pre"],["code"],["abbr"],["acronym"],["address"],["cite"],["samp"],["var"]],defaultFont:'tahoma',fontSelect:false,formatCombo:false,init:function(A){this.editor=A;var B=A.frameId;var C=this;function btn(id,F,G){var H=B+'-'+id;return {id:H,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:F!==false,scope:A,handler:G||A.relayBtnCmd,clickEvent:'mousedown',tooltip:C.buttonTips[id]||undefined,tabIndex:-1};}var tb=new Roo.Toolbar(A.wrap.dom.firstChild);this.tb=tb;tb.el.on('click',function(e){e.preventDefault();});if(!this.disable.font&&!Roo.isSafari){};if(!this.disable.formats){this.formatCombo=new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'tag',fields:['tag'],data:this.formats}),blockFocus:true,displayField:'tag',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Add tag',selectOnFocus:true,width:135,listeners:{'select':function(c,r,i){A.insertTag(r.get('tag'));A.focus();}}});tb.addField(this.formatCombo);}if(!this.disable.format){tb.add(btn('bold'),btn('italic'),btn('underline'));};if(!this.disable.fontSize){tb.add('-',btn('increasefontsize',false,A.adjustFont),btn('decreasefontsize',false,A.adjustFont));};if(!this.disable.colors){tb.add('-',{id:A.frameId+'-forecolor',cls:'x-btn-icon x-edit-forecolor',clickEvent:'mousedown',tooltip:this.buttonTips['forecolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({allowReselect:true,focus:Roo.emptyFn,value:'000000',plain:true,selectHandler:function(cp,F){A.execCmd('forecolor',Roo.isSafari||Roo.isIE?'#'+F:F);A.deferFocus();},scope:A,clickEvent:'mousedown'})},{id:A.frameId+'backcolor',cls:'x-btn-icon x-edit-backcolor',clickEvent:'mousedown',tooltip:this.buttonTips['backcolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({focus:Roo.emptyFn,value:'FFFFFF',plain:true,allowReselect:true,selectHandler:function(cp,F){if(Roo.isGecko){A.execCmd('useCSS',false);A.execCmd('hilitecolor',F);A.execCmd('useCSS',true);A.deferFocus();}else {A.execCmd(Roo.isOpera?'hilitecolor':'backcolor',Roo.isSafari||Roo.isIE?'#'+F:F);A.deferFocus();}},scope:A,clickEvent:'mousedown'})});};if(!this.disable.alignments){tb.add('-',btn('justifyleft'),btn('justifycenter'),btn('justifyright'));};if(!this.disable.links){tb.add('-',btn('createlink',false,A.createLink));};if(!this.disable.lists){tb.add('-',btn('insertorderedlist'),btn('insertunorderedlist'));}if(!this.disable.sourceEdit){tb.add('-',btn('sourceedit',true,function(F){this.toggleSourceEdit(F.pressed);}));}var D={};if(!this.disable.special){D={text:"&#169;",cls:'x-edit-none',menu:{items:[]}};for(var i=0;i<this.specialChars.length;i++){D.menu.items.push({html:this.specialChars[i],handler:function(a,b){A.insertAtCursor(String.fromCharCode(a.html.replace('&#','').replace(';','')));},tabIndex:-1});}
+tb.add(D);}if(!this.disable.specialElements){var E={text:"Other;",cls:'x-edit-none',menu:{items:[]}};for(var i=0;i<this.specialElements.length;i++){E.menu.items.push(Roo.apply({handler:function(a,b){A.insertAtCursor(this.ihtml);}},this.specialElements[i]));}
+tb.add(E);}if(this.btns){for(var i=0;i<this.btns.length;i++){var b=this.btns[i];b.cls='x-edit-none';b.scope=A;tb.add(b);}}
+this.tb.items.each(function(F){if(F.id!=A.frameId+'-sourceedit'){F.disable();}});this.rendered=true;A.on('editorevent',this.updateToolbar,this);},updateToolbar:function(){if(!this.editor.activated){this.editor.onFirstFocus();return;}var A=this.tb.items.map,B=this.editor.doc,C=this.editor.frameId;if(!this.disable.font&&!Roo.isSafari){}if(!this.disable.format){A[C+'-bold'].toggle(B.queryCommandState('bold'));A[C+'-italic'].toggle(B.queryCommandState('italic'));A[C+'-underline'].toggle(B.queryCommandState('underline'));}if(!this.disable.alignments){A[C+'-justifyleft'].toggle(B.queryCommandState('justifyleft'));A[C+'-justifycenter'].toggle(B.queryCommandState('justifycenter'));A[C+'-justifyright'].toggle(B.queryCommandState('justifyright'));}if(!Roo.isSafari&&!this.disable.lists){A[C+'-insertorderedlist'].toggle(B.queryCommandState('insertorderedlist'));A[C+'-insertunorderedlist'].toggle(B.queryCommandState('insertunorderedlist'));}var D=this.editor.getAllAncestors();if(this.formatCombo){var E=this.formatCombo.store;this.formatCombo.setValue("");for(var i=0;i<D.length;i++){if(D[i]&&E.query('tag',D[i].tagName.toLowerCase(),false).length){this.formatCombo.setValue(D[i].tagName.toLowerCase());break;}}}
+Roo.menu.MenuMgr.hideAll();},createFontOptions:function(){var A=[],fs=this.fontFamilies,ff,lc;for(var i=0,B=fs.length;i<B;i++){ff=fs[i];lc=ff.toLowerCase();A.push('<option value="',lc,'" style="font-family:',ff,';"',(this.defaultFont==lc?' selected="true">':'>'),ff,'</option>');}return A.join('');},toggleSourceEdit:function(A){if(A===undefined){A=!this.sourceEditMode;}
+this.sourceEditMode=A===true;var B=this.tb.items.get(this.editor.frameId+'-sourceedit');if(B.pressed!==this.editor.sourceEditMode){B.toggle(this.editor.sourceEditMode);return;}if(this.sourceEditMode){this.tb.items.each(function(C){if(C.cmd!='sourceedit'){C.disable();}});}else {if(this.initialized){this.tb.items.each(function(C){C.enable();});}}
+this.editor.toggleSourceEdit(A);},buttonTips:{bold:{title:'Bold (Ctrl+B)',text:'Make the selected text bold.',cls:'x-html-editor-tip'},italic:{title:'Italic (Ctrl+I)',text:'Make the selected text italic.',cls:'x-html-editor-tip'},underline:{title:'Underline (Ctrl+U)',text:'Underline the selected text.',cls:'x-html-editor-tip'},increasefontsize:{title:'Grow Text',text:'Increase the font size.',cls:'x-html-editor-tip'},decreasefontsize:{title:'Shrink Text',text:'Decrease the font size.',cls:'x-html-editor-tip'},backcolor:{title:'Text Highlight Color',text:'Change the background color of the selected text.',cls:'x-html-editor-tip'},forecolor:{title:'Font Color',text:'Change the color of the selected text.',cls:'x-html-editor-tip'},justifyleft:{title:'Align Text Left',text:'Align text to the left.',cls:'x-html-editor-tip'},justifycenter:{title:'Center Text',text:'Center text in the editor.',cls:'x-html-editor-tip'},justifyright:{title:'Align Text Right',text:'Align text to the right.',cls:'x-html-editor-tip'},insertunorderedlist:{title:'Bullet List',text:'Start a bulleted list.',cls:'x-html-editor-tip'},insertorderedlist:{title:'Numbered List',text:'Start a numbered list.',cls:'x-html-editor-tip'},createlink:{title:'Hyperlink',text:'Make the selected text a hyperlink.',cls:'x-html-editor-tip'},sourceedit:{title:'Source Edit',text:'Switch to source editing mode.',cls:'x-html-editor-tip'}},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();if(A.menu.el){A.menu.el.destroy();}}
+A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});}});
+//Roo/form/HtmlEditor/ToolbarContext.js
+Roo.form.HtmlEditor.ToolbarContext=function(A){Roo.apply(this,A);this.styles=this.styles||{};}
+Roo.form.HtmlEditor.ToolbarContext.types={'IMG':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["right"],["center"],["top"]],width:80},border:{title:"Border",width:40},alt:{title:"Alt",width:120},src:{title:"Src",width:220}},'A':{name:{title:"Name",width:50},href:{title:"Href",width:220}},'TABLE':{rows:{title:"Rows",width:20},cols:{title:"Cols",width:20},width:{title:"Width",width:40},height:{title:"Height",width:40},border:{title:"Border",width:20}},'TD':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["center"],["right"],["justify"],["char"]],width:80},valign:{title:"Valign",opts:[[""],["top"],["middle"],["bottom"],["baseline"]],width:80},colspan:{title:"Colspan",width:20}},'INPUT':{name:{title:"name",width:120},value:{title:"Value",width:120},width:{title:"Width",width:40}},'LABEL':{'for':{title:"For",width:120}},'TEXTAREA':{name:{title:"name",width:120},rows:{title:"Rows",width:20},cols:{title:"Cols",width:20}},'SELECT':{name:{title:"name",width:120},selectoptions:{title:"Options",width:200}},'BODY':{title:{title:"title",width:200,disabled:true}},'*':{}};Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,{tb:false,rendered:false,editor:false,disable:false,styles:false,toolbars:false,init:function(A){this.editor=A;var B=A.frameId;var C=this;function btn(id,E,F){var G=B+'-'+id;return {id:G,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:E!==false,scope:A,handler:F||A.relayBtnCmd,clickEvent:'mousedown',tooltip:C.buttonTips[id]||undefined,tabIndex:-1};}var D=A.wrap.createChild({tag:'div'},A.wrap.dom.firstChild.nextSibling,true);var ty=Roo.form.HtmlEditor.ToolbarContext.types;this.toolbars={};for(var i in ty){this.toolbars[i]=this.buildToolbar(ty[i],i);}
+this.tb=this.toolbars.BODY;this.tb.el.show();this.buildFooter();this.footer.show();this.rendered=true;A.on('editorevent',this.updateToolbar,this);},updateToolbar:function(A,B,C){if(!this.editor.activated){this.editor.onFirstFocus();return;}var D=C?false:true;var E=this.editor.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;if(!C){C=E.length?(E[0]?E[0]:E[1]):this.editor.doc.body;C=C?C:this.editor.doc.body;C=C.tagName.length?C:this.editor.doc.body;}var tn=C.tagName.toUpperCase();tn=C.tagName.toUpperCase();var F=this.tb.selectedNode
+this.tb.selectedNode=C;if((this.tb.name!=tn)||(F!=this.tb.selectedNode)){this.tb.el.hide();this.tb=typeof(ty[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=tn+':&nbsp;';if(this.tb.fields){this.tb.fields.each(function(e){e.setValue(C.getAttribute(e.name));});}var st=this.tb.fields.item(0);st.store.removeAll();var cn=C.className.split(/\s+/);var G=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){G.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){G.push([v,cn.indexOf(v)>-1?1:0]);});}
+st.store.loadData(G);st.collapse();st.setValue(cn);this.tb.selectedNode=C;Roo.menu.MenuMgr.hideAll();}if(!D){return;}var H='';this.footerEls=E.reverse();Roo.each(this.footerEls,function(a,i){if(!a){return;}
+H+=H.length?' &gt; ':'';H+='<span class="x-ed-loc-'+i+'">'+a.tagName+'</span>';});var sz=this.footDisp.up('td').getSize();this.footDisp.dom.style.width=(sz.width-10)+'px';this.footDisp.dom.style.marginLeft='5px';this.footDisp.dom.style.overflow='hidden';this.footDisp.dom.innerHTML=H;},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();if(A.menu.el){A.menu.el.destroy();}}
+A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});},buildToolbar:function(A,nm){var B=this.editor;var C=B.wrap.createChild({tag:'div'},B.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(C);tb.add(nm+":&nbsp;");if(this.styles){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val','selected'],data:[]}),name:'className',displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select Style',selectOnFocus:true,width:130,listeners:{'select':function(c,r,i){tb.selectedNode.className=r?r.get('val'):'';}}}));}for(var i in A){var D=A[i];tb.add(D.title+":&nbsp;");if(D.opts){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val'],data:D.opts}),name:i,displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:D.width?D.width:130,listeners:{'select':function(c,r,i){tb.selectedNode.setAttribute(c.name,r.get('val'));}}}));continue;tb.addField(new Roo.form.TextField({name:i,width:100,value:''}));continue;}
+tb.addField(new Roo.form.TextField({name:i,width:D.width,value:'',listeners:{'change':function(f,nv,ov){tb.selectedNode.setAttribute(f.name,nv);}}}));}
+tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();tb.name=nm;return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}});this.footer.add(B);this.footer.add({text:'&gt;',xtype:'Button',handler:function(){_t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);}});var A=Roo.get(B.el);A.addClass('x-editor-context');this.footDispWrap=A;this.footDispWrap.overflow='hidden';this.footDisp=A.createChild();this.footDispWrap.on('click',this.onContextClick,this)},onContextClick:function(ev,A){ev.preventDefault();var cn=A.className;Roo.log(cn);if(!cn.match(/x-ed-loc-/)){return;}var n=cn.split('-').pop();var B=this.footerEls;var C=B[n];var D=this.editor.createRange();D.selectNodeContents(C);var E=this.editor.getSelection();E.removeAllRanges();E.addRange(D);this.updateToolbar(null,null,C);}});
+//Roo/form/BasicForm.js
+Roo.form.BasicForm=function(el,A){this.allItems=[];this.childForms=[];Roo.apply(this,A);this.items=new Roo.util.MixedCollection(false,function(o){return o.id||(o.id=Roo.id());});this.addEvents({beforeaction:true,actionfailed:true,actioncomplete:true});if(el){this.initEl(el);}
+Roo.form.BasicForm.superclass.constructor.call(this);};Roo.extend(Roo.form.BasicForm,Roo.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,childForms:false,allItems:false,waitMsgTarget:false,initEl:function(el){this.el=Roo.get(el);this.id=this.el.id||Roo.id();this.el.on('submit',this.onSubmit,this);this.el.addClass('x-form');},onSubmit:function(e){e.stopEvent();},isValid:function(){var A=true;this.items.each(function(f){if(!f.validate()){A=false;}});return A;},isDirty:function(){var A=false;this.items.each(function(f){if(f.isDirty()){A=true;return false;}});return A;},doAction:function(A,B){if(typeof A=='string'){A=new Roo.form.Action.ACTION_TYPES[A](this,B);}if(this.fireEvent('beforeaction',this,A)!==false){this.beforeAction(A);A.run.defer(100,A);}return this;},submit:function(A){this.doAction('submit',A);return this;},load:function(A){this.doAction('load',A);return this;},updateRecord:function(A){A.beginEdit();var fs=A.fields;fs.each(function(f){var B=this.findField(f.name);if(B){A.set(f.name,B.getValue());}},this);A.endEdit();return this;},loadRecord:function(A){this.setValues(A.data);return this;},beforeAction:function(A){var o=A.options;if(this.waitMsgTarget===true){this.el.mask(o.waitMsg||"Sending",'x-mask-loading');}else if(this.waitMsgTarget){this.waitMsgTarget=Roo.get(this.waitMsgTarget);this.waitMsgTarget.mask(o.waitMsg||"Sending",'x-mask-loading');}else {Roo.MessageBox.wait(o.waitMsg||"Sending",o.waitTitle||this.waitTitle||'Please Wait...');}},afterAction:function(A,B){this.activeAction=null;var o=A.options;if(this.waitMsgTarget===true){this.el.unmask();}else if(this.waitMsgTarget){this.waitMsgTarget.unmask();}else {Roo.MessageBox.updateProgress(1);Roo.MessageBox.hide();}if(B){if(o.reset){this.reset();}
+Roo.callback(o.success,o.scope,[this,A]);this.fireEvent('actioncomplete',this,A);}else {Roo.callback(o.failure,o.scope,[this,A]);if(!this.hasListener('actionfailed')){Roo.MessageBox.alert("Error",(typeof(A.result)!='undefined'&&typeof(A.result.errorMsg)!='undefined')?A.result.errorMsg:"Saving Failed, please check your entries");}
+this.fireEvent('actionfailed',this,A);}},findField:function(id){var A=this.items.get(id);if(!A){this.items.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){A=f;return false;}});}return A||null;},addForm:function(A){if(this.childForms.indexOf(A)>-1){return;}
+this.childForms.push(A);var n='';Roo.each(A.allItems,function(fe){n=typeof(fe.getName)=='undefined'?fe.name:fe.getName();if(this.findField(n)){return;}var B=new Roo.form.Hidden({name:n});B.render(this.el);this.add(B);},this);},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else {var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}
+Roo.each(this.childForms||[],function(f){f.markInvalid(A);});return this;},setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else {var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={};sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else {C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();}}}}
+Roo.each(this.childForms||[],function(f){f.setValues(A);});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}var B={};this.items.each(function(f){if(!f.getName()){return;}var v=f.getValue();if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){B[f.name]=f.getRawValue();}
+B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();});return this;},reset:function(){this.items.each(function(f){f.reset();});Roo.each(this.childForms||[],function(f){f.reset();});return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this;},remove:function(A){this.items.remove(A);return this;},render:function(){this.items.each(function(f){if(f.isFormField&&!f.rendered&&document.getElementById(f.id)){f.applyTo(f.id);}});return this;},applyToFields:function(o){this.items.each(function(f){Roo.apply(f,o);});return this;},applyIfToFields:function(o){this.items.each(function(f){Roo.applyIf(f,o);});return this;}});Roo.BasicForm=Roo.form.BasicForm;
+//Roo/form/Form.js
+Roo.form.Form=function(A){var B=[];if(A.items){B=A.items;delete A.items;}
+Roo.form.Form.superclass.constructor.call(this,null,A);this.url=this.url||this.action;if(!this.root){this.root=new Roo.form.Layout(Roo.applyIf({id:Roo.id()},A));}
+this.active=this.root;this.buttons=[];this.allItems=[];this.addEvents({clientvalidation:true,rendered:true});if(this.progressUrl){this.addxtype({xns:Roo.form,xtype:'Hidden',name:'UPLOAD_IDENTIFIER'});}
+Roo.each(B,this.addxtype,this);};Roo.extend(Roo.form.Form,Roo.form.BasicForm,{buttonAlign:'center',minButtonWidth:75,labelAlign:'left',monitorValid:false,monitorPoll:200,progressUrl:false,column:function(c){var A=new Roo.form.Column(c);this.start(A);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return A;},fieldset:function(c){var fs=new Roo.form.FieldSet(c);this.start(fs);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return fs;},container:function(c){var l=new Roo.form.Layout(c);this.start(l);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return l;},start:function(c){Roo.applyIf(c,{'labelAlign':this.active.labelAlign,'labelWidth':this.active.labelWidth,'itemCls':this.active.itemCls});this.active.stack.push(c);c.ownerCt=this.active;this.active=c;return this;},end:function(){if(this.active==this.root){return this;}
+this.active=this.active.ownerCt;return this;},add:function(){this.active.stack.push.apply(this.active.stack,arguments);this.allItems.push.apply(this.allItems,arguments);var r=[];for(var i=0,a=arguments,A=a.length;i<A;i++){if(a[i].isFormField){r.push(a[i]);}}if(r.length>0){Roo.form.Form.superclass.add.apply(this,r);}return this;},findbyId:function(id){var A=false;if(!id){return A;}
+Roo.each(this.allItems,function(f){if(f.id==id||f.name==id){A=f;return false;}});return A;},render:function(ct){ct=Roo.get(ct);var o=this.autoCreate||{tag:'form',method:this.method||'POST',id:this.id||Roo.id()};this.initEl(ct.createChild(o));this.root.render(this.el);this.items.each(function(f){f.render('x-form-el-'+f.id);});if(this.buttons.length>0){var tb=this.el.createChild({cls:'x-form-btns-ct',cn:{cls:"x-form-btns x-form-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,A=this.buttons.length;i<A;i++){var b=this.buttons[i];var td=document.createElement('td');td.className='x-form-btn-td';b.render(tr.appendChild(td));}}if(this.monitorValid){this.startMonitoring();}
+this.fireEvent('rendered',this);return this;},addButton:function(A,B,C){var bc={handler:B,scope:C,minWidth:this.minButtonWidth,hideParent:true};if(typeof A=="string"){bc.text=A;}else {Roo.apply(bc,A);}var D=new Roo.Button(null,bc);this.buttons.push(D);return D;},addxtype:function(){var ar=Array.prototype.slice.call(arguments,0);var A=false;for(var i=0;i<ar.length;i++){if(!ar[i]){continue;}if(Roo.form[ar[i].xtype]){ar[i].form=this;var fe=Roo.factory(ar[i],Roo.form);if(!A){A=fe;}
+fe.form=this;if(fe.store){fe.store.form=this;}if(fe.isLayout){this.start(fe);this.allItems.push(fe);if(fe.items&&fe.addxtype){fe.addxtype.apply(fe,fe.items);delete fe.items;}
+this.end();continue;}
+this.add(fe);}if(ar[i].xtype=='Button'){this.addButton(ar[i]);this.allItems.push(fe);continue;}if(ar[i].xtype=='end'){alert('end is not supported on xtype any more, use items');}}return A;},startMonitoring:function(){if(!this.bound){this.bound=true;Roo.TaskMgr.start({run:this.bindHandler,interval:this.monitorPoll||200,scope:this});}},stopMonitoring:function(){this.bound=false;},bindHandler:function(){if(!this.bound){return false;}var A=true;this.items.each(function(f){if(!f.isValid(true)){A=false;return false;}});for(var i=0,B=this.buttons.length;i<B;i++){var C=this.buttons[i];if(C.formBind===true&&C.disabled===A){C.setDisabled(!A);}}
+this.fireEvent('clientvalidation',this,A);}});Roo.Form=Roo.form.Form;
+//Roo/form/Action.js
+Roo.form.Action=function(A,B){this.form=A;this.options=B||{};};Roo.form.Action.CLIENT_INVALID='client';Roo.form.Action.SERVER_INVALID='server';Roo.form.Action.CONNECT_FAILURE='connect';Roo.form.Action.LOAD_FAILURE='load';Roo.form.Action.prototype={type:'default',failureType:undefined,response:undefined,result:undefined,run:function(A){},success:function(A){},handleResponse:function(A){},failure:function(A){this.response=A;this.failureType=Roo.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);},processResponse:function(A){this.response=A;if(!A.responseText){return true;}
+this.result=this.handleResponse(A);return this.result;},getUrl:function(A){var B=this.options.url||this.form.url||this.form.el.dom.action;if(A){var p=this.getParams();if(p){B+=(B.indexOf('?')!=-1?'&':'?')+p;}}return B;},getMethod:function(){return (this.options.method||this.form.method||this.form.el.dom.method||'POST').toUpperCase();},getParams:function(){var bp=this.form.baseParams;var p=this.options.params;if(p){if(typeof p=="object"){p=Roo.urlEncode(Roo.applyIf(p,bp));}else if(typeof p=='string'&&bp){p+='&'+Roo.urlEncode(bp);}}else if(bp){p=Roo.urlEncode(bp);}return p;},createCallback:function(){return {success:this.success,failure:this.failure,scope:this,timeout:(this.form.timeout*1000),upload:this.form.fileUpload?this.success:undefined};}};Roo.form.Action.Submit=function(A,B){Roo.form.Action.Submit.superclass.constructor.call(this,A,B);};Roo.extend(Roo.form.Action.Submit,Roo.form.Action,{type:'submit',haveProgress:false,uploadComplete:false,uploadProgress:function(){if(!this.form.progressUrl){return;}if(!this.haveProgress){Roo.MessageBox.progress("Uploading","Uploading");}if(this.uploadComplete){Roo.MessageBox.hide();return;}
+this.haveProgress=true;var A=this.form.findField('UPLOAD_IDENTIFIER').getValue();var c=new Roo.data.Connection();c.request({url:this.form.progressUrl,params:{id:A},method:'GET',success:function(B){var C=false;var D;try{C=Roo.decode(B.responseText)}catch(e){Roo.log("Invalid data from server..");Roo.log(edata);return;}if(!C||!C.success){Roo.log(C);return;}var E=C.data;if(this.uploadComplete){Roo.MessageBox.hide();return;}if(E){Roo.MessageBox.updateProgress(E.bytes_uploaded/E.bytes_total,Math.floor((E.bytes_total-E.bytes_uploaded)/1000)+'k remaining');}
+this.uploadProgress.defer(2000,this);},failure:function(B){Roo.log('progress url failed ');Roo.log(B);},scope:this});},run:function(){this.form.getValues();var o=this.options;var A=this.getMethod();var B=A=='POST';if(o.clientValidation===false||this.form.isValid()){if(this.form.progressUrl){this.form.findField('UPLOAD_IDENTIFIER').setValue((new Date()*1)+''+Math.random());}Roo.Ajax.request(Roo.apply(this.createCallback(),{form:this.form.el.dom,url:this.getUrl(!B),method:A,params:B?this.getParams():null,isUpload:this.form.fileUpload}));this.uploadProgress();}else if(o.clientValidation!==false){this.failureType=Roo.form.Action.CLIENT_INVALID;this.form.afterAction(this,false);}},success:function(A){this.uploadComplete=true;if(this.haveProgress){Roo.MessageBox.hide();}var B=this.processResponse(A);if(B===true||B.success){this.form.afterAction(this,true);return;}if(B.errors){this.form.markInvalid(B.errors);this.failureType=Roo.form.Action.SERVER_INVALID;}
+this.form.afterAction(this,false);},failure:function(A){this.uploadComplete=true;if(this.haveProgress){Roo.MessageBox.hide();}
+this.response=A;this.failureType=Roo.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);},handleResponse:function(A){if(this.form.errorReader){var rs=this.form.errorReader.read(A);var B=[];if(rs.records){for(var i=0,C=rs.records.length;i<C;i++){var r=rs.records[i];B[i]=r.data;}}if(B.length<1){B=null;}return {success:rs.success,errors:B};}var D=false;try{D=Roo.decode(A.responseText);}catch(e){ret={success:false,errorMsg:"Failed to read server message: "+(response?response.responseText:' - no message'),errors:[]};}return D;}});Roo.form.Action.Load=function(A,B){Roo.form.Action.Load.superclass.constructor.call(this,A,B);this.reader=this.form.reader;};Roo.extend(Roo.form.Action.Load,Roo.form.Action,{type:'load',run:function(){Roo.Ajax.request(Roo.apply(this.createCallback(),{method:this.getMethod(),url:this.getUrl(false),params:this.getParams()}));},success:function(A){var B=this.processResponse(A);if(B===true||!B.success||!B.data){this.failureType=Roo.form.Action.LOAD_FAILURE;this.form.afterAction(this,false);return;}
+this.form.clearInvalid();this.form.setValues(B.data);this.form.afterAction(this,true);},handleResponse:function(A){if(this.form.reader){var rs=this.form.reader.read(A);var B=rs.records&&rs.records[0]?rs.records[0].data:null;return {success:rs.success,data:B};}return Roo.decode(A.responseText);}});Roo.form.Action.ACTION_TYPES={'load':Roo.form.Action.Load,'submit':Roo.form.Action.Submit};
+//Roo/form/Layout.js
+Roo.form.Layout=function(A){var B=[];if(A.items){B=A.items;delete A.items;}
+Roo.form.Layout.superclass.constructor.call(this,A);this.stack=[];Roo.each(B,this.addxtype,this);};Roo.extend(Roo.form.Layout,Roo.Component,{clear:true,labelSeparator:':',hideLabels:false,defaultAutoCreate:{tag:'div',cls:'x-form-ct'},isLayout:true,onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);}else {var B=this.getAutoCreate();this.el=ct.createChild(B,A);}if(this.style){this.el.applyStyles(this.style);}if(this.labelAlign){this.el.addClass('x-form-label-'+this.labelAlign);}if(this.hideLabels){this.labelStyle="display:none";this.elementStyle="padding-left:0;";}else {if(typeof this.labelWidth=='number'){this.labelStyle="width:"+this.labelWidth+"px;";this.elementStyle="padding-left:"+((this.labelWidth+(typeof this.labelPad=='number'?this.labelPad:5))+'px')+";";}if(this.labelAlign=='top'){this.labelStyle="width:auto;";this.elementStyle="padding-left:0;";}}var C=this.stack;var D=C.length;if(D>0){if(!this.fieldTpl){var t=new Roo.Template('<div class="x-form-item {5}">','<label for="{0}" style="{2}">{1}{4}</label>','<div class="x-form-element" id="x-form-el-{0}" style="{3}">','</div>','</div><div class="x-form-clear-left"></div>');t.disableFormats=true;t.compile();Roo.form.Layout.prototype.fieldTpl=t;}for(var i=0;i<D;i++){if(C[i].isFormField){this.renderField(C[i]);}else {this.renderComponent(C[i]);}}}if(this.clear){this.el.createChild({cls:'x-form-clear'});}},renderField:function(f){f.fieldEl=Roo.get(this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||'',this.elementStyle||'',typeof f.labelSeparator=='undefined'?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||''],true).getPrevSibling());},renderComponent:function(c){c.render(c.isLayout?this.el:this.el.createChild());},addxtype:function(o){o.form=this.form;var fe=Roo.factory(o,Roo.form);this.form.allItems.push(fe);this.stack.push(fe);if(fe.isFormField){this.form.items.add(fe);}return fe;}});Roo.form.Column=function(A){Roo.form.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Column,Roo.form.Layout,{defaultAutoCreate:{tag:'div',cls:'x-form-ct x-form-column'},onRender:function(ct,A){Roo.form.Column.superclass.onRender.call(this,ct,A);if(this.width){this.el.setWidth(this.width);}}});Roo.form.Row=function(A){Roo.form.Row.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Row,Roo.form.Layout,{defaultAutoCreate:{tag:'div',cls:'x-form-ct x-form-row'},padWidth:20,onRender:function(ct,A){if(!this.rowTpl){var t=new Roo.Template('<div class="x-form-item {5}" style="float:left;width:{6}px">','<label for="{0}" style="{2}">{1}{4}</label>','<div class="x-form-element" id="x-form-el-{0}" style="{3}">','</div>','</div>');t.disableFormats=true;t.compile();Roo.form.Layout.prototype.rowTpl=t;}
+this.fieldTpl=this.rowTpl;var B=100;if((this.labelAlign!='top')){if(typeof this.labelWidth=='number'){B=this.labelWidth}
+this.padWidth=20+B;}
+Roo.form.Column.superclass.onRender.call(this,ct,A);if(this.width){this.el.setWidth(this.width);}if(this.height){this.el.setHeight(this.height);}},renderField:function(f){f.fieldEl=this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||'',this.elementStyle||'',typeof f.labelSeparator=='undefined'?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||'',f.width?f.width+this.padWidth:160+this.padWidth],true);}});Roo.form.FieldSet=function(A){Roo.form.FieldSet.superclass.constructor.call(this,A);};Roo.extend(Roo.form.FieldSet,Roo.form.Layout,{defaultAutoCreate:{tag:'fieldset',cn:{tag:'legend'}},onRender:function(ct,A){Roo.form.FieldSet.superclass.onRender.call(this,ct,A);if(this.legend){this.setLegend(this.legend);}},setLegend:function(A){if(this.rendered){this.el.child('legend').update(A);}}});
+//Roo/form/VTypes.js
+Roo.form.VTypes=function(){var A=/^[a-zA-Z_]+$/;var B=/^[a-zA-Z0-9_]+$/;var C=/^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;var D=/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;return {'email':function(v){return C.test(v);},'emailText':'This field should be an e-mail address in the format "user@domain.com"','emailMask':/[a-z0-9_\.\-@]/i,'url':function(v){return D.test(v);},'urlText':'This field should be a URL in the format "http:/'+'/www.domain.com"','alpha':function(v){return A.test(v);},'alphaText':'This field should only contain letters and _','alphaMask':/[a-z_]/i,'alphanum':function(v){return B.test(v);},'alphanumText':'This field should only contain letters, numbers and _','alphanumMask':/[a-z0-9_]/i};}();
+//Roo/form/FCKeditor.js
+Roo.form.FCKeditor=function(A){Roo.form.FCKeditor.superclass.constructor.call(this,A);this.addEvents({editorinit:true});};Roo.form.FCKeditor.editors={};Roo.extend(Roo.form.FCKeditor,Roo.form.TextArea,{fckconfig:false,toolbarSet:'Basic',basePath:'/fckeditor/',frame:false,value:'',onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"off"};}
+Roo.form.FCKeditor.superclass.onRender.call(this,ct,A);Roo.form.FCKeditor.editors[this.getId()]=this;this.replaceTextarea();},getEditor:function(){return this.fckEditor;},setValue:function(A){if(typeof(A)=='undefined'){return;}
+Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);if(!this.getEditor()){return;}
+this.getEditor().SetData(A);},getValue:function(){if(this.frame&&this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.getValue.call(this);}if(!this.el||!this.getEditor()){return this.value;}var A=this.getEditor().GetData();Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getValue.call(this);},getRawValue:function(){if(this.frame&&this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.getRawValue.call(this);}if(!this.el||!this.getEditor()){return this.value;return;}var A=this.getEditor().GetData();Roo.form.FCKeditor.superclass.setRawValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getRawValue.call(this);},setSize:function(w,h){Roo.form.FCKeditor.superclass.setSize.apply(this,[w,h]);this.frame.dom.setAttribute('width',w);this.frame.dom.setAttribute('height',h);this.frame.setSize(w,h);},toggleSourceEdit:function(A){this.el.dom.style.display=A?'':'none';this.frame.dom.style.display=A?'none':'';},focus:function(A){if(this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.focus.call(this);}if(!this.el||!this.getEditor()){this.focus.defer(100,this,[A]);return;}var B=this.getEditor().EditorDocument.getElementsByTagName(A);this.getEditor().Focus();if(B.length){if(!this.getEditor().Selection.GetSelection()){this.focus.defer(100,this,[A]);return;}var r=this.getEditor().EditorDocument.createRange();r.setStart(B[0],0);r.setEnd(B[0],0);this.getEditor().Selection.GetSelection().removeAllRanges();this.getEditor().Selection.GetSelection().addRange(r);this.getEditor().Focus();}},replaceTextarea:function(){if(document.getElementById(this.getId()+'___Frame'))return;var A=document.getElementById(this.getId());var B=document.getElementsByName(this.getId());A.style.display='none';if(A.tabIndex){this.TabIndex=A.tabIndex;}
+this._insertHtmlBefore(this._getConfigHtml(),A);this._insertHtmlBefore(this._getIFrameHtml(),A);this.frame=Roo.get(this.getId()+'___Frame')},_getConfigHtml:function(){var A='';for(var o in this.fckconfig){A+=A.length>0?'&amp;':'';A+=encodeURIComponent(o)+'='+encodeURIComponent(this.fckconfig[o]);}return '<input type="hidden" id="'+this.getId()+'___Config" value="'+A+'" style="display:none" />';},_getIFrameHtml:function(){var A='fckeditor.html';var B=this.basePath+'editor/'+A+'?InstanceName='+encodeURIComponent(this.getId());B+=this.toolbarSet?('&amp;Toolbar='+this.toolbarSet):'';var C='<iframe id="'+this.getId()+'___Frame" src="'+B+'" width="'+this.width+'" height="'+this.height+'"'+(this.tabIndex?' tabindex="'+this.tabIndex+'"':'')+' frameborder="0" scrolling="no"></iframe>';return C;},_insertHtmlBefore:function(A,B){if(B.insertAdjacentHTML){B.insertAdjacentHTML('beforeBegin',A);}else {var C=document.createRange();C.setStartBefore(B);var D=C.createContextualFragment(A);B.parentNode.insertBefore(D,B);}}});function FCKeditor_OnComplete(A){var f=Roo.form.FCKeditor.editors[A.Name];f.fckEditor=A;f.fireEvent('editorinit',f,A);}
+//Roo/form/GridField.js
+Roo.form.GridField=function(A){Roo.form.GridField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.GridField,Roo.form.Field,{width:100,height:50,xgrid:false,defaultAutoCreate:{tag:'input',type:'hidden',autocomplete:'off'},addTitle:false,onResize:function(){Roo.form.Field.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){this.style=this.style||'overflow: hidden; border:1px solid #c3daf9;';var B=this.style;delete this.style;Roo.form.GridField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:''});this.viewEl=this.wrap.createChild({tag:'div'});if(B){this.viewEl.applyStyles(B);}if(this.width){this.viewEl.setWidth(this.width);}if(this.height){this.viewEl.setHeight(this.height);}
+this.grid=new Roo.grid[this.xgrid.xtype](this.viewEl,this.xgrid);this.grid.render();this.grid.getDataSource().on('remove',this.refreshValue,this);this.grid.getDataSource().on('update',this.refreshValue,this);this.grid.on('afteredit',this.refreshValue,this);},setValue:function(v){v=v||[];if(this.grid&&this.grid.getDataSource()&&typeof(v)!='undefined'){var ds=this.grid.getDataSource();var A={}
+A[ds.reader.meta.root]=typeof(v)=='string'?Roo.decode(v):v;ds.loadData(A);}if(this.grid.sm){this.grid.sm.clearSelections();}
+Roo.form.GridField.superclass.setValue.call(this,v);this.refreshValue();},refreshValue:function(){var A=[];this.grid.getDataSource().each(function(r){A.push(r.data);});this.el.dom.value=Roo.encode(A);}});
+//Roo/form/DisplayField.js
+Roo.form.DisplayField=function(A){Roo.form.DisplayField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DisplayField,Roo.form.TextField,{inputType:'hidden',allowBlank:true,readOnly:true,focusClass:undefined,fieldClass:'x-form-field',valueRenderer:undefined,width:100,onResize:function(){Roo.form.DisplayField.superclass.onResize.apply(this,arguments);},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.DisplayField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap();this.viewEl=this.wrap.createChild({tag:'div',cls:'x-form-displayfield'});if(this.bodyStyle){this.viewEl.applyStyles(this.bodyStyle);}
+this.setValue(this.value);},onClick:function(){},setValue:function(v){this.value=v;var A=this.valueRenderer?this.valueRenderer(v):String.format('{0}',v);if(!this.viewEl){return;}
+this.viewEl.dom.innerHTML=A;Roo.form.DisplayField.superclass.setValue.call(this,v);}});
+//Roo/form/DayPicker.js
+Roo.form.DayPicker=function(A){Roo.form.DayPicker.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DayPicker,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"},actionMode:'viewEl',inputType:'hidden',inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-form-daypick-item '});var r1='<table><tr>';var r2='<tr class="x-form-daypick-icons">';for(var i=0;i<7;i++){r1+='<td><div>'+Date.dayNames[i].substring(0,3)+'</div></td>';r2+='<td><img class="x-menu-item-icon" src="'+Roo.BLANK_IMAGE_URL+'"></td>';}var B=this.wrap.createChild(r1+'</tr>'+r2+'</tr></table>');B.select('img').on('click',this.onClick,this);this.viewEl=B;this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);},initValue:Roo.emptyFn,getValue:function(){return this.el.dom.value;},onClick:function(e){Roo.get(e.target).toggleClass('x-menu-item-checked');this.refreshValue();},refreshValue:function(){var A='';this.viewEl.select('img',true).each(function(e,i,n){A+=e.is(".x-menu-item-checked")?String(n):'';});this.setValue(A,true);},setValue:function(v,A){if(!this.el.dom){return;}var B=this.el.dom.value;this.el.dom.value=v;if(A){return;}
+this.viewEl.select('img',true).each(function(e,i,n){var on=e.is(".x-menu-item-checked");var C=v.indexOf(String(n))>-1;if(on!=C){e.toggleClass('x-menu-item-checked');}});this.fireEvent('change',this,v,B);},setFromHidden:function(){if(!this.el){return;}
+this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}
+Roo.form.DayPicker.superclass.onDestroy.call(this);}});
+//Roo/form/ComboCheck.js
+Roo.form.ComboCheck=function(A){Roo.form.ComboCheck.superclass.constructor.call(this,A);var B=['hiddenName','displayField','valueField'];var _t=this;Roo.each(B,function(e){if((typeof(_t[e])=='undefined')||!_t[e].length){throw "Roo.form.ComboCheck : missing value for: "+e;}});};Roo.extend(Roo.form.ComboCheck,Roo.form.ComboBox,{editable:false,selectedClass:'x-menu-item-checked',onRender:function(ct,A){var _t=this;if(!this.tpl){var B='x-combo-list';this.tpl=new Roo.Template({html:'<div class="'+B+'-item x-menu-check-item">'+'<img class="x-menu-item-icon" style="margin: 0px;" src="'+Roo.BLANK_IMAGE_URL+'">'+'<span>{'+this.displayField+'}</span>'+'</div>'});}
+Roo.form.ComboCheck.superclass.onRender.call(this,ct,A);this.view.singleSelect=false;this.view.multiSelect=true;this.view.toggleSelect=true;this.pageTb.add(new Roo.Toolbar.Fill(),{text:'Done',handler:function(){_t.collapse();}});},onViewOver:function(e,t){return;},onViewClick:function(A,B){return;},select:function(){},selectByValue:function(xv,A){var ar=this.getValueArray();var B=[];Roo.each(ar,function(v){if(v===undefined||v===null){return;}var r=this.findRecord(this.valueField,v);if(r){B.push(this.store.indexOf(r))}},this);this.view.select(B);return false;},onSelect:function(A,B){this.view.clearSelections();this.setValue('[]');if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);}},getValueArray:function(){var ar=[];try{if(typeof(this.value)=='undefined'){return [];}var ar=Roo.decode(this.value);return ar instanceof Array?ar:[];}catch(e){Roo.log(e+"\nRoo.form.ComboCheck:getValueArray  invalid data:"+this.getValue());return [];}},expand:function(){Roo.form.ComboCheck.superclass.expand.call(this);this.valueBefore=this.value;},collapse:function(){Roo.form.ComboCheck.superclass.collapse.call(this);var sl=this.view.getSelectedIndexes();var st=this.store;var nv=[];var tv=[];var r;Roo.each(sl,function(i){r=st.getAt(i);nv.push(r.get(this.valueField));},this);this.setValue(Roo.encode(nv));if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);}},setValue:function(v){this.value=v;var A=this.getValueArray();var tv=[];Roo.each(A,function(k){var r=this.findRecord(this.valueField,k);if(r){tv.push(r.data[this.displayField]);}else if(this.valueNotFoundText!==undefined){tv.push(this.valueNotFoundText);}},this);Roo.form.ComboBox.superclass.setValue.call(this,tv.join(', '));this.hiddenField.value=v;this.value=v;}});
+//Roo/DDView.js
+Roo.DDView=function(A,B,C){Roo.DDView.superclass.constructor.apply(this,arguments);this.getEl().setStyle("outline","0px none");this.getEl().unselectable();if(this.dragGroup){this.setDraggable(this.dragGroup.split(","));}if(this.dropGroup){this.setDroppable(this.dropGroup.split(","));}if(this.deletable){this.setDeletable();}
+this.isDirtyFlag=false;this.addEvents({"drop":true});};Roo.extend(Roo.DDView,Roo.View,{isFormField:true,reset:Roo.emptyFn,clearInvalid:Roo.form.Field.prototype.clearInvalid,validate:function(){return true;},destroy:function(){this.purgeListeners();this.getEl.removeAllListeners();this.getEl().remove();if(this.dragZone){if(this.dragZone.destroy){this.dragZone.destroy();}}if(this.dropZone){if(this.dropZone.destroy){this.dropZone.destroy();}}},getName:function(){return this.name;},setValue:function(v){if(!this.store){throw "DDView.setValue(). DDView must be constructed with a valid Store";}var A={};A[this.store.reader.meta.root]=v?[].concat(v):[];this.store.proxy=new Roo.data.MemoryProxy(A);this.store.load();},getValue:function(){var A='(';this.store.each(function(B){A+=B.id+',';});return A.substr(0,A.length-1)+')';},getIds:function(){var i=0,A=new Array(this.store.getCount());this.store.each(function(B){A[i++]=B.id;});return A;},isDirty:function(){return this.isDirtyFlag;},getTargetFromEvent:function(e){var A=e.getTarget();while((A!==null)&&(A.parentNode!=this.el.dom)){A=A.parentNode;}if(!A){A=this.el.dom.lastChild||this.el.dom;}return A;},getDragData:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.handleSelection(e);var B=this.getSelectedNodes();var C={source:this,copy:this.copy||(this.allowCopy&&e.ctrlKey),nodes:B,records:[]};var D=this.getSelectedIndexes();for(var i=0;i<D.length;i++){C.records.push(this.store.getAt(D[i]));}if(B.length==1){C.ddel=A.cloneNode(true);}else {var E=document.createElement('div');E.className='multi-proxy';for(var i=0,F=B.length;i<F;i++){E.appendChild(B[i].cloneNode(true));}
+C.ddel=E;}return C;}return false;},setDraggable:function(A){if(A instanceof Array){Roo.each(A,this.setDraggable,this);return;}if(this.dragZone){this.dragZone.addToGroup(A);}else {this.dragZone=new Roo.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:A});if(!this.multiSelect){this.singleSelect=true;}
+this.dragZone.getDragData=this.getDragData.createDelegate(this);}},setDroppable:function(A){if(A instanceof Array){Roo.each(A,this.setDroppable,this);return;}if(this.dropZone){this.dropZone.addToGroup(A);}else {this.dropZone=new Roo.dd.DropZone(this.getEl(),{containerScroll:true,ddGroup:A});this.dropZone.getTargetFromEvent=this.getTargetFromEvent.createDelegate(this);this.dropZone.onNodeEnter=this.onNodeEnter.createDelegate(this);this.dropZone.onNodeOver=this.onNodeOver.createDelegate(this);this.dropZone.onNodeOut=this.onNodeOut.createDelegate(this);this.dropZone.onNodeDrop=this.onNodeDrop.createDelegate(this);}},getDropPoint:function(e,n,dd){if(n==this.el.dom){return "above";}var t=Roo.lib.Dom.getY(n),b=t+n.offsetHeight;var c=t+(b-t)/2;var y=Roo.lib.Event.getPageY(e);if(y<=c){return "above";}else {return "below";}},onNodeEnter:function(n,dd,e,A){return false;},onNodeOver:function(n,dd,e,A){var pt=this.getDropPoint(e,n,dd);var B=this.dropNotAllowed;if(pt){var C;if(pt=="above"){B=n.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";C="x-view-drag-insert-above";}else {B=n.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";C="x-view-drag-insert-below";}if(this.lastInsertClass!=C){Roo.fly(n).replaceClass(this.lastInsertClass,C);this.lastInsertClass=C;}}return B;},onNodeOut:function(n,dd,e,A){this.removeDropIndicators(n);},onNodeDrop:function(n,dd,e,A){if(this.fireEvent("drop",this,n,dd,e,A)===false){return false;}var pt=this.getDropPoint(e,n,dd);var B=(n==this.el.dom)?this.nodes.length:n.nodeIndex;if(pt=="below"){B++;}for(var i=0;i<A.records.length;i++){var r=A.records[i];var C=this.store.getById(r.id);if(C&&(dd!=this.dragZone)){Roo.fly(this.getNode(this.store.indexOf(C))).frame("red",1);}else {if(A.copy){this.store.insert(B++,r.copy());}else {A.source.isDirtyFlag=true;r.store.remove(r);this.store.insert(B++,r);}
+this.isDirtyFlag=true;}}
+this.dragZone.cachedTarget=null;return true;},removeDropIndicators:function(n){if(n){Roo.fly(n).removeClass(["x-view-drag-insert-above","x-view-drag-insert-below"]);this.lastInsertClass="_noclass";}},setDeletable:function(A){if(!this.singleSelect&&!this.multiSelect){this.singleSelect=true;}var c=this.getContextMenu();this.contextMenu.on("itemclick",function(B){switch(B.id){case "delete":this.remove(this.getSelectedIndexes());break;}},this);this.contextMenu.add({icon:A,id:"delete",text:'Delete'});},getContextMenu:function(){if(!this.contextMenu){this.contextMenu=new Roo.menu.Menu({id:this.id+"-contextmenu"});this.el.on("contextmenu",this.showContextMenu,this);}return this.contextMenu;},disableContextMenu:function(){if(this.contextMenu){this.el.un("contextmenu",this.showContextMenu,this);}},showContextMenu:function(e,A){A=this.findItemFromChild(e.getTarget());if(A){e.stopEvent();this.select(this.getNode(A),this.multiSelect&&e.ctrlKey,true);this.contextMenu.showAt(e.getXY());}},remove:function(A){A=[].concat(A);for(var i=0;i<A.length;i++){var B=this.store.getAt(A[i]);this.store.remove(B);}},onDblClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){if(this.fireEvent("dblclick",this,this.indexOf(A),A,e)===false){return false;}if(this.dragGroup){var B=Roo.dd.DragDropMgr.getRelated(this.dragZone,true);while(B.indexOf(this.dropZone)>-1){B.remove(this.dropZone);}if(B.length==1){this.dragZone.cachedTarget=null;var el=Roo.get(B[0].getEl());var C=el.getBox(true);B[0].onNodeDrop(el.dom,{target:el.dom,xy:[C.x,C.y+C.height-1]},null,this.getDragData(e));}}}},handleSelection:function(e){this.dragZone.cachedTarget=null;var A=this.findItemFromChild(e.getTarget());if(!A){this.clearSelections(true);return;}if(A&&(this.multiSelect||this.singleSelect)){if(this.multiSelect&&e.shiftKey&&(!e.ctrlKey)&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),A.nodeIndex),false);}else if(this.isSelected(this.getNode(A))&&e.ctrlKey){this.unselect(A);}else {this.select(A,this.multiSelect&&e.ctrlKey);this.lastSelection=A;}}},onItemClick:function(A,B,e){if(this.fireEvent("beforeclick",this,B,A,e)===false){return false;}return true;},unselect:function(A,B){var C=this.getNode(A);if(C&&this.isSelected(C)){if(this.fireEvent("beforeselect",this,C,this.selections)!==false){Roo.fly(C).removeClass(this.selectedClass);this.selections.remove(C);if(!B){this.fireEvent("selectionchange",this,this.selections);}}}}});
+//Roo/LayoutManager.js
+Roo.LayoutManager=function(A,B){Roo.LayoutManager.superclass.constructor.call(this);this.el=Roo.get(A);if(this.el.dom==document.body&&Roo.isIE&&!B.allowScroll){document.body.scroll="no";}else if(this.el.dom!=document.body&&this.el.getStyle('position')=='static'){this.el.position('relative');}
+this.id=this.el.id;this.el.addClass("x-layout-container");this.monitorWindowResize=true;this.regions={};this.addEvents({"layout":true,"regionresized":true,"regioncollapsed":true,"regionexpanded":true});this.updating=false;Roo.EventManager.onWindowResize(this.onWindowResize,this,true);};Roo.extend(Roo.LayoutManager,Roo.util.Observable,{isUpdating:function(){return this.updating;},beginUpdate:function(){this.updating=true;},endUpdate:function(A){this.updating=false;if(!A){this.layout();}},layout:function(){},onRegionResized:function(A,B){this.fireEvent("regionresized",A,B);this.layout();},onRegionCollapsed:function(A){this.fireEvent("regioncollapsed",A);},onRegionExpanded:function(A){this.fireEvent("regionexpanded",A);},getViewSize:function(){var A;if(this.el.dom!=document.body){A=this.el.getSize();}else {A={width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()};}
+A.width-=this.el.getBorderWidth("lr")-this.el.getPadding("lr");A.height-=this.el.getBorderWidth("tb")-this.el.getPadding("tb");return A;},getEl:function(){return this.el;},getRegion:function(A){return this.regions[A.toLowerCase()];},onWindowResize:function(){if(this.monitorWindowResize){this.layout();}}});
+//Roo/BorderLayout.js
+Roo.BorderLayout=function(A,B){B=B||{};Roo.BorderLayout.superclass.constructor.call(this,A,B);this.factory=B.factory||Roo.BorderLayout.RegionFactory;for(var i=0,C=this.factory.validRegions.length;i<C;i++){var D=this.factory.validRegions[i];if(B[D]){this.addRegion(D,B[D]);}}};Roo.extend(Roo.BorderLayout,Roo.LayoutManager,{addRegion:function(A,B){if(!this.regions[A]){var r=this.factory.create(A,this,B);this.bindRegion(A,r);}return this.regions[A];},bindRegion:function(A,r){this.regions[A]=r;r.on("visibilitychange",this.layout,this);r.on("paneladded",this.layout,this);r.on("panelremoved",this.layout,this);r.on("invalidated",this.layout,this);r.on("resized",this.onRegionResized,this);r.on("collapsed",this.onRegionCollapsed,this);r.on("expanded",this.onRegionExpanded,this);},layout:function(){if(this.updating)return;var A=this.getViewSize();var w=A.width;var h=A.height;var B=w;var C=h;var D=0;var E=0;var rs=this.regions;var F=rs["north"];var G=rs["south"];var H=rs["west"];var I=rs["east"];var J=rs["center"];if(F&&F.isVisible()){var b=F.getBox();var m=F.getMargins();b.width=w-(m.left+m.right);b.x=m.left;b.y=m.top;D=b.height+b.y+m.bottom;C-=D;F.updateBox(this.safeBox(b));}if(G&&G.isVisible()){var b=G.getBox();var m=G.getMargins();b.width=w-(m.left+m.right);b.x=m.left;var K=(b.height+m.top+m.bottom);b.y=h-K+m.top;C-=K;G.updateBox(this.safeBox(b));}if(H&&H.isVisible()){var b=H.getBox();var m=H.getMargins();b.height=C-(m.top+m.bottom);b.x=m.left;b.y=D+m.top;var L=(b.width+m.left+m.right);E+=L;B-=L;H.updateBox(this.safeBox(b));}if(I&&I.isVisible()){var b=I.getBox();var m=I.getMargins();b.height=C-(m.top+m.bottom);var L=(b.width+m.left+m.right);b.x=w-L+m.left;b.y=D+m.top;B-=L;I.updateBox(this.safeBox(b));}if(J){var m=J.getMargins();var M={x:E+m.left,y:D+m.top,width:B-(m.left+m.right),height:C-(m.top+m.bottom)};J.updateBox(this.safeBox(M));}
+this.el.repaint();this.fireEvent("layout",this);},safeBox:function(A){A.width=Math.max(0,A.width);A.height=Math.max(0,A.height);return A;},add:function(A,B){A=A.toLowerCase();return this.regions[A].add(B);},remove:function(A,B){A=A.toLowerCase();return this.regions[A].remove(B);},findPanel:function(A){var rs=this.regions;for(var B in rs){if(typeof rs[B]!="function"){var p=rs[B].getPanel(A);if(p){return p;}}}return null;},showPanel:function(A){var rs=this.regions;for(var B in rs){var r=rs[B];if(typeof r!="function"){if(r.hasPanel(A)){return r.showPanel(A);}}}return null;},restoreState:function(A){if(!A){A=Roo.state.Manager;}var sm=new Roo.LayoutStateManager();sm.init(this,A);},batchAdd:function(A){this.beginUpdate();for(var B in A){var lr=this.regions[B];if(lr){this.addTypedPanels(lr,A[B]);}}
+this.endUpdate();},addTypedPanels:function(lr,ps){if(typeof ps=='string'){lr.add(new Roo.ContentPanel(ps));}else if(ps instanceof Array){for(var i=0,A=ps.length;i<A;i++){this.addTypedPanels(lr,ps[i]);}}else if(!ps.events){var el=ps.el;delete ps.el;lr.add(new Roo.ContentPanel(el||Roo.id(),ps));}else {lr.add(ps);}},addxtype:function(A){if(!A.xtype.match(/Panel$/)){return false;}var B=false;if(typeof(A.region)=='undefined'){Roo.log("Failed to add Panel, region was not set");Roo.log(A);return false;}var C=A.region;delete A.region;var D=[];if(A.items){D=A.items;delete A.items;}var nb=false;switch(A.xtype){case 'ContentPanel':case 'ScrollPanel':if(A.autoCreate){B=new Roo[A.xtype](A);}else {var el=this.el.createChild();B=new Roo[A.xtype](el,A);}
+this.add(C,B);break;case 'TreePanel':A.el=this.el.createChild();B=new Roo[A.xtype](A);this.add(C,B);break;case 'NestedLayoutPanel':var el=this.el.createChild();var E=A.layout;delete A.layout;E.items=E.items||[];D=E.items;if(C=='center'&&this.active&&this.getRegion('center').panels.length<1){A.background=false;}var F=new Roo.BorderLayout(el,E);B=new Roo[A.xtype](F,A);this.add(C,B);nb={};break;case 'GridPanel':var el=this.el.createChild();var G=new Roo.grid[A.grid.xtype](el,A.grid);delete A.grid;if(C=='center'&&this.active){A.background=false;}
+B=new Roo[A.xtype](G,A);this.add(C,B);if(A.background){B.on('activate',function(gp){if(!gp.grid.rendered){gp.grid.render();}});}else {G.render();}break;default:alert("Can not add '"+A.xtype+"' to BorderLayout");return null;}
+this.beginUpdate();var C='';var H={};Roo.each(D,function(i){C=nb&&i.region?i.region:false;var I=B.addxtype(i);if(C){nb[C]=nb[C]==undefined?0:nb[C]+1;if(!i.background){H[C]=nb[C];}}});this.endUpdate();if(nb){for(var r in H){C=this.getRegion(r);if(C){C.showPanel(H[r]);}}}return B;}});Roo.BorderLayout.create=function(A,B){var C=new Roo.BorderLayout(B||document.body,A);C.beginUpdate();var D=Roo.BorderLayout.RegionFactory.validRegions;for(var j=0,E=D.length;j<E;j++){var lr=D[j];if(C.regions[lr]&&A[lr].panels){var r=C.regions[lr];var ps=A[lr].panels;C.addTypedPanels(r,ps);}}
+C.endUpdate();return C;};Roo.BorderLayout.RegionFactory={validRegions:["north","south","east","west","center"],create:function(A,B,C){A=A.toLowerCase();if(C.lightweight||C.basic){return new Roo.BasicLayoutRegion(B,C,A);}switch(A){case "north":return new Roo.NorthLayoutRegion(B,C);case "south":return new Roo.SouthLayoutRegion(B,C);case "east":return new Roo.EastLayoutRegion(B,C);case "west":return new Roo.WestLayoutRegion(B,C);case "center":return new Roo.CenterLayoutRegion(B,C);}throw 'Layout region "'+A+'" not supported.';}};
+//Roo/BasicLayoutRegion.js
+Roo.BasicLayoutRegion=function(A,B,C,D){this.mgr=A;this.position=C;this.events={"beforeremove":true,"invalidated":true,"visibilitychange":true,"paneladded":true,"panelremoved":true,"collapsed":true,"expanded":true,"slideshow":true,"slidehide":true,"panelactivated":true,"resized":true};this.panels=new Roo.util.MixedCollection();this.panels.getKey=this.getPanelId.createDelegate(this);this.box=null;this.activePanel=null;if(B.listeners||B.events){Roo.BasicLayoutRegion.superclass.constructor.call(this,{listeners:B.listeners||{},events:B.events||{}});}if(D!==true){this.applyConfig(B);}};Roo.extend(Roo.BasicLayoutRegion,Roo.util.Observable,{getPanelId:function(p){return p.getId();},applyConfig:function(A){this.margins=A.margins||this.margins||{top:0,left:0,right:0,bottom:0};this.config=A;},resizeTo:function(A){var el=this.el?this.el:(this.activePanel?this.activePanel.getEl():null);if(el){switch(this.position){case "east":case "west":el.setWidth(A);this.fireEvent("resized",this,A);break;case "north":case "south":el.setHeight(A);this.fireEvent("resized",this,A);break;}}},getBox:function(){return this.activePanel?this.activePanel.getEl().getBox(false,true):null;},getMargins:function(){return this.margins;},updateBox:function(A){this.box=A;var el=this.activePanel.getEl();el.dom.style.left=A.x+"px";el.dom.style.top=A.y+"px";this.activePanel.setSize(A.width,A.height);},getEl:function(){return this.activePanel;},isVisible:function(){return this.activePanel?true:false;},setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);this.activePanel.getEl().setLeftTop(-10000,-10000);}
+this.activePanel=A;A.setActiveState(true);if(this.box){A.setSize(this.box.width,this.box.height);}
+this.fireEvent("panelactivated",this,A);this.fireEvent("invalidated");},showPanel:function(A){if(A=this.getPanel(A)){this.setActivePanel(A);}return A;},getActivePanel:function(){return this.activePanel;},add:function(A){if(arguments.length>1){for(var i=0,B=arguments.length;i<B;i++){this.add(arguments[i]);}return null;}if(this.hasPanel(A)){this.showPanel(A);return A;}var el=A.getEl();if(el.dom.parentNode!=this.mgr.el.dom){this.mgr.el.dom.appendChild(el.dom);}if(A.setRegion){A.setRegion(this);}
+this.panels.add(A);el.setStyle("position","absolute");if(!A.background){this.setActivePanel(A);if(this.config.initialSize&&this.panels.getCount()==1){this.resizeTo(this.config.initialSize);}}
+this.fireEvent("paneladded",this,A);return A;},hasPanel:function(A){if(typeof A=="object"){A=A.getId();}return this.getPanel(A)?true:false;},remove:function(A,B){A=this.getPanel(A);if(!A){return null;}var e={};this.fireEvent("beforeremove",this,A,e);if(e.cancel===true){return null;}var C=A.getId();this.panels.removeKey(C);return A;},getPanel:function(id){if(typeof id=="object"){return id;}return this.panels.get(id);},getPosition:function(){return this.position;}});
+//Roo/LayoutRegion.js
+Roo.LayoutRegion=function(A,B,C){Roo.LayoutRegion.superclass.constructor.call(this,A,B,C,true);var dh=Roo.DomHelper;this.el=dh.append(A.el.dom,{tag:"div",cls:"x-layout-panel x-layout-panel-"+this.position},true);this.titleEl=dh.append(this.el.dom,{tag:"div",unselectable:"on",cls:"x-unselectable x-layout-panel-hd x-layout-title-"+this.position,children:[{tag:"span",cls:"x-unselectable x-layout-panel-hd-text",unselectable:"on",html:"&#160;"},{tag:"div",cls:"x-unselectable x-layout-panel-hd-tools",unselectable:"on"}]},true);this.titleEl.enableDisplayMode();this.titleTextEl=this.titleEl.dom.firstChild;this.tools=Roo.get(this.titleEl.dom.childNodes[1],true);this.closeBtn=this.createTool(this.tools.dom,"x-layout-close");this.closeBtn.enableDisplayMode();this.closeBtn.on("click",this.closeClicked,this);this.closeBtn.hide();this.createBody(B);this.visible=true;this.collapsed=false;if(B.hideWhenEmpty){this.hide();this.on("paneladded",this.validateVisibility,this);this.on("panelremoved",this.validateVisibility,this);}
+this.applyConfig(B);};Roo.extend(Roo.LayoutRegion,Roo.BasicLayoutRegion,{createBody:function(){this.bodyEl=this.el.createChild({tag:"div",cls:"x-layout-panel-body"});},applyConfig:function(c){if(c.collapsible&&this.position!="center"&&!this.collapsedEl){var dh=Roo.DomHelper;if(c.titlebar!==false){this.collapseBtn=this.createTool(this.tools.dom,"x-layout-collapse-"+this.position);this.collapseBtn.on("click",this.collapse,this);this.collapseBtn.enableDisplayMode();if(c.showPin===true||this.showPin){this.stickBtn=this.createTool(this.tools.dom,"x-layout-stick");this.stickBtn.enableDisplayMode();this.stickBtn.on("click",this.expand,this);this.stickBtn.hide();}}
+this.collapsedEl=dh.append(this.mgr.el.dom,{cls:"x-layout-collapsed x-layout-collapsed-"+this.position,children:[{cls:"x-layout-collapsed-tools",children:[{cls:"x-layout-ctools-inner"}]}]},true);if(c.floatable!==false){this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.collapseClick,this);}if(c.collapsedTitle&&(this.position=="north"||this.position=="south")){this.collapsedTitleTextEl=dh.append(this.collapsedEl.dom,{tag:"div",cls:"x-unselectable x-layout-panel-hd-text",id:"message",unselectable:"on",style:{"float":"left"}});this.collapsedTitleTextEl.innerHTML=c.collapsedTitle;}
+this.expandBtn=this.createTool(this.collapsedEl.dom.firstChild.firstChild,"x-layout-expand-"+this.position);this.expandBtn.on("click",this.expand,this);}if(this.collapseBtn){this.collapseBtn.setVisible(c.collapsible==true);}
+this.cmargins=c.cmargins||this.cmargins||(this.position=="west"||this.position=="east"?{top:0,left:2,right:2,bottom:0}:{top:2,left:0,right:0,bottom:2});this.margins=c.margins||this.margins||{top:0,left:0,right:0,bottom:0};this.bottomTabs=c.tabPosition!="top";this.autoScroll=c.autoScroll||false;if(this.autoScroll){this.bodyEl.setStyle("overflow","auto");}else {this.bodyEl.setStyle("overflow","hidden");}if((!c.titlebar&&!c.title)||c.titlebar===false){this.titleEl.hide();}else {this.titleEl.show();if(c.title){this.titleTextEl.innerHTML=c.title;}}
+this.duration=c.duration||.30;this.slideDuration=c.slideDuration||.45;this.config=c;if(c.collapsed){this.collapse(true);}if(c.hidden){this.hide();}},isVisible:function(){return this.visible;},setCollapsedTitle:function(A){A=A||"&#160;";if(this.collapsedTitleTextEl){this.collapsedTitleTextEl.innerHTML=A;}},getBox:function(){var b;if(!this.collapsed){b=this.el.getBox(false,true);}else {b=this.collapsedEl.getBox(false,true);}return b;},getMargins:function(){return this.collapsed?this.cmargins:this.margins;},highlight:function(){this.el.addClass("x-layout-panel-dragover");},unhighlight:function(){this.el.removeClass("x-layout-panel-dragover");},updateBox:function(A){this.box=A;if(!this.collapsed){this.el.dom.style.left=A.x+"px";this.el.dom.style.top=A.y+"px";this.updateBody(A.width,A.height);}else {this.collapsedEl.dom.style.left=A.x+"px";this.collapsedEl.dom.style.top=A.y+"px";this.collapsedEl.setSize(A.width,A.height);}if(this.tabs){this.tabs.autoSizeTabs();}},updateBody:function(w,h){if(w!==null){this.el.setWidth(w);w-=this.el.getBorderWidth("rl");if(this.config.adjustments){w+=this.config.adjustments[0];}}if(h!==null){this.el.setHeight(h);h=this.titleEl&&this.titleEl.isDisplayed()?h-(this.titleEl.getHeight()||0):h;h-=this.el.getBorderWidth("tb");if(this.config.adjustments){h+=this.config.adjustments[1];}
+this.bodyEl.setHeight(h);if(this.tabs){h=this.tabs.syncHeight(h);}}if(this.panelSize){w=w!==null?w:this.panelSize.width;h=h!==null?h:this.panelSize.height;}if(this.activePanel){var el=this.activePanel.getEl();w=w!==null?w:el.getWidth();h=h!==null?h:el.getHeight();this.panelSize={width:w,height:h};this.activePanel.setSize(w,h);}if(Roo.isIE&&this.tabs){this.tabs.el.repaint();}},getEl:function(){return this.el;},hide:function(){if(!this.collapsed){this.el.dom.style.left="-2000px";this.el.hide();}else {this.collapsedEl.dom.style.left="-2000px";this.collapsedEl.hide();}
+this.visible=false;this.fireEvent("visibilitychange",this,false);},show:function(){if(!this.collapsed){this.el.show();}else {this.collapsedEl.show();}
+this.visible=true;this.fireEvent("visibilitychange",this,true);},closeClicked:function(){if(this.activePanel){this.remove(this.activePanel);}},collapseClick:function(e){if(this.isSlid){e.stopPropagation();this.slideIn();}else {e.stopPropagation();this.slideOut();}},collapse:function(A){if(this.collapsed)return;this.collapsed=true;if(this.split){this.split.el.hide();}if(this.config.animate&&A!==true){this.fireEvent("invalidated",this);this.animateCollapse();}else {this.el.setLocation(-20000,-20000);this.el.hide();this.collapsedEl.show();this.fireEvent("collapsed",this);this.fireEvent("invalidated",this);}},animateCollapse:function(){},expand:function(e,A){if(e)e.stopPropagation();if(!this.collapsed||this.el.hasActiveFx())return;if(this.isSlid){this.afterSlideIn();A=true;}
+this.collapsed=false;if(this.config.animate&&A!==true){this.animateExpand();}else {this.el.show();if(this.split){this.split.el.show();}
+this.collapsedEl.setLocation(-2000,-2000);this.collapsedEl.hide();this.fireEvent("invalidated",this);this.fireEvent("expanded",this);}},animateExpand:function(){},initTabs:function(){this.bodyEl.setStyle("overflow","hidden");var ts=new Roo.TabPanel(this.bodyEl.dom,{tabPosition:this.bottomTabs?'bottom':'top',disableTooltips:this.config.disableTabTips,toolbar:this.config.toolbar});if(this.config.hideTabs){ts.stripWrap.setDisplayed(false);}
+this.tabs=ts;ts.resizeTabs=this.config.resizeTabs===true;ts.minTabWidth=this.config.minTabWidth||40;ts.maxTabWidth=this.config.maxTabWidth||250;ts.preferredTabWidth=this.config.preferredTabWidth||150;ts.monitorResize=false;ts.bodyEl.setStyle("overflow",this.config.autoScroll?"auto":"hidden");ts.bodyEl.addClass('x-layout-tabs-body');this.panels.each(this.initPanelAsTab,this);},initPanelAsTab:function(A){var ti=this.tabs.addTab(A.getEl().id,A.getTitle(),null,this.config.closeOnTab&&A.isClosable());if(A.tabTip!==undefined){ti.setTooltip(A.tabTip);}
+ti.on("activate",function(){this.setActivePanel(A);},this);if(this.config.closeOnTab){ti.on("beforeclose",function(t,e){e.cancel=true;this.remove(A);},this);}return ti;},updatePanelTitle:function(A,B){if(this.activePanel==A){this.updateTitle(B);}if(this.tabs){var ti=this.tabs.getTab(A.getEl().id);ti.setText(B);if(A.tabTip!==undefined){ti.setTooltip(A.tabTip);}}},updateTitle:function(A){if(this.titleTextEl&&!this.config.title){this.titleTextEl.innerHTML=(typeof A!="undefined"&&A.length>0?A:"&#160;");}},setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);}
+this.activePanel=A;A.setActiveState(true);if(this.panelSize){A.setSize(this.panelSize.width,this.panelSize.height);}if(this.closeBtn){this.closeBtn.setVisible(!this.config.closeOnTab&&!this.isSlid&&A.isClosable());}
+this.updateTitle(A.getTitle());if(this.tabs){this.fireEvent("invalidated",this);}
+this.fireEvent("panelactivated",this,A);},showPanel:function(A){if(A=this.getPanel(A)){if(this.tabs){var B=this.tabs.getTab(A.getEl().id);if(B.isHidden()){this.tabs.unhideTab(B.id);}
+B.activate();}else {this.setActivePanel(A);}}return A;},getActivePanel:function(){return this.activePanel;},validateVisibility:function(){if(this.panels.getCount()<1){this.updateTitle("&#160;");this.closeBtn.hide();this.hide();}else {if(!this.isVisible()){this.show();}}},add:function(A){if(arguments.length>1){for(var i=0,B=arguments.length;i<B;i++){this.add(arguments[i]);}return null;}if(this.hasPanel(A)){this.showPanel(A);return A;}
+A.setRegion(this);this.panels.add(A);if(this.panels.getCount()==1&&!this.config.alwaysShowTabs){this.bodyEl.dom.appendChild(A.getEl().dom);if(A.background!==true){this.setActivePanel(A);}
+this.fireEvent("paneladded",this,A);return A;}if(!this.tabs){this.initTabs();}else {this.initPanelAsTab(A);}if(A.background!==true){this.tabs.activate(A.getEl().id);}
+this.fireEvent("paneladded",this,A);return A;},hidePanel:function(A){if(this.tabs&&(A=this.getPanel(A))){this.tabs.hideTab(A.getEl().id);}},unhidePanel:function(A){if(this.tabs&&(A=this.getPanel(A))){this.tabs.unhideTab(A.getEl().id);}},clearPanels:function(){while(this.panels.getCount()>0){this.remove(this.panels.first());}},remove:function(A,B){A=this.getPanel(A);if(!A){return null;}var e={};this.fireEvent("beforeremove",this,A,e);if(e.cancel===true){return null;}
+B=(typeof B!="undefined"?B:(this.config.preservePanels===true||A.preserve===true));var C=A.getId();this.panels.removeKey(C);if(B){document.body.appendChild(A.getEl().dom);}if(this.tabs){this.tabs.removeTab(A.getEl().id);}else if(!B){this.bodyEl.dom.removeChild(A.getEl().dom);}if(this.panels.getCount()==1&&this.tabs&&!this.config.alwaysShowTabs){var p=this.panels.first();var D=document.createElement("div");D.appendChild(p.getEl().dom);this.bodyEl.update("");this.bodyEl.dom.appendChild(p.getEl().dom);D=null;this.updateTitle(p.getTitle());this.tabs=null;this.bodyEl.setStyle("overflow",this.config.autoScroll?"auto":"hidden");this.setActivePanel(p);}
+A.setRegion(null);if(this.activePanel==A){this.activePanel=null;}if(this.config.autoDestroy!==false&&B!==true){try{A.destroy();}catch(e){}}
+this.fireEvent("panelremoved",this,A);return A;},getTabs:function(){return this.tabs;},createTool:function(A,B){var C=Roo.DomHelper.append(A,{tag:"div",cls:"x-layout-tools-button",children:[{tag:"div",cls:"x-layout-tools-button-inner "+B,html:"&#160;"}]},true);C.addClassOnOver("x-layout-tools-button-over");return C;}});
+//Roo/SplitLayoutRegion.js
+Roo.SplitLayoutRegion=function(A,B,C,D){this.cursor=D;Roo.SplitLayoutRegion.superclass.constructor.call(this,A,B,C);};Roo.extend(Roo.SplitLayoutRegion,Roo.LayoutRegion,{splitTip:"Drag to resize.",collapsibleSplitTip:"Drag to resize. Double click to hide.",useSplitTips:false,applyConfig:function(A){Roo.SplitLayoutRegion.superclass.applyConfig.call(this,A);if(A.split){if(!this.split){var B=Roo.DomHelper.append(this.mgr.el.dom,{tag:"div",id:this.el.id+"-split",cls:"x-layout-split x-layout-split-"+this.position,html:"&#160;"});this.split=new Roo.SplitBar(B,this.el,this.orientation);this.split.on("moved",this.onSplitMove,this);this.split.useShim=A.useShim===true;this.split.getMaximumSize=this[this.position=='north'||this.position=='south'?'getVMaxSize':'getHMaxSize'].createDelegate(this);if(this.useSplitTips){this.split.el.dom.title=A.collapsible?this.collapsibleSplitTip:this.splitTip;}if(A.collapsible){this.split.el.on("dblclick",this.collapse,this);}}if(typeof A.minSize!="undefined"){this.split.minSize=A.minSize;}if(typeof A.maxSize!="undefined"){this.split.maxSize=A.maxSize;}if(A.hideWhenEmpty||A.hidden||A.collapsed){this.hideSplitter();}}},getHMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");return Math.min(A,(this.el.getWidth()+B.getEl().getWidth())-B.getMinWidth());},getVMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");return Math.min(A,(this.el.getHeight()+B.getEl().getHeight())-B.getMinHeight());},onSplitMove:function(A,B){this.fireEvent("resized",this,B);},getSplitBar:function(){return this.split;},hide:function(){this.hideSplitter();Roo.SplitLayoutRegion.superclass.hide.call(this);},hideSplitter:function(){if(this.split){this.split.el.setLocation(-2000,-2000);this.split.el.hide();}},show:function(){if(this.split){this.split.el.show();}
+Roo.SplitLayoutRegion.superclass.show.call(this);},beforeSlide:function(){if(Roo.isGecko){this.bodyEl.clip();if(this.tabs)this.tabs.bodyEl.clip();if(this.activePanel){this.activePanel.getEl().clip();if(this.activePanel.beforeSlide){this.activePanel.beforeSlide();}}}},afterSlide:function(){if(Roo.isGecko){this.bodyEl.unclip();if(this.tabs)this.tabs.bodyEl.unclip();if(this.activePanel){this.activePanel.getEl().unclip();if(this.activePanel.afterSlide){this.activePanel.afterSlide();}}}},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){var st=new Roo.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(){Roo.get(document).un("click",this.slideInIf,this);},slideOut:function(){if(this.isSlid||this.el.hasActiveFx()){return;}
+this.isSlid=true;if(this.collapseBtn){this.collapseBtn.hide();}
+this.closeBtnState=this.closeBtn.getStyle('display');this.closeBtn.hide();if(this.stickBtn){this.stickBtn.show();}
+this.el.show();this.el.alignTo(this.collapsedEl,this.getCollapseAnchor());this.beforeSlide();this.el.setStyle("z-index",10001);this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.afterSlide();this.initAutoHide();Roo.get(document).on("click",this.slideInIf,this);this.fireEvent("slideshow",this);},scope:this,block:true});},afterSlideIn:function(){this.clearAutoHide();this.isSlid=false;this.clearMonitor();this.el.setStyle("z-index","");if(this.collapseBtn){this.collapseBtn.show();}
+this.closeBtn.setStyle('display',this.closeBtnState);if(this.stickBtn){this.stickBtn.hide();}
+this.fireEvent("slidehide",this);},slideIn:function(cb){if(!this.isSlid||this.el.hasActiveFx()){Roo.callback(cb);return;}
+this.isSlid=false;this.beforeSlide();this.el.slideOut(this.getSlideAnchor(),{callback:function(){this.el.setLeftTop(-10000,-10000);this.afterSlide();this.afterSlideIn();Roo.callback(cb);},scope:this,block:true});},slideInIf:function(e){if(!e.within(this.el)){this.slideIn();}},animateCollapse:function(){this.beforeSlide();this.el.setStyle("z-index",20000);var A=this.getSlideAnchor();this.el.slideOut(A,{callback:function(){this.el.setStyle("z-index","");this.collapsedEl.slideIn(A,{duration:.3});this.afterSlide();this.el.setLocation(-10000,-10000);this.el.hide();this.fireEvent("collapsed",this);},scope:this,block:true});},animateExpand:function(){this.beforeSlide();this.el.alignTo(this.collapsedEl,this.getCollapseAnchor(),this.getExpandAdj());this.el.setStyle("z-index",20000);this.collapsedEl.hide({duration:.1});this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.el.setStyle("z-index","");this.afterSlide();if(this.split){this.split.el.show();}
+this.fireEvent("invalidated",this);this.fireEvent("expanded",this);},scope:this,block:true});},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;}}});
+//Roo/CenterLayoutRegion.js
+Roo.CenterLayoutRegion=function(A,B){Roo.LayoutRegion.call(this,A,B,"center");this.visible=true;this.minWidth=B.minWidth||20;this.minHeight=B.minHeight||20;};Roo.extend(Roo.CenterLayoutRegion,Roo.LayoutRegion,{hide:function(){},show:function(){},getMinWidth:function(){return this.minWidth;},getMinHeight:function(){return this.minHeight;}});Roo.NorthLayoutRegion=function(A,B){Roo.LayoutRegion.call(this,A,B,"north","n-resize");if(this.split){this.split.placement=Roo.SplitBar.TOP;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v");}var C=B.initialSize||B.height;if(typeof C!="undefined"){this.el.setHeight(C);}};Roo.extend(Roo.NorthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){A.height+=this.split.el.getHeight();}return A;},updateBox:function(A){if(this.split&&!this.collapsed){A.height-=this.split.el.getHeight();this.split.el.setLeft(A.x);this.split.el.setTop(A.y+A.height);this.split.el.setWidth(A.width);}if(this.collapsed){this.updateBody(A.width,null);}
+Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.SouthLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"south","s-resize");if(this.split){this.split.placement=Roo.SplitBar.BOTTOM;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v");}var C=B.initialSize||B.height;if(typeof C!="undefined"){this.el.setHeight(C);}};Roo.extend(Roo.SouthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){var sh=this.split.el.getHeight();A.height+=sh;A.y-=sh;}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sh=this.split.el.getHeight();A.height-=sh;A.y+=sh;this.split.el.setLeft(A.x);this.split.el.setTop(A.y-sh);this.split.el.setWidth(A.width);}if(this.collapsed){this.updateBody(A.width,null);}
+Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.EastLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"east","e-resize");if(this.split){this.split.placement=Roo.SplitBar.RIGHT;this.split.orientation=Roo.SplitBar.HORIZONTAL;this.split.el.addClass("x-layout-split-h");}var C=B.initialSize||B.width;if(typeof C!="undefined"){this.el.setWidth(C);}};Roo.extend(Roo.EastLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){var sw=this.split.el.getWidth();A.width+=sw;A.x-=sw;}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x);this.split.el.setTop(A.y);this.split.el.setHeight(A.height);A.x+=sw;}if(this.collapsed){this.updateBody(null,A.height);}
+Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.WestLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"west","w-resize");if(this.split){this.split.placement=Roo.SplitBar.LEFT;this.split.orientation=Roo.SplitBar.HORIZONTAL;this.split.el.addClass("x-layout-split-h");}var C=B.initialSize||B.width;if(typeof C!="undefined"){this.el.setWidth(C);}};Roo.extend(Roo.WestLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();if(this.split){A.width+=this.split.el.getWidth();}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x+A.width);this.split.el.setTop(A.y);this.split.el.setHeight(A.height);}if(this.collapsed){this.updateBody(null,A.height);}
+Roo.LayoutRegion.prototype.updateBox.call(this,A);}});
+//Roo/LayoutStateManager.js
+Roo.LayoutStateManager=function(A){this.state={north:{},south:{},east:{},west:{}};};Roo.LayoutStateManager.prototype={init:function(A,B){this.provider=B;var C=B.get(A.id+"-layout-state");if(C){var D=A.isUpdating();if(!D){A.beginUpdate();}for(var E in C){if(typeof C[E]!="function"){var F=C[E];var r=A.getRegion(E);if(r&&F){if(F.size){r.resizeTo(F.size);}if(F.collapsed==true){r.collapse(true);}else {r.expand(null,true);}}}}if(!D){A.endUpdate();}
+this.state=C;}
+this.layout=A;A.on("regionresized",this.onRegionResized,this);A.on("regioncollapsed",this.onRegionCollapsed,this);A.on("regionexpanded",this.onRegionExpanded,this);},storeState:function(){this.provider.set(this.layout.id+"-layout-state",this.state);},onRegionResized:function(A,B){this.state[A.getPosition()].size=B;this.storeState();},onRegionCollapsed:function(A){this.state[A.getPosition()].collapsed=true;this.storeState();},onRegionExpanded:function(A){this.state[A.getPosition()].collapsed=false;this.storeState();}};
+//Roo/ContentPanel.js
+Roo.ContentPanel=function(el,A,B){if(el.autoCreate){A=el;el=Roo.id();}
+this.el=Roo.get(el);if(!this.el&&A&&A.autoCreate){if(typeof A.autoCreate=="object"){if(!A.autoCreate.id){A.autoCreate.id=A.id||el;}
+this.el=Roo.DomHelper.append(document.body,A.autoCreate,true);}else {this.el=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-inactive-content",id:A.id||el},true);}}
+this.closable=false;this.loaded=false;this.active=false;if(typeof A=="string"){this.title=A;}else {Roo.apply(this,A);}if(this.toolbar&&!this.toolbar.el&&this.toolbar.xtype){this.wrapEl=this.el.wrap();this.toolbar.container=this.el.insertSibling(false,'before');this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl,true);}else {this.resizeEl=this.el;}
+this.addEvents({"activate":true,"deactivate":true,"resize":true,"render":true});if(this.autoScroll){this.resizeEl.setStyle("overflow","auto");}else {this.el.on('scroll',function(){Roo.log('fix random scolling');this.scrollTo('top',0);});}
+B=B||this.content;if(B){this.setContent(B);}if(A&&A.url){this.setUrl(this.url,this.params,this.loadOnce);}
+Roo.ContentPanel.superclass.constructor.call(this);this.fireEvent('render',this);};Roo.extend(Roo.ContentPanel,Roo.util.Observable,{tabTip:'',setRegion:function(A){this.region=A;if(A){this.el.replaceClass("x-layout-inactive-content","x-layout-active-content");}else {this.el.replaceClass("x-layout-active-content","x-layout-inactive-content");}},getToolbar:function(){return this.toolbar;},setActiveState:function(A){this.active=A;if(!A){this.fireEvent("deactivate",this);}else {this.fireEvent("activate",this);}},setContent:function(A,B){this.el.update(A,B);},ignoreResize:function(w,h){if(this.lastSize&&this.lastSize.width==w&&this.lastSize.height==h){return true;}else {this.lastSize={width:w,height:h};return false;}},getUpdateManager:function(){return this.el.getUpdateManager();},load:function(){var um=this.el.getUpdateManager();um.update.apply(um,arguments);return this;},setUrl:function(A,B,C){if(this.refreshDelegate){this.removeListener("activate",this.refreshDelegate);}
+this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);return this.el.getUpdateManager();},_handleRefresh:function(A,B,C){if(!C||!this.loaded){var D=this.el.getUpdateManager();D.update(A,B,this._setLoaded.createDelegate(this));}},_setLoaded:function(){this.loaded=true;},getId:function(){return this.el.id;},getEl:function(){return this.wrapEl||this.el;},adjustForComponents:function(A,B){if(this.resizeEl!=this.el){A-=this.el.getFrameWidth('lr');B-=this.el.getFrameWidth('tb');}if(this.toolbar){var te=this.toolbar.getEl();B-=te.getHeight();te.setWidth(A);}if(this.adjustments){A+=this.adjustments[0];B+=this.adjustments[1];}return {"width":A,"height":B};},setSize:function(A,B){if(this.fitToFrame&&!this.ignoreResize(A,B)){if(this.fitContainer&&this.resizeEl!=this.el){this.el.setSize(A,B);}var C=this.adjustForComponents(A,B);this.resizeEl.setSize(this.autoWidth?"auto":C.width,this.autoHeight?"auto":C.height);this.fireEvent('resize',this,C.width,C.height);}},getTitle:function(){return this.title;},setTitle:function(A){this.title=A;if(this.region){this.region.updatePanelTitle(this,A);}},isClosable:function(){return this.closable;},beforeSlide:function(){this.el.clip();this.resizeEl.clip();},afterSlide:function(){this.el.unclip();this.resizeEl.unclip();},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();}},destroy:function(){this.el.removeAllListeners();var A=document.createElement("span");A.appendChild(this.el.dom);A.innerHTML="";this.el.remove();this.el=null;},form:false,view:false,addxtype:function(A){if(A.xtype.match(/^Form$/)){var el=this.el.createChild();this.form=new Roo.form.Form(A);if(this.form.allItems.length)this.form.render(el.dom);return this.form;}if(['View','JsonView','DatePicker'].indexOf(A.xtype)>-1){A.el=this.el.appendChild(document.createElement("div"));var B=new Roo.factory(A);B.render&&B.render(false,'');this.view=B;return B;}return false;}});Roo.GridPanel=function(A,B){this.wrapper=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-grid-wrapper x-layout-inactive-content"},true);this.wrapper.dom.appendChild(A.getGridEl().dom);Roo.GridPanel.superclass.constructor.call(this,this.wrapper,B);if(this.toolbar){this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);}if(this.footer&&!this.footer.el&&this.footer.xtype){this.footer.container=this.grid.getView().getFooterPanel(true);this.footer.dataSource=this.grid.dataSource;this.footer=Roo.factory(this.footer,Roo);}
+A.monitorWindowResize=false;A.autoHeight=false;A.autoWidth=false;this.grid=A;this.grid.getGridEl().replaceClass("x-layout-inactive-content","x-layout-component-panel");};Roo.extend(Roo.GridPanel,Roo.ContentPanel,{getId:function(){return this.grid.id;},getGrid:function(){return this.grid;},setSize:function(A,B){if(!this.ignoreResize(A,B)){var C=this.grid;var D=this.adjustForComponents(A,B);C.getGridEl().setSize(D.width,D.height);C.autoSize();}},beforeSlide:function(){this.grid.getView().scroller.clip();},afterSlide:function(){this.grid.getView().scroller.unclip();},destroy:function(){this.grid.destroy();delete this.grid;Roo.GridPanel.superclass.destroy.call(this);}});Roo.NestedLayoutPanel=function(A,B){Roo.NestedLayoutPanel.superclass.constructor.call(this,A.getEl(),B);A.monitorWindowResize=false;this.layout=A;this.layout.getEl().addClass("x-layout-nested-layout");};Roo.extend(Roo.NestedLayoutPanel,Roo.ContentPanel,{setSize:function(A,B){if(!this.ignoreResize(A,B)){var C=this.adjustForComponents(A,B);var el=this.layout.getEl();el.setSize(C.width,C.height);var D=el.dom.offsetWidth;this.layout.layout();if(Roo.isIE&&!this.initialized){this.initialized=true;this.layout.layout();}}},setActiveState:function(A){this.active=A;if(!A){this.fireEvent("deactivate",this);return;}
+this.fireEvent("activate",this);if(!this.layout){return;}var B=false;for(var r in this.layout.regions){B=this.layout.getRegion(r);if(B.getActivePanel()){B.setActivePanel(B.getActivePanel());continue;}if(!B.panels.length){continue;}
+B.showPanel(B.getPanel(0));}},getLayout:function(){return this.layout;},addxtype:function(A){return this.layout.addxtype(A);}});Roo.ScrollPanel=function(el,A,B){A=A||{};A.fitToFrame=true;Roo.ScrollPanel.superclass.constructor.call(this,el,A,B);this.el.dom.style.overflow="hidden";var C=this.el.wrap({cls:"x-scroller x-layout-inactive-content"});this.el.removeClass("x-layout-inactive-content");this.el.on("mousewheel",this.onWheel,this);var up=C.createChild({cls:"x-scroller-up",html:"&#160;"},this.el.dom);var D=C.createChild({cls:"x-scroller-down",html:"&#160;"});up.unselectable();D.unselectable();up.on("click",this.scrollUp,this);D.on("click",this.scrollDown,this);up.addClassOnOver("x-scroller-btn-over");D.addClassOnOver("x-scroller-btn-over");up.addClassOnClick("x-scroller-btn-click");D.addClassOnClick("x-scroller-btn-click");this.adjustments=[0,-(up.getHeight()+D.getHeight())];this.resizeEl=this.el;this.el=C;this.up=up;this.down=D;};Roo.extend(Roo.ScrollPanel,Roo.ContentPanel,{increment:100,wheelIncrement:5,scrollUp:function(){this.resizeEl.scroll("up",this.increment,{callback:this.afterScroll,scope:this});},scrollDown:function(){this.resizeEl.scroll("down",this.increment,{callback:this.afterScroll,scope:this});},afterScroll:function(){var el=this.resizeEl;var t=el.dom.scrollTop,h=el.dom.scrollHeight,ch=el.dom.clientHeight;this.up[t==0?"addClass":"removeClass"]("x-scroller-btn-disabled");this.down[h-t<=ch?"addClass":"removeClass"]("x-scroller-btn-disabled");},setSize:function(){Roo.ScrollPanel.superclass.setSize.apply(this,arguments);this.afterScroll();},onWheel:function(e){var d=e.getWheelDelta();this.resizeEl.dom.scrollTop-=(d*this.wheelIncrement);this.afterScroll();e.stopEvent();},setContent:function(A,B){this.resizeEl.update(A,B);}});Roo.TreePanel=function(A){var el=A.el;var B=A.tree;delete A.tree;delete A.el;var C=el.createChild();A.resizeEl=C;Roo.TreePanel.superclass.constructor.call(this,el,A);this.tree=new Roo.tree.TreePanel(C,B);this.on('activate',function(){if(this.tree.rendered){return;}
+this.tree.render();});this.on('resize',function(cp,w,h){this.tree.innerCt.setWidth(w);this.tree.innerCt.setHeight(h);this.tree.innerCt.setStyle('overflow-y','auto');});};Roo.extend(Roo.TreePanel,Roo.ContentPanel,{fitToFrame:true,autoScroll:true});
+//Roo/ReaderLayout.js
+Roo.ReaderLayout=function(A,B){var c=A||{size:{}};Roo.ReaderLayout.superclass.constructor.call(this,B||document.body,{north:c.north!==false?Roo.apply({split:false,initialSize:32,titlebar:false},c.north):false,west:c.west!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:5,right:0,bottom:5,top:5},cmargins:{left:5,right:5,bottom:5,top:5}},c.west):false,east:c.east!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:0,right:5,bottom:5,top:5},cmargins:{left:5,right:5,bottom:5,top:5}},c.east):false,center:Roo.apply({tabPosition:'top',autoScroll:false,closeOnTab:true,titlebar:false,margins:{left:c.west!==false?0:5,right:c.east!==false?0:5,bottom:5,top:2}},c.center)});this.el.addClass('x-reader');this.beginUpdate();var C=new Roo.BorderLayout(Roo.get(document.body).createChild(),{south:c.preview!==false?Roo.apply({split:true,initialSize:200,minSize:100,autoScroll:true,collapsible:true,titlebar:true,cmargins:{top:5,left:0,right:0,bottom:0}},c.preview):false,center:Roo.apply({autoScroll:false,titlebar:false,minHeight:200},c.listView)});this.add('center',new Roo.NestedLayoutPanel(C,Roo.apply({title:c.mainTitle||'',tabTip:''},c.innerPanelCfg)));this.endUpdate();this.regions.preview=C.getRegion('south');this.regions.listView=C.getRegion('center');};Roo.extend(Roo.ReaderLayout,Roo.BorderLayout);
+//Roo/grid/Grid.js
+Roo.grid.Grid=function(A,B){this.container=Roo.get(A);this.container.update("");this.container.setStyle("overflow","hidden");this.container.addClass('x-grid-container');this.id=this.container.id;Roo.apply(this,B);if(this.ds){this.dataSource=this.ds;delete this.ds;}if(this.cm){this.colModel=this.cm;delete this.cm;}if(this.sm){this.selModel=this.sm;delete this.sm;}if(this.selModel){this.selModel=Roo.factory(this.selModel,Roo.grid);this.sm=this.selModel;this.sm.xmodule=this.xmodule||false;}if(typeof(this.colModel.config)=='undefined'){this.colModel=new Roo.grid.ColumnModel(this.colModel);this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;}if(this.dataSource){this.dataSource=Roo.factory(this.dataSource,Roo.data);this.ds=this.dataSource;this.ds.xmodule=this.xmodule||false;}if(this.width){this.container.setWidth(this.width);}if(this.height){this.container.setHeight(this.height);}
+this.addEvents({"click":true,"dblclick":true,"contextmenu":true,"mousedown":true,"mouseup":true,"mouseover":true,"mouseout":true,"keypress":true,"keydown":true,"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclick":true,"headerclick":true,"headerdblclick":true,"rowcontextmenu":true,"cellcontextmenu":true,"headercontextmenu":true,"bodyscroll":true,"columnresize":true,"columnmove":true,"startdrag":true,"enddrag":true,"dragdrop":true,"dragover":true,"dragenter":true,"dragout":true,'rowclass':true,'render':true});Roo.grid.Grid.superclass.constructor.call(this);};Roo.extend(Roo.grid.Grid,Roo.util.Observable,{minColumnWidth:25,autoSizeColumns:false,autoSizeHeaders:true,monitorWindowResize:true,maxRowsToMeasure:0,trackMouseOver:true,enableDragDrop:false,enableColumnMove:true,enableColumnHide:true,enableRowHeightSync:false,stripeRows:true,autoHeight:false,autoExpandColumn:false,autoExpandMin:50,autoExpandMax:1000,view:null,loadMask:false,dropTarget:false,rendered:false,render:function(){var c=this.container;if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){this.autoHeight=true;}var A=this.getView();A.init(this);c.on("click",this.onClick,this);c.on("dblclick",this.onDblClick,this);c.on("contextmenu",this.onContextMenu,this);c.on("keydown",this.onKeyDown,this);this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource},this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true);this.footer=Roo.factory(this.footer,Roo);}if(this.dropTarget&&this.dropTarget.xtype){delete this.dropTarget.xtype;this.dropTarget=new Ext.dd.DropTarget(this.getView().mainBody,this.dropTarget);}
+this.rendered=true;this.fireEvent('render',this);return this;},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}
+this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}
+c.update("");if(A===true){c.remove();}},processEvent:function(A,e){this.fireEvent(A,e);var t=e.getTarget();var v=this.view;var B=v.findHeaderIndex(t);if(B!==false){this.fireEvent("header"+A,this,B,e);}else {var C=v.findRowIndex(t);var D=v.findCellIndex(t);if(C!==false){this.fireEvent("row"+A,this,C,e);if(D!==false){this.fireEvent("cell"+A,this,C,D,e);}}}},onClick:function(e){this.processEvent("click",e);},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);},walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--;G=false;}while(A>=0){if(!G){B=E-1;}
+G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}
+B--;}
+A--;}}else {if(B>=E){A++;G=false;}while(A<F){if(!G){B=0;}
+G=false;while(B<E){if(fn.call(D||this,A,B,cm)===true){return [A,B];}
+B++;}
+A++;}}return null;},getSelections:function(){return this.selModel.getSelections();},autoSize:function(){if(this.rendered){this.view.layout();if(this.view.adjustForScroll){this.view.adjustForScroll();}}},getGridEl:function(){return this.container;},stopEditing:function(){},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.grid.RowSelectionModel();}return this.selModel;},getDataSource:function(){return this.dataSource;},getColumnModel:function(){return this.colModel;},getView:function(){if(!this.view){this.view=new Roo.grid.GridView(this.viewConfig);}return this.view;},getDragDropText:function(){var A=this.selModel.getCount();return String.format(this.ddText,A,A==1?'':'s');}});Roo.grid.Grid.prototype.ddText="{0} selected row{1}";
+//Roo/grid/AbstractGridView.js
+Roo.grid.AbstractGridView=function(){this.grid=null;this.events={"beforerowremoved":true,"beforerowsinserted":true,"beforerefresh":true,"rowremoved":true,"rowsinserted":true,"rowupdated":true,"refresh":true};Roo.grid.AbstractGridView.superclass.constructor.call(this);};Roo.extend(Roo.grid.AbstractGridView,Roo.util.Observable,{rowClass:"x-grid-row",cellClass:"x-grid-cell",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-hd-split",init:function(A){this.grid=A;var B=this.grid.getGridEl().id;this.colSelector="#"+B+" ."+this.cellClass+"-";this.tdSelector="#"+B+" ."+this.tdClass+"-";this.hdSelector="#"+B+" ."+this.hdClass+"-";this.splitSelector="#"+B+" ."+this.splitClass+"-";},getColumnRenderers:function(){var A=[];var cm=this.grid.colModel;var B=cm.getColumnCount();for(var i=0;i<B;i++){A[i]=cm.getRenderer(i);}return A;},getColumnIds:function(){var A=[];var cm=this.grid.colModel;var B=cm.getColumnCount();for(var i=0;i<B;i++){A[i]=cm.getColumnId(i);}return A;},getDataIndexes:function(){if(!this.indexMap){this.indexMap=this.buildIndexMap();}return this.indexMap.colToData;},getColumnIndexByDataIndex:function(A){if(!this.indexMap){this.indexMap=this.buildIndexMap();}return this.indexMap.dataToCol[A];},setCSSStyle:function(A,B,C){var D="#"+this.grid.id+" .x-grid-col-"+A;Roo.util.CSS.updateRule(D,B,C);},generateRules:function(cm){var A=[],B=this.grid.id+'-cssrules';Roo.util.CSS.removeStyleSheet(B);for(var i=0,C=cm.getColumnCount();i<C;i++){var D=cm.getColumnId(i);A.push(this.colSelector,D," {\n",cm.config[i].css,"}\n",this.tdSelector,D," {\n}\n",this.hdSelector,D," {\n}\n",this.splitSelector,D," {\n}\n");}return Roo.util.CSS.createStyleSheet(A.join(""),B);}});
+//Roo/grid/HeaderDragZone.js
+Roo.grid.HeaderDragZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDragZone.superclass.constructor.call(this,hd);if(B){this.setHandleElId(Roo.id(hd));this.setOuterHandleElId(Roo.id(B));}
+this.scroll=false;};Roo.extend(Roo.grid.HeaderDragZone,Roo.dd.DragZone,{maxDragWidth:120,getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var h=this.view.findHeaderCell(t);if(h){return {ddel:h.firstChild,header:h};}return false;},onInitDrag:function(e){this.view.headersDisabled=true;var A=this.dragData.ddel.cloneNode(true);A.id=Roo.id();A.style.width=Math.min(this.dragData.header.offsetWidth,this.maxDragWidth)+"px";this.proxy.update(A);return true;},afterValidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;},50);},afterInvalidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;},50);}});
+//Roo/grid/HeaderDropZone.js
+Roo.grid.HeaderDropZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.proxyTop=Roo.DomHelper.append(document.body,{cls:"col-move-top",html:"&#160;"},true);this.proxyBottom=Roo.DomHelper.append(document.body,{cls:"col-move-bottom",html:"&#160;"},true);this.proxyTop.hide=this.proxyBottom.hide=function(){this.setLeftTop(-100,-100);this.setStyle("visibility","hidden");};this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDropZone.superclass.constructor.call(this,A.getGridEl().dom);};Roo.extend(Roo.grid.HeaderDropZone,Roo.dd.DropZone,{proxyOffsets:[-4,-9],fly:Roo.Element.fly,getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);var A=this.view.findCellIndex(t);if(A!==false){return this.view.getHeaderCell(A);}return null;},nextVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.nextSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}
+h=h.nextSibling;}return null;},prevVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.prevSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}
+h=h.prevSibling;}return null;},positionIndicator:function(h,n,e){var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);var px,pt,py=r.top+this.proxyOffsets[1];if((r.right-x)<=(r.right-r.left)/2){px=r.right+this.view.borderWidth;pt="after";}else {px=r.left;pt="before";}var A=this.view.getCellIndex(h);var B=this.view.getCellIndex(n);if(this.grid.colModel.isFixed(B)){return false;}var C=this.grid.colModel.isLocked(B);if(pt=="after"){B++;}if(A<B){B--;}if(A==B&&(C==this.grid.colModel.isLocked(A))){return false;}
+px+=this.proxyOffsets[0];this.proxyTop.setLeftTop(px,py);this.proxyTop.show();if(!this.bottomOffset){this.bottomOffset=this.view.mainHd.getHeight();}
+this.proxyBottom.setLeftTop(px,py+this.proxyTop.dom.offsetHeight+this.bottomOffset);this.proxyBottom.show();return pt;},onNodeEnter:function(n,dd,e,A){if(A.header!=n){this.positionIndicator(A.header,n,e);}},onNodeOver:function(n,dd,e,A){var B=false;if(A.header!=n){B=this.positionIndicator(A.header,n,e);}if(!B){this.proxyTop.hide();this.proxyBottom.hide();}return B?this.dropAllowed:this.dropNotAllowed;},onNodeOut:function(n,dd,e,A){this.proxyTop.hide();this.proxyBottom.hide();},onNodeDrop:function(n,dd,e,A){var h=A.header;if(h!=n){var cm=this.grid.colModel;var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);var pt=(r.right-x)<=((r.right-r.left)/2)?"after":"before";var B=this.view.getCellIndex(h);var C=this.view.getCellIndex(n);var D=cm.isLocked(C);if(pt=="after"){C++;}if(B<C){C--;}if(B==C&&(D==cm.isLocked(B))){return false;}
+cm.setLocked(B,D,true);cm.moveColumn(B,C);this.grid.fireEvent("columnmove",B,C);return true;}return false;}});
+//Roo/grid/GridView.js
+Roo.grid.GridView=function(A){Roo.grid.GridView.superclass.constructor.call(this);this.el=null;Roo.apply(this,A);};Roo.extend(Roo.grid.GridView,Roo.grid.AbstractGridView,{rowClass:"x-grid-row",cellClass:"x-grid-col",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-split",sortClasses:["sort-asc","sort-desc"],enableMoveAnim:false,hlColor:"C3DAF9",dh:Roo.DomHelper,fly:Roo.Element.fly,css:Roo.util.CSS,borderWidth:1,splitOffset:3,scrollIncrement:22,cellRE:/(?:.*?)x-grid-(?:hd|cell|csplit)-(?:[\d]+)-([\d]+)(?:.*?)/,findRE:/\s?(?:x-grid-hd|x-grid-col|x-grid-csplit)\s/,bind:function(ds,cm){if(this.ds){this.ds.un("load",this.onLoad,this);this.ds.un("datachanged",this.onDataChange,this);this.ds.un("add",this.onAdd,this);this.ds.un("remove",this.onRemove,this);this.ds.un("update",this.onUpdate,this);this.ds.un("clear",this.onClear,this);}if(ds){ds.on("load",this.onLoad,this);ds.on("datachanged",this.onDataChange,this);ds.on("add",this.onAdd,this);ds.on("remove",this.onRemove,this);ds.on("update",this.onUpdate,this);ds.on("clear",this.onClear,this);}
+this.ds=ds;if(this.cm){this.cm.un("widthchange",this.onColWidthChange,this);this.cm.un("headerchange",this.onHeaderChange,this);this.cm.un("hiddenchange",this.onHiddenChange,this);this.cm.un("columnmoved",this.onColumnMove,this);this.cm.un("columnlockchange",this.onColumnLock,this);}if(cm){this.generateRules(cm);cm.on("widthchange",this.onColWidthChange,this);cm.on("headerchange",this.onHeaderChange,this);cm.on("hiddenchange",this.onHiddenChange,this);cm.on("columnmoved",this.onColumnMove,this);cm.on("columnlockchange",this.onColumnLock,this);}
+this.cm=cm;},init:function(A){Roo.grid.GridView.superclass.init.call(this,A);this.bind(A.dataSource,A.colModel);A.on("headerclick",this.handleHeaderClick,this);if(A.trackMouseOver){A.on("mouseover",this.onRowOver,this);A.on("mouseout",this.onRowOut,this);}
+A.cancelTextSelection=function(){};this.gridId=A.id;var B=this.templates||{};if(!B.master){B.master=new Roo.Template('<div class="x-grid" hidefocus="true">','<a href="#" class="x-grid-focus" tabIndex="-1"></a>','<div class="x-grid-topbar"></div>','<div class="x-grid-scroller"><div></div></div>','<div class="x-grid-locked">','<div class="x-grid-header">{lockedHeader}</div>','<div class="x-grid-body">{lockedBody}</div>',"</div>",'<div class="x-grid-viewport">','<div class="x-grid-header">{header}</div>','<div class="x-grid-body">{body}</div>',"</div>",'<div class="x-grid-bottombar"></div>','<div class="x-grid-resize-proxy">&#160;</div>',"</div>");B.master.disableformats=true;}if(!B.header){B.header=new Roo.Template('<table border="0" cellspacing="0" cellpadding="0">','<tbody><tr class="x-grid-hd-row">{cells}</tr></tbody>',"</table>{splits}");B.header.disableformats=true;}
+B.header.compile();if(!B.hcell){B.hcell=new Roo.Template('<td class="x-grid-hd x-grid-td-{id} {cellId}"><div title="{title}" class="x-grid-hd-inner x-grid-hd-{id}">','<div class="x-grid-hd-text" unselectable="on">{value}<img class="x-grid-sort-icon" src="',Roo.BLANK_IMAGE_URL,'" /></div>',"</div></td>");B.hcell.disableFormats=true;}
+B.hcell.compile();if(!B.hsplit){B.hsplit=new Roo.Template('<div class="x-grid-split {splitId} x-grid-split-{id}" style="{style}" unselectable="on">&#160;</div>');B.hsplit.disableFormats=true;}
+B.hsplit.compile();if(!B.body){B.body=new Roo.Template('<table border="0" cellspacing="0" cellpadding="0">',"<tbody>{rows}</tbody>","</table>");B.body.disableFormats=true;}
+B.body.compile();if(!B.row){B.row=new Roo.Template('<tr class="x-grid-row {alt}">{cells}</tr>');B.row.disableFormats=true;}
+B.row.compile();if(!B.cell){B.cell=new Roo.Template('<td class="x-grid-col x-grid-td-{id} {cellId} {css}" tabIndex="0">','<div class="x-grid-col-{id} x-grid-cell-inner"><div class="x-grid-cell-text" unselectable="on" {attr}>{value}</div></div>',"</td>");B.cell.disableFormats=true;}
+B.cell.compile();this.templates=B;},onColWidthChange:function(){this.updateColumns.apply(this,arguments);},onHeaderChange:function(){this.updateHeaders.apply(this,arguments);},onHiddenChange:function(){this.handleHiddenChange.apply(this,arguments);},onColumnMove:function(){this.handleColumnMove.apply(this,arguments);},onColumnLock:function(){this.handleLockChange.apply(this,arguments);},onDataChange:function(){this.refresh();this.updateHeaderSortState();},onClear:function(){this.refresh();},onUpdate:function(ds,A){this.refreshRow(A);},refreshRow:function(A){var ds=this.ds,B;if(typeof A=='number'){B=A;A=ds.getAt(B);}else {B=ds.indexOf(A);}
+this.insertRows(ds,B,B,true);this.onRemove(ds,A,B+1,true);this.syncRowHeights(B,B);this.layout();this.fireEvent("rowupdated",this,B,A);},onAdd:function(ds,A,B){this.insertRows(ds,B,B+(A.length-1));},onRemove:function(ds,A,B,C){if(C!==true){this.fireEvent("beforerowremoved",this,B,A);}var bt=this.getBodyTable(),lt=this.getLockedTable();if(bt.rows[B]){bt.firstChild.removeChild(bt.rows[B]);}if(lt.rows[B]){lt.firstChild.removeChild(lt.rows[B]);}if(C!==true){this.stripeRows(B);this.syncRowHeights(B,B);this.layout();this.fireEvent("rowremoved",this,B,A);}},onLoad:function(){this.scrollToTop();},scrollToTop:function(){if(this.scroller){this.scroller.dom.scrollTop=0;this.syncScroll();}},getHeaderPanel:function(A){if(A){this.headerPanel.show();}return this.headerPanel;},getFooterPanel:function(A){if(A){this.footerPanel.show();}return this.footerPanel;},initElements:function(){var E=Roo.Element;var el=this.grid.getGridEl().dom.firstChild;var cs=el.childNodes;this.el=new E(el);this.focusEl=new E(el.firstChild);this.focusEl.swallowEvent("click",true);this.headerPanel=new E(cs[1]);this.headerPanel.enableDisplayMode("block");this.scroller=new E(cs[2]);this.scrollSizer=new E(this.scroller.dom.firstChild);this.lockedWrap=new E(cs[3]);this.lockedHd=new E(this.lockedWrap.dom.firstChild);this.lockedBody=new E(this.lockedWrap.dom.childNodes[1]);this.mainWrap=new E(cs[4]);this.mainHd=new E(this.mainWrap.dom.firstChild);this.mainBody=new E(this.mainWrap.dom.childNodes[1]);this.footerPanel=new E(cs[5]);this.footerPanel.enableDisplayMode("block");this.resizeProxy=new E(cs[6]);this.headerSelector=String.format('#{0} td.x-grid-hd, #{1} td.x-grid-hd',this.lockedHd.id,this.mainHd.id);this.splitterSelector=String.format('#{0} div.x-grid-split, #{1} div.x-grid-split',this.idToCssName(this.lockedHd.id),this.idToCssName(this.mainHd.id));},idToCssName:function(s){return s.replace(/[^a-z0-9]+/ig,'-');},getHeaderCell:function(A){return Roo.DomQuery.select(this.headerSelector)[A];},getHeaderCellMeasure:function(A){return this.getHeaderCell(A).firstChild;},getHeaderCellText:function(A){return this.getHeaderCell(A).firstChild.firstChild;},getLockedTable:function(){return this.lockedBody.dom.firstChild;},getBodyTable:function(){return this.mainBody.dom.firstChild;},getLockedRow:function(A){return this.getLockedTable().rows[A];},getRow:function(A){return this.getBodyTable().rows[A];},getRowComposite:function(A){if(!this.rowEl){this.rowEl=new Roo.CompositeElementLite();}var B=[],C,D;if(C=this.getLockedRow(A)){B.push(C);}if(D=this.getRow(A)){B.push(D);}
+this.rowEl.elements=B;return this.rowEl;},getCell:function(A,B){var C=this.cm.getLockedCount();var D;if(B<C){D=this.lockedBody.dom.firstChild;}else {D=this.mainBody.dom.firstChild;B-=C;}return D.rows[A].childNodes[B];},getCellText:function(A,B){return this.getCell(A,B).firstChild.firstChild;},getCellBox:function(A){var b=this.fly(A).getBox();if(Roo.isOpera){b.y=A.offsetTop+this.mainBody.getY();}return b;},getCellIndex:function(A){var id=String(A.className).match(this.cellRE);if(id){return parseInt(id[1],10);}return 0;},findHeaderIndex:function(n){var r=Roo.fly(n).findParent("td."+this.hdClass,6);return r?this.getCellIndex(r):false;},findHeaderCell:function(n){var r=Roo.fly(n).findParent("td."+this.hdClass,6);return r?r:false;},findRowIndex:function(n){if(!n){return false;}var r=Roo.fly(n).findParent("tr."+this.rowClass,6);return r?r.rowIndex:false;},findCellIndex:function(A){var B=this.el.dom;while(A&&A!=B){if(this.findRE.test(A.className)){return this.getCellIndex(A);}
+A=A.parentNode;}return false;},getColumnId:function(A){return this.cm.getColumnId(A);},getSplitters:function(){if(this.splitterSelector){return Roo.DomQuery.select(this.splitterSelector);}else {return null;}},getSplitter:function(A){return this.getSplitters()[A];},onRowOver:function(e,t){var A;if((A=this.findRowIndex(t))!==false){this.getRowComposite(A).addClass("x-grid-row-over");}},onRowOut:function(e,t){var A;if((A=this.findRowIndex(t))!==false&&A!==this.findRowIndex(e.getRelatedTarget())){this.getRowComposite(A).removeClass("x-grid-row-over");}},renderHeaders:function(){var cm=this.cm;var ct=this.templates.hcell,ht=this.templates.header,st=this.templates.hsplit;var cb=[],lb=[],sb=[],A=[],p={};for(var i=0,B=cm.getColumnCount();i<B;i++){p.cellId="x-grid-hd-0-"+i;p.splitId="x-grid-csplit-0-"+i;p.id=cm.getColumnId(i);p.title=cm.getColumnTooltip(i)||"";p.value=cm.getColumnHeader(i)||"";p.style=(this.grid.enableColumnResize===false||!cm.isResizable(i)||cm.isFixed(i))?'cursor:default':'';if(!cm.isLocked(i)){cb[cb.length]=ct.apply(p);sb[sb.length]=st.apply(p);}else {lb[lb.length]=ct.apply(p);A[A.length]=st.apply(p);}}return [ht.apply({cells:lb.join(""),splits:A.join("")}),ht.apply({cells:cb.join(""),splits:sb.join("")})];},updateHeaders:function(){var A=this.renderHeaders();this.lockedHd.update(A[0]);this.mainHd.update(A[1]);},focusRow:function(A){var x=this.scroller.dom.scrollLeft;this.focusCell(A,0,false);this.scroller.dom.scrollLeft=x;},focusCell:function(A,B,C){var el=this.ensureVisible(A,B,C);this.focusEl.alignTo(el,"tl-tl");if(Roo.isGecko){this.focusEl.focus();}else {this.focusEl.focus.defer(1,this.focusEl);}},ensureVisible:function(A,B,C){if(typeof A!="number"){A=A.rowIndex;}if(A<0&&A>=this.ds.getCount()){return null;}
+B=(B!==undefined?B:0);var cm=this.grid.colModel;while(cm.isHidden(B)){B++;}var el=this.getCell(A,B);if(!el){return null;}var c=this.scroller.dom;var D=parseInt(el.offsetTop,10);var E=parseInt(el.offsetLeft,10);var F=D+el.offsetHeight;var G=E+el.offsetWidth;var ch=c.clientHeight-this.mainHd.dom.offsetHeight;var H=parseInt(c.scrollTop,10);var I=parseInt(c.scrollLeft,10);var J=H+ch;var K=I+c.clientWidth;if(D<H){c.scrollTop=D;}else if(F>J){c.scrollTop=F-ch;}if(C!==false){if(E<I){c.scrollLeft=E;}else if(G>K){c.scrollLeft=G-c.clientWidth;}}return el;},updateColumns:function(){this.grid.stopEditing();var cm=this.grid.colModel,A=this.getColumnIds();var B=0;for(var i=0,C=cm.getColumnCount();i<C;i++){var w=cm.getColumnWidth(i);this.css.updateRule(this.colSelector+this.idToCssName(A[i]),"width",(w-this.borderWidth)+"px");this.css.updateRule(this.hdSelector+this.idToCssName(A[i]),"width",(w-this.borderWidth)+"px");}
+this.updateSplitters();},generateRules:function(cm){var A=[],B=this.idToCssName(this.grid.id)+'-cssrules';Roo.util.CSS.removeStyleSheet(B);for(var i=0,C=cm.getColumnCount();i<C;i++){var D=cm.getColumnId(i);var E='';if(cm.config[i].align){E='text-align:'+cm.config[i].align+';';}var F='';if(cm.isHidden(i)){F='display:none;';}var G="width:"+(cm.getColumnWidth(i)-this.borderWidth)+"px;";A.push(this.colSelector,D," {\n",cm.config[i].css,E,G,"\n}\n",this.hdSelector,D," {\n",E,G,"}\n",this.tdSelector,D," {\n",F,"\n}\n",this.splitSelector,D," {\n",F,"\n}\n");}return Roo.util.CSS.createStyleSheet(A.join(""),B);},updateSplitters:function(){var cm=this.cm,s=this.getSplitters();if(s){var A=0,B=true;for(var i=0,C=cm.getColumnCount();i<C;i++){if(cm.isHidden(i))continue;var w=cm.getColumnWidth(i);if(!cm.isLocked(i)&&B){A=0;B=false;}
+A+=w;s[i].style.left=(A-this.splitOffset)+"px";}}},handleHiddenChange:function(A,B,C){if(C){this.hideColumn(B);}else {this.unhideColumn(B);}},hideColumn:function(A){var B=this.getColumnId(A);this.css.updateRule(this.tdSelector+this.idToCssName(B),"display","none");this.css.updateRule(this.splitSelector+this.idToCssName(B),"display","none");if(Roo.isSafari){this.updateHeaders();}
+this.updateSplitters();this.layout();},unhideColumn:function(A){var B=this.getColumnId(A);this.css.updateRule(this.tdSelector+this.idToCssName(B),"display","");this.css.updateRule(this.splitSelector+this.idToCssName(B),"display","");if(Roo.isSafari){this.updateHeaders();}
+this.updateSplitters();this.layout();},insertRows:function(dm,A,B,C){if(A==0&&B==dm.getCount()-1){this.refresh();}else {if(!C){this.fireEvent("beforerowsinserted",this,A,B);}var s=this.getScrollState();var D=this.renderRows(A,B);this.bufferRows(D[0],this.getLockedTable(),A);this.bufferRows(D[1],this.getBodyTable(),A);this.restoreScroll(s);if(!C){this.fireEvent("rowsinserted",this,A,B);this.syncRowHeights(A,B);this.stripeRows(A);this.layout();}}},bufferRows:function(A,B,C){var D=null,E=B.rows,F=B.tBodies[0];if(C<E.length){D=E[C];}var b=document.createElement("div");b.innerHTML="<table><tbody>"+A+"</tbody></table>";var G=b.firstChild.rows;for(var i=0,H=G.length;i<H;i++){if(D){F.insertBefore(G[0],D);}else {F.appendChild(G[0]);}}
+b.innerHTML="";b=null;},deleteRows:function(dm,A,B){if(dm.getRowCount()<1){this.fireEvent("beforerefresh",this);this.mainBody.update("");this.lockedBody.update("");this.fireEvent("refresh",this);}else {this.fireEvent("beforerowsdeleted",this,A,B);var bt=this.getBodyTable();var C=bt.firstChild;var D=bt.rows;for(var E=A;E<=B;E++){C.removeChild(D[A]);}
+this.stripeRows(A);this.fireEvent("rowsdeleted",this,A,B);}},updateRows:function(A,B,C){var s=this.getScrollState();this.refresh();this.restoreScroll(s);},handleSort:function(A,B,C,D){if(!D){this.refresh();}
+this.updateHeaderSortState();},getScrollState:function(){var sb=this.scroller.dom;return {left:sb.scrollLeft,top:sb.scrollTop};},stripeRows:function(A){if(!this.grid.stripeRows||this.ds.getCount()<1){return;}
+A=A||0;var B=this.getBodyTable().rows;var C=this.getLockedTable().rows;var D=' x-grid-row-alt ';for(var i=A,E=B.length;i<E;i++){var F=B[i],G=C[i];var H=((i+1)%2==0);var I=(' '+F.className+' ').indexOf(D)!=-1;if(H==I){continue;}if(H){F.className+=" x-grid-row-alt";}else {F.className=F.className.replace("x-grid-row-alt","");}if(G){G.className=F.className;}}},restoreScroll:function(A){var sb=this.scroller.dom;sb.scrollLeft=A.left;sb.scrollTop=A.top;this.syncScroll();},syncScroll:function(){var sb=this.scroller.dom;var sh=this.mainHd.dom;var bs=this.mainBody.dom;var lv=this.lockedBody.dom;sh.scrollLeft=bs.scrollLeft=sb.scrollLeft;lv.scrollTop=bs.scrollTop=sb.scrollTop;},handleScroll:function(e){this.syncScroll();var sb=this.scroller.dom;this.grid.fireEvent("bodyscroll",sb.scrollLeft,sb.scrollTop);e.stopEvent();},handleWheel:function(e){var d=e.getWheelDelta();this.scroller.dom.scrollTop-=d*22;this.lockedBody.dom.scrollTop=this.mainBody.dom.scrollTop=this.scroller.dom.scrollTop;e.stopEvent();},renderRows:function(A,B){var g=this.grid,cm=g.colModel,ds=g.dataSource,C=g.stripeRows;var D=cm.getColumnCount();if(ds.getCount()<1){return ["",""];}var cs=[];for(var i=0;i<D;i++){var E=cm.getDataIndex(i);cs[i]={name:typeof E=='undefined'?ds.fields.get(i).name:E,renderer:cm.getRenderer(i),id:cm.getColumnId(i),locked:cm.isLocked(i)};}
+A=A||0;B=typeof B=="undefined"?ds.getCount()-1:B;var rs=ds.getRange(A,B);return this.doRender(cs,rs,ds,A,D,C);},doRender:Roo.isGecko?function(cs,rs,ds,A,B,C){var ts=this.templates,ct=ts.cell,rt=ts.row;var D="",E="",cb,F,c,p={},rp={},r,G;var H=this.grid.hasListener('rowclass');var I={};for(var j=0,J=rs.length;j<J;j++){r=rs[j];cb="";F="";G=(j+A);for(var i=0;i<B;i++){c=cs[i];p.cellId="x-grid-cell-"+G+"-"+i;p.id=c.id;p.css=p.attr="";p.value=c.renderer(r.data[c.name],p,r,G,i,ds);if(p.value==undefined||p.value==="")p.value="&#160;";if(r.dirty&&typeof r.modified[c.name]!=='undefined'){p.css+=p.css?' x-grid-dirty-cell':'x-grid-dirty-cell';}var K=ct.apply(p);if(!c.locked){cb+=K;}else {F+=K;}}var L=[];if(C&&((G+1)%2==0)){L.push("x-grid-row-alt")}if(r.dirty){L.push(" x-grid-dirty-row");}
+rp.cells=F;if(this.getRowClass){L.push(this.getRowClass(r,G));}if(H){I={record:r,rowIndex:G,rowClass:''}
+this.grid.fireEvent('rowclass',this,I);L.push(I.rowClass);}
+rp.alt=L.join(" ");E+=rt.apply(rp);rp.cells=cb;D+=rt.apply(rp);}return [E,D];}:function(cs,rs,ds,A,B,C){var ts=this.templates,ct=ts.cell,rt=ts.row;var D=[],E=[],cb,F,c,p={},rp={},r,G;var H=this.grid.hasListener('rowclass');var I={};for(var j=0,J=rs.length;j<J;j++){r=rs[j];cb=[];F=[];G=(j+A);for(var i=0;i<B;i++){c=cs[i];p.cellId="x-grid-cell-"+G+"-"+i;p.id=c.id;p.css=p.attr="";p.value=c.renderer(r.data[c.name],p,r,G,i,ds);if(p.value==undefined||p.value==="")p.value="&#160;";if(r.dirty&&typeof r.modified[c.name]!=='undefined'){p.css+=p.css?' x-grid-dirty-cell':'x-grid-dirty-cell';}var K=ct.apply(p);if(!c.locked){cb[cb.length]=K;}else {F[F.length]=K;}}var L=[];if(C&&((G+1)%2==0)){L.push("x-grid-row-alt");}if(r.dirty){L.push(" x-grid-dirty-row");}
+rp.cells=F;if(this.getRowClass){L.push(this.getRowClass(r,G));}if(H){I={record:r,rowIndex:G,rowClass:''}
+this.grid.fireEvent('rowclass',this,I);L.push(I.rowClass);}
+rp.alt=L.join(" ");rp.cells=F.join("");E[E.length]=rt.apply(rp);rp.cells=cb.join("");D[D.length]=rt.apply(rp);}return [E.join(""),D.join("")];},renderBody:function(){var A=this.renderRows();var bt=this.templates.body;return [bt.apply({rows:A[0]}),bt.apply({rows:A[1]})];},refresh:function(A){this.fireEvent("beforerefresh",this);this.grid.stopEditing();var B=this.renderBody();this.lockedBody.update(B[0]);this.mainBody.update(B[1]);if(A===true){this.updateHeaders();this.updateColumns();this.updateSplitters();this.updateHeaderSortState();}
+this.syncRowHeights();this.layout();this.fireEvent("refresh",this);},handleColumnMove:function(cm,A,B){this.indexMap=null;var s=this.getScrollState();this.refresh(true);this.restoreScroll(s);this.afterMove(B);},afterMove:function(A){if(this.enableMoveAnim&&Roo.enableFx){this.fly(this.getHeaderCell(A).firstChild).highlight(this.hlColor);}if(this.grid.dataSource.multiSort){var dm=this.grid.dataSource;var cm=this.grid.colModel;var so=[];for(var i=0;i<cm.config.length;i++){if((typeof(dm.sortToggle[cm.config[i].dataIndex])=='undefined')){continue;}
+so.push(cm.config[i].dataIndex);};dm.sortOrder=so;dm.load(dm.lastOptions);}},updateCell:function(dm,A,B){var C=this.getColumnIndexByDataIndex(B);if(typeof C=="undefined"){return;}var cm=this.grid.colModel;var D=this.getCell(A,C);var E=this.getCellText(A,C);var p={cellId:"x-grid-cell-"+A+"-"+C,id:cm.getColumnId(C),css:C==cm.getColumnCount()-1?"x-grid-col-last":""};var F=cm.getRenderer(C);var G=F(dm.getValueAt(A,B),p,A,C,dm);if(typeof G=="undefined"||G==="")G="&#160;";E.innerHTML=G;D.className=this.cellClass+" "+this.idToCssName(p.cellId)+" "+p.css;this.syncRowHeights(A,A);},calcColumnWidth:function(A,B){var C=0;if(this.grid.autoSizeHeaders){var h=this.getHeaderCellMeasure(A);C=Math.max(C,h.scrollWidth);}var tb,D;if(this.cm.isLocked(A)){tb=this.getLockedTable();D=A;}else {tb=this.getBodyTable();D=A-this.cm.getLockedCount();}if(tb&&tb.rows){var E=tb.rows;var F=Math.min(B||E.length,E.length);for(var i=0;i<F;i++){var G=E[i].childNodes[D].firstChild;C=Math.max(C,G.scrollWidth);}}return C+5;},autoSizeColumn:function(A,B,C){if(this.cm.isHidden(A)){return;}if(B){var D=this.cm.getColumnId(A);this.css.updateRule(this.colSelector+this.idToCssName(D),"width",this.grid.minColumnWidth+"px");if(this.grid.autoSizeHeaders){this.css.updateRule(this.hdSelector+this.idToCssName(D),"width",this.grid.minColumnWidth+"px");}}var E=this.calcColumnWidth(A);this.cm.setColumnWidth(A,Math.max(this.grid.minColumnWidth,E),C);if(!C){this.grid.fireEvent("columnresize",A,E);}},autoSizeColumns:function(){var cm=this.grid.colModel;var A=cm.getColumnCount();for(var i=0;i<A;i++){this.autoSizeColumn(i,true,true);}if(cm.getTotalWidth()<this.scroller.dom.clientWidth){this.fitColumns();}else {this.updateColumns();this.layout();}},fitColumns:function(A){var cm=this.grid.colModel;var B=cm.getColumnCount();var C=[];var D=0;var i,w;for(i=0;i<B;i++){if(!cm.isHidden(i)&&!cm.isFixed(i)){w=cm.getColumnWidth(i);C.push(i);C.push(w);D+=w;}}var E=Math.min(this.scroller.dom.clientWidth,this.el.getWidth());if(A){E-=17;}var F=(E-cm.getTotalWidth())/D;while(C.length){w=C.pop();i=C.pop();cm.setColumnWidth(i,Math.floor(w+w*F),true);}
+this.updateColumns();this.layout();},onRowSelect:function(A){var B=this.getRowComposite(A);B.addClass("x-grid-row-selected");},onRowDeselect:function(A){var B=this.getRowComposite(A);B.removeClass("x-grid-row-selected");},onCellSelect:function(A,B){var C=this.getCell(A,B);if(C){Roo.fly(C).addClass("x-grid-cell-selected");}},onCellDeselect:function(A,B){var C=this.getCell(A,B);if(C){Roo.fly(C).removeClass("x-grid-cell-selected");}},updateHeaderSortState:function(){var A={};if(!this.ds.multiSort){var B=this.ds.getSortState();if(!B){return;}
+A[B.field]=B.direction;this.sortState=B;}else {A=this.ds.sortToggle;}var sc=this.sortClasses;var C=this.el.select(this.headerSelector).removeClass(sc);for(var f in A){var D=this.cm.findColumnIndex(f);if(D!=-1){var E=A[f];C.item(D).addClass(sc[E=="DESC"?1:0]);}}},handleHeaderClick:function(g,A){if(this.headersDisabled){return;}var dm=g.dataSource,cm=g.colModel;if(!cm.isSortable(A)){return;}
+g.stopEditing();if(dm.multiSort){var so=[];for(var i=0;i<cm.config.length;i++){if((typeof(dm.sortToggle[cm.config[i].dataIndex])=='undefined')&&(A!=i)){continue;}
+so.push(cm.config[i].dataIndex);};dm.sortOrder=so;}
+dm.sort(cm.getDataIndex(A));},destroy:function(){if(this.colMenu){this.colMenu.removeAll();Roo.menu.MenuMgr.unregister(this.colMenu);this.colMenu.getEl().remove();delete this.colMenu;}if(this.hmenu){this.hmenu.removeAll();Roo.menu.MenuMgr.unregister(this.hmenu);this.hmenu.getEl().remove();delete this.hmenu;}if(this.grid.enableColumnMove){var A=Roo.dd.DDM.ids['gridHeader'+this.grid.getGridEl().id];if(A){for(var dd in A){if(!A[dd].config.isTarget&&A[dd].dragElId){var B=A[dd].dragElId;A[dd].unreg();Roo.get(B).remove();}else if(A[dd].config.isTarget){A[dd].proxyTop.remove();A[dd].proxyBottom.remove();A[dd].unreg();}if(Roo.dd.DDM.locationCache[dd]){delete Roo.dd.DDM.locationCache[dd];}}delete Roo.dd.DDM.ids['gridHeader'+this.grid.getGridEl().id];}}
+Roo.util.CSS.removeStyleSheet(this.idToCssName(this.grid.id)+'-cssrules');this.bind(null,null);Roo.EventManager.removeResizeListener(this.onWindowResize,this);},handleLockChange:function(){this.refresh(true);},onDenyColumnLock:function(){},onDenyColumnHide:function(){},handleHdMenuClick:function(A){var B=this.hdCtxIndex;var cm=this.cm,ds=this.ds;switch(A.id){case "asc":ds.sort(cm.getDataIndex(B),"ASC");break;case "desc":ds.sort(cm.getDataIndex(B),"DESC");break;case "lock":var lc=cm.getLockedCount();if(cm.getColumnCount(true)<=lc+1){this.onDenyColumnLock();return;}if(lc!=B){cm.setLocked(B,true,true);cm.moveColumn(B,lc);this.grid.fireEvent("columnmove",B,lc);}else {cm.setLocked(B,true);}break;case "unlock":var lc=cm.getLockedCount();if((lc-1)!=B){cm.setLocked(B,false,true);cm.moveColumn(B,lc-1);this.grid.fireEvent("columnmove",B,lc-1);}else {cm.setLocked(B,false);}break;default:B=cm.getIndexById(A.id.substr(4));if(B!=-1){if(A.checked&&cm.getColumnCount(true)<=1){this.onDenyColumnHide();return false;}
+cm.setHidden(B,A.checked);}}return true;},beforeColMenuShow:function(){var cm=this.cm,A=cm.getColumnCount();this.colMenu.removeAll();for(var i=0;i<A;i++){this.colMenu.add(new Roo.menu.CheckItem({id:"col-"+cm.getColumnId(i),text:cm.getColumnHeader(i),checked:!cm.isHidden(i),hideOnClick:false}));}},handleHdCtx:function(g,A,e){e.stopEvent();var hd=this.getHeaderCell(A);this.hdCtxIndex=A;var ms=this.hmenu.items,cm=this.cm;ms.get("asc").setDisabled(!cm.isSortable(A));ms.get("desc").setDisabled(!cm.isSortable(A));if(this.grid.enableColLock!==false){ms.get("lock").setDisabled(cm.isLocked(A));ms.get("unlock").setDisabled(!cm.isLocked(A));}
+this.hmenu.show(hd,"tl-bl");},handleHdOver:function(e){var hd=this.findHeaderCell(e.getTarget());if(hd&&!this.headersDisabled){if(this.grid.colModel.isSortable(this.getCellIndex(hd))){this.fly(hd).addClass("x-grid-hd-over");}}},handleHdOut:function(e){var hd=this.findHeaderCell(e.getTarget());if(hd){this.fly(hd).removeClass("x-grid-hd-over");}},handleSplitDblClick:function(e,t){var i=this.getCellIndex(t);if(this.grid.enableColumnResize!==false&&this.cm.isResizable(i)&&!this.cm.isFixed(i)){this.autoSizeColumn(i,true);this.layout();}},render:function(){var cm=this.cm;var A=cm.getColumnCount();if(this.grid.monitorWindowResize===true){Roo.EventManager.onWindowResize(this.onWindowResize,this,true);}var B=this.renderHeaders();var C=this.templates.body.apply({rows:""});var D=this.templates.master.apply({lockedBody:C,body:C,lockedHeader:B[0],header:B[1]});this.grid.getGridEl().dom.innerHTML=D;this.initElements();this.el.on("scroll",function(){this.el.dom.scrollTop=0;},this);this.scroller.on("scroll",this.handleScroll,this);this.lockedBody.on("mousewheel",this.handleWheel,this);this.mainBody.on("mousewheel",this.handleWheel,this);this.mainHd.on("mouseover",this.handleHdOver,this);this.mainHd.on("mouseout",this.handleHdOut,this);this.mainHd.on("dblclick",this.handleSplitDblClick,this,{delegate:"."+this.splitClass});this.lockedHd.on("mouseover",this.handleHdOver,this);this.lockedHd.on("mouseout",this.handleHdOut,this);this.lockedHd.on("dblclick",this.handleSplitDblClick,this,{delegate:"."+this.splitClass});if(this.grid.enableColumnResize!==false&&Roo.grid.SplitDragZone){new Roo.grid.SplitDragZone(this.grid,this.lockedHd.dom,this.mainHd.dom);}
+this.updateSplitters();if(this.grid.enableColumnMove&&Roo.grid.HeaderDragZone){new Roo.grid.HeaderDragZone(this.grid,this.lockedHd.dom,this.mainHd.dom);new Roo.grid.HeaderDropZone(this.grid,this.lockedHd.dom,this.mainHd.dom);}if(this.grid.enableCtxMenu!==false&&Roo.menu.Menu){this.hmenu=new Roo.menu.Menu({id:this.grid.id+"-hctx"});this.hmenu.add({id:"asc",text:this.sortAscText,cls:"xg-hmenu-sort-asc"},{id:"desc",text:this.sortDescText,cls:"xg-hmenu-sort-desc"});if(this.grid.enableColLock!==false){this.hmenu.add('-',{id:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{id:"unlock",text:this.unlockText,cls:"xg-hmenu-unlock"});}if(this.grid.enableColumnHide!==false){this.colMenu=new Roo.menu.Menu({id:this.grid.id+"-hcols-menu"});this.colMenu.on("beforeshow",this.beforeColMenuShow,this);this.colMenu.on("itemclick",this.handleHdMenuClick,this);this.hmenu.add('-',{id:"columns",text:this.columnsText,menu:this.colMenu});}
+this.hmenu.on("itemclick",this.handleHdMenuClick,this);this.grid.on("headercontextmenu",this.handleHdCtx,this);}if((this.grid.enableDragDrop||this.grid.enableDrag)&&Roo.grid.GridDragZone){this.dd=new Roo.grid.GridDragZone(this.grid,{ddGroup:this.grid.ddGroup||'GridDD'});}
+this.updateHeaderSortState();this.beforeInitialResize();this.layout(true);this.renderPhase2.defer(1,this);},renderPhase2:function(){this.refresh();if(this.grid.autoSizeColumns){this.autoSizeColumns();}},beforeInitialResize:function(){},onColumnSplitterMoved:function(i,w){this.userResized=true;var cm=this.grid.colModel;cm.setColumnWidth(i,w,true);var A=cm.getColumnId(i);this.css.updateRule(this.colSelector+this.idToCssName(A),"width",(w-this.borderWidth)+"px");this.css.updateRule(this.hdSelector+this.idToCssName(A),"width",(w-this.borderWidth)+"px");this.updateSplitters();this.layout();this.grid.fireEvent("columnresize",i,w);},syncRowHeights:function(A,B){if(this.grid.enableRowHeightSync===true&&this.cm.getLockedCount()>0){A=A||0;var C=this.getBodyTable().rows;var D=this.getLockedTable().rows;var E=C.length-1;B=Math.min(B||E,E);for(var i=A;i<=B;i++){var m=C[i],l=D[i];var h=Math.max(m.offsetHeight,l.offsetHeight);m.style.height=l.style.height=h+"px";}}},layout:function(A,B){var g=this.grid;var C=g.autoHeight;var D=16;var c=g.getGridEl(),cm=this.cm,E=g.autoExpandColumn,gv=this;if(!c.dom.offsetWidth){if(A){this.lockedWrap.show();this.mainWrap.show();}return;}var F=this.cm.isLocked(0);var G=this.headerPanel.getHeight();var H=this.footerPanel.getHeight();if(C){var ch=this.getBodyTable().offsetHeight+G+H+this.mainHd.getHeight();var I=ch+c.getBorderWidth("tb");if(g.maxHeight){I=Math.min(g.maxHeight,I);}
+c.setHeight(I);}if(g.autoWidth){c.setWidth(cm.getTotalWidth()+c.getBorderWidth('lr'));}var s=this.scroller;var J=c.getSize(true);this.el.setSize(J.width,J.height);this.headerPanel.setWidth(J.width);this.footerPanel.setWidth(J.width);var K=this.mainHd.getHeight();var vw=J.width;var vh=J.height-(G+H);s.setSize(vw,vh);var bt=this.getBodyTable();var L=F?Math.max(this.getLockedTable().offsetWidth,this.lockedHd.dom.firstChild.offsetWidth):0;var M=bt.offsetHeight;var N=L+bt.offsetWidth;var O=false,P=false;this.scrollSizer.setSize(N,M+K);var lw=this.lockedWrap,mw=this.mainWrap;var lb=this.lockedBody,mb=this.mainBody;setTimeout(function(){var t=s.dom.offsetTop;var w=s.dom.clientWidth,h=s.dom.clientHeight;lw.setTop(t);lw.setSize(L,h);mw.setLeftTop(L,t);mw.setSize(w-L,h);lb.setHeight(h-K);mb.setHeight(h-K);if(B!==true&&!gv.userResized&&E){var ci=cm.getIndexById(E);if(ci<0){ci=cm.findColumnIndex(E);}
+ci=Math.max(0,ci);var Q=cm.getColumnId(ci);var tw=cm.getTotalWidth(false);var R=cm.getColumnWidth(ci);var cw=Math.min(Math.max(((w-tw)+R-2)-(w<=s.dom.offsetWidth?0:18),g.autoExpandMin),g.autoExpandMax);if(R!=cw){cm.setColumnWidth(ci,cw,true);gv.css.updateRule(gv.colSelector+gv.idToCssName(Q),"width",(cw-gv.borderWidth)+"px");gv.css.updateRule(gv.hdSelector+gv.idToCssName(Q),"width",(cw-gv.borderWidth)+"px");gv.updateSplitters();gv.layout(false,true);}}if(A){lw.show();mw.show();}},10);},onWindowResize:function(){if(!this.grid.monitorWindowResize||this.grid.autoHeight){return;}
+this.layout();},appendFooter:function(A){return null;},sortAscText:"Sort Ascending",sortDescText:"Sort Descending",lockText:"Lock Column",unlockText:"Unlock Column",columnsText:"Columns"});Roo.grid.GridView.ColumnDragZone=function(A,hd){Roo.grid.GridView.ColumnDragZone.superclass.constructor.call(this,A,hd,null);this.proxy.el.addClass('x-grid3-col-dd');};Roo.extend(Roo.grid.GridView.ColumnDragZone,Roo.grid.HeaderDragZone,{handleMouseDown:function(e){},callHandleMouseDown:function(e){Roo.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this,e);}});
+//Roo/grid/SplitDragZone.js
+Roo.grid.SplitDragZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.proxy=this.view.resizeProxy;Roo.grid.SplitDragZone.superclass.constructor.call(this,hd,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Roo.id(this.proxy.dom),resizeFrame:false});this.setHandleElId(Roo.id(hd));this.setOuterHandleElId(Roo.id(B));this.scroll=false;};Roo.extend(Roo.grid.SplitDragZone,Roo.dd.DDProxy,{fly:Roo.Element.fly,b4StartDrag:function(x,y){this.view.headersDisabled=true;this.proxy.setHeight(this.view.mainWrap.getHeight());var w=this.cm.getColumnWidth(this.cellIndex);var A=Math.max(w-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(A,1000);this.setYConstraint(0,0);this.minX=x-A;this.maxX=x+1000;this.startPos=x;Roo.dd.DDProxy.prototype.b4StartDrag.call(this,x,y);},handleMouseDown:function(e){ev=Roo.EventObject.setEvent(e);var t=this.fly(ev.getTarget());if(t.hasClass("x-grid-split")){this.cellIndex=this.view.getCellIndex(t.dom);this.split=t.dom;this.cm=this.grid.colModel;if(this.cm.isResizable(this.cellIndex)&&!this.cm.isFixed(this.cellIndex)){Roo.grid.SplitDragZone.superclass.handleMouseDown.apply(this,arguments);}}},endDrag:function(e){this.view.headersDisabled=false;var A=Math.max(this.minX,Roo.lib.Event.getPageX(e));var B=A-this.startPos;this.view.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+B);},autoOffset:function(){this.setDelta(0,0);}});
+//Roo/grid/GridDragZone.js
+Roo.grid.GridDragZone=function(A,B){this.view=A.getView();Roo.grid.GridDragZone.superclass.constructor.call(this,this.view.mainBody.dom,B);if(this.view.lockedBody){this.setHandleElId(Roo.id(this.view.mainBody.dom));this.setOuterHandleElId(Roo.id(this.view.lockedBody.dom));}
+this.scroll=false;this.grid=A;this.ddel=document.createElement('div');this.ddel.className='x-grid-dd-wrap';};Roo.extend(Roo.grid.GridDragZone,Roo.dd.DragZone,{ddGroup:"GridDD",getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var A=this.view.findRowIndex(t);if(A!==false){var sm=this.grid.selModel;if(e.hasModifier()){sm.handleMouseDown(e,t);}return {grid:this.grid,ddel:this.ddel,rowIndex:A,selections:sm.getSelections()};}return false;},onInitDrag:function(e){var A=this.dragData;this.ddel.innerHTML=this.grid.getDragDropText();this.proxy.update(this.ddel);},afterRepair:function(){this.dragging=false;},getRepairXY:function(e,A){return false;},onEndDrag:function(A,e){},onValidDrop:function(dd,e,id){this.hideProxy();},beforeInvalidDrop:function(e,id){}});
+//Roo/grid/ColumnModel.js
+Roo.grid.ColumnModel=function(A){this.config=A;this.lookup={};for(var i=0,B=A.length;i<B;i++){var c=A[i];if(typeof c.dataIndex=="undefined"){c.dataIndex=i;}if(typeof c.renderer=="string"){c.renderer=Roo.util.Format[c.renderer];}if(typeof c.id=="undefined"){c.id=Roo.id();}if(c.editor&&c.editor.xtype){c.editor=Roo.factory(c.editor,Roo.grid);}if(c.editor&&c.editor.isFormField){c.editor=new Roo.grid.GridEditor(c.editor);}
+this.lookup[c.id]=c;}
+this.defaultWidth=100;this.defaultSortable=false;this.addEvents({"widthchange":true,"headerchange":true,"hiddenchange":true,"columnmoved":true,"columnlockchange":true});Roo.grid.ColumnModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.ColumnModel,Roo.util.Observable,{getColumnId:function(A){return this.config[A].id;},getColumnById:function(id){return this.lookup[id];},getColumnByDataIndex:function(A){var B=this.findColumnIndex(A);return B>-1?this.config[B]:false;},getIndexById:function(id){for(var i=0,A=this.config.length;i<A;i++){if(this.config[i].id==id){return i;}}return -1;},findColumnIndex:function(A){for(var i=0,B=this.config.length;i<B;i++){if(this.config[i].dataIndex==A){return i;}}return -1;},moveColumn:function(A,B){var c=this.config[A];this.config.splice(A,1);this.config.splice(B,0,c);this.dataMap=null;this.fireEvent("columnmoved",this,A,B);},isLocked:function(A){return this.config[A].locked===true;},setLocked:function(A,B,C){if(this.isLocked(A)==B){return;}
+this.config[A].locked=B;if(!C){this.fireEvent("columnlockchange",this,A,B);}},getTotalLockedWidth:function(){var A=0;for(var i=0;i<this.config.length;i++){if(this.isLocked(i)&&!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}return A;},getLockedCount:function(){for(var i=0,A=this.config.length;i<A;i++){if(!this.isLocked(i)){return i;}}},getColumnCount:function(A){if(A===true){var c=0;for(var i=0,B=this.config.length;i<B;i++){if(!this.isHidden(i)){c++;}}return c;}return this.config.length;},getColumnsBy:function(fn,A){var r=[];for(var i=0,B=this.config.length;i<B;i++){var c=this.config[i];if(fn.call(A||this,c,i)===true){r[r.length]=c;}}return r;},isSortable:function(A){if(typeof this.config[A].sortable=="undefined"){return this.defaultSortable;}return this.config[A].sortable;},getRenderer:function(A){if(!this.config[A].renderer){return Roo.grid.ColumnModel.defaultRenderer;}return this.config[A].renderer;},setRenderer:function(A,fn){this.config[A].renderer=fn;},getColumnWidth:function(A){return this.config[A].width*1||this.defaultWidth;},setColumnWidth:function(A,B,C){this.config[A].width=B;this.totalWidth=null;if(!C){this.fireEvent("widthchange",this,A,B);}},getTotalWidth:function(A){if(!this.totalWidth){this.totalWidth=0;for(var i=0,B=this.config.length;i<B;i++){if(A||!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}}return this.totalWidth;},getColumnHeader:function(A){return this.config[A].header;},setColumnHeader:function(A,B){this.config[A].header=B;this.fireEvent("headerchange",this,A,B);},getColumnTooltip:function(A){return this.config[A].tooltip;},setColumnTooltip:function(A,B){this.config[A].tooltip=B;},getDataIndex:function(A){return this.config[A].dataIndex;},setDataIndex:function(A,B){this.config[A].dataIndex=B;},isCellEditable:function(A,B){return (this.config[A].editable||(typeof this.config[A].editable=="undefined"&&this.config[A].editor))?true:false;},getCellEditor:function(A,B){return this.config[A].editor;},setEditable:function(A,B){this.config[A].editable=B;},isHidden:function(A){return this.config[A].hidden;},isFixed:function(A){return this.config[A].fixed;},isResizable:function(A){return A>=0&&this.config[A].resizable!==false&&this.config[A].fixed!==true;},setHidden:function(A,B){this.config[A].hidden=B;this.totalWidth=null;this.fireEvent("hiddenchange",this,A,B);},setEditor:function(A,B){this.config[A].editor=B;}});Roo.grid.ColumnModel.defaultRenderer=function(A){if(typeof A=="string"&&A.length<1){return "&#160;";}return A;};Roo.grid.DefaultColumnModel=Roo.grid.ColumnModel;
+//Roo/grid/AbstractSelectionModel.js
+Roo.grid.AbstractSelectionModel=function(){this.locked=false;Roo.grid.AbstractSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.AbstractSelectionModel,Roo.util.Observable,{init:function(A){this.grid=A;this.initEvents();},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;}});
+//Roo/grid/RowSelectionModel.js
+Roo.grid.RowSelectionModel=function(A){Roo.apply(this,A);this.selections=new Roo.util.MixedCollection(false,function(o){return o.id;});this.last=false;this.lastActive=false;this.addEvents({"selectionchange":true,"afterselectionchange":true,"beforerowselect":true,"rowselect":true,"rowdeselect":true});Roo.grid.RowSelectionModel.superclass.constructor.call(this);this.locked=false;};Roo.extend(Roo.grid.RowSelectionModel,Roo.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("mousedown",this.handleMouseDown,this);}else {this.grid.on("rowclick",this.handleDragableRowClick,this);}
+this.rowNav=new Roo.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
+this.fireEvent("afterselectionchange",this);},"down":function(e){if(!e.shiftKey){this.selectNext(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
+this.fireEvent("afterselectionchange",this);},scope:this});var A=this.grid.view;A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);A.on("rowremoved",this.onRemove,this);},onRefresh:function(){var ds=this.grid.dataSource,i,v=this.grid.view;var s=this.selections;s.each(function(r){if((i=ds.indexOfId(r.id))!=-1){v.onRowSelect(i);}else {s.remove(r);}});},onRemove:function(v,A,r){this.selections.remove(r);},onRowUpdated:function(v,A,r){if(this.isSelected(r)){v.onRowSelect(A);}},selectRecords:function(A,B){if(!B){this.clearSelections();}var ds=this.grid.dataSource;for(var i=0,C=A.length;i<C;i++){this.selectRow(ds.indexOf(A[i]),true);}},getCount:function(){return this.selections.length;},selectFirstRow:function(){this.selectRow(0);},selectLastRow:function(A){this.selectRow(this.grid.dataSource.getCount()-1,A);},selectNext:function(A){if(this.last!==false&&(this.last+1)<this.grid.dataSource.getCount()){this.selectRow(this.last+1,A);this.grid.getView().focusRow(this.last);}},selectPrevious:function(A){if(this.last){this.selectRow(this.last-1,A);this.grid.getView().focusRow(this.last);}},getSelections:function(){return [].concat(this.selections.items);},getSelected:function(){return this.selections.itemAt(0);},clearSelections:function(A){if(this.locked)return;if(A!==true){var ds=this.grid.dataSource;var s=this.selections;s.each(function(r){this.deselectRow(ds.indexOfId(r.id));},this);s.clear();}else {this.selections.clear();}
+this.last=false;},selectAll:function(){if(this.locked)return;this.selections.clear();for(var i=0,A=this.grid.dataSource.getCount();i<A;i++){this.selectRow(i,true);}},hasSelection:function(){return this.selections.length>0;},isSelected:function(A){var r=typeof A=="number"?this.grid.dataSource.getAt(A):A;return (r&&this.selections.key(r.id)?true:false);},isIdSelected:function(id){return (this.selections.key(id)?true:false);},handleMouseDown:function(e,t){var A=this.grid.getView(),B;if(this.isLocked()||(B=A.findRowIndex(t))===false){return;};if(e.shiftKey&&this.last!==false){var C=this.last;this.selectRange(C,B,e.ctrlKey);this.last=C;A.focusRow(B);}else {var D=this.isSelected(B);if(e.button!==0&&D){A.focusRow(B);}else if(e.ctrlKey&&D){this.deselectRow(B);}else if(!D){this.selectRow(B,e.button===0&&(e.ctrlKey||e.shiftKey));A.focusRow(B);}}
+this.fireEvent("afterselectionchange",this);},handleDragableRowClick:function(A,B,e){if(e.button===0&&!e.shiftKey&&!e.ctrlKey){this.selectRow(B,false);A.view.focusRow(B);this.fireEvent("afterselectionchange",this);}},selectRows:function(A,B){if(!B){this.clearSelections();}for(var i=0,C=A.length;i<C;i++){this.selectRow(A[i],true);}},selectRange:function(A,B,C){if(this.locked)return;if(!C){this.clearSelections();}if(A<=B){for(var i=A;i<=B;i++){this.selectRow(i,true);}}else {for(var i=A;i>=B;i--){this.selectRow(i,true);}}},deselectRange:function(A,B,C){if(this.locked)return;for(var i=A;i<=B;i++){this.deselectRow(i,C);}},selectRow:function(A,B,C){if(this.locked||(A<0||A>=this.grid.dataSource.getCount()))return;if(this.fireEvent("beforerowselect",this,A,B)!==false){if(!B||this.singleSelect){this.clearSelections();}var r=this.grid.dataSource.getAt(A);this.selections.add(r);this.last=this.lastActive=A;if(!C){this.grid.getView().onRowSelect(A);}
+this.fireEvent("rowselect",this,A,r);this.fireEvent("selectionchange",this);}},deselectRow:function(A,B){if(this.locked)return;if(this.last==A){this.last=false;}if(this.lastActive==A){this.lastActive=false;}var r=this.grid.dataSource.getAt(A);this.selections.remove(r);if(!B){this.grid.getView().onRowDeselect(A);}
+this.fireEvent("rowdeselect",this,A);this.fireEvent("selectionchange",this);},restoreLast:function(){if(this._last){this.last=this._last;}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(k==e.TAB){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}}else if(k==e.ENTER&&!e.ctrlKey){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row-1,ed.col,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row+1,ed.col,1,this.acceptsNav,this);}}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing(B[0],B[1]);}}});
+//Roo/grid/CellSelectionModel.js
+Roo.grid.CellSelectionModel=function(A){Roo.apply(this,A);this.selection=null;this.addEvents({"beforecellselect":true,"cellselect":true,"selectionchange":true,"tabend":true});Roo.grid.CellSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.CellSelectionModel,Roo.grid.AbstractSelectionModel,{enter_is_tab:false,initEvents:function(){this.grid.on("mousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Roo.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this);}},beforeEdit:function(e){this.select(e.row,e.column,false,true,e.record);},onRowUpdated:function(v,A,r){if(this.selection&&this.selection.record==r){v.onCellSelect(A,this.selection.cell[1]);}},onViewChange:function(){this.clearSelections(true);},getSelectedCell:function(){return this.selection?this.selection.cell:null;},clearSelections:function(A){var s=this.selection;if(s){if(A!==true){this.grid.view.onCellDeselect(s.cell[0],s.cell[1]);}
+this.selection=null;this.fireEvent("selectionchange",this,null);}},hasSelection:function(){return this.selection?true:false;},handleMouseDown:function(e,t){var v=this.grid.getView();if(this.isLocked()){return;};var A=v.findRowIndex(t);var B=v.findCellIndex(t);if(A!==false&&B!==false){this.select(A,B);}},select:function(A,B,C,D,r){if(this.fireEvent("beforecellselect",this,A,B)!==false){this.clearSelections();r=r||this.grid.dataSource.getAt(A);this.selection={record:r,cell:[A,B]};if(!C){var v=this.grid.getView();v.onCellSelect(A,B);if(D!==true){v.focusCell(A,B);}}
+this.fireEvent("cellselect",this,A,B);this.fireEvent("selectionchange",this,this.selection);}},isSelectable:function(A,B,cm){return !cm.isHidden(B);},handleKeyDown:function(e){if(!e.isNavKeyPress()){return;}var g=this.grid,s=this.selection;if(!s){e.stopEvent();var A=g.walkCells(0,0,1,this.isSelectable,this);if(A){this.select(A[0],A[1]);}return;}var sm=this;var B=function(D,E,F){return g.walkCells(D,E,F,sm.isSelectable,sm);};var k=e.getKey(),r=s.cell[0],c=s.cell[1];var C;switch(k){case e.TAB:if(g.isEditor&&g.editing){return;}if(e.shiftKey){C=B(r,c-1,-1);}else {C=B(r,c+1,1);}break;case e.DOWN:C=B(r+1,c,1);break;case e.UP:C=B(r-1,c,-1);break;case e.RIGHT:C=B(r,c+1,1);break;case e.LEFT:C=B(r,c-1,-1);break;case e.ENTER:if(g.isEditor&&!g.editing){g.startEditing(r,c);e.stopEvent();return;}break;};if(C){this.select(C[0],C[1]);e.stopEvent();}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor,C=false;if(this.enter_is_tab&&k==e.ENTER){k=e.TAB;}if(k==e.TAB){if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else {B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);C=true;}
+e.stopEvent();}else if(k==e.ENTER&&!e.ctrlKey){ed.completeEdit();e.stopEvent();B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing.defer(100,g,[B[0],B[1]]);}else if(C){this.fireEvent.defer(100,this,['tabend',this]);}}});
+//Roo/grid/EditorGrid.js
+Roo.grid.EditorGrid=function(A,B){Roo.grid.EditorGrid.superclass.constructor.call(this,A,B);this.getGridEl().addClass("xedit-grid");if(!this.selModel){this.selModel=new Roo.grid.CellSelectionModel();}
+this.activeEditor=null;this.addEvents({"beforeedit":true,"afteredit":true,"validateedit":true});this.on("bodyscroll",this.stopEditing,this);this.on(this.clicksToEdit==1?"cellclick":"celldblclick",this.onCellDblClick,this);};Roo.extend(Roo.grid.EditorGrid,Roo.grid.Grid,{clicksToEdit:2,isEditor:true,trackMouseOver:false,onCellDblClick:function(g,A,B){this.startEditing(A,B);},onEditComplete:function(ed,A,B){this.editing=false;this.activeEditor=null;ed.un("specialkey",this.selModel.onEditorKey,this.selModel);var r=ed.record;var C=this.colModel.getDataIndex(ed.col);var e={grid:this,record:r,field:C,originalValue:B,value:A,row:ed.row,column:ed.col,cancel:false,editor:ed};var D=Roo.get(this.view.getCell(ed.row,ed.col))
+D.show();if(String(A)!==String(B)){if(this.fireEvent("validateedit",e)!==false&&!e.cancel){r.set(C,e.value);if(ed.field.displayField&&ed.field.name){r.set(ed.field.name,ed.field.el.dom.value);}delete e.cancel;this.fireEvent("afteredit",e);}}else {this.fireEvent("afteredit",e);}
+this.view.focusCell(ed.row,ed.col);},startEditing:function(A,B){this.stopEditing();if(this.colModel.isCellEditable(B,A)){this.view.ensureVisible(A,B,true);var r=this.dataSource.getAt(A);var C=this.colModel.getDataIndex(B);var D=Roo.get(this.view.getCell(A,B));var e={grid:this,record:r,field:C,value:r.data[C],row:A,column:B,cancel:false};if(this.fireEvent("beforeedit",e)!==false&&!e.cancel){this.editing=true;var ed=this.colModel.getCellEditor(B,A);if(!ed){return;}if(!ed.rendered){ed.render(ed.parentEl||document.body);}
+ed.field.reset();D.hide();(function(){ed.row=A;ed.col=B;ed.record=r;ed.on("complete",this.onEditComplete,this,{single:true});ed.on("specialkey",this.selModel.onEditorKey,this.selModel);this.activeEditor=ed;var v=r.data[C];ed.startEdit(this.view.getCell(A,B),v);if(ed.field.displayField&&ed.field.name){ed.field.el.dom.value=r.data[ed.field.name];}}).defer(50,this);}}},stopEditing:function(){if(this.activeEditor){this.activeEditor.completeEdit();}
+this.activeEditor=null;}});
+//Roo/grid/GridEditor.js
+Roo.grid.GridEditor=function(A,B){if(!B&&A.field){B=A;A=Roo.factory(B.field,Roo.form);}
+Roo.grid.GridEditor.superclass.constructor.call(this,A,B);A.monitorTab=false;};Roo.extend(Roo.grid.GridEditor,Roo.Editor,{alignment:"tl-tl",autoSize:"width",hideEl:false,cls:"x-small-editor x-grid-editor",shim:false,shadow:"frame"});
+//Roo/grid/PropertyGrid.js
+Roo.grid.PropertyRecord=Roo.data.Record.create([{name:'name',type:'string'},'value']);Roo.grid.PropertyStore=function(A,B){this.grid=A;this.store=new Roo.data.Store({recordType:Roo.grid.PropertyRecord});this.store.on('update',this.onUpdate,this);if(B){this.setSource(B);}
+Roo.grid.PropertyStore.superclass.constructor.call(this);};Roo.extend(Roo.grid.PropertyStore,Roo.util.Observable,{setSource:function(o){this.source=o;this.store.removeAll();var A=[];for(var k in o){if(this.isEditableValue(o[k])){A.push(new Roo.grid.PropertyRecord({name:k,value:o[k]},k));}}
+this.store.loadRecords({records:A},{},true);},onUpdate:function(ds,A,B){if(B==Roo.data.Record.EDIT){var v=A.data['value'];var C=A.modified['value'];if(this.grid.fireEvent('beforepropertychange',this.source,A.id,v,C)!==false){this.source[A.id]=v;A.commit();this.grid.fireEvent('propertychange',this.source,A.id,v,C);}else {A.reject();}}},getProperty:function(A){return this.store.getAt(A);},isEditableValue:function(A){if(A&&A instanceof Date){return true;}else if(typeof A=='object'||typeof A=='function'){return false;}return true;},setValue:function(A,B){this.source[A]=B;this.store.getById(A).set('value',B);},getSource:function(){return this.source;}});Roo.grid.PropertyColumnModel=function(A,B){this.grid=A;var g=Roo.grid;g.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,sortable:true,dataIndex:'name',id:'name'},{header:this.valueText,resizable:false,dataIndex:'value',id:'value'}]);this.store=B;this.bselect=Roo.DomHelper.append(document.body,{tag:'select',style:'display:none',cls:'x-grid-editor',children:[{tag:'option',value:'true',html:'true'},{tag:'option',value:'false',html:'false'}]});Roo.id(this.bselect);var f=Roo.form;this.editors={'date':new g.GridEditor(new f.DateField({selectOnFocus:true})),'string':new g.GridEditor(new f.TextField({selectOnFocus:true})),'number':new g.GridEditor(new f.NumberField({selectOnFocus:true,style:'text-align:left;'})),'int':new g.GridEditor(new f.NumberField({selectOnFocus:true,allowDecimals:false,style:'text-align:left;'})),'boolean':new g.GridEditor(new f.Field({el:this.bselect,selectOnFocus:true}))};this.renderCellDelegate=this.renderCell.createDelegate(this);this.renderPropDelegate=this.renderProp.createDelegate(this);};Roo.extend(Roo.grid.PropertyColumnModel,Roo.grid.ColumnModel,{nameText:'Name',valueText:'Value',dateFormat:'m/j/Y',renderDate:function(A){return A.dateFormat(this.dateFormat);},renderBool:function(A){return A?'true':'false';},isCellEditable:function(A,B){return A==1;},getRenderer:function(A){return A==1?this.renderCellDelegate:this.renderPropDelegate;},renderProp:function(v){return this.getPropertyName(v);},renderCell:function(A){var rv=A;if(A instanceof Date){rv=this.renderDate(A);}else if(typeof A=='boolean'){rv=this.renderBool(A);}return Roo.util.Format.htmlEncode(rv);},getPropertyName:function(A){var pn=this.grid.propertyNames;return pn&&pn[A]?pn[A]:A;},getCellEditor:function(A,B){var p=this.store.getProperty(B);var n=p.data['name'],C=p.data['value'];if(typeof(this.grid.customEditors[n])=='string'){return this.editors[this.grid.customEditors[n]];}if(typeof(this.grid.customEditors[n])!='undefined'){return this.grid.customEditors[n];}if(C instanceof Date){return this.editors['date'];}else if(typeof C=='number'){return this.editors['number'];}else if(typeof C=='boolean'){return this.editors['boolean'];}else {return this.editors['string'];}}});Roo.grid.PropertyGrid=function(A,B){B=B||{};var C=new Roo.grid.PropertyStore(this);this.store=C;var cm=new Roo.grid.PropertyColumnModel(this,C);C.store.sort('name','ASC');Roo.grid.PropertyGrid.superclass.constructor.call(this,A,Roo.apply({ds:C.store,cm:cm,enableColLock:false,enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1},B));this.getGridEl().addClass('x-props-grid');this.lastEditRow=null;this.on('columnresize',this.onColumnResize,this);this.addEvents({"beforepropertychange":true,"propertychange":true});this.customEditors=this.customEditors||{};};Roo.extend(Roo.grid.PropertyGrid,Roo.grid.EditorGrid,{render:function(){Roo.grid.PropertyGrid.superclass.render.call(this);this.autoSize.defer(100,this);},autoSize:function(){Roo.grid.PropertyGrid.superclass.autoSize.call(this);if(this.view){this.view.fitColumns();}},onColumnResize:function(){this.colModel.setColumnWidth(1,this.container.getWidth(true)-this.colModel.getColumnWidth(0));this.autoSize();},setSource:function(A){this.store.setSource(A);},getSource:function(){return this.store.getSource();}});
+//Roo/LoadMask.js
+Roo.LoadMask=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(this.store){this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoadException,this);this.removeMask=false;}else {var um=this.el.getUpdateManager();um.showLoadIndicator=false;um.on('beforeupdate',this.onBeforeLoad,this);um.on('update',this.onLoad,this);um.on('failure',this.onLoad,this);this.removeMask=true;}};Roo.LoadMask.prototype={msg:'Loading...',msgCls:'x-mask-loading',disabled:false,disable:function(){this.disabled=true;},enable:function(){this.disabled=false;},onLoadException:function(){if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg);}
+this.el.unmask(this.removeMask);},onLoad:function(){this.el.unmask(this.removeMask);},onBeforeLoad:function(){if(!this.disabled){this.el.mask(this.msg,this.msgCls);}},destroy:function(){if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoadException,this);}else {var um=this.el.getUpdateManager();um.un('beforeupdate',this.onBeforeLoad,this);um.un('update',this.onLoad,this);um.un('failure',this.onLoad,this);}}};
+//Roo/XTemplate.js
+Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,arguments);var s=this.html;s=['<tpl>',s,'</tpl>'].join('');var re=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var A=/^<tpl\b[^>]*?for="(.*?)"/;var B=/^<tpl\b[^>]*?if="(.*?)"/;var C=/^<tpl\b[^>]*?exec="(.*?)"/;var m,id=0;var D=[];while(m=s.match(re)){var m2=m[0].match(A);var m3=m[0].match(B);var m4=m[0].match(C);var E=null,fn=null,F=null;var G=m2&&m2[1]?m2[1]:'';if(m3){E=m3&&m3[1]?m3[1]:null;if(E){fn=new Function('values','parent','with(values){ return '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(m4){E=m4&&m4[1]?m4[1]:null;if(E){F=new Function('values','parent','with(values){ '+(Roo.util.Format.htmlDecode(E))+'; }');}}if(G){switch(G){case '.':G=new Function('values','parent','with(values){ return values; }');break;case '..':G=new Function('values','parent','with(values){ return parent; }');break;default:G=new Function('values','parent','with(values){ return '+G+'; }');}}
+D.push({id:id,target:G,exec:F,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}for(var i=D.length-1;i>=0;--i){this.compileTpl(D[i]);}
+this.master=D[D.length-1];this.tpls=D;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){C[C.length]=t.compiled.call(this,vs[i],B);}return C.join('');}return t.compiled.call(this,vs,B);},compileTpl:function(A){var fm=Roo.util.Format;var B=this.disableFormats!==true;var C=Roo.isGecko?"+":",";var fn=function(m,E,F,G){if(E.substr(0,4)=='xtpl'){return "'"+C+'this.applySubTemplate('+E.substr(4)+', values, parent)'+C+"'";}var v;if(E.indexOf('.')!=-1){v=E;}else {v="values['"+E+"']";}if(F&&B){G=G?','+G:"";if(F.substr(0,5)!="this."){F="fm."+F+'(';}else {F='this.call("'+F.substr(5)+'", ';G=", values";}}else {G='';F="("+v+" === undefined ? '' : ";}return "'"+C+F+v+G+")"+C+"'";};var D;if(Roo.isGecko){D="tpl.compiled = function(values, parent){ return '"+A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {D=["tpl.compiled = function(values, parent){ return ['"];D.push(A.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));D.push("'].join('');};");D=D.join('');}eval(D);return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{});var s=this.subs;},apply:function(){return this.applyTemplate.apply(this,arguments);},compile:function(){return this;}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
+//Roo/XComponent.js
+Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true,'buildcomplete':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;}
+Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,render:function(el){el=el||false;var hp=this.parent?1:0;if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1)
+this.parent=false;el=Roo.get(A);if(!el){Roo.log("Warning - element can not be found :#"+A);return;}}if(!this.parent){el=el?Roo.get(el):false;this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})}}var B=this.tree();B.region=B.region||this.region;this.el=this.parent.el.addxtype(B);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;}});Roo.apply(Roo.XComponent,{buildCompleted:false,topModule:false,modules:[],elmodules:[],register:function(A){this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;}var ar=str.split('.');var rt,o;rt=ar.shift();try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;}
+Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+str;}
+o=o[e];});return o;},preBuild:function(){var _t=this;Roo.each(this.modules,function(A){var B=A.parent;try{A.parent=this.toObject(B);}catch(e){Roo.log(e.toString());return;}if(!A.parent){this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(A.parent.constructor!=Roo.XComponent){Roo.log("Object Parent is not instance of XComponent:"+A.name)}if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}
+A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if((!this.topModule||!this.topModule.modules)&&!this.elmodules.length){throw "No top level modules to build";}var C=this.topModule?[this.topModule]:[];Roo.each(this.elmodules,function(e){C.push(e)});var D=function(m){C.push(m);if(m.modules){m.modules.keySort('ASC',B);m.modules.each(D);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule){this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);}return C;},build:function(){this.preBuild();var A=this.buildOrder();if(!A.length){throw "NO modules!!!";}
+Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();if(C.topModule){C.topModule.fireEvent('buildcomplete',C.topModule);}return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();}
+m.render();return D.defer(10,C);}
+D.defer(1,C);}});
+//Roo/Login.js
+Roo.Login=function(A){this.addEvents({'refreshed':true});Roo.apply(this,A);Roo.onReady(function(){this.onLoad();},this);Roo.Login.superclass.constructor.call(this,this);}
+Roo.extend(Roo.Login,Roo.LayoutDialog,{method:'POST',url:'',user:false,checkFails:0,intervalID:0,onLoad:function(){if(Roo.get('loading')){Roo.get('loading').remove();}
+this.check({success:function(A,B){var C=this.processResponse(A);this.checkFails=0;if(!C.success){this.checkFails=5;return this.failure(A,B);}if(!C.data.id){return this.show();}
+this.fillAuth(C.data);this.checkFails=0;Roo.XComponent.build();},failure:this.show});},check:function(A){if(A.again){this.checkFails++;}else {this.checkFails=0;}var B=this;if(this.sending){if(this.checkFails>4){Roo.MessageBox.alert("Error","Error getting authentication status. - try reloading, or wait a while",function(){B.sending=false;});return;}
+A.again=true;B.check.defer(10000,B,[A]);return;}
+this.sending=true;Roo.Ajax.request({url:this.url,params:{getAuthUser:true},method:this.method,success:A.success||this.success,failure:A.failure||this.failure,scope:this,callCfg:A});},logout:function(){window.onbeforeunload=function(){};this.user=false;var A=this;Roo.Ajax.request({url:this.url,params:{logout:1},method:'GET',failure:function(){Roo.MessageBox.alert("Error","Error logging out. - continuing anyway.",function(){document.location=document.location.toString()+'?ts='+Math.random();});},success:function(){A.user=false;this.checkFails=0;document.location=document.location.toString()+'?ts='+Math.random();}});},processResponse:function(A){var B='';try{B=Roo.decode(A.responseText);if(typeof(B)!='object'){B={success:false,errorMsg:B,errors:true};}if(typeof(B.success)=='undefined'){B.success=false;}}catch(e){res={success:false,errorMsg:response.responseText,errors:true};}return B;},success:function(A,B){this.sending=false;var C=this.processResponse(A);if(!C.success){return this.failure(A,B);}if(!C.data||!C.data.id){return this.failure(A,B);}
+this.fillAuth(C.data);this.checkFails=0;},failure:function(A,B){this.authUser=-1;this.sending=false;var C=this.processResponse(A);if(this.checkFails>2){Roo.MessageBox.alert("Error",C.errorMsg?C.errorMsg:"Error getting authentication status. - try reloading");return;}
+B.callCfg.again=true;this.check.defer(1000,this,[B.callCfg]);return;},fillAuth:function(au){this.startAuthCheck();this.authUserId=au.id;this.authUser=au;this.lastChecked=new Date();this.fireEvent('refreshed',au);au.lang=au.lang||'en';Roo.state.Manager.set(this.realm+'lang',au.lang);this.switchLang(au.lang);if(this.authUserId<0){Roo.MessageBox.alert("Warning","This is an open system - please set up a admin user with a password.");}},startAuthCheck:function(){if(this.intervalID){return false;}var A=this;this.intervalID=window.setInterval(function(){A.check(false);},120000);},switchLang:function(A){_T=typeof(_T)=='undefined'?false:_T;if(!_T||!A.length){return;}if(!_T&&A!='en'){Roo.MessageBox.alert("Sorry","Language not available yet ("+A+')');return;}if(typeof(_T.en)=='undefined'){_T.en={};Roo.apply(_T.en,_T);}if(typeof(_T[A])=='undefined'){Roo.MessageBox.alert("Sorry","Language not available yet ("+A+')');return;}
+Roo.apply(_T,_T[A]);var B=this;},title:"Login",modal:true,width:350,height:180,shadow:true,minWidth:200,minHeight:180,closable:false,draggable:false,collapsible:false,resizable:false,center:{autoScroll:false,titlebar:false,hideTabs:true,closeOnTab:true,alwaysShowTabs:false},listeners:{show:function(A){this.form=this.layout.getRegion('center').activePanel.form;this.form.dialog=A;this.buttons[0].form=this.form;this.buttons[0].dialog=A;this.buttons[1].form=this.form;this.buttons[1].dialog=A;if(this.disabled){this.hide();return;}if(this.user.id<0){return;}if(this.intervalID){window.clearInterval(this.intervalID);this.intervalID=false;}if(Roo.get('loading')){Roo.get('loading').remove();}if(Roo.get('loading-mask')){Roo.get('loading-mask').hide();}
+this.form.reset();this.el.unmask();this.form.setValues({'username':Roo.state.Manager.get(this.realm+'.username',''),'lang':Roo.state.Manager.get(this.realm+'.lang','en')});this.switchLang(Roo.state.Manager.get(this.realm+'.lang','en'));if(this.form.findField('username').getValue().length>0){this.form.findField('password').focus();}else {this.form.findField('username').focus();}}},items:[{xtype:'ContentPanel',xns:Roo,region:'center',fitToFrame:true,items:[{xtype:'Form',xns:Roo.form,labelWidth:100,style:'margin: 10px;',listeners:{actionfailed:function(f,A){this.dialog.el.unmask();Roo.MessageBox.alert("Error",A.result.errorMsg?A.result.errorMsg:"Login failed - communication error - try again.");},actioncomplete:function(re,A){Roo.state.Manager.set(this.dialog.realm+'.username',this.findField('username').getValue());Roo.state.Manager.set(this.dialog.realm+'.lang',this.findField('lang').getValue());this.dialog.fillAuth(A.result.data);this.dialog.hide();if(Roo.get('loading-mask')){Roo.get('loading-mask').show();}
+Roo.XComponent.build();}},items:[{xtype:'TextField',xns:Roo.form,fieldLabel:"Email Address",name:'username',width:200,autoCreate:{tag:"input",type:"text",size:"20"}},{xtype:'TextField',xns:Roo.form,fieldLabel:"Password",inputType:'password',name:'password',width:200,autoCreate:{tag:"input",type:"text",size:"20"},listeners:{specialkey:function(e,ev){if(ev.keyCode==13){this.form.dialog.el.mask("Logging in");this.form.doAction('submit',{url:this.form.dialog.url,method:this.form.dialog.method});}}}},{xtype:'ComboBox',xns:Roo.form,fieldLabel:"Language",name:'langdisp',store:{xtype:'SimpleStore',fields:['lang','ldisp'],data:[['en','English'],['zh_HK','\u7E41\u4E2D'],['zh_CN','\u7C21\u4E2D']]},valueField:'lang',hiddenName:'lang',width:200,displayField:'ldisp',typeAhead:false,editable:false,mode:'local',triggerAction:'all',emptyText:'Select a Language...',selectOnFocus:true,listeners:{select:function(cb,A,ix){this.form.switchLang(A.data.lang);}}}]}]}],buttons:[{xtype:'Button',xns:'Roo',text:"Forgot Password",listeners:{click:function(){var n=this.form.findField('username').getValue();if(!n.length){Roo.MessageBox.alert("Error","Fill in your email address");return;}
+Roo.Ajax.request({url:this.dialog.url,params:{passwordRequest:n},method:this.dialog.method,success:function(A,B){var C=this.dialog.processResponse(A);if(!C.success){Roo.MessageBox.alert("Error",C.errorMsg?C.errorMsg:"Problem Requesting Password Reset");return;}
+Roo.MessageBox.alert("Notice","Please check you email for the Password Reset message");},failure:function(){Roo.MessageBox.alert("Error","Problem Requesting Password Reset");}});}}},{xtype:'Button',xns:'Roo',text:"Login",listeners:{click:function(){this.dialog.el.mask("Logging in");this.form.doAction('submit',{url:this.dialog.url,method:this.dialog.method});}}}]})