sync
authorAlan Knowles <alan@roojs.com>
Thu, 28 Jan 2016 09:00:34 +0000 (17:00 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 28 Jan 2016 09:00:34 +0000 (17:00 +0800)
Roo/Element.js
Roo/bootstrap/Popover.js
Roo/bootstrap/UploadCropbox.js
css-bootstrap/upload-cropbox.css
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 03ec098..45b5d30 100644 (file)
@@ -124,6 +124,8 @@ if(opt.anim.isAnimated()){
          * @type String
          */
         defaultUnit : "px",
+        
+        pxReg : '/^\d+(?:\.\d*)?px$/i',
         /**
          * Sets the element's visibility mode. When setVisible() is called it
          * will use this to determine whether to set the visibility or the display property.
@@ -1197,7 +1199,25 @@ if(opt.anim.isAnimated()){
             if(!local){
                 return this.getX();
             }else{
-                return parseInt(this.getStyle("left"), 10) || 0;
+                var x = this.getStyle("left");
+                
+                if(!x || x === 'AUTO'){
+                    return 0;
+                }
+                
+                if(x.test(this.pxReg)){
+                    return parseFloat(x);
+                }
+                
+                x = this.getX();
+                
+                var  par = this.dom.offsetParent ? Roo.fly(this.dom.offsetParent) : false;
+                
+                 if (par !== false) {
+                    x -= par.getX();
+                }
+
+                return x;
             }
         },
 
index 16349b1..383ff87 100644 (file)
@@ -75,10 +75,12 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
     },
     setTitle: function(str)
     {
+        this.title = str;
         this.el.select('.popover-title',true).first().dom.innerHTML = str;
     },
     setContent: function(str)
     {
+        this.html = str;
         this.el.select('.popover-content',true).first().dom.innerHTML = str;
     },
     // as it get's added to the bottom of the page.
@@ -182,7 +184,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         // set content.
         this.el.select('.popover-title',true).first().dom.innerHtml = this.title;
         if (this.html !== false) {
-            this.el.select('.popover-content',true).first().dom.innerHtml = this.title;
+            this.el.select('.popover-content',true).first().dom.innerHtml = this.html;
         }
         this.el.removeClass(['fade','top','bottom', 'left', 'right','in']);
         if (!this.title.length) {
@@ -219,7 +221,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         //arrow.set(align[2], 
         
         this.el.addClass('in');
-        this.hoverState = null;
+        
         
         if (this.el.hasClass('fade')) {
             // fade it?
@@ -231,6 +233,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         this.el.setXY([0,0]);
         this.el.removeClass('in');
         this.el.hide();
+        this.hoverState = null;
         
     }
     
index 0575208..921da5d 100644 (file)
@@ -50,6 +50,7 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
     baseScale : 1,
     rotate : 0,
     dragable : false,
+    pinching : false,
     mouseX : 0,
     mouseY : 0,
     cropImageData : false,
@@ -80,6 +81,11 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
                         {
                             tag : 'div',
                             cls : 'roo-upload-cropbox-thumb'
+                        },
+                        {
+                            tag : 'div',
+                            cls : 'roo-upload-cropbox-empty-notify',
+                            html : this.emptyText
                         }
                     ]
                 },
@@ -145,6 +151,10 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
         
         this.thumb = this.el.select('.roo-upload-cropbox-thumb', true).first();
         this.thumb.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
+        this.thumb.hide();
+        
+        this.emptyNotify = this.el.select('.roo-upload-cropbox-empty-notify', true).first();
+        this.emptyNotify.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
         
         this.footerSection = this.el.select('.roo-upload-cropbox-footer-section', true).first();
         this.footerSection.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
@@ -175,15 +185,23 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
             this.imageSectionHasOnClickEvent = true;
         }
         
-        this.imageSection.on('mousedown', this.onMouseDown, this);
-        
-        this.imageSection.on('mousemove', this.onMouseMove, this);
+        if(Roo.isTouch){
+            this.imageSection.on('touchstart', this.onTouchStart, this);
+            this.imageSection.on('touchmove', this.onTouchMove, this);
+            this.imageSection.on('touchend', this.onTouchEnd, this);
+        }
         
-        var mousewheel = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
+        if(!Roo.isTouch){
+            this.imageSection.on('mousedown', this.onMouseDown, this);
         
-        this.imageSection.on(mousewheel, this.onMouseWheel, this);
+            this.imageSection.on('mousemove', this.onMouseMove, this);
+
+            var mousewheel = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
 
-        Roo.get(document).on('mouseup', this.onMouseUp, this);
+            this.imageSection.on(mousewheel, this.onMouseWheel, this);
+
+            Roo.get(document).on('mouseup', this.onMouseUp, this);
+        }
         
         this.pictureBtn.on('click', this.beforeSelectFile, this);
         
@@ -193,38 +211,13 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
         
     },
     
-    unbind : function()
-    {
-        this.image.un('load', this.onLoadCanvasImage, this);
-        
-        if(this.imageSectionHasOnClickEvent){
-            this.imageSection.un('click', this.beforeSelectFile, this);
-            this.imageSectionHasOnClickEvent = false;
-        }
-        
-        this.imageSection.un('mousedown', this.onMouseDown, this);
-        
-        this.imageSection.un('mousemove', this.onMouseMove, this);
-        
-        var mousewheel = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
-        
-        this.imageSection.un(mousewheel, this.onMouseWheel, this);
-
-        Roo.get(document).un('mouseup', this.onMouseUp, this);
-        
-        this.pictureBtn.un('click', this.beforeSelectFile, this);
-        
-        this.rotateLeft.un('click', this.onRotateLeft, this);
-        
-        this.rotateRight.un('click', this.onRotateRight, this);
-    },
-    
     reset : function()
     {    
         this.scale = 0;
         this.baseScale = 1;
         this.rotate = 0;
         this.dragable = false;
+        this.pinching = false;
         this.mouseX = 0;
         this.mouseY = 0;
         this.cropImageData = false;
@@ -249,12 +242,15 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
     loadCanvasImage : function(src)
     {   
         this.reset();
-        
         this.image.attr('src', src);
     },
     
     onLoadCanvasImage : function(src)
     {   
+        this.emptyNotify.hide();
+        this.thumb.show();
+        this.footerSection.show();
+        
         if(this.imageSectionHasOnClickEvent){
             this.imageSection.un('click', this.beforeSelectFile, this);
             this.imageSectionHasOnClickEvent = false;
@@ -267,8 +263,6 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
         
         this.image.setWidth(this.image.OriginWidth * this.getScaleLevel(false));
         this.image.setHeight(this.image.OriginHeight * this.getScaleLevel(false));
-                
-        this.footerSection.show();
         
         this.setCanvasPosition();
     },
@@ -287,8 +281,10 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
         e.stopEvent();
         
         this.dragable = true;
-        this.mouseX = e.getPageX();
-        this.mouseY = e.getPageY();
+        this.pinching = false;
+        
+        this.mouseX = Roo.isTouch ? e.browserEvent.touches[0].pageX : e.getPageX();
+        this.mouseY = Roo.isTouch ? e.browserEvent.touches[0].pageY : e.getPageY();
         
     },
     
@@ -305,6 +301,13 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
         var minX = this.thumb.getLeft(true) + transform.m41;
         var minY = this.thumb.getTop(true) + transform.m42;
         
+//        alert(this.thumb.getLeft(true));
+//        alert(this.thumb.dom.offsetLeft);
+        
+//        Roo.log(this.thumb.dom.offsetParent);
+//        Roo.log(this.thumb.dom.offsetLeft);
+
+        
         var maxX = minX + this.thumb.getWidth() - this.image.getWidth();
         var maxY = minY + this.thumb.getHeight() - this.image.getHeight();
         
@@ -316,8 +319,11 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
             maxY = minY + this.thumb.getHeight() - this.image.getWidth();
         }
         
-        var x = e.getPageX() - this.mouseX;
-        var y = e.getPageY() - this.mouseY;
+        var x = Roo.isTouch ? e.browserEvent.touches[0].pageX : e.getPageX();
+        var y = Roo.isTouch ? e.browserEvent.touches[0].pageY : e.getPageY();
+        
+        x = x - this.mouseX;
+        y = y - this.mouseY;
         
         var bgX = x + this.imageCanvas.getLeft(true);
         var bgY = y + this.imageCanvas.getTop(true);
@@ -328,8 +334,8 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
         this.imageCanvas.setLeft(bgX);
         this.imageCanvas.setTop(bgY);
         
-        this.mouseX = e.getPageX();
-        this.mouseY = e.getPageY();
+        this.mouseX = Roo.isTouch ? e.browserEvent.touches[0].pageX : e.getPageX();
+        this.mouseY = Roo.isTouch ? e.browserEvent.touches[0].pageY : e.getPageY();
     },
     
     onMouseUp : function(e)
@@ -606,6 +612,111 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
         }
         
         return this.baseScale * Math.pow(1.1, this.scale);
-    }
+    },
     
+    onTouchStart : function(e)
+    {
+        e.stopEvent();
+        
+        var touches = e.browserEvent.touches;
+        
+        if(!touches){
+            return;
+        }
+        
+        if(touches.length == 1){
+            this.onMouseDown(e);
+            return;
+        }
+        
+        if(touches.length != 2){
+            return;
+        }
+        
+        var coords = [];
+        
+        for(var i = 0, finger; finger = touches[i]; i++){
+            coords.push(finger.pageX, finger.pageY);
+        }
+        
+        var x = Math.pow(coords[0] - coords[2], 2);
+        var y = Math.pow(coords[1] - coords[3], 2);
+        
+        this.startDistance =  Math.sqrt(x + y);
+        
+        this.startScale = this.scale;
+        
+        this.dragable = false;
+        this.pinching = true;
+        
+    },
+    
+    onTouchMove : function(e)
+    {
+        e.stopEvent();
+        
+        if(!this.pinching && !this.dragable){
+            return;
+        }
+        
+        var touches = e.browserEvent.touches;
+        
+        if(!touches){
+            return;
+        }
+        
+        if(this.dragable){
+            this.onMouseMove(e);
+            return;
+        }
+        
+        var coords = [];
+        
+        for(var i = 0, finger; finger = touches[i]; i++){
+            coords.push(finger.pageX, finger.pageY);
+        }
+        
+        var x = Math.pow(coords[0] - coords[2], 2);
+        var y = Math.pow(coords[1] - coords[3], 2);
+        
+        this.endDistance =  Math.sqrt(x + y);
+        
+        var scale = this.startScale + Math.floor(Math.log(this.endDistance / this.startDistance) / Math.log(1.1));
+        
+        var width = this.image.OriginWidth * this.baseScale * Math.pow(1.1, scale);
+        var height = this.image.OriginHeight * this.baseScale * Math.pow(1.1, scale);
+        
+        if(
+                this.endDistance / this.startDistance < 1 &&
+                (
+                    (
+                        (this.rotate == 0 || this.rotate == 180) && (width < this.thumb.getWidth() || height < this.thumb.getHeight())
+                    )
+                    ||
+                    (
+                        (this.rotate == 90 || this.rotate == 270) && (height < this.thumb.getWidth() || width < this.thumb.getHeight())
+                    )
+                )
+        ){
+            return;
+        }
+        
+        this.scale = scale;
+        
+        this.image.setWidth(width);
+        this.image.setHeight(height);
+        
+        this.setCanvasPosition();
+        
+        
+    },
+    
+    onTouchEnd : function(e)
+    {
+        e.stopEvent();
+        
+        this.pinching = false;
+        this.dragable = false;
+        
+    }
 });
index 38385e0..2a8794c 100644 (file)
     background: none repeat scroll 0% 0% transparent;
 }
 
+.roo-upload-cropbox-image-section .roo-upload-cropbox-empty-notify {
+    height: 100%;
+    background-color: rgba(0, 0, 0, 0.5);
+    color: white;
+    font-weight: bold;
+    font-size: 24px;
+    text-align: center;
+    padding-top: 35%;
+}
+
 .roo-upload-cropbox-btn-group button {
     background-color: black;
     color: white;
index 5dcb442..48516fd 100644 (file)
@@ -15216,10 +15216,12 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
     },
     setTitle: function(str)
     {
+        this.title = str;
         this.el.select('.popover-title',true).first().dom.innerHTML = str;
     },
     setContent: function(str)
     {
+        this.html = str;
         this.el.select('.popover-content',true).first().dom.innerHTML = str;
     },
     // as it get's added to the bottom of the page.
@@ -15323,7 +15325,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         // set content.
         this.el.select('.popover-title',true).first().dom.innerHtml = this.title;
         if (this.html !== false) {
-            this.el.select('.popover-content',true).first().dom.innerHtml = this.title;
+            this.el.select('.popover-content',true).first().dom.innerHtml = this.html;
         }
         this.el.removeClass(['fade','top','bottom', 'left', 'right','in']);
         if (!this.title.length) {
@@ -15360,7 +15362,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         //arrow.set(align[2], 
         
         this.el.addClass('in');
-        this.hoverState = null;
+        
         
         if (this.el.hasClass('fade')) {
             // fade it?
@@ -15372,6 +15374,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         this.el.setXY([0,0]);
         this.el.removeClass('in');
         this.el.hide();
+        this.hoverState = null;
         
     }
     
index 9aecb9a..cb18a06 100644 (file)
@@ -1039,3 +1039,326 @@ return;}if(this.rotate==180){x=this.image.OriginWidth-this.thumb.getWidth()*this
 this.cropImageData=A.toDataURL(this.cropType);this.fireEvent('crop',this,this.cropImageData);},calcThumbBoxSize:function(){var A,B;B=300;A=this.minWidth*B/this.minHeight;if(this.minWidth>this.minHeight){A=300;B=this.minHeight*A/this.minWidth;}this.thumb.setStyle({width:A+'px',height:B+'px'}
 );return;},fitThumbBox:function(){var A=this.thumb.getWidth();var B=this.image.OriginHeight*A/this.image.OriginWidth;this.baseScale=A/this.image.OriginWidth;if(this.image.OriginWidth>this.image.OriginHeight){B=this.thumb.getHeight();A=this.image.OriginWidth*B/this.image.OriginHeight;
 this.baseScale=B/this.image.OriginHeight;}return;},getScaleLevel:function(A){if(A){return Math.pow(1.1,this.scale*-1)/this.baseScale;}return this.baseScale*Math.pow(1.1,this.scale);}});
+=======
+//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,E,null,e);C.call(D,null,E,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,B,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,A.arg,e);A.callback.call(A.scope||window,null,A.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.o=o;var s=this.meta,A=this.recordType,f=A?A.prototype.fields:null,fi=f?f.items:[],fl=f?f.length:0;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 {raw:o,success:E,records:F,totalRecords:D};}});
+//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/bootstrap/ComboBox.js
+Roo.bootstrap.ComboBox=function(A){Roo.bootstrap.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true,'remove':true,'specialfilter':true});this.item=[];this.tickItems=[];this.selectedIndex=-1;if(this.mode=='local'){if(A.queryDelay===undefined){this.queryDelay=10;}if(A.minChars===undefined){this.minChars=0;}}};Roo.extend(Roo.bootstrap.ComboBox,Roo.bootstrap.TriggerField,{listWidth:undefined,displayField:undefined,valueField:undefined,hiddenName:undefined,listClass:'',selectedClass:'active',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,multiple:false,invalidClass:"has-warning",validClass:"has-success",specialFilter:false,mobileTouchView:true,addicon:false,editicon:false,page:0,hasQuery:false,append:false,loadNext:false,autoFocus:true,tickable:false,btnPosition:'right',triggerList:true,showToggleBtn:true,animate:true,emptyResultText:'Empty',getAutoCreate:function(){var A=false;if(Roo.isTouch&&this.mobileTouchView){A=this.getAutoCreateTouchView();return A;;}if(!this.tickable){A=Roo.bootstrap.ComboBox.superclass.getAutoCreate.call(this);return A;}var B=this.labelAlign||this.parentLabelAlign();A={cls:'form-group roo-combobox-tickable'};var C={tag:'div',cls:'tickable-buttons',cn:[{tag:'button',type:'button',cls:'btn btn-link btn-edit pull-'+this.btnPosition,html:'Edit'},{tag:'button',type:'button',name:'ok',cls:'btn btn-link btn-ok pull-'+this.btnPosition,html:'Done'},{tag:'button',type:'button',name:'cancel',cls:'btn btn-link btn-cancel pull-'+this.btnPosition,html:'Cancel'}]};if(this.editable){C.cn.unshift({tag:'input',cls:'select2-search-field-input'});}var D=this;Roo.each(C.cn,function(c){if(D.size){c.cls+=' btn-'+D.size;}if(D.disabled){c.disabled=true;}});var E={tag:'div',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'},{tag:'ul',cls:'select2-choices',cn:[{tag:'li',cls:'select2-search-field',cn:[C]}]}]};var combobox={cls:'select2-container input-group select2-container-multi',cn:[E]};if(this.hasFeedback&&!this.allowBlank){var F={tag:'span',cls:'glyphicon form-control-feedback'};combobox.cn.push(F);}if(B==='left'&&this.fieldLabel.length){Roo.log("left and has label");A.cn=[{tag:'label','for':id,cls:'control-label col-sm-'+this.labelWidth,html:this.fieldLabel},{cls:"col-sm-"+(12-this.labelWidth),cn:[combobox]}];}else if(this.fieldLabel.length){Roo.log(" label");A.cn=[{tag:'label',html:this.fieldLabel},combobox];}else {Roo.log(" no label && no align");A=combobox}var G=this;['xs','sm','md','lg'].map(function(H){if(G[H]){A.cls+=' col-'+H+'-'+G[H];}});return A;},initEvents:function(){if(!this.store){throw "can not find store for combo";}
+this.store=Roo.factory(this.store,Roo.data);if(Roo.isTouch&&this.mobileTouchView){this.initTouchView();return;}if(this.tickable){this.initTickableEvents();return;}
+Roo.bootstrap.ComboBox.superclass.initEvents.call(this);if(this.hiddenName){this.hiddenField=this.el.select('input.form-hidden-field',true).first();this.hiddenField.dom.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');this.hiddenField.dom.setAttribute('name',this.hiddenName);}var A='x-combo-list';var B=this;(function(){var lw=B.listWidth||Math.max(B.inputEl().getWidth(),B.minListWidth);B.list.setWidth(lw);}).defer(100);this.list.on('mouseover',this.onViewOver,this);this.list.on('mousemove',this.onViewMove,this);this.list.on('scroll',this.onViewScroll,this);if(!this.tpl){this.tpl='<li><a href="#">{'+this.displayField+'}</a></li>';}
+this.view=new Roo.View(this.list,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.editable){this.editable=true;this.setEditable(false);}
+this.keyNav=new Roo.KeyNav(this.inputEl(),{"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.collapse();if(this.fireEvent("specialkey",this,e)){this.onViewClick(false);}return true;},"esc":function(e){this.collapse();},"tab":function(e){this.collapse();if(this.fireEvent("specialkey",this,e)){this.onViewClick(false);}return true;},scope:this,doRelay:function(C,D,E){if(E=='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.inputEl().on("keyup",this.onKeyUp,this);}if(this.forceSelection){this.inputEl().on('blur',this.doForce,this);}if(this.multiple){this.choices=this.el.select('ul.select2-choices',true).first();this.searchField=this.el.select('ul li.select2-search-field',true).first();}},initTickableEvents:function(){this.createList();if(this.hiddenName){this.hiddenField=this.el.select('input.form-hidden-field',true).first();this.hiddenField.dom.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');this.hiddenField.dom.setAttribute('name',this.hiddenName);}
+this.choices=this.el.select('ul.select2-choices',true).first();this.searchField=this.el.select('ul li.select2-search-field',true).first();if(this.triggerList){this.searchField.on("click",this.onSearchFieldClick,this,{preventDefault:true});}
+this.trigger=this.el.select('.tickable-buttons > .btn-edit',true).first();this.trigger.on("click",this.onTickableTriggerClick,this,{preventDefault:true});this.okBtn=this.el.select('.tickable-buttons > .btn-ok',true).first();this.cancelBtn=this.el.select('.tickable-buttons > .btn-cancel',true).first();this.okBtn.on('click',this.onTickableFooterButtonClick,this,this.okBtn);this.cancelBtn.on('click',this.onTickableFooterButtonClick,this,this.cancelBtn);this.trigger.setVisibilityMode(Roo.Element.DISPLAY);this.okBtn.setVisibilityMode(Roo.Element.DISPLAY);this.cancelBtn.setVisibilityMode(Roo.Element.DISPLAY);this.okBtn.hide();this.cancelBtn.hide();var A=this;(function(){var lw=A.listWidth||Math.max(A.inputEl().getWidth(),A.minListWidth);A.list.setWidth(lw);}).defer(100);this.list.on('mouseover',this.onViewOver,this);this.list.on('mousemove',this.onViewMove,this);this.list.on('scroll',this.onViewScroll,this);if(!this.tpl){this.tpl='<li class="select2-result"><div class="checkbox"><input id="{roo-id}" type="checkbox" {roo-data-checked}><label for="{roo-id}"><b>{'+this.displayField+'}</b></label></li>';}
+this.view=new Roo.View(this.list,this.tpl,{singleSelect:true,tickable:true,parent:this,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.editable){this.keyNav=new Roo.KeyNav(this.tickableInputEl(),{"up":function(e){this.inKeyMode=true;this.selectPrev();},"down":function(e){this.inKeyMode=true;this.selectNext();},"enter":function(e){if(this.fireEvent("specialkey",this,e)){this.onViewClick(false);}return true;},"esc":function(e){this.onTickableFooterButtonClick(e,false,false);},"tab":function(e){this.fireEvent("specialkey",this,e);this.onTickableFooterButtonClick(e,false,false);return true;},scope:this,doRelay:function(e,fn,B){if(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.tickableInputEl().on("keyup",this.onKeyUp,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.dom.innerHTML='';}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.bootstrap.ComboBox.superclass.onDestroy.call(this);},fireKey:function(e){if(e.isNavKeyPress()&&!this.list.isVisible()){this.fireEvent("specialkey",this,e);}},onResize:function(w,h){},setEditable:function(A){if(A==this.editable){return;}
+this.editable=A;if(!A){this.inputEl().dom.setAttribute('readOnly',true);this.inputEl().on('mousedown',this.onTriggerClick,this);this.inputEl().addClass('x-combo-noedit');}else {this.inputEl().dom.setAttribute('readOnly',false);this.inputEl().un('mousedown',this.onTriggerClick,this);this.inputEl().removeClass('x-combo-noedit');}},onBeforeLoad:function(A,B){if(!this.hasFocus){return;}if(!B.add){this.list.dom.innerHTML='<li class="loading-indicator">'+(this.loadingText||'loading')+'</li>';}
+this.restrictHeight();this.selectedIndex=-1;},onLoad:function(){this.hasQuery=false;if(!this.hasFocus){return;}if(typeof(this.loading)!=='undefined'&&this.loading!==null){this.loading.hide();}if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable&&!this.tickable){this.inputEl().dom.select();}if(!this.selectByValue(this.value,true)&&this.autoFocus&&(!this.store.lastOptions||typeof(this.store.lastOptions.add)=='undefined'||this.store.lastOptions.add!=true)){this.select(0,true);}}else {if(this.autoFocus){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.hasQuery=false;if(typeof(this.loading)!=='undefined'&&this.loading!==null){this.loading.hide();}if(this.tickable&&this.editable){return;}
+this.collapse();Roo.log(this.store.reader.jsonData);if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){}},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.multiple){return (this.hiddenField)?this.hiddenField.dom.value:this.value;}if(this.valueField){return typeof this.value!='undefined'?this.value:'';}else {return Roo.bootstrap.ComboBox.superclass.getValue.call(this);}},clearValue:function(){if(this.hiddenField){this.hiddenField.dom.value='';}
+this.value='';this.setRawValue('');this.lastSelectionText='';this.lastData=false;var A=this.closeTriggerEl();if(A){A.hide();}},setValue:function(v){if(this.multiple){this.syncValue();return;}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.dom.value=v;}
+Roo.bootstrap.ComboBox.superclass.setValue.call(this,A);this.value=v;var B=this.closeTriggerEl();if(B){(v&&(v.length||v*1>0))?B.show():B.hide();}},lastData:false,setFromData:function(o){if(this.multiple){this.addItem(o);return;}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];}var A=this.closeTriggerEl();if(A){(vv.length||vv*1>0)?A.show():A.hide();}if(this.hiddenField){this.hiddenField.dom.value=vv;this.lastSelectionText=dv;Roo.bootstrap.ComboBox.superclass.setValue.call(this,dv);this.value=vv;return;}
+this.lastSelectionText=dv;Roo.bootstrap.ComboBox.superclass.setValue.call(this,dv);this.value=vv;},reset:function(){if(this.multiple){this.clearItem();return;}
+this.setValue(this.originalValue);this.clearInvalid();this.lastData=false;if(this.view){this.view.clearSelections();}},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.inputEl().dom.name?this.inputEl().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,B,el,e){var C=this.view.getSelectedIndexes()[0];var r=this.store.getAt(C);if(this.tickable){if(typeof(e)!='undefined'&&e.getTarget().nodeName.toLowerCase()!='input'){return;}var rm=false;var D=this;Roo.each(this.tickItems,function(v,k){if(typeof(v)!='undefined'&&v[D.valueField]==r.data[D.valueField]){D.tickItems.splice(k,1);if(typeof(e)=='undefined'&&A==false){Roo.get(D.view.getNodes(C,C)[0]).select('input',true).first().dom.checked=false;}
+rm=true;return;}});if(rm){return;}
+this.tickItems.push(r.data);if(typeof(e)=='undefined'&&A==false){Roo.get(D.view.getNodes(C,C)[0]).select('input',true).first().dom.checked=true;}return;}if(r){this.onSelect(r,C);}if(B!==false&&!this.blockFocus){this.inputEl().focus();}},restrictHeight:function(){this.list.alignTo(this.inputEl(),this.listAlign);this.list.alignTo(this.inputEl(),this.listAlign);},onEmptyResults:function(){if(this.tickable&&this.editable){this.restrictHeight();return;}
+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.list.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(){var v=this.getRawValue();if(this.tickable&&this.editable){v=this.tickableInputEl().getValue();}
+this.doQuery(v);},doForce:function(){if(this.inputEl().dom.value.length>0){this.inputEl().dom.value=this.lastSelectionText===undefined?'':this.lastSelectionText;}},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)){this.hasQuery=true;if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(A){this.store.clearFilter();}else {if(this.specialFilter){this.fireEvent('specialfilter',this);this.onLoad();return;}
+this.store.filter(this.displayField,q);}
+this.store.fireEvent("datachanged",this.store);this.onLoad();}else {this.store.baseParams[this.queryParam]=q;var B={params:this.getParams(q)};if(this.loadNext){B.add=true;B.params.start=this.page*this.pageSize;}
+this.store.load(B);}}else {this.selectedIndex=-1;this.onLoad();}}
+this.loadNext=false;},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();if(this.tickable){this.hasFocus=false;this.okBtn.hide();this.cancelBtn.hide();this.trigger.show();if(this.editable){this.tickableInputEl().dom.value='';this.tickableInputEl().blur();}}
+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){var A=e.within(this.el);var B=e.within(this.list);var C=(Roo.get(e.getTarget()).id==this.list.id)?true:false;if(A||B||C){return;}if(this.tickable){this.onTickableFooterButtonClick(e,false,false);}
+this.collapse();},expand:function(){if(this.isExpanded()||!this.hasFocus){return;}var lw=this.listWidth||Math.max(this.inputEl().getWidth(),this.minListWidth);this.list.setWidth(lw);Roo.log('expand');this.list.show();this.restrictHeight();if(this.tickable){this.tickItems=Roo.apply([],this.item);this.okBtn.show();this.cancelBtn.show();this.trigger.hide();if(this.editable){this.tickableInputEl().focus();}}
+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(e){Roo.log('trigger click');if(this.disabled||!this.triggerList){return;}
+this.page=0;this.loadNext=false;if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.inputEl().focus();}}else {this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else {this.doQuery(this.getRawValue());}if(!this.blockFocus){this.inputEl().focus();}}},onTickableTriggerClick:function(e){if(this.disabled){return;}
+this.page=0;this.loadNext=false;this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else {this.doQuery(this.getRawValue());}},onSearchFieldClick:function(e){if(this.hasFocus&&!this.disabled&&e.getTarget().nodeName.toLowerCase()!='button'){this.onTickableFooterButtonClick(e,false,false);return;}if(this.hasFocus||this.disabled||e.getTarget().nodeName.toLowerCase()=='button'){return;}
+this.page=0;this.loadNext=false;this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else {this.doQuery(this.getRawValue());}},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 true;}if(v.get(this.displayField)&&v.get(this.displayField).substring(0,1).toUpperCase()==k){A=this.store.indexOf(v);return false;}return true;},this);if(A===false){return true;}
+this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0])
+sn.scrollIntoView(sn.dom.parentNode,false);},onViewScroll:function(e,t){if(this.view.el.getScroll().top==0||this.view.el.getScroll().top<this.view.el.dom.scrollHeight-this.view.el.dom.clientHeight||!this.hasFocus||!this.append||this.hasQuery){return;}
+this.hasQuery=true;this.loading=this.list.select('.loading',true).first();if(this.loading===null){this.list.createChild({tag:'div',cls:'loading select2-more-results select2-active',html:'Loading more results...'})
+this.loading=this.list.select('.loading',true).first();this.loading.setVisibilityMode(Roo.Element.DISPLAY);this.loading.hide();}
+this.loading.show();var A=this;this.page++;this.loadNext=true;(function(){A.doQuery(A.allQuery,true);}).defer(500);return;},addItem:function(o){var dv='';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(!dv.length){return;}var A=this.choices.createChild({tag:'li',cls:'select2-search-choice',cn:[{tag:'div',html:dv},{tag:'a',href:'#',cls:'select2-search-choice-close',tabindex:'-1'}]},this.searchField);var B=A.select('a.select2-search-choice-close',true).first()
+B.on('click',this.onRemoveItem,this,{item:A,data:o});this.item.push(o);this.lastData=o;this.syncValue();this.inputEl().dom.value='';this.validate();},onRemoveItem:function(e,A,o){e.preventDefault();this.lastItem=Roo.apply([],this.item);var B=this.item.indexOf(o.data)*1;if(B<0){Roo.log('not this item?!');return;}
+this.item.splice(B,1);o.item.remove();this.syncValue();this.fireEvent('remove',this,e);this.validate();},syncValue:function(){if(!this.item.length){this.clearValue();return;}var A=[];var B=this;Roo.each(this.item,function(i){if(B.valueField){A.push(i[B.valueField]);return;}
+A.push(i);});this.value=A.join(',');if(this.hiddenField){this.hiddenField.dom.value=this.value;}
+this.store.fireEvent("datachanged",this.store);},clearItem:function(){if(!this.multiple){return;}
+this.item=[];Roo.each(this.choices.select('>li.select2-search-choice',true).elements,function(c){c.remove();});this.syncValue();this.validate();},inputEl:function(){if(Roo.isTouch&&this.mobileTouchView){return this.el.select('input.form-control',true).first();}if(this.tickable){return this.searchField;}return this.el.select('input.form-control',true).first();},onTickableFooterButtonClick:function(e,A,el){e.preventDefault();this.lastItem=Roo.apply([],this.item);if(A&&A.name=='cancel'){this.tickItems=Roo.apply([],this.item);this.collapse();return;}
+this.clearItem();var B=this;Roo.each(this.tickItems,function(o){B.addItem(o);});this.collapse();},validate:function(){var v=this.getRawValue();if(this.multiple){v=this.getValue();}if(this.disabled||this.allowBlank||v.length){this.markValid();return true;}
+this.markInvalid();return false;},tickableInputEl:function(){if(!this.tickable||!this.editable){return this.inputEl();}return this.inputEl().select('.select2-search-field-input',true).first();},getAutoCreateTouchView:function(){var id=Roo.id();var A={cls:'form-group'};var B={tag:'input',id:id,type:this.inputType,cls:'form-control x-combo-noedit',autocomplete:'new-password',placeholder:this.placeholder||'',readonly:true};if(this.name){B.name=this.name;}if(this.size){B.cls+=' input-'+this.size;}if(this.disabled){B.disabled=true;}var C={cls:'',cn:[B]};if(this.before){C.cls+=' input-group';C.cn.unshift({tag:'span',cls:'input-group-addon',html:this.before});}if(this.removable&&!this.multiple){C.cls+=' roo-removable';C.cn.push({tag:'button',html:'x',cls:'roo-combo-removable-btn close'});}if(this.hasFeedback&&!this.allowBlank){C.cls+=' has-feedback';C.cn.push({tag:'span',cls:'glyphicon form-control-feedback'});}if(this.after){C.cls+=(this.before)?'':' input-group';C.cn.push({tag:'span',cls:'input-group-addon',html:this.after});}var D={tag:'div',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'},C]};if(this.multiple){D={tag:'div',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'},{tag:'ul',cls:'select2-choices',cn:[{tag:'li',cls:'select2-search-field',cn:[C]}]}]}};var E={cls:'select2-container input-group',cn:[D]};if(this.multiple){E.cls+=' select2-container-multi';}var F=this.labelAlign||this.parentLabelAlign();A.cn=E;if(this.fieldLabel.length){var lw=F==='left'?('col-sm'+this.labelWidth):'';var cw=F==='left'?('col-sm'+(12-this.labelWidth)):'';A.cn=[{tag:'label',cls:'control-label '+lw,html:this.fieldLabel},{cls:cw,cn:[E]}];}var G=this;['xs','sm','md','lg'].map(function(H){if(G[H]){A.cls+=' col-'+H+'-'+G[H];}});return A;},initTouchView:function(){this.renderTouchView();this.touchViewEl.on('scroll',function(){this.el.dom.scrollTop=0;},this);this.inputEl().on("click",this.showTouchView,this);this.touchViewFooterEl.select('.roo-touch-view-cancel',true).first().on('click',this.hideTouchView,this);this.touchViewFooterEl.select('.roo-touch-view-ok',true).first().on('click',this.setTouchViewValue,this);this.maskEl=new Roo.LoadMask(this.touchViewEl,{store:this.store,msgCls:'roo-el-mask-msg'});this.store.on('beforeload',this.onTouchViewBeforeLoad,this);this.store.on('load',this.onTouchViewLoad,this);this.store.on('loadexception',this.onTouchViewLoadException,this);if(this.hiddenName){this.hiddenField=this.el.select('input.form-hidden-field',true).first();this.hiddenField.dom.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');this.hiddenField.dom.setAttribute('name',this.hiddenName);}if(this.multiple){this.choices=this.el.select('ul.select2-choices',true).first();this.searchField=this.el.select('ul li.select2-search-field',true).first();}if(this.removable&&!this.multiple){var A=this.closeTriggerEl();if(A){A.setVisibilityMode(Roo.Element.DISPLAY).hide();A.on('click',this.removeBtnClick,this,A);}}return;},renderTouchView:function(){this.touchViewEl=Roo.get(document.body).createChild(Roo.bootstrap.ComboBox.touchViewTemplate);this.touchViewEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.touchViewHeaderEl=this.touchViewEl.select('.modal-header',true).first();this.touchViewHeaderEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.touchViewBodyEl=this.touchViewEl.select('.modal-body',true).first();this.touchViewBodyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.touchViewBodyEl.setStyle('overflow','auto');this.touchViewListGroup=this.touchViewBodyEl.select('.list-group',true).first();this.touchViewListGroup.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.touchViewFooterEl=this.touchViewEl.select('.modal-footer',true).first();this.touchViewFooterEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';},showTouchView:function(){this.touchViewHeaderEl.hide();if(this.fieldLabel.length){this.touchViewHeaderEl.dom.innerHTML=this.fieldLabel;this.touchViewHeaderEl.show();}
+this.touchViewEl.show();this.touchViewEl.select('.modal-dialog',true).first().setStyle('margin','0px');this.touchViewEl.select('.modal-dialog > .modal-content',true).first().setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));var A=Roo.lib.Dom.getViewHeight()-this.touchViewFooterEl.getHeight()+this.touchViewBodyEl.getPadding('tb');if(this.fieldLabel.length){A=A-this.touchViewHeaderEl.getHeight();}
+this.touchViewBodyEl.setHeight(A);if(this.animate){var B=this;(function(){B.touchViewEl.addClass('in');}).defer(50);}else {this.touchViewEl.addClass('in');}
+this.doTouchViewQuery();},hideTouchView:function(){this.touchViewEl.removeClass('in');if(this.animate){var A=this;(function(){A.touchViewEl.setStyle('display','none');}).defer(150);}else {this.touchViewEl.setStyle('display','none');}},setTouchViewValue:function(){if(this.multiple){this.clearItem();var A=this;Roo.each(this.tickItems,function(o){this.addItem(o);},this);}
+this.hideTouchView();},doTouchViewQuery:function(){var qe={query:'',forceAll:true,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}if(!this.alwaysQuery||this.mode=='local'){this.onTouchViewLoad();return;}
+this.store.load();},onTouchViewBeforeLoad:function(A,B){return;},onTouchViewLoad:function(){if(this.store.getCount()<1){this.onTouchViewEmptyResults();return;}
+this.clearTouchView();var A=this.getRawValue();var B=(this.multiple)?Roo.bootstrap.ComboBox.listItemCheckbox:Roo.bootstrap.ComboBox.listItemRadio;this.tickItems=[];this.store.data.each(function(d,F){var G=this.touchViewListGroup.createChild(B);if(this.displayField&&typeof(d.data[this.displayField])!='undefined'){G.select('.roo-combobox-list-group-item-value',true).first().dom.innerHTML=d.data[this.displayField];}if(!this.multiple&&this.valueField&&typeof(d.data[this.valueField])!='undefined'&&d.data[this.valueField]==this.getValue()){G.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);}if(this.multiple&&this.valueField&&typeof(d.data[this.valueField])!='undefined'&&this.getValue().indexOf(d.data[this.valueField])!=-1){G.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);this.tickItems.push(d.data);}
+G.on('click',this.onTouchViewClick,this,{row:G,rowIndex:F});},this);var C=this.touchViewListGroup.select('.list-group-item > .roo-combobox-list-group-item-box > input:checked',true).first();var D=Roo.lib.Dom.getViewHeight()-this.touchViewFooterEl.getHeight()+this.touchViewBodyEl.getPadding('tb');if(this.fieldLabel.length){D=D-this.touchViewHeaderEl.getHeight();}var E=this.touchViewListGroup.getHeight();if(C&&E>D){(function(){C.findParent('li').scrollIntoView(this.touchViewListGroup.dom);}).defer(500);}},onTouchViewLoadException:function(){this.hideTouchView();},onTouchViewEmptyResults:function(){this.clearTouchView();this.touchViewListGroup.createChild(Roo.bootstrap.ComboBox.emptyResult);this.touchViewListGroup.select('.roo-combobox-touch-view-empty-result',true).first().dom.innerHTML=this.emptyResultText;},clearTouchView:function(){this.touchViewListGroup.dom.innerHTML='';},onTouchViewClick:function(e,el,o){e.preventDefault();var A=o.row;var B=o.rowIndex;var r=this.store.getAt(B);if(!this.multiple){Roo.each(this.touchViewListGroup.select('.list-group-item > .roo-combobox-list-group-item-box > input:checked',true).elements,function(c){c.dom.removeAttribute('checked');},this);A.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);this.setFromData(r.data);var C=this.closeTriggerEl();if(C){C.show();}
+this.hideTouchView();return;}if(this.valueField&&typeof(r.data[this.valueField])!='undefined'&&this.getValue().indexOf(r.data[this.valueField])!=-1){A.select('.roo-combobox-list-group-item-box > input',true).first().dom.removeAttribute('checked');this.tickItems.splice(this.tickItems.indexOf(r.data),1);return;}
+A.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);this.addItem(r.data);this.tickItems.push(r.data);}});Roo.apply(Roo.bootstrap.ComboBox,{header:{tag:'div',cls:'modal-header',cn:[{tag:'h4',cls:'modal-title'}]},body:{tag:'div',cls:'modal-body',cn:[{tag:'ul',cls:'list-group'}]},listItemRadio:{tag:'li',cls:'list-group-item',cn:[{tag:'span',cls:'roo-combobox-list-group-item-value'},{tag:'div',cls:'roo-combobox-list-group-item-box pull-xs-right radio-inline radio radio-info',cn:[{tag:'input',type:'radio'},{tag:'label'}]}]},listItemCheckbox:{tag:'li',cls:'list-group-item',cn:[{tag:'span',cls:'roo-combobox-list-group-item-value'},{tag:'div',cls:'roo-combobox-list-group-item-box pull-xs-right checkbox-inline checkbox checkbox-info',cn:[{tag:'input',type:'checkbox'},{tag:'label'}]}]},emptyResult:{tag:'div',cls:'alert alert-danger roo-combobox-touch-view-empty-result'},footer:{tag:'div',cls:'modal-footer',cn:[{tag:'div',cls:'row',cn:[{tag:'div',cls:'col-xs-6 text-left',cn:{tag:'button',cls:'btn btn-danger roo-touch-view-cancel',html:'Cancel'}},{tag:'div',cls:'col-xs-6 text-right',cn:{tag:'button',cls:'btn btn-success roo-touch-view-ok',html:'OK'}}]}]}});Roo.apply(Roo.bootstrap.ComboBox,{touchViewTemplate:{tag:'div',cls:'modal fade roo-combobox-touch-view',cn:[{tag:'div',cls:'modal-dialog',cn:[{tag:'div',cls:'modal-content',cn:[Roo.bootstrap.ComboBox.header,Roo.bootstrap.ComboBox.body,Roo.bootstrap.ComboBox.footer]}]}]}});
+//Roo/View.js
+Roo.View=function(A,B,C){this.parent=false;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);}
+this.wrapEl=this.el.wrap().wrap();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);}if(this.footer&&this.footer.xtype){var D=this.wrapEl.appendChild(document.createElement("div"));this.footer.dataSource=this.store
+this.footer.container=D;this.footer=Roo.factory(this.footer,Roo);D.insertFirst(this.el);}
+Roo.View.superclass.constructor.call(this);};Roo.extend(Roo.View,Roo.util.Observable,{store:false,el:'',tpl:false,dataName:false,selectedClass:"x-view-selected",emptyText:"",mask:false,multiSelect:false,singleSelect:false,toggleSelect:false,tickable:false,getEl:function(){return this.wrapEl;},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;}var el=this.el;if(this.dataName){this.el.update(t.apply(this.store.meta));el=this.el.child('.roo-tpl-'+this.dataName);}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]);var d=Roo.apply({},D);if(this.tickable){Roo.apply(d,{'roo-id':Roo.id()});var E=this;Roo.each(this.parent.item,function(F){if(F[E.parent.valueField]!=D[E.parent.valueField]){return;}
+Roo.apply(d,{'roo-data-checked':'checked'});});}
+A[A.length]=Roo.util.Format.trim(this.dataName?t.applySubtemplate(this.dataName,d,this.store.meta):t.apply(d));}
+el.update(A.join(""));this.nodes=el.dom.childNodes;this.updateIndexes(0);},prepareData:function(A,B,C){this.fireEvent("preparedata",this,A,B,C);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,B,A));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,i,A[i]);if(n){this.tpl.insertBefore(n,d);}else {this.tpl.append(this.el,d);}}
+this.updateIndexes(B);},onRemove:function(ds,A,B){this.clearSelections();var el=this.dataName?this.el.child('.roo-tpl-'+this.dataName):this.el;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);this.store.un("beforeload",this.onBeforeLoad);this.store.un("load",this.onLoad);this.store.un("loadexception",this.onLoad);}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);A.on("beforeload",this.onBeforeLoad,this);A.on("load",this.onLoad,this);A.on("loadexception",this.onLoad,this);}if(A){this.refresh();}},onBeforeLoad:function(A,B){if(!B.add){this.el.update("");}
+this.el.mask(this.mask?this.mask:"Loading");},onLoad:function(){this.el.unmask();},findItemFromChild:function(A){var el=this.dataName?this.el.child('.roo-tpl-'+this.dataName,true):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';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;}if(!this.tickable){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)){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/bootstrap/Calendar.js
+Roo.bootstrap=Roo.bootstrap||{};Roo.bootstrap.Calendar=function(A){Roo.bootstrap.Calendar.superclass.constructor.call(this,A);this.addEvents({'select':true,'monthchange':true,'evententer':true,'eventleave':true,'eventclick':true});};Roo.extend(Roo.bootstrap.Calendar,Roo.bootstrap.Component,{startDay:0,loadMask:false,header:false,getAutoCreate:function(){var A=function(H,I,J,K){return Roo.apply({},{tag:'span',cls:'fc-button fc-button-'+H+' fc-state-default '+(I.length?'fc-corner-'+I.split(' ').join(' fc-corner-'):''),html:'<SPAN class="fc-text-'+J+'">'+K+'</SPAN>',unselectable:'on'});};var B={};if(!this.header){B={tag:'table',cls:'fc-header',style:'width:100%',cn:[{tag:'tr',cn:[{tag:'td',cls:'fc-header-left',cn:[A('prev','left','arrow','&#8249;'),A('next','right','arrow','&#8250;'),{tag:'span',cls:'fc-header-space'},A('today','left right','','today')]},{tag:'td',cls:'fc-header-center',cn:[{tag:'span',cls:'fc-header-title',cn:{tag:'H2',html:'month / year'}}]},{tag:'td',cls:'fc-header-right',cn:[]}]}]};}
+B=this.header;var C=function(){var H=[];for(var i=0;i<Date.dayNames.length;i++){var d=Date.dayNames[i];H.push({tag:'th',cls:'fc-day-header fc-'+d.substring(0,3).toLowerCase()+' fc-widget-header',html:d.substring(0,3)});}
+H[0].cls+=' fc-first';H[6].cls+=' fc-last';return H;};var D=function(n){return {tag:'td',cls:'fc-day fc-'+n+' fc-widget-content',cn:[{cn:[{cls:'fc-day-number',html:'D'},{cls:'fc-day-content',cn:[{style:'position: relative;'}]}]}]}};var E=function(){var H=[];for(var r=0;r<6;r++){var I={tag:'tr',cls:'fc-week',cn:[]};for(var i=0;i<Date.dayNames.length;i++){var d=Date.dayNames[i];I.cn.push(D(d.substring(0,3).toLowerCase()));}
+I.cn[0].cls+=' fc-first';I.cn[0].cn[0].style='min-height:90px';I.cn[6].cls+=' fc-last';H.push(I);}
+H[0].cls+=' fc-first';H[4].cls+=' fc-prev-last';H[5].cls+=' fc-last';return H;};var F={tag:'table',cls:'fc-border-separate',style:'width:100%',cellspacing:0,cn:[{tag:'thead',cn:[{tag:'tr',cls:'fc-first fc-last',cn:C()}]},{tag:'tbody',cn:E()}]};var G={cls:'fc fc-ltr',cn:[B,{cls:'fc-content',style:"position: relative;",cn:[{cls:'fc-view fc-view-month fc-grid',style:'position: relative',unselectable:'on',cn:[{cls:'fc-event-container',style:'position:absolute;z-index:8;top:0;left:0;'},F]}]}]};return G;},initEvents:function(){if(!this.store){throw "can not find store for calendar";}var A={tag:"div",cls:"x-dlg-mask",style:"text-align:center",cn:[{tag:"div",style:"background-color:white;width:50%;margin:250 auto",cn:[{tag:"img",src:Roo.rootURL+'/images/ux/lightbox/loading.gif'},{tag:"span",html:"Loading"}]}]}
+this.maskEl=Roo.DomHelper.append(this.el.select('.fc-content',true).first(),A,true);var B=this.el.select('.fc-content',true).first().getSize();this.maskEl.setSize(B.width,B.height);this.maskEl.enableDisplayMode("block");if(!this.loadMask){this.maskEl.hide();}
+this.store=Roo.factory(this.store,Roo.data);this.store.on('load',this.onLoad,this);this.store.on('beforeload',this.onBeforeLoad,this);this.resize();this.cells=this.el.select('.fc-day',true);this.textNodes=this.el.query('.fc-day-number');this.cells.addClassOnOver('fc-state-hover');this.el.select('.fc-button-prev',true).on('click',this.showPrevMonth,this);this.el.select('.fc-button-next',true).on('click',this.showNextMonth,this);this.el.select('.fc-button-today',true).on('click',this.showToday,this);this.el.select('.fc-button',true).addClassOnOver('fc-state-hover');this.on('monthchange',this.onMonthChange,this);this.update(new Date().clearTime());},resize:function(){var sz=this.el.getSize();this.el.select('.fc-day-header',true).setWidth(sz.width/7);this.el.select('.fc-day-content div',true).setHeight(34);},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1));},showToday:function(e){this.update(new Date().clearTime());},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));},update:function(A){var vd=this.activeDate;this.activeDate=A;var B=A.getDaysInMonth();var C=A.getFirstDateOfMonth();var D=C.getDay()-this.startDay;if(D<this.startDay){D+=7;}var pm=A.add(Date.MONTH,-1);var E=pm.getDaysInMonth()-D;this.cells=this.el.select('.fc-day',true);this.textNodes=this.el.query('.fc-day-number');this.cells.addClassOnOver('fc-state-hover');var F=this.cells.elements;var G=this.textNodes;Roo.each(F,function(V){V.removeClass(['fc-past','fc-other-month','fc-future','fc-state-highlight','fc-state-disabled']);});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(V,W){W.row=0;W.events=[];W.more=[];W.title="";var t=d.getTime();W.dateValue=t;if(t==I){W.className+=" fc-today";W.className+=" fc-state-highlight";W.title=V.todayText;}if(t==J){}if(t<K){W.className=" fc-state-disabled";W.title=V.minText;return;}if(t>L){W.className=" fc-state-disabled";W.title=V.maxText;return;}if(O){if(O.indexOf(d.getDay())!=-1){W.title=P;W.className=" fc-state-disabled";}}if(M&&Q){var X=d.dateFormat(Q);if(M.test(X)){W.title=N.replace("%0",X);W.className=" fc-state-disabled";}}if(!W.initialClassName){W.initialClassName=W.dom.className;}
+W.dom.className=W.initialClassName+' '+W.className;};var i=0;for(;i<D;i++){G[i].innerHTML=(++E);d.setDate(d.getDate()+1);F[i].className="fc-past fc-other-month";R(this,F[i]);}var S=0;for(;i<B;i++){S=i-D+1;G[i].innerHTML=(S);d.setDate(d.getDate()+1);F[i].className='';R(this,F[i]);}var T=0;for(;i<42;i++){G[i].innerHTML=(++T);d.setDate(d.getDate()+1);F[i].className="fc-future fc-other-month";R(this,F[i]);}
+this.el.select('.fc-header-title h2',true).update(Date.monthNames[A.getMonth()]+" "+A.getFullYear());var U=Math.ceil((A.getDaysInMonth()+A.getFirstDateOfMonth().getDay())/7);this.el.select('tr.fc-week.fc-prev-last',true).removeClass('fc-last');this.el.select('tr.fc-week.fc-next-last',true).addClass('fc-last').show();if(U!=6){this.el.select('tr.fc-week.fc-last',true).removeClass('fc-last').addClass('fc-next-last').hide();this.el.select('tr.fc-week.fc-prev-last',true).addClass('fc-last');}
+this.fireEvent('monthchange',this,A);},findCell:function(dt){dt=dt.clearTime().getTime();var A=false;this.cells.each(function(c){if(c.dateValue==dt){A=c;return false;}return true;});return A;},findCells:function(ev){var s=ev.start.clone().clearTime().getTime();var e=ev.end.clone().clearTime().getTime();var A=[];this.cells.each(function(c){if(c.dateValue>e){return;}if(c.dateValue<s){return;}
+A.push(c);});return A;},addItem:function(ev){var A=this.findCells(ev);var B=false;var C=[];for(var i=0;i<A.length;i++){A[i].row=A[0].row;if(i==0){A[i].row=A[i].row+1;}if(!B){B={start:A[i],end:A[i]};continue;}if(B.start.getY()==A[i].getY()){B.end=A[i];continue;}
+C.push(B);B={start:A[i],end:A[i]};}
+C.push(B);ev.els=[];ev.rows=C;ev.cells=A;A[0].events.push(ev);this.calevents.push(ev);},clearEvents:function(){if(!this.calevents){return;}
+Roo.each(this.cells.elements,function(c){c.row=0;c.events=[];c.more=[];});Roo.each(this.calevents,function(e){Roo.each(e.els,function(el){el.un('mouseenter',this.onEventEnter,this);el.un('mouseleave',this.onEventLeave,this);el.remove();},this);},this);Roo.each(Roo.select('.fc-more-event',true).elements,function(e){e.remove();});},renderEvents:function(){var A=this;this.cells.each(function(c){if(c.row<5){return;}var ev=c.events;var r=4;if(c.row!=c.events.length){r=4-(4-(c.row-c.events.length));}
+c.events=ev.slice(0,r);c.more=ev.slice(r);if(c.more.length&&c.more.length==1){c.events.push(c.more.pop());}
+c.row=(c.row-ev.length)+c.events.length+((c.more.length)?1:0);});this.cells.each(function(c){c.select('.fc-day-content div',true).first().setHeight(Math.max(34,c.row*20));for(var e=0;e<c.events.length;e++){var ev=c.events[e];var B=ev.rows;for(var i=0;i<B.length;i++){var C={cls:'roo-dynamic fc-event fc-event-hori fc-event-draggable ui-draggable',style:'position: absolute',unselectable:"on",cn:[{cls:'fc-event-inner',cn:[{tag:'span',cls:'fc-event-title',html:String.format('{0}',ev.title)}]},{cls:'ui-resizable-handle ui-resizable-e',html:'&nbsp;&nbsp;&nbsp'}]};if(i==0){C.cls+=' fc-event-start';}if((i+1)==B.length){C.cls+=' fc-event-end';}var D=A.el.select('.fc-event-container',true).first();var cg=D.createChild(C);var E=B[i].start.select('.fc-day-content',true).first().getBox();var F=B[i].end.select('.fc-day-content',true).first().getBox();var r=(c.more.length)?1:0;cg.setXY([E.x+2,E.y+((c.row-c.events.length-r+e)*20)]);cg.setWidth(F.right-E.x-2);cg.on('mouseenter',A.onEventEnter,A,ev);cg.on('mouseleave',A.onEventLeave,A,ev);cg.on('click',A.onEventClick,A,ev);ev.els.push(cg);}}if(c.more.length){var C={cls:'fc-more-event roo-dynamic fc-event fc-event-hori fc-event-draggable ui-draggable fc-event-start fc-event-end',style:'position: absolute',unselectable:"on",cn:[{cls:'fc-event-inner',cn:[{tag:'span',cls:'fc-event-title',html:'More'}]},{cls:'ui-resizable-handle ui-resizable-e',html:'&nbsp;&nbsp;&nbsp'}]};var D=A.el.select('.fc-event-container',true).first();var cg=D.createChild(C);var E=c.select('.fc-day-content',true).first().getBox();var F=c.select('.fc-day-content',true).first().getBox();cg.setXY([E.x+2,E.y+((c.row-1)*20)]);cg.setWidth(F.right-E.x-2);cg.on('click',A.onMoreEventClick,A,c.more);}});},onEventEnter:function(e,el,A,d){this.fireEvent('evententer',this,el,A);},onEventLeave:function(e,el,A,d){this.fireEvent('eventleave',this,el,A);},onEventClick:function(e,el,A,d){this.fireEvent('eventclick',this,el,A);},onMonthChange:function(){this.store.load();},onMoreEventClick:function(e,el,A){var B=this;this.calpopover.placement='right';this.calpopover.setTitle('More');this.calpopover.setContent('');var C=this.calpopover.el.select('.popover-content',true).first();Roo.each(A,function(m){var D={cls:'fc-event-hori fc-event-draggable',html:m.title};var cg=C.createChild(D);cg.on('click',B.onEventClick,B,m);});this.calpopover.show(el);},onLoad:function(){this.calevents=[];var A=this;if(this.store.getCount()>0){this.store.data.each(function(d){A.addItem({id:d.data.id,start:(typeof(d.data.start_dt)==='string')?new Date.parseDate(d.data.start_dt,'Y-m-d H:i:s'):d.data.start_dt,end:(typeof(d.data.end_dt)==='string')?new Date.parseDate(d.data.end_dt,'Y-m-d H:i:s'):d.data.end_dt,time:d.data.start_time,title:d.data.title,description:d.data.description,venue:d.data.venue});});}
+this.renderEvents();if(this.calevents.length&&this.loadMask){this.maskEl.hide();}},onBeforeLoad:function(){this.clearEvents();if(this.loadMask){this.maskEl.show();}}});
+//Roo/bootstrap/Popover.js
+Roo.bootstrap.Popover=function(A){Roo.bootstrap.Popover.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Popover,Roo.bootstrap.Component,{title:'Fill in a title',html:false,placement:'right',trigger:'hover',delay:0,over:'parent',can_build_overlaid:false,getChildContainer:function(){return this.el.select('.popover-content',true).first();},getAutoCreate:function(){Roo.log('make popover?');var A={cls:'popover roo-dynamic',style:'display:block',cn:[{cls:'arrow'},{cls:'popover-inner',cn:[{tag:'h3',cls:'popover-title',html:this.title},{cls:'popover-content',html:this.html}]}]};return A;},setTitle:function(A){this.title=A;this.el.select('.popover-title',true).first().dom.innerHTML=A;},setContent:function(A){this.html=A;this.el.select('.popover-content',true).first().dom.innerHTML=A;},onRender:function(ct,A){Roo.bootstrap.Component.superclass.onRender.call(this,ct,A);if(!this.el){var B=Roo.apply({},this.getAutoCreate());B.id=Roo.id();if(this.cls){B.cls+=' '+this.cls;}if(this.style){B.style=this.style;}
+Roo.log("adding to ")
+this.el=Roo.get(document.body).createChild(B,A);Roo.log(this.el);}
+this.initEvents();},initEvents:function(){this.el.select('.popover-title',true).setVisibilityMode(Roo.Element.DISPLAY);this.el.enableDisplayMode('block');this.el.hide();if(this.over===false){return;}if(this.triggers===false){return;}var A=(this.over=='parent')?this.parent().el:Roo.get(this.over);var B=this.trigger?this.trigger.split(' '):[];Roo.each(B,function(C){if(C=='click'){A.on('click',this.toggle,this);}else if(C!='manual'){var D=C=='hover'?'mouseenter':'focusin';var E=C=='hover'?'mouseleave':'focusout';A.on(D,this.enter,this);A.on(E,this.leave,this);}},this);},timeout:null,hoverState:null,toggle:function(){this.hoverState=='in'?this.leave():this.enter();},enter:function(){clearTimeout(this.timeout);this.hoverState='in';if(!this.delay||!this.delay.show){this.show();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='in'){_t.show();}},this.delay.show)},leave:function(){clearTimeout(this.timeout);this.hoverState='out';if(!this.delay||!this.delay.hide){this.hide();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='out'){_t.hide();}},this.delay.hide)},show:function(A){if(!A){A=(this.over=='parent')?this.parent().el:Roo.get(this.over);}
+this.el.select('.popover-title',true).first().dom.innerHtml=this.title;if(this.html!==false){this.el.select('.popover-content',true).first().dom.innerHtml=this.html;}
+this.el.removeClass(['fade','top','bottom','left','right','in']);if(!this.title.length){this.el.select('.popover-title',true).hide();}var B=typeof this.placement=='function'?this.placement.call(this,this.el,A):this.placement;var C=/\s?auto?\s?/i;var D=C.test(B);if(D){B=B.replace(C,'')||'top';}
+this.el.show();this.el.dom.style.display='block';this.el.addClass(B);var p=this.getPosition();var E=this.el.getBox();if(D){}var F=Roo.bootstrap.Popover.alignment[B];this.el.alignTo(A,F[0],F[1]);this.el.addClass('in');if(this.el.hasClass('fade')){}},hide:function(){this.el.setXY([0,0]);this.el.removeClass('in');this.el.hide();this.hoverState=null;}});Roo.bootstrap.Popover.alignment={'left':['r-l',[-10,0],'right'],'right':['l-r',[10,0],'left'],'bottom':['t-b',[0,10],'top'],'top':['b-t',[0,-10],'bottom']};
+//Roo/bootstrap/Progress.js
+Roo.bootstrap.Progress=function(A){Roo.bootstrap.Progress.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Progress,Roo.bootstrap.Component,{striped:false,active:false,getAutoCreate:function(){var A={tag:'div',cls:'progress'};if(this.striped){A.cls+=' progress-striped';}if(this.active){A.cls+=' active';}return A;}});
+//Roo/bootstrap/ProgressBar.js
+Roo.bootstrap.ProgressBar=function(A){Roo.bootstrap.ProgressBar.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.ProgressBar,Roo.bootstrap.Component,{aria_valuenow:0,aria_valuemin:0,aria_valuemax:100,label:false,panel:false,role:false,sr_only:false,getAutoCreate:function(){var A={tag:'div',cls:'progress-bar',style:'width:'+Math.ceil((this.aria_valuenow/this.aria_valuemax)*100)+'%'};if(this.sr_only){A.cn={tag:'span',cls:'sr-only',html:this.sr_only}}if(this.role){A.role=this.role;}if(this.aria_valuenow){A['aria-valuenow']=this.aria_valuenow;}if(this.aria_valuemin){A['aria-valuemin']=this.aria_valuemin;}if(this.aria_valuemax){A['aria-valuemax']=this.aria_valuemax;}if(this.label&&!this.sr_only){A.html=this.label;}if(this.panel){A.cls+=' progress-bar-'+this.panel;}return A;},update:function(A){this.aria_valuenow=A;this.el.setStyle('width',Math.ceil((this.aria_valuenow/this.aria_valuemax)*100)+'%');}});
+//Roo/bootstrap/TabGroup.js
+Roo.bootstrap.TabGroup=function(A){Roo.bootstrap.TabGroup.superclass.constructor.call(this,A);if(!this.navId){this.navId=Roo.id();}
+this.tabs=[];Roo.bootstrap.TabGroup.register(this);};Roo.extend(Roo.bootstrap.TabGroup,Roo.bootstrap.Column,{carousel:false,transition:false,bullets:0,timer:0,autoslide:false,slideFn:false,slideOnTouch:false,getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.TabGroup.superclass.getAutoCreate.call(this));A.cls+=' tab-content';Roo.log('get auto create...............');if(this.carousel){A.cls+=' carousel slide';A.cn=[{cls:'carousel-inner'}];if(this.bullets>0&&!Roo.isTouch){var B={cls:'carousel-bullets',cn:[]};if(this.bullets_cls){B.cls=B.cls+' '+this.bullets_cls;}for(var i=0;i<this.bullets;i++){B.cn.push({cls:'bullet bullet-'+i});}
+B.cn.push({cls:'clear'});A.cn[0].cn=B;}}return A;},initEvents:function(){Roo.log('-------- init events on tab group ---------');if(this.bullets>0&&!Roo.isTouch){this.initBullet();}
+Roo.log(this);if(Roo.isTouch&&this.slideOnTouch){this.el.on("touchstart",this.onTouchStart,this);}if(this.autoslide){var A=this;this.slideFn=window.setInterval(function(){A.showPanelNext();},this.timer);}},onTouchStart:function(e,el,o){if(!this.slideOnTouch||!Roo.isTouch||Roo.get(e.getTarget()).hasClass('roo-button-text')){return;}
+this.showPanelNext();},getChildContainer:function(){return this.carousel?this.el.select('.carousel-inner',true).first():this.el;},register:function(A){this.tabs.push(A);A.navId=this.navId;},getActivePanel:function(){var r=false;Roo.each(this.tabs,function(t){if(t.active){r=t;return false;}return null;});return r;},getPanelByName:function(n){var r=false;Roo.each(this.tabs,function(t){if(t.tabId==n){r=t;return false;}return null;});return r;},indexOfPanel:function(p){var r=false;Roo.each(this.tabs,function(t,i){if(t.tabId==p.tabId){r=i;return false;}return null;});return r;},showPanel:function(A){if(this.transition){Roo.log("waiting for the transitionend");return;}if(typeof(A)=='number'){A=this.tabs[A];}if(typeof(A)=='string'){A=this.getPanelByName(A);}if(A.tabId==this.getActivePanel().tabId){return true;}var B=this.getActivePanel();if(false===B.fireEvent('beforedeactivate')){return false;}if(this.bullets>0&&!Roo.isTouch){this.setActiveBullet(this.indexOfPanel(A));}if(this.carousel&&typeof(Roo.get(document.body).dom.style.transition)!='undefined'){this.transition=true;var C=this.indexOfPanel(A)>this.indexOfPanel(B)?'next':'prev';var lr=C=='next'?'left':'right';A.el.addClass(C);A.el.dom.offsetWidth;B.el.addClass(lr);A.el.addClass(lr);var D=this;B.el.on('transitionend',function(){Roo.log("trans end?");A.el.removeClass([lr,C]);A.setActive(true);B.el.removeClass([lr]);B.setActive(false);D.transition=false;},this,{single:true});return true;}
+B.setActive(false);A.setActive(true);return true;},showPanelNext:function(){var i=this.indexOfPanel(this.getActivePanel());if(i>=this.tabs.length-1&&!this.autoslide){return;}if(i>=this.tabs.length-1&&this.autoslide){i=-1;}
+this.showPanel(this.tabs[i+1]);},showPanelPrev:function(){var i=this.indexOfPanel(this.getActivePanel());if(i<1&&!this.autoslide){return;}if(i<1&&this.autoslide){i=this.tabs.length;}
+this.showPanel(this.tabs[i-1]);},initBullet:function(){if(Roo.isTouch){return;}var A=this;for(var i=0;i<this.bullets;i++){var B=this.el.select('.bullet-'+i,true).first();if(!B){continue;}
+B.on('click',(function(e,el,o,ii,t){e.preventDefault();A.showPanel(ii);if(A.autoslide&&A.slideFn){clearInterval(A.slideFn);A.slideFn=window.setInterval(function(){A.showPanelNext();},A.timer);}}).createDelegate(this,[i,B],true));}},setActiveBullet:function(i){if(Roo.isTouch){return;}
+Roo.each(this.el.select('.bullet',true).elements,function(el){el.removeClass('selected');});var A=this.el.select('.bullet-'+i,true).first();if(!A){return;}
+A.addClass('selected');}});Roo.apply(Roo.bootstrap.TabGroup,{groups:{},register:function(A){this.groups[A.navId]=A;},get:function(A){if(typeof(this.groups[A])=='undefined'){this.register(new Roo.bootstrap.TabGroup({navId:A}));}return this.groups[A];}});
+//Roo/bootstrap/TabPanel.js
+Roo.bootstrap.TabPanel=function(A){Roo.bootstrap.TabPanel.superclass.constructor.call(this,A);this.addEvents({'changed':true,'beforedeactivate':true});this.tabId=this.tabId||Roo.id();};Roo.extend(Roo.bootstrap.TabPanel,Roo.bootstrap.Component,{active:false,html:false,tabId:false,navId:false,getAutoCreate:function(){var A={tag:'div',cls:'tab-pane item',html:this.html||''};if(this.active){A.cls+=' active';}if(this.tabId){A.tabId=this.tabId;}return A;},initEvents:function(){Roo.log('-------- init events on tab panel ---------');var p=this.parent();this.navId=this.navId||p.navId;if(typeof(this.navId)!='undefined'){var tg=Roo.bootstrap.TabGroup.get(this.navId);Roo.log(['register',tg,this]);tg.register(this);var i=tg.tabs.length-1;if(this.active&&tg.bullets>0&&i<tg.bullets){tg.setActiveBullet(i);}}},onRender:function(ct,A){Roo.bootstrap.TabPanel.superclass.onRender.call(this,ct,A);},setActive:function(A){Roo.log("panel - set active "+this.tabId+"="+A);this.active=A;if(!A){this.el.removeClass('active');}else if(!this.el.hasClass('active')){this.el.addClass('active');}
+this.fireEvent('changed',this,A);}});
+//Roo/bootstrap/DateField.js
+Roo.bootstrap.DateField=function(A){Roo.bootstrap.DateField.superclass.constructor.call(this,A);this.addEvents({show:true,hide:true,select:true});};Roo.extend(Roo.bootstrap.DateField,Roo.bootstrap.Input,{format:"m/d/y",altFormats:"m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d",weekStart:0,viewMode:'',minViewMode:'',todayHighlight:false,todayBtn:false,language:'en',keyboardNavigation:true,calendarWeeks:false,startDate:-Infinity,endDate:Infinity,daysOfWeekDisabled:[],_events:[],singleMode:false,UTCDate:function(){return new Date(Date.UTC.apply(Date,arguments));},UTCToday:function(){var A=new Date();return this.UTCDate(A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate());},getDate:function(){var d=this.getUTCDate();return new Date(d.getTime()+(d.getTimezoneOffset()*60000));},getUTCDate:function(){return this.date;},setDate:function(d){this.setUTCDate(new Date(d.getTime()-(d.getTimezoneOffset()*60000)));},setUTCDate:function(d){this.date=d;this.setValue(this.formatDate(this.date));},onRender:function(ct,A){Roo.bootstrap.DateField.superclass.onRender.call(this,ct,A);this.language=this.language||'en';this.language=this.language in Roo.bootstrap.DateField.dates?this.language:this.language.split('-')[0];this.language=this.language in Roo.bootstrap.DateField.dates?this.language:"en";this.isRTL=Roo.bootstrap.DateField.dates[this.language].rtl||false;this.format=this.format||'m/d/y';this.isInline=false;this.isInput=true;this.component=this.el.select('.add-on',true).first()||false;this.component=(this.component&&this.component.length===0)?false:this.component;this.hasInput=this.component&&this.inputEL().length;if(typeof(this.minViewMode==='string')){switch(this.minViewMode){case 'months':this.minViewMode=1;break;case 'years':this.minViewMode=2;break;default:this.minViewMode=0;break;}}if(typeof(this.viewMode==='string')){switch(this.viewMode){case 'months':this.viewMode=1;break;case 'years':this.viewMode=2;break;default:this.viewMode=0;break;}}
+this.pickerEl=Roo.get(document.body).createChild(Roo.bootstrap.DateField.template);this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.picker().on('mousedown',this.onMousedown,this);this.picker().on('click',this.onClick,this);this.picker().addClass('datepicker-dropdown');this.startViewMode=this.viewMode;if(this.singleMode){Roo.each(this.picker().select('thead > tr > th',true).elements,function(v){v.setVisibilityMode(Roo.Element.DISPLAY)
+v.hide();});Roo.each(this.picker().select('tbody > tr > td',true).elements,function(v){v.setStyle('width','189px');});}
+Roo.each(this.picker().select('tfoot th.today',true).elements,function(v){if(!this.calendarWeeks){v.remove();return;}
+v.dom.innerHTML=Roo.bootstrap.DateField.dates[this.language].today;v.attr('colspan',function(i,B){return parseInt(B)+1;});})
+this.weekEnd=this.weekStart===0?6:this.weekStart-1;this.setStartDate(this.startDate);this.setEndDate(this.endDate);this.setDaysOfWeekDisabled(this.daysOfWeekDisabled);this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show();}},picker:function(){return this.pickerEl;},fillDow:function(){var A=this.weekStart;var B={tag:'tr',cn:[]};if(this.calendarWeeks){B.cn.push({tag:'th',cls:'cw',html:'&nbsp;'})}while(A<this.weekStart+7){B.cn.push({tag:'th',cls:'dow',html:Roo.bootstrap.DateField.dates[this.language].daysMin[(A++)%7]});}
+this.picker().select('>.datepicker-days thead',true).first().createChild(B);},fillMonths:function(){var i=0;var A=this.picker().select('>.datepicker-months td',true).first();A.dom.innerHTML='';while(i<12){var B={tag:'span',cls:'month',html:Roo.bootstrap.DateField.dates[this.language].monthsShort[i++]}
+A.createChild(B);}},update:function(){this.date=(typeof(this.date)==='undefined'||((typeof(this.date)==='string')&&!this.date.length))?this.UTCToday():(typeof(this.date)==='string')?this.parseDate(this.date):this.date;if(this.date<this.startDate){this.viewDate=new Date(this.startDate);}else if(this.date>this.endDate){this.viewDate=new Date(this.endDate);}else {this.viewDate=new Date(this.date);}
+this.fill();},fill:function(){var d=new Date(this.viewDate),A=d.getUTCFullYear(),B=d.getUTCMonth(),C=this.startDate!==-Infinity?this.startDate.getUTCFullYear():-Infinity,D=this.startDate!==-Infinity?this.startDate.getUTCMonth():-Infinity,E=this.endDate!==Infinity?this.endDate.getUTCFullYear():Infinity,F=this.endDate!==Infinity?this.endDate.getUTCMonth():Infinity,G=this.date&&this.date.valueOf(),H=this.UTCToday();this.picker().select('>.datepicker-days thead th.switch',true).first().dom.innerHTML=Roo.bootstrap.DateField.dates[this.language].months[B]+' '+A;this.updateNavArrows();this.fillMonths();var I=this.UTCDate(A,B-1,28,0,0,0,0),J=I.getDaysInMonth(I.getUTCFullYear(),I.getUTCMonth());I.setUTCDate(J);I.setUTCDate(J-(I.getUTCDay()-this.weekStart+7)%7);var K=new Date(I);K.setUTCDate(K.getUTCDate()+42);K=K.valueOf();var L=false;this.picker().select('>.datepicker-days tbody',true).first().dom.innerHTML='';while(I.valueOf()<K){var M='';if(I.getUTCDay()===this.weekStart){if(L){this.picker().select('>.datepicker-days tbody',true).first().createChild(L);}
+L={tag:'tr',cn:[]};if(this.calendarWeeks){var ws=new Date(+I+(this.weekStart-I.getUTCDay()-7)%7*864e5),th=new Date(+ws+(7+4-ws.getUTCDay())%7*864e5),N=new Date(+(N=this.UTCDate(th.getUTCFullYear(),0,1))+(7+4-N.getUTCDay())%7*864e5),O=(th-N)/864e5/7+1;L.cn.push({tag:'td',cls:'cw',html:O});}}if(I.getUTCFullYear()<A||(I.getUTCFullYear()==A&&I.getUTCMonth()<B)){M+=' old';}else if(I.getUTCFullYear()>A||(I.getUTCFullYear()==A&&I.getUTCMonth()>B)){M+=' new';}if(this.todayHighlight&&I.getUTCFullYear()==H.getFullYear()&&I.getUTCMonth()==H.getMonth()&&I.getUTCDate()==H.getDate()){M+=' today';}if(G&&I.valueOf()===G){M+=' active';}if(I.valueOf()<this.startDate||I.valueOf()>this.endDate||this.daysOfWeekDisabled.indexOf(I.getUTCDay())!==-1){M+=' disabled';}
+L.cn.push({tag:'td',cls:'day '+M,html:I.getDate()})
+I.setDate(I.getDate()+1);}var P=this.date&&this.date.getUTCFullYear();var Q=this.date&&this.date.getUTCMonth();this.picker().select('>.datepicker-months th.switch',true).first().dom.innerHTML=A;Roo.each(this.picker().select('>.datepicker-months tbody span',true).elements,function(v,k){v.removeClass('active');if(P===A&&k===Q){v.addClass('active');}if(A<C||A>E||(A==C&&k<D)||(A==E&&k>F)){v.addClass('disabled');}});A=parseInt(A/10,10)*10;this.picker().select('>.datepicker-years th.switch',true).first().dom.innerHTML=A+'-'+(A+9);this.picker().select('>.datepicker-years tbody td',true).first().dom.innerHTML='';A-=1;for(var i=-1;i<11;i++){this.picker().select('>.datepicker-years tbody td',true).first().createChild({tag:'span',cls:'year'+(i===-1||i===10?' old':'')+(P===A?' active':'')+(A<C||A>E?' disabled':''),html:A})
+A+=1;}},showMode:function(A){if(A){this.viewMode=Math.max(this.minViewMode,Math.min(2,this.viewMode+A));}
+Roo.each(this.picker().select('>div',true).elements,function(v){v.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';v.hide();});this.picker().select('>.datepicker-'+Roo.bootstrap.DateField.modes[this.viewMode].clsName,true).first().show();},place:function(){if(this.isInline)return;this.picker().removeClass(['bottom','top']);if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){this.picker().addClass('top');this.picker().setTop(this.inputEl().getTop()-this.picker().getHeight()).setLeft(this.inputEl().getLeft());return;}
+this.picker().addClass('bottom');this.picker().setTop(this.inputEl().getBottom()).setLeft(this.inputEl().getLeft());},parseDate:function(A){if(!A||A instanceof Date){return A;}var v=Date.parseDate(A,this.format);if(!v&&(this.useIso||A.match(/^(\d{4})-0?(\d+)-0?(\d+)/))){v=Date.parseDate(A,'Y-m-d');}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);},onFocus:function(){Roo.bootstrap.DateField.superclass.onFocus.call(this);this.show();},onBlur:function(){Roo.bootstrap.DateField.superclass.onBlur.call(this);var d=this.inputEl().getValue();this.setValue(d);this.hide();},show:function(){this.picker().show();this.update();this.place();this.fireEvent('show',this,this.date);},hide:function(){if(this.isInline)return;this.picker().hide();this.viewMode=this.startViewMode;this.showMode();this.fireEvent('hide',this,this.date);},onMousedown:function(e){e.stopPropagation();e.preventDefault();},keyup:function(e){Roo.bootstrap.DateField.superclass.keyup.call(this);this.update();},setValue:function(v){var d=new Date(this.parseDate(v)).clearTime();if(isNaN(d.getTime())){this.date=this.viewDate='';Roo.bootstrap.DateField.superclass.setValue.call(this,'');return;}
+v=this.formatDate(d);Roo.bootstrap.DateField.superclass.setValue.call(this,v);this.date=new Date(d.getTime()-d.getTimezoneOffset()*60000);this.update();this.fireEvent('select',this,this.date);},getValue:function(){return this.formatDate(this.date);},fireKey:function(e){if(!this.picker().isVisible()){if(e.keyCode==27)this.show();return;}var A=false,B,C,D,E,F;switch(e.keyCode){case 27:this.hide();e.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation)break;B=e.keyCode==37?-1:1;if(e.ctrlKey){E=this.moveYear(this.date,B);F=this.moveYear(this.viewDate,B);}else if(e.shiftKey){E=this.moveMonth(this.date,B);F=this.moveMonth(this.viewDate,B);}else {E=new Date(this.date);E.setUTCDate(this.date.getUTCDate()+B);F=new Date(this.viewDate);F.setUTCDate(this.viewDate.getUTCDate()+B);}if(this.dateWithinRange(E)){this.date=E;this.viewDate=F;this.setValue(this.formatDate(this.date));e.preventDefault();A=true;}break;case 38:case 40:if(!this.keyboardNavigation)break;B=e.keyCode==38?-1:1;if(e.ctrlKey){E=this.moveYear(this.date,B);F=this.moveYear(this.viewDate,B);}else if(e.shiftKey){E=this.moveMonth(this.date,B);F=this.moveMonth(this.viewDate,B);}else {E=new Date(this.date);E.setUTCDate(this.date.getUTCDate()+B*7);F=new Date(this.viewDate);F.setUTCDate(this.viewDate.getUTCDate()+B*7);}if(this.dateWithinRange(E)){this.date=E;this.viewDate=F;this.setValue(this.formatDate(this.date));e.preventDefault();A=true;}break;case 13:this.setValue(this.formatDate(this.date));this.hide();e.preventDefault();break;case 9:this.setValue(this.formatDate(this.date));this.hide();break;case 16:case 17:case 18:break;default:this.hide();}},onClick:function(e){e.stopPropagation();e.preventDefault();var A=e.getTarget();if(A.nodeName.toLowerCase()==='i'){A=Roo.get(A).dom.parentNode;}var B=A.nodeName;var C=A.className;var D=A.innerHTML;switch(B.toLowerCase()){case 'th':switch(C){case 'switch':this.showMode(1);break;case 'prev':case 'next':var E=Roo.bootstrap.DateField.modes[this.viewMode].navStep*(C=='prev'?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,E);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,E);break;}
+this.fill();break;case 'today':var F=new Date();this.date=this.UTCDate(F.getFullYear(),F.getMonth(),F.getDate(),0,0,0);this.setValue(this.formatDate(this.date));this.hide();break;}break;case 'span':if(C.indexOf('disabled')<0){this.viewDate.setUTCDate(1);if(C.indexOf('month')>-1){this.viewDate.setUTCMonth(Roo.bootstrap.DateField.dates[this.language].monthsShort.indexOf(D));}else {var G=parseInt(D,10)||0;this.viewDate.setUTCFullYear(G);}if(this.singleMode){this.setValue(this.formatDate(this.viewDate));this.hide();return;}
+this.showMode(-1);this.fill();}break;case 'td':if(C.indexOf('day')>-1&&C.indexOf('disabled')<0){var H=parseInt(D,10)||1;var G=this.viewDate.getUTCFullYear(),I=this.viewDate.getUTCMonth();if(C.indexOf('old')>-1){if(I===0){I=11;G-=1;}else {I-=1;}}else if(C.indexOf('new')>-1){if(I==11){I=0;G+=1;}else {I+=1;}}
+this.date=this.UTCDate(G,I,H,0,0,0,0);this.viewDate=this.UTCDate(G,I,Math.min(28,H),0,0,0,0);this.setValue(this.formatDate(this.date));this.hide();}break;}},setStartDate:function(A){this.startDate=A||-Infinity;if(this.startDate!==-Infinity){this.startDate=this.parseDate(this.startDate);}
+this.update();this.updateNavArrows();},setEndDate:function(A){this.endDate=A||Infinity;if(this.endDate!==Infinity){this.endDate=this.parseDate(this.endDate);}
+this.update();this.updateNavArrows();},setDaysOfWeekDisabled:function(A){this.daysOfWeekDisabled=A||[];if(typeof(this.daysOfWeekDisabled)!=='object'){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/);}
+this.daysOfWeekDisabled=this.daysOfWeekDisabled.map(function(d){return parseInt(d,10);});this.update();this.updateNavArrows();},updateNavArrows:function(){if(this.singleMode){return;}var d=new Date(this.viewDate),A=d.getUTCFullYear(),B=d.getUTCMonth();Roo.each(this.picker().select('.prev',true).elements,function(v){v.show();switch(this.viewMode){case 0:if(this.startDate!==-Infinity&&A<=this.startDate.getUTCFullYear()&&B<=this.startDate.getUTCMonth()){v.hide();}break;case 1:case 2:if(this.startDate!==-Infinity&&A<=this.startDate.getUTCFullYear()){v.hide();}break;}});Roo.each(this.picker().select('.next',true).elements,function(v){v.show();switch(this.viewMode){case 0:if(this.endDate!==Infinity&&A>=this.endDate.getUTCFullYear()&&B>=this.endDate.getUTCMonth()){v.hide();}break;case 1:case 2:if(this.endDate!==Infinity&&A>=this.endDate.getUTCFullYear()){v.hide();}break;}})},moveMonth:function(A,B){if(!B)return A;var C=new Date(A.valueOf()),D=C.getUTCDate(),E=C.getUTCMonth(),F=Math.abs(B),G,H;B=B>0?1:-1;if(F==1){H=B==-1?function(){return C.getUTCMonth()==E;}:function(){return C.getUTCMonth()!=G;};G=E+B;C.setUTCMonth(G);if(G<0||G>11)G=(G+12)%12;}else {for(var i=0;i<F;i++)C=this.moveMonth(C,B);G=C.getUTCMonth();C.setUTCDate(D);H=function(){return G!=C.getUTCMonth();};}while(H()){C.setUTCDate(--D);C.setUTCMonth(G);}return C;},moveYear:function(A,B){return this.moveMonth(A,B*12);},dateWithinRange:function(A){return A>=this.startDate&&A<=this.endDate;},remove:function(){this.picker().remove();}});Roo.apply(Roo.bootstrap.DateField,{head:{tag:'thead',cn:[{tag:'tr',cn:[{tag:'th',cls:'prev',html:'<i class="fa fa-arrow-left"/>'},{tag:'th',cls:'switch',colspan:'5'},{tag:'th',cls:'next',html:'<i class="fa fa-arrow-right"/>'}]}]},content:{tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:'7'}]}]},footer:{tag:'tfoot',cn:[{tag:'tr',cn:[{tag:'th',colspan:'7',cls:'today'}]}]},dates:{en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today"}},modes:[{clsName:'days',navFnc:'Month',navStep:1},{clsName:'months',navFnc:'FullYear',navStep:1},{clsName:'years',navFnc:'FullYear',navStep:10}]});Roo.apply(Roo.bootstrap.DateField,{template:{tag:'div',cls:'datepicker dropdown-menu roo-dynamic',cn:[{tag:'div',cls:'datepicker-days',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.head,{tag:'tbody'},Roo.bootstrap.DateField.footer]}]},{tag:'div',cls:'datepicker-months',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.head,Roo.bootstrap.DateField.content,Roo.bootstrap.DateField.footer]}]},{tag:'div',cls:'datepicker-years',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.head,Roo.bootstrap.DateField.content,Roo.bootstrap.DateField.footer]}]}]}});
+//Roo/bootstrap/TimeField.js
+Roo.bootstrap.TimeField=function(A){Roo.bootstrap.TimeField.superclass.constructor.call(this,A);this.addEvents({show:true,hide:true,select:true});};Roo.extend(Roo.bootstrap.TimeField,Roo.bootstrap.Input,{format:"H:i",onRender:function(ct,A){Roo.bootstrap.TimeField.superclass.onRender.call(this,ct,A);this.el.select('>.input-group',true).first().createChild(Roo.bootstrap.TimeField.template);this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.pop=this.picker().select('>.datepicker-time',true).first();this.pop.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.picker().on('mousedown',this.onMousedown,this);this.picker().on('click',this.onClick,this);this.picker().addClass('datepicker-dropdown');this.fillTime();this.update();this.pop.select('span.hours-up',true).first().on('click',this.onIncrementHours,this);this.pop.select('span.hours-down',true).first().on('click',this.onDecrementHours,this);this.pop.select('span.minutes-up',true).first().on('click',this.onIncrementMinutes,this);this.pop.select('span.minutes-down',true).first().on('click',this.onDecrementMinutes,this);this.pop.select('button.period',true).first().on('click',this.onTogglePeriod,this);this.pop.select('button.ok',true).first().on('click',this.setTime,this);},fireKey:function(e){if(!this.picker().isVisible()){if(e.keyCode==27){this.show();}return;}
+e.preventDefault();switch(e.keyCode){case 27:this.hide();break;case 37:case 39:this.onTogglePeriod();break;case 38:this.onIncrementMinutes();break;case 40:this.onDecrementMinutes();break;case 13:case 9:this.setTime();break;}},onClick:function(e){e.stopPropagation();e.preventDefault();},picker:function(){return this.el.select('.datepicker',true).first();},fillTime:function(){var A=this.pop.select('tbody',true).first();A.dom.innerHTML='';A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-up glyphicon glyphicon-chevron-up'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-up glyphicon glyphicon-chevron-up'}]}]},{tag:'td',cls:'separator'}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'span',cls:'timepicker-hour',html:'00'}]},{tag:'td',cls:'separator',html:':'},{tag:'td',cn:[{tag:'span',cls:'timepicker-minute',html:'00'}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'button',type:'button',cls:'btn btn-primary period',html:'AM'}]}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-down glyphicon glyphicon-chevron-down'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-down glyphicon glyphicon-chevron-down'}]}]},{tag:'td',cls:'separator'}]});},update:function(){this.time=(typeof(this.time)==='undefined')?new Date():this.time;this.fill();},fill:function(){var A=this.time.getHours();var B=this.time.getMinutes();var C='AM';if(A>11){C='PM';}if(A==0){A=12;}if(A>12){A=A-12;}if(A<10){A='0'+A;}if(B<10){B='0'+B;}
+this.pop.select('.timepicker-hour',true).first().dom.innerHTML=A;this.pop.select('.timepicker-minute',true).first().dom.innerHTML=B;this.pop.select('button',true).first().dom.innerHTML=C;},place:function(){this.picker().removeClass(['bottom-left','bottom-right','top-left','top-right']);var A=['bottom'];if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){A.pop();A.push('top');}
+A.push('right');if((Roo.lib.Dom.getViewWidth()+Roo.get(document.body).getScroll().left)-(this.inputEl().getLeft()+this.picker().getWidth())<0){A.pop();A.push('left');}
+this.picker().addClass(A.join('-'));var B=this;Roo.each(A,function(c){if(c=='bottom'){B.picker().setTop(B.inputEl().getHeight());return;}if(c=='top'){B.picker().setTop(0-B.picker().getHeight());return;}if(c=='left'){B.picker().setLeft(B.inputEl().getLeft()+B.inputEl().getWidth()-B.el.getLeft()-B.picker().getWidth());return;}if(c=='right'){B.picker().setLeft(B.inputEl().getLeft()-B.el.getLeft());return;}});},onFocus:function(){Roo.bootstrap.TimeField.superclass.onFocus.call(this);this.show();},onBlur:function(){Roo.bootstrap.TimeField.superclass.onBlur.call(this);this.hide();},show:function(){this.picker().show();this.pop.show();this.update();this.place();this.fireEvent('show',this,this.date);},hide:function(){this.picker().hide();this.pop.hide();this.fireEvent('hide',this,this.date);},setTime:function(){this.hide();this.setValue(this.time.format(this.format));this.fireEvent('select',this,this.date);},onMousedown:function(e){e.stopPropagation();e.preventDefault();},onIncrementHours:function(){Roo.log('onIncrementHours');this.time=this.time.add(Date.HOUR,1);this.update();},onDecrementHours:function(){Roo.log('onDecrementHours');this.time=this.time.add(Date.HOUR,-1);this.update();},onIncrementMinutes:function(){Roo.log('onIncrementMinutes');this.time=this.time.add(Date.MINUTE,1);this.update();},onDecrementMinutes:function(){Roo.log('onDecrementMinutes');this.time=this.time.add(Date.MINUTE,-1);this.update();},onTogglePeriod:function(){Roo.log('onTogglePeriod');this.time=this.time.add(Date.HOUR,12);this.update();}});Roo.apply(Roo.bootstrap.TimeField,{content:{tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:'7'}]}]},footer:{tag:'tfoot',cn:[{tag:'tr',cn:[{tag:'th',colspan:'7',cls:'',cn:[{tag:'button',cls:'btn btn-info ok',html:'OK'}]}]}]}});Roo.apply(Roo.bootstrap.TimeField,{template:{tag:'div',cls:'datepicker dropdown-menu',cn:[{tag:'div',cls:'datepicker-time',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.TimeField.content,Roo.bootstrap.TimeField.footer]}]}]}});
+//Roo/bootstrap/MonthField.js
+Roo.bootstrap.MonthField=function(A){Roo.bootstrap.MonthField.superclass.constructor.call(this,A);this.addEvents({show:true,hide:true,select:true});};Roo.extend(Roo.bootstrap.MonthField,Roo.bootstrap.Input,{onRender:function(ct,A){Roo.bootstrap.MonthField.superclass.onRender.call(this,ct,A);this.language=this.language||'en';this.language=this.language in Roo.bootstrap.MonthField.dates?this.language:this.language.split('-')[0];this.language=this.language in Roo.bootstrap.MonthField.dates?this.language:"en";this.isRTL=Roo.bootstrap.MonthField.dates[this.language].rtl||false;this.isInline=false;this.isInput=true;this.component=this.el.select('.add-on',true).first()||false;this.component=(this.component&&this.component.length===0)?false:this.component;this.hasInput=this.component&&this.inputEL().length;this.pickerEl=Roo.get(document.body).createChild(Roo.bootstrap.MonthField.template);this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.picker().on('mousedown',this.onMousedown,this);this.picker().on('click',this.onClick,this);this.picker().addClass('datepicker-dropdown');Roo.each(this.picker().select('tbody > tr > td',true).elements,function(v){v.setStyle('width','189px');});this.fillMonths();this.update();if(this.isInline){this.show();}},setValue:function(v,A){var o=this.getValue();Roo.bootstrap.MonthField.superclass.setValue.call(this,v);this.update();if(A!==true){this.fireEvent('select',this,o,v);}},getValue:function(){return this.value;},onClick:function(e){e.stopPropagation();e.preventDefault();var A=e.getTarget();if(A.nodeName.toLowerCase()==='i'){A=Roo.get(A).dom.parentNode;}var B=A.nodeName;var C=A.className;var D=A.innerHTML;if(B.toLowerCase()!='span'||C.indexOf('disabled')>-1||C.indexOf('month')==-1){return;}
+this.vIndex=Roo.bootstrap.MonthField.dates[this.language].monthsShort.indexOf(D);this.setValue(Roo.bootstrap.MonthField.dates[this.language].months[this.vIndex]);this.hide();},picker:function(){return this.pickerEl;},fillMonths:function(){var i=0;var A=this.picker().select('>.datepicker-months td',true).first();A.dom.innerHTML='';while(i<12){var B={tag:'span',cls:'month',html:Roo.bootstrap.MonthField.dates[this.language].monthsShort[i++]}
+A.createChild(B);}},update:function(){var A=this;if(typeof(this.vIndex)=='undefined'&&this.value.length){this.vIndex=Roo.bootstrap.MonthField.dates[this.language].months.indexOf(this.value);}
+Roo.each(this.pickerEl.select('> .datepicker-months tbody > tr > td > span',true).elements,function(e,k){e.removeClass('active');if(typeof(A.vIndex)!='undefined'&&k==A.vIndex){e.addClass('active');}})},place:function(){if(this.isInline)return;this.picker().removeClass(['bottom','top']);if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){this.picker().addClass('top');this.picker().setTop(this.inputEl().getTop()-this.picker().getHeight()).setLeft(this.inputEl().getLeft());return;}
+this.picker().addClass('bottom');this.picker().setTop(this.inputEl().getBottom()).setLeft(this.inputEl().getLeft());},onFocus:function(){Roo.bootstrap.MonthField.superclass.onFocus.call(this);this.show();},onBlur:function(){Roo.bootstrap.MonthField.superclass.onBlur.call(this);var d=this.inputEl().getValue();this.setValue(d);this.hide();},show:function(){this.picker().show();this.picker().select('>.datepicker-months',true).first().show();this.update();this.place();this.fireEvent('show',this,this.date);},hide:function(){if(this.isInline)return;this.picker().hide();this.fireEvent('hide',this,this.date);},onMousedown:function(e){e.stopPropagation();e.preventDefault();},keyup:function(e){Roo.bootstrap.MonthField.superclass.keyup.call(this);this.update();},fireKey:function(e){if(!this.picker().isVisible()){if(e.keyCode==27)this.show();return;}var A;switch(e.keyCode){case 27:this.hide();e.preventDefault();break;case 37:case 39:A=e.keyCode==37?-1:1;this.vIndex=this.vIndex+A;if(this.vIndex<0){this.vIndex=0;}if(this.vIndex>11){this.vIndex=11;}if(isNaN(this.vIndex)){this.vIndex=0;}
+this.setValue(Roo.bootstrap.MonthField.dates[this.language].months[this.vIndex]);break;case 38:case 40:A=e.keyCode==38?-1:1;this.vIndex=this.vIndex+A*4;if(this.vIndex<0){this.vIndex=0;}if(this.vIndex>11){this.vIndex=11;}if(isNaN(this.vIndex)){this.vIndex=0;}
+this.setValue(Roo.bootstrap.MonthField.dates[this.language].months[this.vIndex]);break;case 13:if(typeof(this.vIndex)!='undefined'&&!isNaN(this.vIndex)){this.setValue(Roo.bootstrap.MonthField.dates[this.language].months[this.vIndex]);}
+this.hide();e.preventDefault();break;case 9:if(typeof(this.vIndex)!='undefined'&&!isNaN(this.vIndex)){this.setValue(Roo.bootstrap.MonthField.dates[this.language].months[this.vIndex]);}
+this.hide();break;case 16:case 17:case 18:break;default:this.hide();}},remove:function(){this.picker().remove();}});Roo.apply(Roo.bootstrap.MonthField,{content:{tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:'7'}]}]},dates:{en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}}});Roo.apply(Roo.bootstrap.MonthField,{template:{tag:'div',cls:'datepicker dropdown-menu roo-dynamic',cn:[{tag:'div',cls:'datepicker-months',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.content]}]}]}});
+//Roo/bootstrap/CheckBox.js
+Roo.bootstrap.CheckBox=function(A){Roo.bootstrap.CheckBox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.bootstrap.CheckBox,Roo.bootstrap.Input,{inputType:'checkbox',inputValue:1,valueOff:0,boxLabel:false,checked:false,weight:false,inline:false,getAutoCreate:function(){var A=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign;var id=Roo.id();var B={};B.cls='form-group '+this.inputType;if(this.inline){B.cls+=' '+this.inputType+'-inline';}var C={tag:'input',id:id,type:this.inputType,value:this.inputType=='radio'?this.inputValue:((!this.checked)?this.valueOff:this.inputValue),cls:'roo-'+this.inputType,placeholder:this.placeholder||''};if(this.weight){B.cls+=" "+this.inputType+"-"+this.weight;}if(this.disabled){C.disabled=true;}if(this.checked){C.checked=this.checked;}if(this.name){C.name=this.name;}if(this.size){C.cls+=' input-'+this.size;}var D=this;['xs','sm','md','lg'].map(function(G){if(D[G]){B.cls+=' col-'+G+'-'+D[G];}});var E=C;if(this.before||this.after){E={cls:'input-group',cn:[]};if(this.before){E.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}
+E.cn.push(C);if(this.after){E.cn.push({tag:'span',cls:'input-group-addon',html:this.after});}}if(A==='left'&&this.fieldLabel.length){Roo.log("left and has label");B.cn=[{tag:'label','for':id,cls:'control-label col-md-'+this.labelWidth,html:this.fieldLabel},{cls:"col-md-"+(12-this.labelWidth),cn:[E]}];}else if(this.fieldLabel.length){Roo.log(" label");B.cn=[{tag:this.boxLabel?'span':'label','for':id,cls:'control-label box-input-label',html:this.fieldLabel},E];}else {Roo.log(" no label && no align");B.cn=[E];}if(this.boxLabel){var F={tag:'label',cls:'box-label',html:this.boxLabel};if(this.tooltip){F.tooltip=this.tooltip;}
+B.cn.push(F);}return B;},inputEl:function(){return this.el.select('input.roo-'+this.inputType,true).first();},labelEl:function(){return this.el.select('label.control-label',true).first();},label:function(){return this.labelEl();},initEvents:function(){this.inputEl().on('click',this.onClick,this);if(this.boxLabel){this.el.select('label.box-label',true).first().on('click',this.onClick,this);}
+this.startValue=this.getValue();if(this.groupId){Roo.bootstrap.CheckBox.register(this);}},onClick:function(){this.setChecked(!this.checked);},setChecked:function(A,B){this.startValue=this.getValue();if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.dom.checked=false;});this.inputEl().dom.checked=true;this.inputEl().dom.value=this.inputValue;if(B!==true){this.fireEvent('check',this,true);}
+this.validate();return;}
+this.checked=A;this.inputEl().dom.checked=A;this.inputEl().dom.value=A?this.inputValue:this.valueOff;if(B!==true){this.fireEvent('check',this,A);}
+this.validate();},getValue:function(){if(this.inputType=='radio'){return this.getGroupValue();}return this.inputEl().getValue();},getGroupValue:function(){if(typeof(this.el.up('form').child('input[name='+this.name+']:checked',true))=='undefined'){return '';}return this.el.up('form').child('input[name='+this.name+']:checked',true).value;},setValue:function(v,A){if(this.inputType=='radio'){this.setGroupValue(v,A);return;}
+this.setChecked(((typeof(v)=='undefined')?this.checked:(String(v)===String(this.inputValue))),A);this.validate();},setGroupValue:function(v,A){this.startValue=this.getValue();Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.dom.checked=false;if(e.dom.value==v){e.dom.checked=true;}});if(A!==true){this.fireEvent('check',this,true);}
+this.validate();return;},validate:function(){if(this.disabled||(this.inputType=='radio'&&this.validateRadio())||(this.inputType=='checkbox'&&this.validateCheckbox())){this.markValid();return true;}
+this.markInvalid();return false;},validateRadio:function(){var A=false;Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){if(!e.dom.checked){return;}
+A=true;return false;});return A;},validateCheckbox:function(){if(!this.groupId){return (this.getValue()==this.inputValue||this.allowBlank)?true:false;}var A=Roo.bootstrap.CheckBox.get(this.groupId);if(!A){return false;}var r=false;for(var i in A){if(r){break;}
+r=(A[i].getValue()==A[i].inputValue)?true:false;}return r;},markValid:function(){if(this.allowBlank){return;}var A=this;this.fireEvent('valid',this);if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.findParent('.form-group',false,true).removeClass([A.invalidClass,A.validClass]);e.findParent('.form-group',false,true).addClass(A.validClass);});return;}if(!this.groupId){this.el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);this.el.findParent('.form-group',false,true).addClass(this.validClass);return;}var B=Roo.bootstrap.CheckBox.get(this.groupId);if(!B){return;}for(var i in B){B[i].el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);B[i].el.findParent('.form-group',false,true).addClass(this.validClass);}},markInvalid:function(A){if(this.allowBlank){return;}var B=this;this.fireEvent('invalid',this,A);if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.findParent('.form-group',false,true).removeClass([B.invalidClass,B.validClass]);e.findParent('.form-group',false,true).addClass(B.invalidClass);});return;}if(!this.groupId){this.el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);this.el.findParent('.form-group',false,true).addClass(this.invalidClass);return;}var C=Roo.bootstrap.CheckBox.get(this.groupId);if(!C){return;}for(var i in C){C[i].el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);C[i].el.findParent('.form-group',false,true).addClass(this.invalidClass);}}});Roo.apply(Roo.bootstrap.CheckBox,{groups:{},register:function(A){if(typeof(this.groups[A.groupId])=='undefined'){this.groups[A.groupId]={};}if(this.groups[A.groupId].hasOwnProperty(A.name)){return;}
+this.groups[A.groupId][A.name]=A;},get:function(A){if(typeof(this.groups[A])=='undefined'){return false;}return this.groups[A];}});
+//Roo/bootstrap/Radio.js
+Roo.bootstrap.Radio=function(A){Roo.bootstrap.Radio.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Radio,Roo.bootstrap.CheckBox,{inputType:'radio',inputValue:'',valueOff:'',getAutoCreate:function(){var A=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign;A=A||'left';var id=Roo.id();var B={tag:this.inline?'span':'div',cls:'',cn:[]};var C=this.inline?' radio-inline':'';var D={tag:'label','for':id,cls:'control-label box-label'+C,cn:[]};var E=this.labelWidth?this.labelWidth*1:100;var F={tag:'label',html:this.fieldLabel,style:'width:'+E+'px;line-height:1;vertical-align:bottom;cursor:default;'};var G={tag:'input',id:id,type:this.inputType,value:this.inputValue,cls:'roo-radio',placeholder:this.placeholder||''};if(this.weight){G.cls+=" radio-"+this.weight;}if(this.disabled){G.disabled=true;}if(this.checked){G.checked=this.checked;}if(this.name){G.name=this.name;}if(this.size){G.cls+=' input-'+this.size;}var H=this;['xs','sm','md','lg'].map(function(K){if(H[K]){B.cls+=' col-'+K+'-'+H[K];}});var I=G;if(this.before||this.after){I={cls:'input-group',tag:'span',cn:[]};if(this.before){I.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}
+I.cn.push(G);if(this.after){I.cn.push({tag:'span',cls:'input-group-addon',html:this.after});}};if(this.fieldLabel&&this.fieldLabel.length){B.cn.push(F);}var J={tag:'span',cls:'radio'+C,cn:[I,D]};B.cn.push(J);if(this.boxLabel){D.cn.push({tag:'span',html:this.boxLabel})}return B;},initEvents:function(){this.inputEl().on('click',this.onClick,this);if(this.boxLabel){Roo.log('find label')
+this.el.select('span.radio label span',true).first().on('click',this.onClick,this);}},inputEl:function(){return this.el.select('input.roo-radio',true).first();},onClick:function(){Roo.log("click");this.setChecked(true);},setChecked:function(A,B){if(A){Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']',true).elements,function(v){v.dom.checked=false;});}
+Roo.log(this.inputEl().dom);this.checked=A;this.inputEl().dom.checked=A;if(B!==true){this.fireEvent('check',this,A);}},getGroupValue:function(){var A='';Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']',true).elements,function(v){if(v.dom.checked==true){A=v.dom.value;}});return A;},getValue:function(){return this.getGroupValue();}});
+//Roo/HtmlEditorCore.js
+Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,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',clearUp:true,black:false,white:false,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 {}
+st+='<style type="text/css">'+'IMG { cursor: pointer } '+'</style>';return '<html><head>'+st+' </head><body class="roo-htmleditor-body"></body></html>';},onRender:function(ct,A){var _t=this;this.el=this.owner.inputEl?this.owner.inputEl():this.owner.el;this.el.dom.style.border='0 none';this.el.dom.setAttribute('tabIndex',-1);this.el.addClass('x-hidden hide');if(Roo.isIE){this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')}
+this.frameId=Roo.id();var B=this.owner.wrap.createChild({tag:'iframe',cls:'form-control',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);},onResize:function(w,h){Roo.log('resize: '+w+','+h);if(!this.iframe){return;}if(typeof w=='number'){this.iframe.style.width=w+'px';}if(typeof h=='number'){this.iframe.style.height=h+'px';if(this.doc){(this.doc.body||this.doc.documentElement).style.height=(h-(this.iframePad*2))+'px';}}},toggleSourceEdit:function(A){this.sourceEditMode=A===true;if(this.sourceEditMode){Roo.get(this.iframe).addClass(['x-hidden','hide']);}else {Roo.get(this.iframe).removeClass(['x-hidden','hide']);this.deferFocus();}},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?bs.match(/text-align:(.*?);/i):false;if(m&&m[1]){A='<div style="'+m[0]+'">'+A+'</div>';}}
+A=this.cleanHtml(A);A=A.replace(/([\x80-\uffff])/g,function(a,b){var cc=b.charCodeAt();if((cc>=0x4E00&&cc<0xA000)||(cc>=0x3400&&cc<0x4E00)||(cc>=0xf900&&cc<0xfb00)){return b;}return "&#"+cc+";"});if(this.owner.fireEvent('beforesync',this,A)!==false){this.el.dom.value=A;this.owner.fireEvent('sync',this,A);}}},pushValue:function(){if(this.initialized){var v=this.el.dom.value.trim();if(this.owner.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.owner.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)&&!A.contentDocument){return;}
+this.doc=(A.contentDocument||Roo.get(this.frameId).dom.document);this.win=(A.contentWindow||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);A.bgProperties='fixed';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.owner.fireEvent('initialize',this);this.pushValue();},onDestroy:function(){if(this.rendered){}},onFirstFocus:function(){this.assignDocWin();this.activated=true;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.owner.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.owner.fireEvent('editorevent',this,e);this.syncValue();},insertTag:function(tg){if(tg.toLowerCase()=='span'||tg.toLowerCase()=='code'){range=this.createRange(this.getSelection());var A=this.doc.createElement(tg.toLowerCase());A.appendChild(range.extractContents());range.insertNode(A);return;}
+this.execCmd("formatblock",tg);},insertText:function(A){var B=this.createRange();B.deleteContents();B.insertNode(this.doc.createTextNode(A));},relayCmd:function(A,B){this.win.focus();this.execCmd(A,B);this.owner.fireEvent('editorevent',this);this.owner.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.isGecko||Roo.isOpera||Roo.isSafari){this.win.focus();var B,C;var D=this.win;if(D.getSelection&&D.getSelection().getRangeAt){B=D.getSelection().getRangeAt(0);C=typeof(A)=='string'?B.createContextualFragment(A):A;B.insertNode(C);}else if(D.document.selection&&D.document.selection.createRange){var E=typeof(A)=='string'?A:A.outerHTML;D.document.selection.createRange().pasteHTML(E);}else {var E=typeof(A)=='string'?A:A.outerHTML;this.execCmd('InsertHTML',E);}this.syncValue();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;}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){C.selectNodeContents(B);}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){C.selectNodeContents(B);}
+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.HtmlEditorCore;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){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A);return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if(C){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;}if(v.match(/^#/)){return;}
+A.removeAttribute(n);}var D=this.cwhite;var E=this.cblack;function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var F=v.split(/;/);var G=[];Roo.each(F,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,'');if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(D.length&&E.indexOf(l)>-1){return true;}if(D.length&&D.indexOf(l)<0){return true;}
+G.push(p);return true;});if(G.length){A.setAttribute(n,G.join(';'));}else {A.removeAttribute(n);}}for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(a.name.toLowerCase().substr(0,2)=='on'){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.ablack.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.aclean.indexOf(a.name.toLowerCase())>-1){cleanAttr(a.name,a.value);continue;}if(a.name=='style'){cleanStyle(a.name,a.value);continue;}if(a.name=='class'){if(a.value.match(/^Mso/)){A.className='';}if(a.value.match(/body/)){A.className='';}continue;}}
+this.cleanUpChildren(A);},cleanWord:function(A){if(!A){this.cleanWord(this.doc.body);return;}if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(style|script|applet|embed|noframes|noscript)$/)){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|font)/)){while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);A.parentNode.insertBefore(cn,A);}
+A.parentNode.removeChild(A);this.iterateChildren(A,this.cleanWord);return;}if(A.className.length){var cn=A.className.split(/\W+/);var B=[];Roo.each(cn,function(E){if(E.match(/Mso[a-zA-Z]+/)){return;}
+B.push(E);});A.className=B.length?B.join(' '):'';if(!B.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var C=A.getAttribute("style").split(";");var D=[];Roo.each(C,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;}
+D.push(s);});A.setAttribute("style",D.length?D.join(';'):'');if(!D.length){A.removeAttribute('style');}}
+this.iterateChildren(A,this.cleanWord);},iterateChildren:function(A,fn){if(!A.childNodes.length){return;}for(var i=A.childNodes.length-1;i>-1;i--){fn.call(this,A.childNodes[i])}},cleanTableWidths:function(A){if(!A){this.cleanTableWidths(this.doc.body);return;}if(A.nodeName=="#text"||A.nodeName=="#comment"){return;}
+Roo.log(A.tagName);if(!A.tagName.toLowerCase().match(/^(table|td|tr)$/)){this.iterateChildren(A,this.cleanTableWidths);return;}if(A.hasAttribute('width')){A.removeAttribute('width');}if(A.hasAttribute("style")){var B=A.getAttribute("style").split(";");var C=[];Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^\s*(width|min-width)\s*$/)){return;}
+C.push(s);});A.setAttribute("style",C.length?C.join(';'):'');if(!C.length){A.removeAttribute('style');}}
+this.iterateChildren(A,this.cleanTableWidths);},domToHTML:function(A,B,C){B=B||0;C=C||false;if(!A){return this.domToHTML(this.doc.body);}var j;var D=false;var E=A.nodeName;var F=Roo.util.Format.htmlEncode(A.tagName);if(E=='#text'){return C?A.nodeValue:A.nodeValue.trim();}var G='';if(E!='BODY'){var i=0;if(F){var H=[];for(i=0;i<A.attributes.length;i++){var I=A.attributes.item(i).name;if(!A.attributes.item(i).value.length){continue;}
+H.push(I+'="'+Roo.util.Format.htmlEncode(A.attributes.item(i).value)+'"');}
+G="<"+A.tagName+(H.length?(' '+H.join(' ')):'')+">";}else {}}else {F=false;}if(['IMG','BR','HR','INPUT'].indexOf(F)>-1){return G;}if(['PRE','TEXTAREA','TD','A','SPAN'].indexOf(F)>-1){C=true;}
+i=0;var J=A.childNodes.item(i);var D=true;var K='';lastnode='';while(J){var L=C;if(lastnode=='SPAN'){L=true;}if(J.nodeName=='#text'){var M=Roo.util.Format.htmlEncode(J.nodeValue);M=C?M:M.trim();if(!L&&M.length>80){K+="\n"+(new Array(B+1)).join("  ");}
+K+=M;i++;J=A.childNodes.item(i);lastNode='';continue;}
+D=false;K+=L?'':"\n"+(new Array(B+1)).join("  ");K+=this.domToHTML(J,B+1,C);lastnode=J.nodeName;i++;J=A.childNodes.item(i);}
+G+=K;if(!D){G+=C?'':"\n"+(new Array(B)).join("  ");}if(F){G+="</"+F+">";}return G;},applyBlacklists:function(){var w=typeof(this.owner.white)!='undefined'&&this.owner.white?this.owner.white:[];var b=typeof(this.owner.black)!='undefined'&&this.owner.black?this.owner.black:[];this.white=[];this.black=[];Roo.each(Roo.HtmlEditorCore.white,function(A){if(b.indexOf(A)>-1){return;}
+this.white.push(A);},this);Roo.each(w,function(A){if(b.indexOf(A)>-1){return;}if(this.white.indexOf(A)>-1){return;}
+this.white.push(A);},this);Roo.each(Roo.HtmlEditorCore.black,function(A){if(w.indexOf(A)>-1){return;}
+this.black.push(A);},this);Roo.each(b,function(A){if(w.indexOf(A)>-1){return;}if(this.black.indexOf(A)>-1){return;}
+this.black.push(A);},this);w=typeof(this.owner.cwhite)!='undefined'&&this.owner.cwhite?this.owner.cwhite:[];b=typeof(this.owner.cblack)!='undefined'&&this.owner.cblack?this.owner.cblack:[];this.cwhite=[];this.cblack=[];Roo.each(Roo.HtmlEditorCore.cwhite,function(A){if(b.indexOf(A)>-1){return;}
+this.cwhite.push(A);},this);Roo.each(w,function(A){if(b.indexOf(A)>-1){return;}if(this.cwhite.indexOf(A)>-1){return;}
+this.cwhite.push(A);},this);Roo.each(Roo.HtmlEditorCore.cblack,function(A){if(w.indexOf(A)>-1){return;}
+this.cblack.push(A);},this);Roo.each(b,function(A){if(w.indexOf(A)>-1){return;}if(this.cblack.indexOf(A)>-1){return;}
+this.cblack.push(A);},this);},setStylesheets:function(A){if(typeof(A)=='string'){Roo.get(this.iframe.contentDocument.head).createChild({tag:'link',rel:'stylesheet',type:'text/css',href:A});return;}var B=this;Roo.each(A,function(s){if(!s.length){return;}
+Roo.get(B.iframe.contentDocument.head).createChild({tag:'link',rel:'stylesheet',type:'text/css',href:s});});},removeStylesheets:function(){var A=this;Roo.each(Roo.get(A.iframe.contentDocument.head).select('link[rel=stylesheet]',true).elements,function(s){s.remove();});}});Roo.HtmlEditorCore.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.HtmlEditorCore.black=['applet','base','basefont','bgsound','blink','body','frame','frameset','head','html','ilayer','iframe','layer','link','meta','object','script','style','title','xml'];Roo.HtmlEditorCore.clean=['script','style','title','xml'];Roo.HtmlEditorCore.remove=['font'];Roo.HtmlEditorCore.ablack=['on'];Roo.HtmlEditorCore.aclean=['action','background','codebase','dynsrc','href','lowsrc'];Roo.HtmlEditorCore.pwhite=['http','https','mailto'];Roo.HtmlEditorCore.cwhite=[];Roo.HtmlEditorCore.cblack=[];Roo.HtmlEditorCore.swapCodes=[[8211,"--"],[8212,"--"],[8216,"'"],[8217,"'"],[8220,'"'],[8221,'"'],[8226,"*"],[8230,"..."]];
+//Roo/bootstrap/HtmlEditor.js
+Roo.bootstrap.HtmlEditor=function(A){Roo.bootstrap.HtmlEditor.superclass.constructor.call(this,A);if(!this.toolbars){this.toolbars=[];}
+this.editorcore=new Roo.HtmlEditorCore(Roo.apply({owner:this},A));this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editmodechange:true,editorevent:true,firstfocus:true,autosave:true,savedpreview:true});};Roo.extend(Roo.bootstrap.HtmlEditor,Roo.bootstrap.TextArea,{toolbars:false,resizable:false,height:300,width:false,stylesheets:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',tbContainer:false,toolbarContainer:function(){return this.wrap.select('.x-html-editor-tb',true).first();},createToolbar:function(){Roo.log("create toolbars");this.toolbars=[new Roo.bootstrap.htmleditor.ToolbarStandard({editor:this})];this.toolbars[0].render(this.toolbarContainer());return;},onRender:function(ct,A){var _t=this;Roo.bootstrap.HtmlEditor.superclass.onRender.call(this,ct,A);this.wrap=this.inputEl().wrap({cls:'x-html-editor-wrap',cn:{cls:'x-html-editor-tb'}});this.editorcore.onRender(ct,A);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.createToolbar(this);if(!this.width&&this.resizable){this.setSize(this.wrap.getSize());}if(this.resizeEl){this.resizeEl.resizeTo.defer(100,this.resizeEl,[this.width,this.height]);}},onResize:function(w,h){Roo.log('resize: '+w+','+h);Roo.bootstrap.HtmlEditor.superclass.onResize.apply(this,arguments);var ew=false;var eh=false;if(this.inputEl()){if(typeof w=='number'){var aw=w-this.wrap.getFrameWidth('lr');this.inputEl().setWidth(this.adjustWidth('textarea',aw));ew=aw;}if(typeof h=='number'){var A=-11;for(var i=0;i<this.toolbars.length;i++){A+=this.toolbars[i].el.getHeight();}var ah=h-this.wrap.getFrameWidth('tb')-A;ah-=5;this.inputEl().setHeight(this.adjustWidth('textarea',ah));var eh=ah;}}
+Roo.log('onResize:'+[w,h,ew,eh].join(','));this.editorcore.onResize(ew,eh);},toggleSourceEdit:function(A){this.editorcore.toggleSourceEdit(A);if(this.editorcore.sourceEditMode){Roo.log('editor - showing textarea');this.syncValue();this.inputEl().removeClass(['hide','x-hidden']);this.inputEl().dom.removeAttribute('tabIndex');this.inputEl().focus();}else {Roo.log('editor - hiding textarea');this.pushValue();this.inputEl().addClass(['hide','x-hidden']);this.inputEl().dom.setAttribute('tabIndex',-1);}if(this.resizable){this.setSize(this.wrap.getSize());}
+this.fireEvent('editmodechange',this,this.editorcore.sourceEditMode);},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},initEvents:function(){this.originalValue=this.getValue();},setValue:function(v){Roo.bootstrap.HtmlEditor.superclass.setValue.call(this,v);this.editorcore.pushValue();},deferFocus:function(){this.focus.defer(10,this);},focus:function(){this.editorcore.focus();},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.editorcore.onFirstFocus();for(var i=0;i<this.toolbars.length;i++){this.toolbars[i].onFirstFocus();}},syncValue:function(){this.editorcore.syncValue();},pushValue:function(){this.editorcore.pushValue();}});
+//Roo/bootstrap/htmleditor/ToolbarStandard.js
+Roo.namespace('Roo.bootstrap.htmleditor');Roo.bootstrap.htmleditor.ToolbarStandard=function(A){Roo.apply(this,A);this.disable=this.disable||{};Roo.applyIf(this.disable,{fontSize:true,colors:true,specialElements:true});Roo.bootstrap.htmleditor.ToolbarStandard.superclass.constructor.call(this,A);this.editor=A.editor;this.editorcore=A.editor.editorcore;this.buttons=new Roo.util.MixedCollection(false,function(o){return o.cmd;});}
+Roo.extend(Roo.bootstrap.htmleditor.ToolbarStandard,Roo.bootstrap.NavSimplebar,{bar:true,editor:false,editorcore:false,formats:["p","h1","h2","h3","h4","h5","h6","pre","code","abbr","acronym","address","cite","samp","var",'div','span'],onRender:function(ct,A){Roo.bootstrap.htmleditor.ToolbarStandard.superclass.onRender.call(this,ct,A);Roo.log(this.el);this.el.dom.style.marginBottom='0';var B=this;var C=this.editorcore;var D=this.editor;var E=[];var F=function(id,G,H,I){var J=H?'toggle':'click';var a={size:'sm',xtype:'Button',xns:Roo.bootstrap,glyphicon:id,cmd:id||G,enableToggle:H!==false,pressed:H?false:null,listeners:{}}
+a.listeners[H?'toggle':'click']=function(){I?I.call(B,this):B.onBtnClick.call(B,G||id);}
+E.push(a);return a;};var style={xtype:'Button',size:'sm',xns:Roo.bootstrap,glyphicon:'font',menu:{xtype:'Menu',xns:Roo.bootstrap,items:[]}};Roo.each(this.formats,function(f){style.menu.items.push({xtype:'MenuItem',xns:Roo.bootstrap,html:'<'+f+' style="margin:2px">'+f+'</'+f+'>',tagname:f,listeners:{click:function(){C.insertTag(this.tagname);D.focus();}}});});E.push(style);F('bold',false,true);F('italic',false,true);F('align-left','justifyleft',true);F('align-center','justifycenter',true);F('align-right','justifyright',true);F('link',false,false,function(G){var H=prompt(this.createLinkText,this.defaultLinkValue);if(H&&H!='http:/'+'/'){this.editorcore.relayCmd('createlink',H);}}),F('list','insertunorderedlist',true);F('pencil',false,true,function(G){Roo.log(this);this.toggleSourceEdit(G.pressed);});this.xtype='NavSimplebar';for(var i=0;i<E.length;i++){this.buttons.add(this.addxtypeChild(E[i]));}
+D.on('editorevent',this.updateToolbar,this);},onBtnClick:function(id){this.editorcore.relayCmd(id);this.editorcore.focus();},updateToolbar:function(){if(!this.editorcore.activated){this.editor.onFirstFocus();return;}var A=this.buttons;var B=this.editorcore.doc;A.get('bold').setActive(B.queryCommandState('bold'));A.get('italic').setActive(B.queryCommandState('italic'));A.get('align-left').setActive(B.queryCommandState('justifyleft'));A.get('align-center').setActive(B.queryCommandState('justifycenter'));A.get('align-right').setActive(B.queryCommandState('justifyright'));A.get('list').setActive(B.queryCommandState('insertunorderedlist'));Roo.bootstrap.MenuMgr.hideAll();},onFirstFocus:function(){this.buttons.each(function(A){A.enable();});},toggleSourceEdit:function(A){if(A){Roo.log("disabling buttons");this.buttons.each(function(B){if(B.cmd!='pencil'){B.disable();}});}else {Roo.log("enabling buttons");if(this.editorcore.initialized){this.buttons.each(function(B){B.enable();});}}
+Roo.log("calling toggole on editor");this.editor.toggleSourceEdit(A);}});
+//Roo/bootstrap/Table/AbstractSelectionModel.js
+Roo.bootstrap.Table.AbstractSelectionModel=function(){this.locked=false;Roo.bootstrap.Table.AbstractSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.bootstrap.Table.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/bootstrap/Table/RowSelectionModel.js
+Roo.bootstrap.Table.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.bootstrap.Table.RowSelectionModel.superclass.constructor.call(this);this.locked=false;};Roo.extend(Roo.bootstrap.Table.RowSelectionModel,Roo.bootstrap.Table.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/bootstrap/PagingToolbar.js
+Roo.bootstrap.PagingToolbar=function(A){var ds=A.dataSource;this.toolbarItems=[];if(A.items){this.toolbarItems=A.items;}
+Roo.bootstrap.PagingToolbar.superclass.constructor.call(this,A);this.ds=ds;this.cursor=0;if(ds){this.bind(ds);}
+this.navgroup=new Roo.bootstrap.NavGroup({cls:'pagination'});};Roo.extend(Roo.bootstrap.PagingToolbar,Roo.bootstrap.NavSimplebar,{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",buttons:false,onRender:function(ct,A){Roo.bootstrap.PagingToolbar.superclass.onRender.call(this,ct,A);this.navgroup.parentId=this.id;this.navgroup.onRender(this.el,null);if(this.displayInfo){Roo.log(this.el.select('ul.navbar-nav',true).first());this.el.select('ul.navbar-nav',true).first().createChild({cls:'x-paging-info'});this.displayEl=this.el.select('.x-paging-info',true).first();}var B=this;if(this.buttons){Roo.each(B.buttons,function(e){Roo.factory(e).onRender(B.el,null);});}
+Roo.each(B.toolbarItems,function(e){B.navgroup.addItem(e);});this.first=this.navgroup.addItem({tooltip:this.firstText,cls:"prev",icon:'fa fa-backward',disabled:true,preventDefault:true,listeners:{click:this.onClick.createDelegate(this,["first"])}});this.prev=this.navgroup.addItem({tooltip:this.prevText,cls:"prev",icon:'fa fa-step-backward',disabled:true,preventDefault:true,listeners:{click:this.onClick.createDelegate(this,["prev"])}});var C=this.navgroup.addItem({tagtype:'span',cls:'x-paging-position',html:this.beforePageText+'<input type="text" size="3" value="1" class="x-grid-page-number">'+'<span class="x-paging-after">'+String.format(this.afterPageText,1)+'</span>'});this.field=C.el.select('input',true).first();this.field.on("keydown",this.onPagingKeydown,this);this.field.on("focus",function(){this.dom.select();});this.afterTextEl=C.el.select('.x-paging-after',true).first();this.next=this.navgroup.addItem({tooltip:this.nextText,cls:"next",html:' <i class="fa fa-step-forward">',disabled:true,preventDefault:true,listeners:{click:this.onClick.createDelegate(this,["next"])}});this.last=this.navgroup.addItem({tooltip:this.lastText,icon:'fa fa-forward',cls:"next",disabled:true,preventDefault:true,listeners:{click:this.onClick.createDelegate(this,["last"])}});this.loading=this.navgroup.addItem({tooltip:this.refreshText,icon:'fa fa-refresh',preventDefault:true,listeners:{click:this.onClick.createDelegate(this,["refresh"])}});},updateInfo:function(){if(this.displayEl){var A=(typeof(this.getCount)=='undefined')?this.ds.getCount():this.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.dom.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;if(!ds){return;}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/bootstrap/MessageBar.js
+Roo.bootstrap.MessageBar=function(A){Roo.bootstrap.MessageBar.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.MessageBar,Roo.bootstrap.Component,{html:'',weight:'info',closable:false,fixed:false,beforeClass:'bootstrap-sticky-wrap',getAutoCreate:function(){var A={tag:'div',cls:'alert alert-dismissable alert-'+this.weight,cn:[{tag:'span',cls:'message',html:this.html||''}]};if(this.fixed){A.cls+=' alert-messages-fixed';}if(this.closable){A.cn.push({tag:'button',cls:'close',html:'x'});}return A;},onRender:function(ct,A){Roo.bootstrap.Component.superclass.onRender.call(this,ct,A);if(!this.el){var B=Roo.apply({},this.getAutoCreate());B.id=Roo.id();if(this.cls){B.cls+=' '+this.cls;}if(this.style){B.style=this.style;}
+this.el=Roo.get(document.body).createChild(B,Roo.select('.'+this.beforeClass,true).first());this.el.setVisibilityMode(Roo.Element.DISPLAY);}
+this.el.select('>button.close').on('click',this.hide,this);},show:function(){if(!this.rendered){this.render();}
+this.el.show();this.fireEvent('show',this);},hide:function(){if(!this.rendered){this.render();}
+this.el.hide();this.fireEvent('hide',this);},update:function(){this.el.select('>.message',true).first().dom.innerHTML=this.html||'';}});
+//Roo/bootstrap/Graph.js
+Roo.bootstrap.Graph=function(A){Roo.bootstrap.Graph.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Graph,Roo.bootstrap.Component,{sm:4,md:5,graphtype:'bar',g_height:250,g_width:400,g_x:50,g_y:50,g_r:30,opts:{g_type:'soft',g_gutter:'20%'},title:false,getAutoCreate:function(){var A={tag:'div',html:null};return A;},onRender:function(ct,A){Roo.bootstrap.Graph.superclass.onRender.call(this,ct,A);this.raphael=Raphael(this.el.dom);},load:function(A,B,C){this.raphael.clear();if(!A){A=this.graphtype;}if(!C){C=this.opts;}var r=this.raphael,D=function(){this.flag=r.popup(this.bar.x,this.bar.y,this.bar.value||"0").insertBefore(this);},E=function(){this.flag.animate({opacity:0},300,function(){this.remove();});},F=function(){this.sector.stop();this.sector.scale(1.1,1.1,this.cx,this.cy);if(this.label){this.label[0].stop();this.label[0].attr({r:7.5});this.label[1].attr({"font-weight":800});}},G=function(){this.sector.animate({transform:'s1 1 '+this.cx+' '+this.cy},500,"bounce");if(this.label){this.label[0].animate({r:5},500,"bounce");this.label[1].attr({"font-weight":400});}};switch(A){case 'bar':this.raphael.barchart(this.g_x,this.g_y,this.g_width,this.g_height,B,C).hover(D,E);break;case 'hbar':this.raphael.hbarchart(this.g_x,this.g_y,this.g_width,this.g_height,B,C).hover(D,E);break;case 'pie':this.raphael.piechart(this.g_x,this.g_y,this.g_r,B,C).hover(F,G);break;}if(this.title){this.raphael.text(this.title.x,this.title.y,this.title.text).attr(this.title.attr);}},setTitle:function(o){this.title=o;},initEvents:function(){if(!this.href){this.el.on('click',this.onClick,this);}},onClick:function(e){Roo.log('img onclick');this.fireEvent('click',this,e);}});
+//Roo/bootstrap/dash/NumberBox.js
+Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.NumberBox=function(A){Roo.bootstrap.dash.NumberBox.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.dash.NumberBox,Roo.bootstrap.Component,{headline:'',content:'',icon:'',footer:'',fhref:'',ficon:'',getAutoCreate:function(){var A={tag:'div',cls:'small-box ',cn:[{tag:'div',cls:'inner',cn:[{tag:'h3',cls:'roo-headline',html:this.headline},{tag:'p',cls:'roo-content',html:this.content}]}]};if(this.icon){A.cn.push({tag:'div',cls:'icon',cn:[{tag:'i',cls:'ion '+this.icon}]});}if(this.footer){var footer={tag:'a',cls:'small-box-footer',href:this.fhref||'#',html:this.footer};A.cn.push(footer);}return A;},onRender:function(ct,A){Roo.bootstrap.dash.NumberBox.superclass.onRender.call(this,ct,A);},setHeadline:function(A){this.el.select('.roo-headline',true).first().dom.innerHTML=A;},setFooter:function(A,B){this.el.select('a.small-box-footer',true).first().dom.innerHTML=A;if(B){this.el.select('a.small-box-footer',true).first().attr('href',B);}},setContent:function(A){this.el.select('.roo-content',true).first().dom.innerHTML=A;},initEvents:function(){}});
+//Roo/bootstrap/dash/TabBox.js
+Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.TabBox=function(A){Roo.bootstrap.dash.TabBox.superclass.constructor.call(this,A);this.addEvents({"addpane":true,"activatepane":true});this.panes=[];};Roo.extend(Roo.bootstrap.dash.TabBox,Roo.bootstrap.Component,{title:'',icon:false,showtabs:true,tabScrollable:false,getChildContainer:function(){return this.el.select('.tab-content',true).first();},getAutoCreate:function(){var A={tag:'li',cls:'pull-left header',html:this.title,cn:[]};if(this.icon){A.cn.push({tag:'i',cls:'fa '+this.icon});}var h={tag:'ul',cls:'nav nav-tabs pull-right',cn:[A]};if(this.tabScrollable){h={tag:'div',cls:'tab-header',cn:[{tag:'ul',cls:'nav nav-tabs pull-right',cn:[A]}]}}var B={tag:'div',cls:'nav-tabs-custom',cn:[h,{tag:'div',cls:'tab-content no-padding',cn:[]}]};return B;},initEvents:function(){this.on('addpane',this.onAddPane,this);},setTitle:function(A){this.el.select('.nav-tabs .header',true).first().dom.innerHTML=A;},onAddPane:function(A){this.panes.push(A);if(!this.showtabs){return;}var B=this.el.select('.nav-tabs',true).first();var C=B.select('.nav-tab',true);var D=C.getCount();;var E=B.createChild({tag:'li',cls:'nav-tab'+(D?'':' active'),cn:[{tag:'a',href:'#',html:A.title}]},D?C.first().dom:B.select('.header',true).first().dom);A.tab=E;E.on('click',this.onTabClick.createDelegate(this,[A],true));if(!D){A.el.addClass('active');}},onTabClick:function(ev,un,ob,A){ev.preventDefault();this.el.select('.nav-tabs li.nav-tab',true).removeClass('active');A.tab.addClass('active');this.getChildContainer().select('.tab-pane',true).removeClass('active');this.fireEvent('activatepane',A);A.el.addClass('active');A.fireEvent('activate');},getActivePane:function(){var r=false;Roo.each(this.panes,function(p){if(p.el.hasClass('active')){r=p;return false;}return;});return r;}});
+//Roo/bootstrap/dash/TabPane.js
+Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.TabPane=function(A){Roo.bootstrap.dash.TabPane.superclass.constructor.call(this,A);this.addEvents({"activate":true});};Roo.extend(Roo.bootstrap.dash.TabPane,Roo.bootstrap.Component,{active:false,title:'',tab:false,getAutoCreate:function(){var A={tag:'div',cls:'tab-pane'};if(this.active){A.cls+=' active';}return A;},initEvents:function(){this.parent().fireEvent('addpane',this)},setTitle:function(A){if(!this.tab){return;}
+this.title=A;this.tab.select('a',true).first().dom.innerHTML=A;}});
+//Roo/bootstrap/menu/Menu.js
+Roo.bootstrap.menu=Roo.bootstrap.menu||{};Roo.bootstrap.menu.Menu=function(A){Roo.bootstrap.menu.Menu.superclass.constructor.call(this,A);this.addEvents({beforeshow:true,beforehide:true,show:true,hide:true,click:true});};Roo.extend(Roo.bootstrap.menu.Menu,Roo.bootstrap.Component,{submenu:false,html:'',weight:'default',icon:false,pos:'bottom',getChildContainer:function(){if(this.isSubMenu){return this.el;}return this.el.select('ul.dropdown-menu',true).first();},getAutoCreate:function(){var A=[{tag:'span',cls:'roo-menu-text',html:this.html}];if(this.icon){A.unshift({tag:'i',cls:'fa '+this.icon})}var B={tag:'div',cls:'btn-group',cn:[{tag:'button',cls:'dropdown-button btn btn-'+this.weight,cn:A},{tag:'button',cls:'dropdown-toggle btn btn-'+this.weight,cn:[{tag:'span',cls:'caret'}]},{tag:'ul',cls:'dropdown-menu'}]};if(this.pos=='top'){B.cls+=' dropup';}if(this.isSubMenu){B={tag:'ul',cls:'dropdown-menu'}}return B;},onRender:function(ct,A){this.isSubMenu=ct.hasClass('dropdown-submenu');Roo.bootstrap.menu.Menu.superclass.onRender.call(this,ct,A);},initEvents:function(){if(this.isSubMenu){return;}
+this.hidden=true;this.triggerEl=this.el.select('button.dropdown-toggle',true).first();this.triggerEl.on('click',this.onTriggerPress,this);this.buttonEl=this.el.select('button.dropdown-button',true).first();this.buttonEl.on('click',this.onClick,this);},list:function(){if(this.isSubMenu){return this.el;}return this.el.select('ul.dropdown-menu',true).first();},onClick:function(e){this.fireEvent("click",this,e);},onTriggerPress:function(e){if(this.isVisible()){this.hide();}else {this.show();}},isVisible:function(){return !this.hidden;},show:function(){this.fireEvent("beforeshow",this);this.hidden=false;this.el.addClass('open');Roo.get(document).on("mouseup",this.onMouseUp,this);this.fireEvent("show",this);},hide:function(){this.fireEvent("beforehide",this);this.hidden=true;this.el.removeClass('open');Roo.get(document).un("mouseup",this.onMouseUp);this.fireEvent("hide",this);},onMouseUp:function(){this.hide();}});
+//Roo/bootstrap/menu/Item.js
+Roo.bootstrap.menu=Roo.bootstrap.menu||{};Roo.bootstrap.menu.Item=function(A){Roo.bootstrap.menu.Item.superclass.constructor.call(this,A);this.addEvents({mouseover:true,mouseout:true,click:true});};Roo.extend(Roo.bootstrap.menu.Item,Roo.bootstrap.Component,{submenu:false,href:'',html:'',preventDefault:true,disable:false,icon:false,pos:'right',getAutoCreate:function(){var A=[{tag:'span',cls:'roo-menu-item-text',html:this.html}];if(this.icon){A.unshift({tag:'i',cls:'fa '+this.icon})}var B={tag:'li',cn:[{tag:'a',href:this.href||'#',cn:A}]};if(this.disable){B.cls=(typeof(B.cls)=='undefined')?'disabled':(B.cls+' disabled');}if(this.submenu){B.cls=(typeof(B.cls)=='undefined')?'dropdown-submenu':(B.cls+' dropdown-submenu');if(this.pos=='left'){B.cls=(typeof(B.cls)=='undefined')?'pull-left':(B.cls+' pull-left');}}return B;},initEvents:function(){this.el.on('mouseover',this.onMouseOver,this);this.el.on('mouseout',this.onMouseOut,this);this.el.select('a',true).first().on('click',this.onClick,this);},onClick:function(e){if(this.preventDefault){e.preventDefault();}
+this.fireEvent("click",this,e);},onMouseOver:function(e){if(this.submenu&&this.pos=='left'){this.el.select('ul.dropdown-menu',true).first().setLeft(this.el.select('ul.dropdown-menu',true).first().getWidth()*-1);}
+this.fireEvent("mouseover",this,e);},onMouseOut:function(e){this.fireEvent("mouseout",this,e);}});
+//Roo/bootstrap/menu/Separator.js
+Roo.bootstrap.menu=Roo.bootstrap.menu||{};Roo.bootstrap.menu.Separator=function(A){Roo.bootstrap.menu.Separator.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.menu.Separator,Roo.bootstrap.Component,{getAutoCreate:function(){var A={tag:'li',cls:'divider'};return A;}});
+//Roo/bootstrap/Tooltip.js
+Roo.bootstrap.Tooltip=function(A){Roo.bootstrap.Tooltip.superclass.constructor.call(this,A);};Roo.apply(Roo.bootstrap.Tooltip,{currentEl:false,currentTip:false,currentRegion:false,init:function(){Roo.get(document).on('mouseover',this.enter,this);Roo.get(document).on('mouseout',this.leave,this);this.currentTip=new Roo.bootstrap.Tooltip();},enter:function(ev){var A=ev.getTarget();var el=Roo.fly(A);if(this.currentEl){if(this.currentEl==el){return;}if(A!=this.currentEl.dom&&this.currentEl.contains(A)){return;}}if(this.currentTip.el){this.currentTip.el.hide();}var B=el;if(!el.attr('tooltip')){if(!el.select("[tooltip]").elements.length){return;}
+B=el.select("[tooltip]").first();var xy=ev.getXY();if(!B.getRegion().contains({top:xy[1],right:xy[0],bottom:xy[1],left:xy[0]})){return;}}
+this.currentEl=B;this.currentTip.bind(B);this.currentRegion=Roo.lib.Region.getRegion(A);this.currentTip.enter();},leave:function(ev){var A=ev.getTarget();if(!this.currentEl){return;}if(A!=this.currentEl.dom){return;}var xy=ev.getXY();if(this.currentRegion.contains(new Roo.lib.Region(xy[1],xy[0],xy[1],xy[0]))){return;}if(this.currentTip){this.currentTip.leave();}
+this.currentEl=false;},alignment:{'left':['r-l',[-2,0],'right'],'right':['l-r',[2,0],'left'],'bottom':['t-b',[0,2],'top'],'top':['b-t',[0,-2],'bottom']}});Roo.extend(Roo.bootstrap.Tooltip,Roo.bootstrap.Component,{bindEl:false,delay:null,timeout:null,hoverState:null,placement:'bottom',getAutoCreate:function(){var A={cls:'tooltip',role:'tooltip',cn:[{cls:'tooltip-arrow'},{cls:'tooltip-inner'}]};return A;},bind:function(el){this.bindEl=el;},enter:function(){if(this.timeout!=null){clearTimeout(this.timeout);}
+this.hoverState='in';if(!this.delay||!this.delay.show){this.show();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='in'){_t.show();}},this.delay.show);},leave:function(){clearTimeout(this.timeout);this.hoverState='out';if(!this.delay||!this.delay.hide){this.hide();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='out'){_t.hide();Roo.bootstrap.Tooltip.currentEl=false;}},delay);},show:function(){if(!this.el){this.render(document.body);}var A=this.bindEl.attr('tooltip')||this.bindEl.select("[tooltip]").first().attr('tooltip');this.el.select('.tooltip-inner',true).first().dom.innerHTML=A;this.el.removeClass(['fade','top','bottom','left','right','in']);var B=typeof this.placement=='function'?this.placement.call(this,this.el,on_el):this.placement;var C=/\s?auto?\s?/i;var D=C.test(B);if(D){B=B.replace(C,'')||'top';}
+this.el.show();this.el.addClass(B);var p=this.getPosition();var E=this.el.getBox();if(D){}var F=Roo.bootstrap.Tooltip.alignment[B];this.el.alignTo(this.bindEl,F[0],F[1]);this.el.addClass('in fade');this.hoverState=null;if(this.el.hasClass('fade')){}},hide:function(){if(!this.el){return;}
+this.el.removeClass('in');}});
+//Roo/bootstrap/LocationPicker.js
+Roo.bootstrap.LocationPicker=function(A){Roo.bootstrap.LocationPicker.superclass.constructor.call(this,A);this.addEvents({initial:true,positionchanged:true,resize:true,show:true,hide:true,mapClick:true,mapRightClick:true,markerClick:true,markerRightClick:true,OverlayViewDraw:true,OverlayViewOnAdd:true,OverlayViewOnRemove:true,OverlayViewShow:true,OverlayViewHide:true});};Roo.extend(Roo.bootstrap.LocationPicker,Roo.bootstrap.Component,{gMapContext:false,latitude:0,longitude:0,zoom:15,mapTypeId:false,mapTypeControl:false,disableDoubleClickZoom:false,scrollwheel:true,streetViewControl:false,radius:0,locationName:'',draggable:true,enableAutocomplete:false,enableReverseGeocode:true,markerTitle:'',getAutoCreate:function(){var A={tag:'div',cls:'roo-location-picker'};return A},initEvents:function(ct,A){if(!this.el.getWidth()||this.isApplied()){return;}
+this.el.setVisibilityMode(Roo.Element.DISPLAY);this.initial();},initial:function(){if(!this.mapTypeId){this.mapTypeId=google.maps.MapTypeId.ROADMAP;}
+this.gMapContext=this.GMapContext();this.initOverlayView();this.OverlayView=new Roo.bootstrap.LocationPicker.OverlayView(this.gMapContext.map);var A=this;google.maps.event.addListener(this.gMapContext.marker,"dragend",function(B){A.setPosition(A.gMapContext.marker.position);});google.maps.event.addListener(this.gMapContext.map,'click',function(B){A.fireEvent('mapClick',this,B);});google.maps.event.addListener(this.gMapContext.map,'rightclick',function(B){A.fireEvent('mapRightClick',this,B);});google.maps.event.addListener(this.gMapContext.marker,'click',function(B){A.fireEvent('markerClick',this,B);});google.maps.event.addListener(this.gMapContext.marker,'rightclick',function(B){A.fireEvent('markerRightClick',this,B);});this.setPosition(this.gMapContext.location);this.fireEvent('initial',this,this.gMapContext.location);},initOverlayView:function(){var A=this;Roo.bootstrap.LocationPicker.OverlayView.prototype=Roo.apply(new google.maps.OverlayView(),{draw:function(){A.fireEvent('OverlayViewDraw',A);},onAdd:function(){A.fireEvent('OverlayViewOnAdd',A);},onRemove:function(){A.fireEvent('OverlayViewOnRemove',A);},show:function(B){A.fireEvent('OverlayViewShow',A,B);},hide:function(){A.fireEvent('OverlayViewHide',A);}});},fromLatLngToContainerPixel:function(A){return this.OverlayView.getProjection().fromLatLngToContainerPixel(A.latLng);},isApplied:function(){return this.getGmapContext()==false?false:true;},getGmapContext:function(){return this.gMapContext},GMapContext:function(){var A=new google.maps.LatLng(this.latitude,this.longitude);var B=new google.maps.Map(this.el.dom,{center:A,zoom:this.zoom,mapTypeId:this.mapTypeId,mapTypeControl:this.mapTypeControl,disableDoubleClickZoom:this.disableDoubleClickZoom,scrollwheel:this.scrollwheel,streetViewControl:this.streetViewControl,locationName:this.locationName,draggable:this.draggable,enableAutocomplete:this.enableAutocomplete,enableReverseGeocode:this.enableReverseGeocode});var C=new google.maps.Marker({position:A,map:B,title:this.markerTitle,draggable:this.draggable});return {map:B,marker:C,circle:null,location:A,radius:this.radius,locationName:this.locationName,addressComponents:{formatted_address:null,addressLine1:null,addressLine2:null,streetName:null,streetNumber:null,city:null,district:null,state:null,stateOrProvince:null},settings:this,domContainer:this.el.dom,geodecoder:new google.maps.Geocoder()};},drawCircle:function(A,B,C){if(this.gMapContext.circle!=null){this.gMapContext.circle.setMap(null);}if(B>0){B*=1;C=Roo.apply({},C,{strokeColor:"#0000FF",strokeOpacity:.35,strokeWeight:2,fillColor:"#0000FF",fillOpacity:.2});C.map=this.gMapContext.map;C.radius=B;C.center=A;this.gMapContext.circle=new google.maps.Circle(C);return this.gMapContext.circle;}return null;},setPosition:function(A){this.gMapContext.location=A;this.gMapContext.marker.setPosition(A);this.gMapContext.map.panTo(A);this.drawCircle(A,this.gMapContext.radius,{});var B=this;if(this.gMapContext.settings.enableReverseGeocode){this.gMapContext.geodecoder.geocode({latLng:this.gMapContext.location},function(C,D){if(D==google.maps.GeocoderStatus.OK&&C.length>0){B.gMapContext.locationName=C[0].formatted_address;B.gMapContext.addressComponents=B.address_component_from_google_geocode(C[0].address_components);B.fireEvent('positionchanged',this,A);}});return;}
+this.fireEvent('positionchanged',this,A);},resize:function(){google.maps.event.trigger(this.gMapContext.map,"resize");this.gMapContext.map.setCenter(this.gMapContext.marker.position);this.fireEvent('resize',this);},setPositionByLatLng:function(A,B){this.setPosition(new google.maps.LatLng(A,B));},getCurrentPosition:function(){return {latitude:this.gMapContext.location.lat(),longitude:this.gMapContext.location.lng()};},getAddressName:function(){return this.gMapContext.locationName;},getAddressComponents:function(){return this.gMapContext.addressComponents;},address_component_from_google_geocode:function(A){var B={};for(var i=0;i<A.length;i++){var C=A[i];if(C.types.indexOf("postal_code")>=0){B.postalCode=C.short_name;}else if(C.types.indexOf("street_number")>=0){B.streetNumber=C.short_name;}else if(C.types.indexOf("route")>=0){B.streetName=C.short_name;}else if(C.types.indexOf("neighborhood")>=0){B.city=C.short_name;}else if(C.types.indexOf("locality")>=0){B.city=C.short_name;}else if(C.types.indexOf("sublocality")>=0){B.district=C.short_name;}else if(C.types.indexOf("administrative_area_level_1")>=0){B.stateOrProvince=C.short_name;}else if(C.types.indexOf("country")>=0){B.country=C.short_name;}}
+B.addressLine1=[B.streetNumber,B.streetName].join(" ").trim();B.addressLine2="";return B;},setZoomLevel:function(A){this.gMapContext.map.setZoom(A);},show:function(){if(!this.el){return;}
+this.el.show();this.resize();this.fireEvent('show',this);},hide:function(){if(!this.el){return;}
+this.el.hide();this.fireEvent('hide',this);}});Roo.apply(Roo.bootstrap.LocationPicker,{OverlayView:function(A,B){B=B||{};this.setMap(A);}});
+//Roo/bootstrap/Alert.js
+Roo.bootstrap.Alert=function(A){Roo.bootstrap.Alert.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Alert,Roo.bootstrap.Component,{title:'',html:'',weight:false,faicon:false,getAutoCreate:function(){var A={tag:'div',cls:'alert',cn:[{tag:'i',cls:'roo-alert-icon'},{tag:'b',cls:'roo-alert-title',html:this.title},{tag:'span',cls:'roo-alert-text',html:this.html}]};if(this.faicon){A.cn[0].cls+=' fa '+this.faicon;}if(this.weight){A.cls+=' alert-'+this.weight;}return A;},initEvents:function(){this.el.setVisibilityMode(Roo.Element.DISPLAY);},setTitle:function(A){this.el.select('.roo-alert-title',true).first().dom.innerHTML=A;},setText:function(A){this.el.select('.roo-alert-text',true).first().dom.innerHTML=A;},setWeight:function(A){if(this.weight){this.el.select('.alert',true).first().removeClass('alert-'+this.weight);}
+this.weight=A;this.el.select('.alert',true).first().addClass('alert-'+this.weight);},setIcon:function(A){if(this.faicon){this.el.select('.roo-alert-icon',true).first().removeClass(['fa','fa-'+this.faicon]);}
+this.faicon=Athis.el.select('.roo-alert-icon',true).first().addClass(['fa','fa-'+this.faicon]);},hide:function(){this.el.hide();},show:function(){this.el.show();}});
+//Roo/bootstrap/UploadCropbox.js
+Roo.bootstrap.UploadCropbox=function(A){Roo.bootstrap.UploadCropbox.superclass.constructor.call(this,A);this.addEvents({"beforeSelectFile":true,"initial":true,"crop":true});};Roo.extend(Roo.bootstrap.UploadCropbox,Roo.bootstrap.Component,{emptyText:'Click to upload image',scale:0,baseScale:1,rotate:0,dragable:false,mouseX:0,mouseY:0,cropImageData:false,cropType:'image/png',minWidth:300,minHeight:300,getAutoCreate:function(){var A={tag:'div',cls:'roo-upload-cropbox',cn:[{tag:'div',cls:'roo-upload-cropbox-image-section',cn:[{tag:'div',cls:'roo-upload-cropbox-canvas',cn:[{tag:'img',cls:'roo-upload-cropbox-image'}]},{tag:'div',cls:'roo-upload-cropbox-thumb'}]},{tag:'div',cls:'roo-upload-cropbox-footer-section',cn:{tag:'div',cls:'btn-group btn-group-justified roo-upload-cropbox-btn-group',cn:[{tag:'div',cls:'btn-group',cn:[{tag:'button',cls:'btn btn-default roo-upload-cropbox-rotate-left',html:'<i class="fa fa-undo"></i>'}]},{tag:'div',cls:'btn-group',cn:[{tag:'button',cls:'btn btn-default roo-upload-cropbox-picture',html:'<i class="fa fa-picture-o"></i>'}]},{tag:'div',cls:'btn-group',cn:[{tag:'button',cls:'btn btn-default roo-upload-cropbox-rotate-right',html:'<i class="fa fa-repeat"></i>'}]}]}}]};return A;},initEvents:function(){this.imageSection=this.el.select('.roo-upload-cropbox-image-section',true).first();this.imageSection.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.imageCanvas=this.el.select('.roo-upload-cropbox-canvas',true).first();this.imageCanvas.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.image=this.el.select('.roo-upload-cropbox-image',true).first();this.image.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.thumb=this.el.select('.roo-upload-cropbox-thumb',true).first();this.thumb.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.footerSection=this.el.select('.roo-upload-cropbox-footer-section',true).first();this.footerSection.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.footerSection.hide();this.rotateLeft=this.el.select('.roo-upload-cropbox-rotate-left',true).first();this.rotateLeft.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.pictureBtn=this.el.select('.roo-upload-cropbox-picture',true).first();this.pictureBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.rotateRight=this.el.select('.roo-upload-cropbox-rotate-right',true).first();this.rotateRight.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.calcThumbBoxSize();this.bind();this.fireEvent('initial',this);},bind:function(){this.image.on('load',this.onLoadCanvasImage,this);if(!this.imageSectionHasOnClickEvent){this.imageSection.on('click',this.beforeSelectFile,this);this.imageSectionHasOnClickEvent=true;}
+this.imageSection.on('mousedown',this.onMouseDown,this);this.imageSection.on('mousemove',this.onMouseMove,this);var A=(/Firefox/i.test(navigator.userAgent))?'DOMMouseScroll':'mousewheel';this.imageSection.on(A,this.onMouseWheel,this);Roo.get(document).on('mouseup',this.onMouseUp,this);this.pictureBtn.on('click',this.beforeSelectFile,this);this.rotateLeft.on('click',this.onRotateLeft,this);this.rotateRight.on('click',this.onRotateRight,this);},unbind:function(){this.image.un('load',this.onLoadCanvasImage,this);if(this.imageSectionHasOnClickEvent){this.imageSection.un('click',this.beforeSelectFile,this);this.imageSectionHasOnClickEvent=false;}
+this.imageSection.un('mousedown',this.onMouseDown,this);this.imageSection.un('mousemove',this.onMouseMove,this);var A=(/Firefox/i.test(navigator.userAgent))?'DOMMouseScroll':'mousewheel';this.imageSection.un(A,this.onMouseWheel,this);Roo.get(document).un('mouseup',this.onMouseUp,this);this.pictureBtn.un('click',this.beforeSelectFile,this);this.rotateLeft.un('click',this.onRotateLeft,this);this.rotateRight.un('click',this.onRotateRight,this);},reset:function(){this.scale=0;this.baseScale=1;this.rotate=0;this.dragable=false;this.mouseX=0;this.mouseY=0;this.cropImageData=false;this.imageCanvas.dom.removeAttribute('style');this.image.dom.removeAttribute('style');this.image.attr('src','');if(!this.imageSectionHasOnClickEvent){this.imageSection.on('click',this.beforeSelectFile,this);this.imageSectionHasOnClickEvent=true;}},beforeSelectFile:function(e){e.preventDefault();this.fireEvent('beforeSelectFile',this);},loadCanvasImage:function(A){this.reset();this.image.attr('src',A);},onLoadCanvasImage:function(A){if(this.imageSectionHasOnClickEvent){this.imageSection.un('click',this.beforeSelectFile,this);this.imageSectionHasOnClickEvent=false;}
+this.image.OriginWidth=this.image.getWidth();this.image.OriginHeight=this.image.getHeight();this.fitThumbBox();this.image.setWidth(this.image.OriginWidth*this.getScaleLevel(false));this.image.setHeight(this.image.OriginHeight*this.getScaleLevel(false));this.footerSection.show();this.setCanvasPosition();},setCanvasPosition:function(){var pw=(this.imageSection.getWidth(true)-this.image.getWidth())/2;var ph=(this.imageSection.getHeight(true)-this.image.getHeight())/2;this.imageCanvas.setLeft(pw);this.imageCanvas.setTop(ph);},onMouseDown:function(e){e.stopEvent();this.dragable=true;this.mouseX=e.getPageX();this.mouseY=e.getPageY();},onMouseMove:function(e){e.stopEvent();if(!this.dragable){return;}var A=new WebKitCSSMatrix(window.getComputedStyle(this.thumb.dom).webkitTransform);var B=this.thumb.getLeft(true)+A.m41;var C=this.thumb.getTop(true)+A.m42;var D=B+this.thumb.getWidth()-this.image.getWidth();var E=C+this.thumb.getHeight()-this.image.getHeight();if(this.rotate==90||this.rotate==270){B=this.thumb.getLeft(true)+A.m41-(this.image.getWidth()-this.image.getHeight())/2;C=this.thumb.getTop(true)+A.m42+(this.image.getWidth()-this.image.getHeight())/2;D=B+this.thumb.getWidth()-this.image.getHeight();E=C+this.thumb.getHeight()-this.image.getWidth();}var x=e.getPageX()-this.mouseX;var y=e.getPageY()-this.mouseY;var F=x+this.imageCanvas.getLeft(true);var G=y+this.imageCanvas.getTop(true);F=(B<F)?B:((D>F)?D:F);G=(C<G)?C:((E>G)?E:G);this.imageCanvas.setLeft(F);this.imageCanvas.setTop(G);this.mouseX=e.getPageX();this.mouseY=e.getPageY();},onMouseUp:function(e){e.stopEvent();this.dragable=false;},onMouseWheel:function(e){e.stopEvent();this.scale=(e.getWheelDelta()==1)?(this.scale+1):(this.scale-1);var A=this.image.OriginWidth*this.getScaleLevel(false);var B=this.image.OriginHeight*this.getScaleLevel(false);if(e.getWheelDelta()==-1&&(((this.rotate==0||this.rotate==180)&&(A<this.thumb.getWidth()||B<this.thumb.getHeight()))||((this.rotate==90||this.rotate==270)&&(B<this.thumb.getWidth()||A<this.thumb.getHeight())))){this.scale=(e.getWheelDelta()==1)?(this.scale-1):(this.scale+1);return;}
+this.image.setWidth(A);this.image.setHeight(B);this.setCanvasPosition();},onRotateLeft:function(e){e.stopEvent();if(((this.rotate==0||this.rotate==180)&&(this.image.getHeight()<this.thumb.getWidth()||this.image.getWidth()<this.thumb.getHeight()))||((this.rotate==90||this.rotate==270)&&(this.image.getWidth()<this.thumb.getWidth()||this.image.getHeight()<this.thumb.getHeight()))){return;}
+this.rotate=(this.rotate<90)?270:this.rotate-90;this.imageCanvas.setStyle({'-ms-transform':'rotate('+this.rotate+'deg)','-webkit-transform':'rotate('+this.rotate+'deg)','transform':'rotate('+this.rotate+'deg)'});this.setCanvasPosition();},onRotateRight:function(e){e.stopEvent();if(((this.rotate==0||this.rotate==180)&&(this.image.getHeight()<this.thumb.getWidth()||this.image.getWidth()<this.thumb.getHeight()))||((this.rotate==90||this.rotate==270)&&(this.image.getWidth()<this.thumb.getWidth()||this.image.getHeight()<this.thumb.getHeight()))){return false;}
+this.rotate=(this.rotate>180)?0:this.rotate+90;this.imageCanvas.setStyle({'-ms-transform':'rotate('+this.rotate+'deg)','-webkit-transform':'rotate('+this.rotate+'deg)','transform':'rotate('+this.rotate+'deg)'});this.setCanvasPosition();},crop:function(){var A=document.createElement("canvas");var B=A.getContext("2d");A.width=this.minWidth;A.height=this.minHeight;var C=this.minWidth/2;var D=this.minHeight/2;var E=this.thumb.getWidth()*this.getScaleLevel(true);var F=this.thumb.getHeight()*this.getScaleLevel(true);var G=new WebKitCSSMatrix(window.getComputedStyle(this.thumb.dom).webkitTransform);var H=this.thumb.getLeft(true)+G.m41;var I=this.thumb.getTop(true)+G.m42;var x=(H-this.imageCanvas.getLeft(true))*this.getScaleLevel(true);var y=(I-this.imageCanvas.getTop(true))*this.getScaleLevel(true);if(this.rotate==90){x=I+(this.image.getWidth()-this.image.getHeight())/2-this.imageCanvas.getTop(true);y=this.image.getHeight()-this.thumb.getWidth()-(H-(this.image.getWidth()-this.image.getHeight())/2-this.imageCanvas.getLeft(true));x=x*this.getScaleLevel(true);y=y*this.getScaleLevel(true);x=x<0?0:x;y=y<0?0:y;E=this.thumb.getHeight()*this.getScaleLevel(true);F=this.thumb.getWidth()*this.getScaleLevel(true);A.width=this.minWidth>this.minHeight?this.minWidth:this.minHeight;A.height=this.minWidth>this.minHeight?this.minWidth:this.minHeight;C=this.minWidth>this.minHeight?(this.minWidth/2):(this.minHeight/2);D=this.minWidth>this.minHeight?(this.minWidth/2):(this.minHeight/2);B.translate(C,D);B.rotate(this.rotate*Math.PI/180);B.drawImage(this.image.dom,x,y,E,F,C*-1,D*-1,this.minHeight,this.minWidth);var J=document.createElement("canvas");var K=J.getContext("2d");J.width=this.minWidth;J.height=this.minHeight;K.drawImage(A,Math.abs(this.minWidth-this.minHeight),0,this.minWidth,this.minHeight,0,0,this.minWidth,this.minHeight);this.cropImageData=J.toDataURL(this.cropType);this.fireEvent('crop',this,this.cropImageData);return;}if(this.rotate==270){x=I+(this.image.getWidth()-this.image.getHeight())/2-this.imageCanvas.getTop(true);y=H-(this.image.getWidth()-this.image.getHeight())/2-this.imageCanvas.getLeft(true);x=(this.image.getWidth()-this.thumb.getHeight()-x)*this.getScaleLevel(true);y=y*this.getScaleLevel(true);x=x<0?0:x;y=y<0?0:y;E=this.thumb.getHeight()*this.getScaleLevel(true);F=this.thumb.getWidth()*this.getScaleLevel(true);A.width=this.minWidth>this.minHeight?this.minWidth:this.minHeight;A.height=this.minWidth>this.minHeight?this.minWidth:this.minHeight;C=this.minWidth>this.minHeight?(this.minWidth/2):(this.minHeight/2);D=this.minWidth>this.minHeight?(this.minWidth/2):(this.minHeight/2);B.translate(C,D);B.rotate(this.rotate*Math.PI/180);B.drawImage(this.image.dom,x,y,E,F,C*-1,D*-1,this.minHeight,this.minWidth);var J=document.createElement("canvas");var K=J.getContext("2d");J.width=this.minWidth;J.height=this.minHeight;K.drawImage(A,0,0,this.minWidth,this.minHeight,0,0,this.minWidth,this.minHeight);this.cropImageData=J.toDataURL(this.cropType);this.fireEvent('crop',this,this.cropImageData);return;}if(this.rotate==180){x=this.image.OriginWidth-this.thumb.getWidth()*this.getScaleLevel(true)-x;y=this.image.OriginHeight-this.thumb.getHeight()*this.getScaleLevel(true)-y;}
+x=x<0?0:x;y=y<0?0:y;B.translate(C,D);B.rotate(this.rotate*Math.PI/180);B.drawImage(this.image.dom,x,y,E,F,C*-1,D*-1,A.width,A.height);this.cropImageData=A.toDataURL(this.cropType);this.fireEvent('crop',this,this.cropImageData);},calcThumbBoxSize:function(){var A,B;B=300;A=this.minWidth*B/this.minHeight;if(this.minWidth>this.minHeight){A=300;B=this.minHeight*A/this.minWidth;}
+this.thumb.setStyle({width:A+'px',height:B+'px'});return;},fitThumbBox:function(){var A=this.thumb.getWidth();var B=this.image.OriginHeight*A/this.image.OriginWidth;this.baseScale=A/this.image.OriginWidth;if(this.image.OriginWidth>this.image.OriginHeight){B=this.thumb.getHeight();A=this.image.OriginWidth*B/this.image.OriginHeight;this.baseScale=B/this.image.OriginHeight;}return;},getScaleLevel:function(A){if(A){return Math.pow(1.1,this.scale*-1)/this.baseScale;}return this.baseScale*Math.pow(1.1,this.scale);}});