roojs-all.js
authoralan <alan@desktop.akbkhome.com>
Wed, 28 Apr 2010 05:42:52 +0000 (13:42 +0800)
committeralan <alan@desktop.akbkhome.com>
Wed, 28 Apr 2010 05:42:52 +0000 (13:42 +0800)
roojs-all.js

index 3c5f9e7..e69de29 100644 (file)
@@ -1,919 +0,0 @@
-window["undefined"]=window["undefined"];var Roo={};Roo.apply=function(o,c,A){if(A){Roo.apply(o,A)}if(o&&c&&typeof c=="object"){for(var p in c){o[p]=c[p]}}return o};(function(){var D=0;var ua=navigator.userAgent.toLowerCase();var J=document.compatMode=="CSS1Compat",G=ua.indexOf("opera")>-1,H=(/webkit|khtml/).test(ua),A=ua.indexOf("msie")>-1,B=ua.indexOf("msie 7")>-1,E=!H&&ua.indexOf("gecko")>-1,L=A&&!J,K=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),C=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),F=(ua.indexOf("linux")!=-1),I=window.location.href.toLowerCase().indexOf("https")===0;if(A&&!B){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}Roo.apply(Roo,{isStrict:J,isSecure:I,isReady:false,enableGarbageCollector:true,enableListenerCollection:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/localhost/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p]}}}return o},addBehaviors:function(o){if(!Roo.isReady){Roo.onReady(function(){Roo.addBehaviors(o)});return}var M={};for(var b in o){var N=b.split("@");if(N[1]){var s=N[0];if(!M[s]){M[s]=Roo.select(s)}M[s].on(N[1],o[b])}}M=null},id:function(el,M){M=M||"roo-gen";el=Roo.getDom(el);var id=M+(++D);return el?(el.id?el.id:(el.id=id)):id},extend:function(){var io=function(o){for(var m in o){this[m]=o[m]}};return function(sb,sp,O){if(typeof sp=="object"){O=sp;sp=sb;sb=function(){sp.apply(this,arguments)}}var F=function(){},M,N=sp.prototype;F.prototype=N;M=sb.prototype=new F();M.constructor=sb;sb.superclass=N;if(N.constructor==Object.prototype.constructor){N.constructor=sp}sb.override=function(o){Roo.override(sb,o)};M.override=io;Roo.override(sb,O);return sb}}(),override:function(N,O){if(O){var p=N.prototype;for(var M in O){p[M]=O[M]}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval("if (typeof "+rt+" == \"undefined\"){"+rt+" = {};} o = "+rt+";");for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]]}}},factory:function(c,ns){if(!c.xtype||(!ns&&!c.xns)||(c.xns===false)){return c}ns=c.xns?c.xns:ns;if(c.constructor==ns[c.xtype]){return c}if(ns[c.xtype]){var M=new ns[c.xtype](c);M.xns=false;return M}c.xns=false;return c},urlEncode:function(o){if(!o){return ""}var M=[];for(var N in o){var ov=o[N],k=encodeURIComponent(N);var P=typeof ov;if(P=="undefined"){M.push(k,"=&")}else if(P!="function"&&P!="object"){M.push(k,"=",encodeURIComponent(ov),"&")}else if(ov instanceof Array){if(ov.length){for(var i=0,O=ov.length;i<O;i++){M.push(k,"=",encodeURIComponent(ov[i]===undefined?"":ov[i]),"&")}}else{M.push(k,"=&")}}}M.pop();return M.join("")},urlDecode:function(S,T){if(!S||!S.length){return {}}var N={};var Q=S.split("&");var P,O,R;for(var i=0,M=Q.length;i<M;i++){P=Q[i].split("=");O=decodeURIComponent(P[0]);R=decodeURIComponent(P[1]);if(T!==true){if(typeof N[O]=="undefined"){N[O]=R}else if(typeof N[O]=="string"){N[O]=[N[O]];N[O].push(R)}else{N[O].push(R)}}else{N[O]=R}}return N},each:function(N,fn,O){if(typeof N.length=="undefined"||typeof N=="string"){N=[N]}for(var i=0,M=N.length;i<M;i++){if(fn.call(O||N[i],N[i],i,N)===false){return i}}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;i<l;i++){var a=as[i];if(a instanceof Array){r=r.concat(a)}else if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0))}else{r.push(a)}}return r},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},callback:function(cb,O,M,N){if(typeof cb=="function"){if(N){cb.defer(N,O,M||[])}else{cb.apply(O,M||[])}}},getDom:function(el){if(!el){return null}return el.dom?el.dom:(typeof el=="string"?document.getElementById(el):el)},getCmp:function(id){return Roo.ComponentMgr.get(id)},num:function(v,M){if(typeof v!="number"){return M}return v},destroy:function(){for(var i=0,a=arguments,M=a.length;i<M;i++){var as=a[i];if(as){if(as.dom){as.removeAllListeners();as.remove();continue}if(typeof as.purgeListeners=="function"){as.purgeListeners()}if(typeof as.destroy=="function"){as.destroy()}}}},type:function(o){if(o===undefined||o===null){return false}if(o.htmlElement){return "element"}var t=typeof o;if(t=="object"&&o.nodeName){switch(o.nodeType){case 1:return "element";case 3:return (/\S/).test(o.nodeValue)?"textnode":"whitespace"}}if(t=="object"||t=="function"){switch(o.constructor){case Array:return "array";case RegExp:return "regexp"}if(typeof o.length=="number"&&typeof o.item=="function"){return "nodelist"}}return t},isEmpty:function(v,M){return v===null||v===undefined||(!M?v==="":false)},isOpera:G,isSafari:H,isIE:A,isIE7:B,isGecko:E,isBorderBox:L,isWindows:K,isLinux:F,isMac:C,useShims:((A&&!B)||(E&&C))})})();Roo.namespace("Roo","Roo.util","Roo.grid","Roo.dd","Roo.tree","Roo.data","Roo.form","Roo.menu","Roo.state","Roo.lib","Roo.layout","Roo.app","Roo.ux");
-(function(){if(Roo.isIE){function A(){var p=Function.prototype;delete p.createSequence;delete p.defer;delete p.createDelegate;delete p.createCallback;delete p.createInterceptor;window.detachEvent("onunload",A)}window.attachEvent("onunload",A)}})();Roo.apply(Function.prototype,{createCallback:function(){var A=arguments;var B=this;return function(){return B.apply(window,A)}},createDelegate:function(A,B,D){var C=this;return function(){var E=B||arguments;if(D===true){E=Array.prototype.slice.call(arguments,0);E=E.concat(B)}else if(typeof D=="number"){E=Array.prototype.slice.call(arguments,0);var F=[D,0].concat(B);Array.prototype.splice.apply(E,F)}return C.apply(A||window,E)}},defer:function(C,A,B,D){var fn=this.createDelegate(A,B,D);if(C){return setTimeout(fn,C)}fn();return 0},createSequence:function(A,B){if(typeof A!="function"){return this}var C=this;return function(){var D=C.apply(this||window,arguments);A.apply(B||this||window,arguments);return D}},createInterceptor:function(A,B){if(typeof A!="function"){return this}var C=this;return function(){A.target=this;A.method=C;if(A.apply(B||this||window,arguments)===false){return}return C.apply(this||window,arguments)}}});
-Roo.applyIf(String,{escape:function(A){return A.replace(/('|\\)/g,"\\$1");},leftPad:function(A,B,ch){var C=new String(A);if(ch===null||ch===undefined||ch===""){ch=" ";}while(C.length<B){C=ch+C;}return C;},format:function(B){var A=Array.prototype.slice.call(arguments,1);
-return B.replace(/\{(\d+)\}/g,function(m,i){return Roo.util.Format.htmlEncode(A[i]);});}});String.prototype.toggle=function(B,A){return this==B?A:B;};
-Roo.applyIf(Number.prototype,{constrain:function(B,A){return Math.min(Math.max(this,B),A)}});
-Roo.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,A=this.length;i<A;i++){if(this[i]==o)return i}return -1},remove:function(o){var A=this.indexOf(o);if(A!=-1){this.splice(A,1)}}});
-Date.prototype.getElapsed=function(A){return Math.abs((A||new Date()).getTime()-this.getTime())};Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(B){if(Date.formatFunctions[B]==null){Date.createNewFormat(B)}var A=Date.formatFunctions[B];return this[A]()};Date.prototype.format=Date.prototype.dateFormat;Date.createNewFormat=function(B){var D="format"+Date.formatFunctions.count++;Date.formatFunctions[B]=D;var A="Date.prototype."+D+" = function(){return ";var C=false;var ch="";for(var i=0;i<B.length;++i){ch=B.charAt(i);if(!C&&ch=="\\"){C=true}else if(C){C=false;A+="'"+String.escape(ch)+"' + "}else{A+=Date.getFormatCode(ch)}}eval(A.substring(0,A.length-3)+";}")};Date.getFormatCode=function(A){switch(A){case "d":return "String.leftPad(this.getDate(), 2, '0') + ";case "D":return "Date.dayNames[this.getDay()].substring(0, 3) + ";case "j":return "this.getDate() + ";case "l":return "Date.dayNames[this.getDay()] + ";case "S":return "this.getSuffix() + ";case "w":return "this.getDay() + ";case "z":return "this.getDayOfYear() + ";case "W":return "this.getWeekOfYear() + ";case "F":return "Date.monthNames[this.getMonth()] + ";case "m":return "String.leftPad(this.getMonth() + 1, 2, '0') + ";case "M":return "Date.monthNames[this.getMonth()].substring(0, 3) + ";case "n":return "(this.getMonth() + 1) + ";case "t":return "this.getDaysInMonth() + ";case "L":return "(this.isLeapYear() ? 1 : 0) + ";case "Y":return "this.getFullYear() + ";case "y":return "('' + this.getFullYear()).substring(2, 4) + ";case "a":return "(this.getHours() < 12 ? 'am' : 'pm') + ";case "A":return "(this.getHours() < 12 ? 'AM' : 'PM') + ";case "g":return "((this.getHours() % 12) ? this.getHours() % 12 : 12) + ";case "G":return "this.getHours() + ";case "h":return "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0') + ";case "H":return "String.leftPad(this.getHours(), 2, '0') + ";case "i":return "String.leftPad(this.getMinutes(), 2, '0') + ";case "s":return "String.leftPad(this.getSeconds(), 2, '0') + ";case "O":return "this.getGMTOffset() + ";case "T":return "this.getTimezone() + ";case "Z":return "(this.getTimezoneOffset() * -60) + ";default:return "'"+String.escape(A)+"' + "}};Date.parseDate=function(B,C){if(Date.parseFunctions[C]==null){Date.createParser(C)}var A=Date.parseFunctions[C];return Date[A](B)};Date.createParser=function(D){var F="parse"+Date.parseFunctions.count++;var G=Date.parseRegexes.length;var H=1;Date.parseFunctions[D]=F;var B="Date."+F+" = function(input){\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, o, z, v;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"var results = input.match(Date.parseRegexes["+G+"]);\n"+"if (results && results.length > 0) {";var C="";var E=false;var ch="";for(var i=0;i<D.length;++i){ch=D.charAt(i);if(!E&&ch=="\\"){E=true}else if(E){E=false;C+=String.escape(ch)}else{var A=Date.formatCodeToRegex(ch,H);H+=A.g;C+=A.s;if(A.g&&A.c){B+=A.c}}}B+="if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{v = new Date(y, m, d, h, i, s);}\n"+"else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{v = new Date(y, m, d, h, i);}\n"+"else if (y >= 0 && m >= 0 && d > 0 && h >= 0)\n"+"{v = new Date(y, m, d, h);}\n"+"else if (y >= 0 && m >= 0 && d > 0)\n"+"{v = new Date(y, m, d);}\n"+"else if (y >= 0 && m >= 0)\n"+"{v = new Date(y, m);}\n"+"else if (y >= 0)\n"+"{v = new Date(y);}\n"+"}return (v && (z || o))?\n"+"    ((z)? v.add(Date.SECOND, (v.getTimezoneOffset() * 60) + (z*1)) :\n"+"        v.add(Date.HOUR, (v.getGMTOffset() / 100) + (o / -100))) : v\n"+";}";Date.parseRegexes[G]=new RegExp("^"+C+"$");eval(B)};Date.formatCodeToRegex=function(A,B){switch(A){case "D":return {g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case "j":return {g:1,c:"d = parseInt(results["+B+"], 10);\n",s:"(\\d{1,2})"};case "d":return {g:1,c:"d = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"};case "l":return {g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case "S":return {g:0,c:null,s:"(?:st|nd|rd|th)"};case "w":return {g:0,c:null,s:"\\d"};case "z":return {g:0,c:null,s:"(?:\\d{1,3})"};case "W":return {g:0,c:null,s:"(?:\\d{2})"};case "F":return {g:1,c:"m = parseInt(Date.monthNumbers[results["+B+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case "M":return {g:1,c:"m = parseInt(Date.monthNumbers[results["+B+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case "n":return {g:1,c:"m = parseInt(results["+B+"], 10) - 1;\n",s:"(\\d{1,2})"};case "m":return {g:1,c:"m = parseInt(results["+B+"], 10) - 1;\n",s:"(\\d{2})"};case "t":return {g:0,c:null,s:"\\d{1,2}"};case "L":return {g:0,c:null,s:"(?:1|0)"};case "Y":return {g:1,c:"y = parseInt(results["+B+"], 10);\n",s:"(\\d{4})"};case "y":return {g:1,c:"var ty = parseInt(results["+B+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case "a":return {g:1,c:"if (results["+B+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case "A":return {g:1,c:"if (results["+B+"] == 'AM') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case "g":case "G":return {g:1,c:"h = parseInt(results["+B+"], 10);\n",s:"(\\d{1,2})"};case "h":case "H":return {g:1,c:"h = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"};case "i":return {g:1,c:"i = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"};case "s":return {g:1,c:"s = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"};case "O":return {g:1,c:["o = results[",B,"];\n","var sn = o.substring(0,1);\n","var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);\n","var mn = o.substring(3,5) % 60;\n","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n","    (sn + String.leftPad(hr, 2, 0) + String.leftPad(mn, 2, 0)) : null;\n"].join(""),s:"([+-]\\d{4})"};case "T":return {g:0,c:null,s:"[A-Z]{1,4}"};case "Z":return {g:1,c:"z = results["+B+"];\n"+"z = (-43200 <= z*1 && z*1 <= 50400)? z : null;\n",s:"([+-]?\\d{1,5})"};default:return {g:0,c:null,s:String.escape(A)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{1,4})[\-+][0-9]{4} .*$/,"$1")};Date.prototype.getGMTOffset=function(){return (this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset()/60)),2,"0")+String.leftPad(this.getTimezoneOffset()%60,2,"0")};Date.prototype.getDayOfYear=function(){var A=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){A+=Date.daysInMonth[i]}return A+this.getDate()-1};Date.prototype.getWeekOfYear=function(){var A=this.getDayOfYear()+(4-this.getDay());var B=new Date(this.getFullYear(),0,1);var C=(7-B.getDay()+4);return String.leftPad(((A-C)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var A=this.getFullYear();return ((A&3)==0&&(A%100||(A%400==0&&A)))};Date.prototype.getFirstDayOfMonth=function(){var A=(this.getDay()-(this.getDate()-1))%7;return (A<0)?(A+7):A};Date.prototype.getLastDayOfMonth=function(){var A=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return (A<0)?(A+7):A};Date.prototype.getFirstDateOfMonth=function(){return new Date(this.getFullYear(),this.getMonth(),1)};Date.prototype.getLastDateOfMonth=function(){return new Date(this.getFullYear(),this.getMonth(),this.getDaysInMonth())};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return "st";case 2:case 22:return "nd";case 3:case 23:return "rd";default:return "th"}};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.prototype.clone=function(){return new Date(this.getTime())};Date.prototype.clearTime=function(A){if(A){return this.clone().clearTime()}this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};if(Roo.isSafari){Date.brokenSetMonth=Date.prototype.setMonth;Date.prototype.setMonth=function(A){if(A<=-1){var n=Math.ceil(-A);var C=Math.ceil(n/12);var B=(n%12)?12-n%12:0;this.setFullYear(this.getFullYear()-C);return Date.brokenSetMonth.call(this,B)}else{return Date.brokenSetMonth.apply(this,arguments)}}}Date.MILLI="ms";Date.SECOND="s";Date.MINUTE="mi";Date.HOUR="h";Date.DAY="d";Date.MONTH="mo";Date.YEAR="y";Date.prototype.add=function(C,B){var d=this.clone();if(!C||B===0)return d;switch(C.toLowerCase()){case Date.MILLI:d.setMilliseconds(this.getMilliseconds()+B);break;case Date.SECOND:d.setSeconds(this.getSeconds()+B);break;case Date.MINUTE:d.setMinutes(this.getMinutes()+B);break;case Date.HOUR:d.setHours(this.getHours()+B);break;case Date.DAY:d.setDate(this.getDate()+B);break;case Date.MONTH:var A=this.getDate();if(A>28){A=Math.min(A,this.getFirstDateOfMonth().add("mo",B).getLastDateOfMonth().getDate())}d.setDate(A);d.setMonth(this.getMonth()+B);break;case Date.YEAR:d.setFullYear(this.getFullYear()+B);break}return d};
-Roo.lib.Dom={getViewWidth:function(A){return A?this.getDocumentWidth():this.getViewportWidth()},getViewHeight:function(A){return A?this.getDocumentHeight():this.getViewportHeight()},getDocumentHeight:function(){var A=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(A,this.getViewportHeight())},getDocumentWidth:function(){var A=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(A,this.getViewportWidth())},getViewportHeight:function(){var B=self.innerHeight;var A=document.compatMode;if((A||Roo.isIE)&&!Roo.isOpera){B=(A=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight}return B},getViewportWidth:function(){var B=self.innerWidth;var A=document.compatMode;if(A||Roo.isIE){B=(A=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth}return B},isAncestor:function(p,c){p=Roo.getDom(p);c=Roo.getDom(c);if(!p||!c){return false}if(p.contains&&!Roo.isSafari){return p.contains(c)}else if(p.compareDocumentPosition){return !!(p.compareDocumentPosition(c)&16)}else{var A=c.parentNode;while(A){if(A==p){return true}else if(!A.tagName||A.tagName.toUpperCase()=="HTML"){return false}A=A.parentNode}return false}},getRegion:function(el){return Roo.lib.Region.getRegion(el)},getY:function(el){return this.getXY(el)[1]},getX:function(el){return this.getXY(el)[0]},getXY:function(el){var p,pe,b,C,bd=document.body;el=Roo.getDom(el);var B=Roo.lib.AnimBase.fly;if(el.getBoundingClientRect){b=el.getBoundingClientRect();C=B(document).getScroll();return [b.left+C.left,b.top+C.top]}var x=0,y=0;p=el;var D=B(el).getStyle("position")=="absolute";while(p){x+=p.offsetLeft;y+=p.offsetTop;if(!D&&B(p).getStyle("position")=="absolute"){D=true}if(Roo.isGecko){pe=B(p);var bt=parseInt(pe.getStyle("borderTopWidth"),10)||0;var bl=parseInt(pe.getStyle("borderLeftWidth"),10)||0;x+=bl;y+=bt;if(p!=el&&pe.getStyle("overflow")!="visible"){x+=bl;y+=bt}}p=p.offsetParent}if(Roo.isSafari&&D){x-=bd.offsetLeft;y-=bd.offsetTop}if(Roo.isGecko&&!D){var A=B(bd);x+=parseInt(A.getStyle("borderLeftWidth"),10)||0;y+=parseInt(A.getStyle("borderTopWidth"),10)||0}p=el.parentNode;while(p&&p!=bd){if(!Roo.isOpera||(p.tagName!="TR"&&B(p).getStyle("display")!="inline")){x-=p.scrollLeft;y-=p.scrollTop}p=p.parentNode}return [x,y]},setXY:function(el,xy){el=Roo.fly(el,"_setXY");el.position();var A=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=A.left+"px"}if(xy[1]!==false){el.dom.style.top=A.top+"px"}},setX:function(el,x){this.setXY(el,[x,false])},setY:function(el,y){this.setXY(el,[false,y])}};
-Roo.lib.Event=function(){var E=false;var C=[];var G=[];var D=0;var F=[];var A=0;var B=null;return {POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,_interval:null,startInterval:function(){if(!this._interval){var H=this;var I=function(){H._tryPreloadAttach()};this._interval=setInterval(I,this.POLL_INTERVAL)}},onAvailable:function(I,H,J,K){F.push({id:I,fn:H,obj:J,override:K,checkReady:false});D=this.POLL_RETRYS;this.startInterval()},addListener:function(el,I,fn){el=Roo.getDom(el);if(!el||!fn){return false}if("unload"==I){G[G.length]=[el,I,fn];return true}var J=function(e){return fn(Roo.lib.Event.getEvent(e))};var li=[el,I,fn,J];var H=C.length;C[H]=li;this.doAdd(el,I,J,false);return true},removeListener:function(el,K,fn){var i,H;el=Roo.getDom(el);if(!fn){return this.purgeElement(el,false,K)}if("unload"==K){for(i=0,H=G.length;i<H;i++){var li=G[i];if(li&&li[0]==el&&li[1]==K&&li[2]==fn){G.splice(i,1);return true}}return false}var J=null;var I=arguments[3];if("undefined"==typeof I){I=this._getCacheIndex(el,K,fn)}if(I>=0){J=C[I]}if(!el||!J){return false}this.doRemove(el,K,J[this.WFN],false);delete C[I][this.WFN];delete C[I][this.FN];C.splice(I,1);return true},getTarget:function(ev,H){ev=ev.browserEvent||ev;var t=ev.target||ev.srcElement;return this.resolveTextNode(t)},resolveTextNode:function(H){if(Roo.isSafari&&H&&3==H.nodeType){return H.parentNode}else{return H}},getPageX:function(ev){ev=ev.browserEvent||ev;var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(Roo.isIE){x+=this.getScroll()[1]}}return x},getPageY:function(ev){ev=ev.browserEvent||ev;var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(Roo.isIE){y+=this.getScroll()[0]}}return y},getXY:function(ev){ev=ev.browserEvent||ev;return [this.getPageX(ev),this.getPageY(ev)]},getRelatedTarget:function(ev){ev=ev.browserEvent||ev;var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement}else if(ev.type=="mouseover"){t=ev.fromElement}}return this.resolveTextNode(t)},getTime:function(ev){ev=ev.browserEvent||ev;if(!ev.time){var t=new Date().getTime();try{ev.time=t}catch(ex){this.lastError=ex;return t}}return ev.time},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev)},stopPropagation:function(ev){ev=ev.browserEvent||ev;if(ev.stopPropagation){ev.stopPropagation()}else{ev.cancelBubble=true}},preventDefault:function(ev){ev=ev.browserEvent||ev;if(ev.preventDefault){ev.preventDefault()}else{ev.returnValue=false}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break}c=c.caller}}return ev},getCharCode:function(ev){ev=ev.browserEvent||ev;return ev.charCode||ev.keyCode||0},_getCacheIndex:function(el,I,fn){for(var i=0,H=C.length;i<H;++i){var li=C[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==I){return i}}return -1},elCache:{},getEl:function(id){return document.getElementById(id)},clearCache:function(){},_load:function(e){E=true;var EU=Roo.lib.Event;if(Roo.isIE){EU.doRemove(window,"load",EU._load)}},_tryPreloadAttach:function(){if(this.locked){return false}this.locked=true;var L=!E;if(!L){L=(D>0)}var K=[];for(var i=0,H=F.length;i<H;++i){var I=F[i];if(I){var el=this.getEl(I.id);if(el){if(!I.checkReady||E||el.nextSibling||(document&&document.body)){var J=el;if(I.override){if(I.override===true){J=I.obj}else{J=I.override}}I.fn.call(J,I.obj);F[i]=null}}else{K.push(I)}}}D=(K.length===0)?0:D-1;if(L){this.startInterval()}else{clearInterval(this._interval);this._interval=null}this.locked=false;return true},purgeElement:function(el,I,J){var K=this.getListeners(el,J);if(K){for(var i=0,H=K.length;i<H;++i){var l=K[i];this.removeListener(el,l.type,l.fn)}}if(I&&el&&el.childNodes){for(i=0,H=el.childNodes.length;i<H;++i){this.purgeElement(el.childNodes[i],I,J)}}},getListeners:function(el,J){var I=[],L;if(!J){L=[C,G]}else if(J=="unload"){L=[G]}else{L=[C]}for(var j=0;j<L.length;++j){var K=L[j];if(K&&K.length>0){for(var i=0,H=K.length;i<H;++i){var l=K[i];if(l&&l[this.EL]===el&&(!J||J===l[this.TYPE])){I.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i})}}}}return (I.length)?I:null},_unload:function(e){var EU=Roo.lib.Event,i,j,l,H,I;for(i=0,H=G.length;i<H;++i){l=G[i];if(l){var J=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){J=l[EU.OBJ]}else{J=l[EU.ADJ_SCOPE]}}l[EU.FN].call(J,EU.getEvent(e),l[EU.OBJ]);G[i]=null;l=null;J=null}}G=null;if(C&&C.length>0){j=C.length;while(j){I=j-1;l=C[I];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],I)}j=j-1}l=null;EU.clearCache()}EU.doRemove(window,"unload",EU._unload)},getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft]}else if(db){return [db.scrollTop,db.scrollLeft]}else{return [0,0]}},doAdd:function(){if(window.addEventListener){return function(el,I,fn,H){el.addEventListener(I,fn,(H))}}else if(window.attachEvent){return function(el,I,fn,H){el.attachEvent("on"+I,fn)}}else{return function(){}}}(),doRemove:function(){if(window.removeEventListener){return function(el,I,fn,H){el.removeEventListener(I,fn,(H))}}else if(window.detachEvent){return function(el,H,fn){el.detachEvent("on"+H,fn)}}else{return function(){}}}()}}();(function(){var E=Roo.lib.Event;E.on=E.addListener;E.un=E.removeListener;if(document&&document.body){E._load()}else{E.doAdd(window,"load",E._load)}E.doAdd(window,"unload",E._unload);E._tryPreloadAttach()})();
-(function(){Roo.lib.Ajax={request:function(C,A,cb,B,D){if(D){var hs=D.headers;if(hs){for(var h in hs){if(hs.hasOwnProperty(h)){this.initHeader(h,hs[h],false)}}}if(D.xmlData){this.initHeader("Content-Type","text/xml",false);C="POST";B=D.xmlData}}return this.asyncRequest(C,A,cb,B)},serializeForm:function(C){if(typeof C=="string"){C=(document.getElementById(C)||document.forms[C])}var el,D,A,E,B="",F=false;for(var i=0;i<C.elements.length;i++){el=C.elements[i];E=C.elements[i].disabled;D=C.elements[i].name;A=C.elements[i].value;if(!E&&D){switch(el.type){case "select-one":case "select-multiple":for(var j=0;j<el.options.length;j++){if(el.options[j].selected){if(Roo.isIE){B+=encodeURIComponent(D)+"="+encodeURIComponent(el.options[j].attributes["value"].specified?el.options[j].value:el.options[j].text)+"&"}else{B+=encodeURIComponent(D)+"="+encodeURIComponent(el.options[j].hasAttribute("value")?el.options[j].value:el.options[j].text)+"&"}}}break;case "radio":case "checkbox":if(el.checked){B+=encodeURIComponent(D)+"="+encodeURIComponent(A)+"&"}break;case "file":case undefined:case "reset":case "button":break;case "submit":if(F==false){B+=encodeURIComponent(D)+"="+encodeURIComponent(A)+"&";F=true}break;default:B+=encodeURIComponent(D)+"="+encodeURIComponent(A)+"&";break}}}B=B.substr(0,B.length-1);return B},headers:{},hasHeaders:false,useDefaultHeader:true,defaultPostHeader:"application/x-www-form-urlencoded",useDefaultXhrHeader:true,defaultXhrHeader:"XMLHttpRequest",hasDefaultHeaders:true,defaultHeaders:{},poll:{},timeout:{},pollInterval:50,transactionId:0,setProgId:function(id){this.activeX.unshift(id)},setDefaultPostHeader:function(b){this.useDefaultHeader=b},setDefaultXhrHeader:function(b){this.useDefaultXhrHeader=b},setPollingInterval:function(i){if(typeof i=="number"&&isFinite(i)){this.pollInterval=i}},createXhrObject:function(C){var A,B;try{B=new XMLHttpRequest();A={conn:B,tId:C}}catch(e){for(var i=0;i<this.activeX.length;++i){try{B=new ActiveXObject(this.activeX[i]);A={conn:B,tId:C};break}catch(e){}}}finally{return A}},getConnectionObject:function(){var o;var A=this.transactionId;try{o=this.createXhrObject(A);if(o){this.transactionId++}}catch(e){}finally{return o}},asyncRequest:function(B,A,C,D){var o=this.getConnectionObject();if(!o){return null}else{o.conn.open(B,A,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders["X-Requested-With"]){this.initHeader("X-Requested-With",this.defaultXhrHeader,true)}}if(D&&this.useDefaultHeader){this.initHeader("Content-Type",this.defaultPostHeader)}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(o)}this.handleReadyState(o,C);o.conn.send(D||null);return o}},handleReadyState:function(o,B){var A=this;if(B&&B.timeout){this.timeout[o.tId]=window.setTimeout(function(){A.abort(o,B,true)},B.timeout)}this.poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(A.poll[o.tId]);delete A.poll[o.tId];if(B&&B.timeout){window.clearTimeout(A.timeout[o.tId]);delete A.timeout[o.tId]}A.handleTransactionResponse(o,B)}},this.pollInterval)},handleTransactionResponse:function(o,B,A){if(!B){this.releaseObject(o);return}var C,D;try{if(o.conn.status!==undefined&&o.conn.status!=0){C=o.conn.status}else{C=13030}}catch(e){C=13030}if(C>=200&&C<300){D=this.createResponseObject(o,B.argument);if(B.success){if(!B.scope){B.success(D)}else{B.success.apply(B.scope,[D])}}}else{switch(C){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:D=this.createExceptionObject(o.tId,B.argument,(A?A:false));if(B.failure){if(!B.scope){B.failure(D)}else{B.failure.apply(B.scope,[D])}}break;default:D=this.createResponseObject(o,B.argument);if(B.failure){if(!B.scope){B.failure(D)}else{B.failure.apply(B.scope,[D])}}}}this.releaseObject(o);D=null},createResponseObject:function(o,F){var A={};var C={};try{var D=o.conn.getAllResponseHeaders();var B=D.split("\n");for(var i=0;i<B.length;i++){var E=B[i].indexOf(":");if(E!=-1){C[B[i].substring(0,E)]=B[i].substring(E+2)}}}catch(e){}A.tId=o.tId;A.status=o.conn.status;A.statusText=o.conn.statusText;A.getResponseHeader=C;A.getAllResponseHeaders=D;A.responseText=o.conn.responseText;A.responseXML=o.conn.responseXML;if(typeof F!==undefined){A.argument=F}return A},createExceptionObject:function(B,H,C){var D=0;var F="communication failure";var E=-1;var G="transaction aborted";var A={};A.tId=B;if(C){A.status=E;A.statusText=G}else{A.status=D;A.statusText=F}if(H){A.argument=H}return A},initHeader:function(A,B,D){var C=(D)?this.defaultHeaders:this.headers;if(C[A]===undefined){C[A]=B}else{C[A]=B+","+C[A]}if(D){this.hasDefaultHeaders=true}else{this.hasHeaders=true}},setHeader:function(o){if(this.hasDefaultHeaders){for(var A in this.defaultHeaders){if(this.defaultHeaders.hasOwnProperty(A)){o.conn.setRequestHeader(A,this.defaultHeaders[A])}}}if(this.hasHeaders){for(var A in this.headers){if(this.headers.hasOwnProperty(A)){o.conn.setRequestHeader(A,this.headers[A])}}this.headers={};this.hasHeaders=false}},resetDefaultHeaders:function(){delete this.defaultHeaders;this.defaultHeaders={};this.hasDefaultHeaders=false},abort:function(o,A,B){if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this.poll[o.tId]);delete this.poll[o.tId];if(B){delete this.timeout[o.tId]}this.handleTransactionResponse(o,A,true);return true}else{return false}},isCallInProgress:function(o){if(o&&o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0}else{return false}},releaseObject:function(o){o.conn=null;o=null},activeX:["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"]}})();
-Roo.lib.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l};Roo.lib.Region.prototype={contains:function(A){return (A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom)},getArea:function(){return ((this.bottom-this.top)*(this.right-this.left))},intersect:function(A){var t=Math.max(this.top,A.top);var r=Math.min(this.right,A.right);var b=Math.min(this.bottom,A.bottom);var l=Math.max(this.left,A.left);if(b>=t&&r>=l){return new Roo.lib.Region(t,r,b,l)}else{return null}},union:function(A){var t=Math.min(this.top,A.top);var r=Math.max(this.right,A.right);var b=Math.max(this.bottom,A.bottom);var l=Math.min(this.left,A.left);return new Roo.lib.Region(t,r,b,l)},adjust:function(t,l,b,r){this.top+=t;this.left+=l;this.right+=r;this.bottom+=b;return this}};Roo.lib.Region.getRegion=function(el){var p=Roo.lib.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new Roo.lib.Region(t,r,b,l)};
-Roo.lib.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0]}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y};Roo.lib.Point.prototype=new Roo.lib.Region();
-(function(){Roo.lib.Anim={scroll:function(el,A,D,C,cb,B){this.run(el,A,D,C,cb,B,Roo.lib.Scroll)},motion:function(el,A,D,C,cb,B){this.run(el,A,D,C,cb,B,Roo.lib.Motion)},color:function(el,A,D,C,cb,B){this.run(el,A,D,C,cb,B,Roo.lib.ColorAnim)},run:function(el,B,F,E,cb,D,C){C=C||Roo.lib.AnimBase;if(typeof E=="string"){E=Roo.lib.Easing[E]}var A=new C(el,B,F,E);A.animateX(function(){Roo.callback(cb,D)});return A}}})();
-(function(){var B;function A(el){if(!B){B=new Roo.Element.Flyweight()}B.dom=el;return B}Roo.lib.AnimBase=function(el,E,D,C){if(el){this.init(el,E,D,C)}};Roo.lib.AnimBase.fly=A;Roo.lib.AnimBase.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return ("Anim "+id)},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(D,E,C){return this.method(this.currentFrame,E,C-E,this.totalFrames)},setAttribute:function(D,C,E){if(this.patterns.noNegatives.test(D)){C=(C>0)?C:0}Roo.fly(this.getEl(),"_anim").setStyle(D,C+E)},getAttribute:function(F){var el=this.getEl();var E=A(el).getStyle(F);if(E!=="auto"&&!this.patterns.offsetUnit.test(E)){return parseFloat(E)}var a=this.patterns.offsetAttribute.exec(F)||[];var D=!!(a[3]);var C=!!(a[2]);if(C||(A(el).getStyle("position")=="absolute"&&D)){E=el["offset"+a[0].charAt(0).toUpperCase()+a[0].substr(1)]}else{E=0}return E},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return "px"}return ""},animateX:function(D,C){var f=function(){this.onComplete.removeListener(f);if(typeof D=="function"){D.call(C||this,this)}};this.onComplete.addListener(f,this);this.animate()},setRuntimeAttribute:function(E){var G;var C;var H=this.attributes;this.runtimeAttributes[E]={};var F=function(I){return (typeof I!=="undefined")};if(!F(H[E]["to"])&&!F(H[E]["by"])){return false}G=(F(H[E]["from"]))?H[E]["from"]:this.getAttribute(E);if(F(H[E]["to"])){C=H[E]["to"]}else if(F(H[E]["by"])){if(G.constructor==Array){C=[];for(var i=0,D=G.length;i<D;++i){C[i]=G[i]+H[E]["by"][i]}}else{C=G+H[E]["by"]}}this.runtimeAttributes[E].start=G;this.runtimeAttributes[E].end=C;this.runtimeAttributes[E].unit=(F(H[E].unit))?H[E]["unit"]:this.getDefaultUnit(E)},init:function(el,H,F,C){var I=false;var G=null;var K=0;el=Roo.getDom(el);this.attributes=H||{};this.duration=F||1;this.method=C||Roo.lib.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=Roo.lib.AnimMgr.fps;this.getEl=function(){return el};this.isAnimated=function(){return I};this.getStartTime=function(){return G};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(Roo.lib.AnimMgr.fps*this.duration):this.duration;Roo.lib.AnimMgr.registerElement(this)};this.stop=function(L){if(L){this.currentFrame=this.totalFrames;this._onTween.fire()}Roo.lib.AnimMgr.stop(this)};var D=function(){this.onStart.fire();this.runtimeAttributes={};for(var L in this.attributes){this.setRuntimeAttribute(L)}I=true;K=0;G=new Date()};var E=function(){var M={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};M.toString=function(){return ("duration: "+M.duration+", currentFrame: "+M.currentFrame)};this.onTween.fire(M);var N=this.runtimeAttributes;for(var L in N){this.setAttribute(L,this.doMethod(L,N[L].start,N[L].end),N[L].unit)}K+=1};var J=function(){var M=(new Date()-G)/1000;var L={duration:M,frames:K,fps:K/M};L.toString=function(){return ("duration: "+L.duration+", frames: "+L.frames+", fps: "+L.fps)};I=false;K=0;this.onComplete.fire(L)};this._onStart=new Roo.util.Event(this);this.onStart=new Roo.util.Event(this);this.onTween=new Roo.util.Event(this);this._onTween=new Roo.util.Event(this);this.onComplete=new Roo.util.Event(this);this._onComplete=new Roo.util.Event(this);this._onStart.addListener(D);this._onTween.addListener(E);this._onComplete.addListener(J)}}})();
-Roo.lib.AnimMgr=new function(){var B=null;var A=[];var D=0;this.fps=1000;this.delay=1;this.registerElement=function(F){A[A.length]=F;D+=1;F._onStart.fire();this.start()};this.unRegister=function(G,F){G._onComplete.fire();F=F||C(G);if(F!=-1){A.splice(F,1)}D-=1;if(D<=0){this.stop()}};this.start=function(){if(B===null){B=setInterval(this.run,this.delay)}};this.stop=function(G){if(!G){clearInterval(B);for(var i=0,F=A.length;i<F;++i){if(A[0].isAnimated()){this.unRegister(A[0],0)}}A=[];B=null;D=0}else{this.unRegister(G)}};this.run=function(){for(var i=0,F=A.length;i<F;++i){var G=A[i];if(!G||!G.isAnimated()){continue}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){E(G)}G._onTween.fire()}else{Roo.lib.AnimMgr.stop(G,i)}}};var C=function(G){for(var i=0,F=A.length;i<F;++i){if(A[i]==G){return i}}return -1};var E=function(H){var I=H.totalFrames;var F=H.currentFrame;var K=(H.currentFrame*H.duration*1000/H.totalFrames);var J=(new Date()-H.getStartTime());var G=0;if(J<H.duration*1000){G=Math.round((J/K-1)*H.currentFrame)}else{G=I-(F+1)}if(G>0&&isFinite(G)){if(H.currentFrame+G>=I){G=I-(F+1)}H.currentFrame+=G}}};
-Roo.lib.Bezier=new function(){this.getPosition=function(B,t){var n=B.length;var A=[];for(var i=0;i<n;++i){A[i]=[B[i][0],B[i][1]]}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){A[i][0]=(1-t)*A[i][0]+t*A[parseInt(i+1,10)][0];A[i][1]=(1-t)*A[i][1]+t*A[parseInt(i+1,10)][1]}}return [A[0][0],A[0][1]]}};
-(function(){Roo.lib.ColorAnim=function(el,F,E,D){Roo.lib.ColorAnim.superclass.constructor.call(this,el,F,E,D)};Roo.extend(Roo.lib.ColorAnim,Roo.lib.AnimBase);var A=Roo.lib.AnimBase.fly;var Y=Roo.lib;var C=Y.ColorAnim.superclass;var B=Y.ColorAnim.prototype;B.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return ("ColorAnim "+id)};B.patterns.color=/color$/i;B.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;B.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;B.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;B.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;B.parseColor=function(s){if(s.length==3){return s}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return [parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return [parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]}c=this.patterns.hex3.exec(s);if(c&&c.length==4){return [parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]}return null};B.getAttribute=function(E){var el=this.getEl();if(this.patterns.color.test(E)){var D=A(el).getStyle(E);if(this.patterns.transparent.test(D)){var F=el.parentNode;D=A(F).getStyle(E);while(F&&this.patterns.transparent.test(D)){F=F.parentNode;D=A(F).getStyle(E);if(F.tagName.toUpperCase()=="HTML"){D="#fff"}}}}else{D=C.getAttribute.call(this,E)}return D};B.getAttribute=function(E){var el=this.getEl();if(this.patterns.color.test(E)){var D=A(el).getStyle(E);if(this.patterns.transparent.test(D)){var F=el.parentNode;D=A(F).getStyle(E);while(F&&this.patterns.transparent.test(D)){F=F.parentNode;D=A(F).getStyle(E);if(F.tagName.toUpperCase()=="HTML"){D="#fff"}}}}else{D=C.getAttribute.call(this,E)}return D};B.doMethod=function(G,H,D){var F;if(this.patterns.color.test(G)){F=[];for(var i=0,E=H.length;i<E;++i){F[i]=C.doMethod.call(this,G,H[i],D[i])}F="rgb("+Math.floor(F[0])+","+Math.floor(F[1])+","+Math.floor(F[2])+")"}else{F=C.doMethod.call(this,G,H,D)}return F};B.setRuntimeAttribute=function(F){C.setRuntimeAttribute.call(this,F);if(this.patterns.color.test(F)){var H=this.attributes;var G=this.parseColor(this.runtimeAttributes[F].start);var D=this.parseColor(this.runtimeAttributes[F].end);if(typeof H[F]["to"]==="undefined"&&typeof H[F]["by"]!=="undefined"){D=this.parseColor(H[F].by);for(var i=0,E=G.length;i<E;++i){D[i]=G[i]+D[i]}}this.runtimeAttributes[F].start=G;this.runtimeAttributes[F].end=D}}})();
-Roo.lib.Easing={easeNone:function(t,b,c,d){return c*t/d+b},easeIn:function(t,b,c,d){return c*(t/=d)*t+b},easeOut:function(t,b,c,d){return -c*(t/=d)*(t-2)+b},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b}return -c/2*((--t)*(t-2)-1)+b},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutStrong:function(t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b}return -c/2*((t-=2)*t*t*t-2)+b},elasticIn:function(t,b,c,d,a,p){if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(!a||a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return -(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},elasticOut:function(t,b,c,d,a,p){if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(!a||a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b}if((t/=d/2)==2){return b+c}if(!p){p=d*(0.3*1.5)}if(!a||a<Math.abs(c)){a=c;var s=p/4}else{var s=p/(2*Math.PI)*Math.asin(c/a)}if(t<1){return -0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b}return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b},backIn:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158}return c*(t/=d)*t*((s+1)*t-s)+b},backOut:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158}return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},backBoth:function(t,b,c,d,s){if(typeof s=="undefined"){s=1.70158}if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b}return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},bounceIn:function(t,b,c,d){return c-Roo.lib.Easing.bounceOut(d-t,0,c,d)+b},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b}return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b},bounceBoth:function(t,b,c,d){if(t<d/2){return Roo.lib.Easing.bounceIn(t*2,0,c,d)*0.5+b}return Roo.lib.Easing.bounceOut(t*2-d,0,c,d)*0.5+c*0.5+b}};
-(function(){Roo.lib.Motion=function(el,G,F,E){if(el){Roo.lib.Motion.superclass.constructor.call(this,el,G,F,E)}};Roo.extend(Roo.lib.Motion,Roo.lib.ColorAnim);var Y=Roo.lib;var C=Y.Motion.superclass;var B=Y.Motion.prototype;B.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return ("Motion "+id)};B.patterns.points=/^points$/i;B.setAttribute=function(F,E,G){if(this.patterns.points.test(F)){G=G||"px";C.setAttribute.call(this,"left",E[0],G);C.setAttribute.call(this,"top",E[1],G)}else{C.setAttribute.call(this,F,E,G)}};B.getAttribute=function(F){if(this.patterns.points.test(F)){var E=[C.getAttribute.call(this,"left"),C.getAttribute.call(this,"top")]}else{E=C.getAttribute.call(this,F)}return E};B.doMethod=function(G,H,E){var F=null;if(this.patterns.points.test(G)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;F=Y.Bezier.getPosition(this.runtimeAttributes[G],t)}else{F=C.doMethod.call(this,G,H,E)}return F};B.setRuntimeAttribute=function(H){if(this.patterns.points.test(H)){var el=this.getEl();var L=this.attributes;var I;var K=L["points"]["control"]||[];var E;var i,F;if(K.length>0&&!(K[0] instanceof Array)){K=[K]}else{var G=[];for(i=0,F=K.length;i<F;++i){G[i]=K[i]}K=G}Roo.fly(el).position();if(A(L["points"]["from"])){Roo.lib.Dom.setXY(el,L["points"]["from"])}else{Roo.lib.Dom.setXY(el,Roo.lib.Dom.getXY(el))}I=this.getAttribute("points");if(A(L["points"]["to"])){E=D.call(this,L["points"]["to"],I);var J=Roo.lib.Dom.getXY(this.getEl());for(i=0,F=K.length;i<F;++i){K[i]=D.call(this,K[i],I)}}else if(A(L["points"]["by"])){E=[I[0]+L["points"]["by"][0],I[1]+L["points"]["by"][1]];for(i=0,F=K.length;i<F;++i){K[i]=[I[0]+K[i][0],I[1]+K[i][1]]}}this.runtimeAttributes[H]=[I];if(K.length>0){this.runtimeAttributes[H]=this.runtimeAttributes[H].concat(K)}this.runtimeAttributes[H][this.runtimeAttributes[H].length]=E}else{C.setRuntimeAttribute.call(this,H)}};var D=function(E,F){var G=Roo.lib.Dom.getXY(this.getEl());E=[E[0]-G[0]+F[0],E[1]-G[1]+F[1]];return E};var A=function(E){return (typeof E!=="undefined")}})();
-(function(){Roo.lib.Scroll=function(el,E,D,C){if(el){Roo.lib.Scroll.superclass.constructor.call(this,el,E,D,C)}};Roo.extend(Roo.lib.Scroll,Roo.lib.ColorAnim);var Y=Roo.lib;var B=Y.Scroll.superclass;var A=Y.Scroll.prototype;A.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return ("Scroll "+id)};A.doMethod=function(E,F,C){var D=null;if(E=="scroll"){D=[this.method(this.currentFrame,F[0],C[0]-F[0],this.totalFrames),this.method(this.currentFrame,F[1],C[1]-F[1],this.totalFrames)]}else{D=B.doMethod.call(this,E,F,C)}return D};A.getAttribute=function(D){var C=null;var el=this.getEl();if(D=="scroll"){C=[el.scrollLeft,el.scrollTop]}else{C=B.getAttribute.call(this,D)}return C};A.setAttribute=function(D,C,E){var el=this.getEl();if(D=="scroll"){el.scrollLeft=C[0];el.scrollTop=C[1]}else{B.setAttribute.call(this,D,C,E)}}})();
-Roo.DomHelper=function(){var K=null;var I=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var G=/^table|tbody|tr|td$/i;var E={};var J=function(o){if(typeof o=="string"){return o;}var b="";if(!o.tag){o.tag="div";}b+="<"+o.tag;for(var O in o){if(O=="tag"||O=="children"||O=="cn"||O=="html"||typeof o[O]=="function")continue;
-if(O=="style"){var s=o["style"];if(typeof s=="function"){s=s.call();}if(typeof s=="string"){b+=" style=\""+s+"\"";}else if(typeof s=="object"){b+=" style=\"";for(var M in s){if(typeof s[M]!="function"){b+=M+":"+s[M]+";";}}b+="\"";}}else{if(O=="cls"){b+=" class=\""+o["cls"]+"\"";
-}else if(O=="htmlFor"){b+=" for=\""+o["htmlFor"]+"\"";}else{b+=" "+O+"=\""+o[O]+"\"";}}}if(I.test(o.tag)){b+="/>";}else{b+=">";var cn=o.children||o.cn;if(cn){if((cn instanceof Array)||(Roo.isSafari&&typeof (cn.join)=="function")){for(var i=0,N=cn.length;i<N;
-i++){b+=J(cn[i],b);}}else{b+=J(cn,b);}}if(o.html){b+=o.html;}b+="</"+o.tag+">";}return b;};var H=function(o,P){var ns=false;if(o.ns&&o.ns!="html"){if(o.xmlns&&typeof (E[o.ns])=="undefined"){E[o.ns]=o.xmlns;ns=o.xmlns;}if(typeof (E[o.ns])=="undefined"){console.log("Trying to create namespace element "+o.ns+", however no xmlns was sent to builder previously");
-}ns=E[o.ns];}if(typeof (o)=="string"){return P.appendChild(document.createTextNode(o));}o.tag=o.tag||div;if(o.ns&&Roo.isIE){ns=false;o.tag=o.ns+":"+o.tag;}var el=ns?document.createElementNS(ns,o.tag||"div"):document.createElement(o.tag||"div");var O=el.setAttribute?true:false;
-for(var N in o){if(N=="tag"||N=="ns"||N=="xmlns"||N=="children"||N=="cn"||N=="html"||N=="style"||typeof o[N]=="function")continue;if(N=="cls"&&Roo.isIE){el.className=o["cls"];}else{if(O)el.setAttribute(N=="cls"?"class":N,o[N]);elseel[N]=o[N];}}Roo.DomHelper.applyStyles(el,o.style);
-var cn=o.children||o.cn;if(cn){if((cn instanceof Array)||(Roo.isSafari&&typeof (cn.join)=="function")){for(var i=0,M=cn.length;i<M;i++){H(cn[i],el);}}else{H(cn,el);}}if(o.html){el.innerHTML=o.html;}if(P){P.appendChild(el);}return el;};var F=function(M,s,h,e){K.innerHTML=[s,h,e].join("");
-var i=-1,el=K;while(++i<M){el=el.firstChild;}return el;};var ts="<table>",te="</table>",B=ts+"<tbody>",A="</tbody>"+te,D=B+"<tr>",C="</tr>"+A;var L=function(M,P,el,N){if(!K){K=document.createElement("div");}var O;var Q=null;if(M=="td"){if(P=="afterbegin"||P=="beforeend"){return;
-}if(P=="beforebegin"){Q=el;el=el.parentNode;}else{Q=el.nextSibling;el=el.parentNode;}O=F(4,D,N,C);}else if(M=="tr"){if(P=="beforebegin"){Q=el;el=el.parentNode;O=F(3,B,N,A);}else if(P=="afterend"){Q=el.nextSibling;el=el.parentNode;O=F(3,B,N,A);}else{if(P=="afterbegin"){Q=el.firstChild;
-}O=F(4,D,N,C);}}else if(M=="tbody"){if(P=="beforebegin"){Q=el;el=el.parentNode;O=F(2,ts,N,te);}else if(P=="afterend"){Q=el.nextSibling;el=el.parentNode;O=F(2,ts,N,te);}else{if(P=="afterbegin"){Q=el.firstChild;}O=F(3,B,N,A);}}else{if(P=="beforebegin"||P=="afterend"){return;
-}if(P=="afterbegin"){Q=el.firstChild;}O=F(2,ts,N,te);}el.insertBefore(O,Q);return O;};return {useDom:false,markup:function(o){return J(o);},applyStyles:function(el,N){if(N){el=Roo.fly(el);if(typeof N=="string"){var re=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var O;
-while((O=re.exec(N))!=null){el.setStyle(O[1],O[2]);}}else if(typeof N=="object"){for(var M in N){el.setStyle(M,N[M]);}}else if(typeof N=="function"){Roo.DomHelper.applyStyles(el,N.call());}}},insertHtml:function(P,el,N){P=P.toLowerCase();if(el.insertAdjacentHTML){if(G.test(el.tagName)){var rs;
-if(rs=L(el.tagName.toLowerCase(),P,el,N)){return rs;}}switch(P){case "beforebegin":el.insertAdjacentHTML("BeforeBegin",N);return el.previousSibling;case "afterbegin":el.insertAdjacentHTML("AfterBegin",N);return el.firstChild;case "beforeend":el.insertAdjacentHTML("BeforeEnd",N);
-return el.lastChild;case "afterend":el.insertAdjacentHTML("AfterEnd",N);return el.nextSibling;}throw "Illegal insertion point -> \""+P+"\"";}var O=el.ownerDocument.createRange();var M;switch(P){case "beforebegin":O.setStartBefore(el);M=O.createContextualFragment(N);
-el.parentNode.insertBefore(M,el);return el.previousSibling;case "afterbegin":if(el.firstChild){O.setStartBefore(el.firstChild);M=O.createContextualFragment(N);el.insertBefore(M,el.firstChild);return el.firstChild;}else{el.innerHTML=N;return el.firstChild;
-}case "beforeend":if(el.lastChild){O.setStartAfter(el.lastChild);M=O.createContextualFragment(N);el.appendChild(M);return el.lastChild;}else{el.innerHTML=N;return el.lastChild;}case "afterend":O.setStartAfter(el);M=O.createContextualFragment(N);el.parentNode.insertBefore(M,el.nextSibling);
-return el.nextSibling;}throw "Illegal insertion point -> \""+P+"\"";},insertBefore:function(el,o,M){return this.doInsert(el,o,M,"beforeBegin");},insertAfter:function(el,o,M){return this.doInsert(el,o,M,"afterEnd","nextSibling");},insertFirst:function(el,o,M){return this.doInsert(el,o,M,"afterBegin");
-},doInsert:function(el,o,Q,M,P){el=Roo.getDom(el);var O;if(this.useDom||o.ns){O=H(o,null);el.parentNode.insertBefore(O,P?el[P]:el);}else{var N=J(o);O=this.insertHtml(M,el,N);}return Q?Roo.get(O,true):O;},append:function(el,o,O){el=Roo.getDom(el);var N;if(this.useDom||o.ns){N=H(o,null);
-el.appendChild(N);}else{var M=J(o);N=this.insertHtml("beforeEnd",el,M);}return O?Roo.get(N,true):N;},overwrite:function(el,o,M){el=Roo.getDom(el);if(o.ns){while(el.childNodes.length){el.removeChild(el.firstChild);}H(o,el);}else{el.innerHTML=J(o);}return M?Roo.get(el.firstChild,true):el.firstChild;
-},createTemplate:function(o){var M=J(o);return new Roo.Template(M);}};}();
-Roo.Template=function(A){if(A instanceof Array){A=A.join("")}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"")}this.html=A};Roo.Template.prototype={applyTemplate:function(C){if(this.compiled){return this.compiled(C)}var B=this.disableFormats!==true;var fm=Roo.util.Format,A=this;var fn=function(m,F,G,E){if(G&&B){if(G.substr(0,5)=="this."){return A.call(G.substr(5),C[F],C)}else{if(E){var re=/^\s*['"](.*)["']\s*$/;E=E.split(",");for(var i=0,D=E.length;i<D;i++){E[i]=E[i].replace(re,"$1")}E=[C[F]].concat(E)}else{E=[C[F]]}return fm[G].apply(fm,E)}}else{return C[F]!==undefined?C[F]:""}};return this.html.replace(this.re,fn)},set:function(A,B){this.html=A;this.compiled=null;if(B){this.compile()}return this},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Roo.util.Format;var C=this.disableFormats!==true;var A=Roo.isGecko?"+":",";var fn=function(m,E,F,D){if(F&&C){D=D?","+D:"";if(F.substr(0,5)!="this."){F="fm."+F+"("}else{F="this.call(\""+F.substr(5)+"\", ";D=", values"}}else{D="";F="(values['"+E+"'] == undefined ? '' : "}return "'"+A+F+"values['"+E+"']"+D+")"+A+"'"};var B;if(Roo.isGecko){B="this.compiled = function(values){ return '"+this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn)+"';};"}else{B=["this.compiled = function(values){ return ['"];B.push(this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn));B.push("'].join('');};");B=B.join("")}eval(B);return this},call:function(B,A,C){return this[B](A,C)},insertFirst:function(el,A,B){return this.doInsert("afterBegin",el,A,B)},insertBefore:function(el,A,B){return this.doInsert("beforeBegin",el,A,B)},insertAfter:function(el,A,B){return this.doInsert("afterEnd",el,A,B)},append:function(el,A,B){return this.doInsert("beforeEnd",el,A,B)},doInsert:function(A,el,B,D){el=Roo.getDom(el);var C=Roo.DomHelper.insertHtml(A,el,this.applyTemplate(B));return D?Roo.get(C,true):C},overwrite:function(el,A,B){el=Roo.getDom(el);el.innerHTML=this.applyTemplate(A);return B?Roo.get(el.firstChild,true):el.firstChild}};Roo.Template.prototype.apply=Roo.Template.prototype.applyTemplate;Roo.DomHelper.Template=Roo.Template;Roo.Template.from=function(el){el=Roo.getDom(el);return new Roo.Template(el.value||el.innerHTML)};
-Roo.DomQuery=function(){var F={},T={},S={};var O=/\S/;var M=/^\s+|\s+$/g;var I=/\{(\d+)\}/g;var K=/^(\s?[\/>+~]\s?|\s|$)/;var R=/^(#)?([\w-\*]+)/;var H=/(\d*)n\+?(\d*)/,L=/\D/;function G(p,V){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==V){return n}}n=n.nextSibling}return null};function D(n){while((n=n.nextSibling)&&n.nodeType!=1);return n};function E(n){while((n=n.previousSibling)&&n.nodeType!=1);return n};function N(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!O.test(n.nodeValue)){d.removeChild(n)}else{n.nodeIndex=++ni}n=nx}return this};function byClassName(c,a,v){if(!v){return c}var r=[],ri=-1,cn;for(var i=0,ci;ci=c[i];i++){if((" "+ci.className+" ").indexOf(v)!=-1){r[++ri]=ci}}return r};function attrValue(n,V){if(!n.tagName&&typeof n.length!="undefined"){n=n[0]}if(!n){return null}if(V=="for"){return n.htmlFor}if(V=="class"||V=="className"){return n.className}return n.getAttribute(V)||n[V]};function getNodes(ns,V,Y){var X=[],ri=-1,cs;if(!ns){return X}Y=Y||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns]}if(!V){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(Y);for(var j=0,ci;ci=cs[j];j++){X[++ri]=ci}}}else if(V=="/"||V==">"){var W=Y.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.children||ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==W||cj.nodeName==Y||Y=="*"){X[++ri]=cj}}}}else if(V=="+"){var W=Y.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(n&&(n.nodeName==W||n.nodeName==Y||Y=="*")){X[++ri]=n}}}else if(V=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(Y=="*"||n.tagName.toLowerCase()!=Y)));if(n){X[++ri]=n}}}return X};function J(a,b){if(b.slice){return a.concat(b)}for(var i=0,l=b.length;i<l;i++){a[a.length]=b[i]}return a}function byTag(cs,V){if(cs.tagName||cs==document){cs=[cs]}if(!V){return cs}var r=[],ri=-1;V=V.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==V){r[++ri]=ci}}return r};function B(cs,V,id){if(cs.tagName||cs==document){cs=[cs]}if(!id){return cs}var r=[],ri=-1;for(var i=0,ci;ci=cs[i];i++){if(ci&&ci.id==id){r[++ri]=ci;return r}}return r};function byAttribute(cs,V,W,op,X){var r=[],ri=-1,st=X=="{";var f=Roo.DomQuery.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Roo.DomQuery.getStyle(ci,V)}else if(V=="class"||V=="className"){a=ci.className}else if(V=="for"){a=ci.htmlFor}else if(V=="href"){a=ci.getAttribute("href",2)}else{a=ci.getAttribute(V)}if((f&&f(a,W))||(!f&&a)){r[++ri]=ci}}return r};function byPseudo(cs,V,W){return Roo.DomQuery.pseudos[V](cs,W)};var C=window.ActiveXObject?true:false;var batch=30803;var A=30803;function Q(cs){var d=++A;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,V=cs.length;i<V;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c}}for(var i=0,V=cs.length;i<V;i++){cs[i].removeAttribute("_nodup")}return r}function nodup(cs){if(!cs){return []}var V=cs.length,c,i,r=cs,cj,ri=-1;if(!V||typeof cs.nodeType!="undefined"||V==1){return cs}if(C&&typeof cs[0].selectSingleNode!="undefined"){return Q(cs)}var d=++A;cs[0]._nodup=d;for(i=1;c=cs[i];i++){if(c._nodup!=d){c._nodup=d}else{r=[];for(var j=0;j<i;j++){r[++ri]=cs[j]}for(j=i+1;cj=cs[j];j++){if(cj._nodup!=d){cj._nodup=d;r[++ri]=cj}}return r}}return r}function U(c1,c2){var d=++A;for(var i=0,V=c1.length;i<V;i++){c1[i].setAttribute("_qdiff",d)}var r=[];for(var i=0,V=c2.length;i<V;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i]}}for(var i=0,V=c1.length;i<V;i++){c1[i].removeAttribute("_qdiff")}return r}function P(c1,c2){var W=c1.length;if(!W){return c2}if(C&&c1[0].selectSingleNode){return U(c1,c2)}var d=++A;for(var i=0;i<W;i++){c1[i]._qdiff=d}var r=[];for(var i=0,V=c2.length;i<V;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i]}}return r}function quickId(ns,V,W,id){if(ns==W){var d=W.ownerDocument||W;return d.getElementById(id)}ns=getNodes(ns,V,"*");return B(ns,null,id)}return {getStyle:function(el,V){return Roo.fly(el).getStyle(V)},compile:function(V,W){W=W||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];var q=V,mode,lq;var tk=Roo.DomQuery.matchers;var Y=tk.length;var mm;var X=q.match(K);if(X&&X[1]){fn[fn.length]="mode=\""+X[1].replace(M,"")+"\";";q=q.replace(X[1],"")}while(V.substr(0,1)=="/"){V=V.substr(1)}while(q&&lq!=q){lq=q;var tm=q.match(R);if(W=="select"){if(tm){if(tm[1]=="#"){fn[fn.length]="n = quickId(n, mode, root, \""+tm[2]+"\");"}else{fn[fn.length]="n = getNodes(n, mode, \""+tm[2]+"\");"}q=q.replace(tm[0],"")}else if(q.substr(0,1)!="@"){fn[fn.length]="n = getNodes(n, mode, \"*\");"}}else{if(tm){if(tm[1]=="#"){fn[fn.length]="n = byId(n, null, \""+tm[2]+"\");"}else{fn[fn.length]="n = byTag(n, \""+tm[2]+"\");"}q=q.replace(tm[0],"")}}while(!(mm=q.match(K))){var Z=false;for(var j=0;j<Y;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(I,function(x,i){return m[i]});q=q.replace(m[0],"");Z=true;break}}if(!Z){throw "Error parsing selector, parsing failed at \""+q+"\""}}if(mm[1]){fn[fn.length]="mode=\""+mm[1].replace(M,"")+"\";";q=q.replace(mm[1],"")}}fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f},select:function(W,X,Y){if(!X||X==document){X=document}if(typeof X=="string"){X=document.getElementById(X)}var Z=W.split(",");var b=[];for(var i=0,V=Z.length;i<V;i++){var p=Z[i].replace(M,"");if(!F[p]){F[p]=Roo.DomQuery.compile(p);if(!F[p]){throw p+" is not a valid selector"}}var a=F[p](X);if(a&&a!=document){b=b.concat(a)}}if(Z.length>1){return nodup(b)}return b},selectNode:function(V,W){return Roo.DomQuery.select(V,W)[0]},selectValue:function(V,W,X){V=V.replace(M,"");if(!S[V]){S[V]=Roo.DomQuery.compile(V,"select")}var n=S[V](W);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return ((v===null||v===undefined||v==="")?X:v)},selectNumber:function(V,W,X){var v=Roo.DomQuery.selectValue(V,W,X||0);return parseFloat(v)},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el)}var W=(el instanceof Array);var V=Roo.DomQuery.filter(W?el:[el],ss);return W?(V.length==el.length):(V.length>0)},filter:function(V,ss,X){ss=ss.replace(M,"");if(!T[ss]){T[ss]=Roo.DomQuery.compile(ss,"simple")}var W=T[ss](V);return X?P(W,V):W},matchers:[{re:/^\.([\w-]+)/,select:"n = byClassName(n, null, \" {1} \");"},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:"n = byPseudo(n, \"{1}\", \"{2}\");"},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:"n = byAttribute(n, \"{2}\", \"{4}\", \"{3}\", \"{1}\");"},{re:/^#([\w-]+)/,select:"n = byId(n, null, \"{1}\");"},{re:/^@([\w-]+)/,select:"return {firstChild:{nodeValue:attrValue(n, \"{1}\")}};"}],operators:{"=":function(a,v){return a==v},"!=":function(a,v){return a!=v},"^=":function(a,v){return a&&a.substr(0,v.length)==v},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v},"*=":function(a,v){return a&&a.indexOf(v)!==-1},"%=":function(a,v){return (a%v)==0},"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+"-")},"~=":function(a,v){return a&&(" "+a+" ").indexOf(" "+v+" ")!=-1}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1);if(!n){r[++ri]=ci}}return r},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(!n){r[++ri]=ci}}return r},"nth-child":function(c,a){var r=[],ri=-1;var m=H.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!L.test(a)&&"n+"+a||a);var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j}}pn._batch=batch}if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n}}else if((n.nodeIndex+l)%f==0){r[++ri]=n}}return r},"only-child":function(c){var r=[],ri=-1;;for(var i=0,ci;ci=c[i];i++){if(!E(ci)&&!D(ci)){r[++ri]=ci}}return r},empty:function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var V=ci.childNodes,j=0,cn,W=true;while(cn=V[j]){++j;if(cn.nodeType==1||cn.nodeType==3){W=false;break}}if(W){r[++ri]=ci}}return r},contains:function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||"").indexOf(v)!=-1){r[++ri]=ci}}return r},nodeValue:function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci}}return r},checked:function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci}}return r},not:function(c,ss){return Roo.DomQuery.filter(c,ss,true)},odd:function(c){return this["nth-child"](c,"odd")},even:function(c){return this["nth-child"](c,"even")},nth:function(c,a){return c[a-1]||[]},first:function(c){return c[0]||[]},last:function(c){return c[c.length-1]||[]},has:function(c,ss){var s=Roo.DomQuery.select;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci}}return r},next:function(c,ss){var is=Roo.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=D(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r},prev:function(c,ss){var is=Roo.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=E(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r}}}}();Roo.query=Roo.DomQuery.select;
-Roo.util.Observable=function(A){A=A||{};this.addEvents(A.events||{});if(A.events){delete A.events;}Roo.apply(this,A);if(this.listeners){this.on(this.listeners);delete this.listeners;}};Roo.util.Observable.prototype={fireEvent:function(){var ce=this.events[arguments[0].toLowerCase()];
-if(typeof ce=="object"){return ce.fire.apply(ce,Array.prototype.slice.call(arguments,1));}else{return true;}},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(B,fn,A,o){if(typeof B=="object"){o=B;for(var e in o){if(this.filterOptRe.test(e)){continue;
-}if(typeof o[e]=="function"){this.addListener(e,o[e],o.scope,o);}else{this.addListener(e,o[e].fn,o[e].scope,o[e]);}}return;}o=(!o||typeof o=="boolean")?{}:o;B=B.toLowerCase();var ce=this.events[B]||true;if(typeof ce=="boolean"){ce=new Roo.util.Event(this,B);
-this.events[B]=ce;}ce.addListener(fn,A,o);},removeListener:function(B,fn,A){var ce=this.events[B.toLowerCase()];if(typeof ce=="object"){ce.removeListener(fn,A);}},purgeListeners:function(){for(var A in this.events){if(typeof this.events[A]=="object"){this.events[A].clearListeners();
-}}},relayEvents:function(o,C){var D=function(E){return function(){return this.fireEvent.apply(this,Roo.combine(E,Array.prototype.slice.call(arguments,0)));};};for(var i=0,A=C.length;i<A;i++){var B=C[i];if(!this.events[B]){this.events[B]=true;};o.on(B,D(B),this);
-}},addEvents:function(o){if(!this.events){this.events={};}Roo.applyIf(this.events,o);},hasListener:function(A){var e=this.events[A];return typeof e=="object"&&e.listeners.length>0;}};Roo.util.Observable.prototype.on=Roo.util.Observable.prototype.addListener;
-Roo.util.Observable.prototype.un=Roo.util.Observable.prototype.removeListener;Roo.util.Observable.capture=function(o,fn,A){o.fireEvent=o.fireEvent.createInterceptor(fn,A);};Roo.util.Observable.releaseCapture=function(o){o.fireEvent=Roo.util.Observable.prototype.fireEvent;
-};(function(){var C=function(h,o,E){var D=new Roo.util.DelayedTask();return function(){D.delay(o.buffer,h,E,Array.prototype.slice.call(arguments,0));};};var A=function(h,e,fn,D){return function(){e.removeListener(fn,D);return h.apply(D,arguments);};};var B=function(h,o,D){return function(){var E=Array.prototype.slice.call(arguments,0);
-setTimeout(function(){h.apply(D,E);},o.delay||10);};};Roo.util.Event=function(D,E){this.name=E;this.obj=D;this.listeners=[];};Roo.util.Event.prototype={addListener:function(fn,D,E){var o=E||{};D=D||this.obj;if(!this.isListening(fn,D)){var l={fn:fn,scope:D,options:o};
-var h=fn;if(o.delay){h=B(h,o,D);}if(o.single){h=A(h,this,fn,D);}if(o.buffer){h=C(h,o,D);}l.fireFn=h;if(!this.firing){this.listeners.push(l);}else{this.listeners=this.listeners.slice(0);this.listeners.push(l);}}},findListener:function(fn,E){E=E||this.obj;var ls=this.listeners;
-for(var i=0,D=ls.length;i<D;i++){var l=ls[i];if(l.fn==fn&&l.scope==E){return i;}}return -1;},isListening:function(fn,D){return this.findListener(fn,D)!=-1;},removeListener:function(fn,E){var D;if((D=this.findListener(fn,E))!=-1){if(!this.firing){this.listeners.splice(D,1);
-}else{this.listeners=this.listeners.slice(0);this.listeners.splice(D,1);}return true;}return false;},clearListeners:function(){this.listeners=[];},fire:function(){var ls=this.listeners,F,D=ls.length;if(D>0){this.firing=true;var E=Array.prototype.slice.call(arguments,0);
-for(var i=0;i<D;i++){var l=ls[i];if(l.fireFn.apply(l.scope||this.obj||window,arguments)===false){this.firing=false;return false;}}this.firing=false;}return true;}};})();
-Roo.EventManager=function(){var N,R,O=false;var I,H,G,F;var E=Roo.lib.Event;var D=Roo.lib.Dom;var K=function(){if(!O){O=true;Roo.isReady=true;if(R){clearInterval(R);}if(Roo.isGecko||Roo.isOpera){document.removeEventListener("DOMContentLoaded",K,false);}if(Roo.isIE){var S=document.getElementById("ie-deferred-loader");
-if(S){S.onreadystatechange=null;S.parentNode.removeChild(S);}}if(N){N.fire();N.clearListeners();}}};var L=function(){N=new Roo.util.Event();if(Roo.isGecko||Roo.isOpera){document.addEventListener("DOMContentLoaded",K,false);}else if(Roo.isIE){document.write("<s"+"cript id=\"ie-deferred-loader\" defer=\"defer\" src=\"/"+"/:\"></s"+"cript>");
-var S=document.getElementById("ie-deferred-loader");S.onreadystatechange=function(){if(this.readyState=="complete"){K();}};}else if(Roo.isSafari){R=setInterval(function(){var rs=document.readyState;if(rs=="complete"){K();}},10);}E.on(window,"load",K);};var Q=function(h,o){var S=new Roo.util.DelayedTask(h);
-return function(e){e=new Roo.EventObjectImpl(e);S.delay(o.buffer,h,null,[e]);};};var J=function(h,el,S,fn){return function(e){Roo.EventManager.removeListener(el,S,fn);h(e);};};var M=function(h,o){return function(e){e=new Roo.EventObjectImpl(e);setTimeout(function(){h(e);
-},o.delay||10);};};var B=function(V,T,S,fn,U){var o=(!S||typeof S=="boolean")?{}:S;fn=fn||o.fn;U=U||o.scope;var el=Roo.getDom(V);if(!el){throw "Error listening for \""+T+"\". Element \""+V+"\" doesn't exist.";}var h=function(e){e=Roo.EventObject.setEvent(e);
-var t;if(o.delegate){t=e.getTarget(o.delegate,el);if(!t){return;}}else{t=e.target;}if(o.stopEvent===true){e.stopEvent();}if(o.preventDefault===true){e.preventDefault();}if(o.stopPropagation===true){e.stopPropagation();}if(o.normalized===false){e=e.browserEvent;
-}fn.call(U||el,e,t,o);};if(o.delay){h=M(h,o);}if(o.single){h=J(h,el,T,fn);}if(o.buffer){h=Q(h,o);}fn._handlers=fn._handlers||[];fn._handlers.push([Roo.id(el),T,h]);E.on(el,T,h);if(T=="mousewheel"&&el.addEventListener){el.addEventListener("DOMMouseScroll",h,false);
-E.on(window,"unload",function(){el.removeEventListener("DOMMouseScroll",h,false);});}if(T=="mousedown"&&el==document){Roo.EventManager.stoppedMouseDownEvent.addListener(h);}return h;};var P=function(el,U,fn){var id=Roo.id(el),S=fn._handlers,hd=fn;if(S){for(var i=0,T=S.length;
-i<T;i++){var h=S[i];if(h[0]==id&&h[1]==U){hd=h[2];S.splice(i,1);break;}}}E.un(el,U,hd);el=Roo.getDom(el);if(U=="mousewheel"&&el.addEventListener){el.removeEventListener("DOMMouseScroll",hd,false);}if(U=="mousedown"&&el==document){Roo.EventManager.stoppedMouseDownEvent.removeListener(hd);
-}};var C=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var A={wrap:function(fn,S,T){return function(e){Roo.EventObject.setEvent(e);fn.call(T?S||window:window,Roo.EventObject,S);};},addListener:function(T,V,fn,S,U){if(typeof V=="object"){var o=V;
-for(var e in o){if(C.test(e)){continue;}if(typeof o[e]=="function"){B(T,e,o,o[e],o.scope);}else{B(T,e,o[e]);}}return;}return B(T,V,U,fn,S);},removeListener:function(S,T,fn){return P(S,T,fn);},onDocumentReady:function(fn,S,T){if(O){N.addListener(fn,S,T);N.fire();
-N.clearListeners();return;}if(!N){L();}N.addListener(fn,S,T);},onWindowResize:function(fn,S,T){if(!I){I=new Roo.util.Event();H=new Roo.util.DelayedTask(function(){I.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){if(Roo.isIE){H.delay(50);
-}else{I.fire(D.getViewWidth(),D.getViewHeight());}});}I.addListener(fn,S,T);},onTextResize:function(fn,S,U){if(!G){G=new Roo.util.Event();var T=new Roo.Element(document.createElement("div"));T.dom.className="x-text-resize";T.dom.innerHTML="X";T.appendTo(document.body);
-F=T.dom.offsetHeight;setInterval(function(){if(T.dom.offsetHeight!=F){G.fire(F,F=T.dom.offsetHeight);}},this.textResizeInterval);}G.addListener(fn,S,U);},removeResizeListener:function(fn,S){if(I){I.removeListener(fn,S);}},fireResize:function(){if(I){I.fire(D.getViewWidth(),D.getViewHeight());
-}},ieDeferSrc:false,textResizeInterval:50};A.on=A.addListener;A.un=A.removeListener;A.stoppedMouseDownEvent=new Roo.util.Event();return A;}();Roo.onReady=Roo.EventManager.onDocumentReady;Roo.onReady(function(){var bd=Roo.get(document.body);if(!bd){return;
-}var A=[Roo.isIE?"roo-ie":Roo.isGecko?"roo-gecko":Roo.isOpera?"roo-opera":Roo.isSafari?"roo-safari":""];if(Roo.isMac){A.push("roo-mac");}if(Roo.isLinux){A.push("roo-linux");}if(Roo.isBorderBox){A.push("roo-border-box");}if(Roo.isStrict){var p=bd.dom.parentNode;
-if(p){p.className+=" roo-strict";}}bd.addClass(A.join(" "));});Roo.EventObject=function(){var E=Roo.lib.Event;var B={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var A=Roo.isIE?{1:0,4:1,2:2}:(Roo.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});
-Roo.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);}};Roo.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;
-}this.browserEvent=e;if(e){this.button=e.button?A[e.button]:(e.which?e.which-1:-1);if(e.type=="click"&&this.button==-1){this.button=0;}this.type=e.type;this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey||e.metaKey;this.altKey=e.altKey;this.keyCode=e.keyCode;
-this.charCode=(e.type=="keyup"||e.type=="keydown")?0:e.charCode;this.target=E.getTarget(e);this.xy=E.getXY(e);}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0];}return this;
-},stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Roo.EventManager.stoppedMouseDownEvent.fire(this);}E.stopEvent(this.browserEvent);}},preventDefault:function(){if(this.browserEvent){E.preventDefault(this.browserEvent);}},isNavKeyPress:function(){var k=this.keyCode;
-k=Roo.isSafari?(B[k]||k):k;return (k>=33&&k<=40)||k==this.RETURN||k==this.TAB||k==this.ESC;},isSpecialKey:function(){var k=this.keyCode;return (this.type=="keypress"&&this.ctrlKey)||k==9||k==13||k==40||k==27||(k==16)||(k==17)||(k>=18&&k<=20)||(k>=33&&k<=35)||(k>=36&&k<=39)||(k>=44&&k<=45);
-},stopPropagation:function(){if(this.browserEvent){if(this.type=="mousedown"){Roo.EventManager.stoppedMouseDownEvent.fire(this);}E.stopPropagation(this.browserEvent);}},getCharCode:function(){return this.charCode||this.keyCode;},getKey:function(){var k=this.keyCode||this.charCode;
-return Roo.isSafari?(B[k]||k):k;},getPageX:function(){return this.xy[0];},getPageY:function(){return this.xy[1];},getTime:function(){if(this.browserEvent){return E.getTime(this.browserEvent);}return null;},getXY:function(){return this.xy;},getTarget:function(F,C,D){return F?Roo.fly(this.target).findParent(F,C,D):this.target;
-},getRelatedTarget:function(){if(this.browserEvent){return E.getRelatedTarget(this.browserEvent);}return null;},getWheelDelta:function(){var e=this.browserEvent;var C=0;if(e.wheelDelta){C=e.wheelDelta/120;}else if(e.detail){C=-e.detail/3;}return C;},hasModifier:function(){return !!((this.ctrlKey||this.altKey)||this.shiftKey);
-},within:function(el,C){var t=this[C?"getRelatedTarget":"getTarget"]();return t&&Roo.fly(el).contains(t);},getPoint:function(){return new Roo.lib.Point(this.xy[0],this.xy[1]);}};return new Roo.EventObjectImpl();}();
-(function(){var D=Roo.lib.Dom;var E=Roo.lib.Event;var A=Roo.lib.Anim;var H={};var G=/(-[a-z])/gi;var F=function(m,a){return a.charAt(1).toUpperCase()};var B=document.defaultView;Roo.Element=function(K,L){var J=typeof K=="string"?document.getElementById(K):K;if(!J){return null}var id=J.id;if(L!==true&&id&&Roo.Element.cache[id]){return Roo.Element.cache[id]}this.dom=J;this.id=id||Roo.id(J)};var El=Roo.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(J){this.visibilityMode=J;return this},enableDisplayMode:function(J){this.setVisibilityMode(El.DISPLAY);if(typeof J!="undefined")this.originalDisplay=J;return this},findParent:function(N,L,M){var p=this.dom,b=document.body,J=0,dq=Roo.DomQuery,K;L=L||50;if(typeof L!="number"){K=Roo.getDom(L);L=10}while(p&&p.nodeType==1&&J<L&&p!=b&&p!=K){if(dq.is(p,N)){return M?Roo.get(p):p}J++;p=p.parentNode}return null},findParentNode:function(L,J,K){var p=Roo.fly(this.dom.parentNode,"_internal");return p?p.findParent(L,J,K):null},up:function(K,J){return this.findParentNode(K,J,true)},is:function(J){return Roo.DomQuery.is(this.dom,J)},animate:function(J,M,N,K,L){this.anim(J,{duration:M,callback:N,easing:K},L);return this},anim:function(L,J,M,N,O,cb){M=M||"run";J=J||{};var K=Roo.lib.Anim[M](this.dom,L,(J.duration||N)||0.35,(J.easing||O)||"easeOut",function(){Roo.callback(cb,this);Roo.callback(J.callback,J.scope||this,[this,J])},this);J.anim=K;return K},preanim:function(a,i){return !a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]})},clean:function(J){if(this.isCleaned&&J!==true){return this}var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n)}else{n.nodeIndex=++ni}n=nx}this.isCleaned=true;return this},calcOffsetsTo:function(el){el=Roo.get(el);var d=el.dom;var J=false;if(el.getStyle("position")=="static"){el.position("relative");J=true}var x=0,y=0;var op=this.dom;while(op&&op!=d&&op.tagName!="HTML"){x+=op.offsetLeft;y+=op.offsetTop;op=op.offsetParent}if(J){el.position("static")}return [x,y]},scrollIntoView:function(K,J){var c=Roo.getDom(K)||document.body;var el=this.dom;var o=this.calcOffsetsTo(c),l=o[0],t=o[1],b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(t<ct){c.scrollTop=t}else if(b>cb){c.scrollTop=b-ch}if(J!==false){if(l<cl){c.scrollLeft=l}else if(r>cr){c.scrollLeft=r-c.clientWidth}}return this},scrollChildIntoView:function(J,K){Roo.fly(J,"_scrollChildIntoView").scrollIntoView(this,K)},autoHeight:function(K,L,N,J){var M=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var O=parseInt(this.dom.scrollHeight,10);if(!K){this.setHeight(O);this.unclip();if(typeof N=="function"){N()}}else{this.setHeight(M);this.setHeight(O,K,L,function(){this.unclip();if(typeof N=="function")N()}.createDelegate(this),J)}}.createDelegate(this),0);return this},contains:function(el){if(!el){return false}return D.isAncestor(this.dom,el.dom?el.dom:el)},isVisible:function(K){var J=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(K!==true||!J){return J}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Roo.fly(p,"_isVisible").isVisible()){return false}p=p.parentNode}return true},select:function(K,J){return El.select(K,J,this.dom)},query:function(K,J){return Roo.DomQuery.select(K,this.dom)},child:function(J,K){var n=Roo.DomQuery.selectNode(J,this.dom);return K?n:Roo.get(n)},down:function(J,K){var n=Roo.DomQuery.selectNode(" > "+J,this.dom);return K?n:Roo.get(n)},initDD:function(J,K,L){var dd=new Roo.dd.DD(Roo.id(this.dom),J,K);return Roo.apply(dd,L)},initDDProxy:function(J,K,L){var dd=new Roo.dd.DDProxy(Roo.id(this.dom),J,K);return Roo.apply(dd,L)},initDDTarget:function(J,K,L){var dd=new Roo.dd.DDTarget(Roo.id(this.dom),J,K);return Roo.apply(dd,L)},setVisible:function(M,K){if(!K||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(M)}else{this.fixDisplay();this.dom.style.visibility=M?"visible":"hidden"}}else{var J=this.dom;var L=this.visibilityMode;if(M){this.setOpacity(0.01);this.setVisible(true)}this.anim({opacity:{to:(M?1:0)}},this.preanim(arguments,1),null,0.35,"easeIn",function(){if(!M){if(L==El.DISPLAY){J.style.display="none"}else{J.style.visibility="hidden"}Roo.get(J).setOpacity(1)}})}return this},isDisplayed:function(){return this.getStyle("display")!="none"},toggle:function(J){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this},setDisplayed:function(J){if(typeof J=="boolean"){J=J?this.originalDisplay:"none"}this.setStyle("display",J);return this},focus:function(){try{this.dom.focus()}catch(e){}return this},blur:function(){try{this.dom.blur()}catch(e){}return this},addClass:function(K){if(K instanceof Array){for(var i=0,J=K.length;i<J;i++){this.addClass(K[i])}}else{if(K&&!this.hasClass(K)){this.dom.className=this.dom.className+" "+K}}return this},radioClass:function(K){var J=this.dom.parentNode.childNodes;for(var i=0;i<J.length;i++){var s=J[i];if(s.nodeType==1){Roo.get(s).removeClass(K)}}this.addClass(K);return this},removeClass:function(K){if(!K||!this.dom.className){return this}if(K instanceof Array){for(var i=0,J=K.length;i<J;i++){this.removeClass(K[i])}}else{if(this.hasClass(K)){var re=this.classReCache[K];if(!re){re=new RegExp("(?:^|\\s+)"+K+"(?:\\s+|$)","g");this.classReCache[K]=re}this.dom.className=this.dom.className.replace(re," ")}}return this},classReCache:{},toggleClass:function(J){if(this.hasClass(J)){this.removeClass(J)}else{this.addClass(J)}return this},hasClass:function(J){return J&&(" "+this.dom.className+" ").indexOf(" "+J+" ")!=-1},replaceClass:function(K,J){this.removeClass(K);this.addClass(J);return this},getStyles:function(){var a=arguments,J=a.length,r={};for(var i=0;i<J;i++){r[a[i]]=this.getStyle(a[i])}return r},getStyle:function(){return B&&B.getComputedStyle?function(J){var el=this.dom,v,cs,K;if(J=="float"){J="cssFloat"}if(el.style&&(v=el.style[J])){return v}if(cs=B.getComputedStyle(el,"")){if(!(K=H[J])){K=H[J]=J.replace(G,F)}return cs[K]}return null}:function(J){var el=this.dom,v,cs,K;if(J=="opacity"){if(typeof el.style.filter=="string"){var m=el.style.filter.match(/alpha\(opacity=(.*)\)/i);if(m){var fv=parseFloat(m[1]);if(!isNaN(fv)){return fv?fv/100:0}}}return 1}else if(J=="float"){J="styleFloat"}if(!(K=H[J])){K=H[J]=J.replace(G,F)}if(v=el.style[K]){return v}if(cs=el.currentStyle){return cs[K]}return null}}(),setStyle:function(J,M){if(typeof J=="string"){var K;if(!(K=H[J])){K=H[J]=J.replace(G,F)}if(K=="opacity"){this.setOpacity(M)}else{this.dom.style[K]=M}}else{for(var L in J){if(typeof J[L]!="function"){this.setStyle(L,J[L])}}}return this},applyStyles:function(J){Roo.DomHelper.applyStyles(this.dom,J);return this},getX:function(){return D.getX(this.dom)},getY:function(){return D.getY(this.dom)},getXY:function(){return D.getXY(this.dom)},setX:function(x,J){if(!J||!A){D.setX(this.dom,x)}else{this.setXY([x,this.getY()],this.preanim(arguments,1))}return this},setY:function(y,J){if(!J||!A){D.setY(this.dom,y)}else{this.setXY([this.getX(),y],this.preanim(arguments,1))}return this},setLeft:function(J){this.setStyle("left",this.addUnits(J));return this},setTop:function(J){this.setStyle("top",this.addUnits(J));return this},setRight:function(J){this.setStyle("right",this.addUnits(J));return this},setBottom:function(J){this.setStyle("bottom",this.addUnits(J));return this},setXY:function(J,K){if(!K||!A){D.setXY(this.dom,J)}else{this.anim({points:{to:J}},this.preanim(arguments,1),"motion")}return this},setLocation:function(x,y,J){this.setXY([x,y],this.preanim(arguments,2));return this},moveTo:function(x,y,J){this.setXY([x,y],this.preanim(arguments,2));return this},getRegion:function(){return D.getRegion(this.dom)},getHeight:function(J){var h=this.dom.offsetHeight||0;return J!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb")},getWidth:function(J){var w=this.dom.offsetWidth||0;return J!==true?w:w-this.getBorderWidth("lr")-this.getPadding("lr")},getComputedHeight:function(){var h=Math.max(this.dom.offsetHeight,this.dom.clientHeight);if(!h){h=parseInt(this.getStyle("height"),10)||0;if(!this.isBorderBox()){h+=this.getFrameWidth("tb")}}return h},getComputedWidth:function(){var w=Math.max(this.dom.offsetWidth,this.dom.clientWidth);if(!w){w=parseInt(this.getStyle("width"),10)||0;if(!this.isBorderBox()){w+=this.getFrameWidth("lr")}}return w},getSize:function(J){return {width:this.getWidth(J),height:this.getHeight(J)}},getViewSize:function(){var d=this.dom,J=document,aw=0,ah=0;if(d==J||d==J.body){return {width:D.getViewWidth(),height:D.getViewHeight()}}else{return {width:d.clientWidth,height:d.clientHeight}}},getValue:function(J){return J?parseInt(this.dom.value,10):this.dom.value},adjustWidth:function(J){if(typeof J=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){J-=(this.getBorderWidth("lr")+this.getPadding("lr"))}if(J<0){J=0}}return J},adjustHeight:function(J){if(typeof J=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){J-=(this.getBorderWidth("tb")+this.getPadding("tb"))}if(J<0){J=0}}return J},setWidth:function(J,K){J=this.adjustWidth(J);if(!K||!A){this.dom.style.width=this.addUnits(J)}else{this.anim({width:{to:J}},this.preanim(arguments,1))}return this},setHeight:function(J,K){J=this.adjustHeight(J);if(!K||!A){this.dom.style.height=this.addUnits(J)}else{this.anim({height:{to:J}},this.preanim(arguments,1))}return this},setSize:function(J,K,L){if(typeof J=="object"){K=J.height;J=J.width}J=this.adjustWidth(J);K=this.adjustHeight(K);if(!L||!A){this.dom.style.width=this.addUnits(J);this.dom.style.height=this.addUnits(K)}else{this.anim({width:{to:J},height:{to:K}},this.preanim(arguments,2))}return this},setBounds:function(x,y,J,K,L){if(!L||!A){this.setSize(J,K);this.setLocation(x,y)}else{J=this.adjustWidth(J);K=this.adjustHeight(K);this.anim({points:{to:[x,y]},width:{to:J},height:{to:K}},this.preanim(arguments,4),"motion")}return this},setRegion:function(J,K){this.setBounds(J.left,J.top,J.right-J.left,J.bottom-J.top,this.preanim(arguments,1));return this},addListener:function(L,fn,J,K){Roo.EventManager.on(this.dom,L,fn,J||this,K)},removeListener:function(J,fn){Roo.EventManager.removeListener(this.dom,J,fn);return this},removeAllListeners:function(){E.purgeElement(this.dom);return this},relayEvent:function(J,K){this.on(J,function(e){K.fireEvent(J,e)})},setOpacity:function(K,J){if(!J||!A){var s=this.dom.style;if(Roo.isIE){s.zoom=1;s.filter=(s.filter||"").replace(/alpha\([^\)]*\)/gi,"")+(K==1?"":"alpha(opacity="+K*100+")")}else{s.opacity=K}}else{this.anim({opacity:{to:K}},this.preanim(arguments,1),null,0.35,"easeIn")}return this},getLeft:function(J){if(!J){return this.getX()}else{return parseInt(this.getStyle("left"),10)||0}},getRight:function(J){if(!J){return this.getX()+this.getWidth()}else{return (this.getLeft(true)+this.getWidth())||0}},getTop:function(J){if(!J){return this.getY()}else{return parseInt(this.getStyle("top"),10)||0}},getBottom:function(J){if(!J){return this.getY()+this.getHeight()}else{return (this.getTop(true)+this.getHeight())||0}},position:function(J,K,x,y){if(!J){if(this.getStyle("position")=="static"){this.setStyle("position","relative")}}else{this.setStyle("position",J)}if(K){this.setStyle("z-index",K)}if(x!==undefined&&y!==undefined){this.setXY([x,y])}else if(x!==undefined){this.setX(x)}else if(y!==undefined){this.setY(y)}},clearPositioning:function(J){J=J||"";this.setStyle({"left":J,right:J,top:J,bottom:J,"z-index":"",position:"static"});return this},getPositioning:function(){var l=this.getStyle("left");var t=this.getStyle("top");return {"position":this.getStyle("position"),left:l,right:l?"":this.getStyle("right"),top:t,bottom:t?"":this.getStyle("bottom"),"z-index":this.getStyle("z-index")}},getBorderWidth:function(J){return this.addStyles(J,El.borders)},getPadding:function(J){return this.addStyles(J,El.paddings)},setPositioning:function(pc){this.applyStyles(pc);if(pc.right=="auto"){this.dom.style.right=""}if(pc.bottom=="auto"){this.dom.style.bottom=""}return this},fixDisplay:function(){if(this.getStyle("display")=="none"){this.setStyle("visibility","hidden");this.setStyle("display",this.originalDisplay);if(this.getStyle("display")=="none"){this.setStyle("display","block")}}},setLeftTop:function(K,J){this.dom.style.left=this.addUnits(K);this.dom.style.top=this.addUnits(J);return this},move:function(L,K,J){var xy=this.getXY();L=L.toLowerCase();switch(L){case "l":case "left":this.moveTo(xy[0]-K,xy[1],this.preanim(arguments,2));break;case "r":case "right":this.moveTo(xy[0]+K,xy[1],this.preanim(arguments,2));break;case "t":case "top":case "up":this.moveTo(xy[0],xy[1]-K,this.preanim(arguments,2));break;case "b":case "bottom":case "down":this.moveTo(xy[0],xy[1]+K,this.preanim(arguments,2));break}return this},clip:function(){if(!this.isClipped){this.isClipped=true;this.originalClip={"o":this.getStyle("overflow"),x:this.getStyle("overflow-x"),y:this.getStyle("overflow-y")};this.setStyle("overflow","hidden");this.setStyle("overflow-x","hidden");this.setStyle("overflow-y","hidden")}return this},unclip:function(){if(this.isClipped){this.isClipped=false;var o=this.originalClip;if(o.o){this.setStyle("overflow",o.o)}if(o.x){this.setStyle("overflow-x",o.x)}if(o.y){this.setStyle("overflow-y",o.y)}}return this},getAnchorXY:function(K,J,s){var w,h,vp=false;if(!s){var d=this.dom;if(d==document.body||d==document){vp=true;w=D.getViewWidth();h=D.getViewHeight()}else{w=this.getWidth();h=this.getHeight()}}else{w=s.width;h=s.height}var x=0,y=0,r=Math.round;switch((K||"tl").toLowerCase()){case "c":x=r(w*0.5);y=r(h*0.5);break;case "t":x=r(w*0.5);y=0;break;case "l":x=0;y=r(h*0.5);break;case "r":x=w;y=r(h*0.5);break;case "b":x=r(w*0.5);y=h;break;case "tl":x=0;y=0;break;case "bl":x=0;y=h;break;case "br":x=w;y=h;break;case "tr":x=w;y=0;break}if(J===true){return [x,y]}if(vp){var sc=this.getScroll();return [x+sc.left,y+sc.top]}var o=this.getXY();return [x+o[0],y+o[1]]},getAlignToXY:function(el,p,o){el=Roo.get(el);var d=this.dom;if(!el.dom){throw "Element.alignTo with an element that doesn't exist"}var c=false;var p1="",p2="";o=o||[0,0];if(!p){p="tl-bl"}else if(p=="?"){p="tl-bl?"}else if(p.indexOf("-")==-1){p="tl-"+p}p=p.toLowerCase();var m=p.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!m){throw "Element.alignTo with an invalid alignment "+p}p1=m[1];p2=m[2];c=!!m[3];var a1=this.getAnchorXY(p1,true);var a2=el.getAnchorXY(p2,false);var x=a2[0]-a1[0]+o[0];var y=a2[1]-a1[1]+o[1];if(c){var w=this.getWidth(),h=this.getHeight(),r=el.getRegion();var dw=D.getViewWidth()-5,dh=D.getViewHeight()-5;var L=p1.charAt(0),K=p1.charAt(p1.length-1);var N=p2.charAt(0),M=p2.charAt(p2.length-1);var P=((L=="t"&&N=="b")||(L=="b"&&N=="t"));var O=((K=="r"&&M=="l")||(K=="l"&&M=="r"));var J=document;var Q=(J.documentElement.scrollLeft||J.body.scrollLeft||0)+5;var R=(J.documentElement.scrollTop||J.body.scrollTop||0)+5;if((x+w)>dw+Q){x=O?r.left-w:dw+Q-w}if(x<Q){x=O?r.right:Q}if((y+h)>dh+R){y=P?r.top-h:dh+R-h}if(y<R){y=P?r.bottom:R}}return [x,y]},getConstrainToXY:function(){var os={top:0,left:0,bottom:0,right:0};return function(el,K,M,N){el=Roo.get(el);M=M?Roo.applyIf(M,os):os;var vw,vh,vx=0,vy=0;if(el.dom==document.body||el.dom==document){vw=Roo.lib.Dom.getViewWidth();vh=Roo.lib.Dom.getViewHeight()}else{vw=el.dom.clientWidth;vh=el.dom.clientHeight;if(!K){var J=el.getXY();vx=J[0];vy=J[1]}}var s=el.getScroll();vx+=M.left+s.left;vy+=M.top+s.top;vw-=M.right;vh-=M.bottom;var vr=vx+vw;var vb=vy+vh;var xy=N||(!K?this.getXY():[this.getLeft(true),this.getTop(true)]);var x=xy[0],y=xy[1];var w=this.dom.offsetWidth,h=this.dom.offsetHeight;var L=false;if((x+w)>vr){x=vr-w;L=true}if((y+h)>vb){y=vb-h;L=true}if(x<vx){x=vx;L=true}if(y<vy){y=vy;L=true}return L?[x,y]:false}}(),adjustForConstraints:function(xy,J,K){return this.getConstrainToXY(J||document,false,K,xy)||xy},alignTo:function(K,M,L,J){var xy=this.getAlignToXY(K,M,L);this.setXY(xy,this.preanim(arguments,3));return this},anchorTo:function(el,N,L,K,O,M){var J=function(){this.alignTo(el,N,L,K);Roo.callback(M,this)};Roo.EventManager.onWindowResize(J,this);var tm=typeof O;if(tm!="undefined"){Roo.EventManager.on(window,"scroll",J,this,{buffer:tm=="number"?O:50})}J.call(this);return this},clearOpacity:function(){if(window.ActiveXObject){if(typeof this.dom.style.filter=="string"&&(/alpha/i).test(this.dom.style.filter)){this.dom.style.filter=""}}else{this.dom.style.opacity="";this.dom.style["-moz-opacity"]="";this.dom.style["-khtml-opacity"]=""}return this},hide:function(J){this.setVisible(false,this.preanim(arguments,0));return this},show:function(J){this.setVisible(true,this.preanim(arguments,0));return this},addUnits:function(J){return Roo.Element.addUnits(J,this.defaultUnit)},beginMeasure:function(){var el=this.dom;if(el.offsetWidth||el.offsetHeight){return this}var J=[];var p=this.dom,b=document.body;while((!el.offsetWidth&&!el.offsetHeight)&&p&&p.tagName&&p!=b){var pe=Roo.get(p);if(pe.getStyle("display")=="none"){J.push({el:p,visibility:pe.getStyle("visibility")});p.style.visibility="hidden";p.style.display="block"}p=p.parentNode}this._measureChanged=J;return this},endMeasure:function(){var K=this._measureChanged;if(K){for(var i=0,J=K.length;i<J;i++){var r=K[i];r.el.style.visibility=r.visibility;r.el.style.display="none"}this._measureChanged=null}return this},update:function(K,M,L){if(typeof K=="undefined"){K=""}if(M!==true){this.dom.innerHTML=K;if(typeof L=="function"){L()}return this}var id=Roo.id();var J=this.dom;K+="<span id=\""+id+"\"></span>";E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var P=/\ssrc=([\'\"])(.*?)\1/i;var Q=/\stype=([\'\"])(.*?)\1/i;var O;while(O=re.exec(K)){var N=O[1];var R=N?N.match(P):false;if(R&&R[2]){var s=document.createElement("script");s.src=R[2];var S=N.match(Q);if(S&&S[2]){s.type=S[2]}hd.appendChild(s)}else if(O[2]&&O[2].length>0){if(window.execScript){window.execScript(O[2])}else{window.eval(O[2])}}}var el=document.getElementById(id);if(el){el.parentNode.removeChild(el)}if(typeof L=="function"){L()}});J.innerHTML=K.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this},load:function(){var um=this.getUpdateManager();um.update.apply(um,arguments);return this},getUpdateManager:function(){if(!this.updateManager){this.updateManager=new Roo.UpdateManager(this)}return this.updateManager},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this},getCenterXY:function(){return this.getAlignToXY(document,"c-c")},center:function(J){this.alignTo(J||document,"c-c");return this},isBorderBox:function(){return I[this.dom.tagName.toLowerCase()]||Roo.isBorderBox},getBox:function(M,L){var xy;if(!L){xy=this.getXY()}else{var K=parseInt(this.getStyle("left"),10)||0;var J=parseInt(this.getStyle("top"),10)||0;xy=[K,J]}var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!M){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h}}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)}}bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx},getFrameWidth:function(J,K){return K&&Roo.isBorderBox?0:(this.getPadding(J)+this.getBorderWidth(J))},setBox:function(J,K,L){var w=J.width,h=J.height;if((K&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));h-=(this.getBorderWidth("tb")+this.getPadding("tb"))}this.setBounds(J.x,J.y,w,h,this.preanim(arguments,2));return this},repaint:function(){var J=this.dom;this.addClass("x-repaint");setTimeout(function(){Roo.get(J).removeClass("x-repaint")},1);return this},getMargins:function(J){if(!J){return {top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0}}else{return this.addStyles(J,El.margins)}},addStyles:function(L,M){var K=0,v,w;for(var i=0,J=L.length;i<J;i++){v=this.getStyle(M[L.charAt(i)]);if(v){w=parseInt(v,10);if(w){K+=w}}}return K},createProxy:function(K,M,L){if(M){M=Roo.getDom(M)}else{M=document.body}K=typeof K=="object"?K:{tag:"div",cls:K};var J=Roo.DomHelper.append(M,K,true);if(L){J.setBox(this.getBox())}return J},mask:function(J,K){if(this.getStyle("position")=="static"){this.setStyle("position","relative")}if(!this._mask){this._mask=Roo.DomHelper.append(this.dom,{cls:"roo-el-mask"},true)}this.addClass("x-masked");this._mask.setDisplayed(true);if(typeof J=="string"){if(!this._maskMsg){this._maskMsg=Roo.DomHelper.append(this.dom,{cls:"roo-el-mask-msg",cn:{tag:"div"}},true)}var mm=this._maskMsg;mm.dom.className=K?"roo-el-mask-msg "+K:"roo-el-mask-msg";mm.dom.firstChild.innerHTML=J;mm.setDisplayed(true);mm.center(this)}if(Roo.isIE&&!(Roo.isIE7&&Roo.isStrict)&&this.getStyle("height")=="auto"){this._mask.setHeight(this.getHeight())}return this._mask},unmask:function(J){if(this._mask){if(J===true){this._mask.remove();delete this._mask;if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg}}else{this._mask.setDisplayed(false);if(this._maskMsg){this._maskMsg.setDisplayed(false)}}}this.removeClass("x-masked")},isMasked:function(){return this._mask&&this._mask.isVisible()},createShim:function(){var el=document.createElement("iframe");el.frameBorder="no";el.className="roo-shim";if(Roo.isIE&&Roo.isSecure){el.src=Roo.SSL_SECURE_URL}var J=Roo.get(this.dom.parentNode.insertBefore(el,this.dom));J.autoBoxAdjust=false;return J},remove:function(){if(this.dom.parentNode){this.dom.parentNode.removeChild(this.dom)}delete El.cache[this.dom.id]},addClassOnOver:function(K,L){this.on("mouseover",function(){Roo.fly(this,"_internal").addClass(K)},this.dom);var J=function(e){if(L!==true||!e.within(this,true)){Roo.fly(this,"_internal").removeClass(K)}};this.on("mouseout",J,this.dom);return this},addClassOnFocus:function(J){this.on("focus",function(){Roo.fly(this,"_internal").addClass(J)},this.dom);this.on("blur",function(){Roo.fly(this,"_internal").removeClass(J)},this.dom);return this},addClassOnClick:function(K){var J=this.dom;this.on("mousedown",function(){Roo.fly(J,"_internal").addClass(K);var d=Roo.get(document);var fn=function(){Roo.fly(J,"_internal").removeClass(K);d.removeListener("mouseup",fn)};d.on("mouseup",fn)});return this},swallowEvent:function(K,L){var fn=function(e){e.stopPropagation();if(L){e.preventDefault()}};if(K instanceof Array){for(var i=0,J=K.length;i<J;i++){this.on(K[i],fn)}return this}this.on(K,fn);return this},fitToParentDelegate:Roo.emptyFn,fitToParent:function(K,J){Roo.EventManager.removeResizeListener(this.fitToParentDelegate);this.fitToParentDelegate=Roo.emptyFn;if(K===true&&!this.dom.parentNode){return}var p=Roo.get(J||this.dom.parentNode);this.setSize(p.getComputedWidth()-p.getFrameWidth("lr"),p.getComputedHeight()-p.getFrameWidth("tb"));if(K===true){this.fitToParentDelegate=this.fitToParent.createDelegate(this,[true,J]);Roo.EventManager.onWindowResize(this.fitToParentDelegate)}return this},getNextSibling:function(){var n=this.dom.nextSibling;while(n&&n.nodeType!=1){n=n.nextSibling}return n},getPrevSibling:function(){var n=this.dom.previousSibling;while(n&&n.nodeType!=1){n=n.previousSibling}return n},appendChild:function(el){el=Roo.get(el);el.appendTo(this);return this},createChild:function(J,L,K){J=J||{tag:"div"};if(L){return Roo.DomHelper.insertBefore(L,J,K!==true)}return Roo.DomHelper[!this.dom.firstChild?"overwrite":"append"](this.dom,J,K!==true)},appendTo:function(el){el=Roo.getDom(el);el.appendChild(this.dom);return this},insertBefore:function(el){el=Roo.getDom(el);el.parentNode.insertBefore(this.dom,el);return this},insertAfter:function(el){el=Roo.getDom(el);el.parentNode.insertBefore(this.dom,el.nextSibling);return this},insertFirst:function(el,J){el=el||{};if(typeof el=="object"&&!el.nodeType){return this.createChild(el,this.dom.firstChild,J)}else{el=Roo.getDom(el);this.dom.insertBefore(el,this.dom.firstChild);return !J?Roo.get(el):el}},insertSibling:function(el,J,L){J=J?J.toLowerCase():"before";el=el||{};var rt,K=J=="before"?this.dom:this.dom.nextSibling;if(typeof el=="object"&&!el.nodeType){if(J=="after"&&!this.dom.nextSibling){rt=Roo.DomHelper.append(this.dom.parentNode,el,!L)}else{rt=Roo.DomHelper[J=="after"?"insertAfter":"insertBefore"](this.dom,el,!L)}}else{rt=this.dom.parentNode.insertBefore(Roo.getDom(el),J=="before"?this.dom:this.dom.nextSibling);if(!L){rt=Roo.get(rt)}}return rt},wrap:function(K,L){if(!K){K={tag:"div"}}var J=Roo.DomHelper.insertBefore(this.dom,K,!L);J.dom?J.dom.appendChild(this.dom):J.appendChild(this.dom);return J},replace:function(el){el=Roo.get(el);this.insertBefore(el);el.remove();return this},insertHtml:function(K,J,L){var el=Roo.DomHelper.insertHtml(K,this.dom,J);return L?Roo.get(el):el},set:function(o,K){var el=this.dom;K=typeof K=="undefined"?(el.setAttribute?true:false):K;for(var J in o){if(J=="style"||typeof o[J]=="function")continue;if(J=="cls"){el.className=o["cls"]}else{if(K)el.setAttribute(J,o[J]);elseel[J]=o[J]}}if(o.style){Roo.DomHelper.applyStyles(el,o.style)}return this},addKeyListener:function(J,fn,K){var L;if(typeof J!="object"||J instanceof Array){L={key:J,fn:fn,scope:K}}else{L={key:J.key,shift:J.shift,ctrl:J.ctrl,alt:J.alt,fn:fn,scope:K}}return new Roo.KeyMap(this,L)},addKeyMap:function(J){return new Roo.KeyMap(this,J)},isScrollable:function(){var J=this.dom;return J.scrollHeight>J.clientHeight||J.scrollWidth>J.clientWidth},scrollTo:function(K,L,M){var J=K.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!M||!A){this.dom[J]=L}else{var to=J=="scrollLeft"?[L,this.dom.scrollTop]:[this.dom.scrollLeft,L];this.anim({scroll:{"to":to}},this.preanim(arguments,2),"scroll")}return this},scroll:function(M,K,J){if(!this.isScrollable()){return}var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;M=M.toLowerCase();var L=false;var a=this.preanim(arguments,2);switch(M){case "l":case "left":if(w-l>cw){var v=Math.min(l+K,w-cw);this.scrollTo("left",v,a);L=true}break;case "r":case "right":if(l>0){var v=Math.max(l-K,0);this.scrollTo("left",v,a);L=true}break;case "t":case "top":case "up":if(t>0){var v=Math.max(t-K,0);this.scrollTo("top",v,a);L=true}break;case "b":case "bottom":case "down":if(h-t>ch){var v=Math.min(t+K,h-ch);this.scrollTo("top",v,a);L=true}break}return L},translatePoints:function(x,y){if(typeof x=="object"||x instanceof Array){y=x[1];x=x[0]}var p=this.getStyle("position");var o=this.getXY();var l=parseInt(this.getStyle("left"),10);var t=parseInt(this.getStyle("top"),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft}if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop}return {left:(x-o[0]+l),top:(y-o[1]+t)}},getScroll:function(){var d=this.dom,J=document;if(d==J||d==J.body){var l=window.pageXOffset||J.documentElement.scrollLeft||J.body.scrollLeft||0;var t=window.pageYOffset||J.documentElement.scrollTop||J.body.scrollTop||0;return {left:l,top:t}}else{return {left:d.scrollLeft,top:d.scrollTop}}},getColor:function(K,N,M){var v=this.getStyle(K);if(!v||v=="transparent"||v=="inherit"){return N}var L=typeof M=="undefined"?"#":M;if(v.substr(0,4)=="rgb("){var J=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(J[i]).toString(16);if(h<16){h="0"+h}L+=h}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;i<4;i++){var c=v.charAt(i);L+=c+c}}else if(v.length==7){L+=v.substr(1)}}}return (L.length>5?L.toLowerCase():N)},boxWrap:function(J){J=J||"x-box";var el=Roo.get(this.insertHtml("beforeBegin",String.format("<div class=\"{0}\">"+El.boxMarkup+"</div>",J)));el.child("."+J+"-mc").dom.appendChild(this.dom);return el},getAttributeNS:Roo.isIE?function(ns,J){var d=this.dom;var K=typeof d[ns+":"+J];if(K!="undefined"&&K!="unknown"){return d[ns+":"+J]}return d[J]}:function(ns,J){var d=this.dom;return d.getAttributeNS(ns,J)||d.getAttribute(ns+":"+J)||d.getAttribute(J)||d[J]}};var ep=El.prototype;ep.on=ep.addListener;ep.mon=ep.addListener;ep.un=ep.removeListener;ep.autoBoxAdjust=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,J){if(v===""||v=="auto"){return v}if(v===undefined){return ""}if(typeof v=="number"||!El.unitPattern.test(v)){return v+(J||"px")}return v};El.boxMarkup="<div class=\"{0}-tl\"><div class=\"{0}-tr\"><div class=\"{0}-tc\"></div></div></div><div class=\"{0}-ml\"><div class=\"{0}-mr\"><div class=\"{0}-mc\"></div></div></div><div class=\"{0}-bl\"><div class=\"{0}-br\"><div class=\"{0}-bc\"></div></div></div>";El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};El.cache={};var C;El.get=function(el){var ex,J,id;if(!el){return null}if(typeof el=="string"){if(!(J=document.getElementById(el))){return null}if(ex=El.cache[el]){ex.dom=J}else{ex=El.cache[el]=new El(J)}return ex}else if(el.tagName){if(!(id=el.id)){id=Roo.id(el)}if(ex=El.cache[id]){ex.dom=el}else{ex=El.cache[id]=new El(el)}return ex}else if(el instanceof El){if(el!=C){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el}return el}else if(el.isComposite){return el}else if(el instanceof Array){return El.select(el)}else if(el==document){if(!C){var f=function(){};f.prototype=El.prototype;C=new f();C.dom=document}return C}return null};El.uncache=function(el){for(var i=0,a=arguments,J=a.length;i<J;i++){if(a[i]){delete El.cache[a[i].id||a[i]]}}};El.garbageCollect=function(){if(!Roo.enableGarbageCollector){clearInterval(El.collectorThread);return}for(var J in El.cache){var el=El.cache[J],d=el.dom;if(!d||!d.parentNode||(!d.offsetParent&&!document.getElementById(J))){delete El.cache[J];if(d&&Roo.enableListenerCollection){E.purgeElement(d)}}}};El.collectorThreadId=setInterval(El.garbageCollect,30000);El.Flyweight=function(J){this.dom=J};El.Flyweight.prototype=El.prototype;El._flyweights={};El.fly=function(el,J){J=J||"_global";el=Roo.getDom(el);if(!el){return null}if(!El._flyweights[J]){El._flyweights[J]=new El.Flyweight()}El._flyweights[J].dom=el;return El._flyweights[J]};Roo.get=El.get;Roo.fly=El.fly;var I=Roo.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Roo.isIE||Roo.isGecko){I["button"]=1}Roo.EventManager.on(window,"unload",function(){delete El.cache;delete El._flyweights})})();if(Roo.DomQuery){Roo.Element.selectorFunction=Roo.DomQuery.select}Roo.Element.select=function(D,C,B){var A;if(typeof D=="string"){A=Roo.Element.selectorFunction(D,B)}else if(D.length!==undefined){A=D}else{throw "Invalid selector"}if(C===true){return new Roo.CompositeElement(A)}else{return new Roo.CompositeElementLite(A)}};Roo.select=Roo.Element.select;
-Roo.enableFx=true;Roo.Fx={slideIn:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"t";this.fixDisplay();var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var B=this.fxWrap(r.pos,o,"hidden");var st=this.dom.style;st.visibility="visible";st.position="absolute";var C=function(){el.fxUnwrap(B,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o)};var a,pt={to:[b.x,b.y]},bw={to:b.width},bh={to:b.height};switch(A.toLowerCase()){case "t":B.setSize(b.width,0);st.left=st.bottom="0";a={height:bh};break;case "l":B.setSize(0,b.height);st.right=st.top="0";a={width:bw};break;case "r":B.setSize(0,b.height);B.setX(b.right);st.left=st.top="0";a={width:bw,points:pt};break;case "b":B.setSize(b.width,0);B.setY(b.bottom);st.left=st.top="0";a={height:bh,points:pt};break;case "tl":B.setSize(0,0);st.right=st.bottom="0";a={width:bw,height:bh};break;case "bl":B.setSize(0,0);B.setY(b.y+b.height);st.right=st.top="0";a={width:bw,height:bh,points:pt};break;case "br":B.setSize(0,0);B.setXY([b.right,b.bottom]);st.left=st.top="0";a={width:bw,height:bh,points:pt};break;case "tr":B.setSize(0,0);B.setX(b.x+b.width);st.left=st.bottom="0";a={width:bw,height:bh,points:pt};break}this.dom.style.visibility="visible";B.show();arguments.callee.anim=B.fxanim(a,o,"motion",0.5,"easeOut",C)});return this},slideOut:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"t";var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var B=this.fxWrap(r.pos,o,"visible");var st=this.dom.style;st.visibility="visible";st.position="absolute";B.setSize(b);var D=function(){if(o.useDisplay){el.setDisplayed(false)}else{el.hide()}el.fxUnwrap(B,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o)};var a,C={to:0};switch(A.toLowerCase()){case "t":st.left=st.bottom="0";a={height:C};break;case "l":st.right=st.top="0";a={width:C};break;case "r":st.left=st.top="0";a={width:C,points:{to:[b.right,b.y]}};break;case "b":st.left=st.top="0";a={height:C,points:{to:[b.x,b.bottom]}};break;case "tl":st.right=st.bottom="0";a={width:C,height:C};break;case "bl":st.right=st.top="0";a={width:C,height:C,points:{to:[b.x,b.bottom]}};break;case "br":st.left=st.top="0";a={width:C,height:C,points:{to:[b.x+b.width,b.bottom]}};break;case "tr":st.left=st.bottom="0";a={width:C,height:C,points:{to:[b.right,b.y]}};break}arguments.callee.anim=B.fxanim(a,o,"motion",0.5,"easeOut",D)});return this},puff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.show();var r=this.getFxRestore();var st=this.dom.style;var A=function(){if(o.useDisplay){el.setDisplayed(false)}else{el.hide()}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;st.fontSize="";el.afterFx(o)};var B=this.getWidth();var C=this.getHeight();arguments.callee.anim=this.fxanim({width:{to:this.adjustWidth(B*2)},height:{to:this.adjustHeight(C*2)},points:{by:[-(B*0.5),-(C*0.5)]},opacity:{to:0},fontSize:{to:200,unit:"%"}},o,"motion",0.5,"easeOut",A)});return this},switchOff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.clip();var r=this.getFxRestore();var st=this.dom.style;var A=function(){if(o.useDisplay){el.setDisplayed(false)}else{el.hide()}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o)};this.fxanim({opacity:{to:0.3}},null,null,0.1,null,function(){this.clearOpacity();(function(){this.fxanim({height:{to:1},points:{by:[0,this.getHeight()*0.5]}},o,"motion",0.3,"easeIn",A)}).defer(100,this)})});return this},highlight:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"ffff9c";attr=o.attr||"backgroundColor";this.clearOpacity();this.show();var C=this.getColor(attr);var D=this.dom.style[attr];endColor=(o.endColor||C)||"ffffff";var B=function(){el.dom.style[attr]=D;el.afterFx(o)};var a={};a[attr]={from:A,to:endColor};arguments.callee.anim=this.fxanim(a,o,"color",1,"easeIn",B)});return this},frame:function(A,B,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"#C3DAF9";if(A.length==6){A="#"+A}B=B||1;duration=o.duration||1;this.show();var b=this.getBox();var C=function(){var D=this.createProxy({style:{visbility:"hidden",position:"absolute","z-index":"35000",border:"0px solid "+A}});var E=Roo.isBorderBox?2:1;D.animate({top:{from:b.y,to:b.y-20},left:{from:b.x,to:b.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:b.height,to:(b.height+(20*E))},width:{from:b.width,to:(b.width+(20*E))}},duration,function(){D.remove()});if(--B>0){C.defer((duration/2)*1000,this)}else{el.afterFx(o)}};C.call(this)});return this},pause:function(A){var el=this.getFxEl();var o={};el.queueFx(o,function(){setTimeout(function(){el.afterFx(o)},A*1000)});return this},fadeIn:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility="visible";var to=o.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:to}},o,null,0.5,"easeOut",function(){if(to==1){this.clearOpacity()}el.afterFx(o)})});return this},fadeOut:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){arguments.callee.anim=this.fxanim({opacity:{to:o.endOpacity||0}},o,null,0.5,"easeOut",function(){if(this.visibilityMode==Roo.Element.DISPLAY||o.useDisplay){this.dom.style.display="none"}else{this.dom.style.visibility="hidden"}this.clearOpacity();el.afterFx(o)})});return this},scale:function(w,h,o){this.shift(Roo.apply({},o,{width:w,height:h}));return this},shift:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){var a={},w=o.width,h=o.height,x=o.x,y=o.y,op=o.opacity;if(w!==undefined){a.width={to:this.adjustWidth(w)}}if(h!==undefined){a.height={to:this.adjustHeight(h)}}if(x!==undefined||y!==undefined){a.points={to:[x!==undefined?x:this.getX(),y!==undefined?y:this.getY()]}}if(op!==undefined){a.opacity={to:op}}if(o.xy!==undefined){a.points={to:o.xy}}arguments.callee.anim=this.fxanim(a,o,"motion",0.35,"easeOut",function(){el.afterFx(o)})});return this},ghost:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"b";var r=this.getFxRestore();var w=this.getWidth(),h=this.getHeight();var st=this.dom.style;var B=function(){if(o.useDisplay){el.setDisplayed(false)}else{el.hide()}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o)};var a={opacity:{to:0},points:{}},pt=a.points;switch(A.toLowerCase()){case "t":pt.by=[0,-h];break;case "l":pt.by=[-w,0];break;case "r":pt.by=[w,0];break;case "b":pt.by=[0,h];break;case "tl":pt.by=[-w,-h];break;case "bl":pt.by=[-w,h];break;case "br":pt.by=[w,h];break;case "tr":pt.by=[w,-h];break}arguments.callee.anim=this.fxanim(a,o,"motion",0.5,"easeOut",B)});return this},syncFx:function(){this.fxDefaults=Roo.apply(this.fxDefaults||{},{block:false,concurrent:true,stopFx:false});return this},sequenceFx:function(){this.fxDefaults=Roo.apply(this.fxDefaults||{},{block:false,concurrent:false,stopFx:false});return this},nextFx:function(){var ef=this.fxQueue[0];if(ef){ef.call(this)}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0]},stopFx:function(){if(this.hasActiveFx()){var A=this.fxQueue[0];if(A&&A.anim&&A.anim.isAnimated()){this.fxQueue=[A];A.anim.stop(true)}}return this},beforeFx:function(o){if(this.hasActiveFx()&&!o.concurrent){if(o.stopFx){this.stopFx();return true}return false}return true},hasFxBlock:function(){var q=this.fxQueue;return q&&q[0]&&q[0].block},queueFx:function(o,fn){if(!this.fxQueue){this.fxQueue=[]}if(!this.hasFxBlock()){Roo.applyIf(o,this.fxDefaults);if(!o.concurrent){var A=this.beforeFx(o);fn.block=o.block;this.fxQueue.push(fn);if(A){this.nextFx()}}else{fn.call(this)}}return this},fxWrap:function(B,o,C){var D;if(!o.wrap||!(D=Roo.get(o.wrap))){var E;if(o.fixPosition){E=this.getXY()}var A=document.createElement("div");A.style.visibility=C;D=Roo.get(this.dom.parentNode.insertBefore(A,this.dom));D.setPositioning(B);if(D.getStyle("position")=="static"){D.position("relative")}this.clearPositioning("auto");D.clip();D.dom.appendChild(this.dom);if(E){D.setXY(E)}}return D},fxUnwrap:function(B,A,o){this.clearPositioning();this.setPositioning(A);if(!o.wrap){B.dom.parentNode.insertBefore(this.dom,B.dom);B.remove()}},getFxRestore:function(){var st=this.dom.style;return {pos:this.getPositioning(),width:st.width,height:st.height}},afterFx:function(o){if(o.afterStyle){this.applyStyles(o.afterStyle)}if(o.afterCls){this.addClass(o.afterCls)}if(o.remove===true){this.remove()}Roo.callback(o.callback,o.scope,[this]);if(!o.concurrent){this.fxQueue.shift();this.nextFx()}},getFxEl:function(){return Roo.get(this.dom)},fxanim:function(C,A,D,E,F,cb){D=D||"run";A=A||{};var B=Roo.lib.Anim[D](this.dom,C,(A.duration||E)||0.35,(A.easing||F)||"easeOut",function(){Roo.callback(cb,this)},this);A.anim=B;return B}};Roo.Fx.resize=Roo.Fx.scale;Roo.apply(Roo.Element.prototype,Roo.Fx);
-Roo.CompositeElement=function(A){this.elements=[];this.addElements(A)};Roo.CompositeElement.prototype={isComposite:true,addElements:function(A){if(!A)return this;if(typeof A=="string"){A=Roo.Element.selectorFunction(A)}var C=this.elements;var D=C.length-1;for(var i=0,B=A.length;i<B;i++){C[++D]=Roo.get(A[i])}return this},fill:function(A){this.elements=[];this.add(A);return this},filter:function(B){var A=[];this.each(function(el){if(el.is(B)){A[A.length]=el.dom}});this.fill(A);return this},invoke:function(fn,C){var A=this.elements;for(var i=0,B=A.length;i<B;i++){Roo.Element.prototype[fn].apply(A[i],C)}return this},add:function(A){if(typeof A=="string"){this.addElements(Roo.Element.selectorFunction(A))}else if(A.length!==undefined){this.addElements(A)}else{this.addElements([A])}return this},each:function(fn,C){var A=this.elements;for(var i=0,B=A.length;i<B;i++){if(fn.call(C||A[i],A[i],this,i)===false){break}}return this},item:function(A){return this.elements[A]||null},first:function(){return this.item(0)},last:function(){return this.item(this.elements.length-1)},getCount:function(){return this.elements.length},contains:function(el){return this.indexOf(el)!==-1},indexOf:function(el){return this.elements.indexOf(Roo.get(el))},removeElement:function(el,C){if(el instanceof Array){for(var i=0,A=el.length;i<A;i++){this.removeElement(el[i])}return this}var B=typeof el=="number"?el:this.indexOf(el);if(B!==-1){if(C){var d=this.elements[B];if(d.dom){d.remove()}else{d.parentNode.removeChild(d)}}this.elements.splice(B,1)}return this},replaceElement:function(el,C,B){var A=typeof el=="number"?el:this.indexOf(el);if(A!==-1){if(B){this.elements[A].replaceWith(C)}else{this.elements.splice(A,1,Roo.get(C))}}return this},clear:function(){this.elements=[]}};(function(){Roo.CompositeElement.createCall=function(B,C){if(!B[C]){B[C]=function(){return this.invoke(C,arguments)}}};for(var A in Roo.Element.prototype){if(typeof Roo.Element.prototype[A]=="function"){Roo.CompositeElement.createCall(Roo.CompositeElement.prototype,A)}}})();
-Roo.CompositeElementLite=function(A){Roo.CompositeElementLite.superclass.constructor.call(this,A);this.el=new Roo.Element.Flyweight()};Roo.extend(Roo.CompositeElementLite,Roo.CompositeElement,{addElements:function(A){if(A){if(A instanceof Array){this.elements=this.elements.concat(A)}else{var C=this.elements;var D=C.length-1;for(var i=0,B=A.length;i<B;i++){C[++D]=A[i]}}}return this},invoke:function(fn,C){var A=this.elements;var el=this.el;for(var i=0,B=A.length;i<B;i++){el.dom=A[i];Roo.Element.prototype[fn].apply(el,C)}return this},item:function(A){if(!this.elements[A]){return null}this.el.dom=this.elements[A];return this.el},addListener:function(F,E,D,C){var A=this.elements;for(var i=0,B=A.length;i<B;i++){Roo.EventManager.on(A[i],F,E,D||A[i],C)}return this},each:function(fn,C){var A=this.elements;var el=this.el;for(var i=0,B=A.length;i<B;i++){el.dom=A[i];if(fn.call(C||el,el,this,i)===false){break}}return this},indexOf:function(el){return this.elements.indexOf(Roo.getDom(el))},replaceElement:function(el,C,B){var A=typeof el=="number"?el:this.indexOf(el);if(A!==-1){C=Roo.getDom(C);if(B){var d=this.elements[A];d.parentNode.insertBefore(C,d);d.parentNode.removeChild(d)}this.elements.splice(A,1,C)}return this}});Roo.CompositeElementLite.prototype.on=Roo.CompositeElementLite.prototype.addListener;
-Roo.data.Connection=function(A){Roo.apply(this,A);this.addEvents({"beforerequest":true,requestcomplete:true,requestexception:true});Roo.data.Connection.superclass.constructor.call(this);};Roo.extend(Roo.data.Connection,Roo.util.Observable,{timeout:30000,autoAbort:false,disableCaching:true,request:function(o){if(this.fireEvent("beforerequest",this,o)!==false){var p=o.params;
-if(typeof p=="function"){p=p.call(o.scope||window,o);}if(typeof p=="object"){p=Roo.urlEncode(o.params);}if(this.extraParams){var C=Roo.urlEncode(this.extraParams);p=p?(p+"&"+C):C;}var A=o.url||this.url;if(typeof A=="function"){A=A.call(o.scope||window,o);
-}if(o.form){var B=Roo.getDom(o.form);A=A||B.action;var E=B.getAttribute("enctype");if(o.isUpload||(E&&E.toLowerCase()=="multipart/form-data")){return this.doFormUpload(o,p,A);}var f=Roo.lib.Ajax.serializeForm(B);p=p?(p+"&"+f):f;}var hs=o.headers;if(this.defaultHeaders){hs=Roo.apply(hs||{},this.defaultHeaders);
-if(!o.headers){o.headers=hs;}}var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:o},timeout:this.timeout};var D=o.method||this.method||(p?"POST":"GET");if(D=="GET"&&(this.disableCaching&&o.disableCaching!==false)||o.disableCaching===true){A+=(A.indexOf("?")!=-1?"&":"?")+"_dc="+(new Date().getTime());
-}if(typeof o.autoAbort=="boolean"){if(o.autoAbort){this.abort();}}else if(this.autoAbort!==false){this.abort();}if((D=="GET"&&p)||o.xmlData){A+=(A.indexOf("?")!=-1?"&":"?")+p;p="";}this.transId=Roo.lib.Ajax.request(D,A,cb,p,o);return this.transId;}else{Roo.callback(o.callback,o.scope,[o,null,null]);
-return null;}},isLoading:function(A){if(A){return Roo.lib.Ajax.isCallInProgress(A);}else{return this.transId?true:false;}},abort:function(A){if(A||this.isLoading()){Roo.lib.Ajax.abort(A||this.transId);}},handleResponse:function(B){this.transId=false;var A=B.argument.options;
-B.argument=A?A.argument:null;this.fireEvent("requestcomplete",this,B,A);Roo.callback(A.success,A.scope,[B,A]);Roo.callback(A.callback,A.scope,[A,true,B]);},handleFailure:function(B,e){this.transId=false;var A=B.argument.options;B.argument=A?A.argument:null;
-this.fireEvent("requestexception",this,B,A,e);Roo.callback(A.failure,A.scope,[B,A]);Roo.callback(A.callback,A.scope,[A,false,B]);},doFormUpload:function(o,ps,B){var id=Roo.id();var D=document.createElement("iframe");D.id=id;D.name=id;D.className="x-hidden";
-if(Roo.isIE){D.src=Roo.SSL_SECURE_URL;}document.body.appendChild(D);if(Roo.isIE){document.frames[id].name=id;}var C=Roo.getDom(o.form);C.target=id;C.method="POST";C.enctype=C.encoding="multipart/form-data";if(B){C.action=B;}var E,hd;if(ps){E=[];ps=Roo.urlDecode(ps,false);
-for(var k in ps){if(ps.hasOwnProperty(k)){hd=document.createElement("input");hd.type="hidden";hd.name=k;hd.value=ps[k];C.appendChild(hd);E.push(hd);}}}function cb(){var r={responseText:"",responseXML:null};r.argument=o?o.argument:null;try{var F;if(Roo.isIE){F=D.contentWindow.document;
-}else{F=(D.contentDocument||window.frames[id].document);}if(F&&F.body){r.responseText=F.body.innerHTML;}if(F&&F.XMLDocument){r.responseXML=F.XMLDocument;}else{r.responseXML=F;}}catch(e){}Roo.EventManager.removeListener(D,"load",cb,this);this.fireEvent("requestcomplete",this,r,o);
-Roo.callback(o.success,o.scope,[r,o]);Roo.callback(o.callback,o.scope,[o,true,r]);setTimeout(function(){document.body.removeChild(D);},100);}Roo.EventManager.on(D,"load",cb,this);C.submit();if(E){for(var i=0,A=E.length;i<A;i++){C.removeChild(E[i]);}}}});Roo.Ajax=new Roo.data.Connection({autoAbort:false,serializeForm:function(A){return Roo.lib.Ajax.serializeForm(A);
-}});
-Roo.Ajax=new Roo.data.Connection({autoAbort:false,serializeForm:function(A){return Roo.lib.Ajax.serializeForm(A)}});
-Roo.UpdateManager=function(el,A){el=Roo.get(el);if(!A&&el.updateManager){return el.updateManager}this.el=el;this.defaultUrl=null;this.addEvents({"beforeupdate":true,update:true,failure:true});var d=Roo.UpdateManager.defaults;this.sslBlankUrl=d.sslBlankUrl;this.disableCaching=d.disableCaching;this.indicatorText=d.indicatorText;this.showLoadIndicator=d.showLoadIndicator;this.timeout=d.timeout;this.loadScripts=d.loadScripts;this.transaction=null;this.autoRefreshProcId=null;this.refreshDelegate=this.refresh.createDelegate(this);this.updateDelegate=this.update.createDelegate(this);this.formUpdateDelegate=this.formUpdate.createDelegate(this);this.successDelegate=this.processSuccess.createDelegate(this);this.failureDelegate=this.processFailure.createDelegate(this);if(!this.renderer){this.renderer=new Roo.UpdateManager.BasicRenderer()}Roo.UpdateManager.superclass.constructor.call(this)};Roo.extend(Roo.UpdateManager,Roo.util.Observable,{getEl:function(){return this.el},update:function(B,D,E,F){if(this.fireEvent("beforeupdate",this.el,B,D)!==false){var C=this.method,A;if(typeof B=="object"){A=B;B=A.url;D=D||A.params;E=E||A.callback;F=F||A.discardUrl;if(E&&A.scope){E=E.createDelegate(A.scope)}if(typeof A.method!="undefined"){C=A.method};if(typeof A.nocache!="undefined"){this.disableCaching=A.nocache};if(typeof A.text!="undefined"){this.indicatorText="<div class=\"loading-indicator\">"+A.text+"</div>"};if(typeof A.scripts!="undefined"){this.loadScripts=A.scripts};if(typeof A.timeout!="undefined"){this.timeout=A.timeout}}this.showLoading();if(!F){this.defaultUrl=B}if(typeof B=="function"){B=B.call(this)}C=C||(D?"POST":"GET");if(C=="GET"){B=this.prepareUrl(B)}var o=Roo.apply(A||{},{url:B,params:D,success:this.successDelegate,failure:this.failureDelegate,callback:undefined,timeout:(this.timeout*1000),argument:{"url":B,form:null,callback:E,params:D}});this.transaction=Roo.Ajax.request(o)}},formUpdate:function(B,A,C,D){if(this.fireEvent("beforeupdate",this.el,B,A)!==false){if(typeof A=="function"){A=A.call(this)}B=Roo.getDom(B);this.transaction=Roo.Ajax.request({form:B,url:A,success:this.successDelegate,failure:this.failureDelegate,timeout:(this.timeout*1000),argument:{"url":A,form:B,callback:D,reset:C}});this.showLoading.defer(1,this)}},refresh:function(A){if(this.defaultUrl==null){return}this.update(this.defaultUrl,null,A,true)},startAutoRefresh:function(D,A,B,C,E){if(E){this.update(A||this.defaultUrl,B,C,true)}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId)}this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[A||this.defaultUrl,B,C,true]),D*1000)},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId}},isAutoRefreshing:function(){return this.autoRefreshProcId?true:false},showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText)}},prepareUrl:function(A){if(this.disableCaching){var B="_dc="+(new Date().getTime());if(A.indexOf("?")!==-1){A+="&"+B}else{A+="?"+B}}return A},processSuccess:function(A){this.transaction=null;if(A.argument.form&&A.argument.reset){try{A.argument.form.reset()}catch(e){}}if(this.loadScripts){this.renderer.render(this.el,A,this,this.updateComplete.createDelegate(this,[A]))}else{this.renderer.render(this.el,A,this);this.updateComplete(A)}},updateComplete:function(A){this.fireEvent("update",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback(this.el,true,A)}},processFailure:function(A){this.transaction=null;this.fireEvent("failure",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback(this.el,false,A)}},setRenderer:function(A){this.renderer=A},getRenderer:function(){return this.renderer},setDefaultUrl:function(A){this.defaultUrl=A},abort:function(){if(this.transaction){Roo.Ajax.abort(this.transaction)}},isUpdating:function(){if(this.transaction){return Roo.Ajax.isLoading(this.transaction)}return false}});Roo.UpdateManager.defaults={timeout:30,loadScripts:false,sslBlankUrl:(Roo.SSL_SECURE_URL||"javascript:false"),disableCaching:false,showLoadIndicator:true,indicatorText:"<div class=\"loading-indicator\">Loading...</div>"};Roo.UpdateManager.updateElement=function(el,A,B,C){var um=Roo.get(el,true).getUpdateManager();Roo.apply(um,C);um.update(A,B,C?C.callback:null)};Roo.UpdateManager.update=Roo.UpdateManager.updateElement;Roo.UpdateManager.BasicRenderer=function(){};Roo.UpdateManager.BasicRenderer.prototype={render:function(el,B,C,A){el.update(B.responseText,C.loadScripts,A)}};
-Roo.util.DelayedTask=function(fn,C,A){var id=null,d,t;var B=function(){var D=new Date().getTime();if(D-t>=d){clearInterval(id);id=null;fn.apply(C,A||[])}};this.delay=function(D,E,G,F){if(id&&D!=d){this.cancel()}d=D;t=new Date().getTime();fn=E||fn;C=G||C;A=F||A;if(!id){id=setInterval(B,d)}};this.cancel=function(){if(id){clearInterval(id);id=null}}};
-Roo.util.TaskRunner=function(C){C=C||10;var A=[],G=[];var id=0;var B=false;var F=function(){B=false;clearInterval(id);id=0};var H=function(){if(!B){B=true;id=setInterval(D,C)}};var E=function(I){G.push(I);if(I.onStop){I.onStop()}};var D=function(){if(G.length>0){for(var i=0,I=G.length;i<I;i++){A.remove(G[i])}G=[];if(A.length<1){F();return}}var J=new Date().getTime();for(var i=0,I=A.length;i<I;++i){var t=A[i];var K=J-t.taskRunTime;if(t.interval<=K){var rt=t.run.apply(t.scope||t,t.args||[++t.taskRunCount]);t.taskRunTime=J;if(rt===false||t.taskRunCount===t.repeat){E(t);return}}if(t.duration&&t.duration<=(J-t.taskStartTime)){E(t)}}};this.start=function(I){A.push(I);I.taskStartTime=new Date().getTime();I.taskRunTime=0;I.taskRunCount=0;H();return I};this.stop=function(I){E(I);return I};this.stopAll=function(){F();for(var i=0,I=A.length;i<I;i++){if(A[i].onStop){A[i].onStop()}}A=[];G=[]}};Roo.TaskMgr=new Roo.util.TaskRunner();
-Roo.util.MixedCollection=function(B,A){this.items=[];this.map={};this.keys=[];this.length=0;this.addEvents({"clear":true,add:true,replace:true,remove:true,sort:true});this.allowFunctions=B===true;if(A){this.getKey=A}Roo.util.MixedCollection.superclass.constructor.call(this)};Roo.extend(Roo.util.MixedCollection,Roo.util.Observable,{allowFunctions:false,add:function(A,o){if(arguments.length==1){o=arguments[0];A=this.getKey(o)}if(typeof A=="undefined"||A===null){this.length++;this.items.push(o);this.keys.push(null)}else{var B=this.map[A];if(B){return this.replace(A,o)}this.length++;this.items.push(o);this.map[A]=o;this.keys.push(A)}this.fireEvent("add",this.length-1,o,A);return o},getKey:function(o){return o.id},replace:function(A,o){if(arguments.length==1){o=arguments[0];A=this.getKey(o)}var B=this.item(A);if(typeof A=="undefined"||A===null||typeof B=="undefined"){return this.add(A,o)}var C=this.indexOfKey(A);this.items[C]=o;this.map[A]=o;this.fireEvent("replace",A,B,o);return o},addAll:function(D){if(arguments.length>1||D instanceof Array){var C=arguments.length>1?arguments:D;for(var i=0,B=C.length;i<B;i++){this.add(C[i])}}else{for(var A in D){if(this.allowFunctions||typeof D[A]!="function"){this.add(A,D[A])}}}},each:function(fn,C){var B=[].concat(this.items);for(var i=0,A=B.length;i<A;i++){if(fn.call(C||B[i],B[i],i,A)===false){break}}},eachKey:function(fn,B){for(var i=0,A=this.keys.length;i<A;i++){fn.call(B||window,this.keys[i],this.items[i],i,A)}},find:function(fn,B){for(var i=0,A=this.items.length;i<A;i++){if(fn.call(B||window,this.items[i],this.keys[i])){return this.items[i]}}return null},insert:function(B,A,o){if(arguments.length==2){o=arguments[1];A=this.getKey(o)}if(B>=this.length){return this.add(A,o)}this.length++;this.items.splice(B,0,o);if(typeof A!="undefined"&&A!=null){this.map[A]=o}this.keys.splice(B,0,A);this.fireEvent("add",B,o,A);return o},remove:function(o){return this.removeAt(this.indexOf(o))},removeAt:function(B){if(B<this.length&&B>=0){this.length--;var o=this.items[B];this.items.splice(B,1);var A=this.keys[B];if(typeof A!="undefined"){delete this.map[A]}this.keys.splice(B,1);this.fireEvent("remove",o,A)}},removeKey:function(A){return this.removeAt(this.indexOfKey(A))},getCount:function(){return this.length},indexOf:function(o){if(!this.items.indexOf){for(var i=0,A=this.items.length;i<A;i++){if(this.items[i]==o)return i}return -1}else{return this.items.indexOf(o)}},indexOfKey:function(A){if(!this.keys.indexOf){for(var i=0,B=this.keys.length;i<B;i++){if(this.keys[i]==A)return i}return -1}else{return this.keys.indexOf(A)}},item:function(A){var B=typeof this.map[A]!="undefined"?this.map[A]:this.items[A];return typeof B!="function"||this.allowFunctions?B:null},itemAt:function(A){return this.items[A]},key:function(A){return this.map[A]},contains:function(o){return this.indexOf(o)!=-1},containsKey:function(A){return typeof this.map[A]!="undefined"},clear:function(){this.length=0;this.items=[];this.keys=[];this.map={};this.fireEvent("clear")},first:function(){return this.items[0]},last:function(){return this.items[this.length-1]},_sort:function(E,A,fn){var B=String(A).toUpperCase()=="DESC"?-1:1;fn=fn||function(a,b){return a-b};var c=[],k=this.keys,D=this.items;for(var i=0,C=D.length;i<C;i++){c[c.length]={key:k[i],value:D[i],index:i}}c.sort(function(a,b){var v=fn(a[E],b[E])*B;if(v==0){v=(a.index<b.index?-1:1)}return v});for(var i=0,C=c.length;i<C;i++){D[i]=c[i].value;k[i]=c[i].key}this.fireEvent("sort",this)},sort:function(A,fn){this._sort("value",A,fn)},keySort:function(A,fn){this._sort("key",A,fn||function(a,b){return String(a).toUpperCase()-String(b).toUpperCase()})},getRange:function(C,A){var B=this.items;if(B.length<1){return []}C=C||0;A=Math.min(typeof A=="undefined"?this.length-1:A,this.length-1);var r=[];if(C<=A){for(var i=C;i<=A;i++){r[r.length]=B[i]}}else{for(var i=C;i>=A;i--){r[r.length]=B[i]}}return r},filter:function(B,A){if(!A.exec){A=String(A);if(A.length==0){return this.clone()}A=new RegExp("^"+Roo.escapeRe(A),"i")}return this.filterBy(function(o){return o&&A.test(o[B])})},filterBy:function(fn,B){var r=new Roo.util.MixedCollection();r.getKey=this.getKey;var k=this.keys,it=this.items;for(var i=0,A=it.length;i<A;i++){if(fn.call(B||this,it[i],k[i])){r.add(k[i],it[i])}}return r},clone:function(){var r=new Roo.util.MixedCollection();var k=this.keys,it=this.items;for(var i=0,A=it.length;i<A;i++){r.add(k[i],it[i])}r.getKey=this.getKey;return r}});Roo.util.MixedCollection.prototype.get=Roo.util.MixedCollection.prototype.item;
-Roo.util.JSON=new (function(){var useHasOwn={}.hasOwnProperty?true:false;var pad=function(n){return n<10?"0"+n:n};var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\"":"\\\"","\\":"\\\\"};var encodeString=function(s){if(/["\\\x00-\x1f]/.test(s)){return "\""+s.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c}c=b.charCodeAt();return "\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+"\""}return "\""+s+"\""};var encodeArray=function(o){var a=["["],b,i,l=o.length,v;for(i=0;i<l;i+=1){v=o[i];switch(typeof v){case "undefined":case "function":case "unknown":break;default:if(b){a.push(",")}a.push(v===null?"null":Roo.util.JSON.encode(v));b=true}}a.push("]");return a.join("")};var encodeDate=function(o){return "\""+o.getFullYear()+"-"+pad(o.getMonth()+1)+"-"+pad(o.getDate())+"T"+pad(o.getHours())+":"+pad(o.getMinutes())+":"+pad(o.getSeconds())+"\""};this.encode=function(o){if(typeof o=="undefined"||o===null){return "null"}else if(o instanceof Array){return encodeArray(o)}else if(o instanceof Date){return encodeDate(o)}else if(typeof o=="string"){return encodeString(o)}else if(typeof o=="number"){return isFinite(o)?String(o):"null"}else if(typeof o=="boolean"){return String(o)}else{var a=["{"],b,i,v;for(i in o){if(!useHasOwn||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case "undefined":case "function":case "unknown":break;default:if(b){a.push(",")}a.push(this.encode(i),":",v===null?"null":this.encode(v));b=true}}}a.push("}");return a.join("")}};this.decode=function(json){return eval("("+json+")")}})();Roo.encode=Roo.util.JSON.encode;Roo.decode=Roo.util.JSON.decode;
-Roo.util.Format=function(){var A=/^\s+|\s+$/g;return {ellipsis:function(C,B){if(C&&C.length>B){return C.substr(0,B-3)+"..."}return C},undef:function(B){return typeof B!="undefined"?B:""},htmlEncode:function(B){return !B?B:String(B).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")},htmlDecode:function(B){return !B?B:String(B).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,"\"")},trim:function(B){return String(B).replace(A,"")},substr:function(C,B,D){return String(C).substr(B,D)},lowercase:function(B){return String(B).toLowerCase()},uppercase:function(B){return String(B).toUpperCase()},capitalize:function(B){return !B?B:B.charAt(0).toUpperCase()+B.substr(1).toLowerCase()},call:function(value,fn){if(arguments.length>2){var B=Array.prototype.slice.call(arguments,2);B.unshift(value);return eval(fn).apply(window,B)}else{return eval(fn).call(window,value)}},usMoney:function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);v=String(v);var ps=v.split(".");var C=ps[0];var B=ps[1]?"."+ps[1]:".00";var r=/(\d+)(\d{3})/;while(r.test(C)){C=C.replace(r,"$1"+","+"$2")}return "$"+C+B},date:function(v,B){if(!v){return ""}if(!(v instanceof Date)){v=new Date(Date.parse(v))}return v.dateFormat(B||"m/d/Y")},dateRenderer:function(B){return function(v){return Roo.util.Format.date(v,B)}},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return !v?v:String(v).replace(this.stripTagsRE,"")}}}();
-Roo.MasterTemplate=function(){Roo.MasterTemplate.superclass.constructor.apply(this,arguments);this.originalHtml=this.html;var st={};var m,re=this.subTemplateRe;re.lastIndex=0;var C=0;while(m=re.exec(this.html)){var A=m[1],B=m[2];st[C]={name:A,index:C,buffer:[],tpl:new Roo.Template(B)};if(A){st[A]=st[C]}st[C].tpl.compile();st[C].tpl.call=this.call.createDelegate(this);C++}this.subCount=C;this.subs=st};Roo.extend(Roo.MasterTemplate,Roo.Template,{subTemplateRe:/<tpl(?:\sname="([\w-]+)")?>((?:.|\n)*?)<\/tpl>/gi,add:function(A,B){if(arguments.length==1){B=arguments[0];A=0}var s=this.subs[A];s.buffer[s.buffer.length]=s.tpl.apply(B);return this},fill:function(B,D,C){var a=arguments;if(a.length==1||(a.length==2&&typeof a[1]=="boolean")){D=a[0];B=0;C=a[1]}if(C){this.reset()}for(var i=0,A=D.length;i<A;i++){this.add(B,D[i])}return this},reset:function(){var s=this.subs;for(var i=0;i<this.subCount;i++){s[i].buffer=[]}return this},applyTemplate:function(A){var s=this.subs;var B=-1;this.html=this.originalHtml.replace(this.subTemplateRe,function(m,C){return s[++B].buffer.join("")});return Roo.MasterTemplate.superclass.applyTemplate.call(this,A)},apply:function(){return this.applyTemplate.apply(this,arguments)},compile:function(){return this}});Roo.MasterTemplate.prototype.addAll=Roo.MasterTemplate.prototype.fill;Roo.MasterTemplate.from=function(el,A){el=Roo.getDom(el);return new Roo.MasterTemplate(el.value||el.innerHTML,A||"")};
-Roo.util.CSS=function(){var B=null;var A=document;var D=/(-[a-z])/gi;var C=function(m,a){return a.charAt(1).toUpperCase()};return {createStyleSheet:function(G,id){var ss;var E=A.getElementsByTagName("head")[0];var F=A.createElement("style");F.setAttribute("type","text/css");if(id){F.setAttribute("id",id)}if(Roo.isIE){E.appendChild(F);ss=F.styleSheet;ss.cssText=G}else{try{F.appendChild(A.createTextNode(G))}catch(e){F.cssText=G}E.appendChild(F);ss=F.styleSheet?F.styleSheet:(F.sheet||A.styleSheets[A.styleSheets.length-1])}this.cacheStyleSheet(ss);return ss},removeStyleSheet:function(id){var E=A.getElementById(id);if(E){E.parentNode.removeChild(E)}},swapStyleSheet:function(id,E){this.removeStyleSheet(id);var ss=A.createElement("link");ss.setAttribute("rel","stylesheet");ss.setAttribute("type","text/css");ss.setAttribute("id",id);ss.setAttribute("href",E);A.getElementsByTagName("head")[0].appendChild(ss)},refreshCache:function(){return this.getRules(true)},cacheStyleSheet:function(ss){if(!B){B={}}try{var E=ss.cssRules||ss.rules;for(var j=E.length-1;j>=0;--j){B[E[j].selectorText]=E[j]}}catch(e){}},getRules:function(F){if(B==null||F){B={};var ds=A.styleSheets;for(var i=0,E=ds.length;i<E;i++){try{this.cacheStyleSheet(ds[i])}catch(e){}}}return B},getRule:function(E,F){var rs=this.getRules(F);if(!(E instanceof Array)){return rs[E]}for(var i=0;i<E.length;i++){if(rs[E[i]]){return rs[E[i]]}}return null},updateRule:function(H,G,F){if(!(H instanceof Array)){var E=this.getRule(H);if(E){E.style[G.replace(D,C)]=F;return true}}else{for(var i=0;i<H.length;i++){if(this.updateRule(H[i],G,F)){return true}}}return false}}}();
-Roo.util.ClickRepeater=function(el,A){this.el=Roo.get(el);this.el.unselectable();Roo.apply(this,A);this.addEvents({"mousedown":true,click:true,mouseup:true});this.el.on("mousedown",this.handleMouseDown,this);if(this.preventDefault||this.stopDefault){this.el.on("click",function(e){if(this.preventDefault){e.preventDefault()}if(this.stopDefault){e.stopEvent()}},this)}if(this.handler){this.on("click",this.handler,this.scope||this)}Roo.util.ClickRepeater.superclass.constructor.call(this)};Roo.extend(Roo.util.ClickRepeater,Roo.util.Observable,{interval:20,delay:250,preventDefault:true,stopDefault:false,timer:0,handleMouseDown:function(){clearTimeout(this.timer);this.el.blur();if(this.pressClass){this.el.addClass(this.pressClass)}this.mousedownTime=new Date();Roo.get(document).on("mouseup",this.handleMouseUp,this);this.el.on("mouseout",this.handleMouseOut,this);this.fireEvent("mousedown",this);this.fireEvent("click",this);this.timer=this.click.defer(this.delay||this.interval,this)},click:function(){this.fireEvent("click",this);this.timer=this.click.defer(this.getInterval(),this)},getInterval:function(){if(!this.accelerate){return this.interval}var A=this.mousedownTime.getElapsed();if(A<500){return 400}else if(A<1700){return 320}else if(A<2600){return 250}else if(A<3500){return 180}else if(A<4400){return 140}else if(A<5300){return 80}else if(A<6200){return 50}else{return 10}},handleMouseOut:function(){clearTimeout(this.timer);if(this.pressClass){this.el.removeClass(this.pressClass)}this.el.on("mouseover",this.handleMouseReturn,this)},handleMouseReturn:function(){this.el.un("mouseover",this.handleMouseReturn);if(this.pressClass){this.el.addClass(this.pressClass)}this.click()},handleMouseUp:function(){clearTimeout(this.timer);this.el.un("mouseover",this.handleMouseReturn);this.el.un("mouseout",this.handleMouseOut);Roo.get(document).un("mouseup",this.handleMouseUp);this.el.removeClass(this.pressClass);this.fireEvent("mouseup",this)}});
-Roo.KeyNav=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(!this.disabled){this.disabled=true;this.enable()}};Roo.KeyNav.prototype={disabled:false,defaultEventAction:"stopEvent",forceKeyDown:false,prepareEvent:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(Roo.isSafari&&h&&k>=37&&k<=40){e.stopEvent()}},relay:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(h&&this[h]){if(this.doRelay(e,this[h],h)!==true){e[this.defaultEventAction]()}}},doRelay:function(e,h,A){return h.call(this.scope||this,e)},enter:false,left:false,right:false,up:false,down:false,tab:false,esc:false,pageUp:false,pageDown:false,del:false,home:false,end:false,keyToHandler:{37:"left",39:"right",38:"up",40:"down",33:"pageUp",34:"pageDown",46:"del",36:"home",35:"end",13:"enter",27:"esc",9:"tab"},enable:function(){if(this.disabled){if(this.forceKeyDown||Roo.isIE||Roo.isAir){this.el.on("keydown",this.relay,this)}else{this.el.on("keydown",this.prepareEvent,this);this.el.on("keypress",this.relay,this)}this.disabled=false}},disable:function(){if(!this.disabled){if(this.forceKeyDown||Roo.isIE||Roo.isAir){this.el.un("keydown",this.relay)}else{this.el.un("keydown",this.prepareEvent);this.el.un("keypress",this.relay)}this.disabled=true}}};
-Roo.KeyMap=function(el,A,B){this.el=Roo.get(el);this.eventName=B||"keydown";this.bindings=[];if(A){this.addBinding(A)}this.enable()};Roo.KeyMap.prototype={stopEvent:false,addBinding:function(F){if(F instanceof Array){for(var i=0,B=F.length;i<B;i++){this.addBinding(F[i])}return}var H=F.key,E=F.shift,C=F.ctrl,A=F.alt,fn=F.fn,D=F.scope;if(typeof H=="string"){var ks=[];var J=H.toUpperCase();for(var j=0,B=J.length;j<B;j++){ks.push(J.charCodeAt(j))}H=ks}var I=H instanceof Array;var G=function(e){if((!E||e.shiftKey)&&(!C||e.ctrlKey)&&(!A||e.altKey)){var k=e.getKey();if(I){for(var i=0,K=H.length;i<K;i++){if(H[i]==k){if(this.stopEvent){e.stopEvent()}fn.call(D||window,k,e);return}}}else{if(k==H){if(this.stopEvent){e.stopEvent()}fn.call(D||window,k,e)}}}};this.bindings.push(G)},on:function(B,fn,D){var F,E,C,A;if(typeof B=="object"&&!(B instanceof Array)){F=B.key;E=B.shift;C=B.ctrl;A=B.alt}else{F=B}this.addBinding({key:F,shift:E,ctrl:C,alt:A,fn:fn,scope:D})},handleKeyDown:function(e){if(this.enabled){var b=this.bindings;for(var i=0,A=b.length;i<A;i++){b[i].call(this,e)}}},isEnabled:function(){return this.enabled},enable:function(){if(!this.enabled){this.el.on(this.eventName,this.handleKeyDown,this);this.enabled=true}},disable:function(){if(this.enabled){this.el.removeListener(this.eventName,this.handleKeyDown,this);this.enabled=false}}};
-Roo.util.TextMetrics=function(){var A;return {measure:function(el,B,C){if(!A){A=Roo.util.TextMetrics.Instance(el,C)}A.bind(el);A.setFixedWidth(C||"auto");return A.getSize(B)},createInstance:function(el,B){return Roo.util.TextMetrics.Instance(el,B)}}}();Roo.util.TextMetrics.Instance=function(A,C){var ml=new Roo.Element(document.createElement("div"));document.body.appendChild(ml.dom);ml.position("absolute");ml.setLeftTop(-1000,-1000);ml.hide();if(C){ml.setWidth(C)}var B={getSize:function(D){ml.update(D);var s=ml.getSize();ml.update("");return s},bind:function(el){ml.setStyle(Roo.fly(el).getStyles("font-size","font-style","font-weight","font-family","line-height"))},setFixedWidth:function(D){ml.setWidth(D)},getWidth:function(D){ml.dom.style.width="auto";return this.getSize(D).width},getHeight:function(D){return this.getSize(D).height}};B.bind(A);return B};Roo.Element.measureText=Roo.util.TextMetrics.measure;
-Roo.state.Provider=function(){this.addEvents({"statechange":true});this.state={};Roo.state.Provider.superclass.constructor.call(this)};Roo.extend(Roo.state.Provider,Roo.util.Observable,{get:function(A,B){return typeof this.state[A]=="undefined"?B:this.state[A]},clear:function(A){delete this.state[A];this.fireEvent("statechange",this,A,null)},set:function(A,B){this.state[A]=B;this.fireEvent("statechange",this,A,B)},decodeValue:function(D){var re=/^(a|n|d|b|s|o)\:(.*)$/;var F=re.exec(unescape(D));if(!F||!F[1])return;var C=F[1];var v=F[2];switch(C){case "n":return parseFloat(v);case "d":return new Date(Date.parse(v));case "b":return (v=="1");case "a":var A=[];var E=v.split("^");for(var i=0,B=E.length;i<B;i++){A.push(this.decodeValue(E[i]))}return A;case "o":var A={};var E=v.split("^");for(var i=0,B=E.length;i<B;i++){var kv=E[i].split("=");A[kv[0]]=this.decodeValue(kv[1])}return A;default:return v}},encodeValue:function(v){var A;if(typeof v=="number"){A="n:"+v}else if(typeof v=="boolean"){A="b:"+(v?"1":"0")}else if(v instanceof Date){A="d:"+v.toGMTString()}else if(v instanceof Array){var D="";for(var i=0,C=v.length;i<C;i++){D+=this.encodeValue(v[i]);if(i!=C-1)D+="^"}A="a:"+D}else if(typeof v=="object"){var D="";for(var B in v){if(typeof v[B]!="function"){D+=B+"="+this.encodeValue(v[B])+"^"}}A="o:"+D.substring(0,D.length-1)}else{A="s:"+v}return escape(A)}});
-Roo.state.Manager=function(){var A=new Roo.state.Provider();return {setProvider:function(B){A=B},get:function(B,C){return A.get(B,C)},set:function(B,C){A.set(B,C)},clear:function(B){A.clear(B)},getProvider:function(){return A}}}();
-Roo.state.CookieProvider=function(A){Roo.state.CookieProvider.superclass.constructor.call(this);this.path="/";this.expires=new Date(new Date().getTime()+(1000*60*60*24*7));this.domain=null;this.secure=false;Roo.apply(this,A);this.state=this.readCookies()};Roo.extend(Roo.state.CookieProvider,Roo.state.Provider,{set:function(A,B){if(typeof B=="undefined"||B===null){this.clear(A);return}this.setCookie(A,B);Roo.state.CookieProvider.superclass.set.call(this,A,B)},clear:function(A){this.clearCookie(A);Roo.state.CookieProvider.superclass.clear.call(this,A)},readCookies:function(){var C={};var c=document.cookie+";";var re=/\s?(.*?)=(.*?);/g;var D;while((D=re.exec(c))!=null){var A=D[1];var B=D[2];if(A&&A.substring(0,3)=="ys-"){C[A.substr(3)]=this.decodeValue(B)}}return C},setCookie:function(A,B){document.cookie="ys-"+A+"="+this.encodeValue(B)+((this.expires==null)?"":("; expires="+this.expires.toGMTString()))+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"")},clearCookie:function(A){document.cookie="ys-"+A+"=null; expires=Thu, 01-Jan-70 00:00:01 GMT"+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"")}});
-(function(){var B=Roo.EventManager;var A=Roo.lib.Dom;Roo.dd.DragDrop=function(id,D,C){if(id){this.init(id,D,C)}};Roo.dd.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true},unlock:function(){this.locked=false},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(G,C,E){if(typeof C=="number"){C={left:C,right:C,top:C,bottom:C}}C=C||this.defaultPadding;var b=Roo.get(this.getEl()).getBox();var ce=Roo.get(G);var s=ce.getScroll();var c,cd=ce.dom;if(cd==document.body){c={x:s.left,y:s.top,width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()}}else{xy=ce.getXY();c={x:xy[0]+s.left,y:xy[1]+s.top,width:cd.clientWidth,height:cd.clientHeight}}var D=b.y-c.y;var F=b.x-c.x;this.resetConstraints();this.setXConstraint(F-(C.left||0),c.width-F-b.width-(C.right||0));this.setYConstraint(D-(C.top||0),c.height-D-b.height-(C.bottom||0))},getEl:function(){if(!this._domRef){this._domRef=Roo.getDom(this.id)}return this._domRef},getDragEl:function(){return Roo.getDom(this.dragElId)},init:function(id,D,C){this.initTarget(id,D,C);B.on(this.id,"mousedown",this.handleMouseDown,this)},initTarget:function(id,D,C){this.config=C||{};this.DDM=Roo.dd.DDM;this.groups={};if(typeof id!=="string"){id=Roo.id(id)}this.id=id;this.addToGroup((D)?D:"default");this.handleElId=id;this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();this.handleOnAvailable()},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false)},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable()},setPadding:function(D,F,C,E){if(!F&&0!==F){this.padding=[D,D,D,D]}else if(!C&&0!==C){this.padding=[D,F,D,F]}else{this.padding=[D,F,C,E]}},setInitPosition:function(C,D){var el=this.getEl();if(!this.DDM.verifyEl(el)){return}var dx=C||0;var dy=D||0;var p=A.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p)},setStartPosition:function(C){var p=C||A.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1]},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C)},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C]}this.DDM.removeDDFromGroup(this,C)},setDragElId:function(id){this.dragElId=id},setHandleElId:function(id){if(typeof id!=="string"){id=Roo.id(id)}this.handleElId=id;this.DDM.regHandle(this.id,id)},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Roo.id(id)}B.on(id,"mousedown",this.handleMouseDown,this);this.setHandleElId(id);this.hasOuterHandles=true},unreg:function(){B.un(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this)},destroy:function(){this.unreg()},isLocked:function(){return (this.DDM.isLocked()||this.locked)},handleMouseDown:function(e,C){if(this.primaryButtonOnly&&e.button!=0){return}if(this.isLocked()){return}this.DDM.refreshCache(this.groups);var pt=new Roo.lib.Point(Roo.lib.Event.getPageX(e),Roo.lib.Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e)}else{}}},clickValidator:function(e){var C=e.getTarget();return (this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)))},addInvalidHandleType:function(D){var C=D.toUpperCase();this.invalidHandleTypes[C]=C},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Roo.id(id)}this.invalidHandleIds[id]=id},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C)},removeInvalidHandleType:function(D){var C=D.toUpperCase();delete this.invalidHandleTypes[C]},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Roo.id(id)}delete this.invalidHandleIds[id]},removeInvalidHandleClass:function(D){for(var i=0,C=this.invalidHandleClasses.length;i<C;++i){if(this.invalidHandleClasses[i]==D){delete this.invalidHandleClasses[i]}}},isValidHandleChild:function(D){var E=true;var F;try{F=D.nodeName.toUpperCase()}catch(e){F=D.nodeName}E=E&&!this.invalidHandleTypes[F];E=E&&!this.invalidHandleIds[D.id];for(var i=0,C=this.invalidHandleClasses.length;E&&i<C;++i){E=!A.hasClass(D,this.invalidHandleClasses[i])}return E},setXTicks:function(C,E){this.xTicks=[];this.xTickSize=E;var D={};for(var i=this.initPageX;i>=this.minX;i=i-E){if(!D[i]){this.xTicks[this.xTicks.length]=i;D[i]=true}}for(i=this.initPageX;i<=this.maxX;i=i+E){if(!D[i]){this.xTicks[this.xTicks.length]=i;D[i]=true}}this.xTicks.sort(this.DDM.numericSort)},setYTicks:function(C,E){this.yTicks=[];this.yTickSize=E;var D={};for(var i=this.initPageY;i>=this.minY;i=i-E){if(!D[i]){this.yTicks[this.yTicks.length]=i;D[i]=true}}for(i=this.initPageY;i<=this.maxY;i=i+E){if(!D[i]){this.yTicks[this.yTicks.length]=i;D[i]=true}}this.yTicks.sort(this.DDM.numericSort)},setXConstraint:function(C,D,E){this.leftConstraint=C;this.rightConstraint=D;this.minX=this.initPageX-C;this.maxX=this.initPageX+D;if(E){this.setXTicks(this.initPageX,E)}this.constrainX=true},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks()},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0},setYConstraint:function(C,D,E){this.topConstraint=C;this.bottomConstraint=D;this.minY=this.initPageY-C;this.maxY=this.initPageY+D;if(E){this.setYTicks(this.initPageY,E)}this.constrainY=true},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy)}else{this.setInitPosition()}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize)}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize)}},getTick:function(D,H){if(!H){return D}else if(H[0]>=D){return H[0]}else{for(var i=0,C=H.length;i<C;++i){var E=i+1;if(H[E]&&H[E]>=D){var F=D-H[i];var G=H[E]-D;return (G>F)?H[i]:H[E]}}return H[H.length-1]}},toString:function(){return ("DragDrop "+this.id)}}})();
-if(!Roo.dd.DragDropMgr){Roo.dd.DragDropMgr=function(){var A=Roo.EventManager;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(D,C){for(var i in this.ids){for(var j in this.ids[i]){var B=this.ids[i][j];if(!this.isTypeOfDD(B)){continue}B[D].apply(B,C)}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true)},_onResize:function(e){this._execOnAll("resetConstraints",[])},lock:function(){this.locked=true},unlock:function(){this.locked=false},isLocked:function(){return this.locked},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(B,C){if(!this.initialized){this.init()}if(!this.ids[C]){this.ids[C]={}}this.ids[C][B.id]=B},removeDDFromGroup:function(B,D){if(!this.ids[D]){this.ids[D]={}}var C=this.ids[D];if(C&&C[B.id]){delete C[B.id]}},_remove:function(B){for(var g in B.groups){if(g&&this.ids[g][B.id]){delete this.ids[g][B.id]}}delete this.handleIds[B.id]},regHandle:function(B,C){if(!this.handleIds[B]){this.handleIds[B]={}}this.handleIds[B][C]=C},isDragDrop:function(id){return (this.getDDById(id))?true:false},getRelated:function(C,D){var B=[];for(var i in C.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue}if(!D||dd.isTarget){B[B.length]=dd}}}return B},isLegalTarget:function(C,E){var D=this.getRelated(C,true);for(var i=0,B=D.length;i<B;++i){if(D[i].id==E.id){return true}}return false},isTypeOfDD:function(B){return (B&&B.__ygDragDrop)},isHandle:function(B,C){return (this.handleIds[B]&&this.handleIds[B][C])},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id]}}return null},handleMouseDown:function(e,B){if(Roo.QuickTips){Roo.QuickTips.disable()}this.currentTarget=e.getTarget();this.dragCurrent=B;var el=B.getEl();this.startX=e.getPageX();this.startY=e.getPageY();this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var C=Roo.dd.DDM;C.startDrag(C.startX,C.startY)},this.clickTimeThresh)},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y)}this.dragThreshMet=true},handleMouseUp:function(e){if(Roo.QuickTips){Roo.QuickTips.enable()}if(!this.dragCurrent){return}clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true)}else{}this.stopDrag(e);this.stopEvent(e)},stopEvent:function(e){if(this.stopPropagation){e.stopPropagation()}if(this.preventDefault){e.preventDefault()}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e)}this.dragCurrent.onMouseUp(e)}this.dragCurrent=null;this.dragOvers={}},handleMouseMove:function(e){if(!this.dragCurrent){return true}if(Roo.isIE&&(e.button!==0&&e.button!==1&&e.button!==2)){this.stopEvent(e);return this.handleMouseUp(e)}if(!this.dragThreshMet){var B=Math.abs(this.startX-e.getPageX());var C=Math.abs(this.startY-e.getPageY());if(B>this.clickPixelThresh||C>this.clickPixelThresh){this.startDrag(this.startX,this.startY)}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);if(!this.dragCurrent.moveOnly){this.fireEvents(e,false)}}this.stopEvent(e);return true},fireEvents:function(e,E){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return}var pt=e.getPoint();var I=[];var G=[];var J=[];var H=[];var K=[];for(var i in this.dragOvers){var B=this.dragOvers[i];if(!this.isTypeOfDD(B)){continue}if(!this.isOverTarget(pt,B,this.mode)){G.push(B)}I[i]=true;delete this.dragOvers[i]}for(var F in dc.groups){if("string"!=typeof F){continue}for(i in this.ids[F]){var D=this.ids[F][i];if(!this.isTypeOfDD(D)){continue}if(D.isTarget&&!D.isLocked()&&D!=dc){if(this.isOverTarget(pt,D,this.mode)){if(E){H.push(D)}else{if(!I[D.id]){K.push(D)}else{J.push(D)}this.dragOvers[D.id]=D}}}}}if(this.mode){if(G.length){dc.b4DragOut(e,G);dc.onDragOut(e,G)}if(K.length){dc.onDragEnter(e,K)}if(J.length){dc.b4DragOver(e,J);dc.onDragOver(e,J)}if(H.length){dc.b4DragDrop(e,H);dc.onDragDrop(e,H)}}else{var C=0;for(i=0,C=G.length;i<C;++i){dc.b4DragOut(e,G[i].id);dc.onDragOut(e,G[i].id)}for(i=0,C=K.length;i<C;++i){dc.onDragEnter(e,K[i].id)}for(i=0,C=J.length;i<C;++i){dc.b4DragOver(e,J[i].id);dc.onDragOver(e,J[i].id)}for(i=0,C=H.length;i<C;++i){dc.b4DragDrop(e,H[i].id);dc.onDragDrop(e,H[i].id)}}if(E&&!H.length){dc.onInvalidDrop(e)}},getBestMatch:function(B){var D=null;var C=B.length;if(C==1){D=B[0]}else{for(var i=0;i<C;++i){var dd=B[i];if(dd.cursorIsOver){D=dd;break}else{if(!D||D.overlap.getArea()<dd.overlap.getArea()){D=dd}}}}return D},refreshCache:function(D){for(var E in D){if("string"!=typeof E){continue}for(var i in this.ids[E]){var C=this.ids[E][i];if(this.isTypeOfDD(C)){var B=this.getLocation(C);if(B){this.locationCache[C.id]=B}else{delete this.locationCache[C.id]}}}}},verifyEl:function(el){if(el){var B;if(Roo.isIE){try{B=el.offsetParent}catch(e){}}else{B=el.offsetParent}if(B){return true}}return false},getLocation:function(B){if(!this.isTypeOfDD(B)){return null}var el=B.getEl(),C,x1,x2,y1,y2,t,r,b,l;try{C=Roo.lib.Dom.getXY(el)}catch(e){}if(!C){return null}x1=C[0];x2=x1+el.offsetWidth;y1=C[1];y2=y1+el.offsetHeight;t=y1-B.padding[0];r=x2+B.padding[1];b=y2+B.padding[2];l=x1-B.padding[3];return new Roo.lib.Region(t,r,b,l)},isOverTarget:function(pt,D,G){var B=this.locationCache[D.id];if(!B||!this.useCache){B=this.getLocation(D);this.locationCache[D.id]=B}if(!B){return false}D.cursorIsOver=B.contains(pt);var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord||(!G&&!dc.constrainX&&!dc.constrainY)){return D.cursorIsOver}D.overlap=null;var C=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var F=new Roo.lib.Region(C.y,C.x+el.offsetWidth,C.y+el.offsetHeight,C.x);var E=F.intersect(B);if(E){D.overlap=E;return (G)?true:D.cursorIsOver}else{return false}},_onUnload:function(e,me){Roo.dd.DragDropMgr.unregAll()},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null}this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i]}this.elementCache={};this.ids={}},elementCache:{},getElWrapper:function(id){var B=this.elementCache[id];if(!B||!B.el){B=this.elementCache[id]=new this.ElementWrapper(Roo.getDom(id))}return B},getElement:function(id){return Roo.getDom(id)},getCss:function(id){var el=Roo.getDom(id);return (el)?el.style:null},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style},getPosX:function(el){return Roo.lib.Dom.getX(el)},getPosY:function(el){return Roo.lib.Dom.getY(el)},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2)}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2)}else if(n2==n1.nextSibling){p.insertBefore(n2,n1)}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s)}}},getScroll:function(){var t,l,B=document.documentElement,db=document.body;if(B&&(B.scrollTop||B.scrollLeft)){t=B.scrollTop;l=B.scrollLeft}else if(db){t=db.scrollTop;l=db.scrollLeft}else{}return {top:t,left:l}},getStyle:function(el,B){return Roo.fly(el).getStyle(B)},getScrollTop:function(){return this.getScroll().top},getScrollLeft:function(){return this.getScroll().left},moveToEl:function(C,D){var B=Roo.lib.Dom.getXY(D);Roo.lib.Dom.setXY(C,B)},numericSort:function(a,b){return (a-b)},_timeoutCount:0,_addListeners:function(){var B=Roo.dd.DDM;if(Roo.lib.Event&&document){B._onLoad()}else{if(B._timeoutCount>2000){}else{setTimeout(B._addListeners,10);if(document&&document.body){B._timeoutCount+=1}}}},handleWasClicked:function(B,id){if(this.isHandle(id,B.id)){return true}else{var p=B.parentNode;while(p){if(this.isHandle(id,p.id)){return true}else{p=p.parentNode}}}return false}}}();Roo.dd.DDM=Roo.dd.DragDropMgr;Roo.dd.DDM._addListeners()}
-Roo.dd.DD=function(id,B,A){if(id){this.init(id,B,A)}};Roo.extend(Roo.dd.DD,Roo.dd.DragDrop,{scroll:true,autoOffset:function(A,B){var x=A-this.startPageX;var y=B-this.startPageY;this.setDelta(x,y)},setDelta:function(A,B){this.deltaX=A;this.deltaY=B},setDragElPos:function(A,B){var el=this.getDragEl();this.alignElWithMouse(el,A,B)},alignElWithMouse:function(el,C,D){var F=this.getTargetCoord(C,D);var A=el.dom?el:Roo.fly(el);if(!this.deltaSetXY){var B=[F.x,F.y];A.setXY(B);var G=A.getLeft(true);var E=A.getTop(true);this.deltaSetXY=[G-F.x,E-F.y]}else{A.setLeftTop(F.x+this.deltaSetXY[0],F.y+this.deltaSetXY[1])}this.cachePosition(F.x,F.y);this.autoScroll(F.x,F.y,el.offsetHeight,el.offsetWidth);return F},cachePosition:function(B,C){if(B){this.lastPageX=B;this.lastPageY=C}else{var A=Roo.lib.Dom.getXY(this.getEl());this.lastPageX=A[0];this.lastPageY=A[1]}},autoScroll:function(x,y,h,w){if(this.scroll){var F=Roo.lib.Dom.getViewWidth();var G=Roo.lib.Dom.getViewHeight();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var A=h+y;var B=w+x;var C=(F+st-y-this.deltaY);var H=(G+sl-x-this.deltaX);var E=40;var D=(document.all)?80:30;if(A>F&&C<E){window.scrollTo(sl,st+D)}if(y<st&&st>0&&y-st<E){window.scrollTo(sl,st-D)}if(B>G&&H<E){window.scrollTo(sl+D,st)}if(x<sl&&sl>0&&x-sl<E){window.scrollTo(sl-D,st)}}},getTargetCoord:function(A,B){var x=A-this.deltaX;var y=B-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX}if(x>this.maxX){x=this.maxX}}if(this.constrainY){if(y<this.minY){y=this.minY}if(y>this.maxY){y=this.maxY}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y}},applyConfig:function(){Roo.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false)},b4MouseDown:function(e){this.autoOffset(e.getPageX(),e.getPageY())},b4Drag:function(e){this.setDragElPos(e.getPageX(),e.getPageY())},toString:function(){return ("DD "+this.id)}});
-Roo.dd.DDProxy=function(id,B,A){if(id){this.init(id,B,A);this.initFrame()}};Roo.dd.DDProxy.dragElId="ygddfdiv";Roo.extend(Roo.dd.DDProxy,Roo.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var C=this;var B=document.body;if(!B||!B.firstChild){setTimeout(function(){C.createFrame()},50);return}var A=this.getDragEl();if(!A){A=document.createElement("div");A.id=this.dragElId;var s=A.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;B.insertBefore(A,B.firstChild)}},initFrame:function(){this.createFrame()},applyConfig:function(){Roo.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Roo.dd.DDProxy.dragElId)},showFrame:function(B,C){var el=this.getEl();var A=this.getDragEl();var s=A.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2))}this.setDragElPos(B,C);Roo.fly(A).show()},_resizeProxy:function(){if(this.resizeFrame){var el=this.getEl();Roo.fly(this.getDragEl()).setSize(el.offsetWidth,el.offsetHeight)}},b4MouseDown:function(e){var x=e.getPageX();var y=e.getPageY();this.autoOffset(x,y);this.setDragElPos(x,y)},b4StartDrag:function(x,y){this.showFrame(x,y)},b4EndDrag:function(e){Roo.fly(this.getDragEl()).hide()},endDrag:function(e){var B=this.getEl();var A=this.getDragEl();A.style.visibility="";this.beforeMove();B.style.visibility="hidden";Roo.dd.DDM.moveToEl(B,A);A.style.visibility="hidden";B.style.visibility="";this.afterDrag()},beforeMove:function(){},afterDrag:function(){},toString:function(){return ("DDProxy "+this.id)}});
-Roo.dd.DDTarget=function(id,B,A){if(id){this.initTarget(id,B,A)}};Roo.extend(Roo.dd.DDTarget,Roo.dd.DragDrop,{toString:function(){return ("DDTarget "+this.id)}});
-Roo.dd.ScrollManager=function(){var A=Roo.dd.DragDropMgr;var B={};var D=null;var C={};var F=function(e){D=null;H()};var J=function(){if(A.dragCurrent){A.refreshCache(A.dragCurrent.groups)}};var G=function(){if(A.dragCurrent){var K=Roo.dd.ScrollManager;if(!K.animate){if(C.el.scroll(C.dir,K.increment)){J()}}else{C.el.scroll(C.dir,K.increment,true,K.animDuration,J)}}};var H=function(){if(C.id){clearInterval(C.id)}C.id=0;C.el=null;C.dir=""};var I=function(el,K){H();C.el=el;C.dir=K;C.id=setInterval(G,Roo.dd.ScrollManager.frequency)};var E=function(e,L){if(L||!A.dragCurrent){return}var K=Roo.dd.ScrollManager;if(!D||D!=A.dragCurrent){D=A.dragCurrent;K.refreshCache()}var xy=Roo.lib.Event.getXY(e);var pt=new Roo.lib.Point(xy[0],xy[1]);for(var id in B){var el=B[id],r=el._region;if(r&&r.contains(pt)&&el.isScrollable()){if(r.bottom-pt.y<=K.thresh){if(C.el!=el){I(el,"down")}return}else if(r.right-pt.x<=K.thresh){if(C.el!=el){I(el,"left")}return}else if(pt.y-r.top<=K.thresh){if(C.el!=el){I(el,"up")}return}else if(pt.x-r.left<=K.thresh){if(C.el!=el){I(el,"right")}return}}}H()};A.fireEvents=A.fireEvents.createSequence(E,A);A.stopDrag=A.stopDrag.createSequence(F,A);return {register:function(el){if(el instanceof Array){for(var i=0,K=el.length;i<K;i++){this.register(el[i])}}else{el=Roo.get(el);B[el.id]=el}},unregister:function(el){if(el instanceof Array){for(var i=0,K=el.length;i<K;i++){this.unregister(el[i])}}else{el=Roo.get(el);delete B[el.id]}},thresh:25,increment:100,frequency:500,animate:true,animDuration:0.4,refreshCache:function(){for(var id in B){if(typeof B[id]=="object"){B[id]._region=B[id].getRegion()}}}}}();
-Roo.dd.Registry=function(){var C={};var B={};var D=0;var A=function(el,E){if(typeof el=="string"){return el}var id=el.id;if(!id&&E!==false){id="roodd-"+(++D);el.id=id}return id};return {register:function(el,F){F=F||{};if(typeof el=="string"){el=document.getElementById(el)}F.ddel=el;C[A(el)]=F;if(F.isHandle!==false){B[F.ddel.id]=F}if(F.handles){var hs=F.handles;for(var i=0,E=hs.length;i<E;i++){B[A(hs[i])]=F}}},unregister:function(el){var id=A(el,false);var F=C[id];if(F){delete C[id];if(F.handles){var hs=F.handles;for(var i=0,E=hs.length;i<E;i++){delete B[A(hs[i],false)]}}}},getHandle:function(id){if(typeof id!="string"){id=id.id}return B[id]},getHandleFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?B[t.id]:null},getTarget:function(id){if(typeof id!="string"){id=id.id}return C[id]},getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?C[t.id]||B[t.id]:null}}}();
-Roo.dd.StatusProxy=function(A){Roo.apply(this,A);this.id=this.id||Roo.id();this.el=new Roo.Layer({dh:{id:this.id,tag:"div",cls:"x-dd-drag-proxy "+this.dropNotAllowed,children:[{tag:"div",cls:"x-dd-drop-icon"},{tag:"div",cls:"x-dd-drag-ghost"}]},shadow:!A||A.shadow!==false});this.ghost=Roo.get(this.el.dom.childNodes[1]);this.dropStatus=this.dropNotAllowed};Roo.dd.StatusProxy.prototype={dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",setStatus:function(A){A=A||this.dropNotAllowed;if(this.dropStatus!=A){this.el.replaceClass(this.dropStatus,A);this.dropStatus=A}},reset:function(A){this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;this.dropStatus=this.dropNotAllowed;if(A){this.ghost.update("")}},update:function(A){if(typeof A=="string"){this.ghost.update(A)}else{this.ghost.update("");A.style.margin="0";this.ghost.dom.appendChild(A)}var el=this.ghost.dom.firstChild;if(el){Roo.fly(el).setStyle("float","none")}},getEl:function(){return this.el},getGhost:function(){return this.ghost},hide:function(A){this.el.hide();if(A){this.reset(true)}},stop:function(){if(this.anim&&this.anim.isAnimated&&this.anim.isAnimated()){this.anim.stop()}},show:function(){this.el.show()},sync:function(){this.el.sync()},repair:function(xy,B,A){this.callback=B;this.scope=A;if(xy&&this.animRepair!==false){this.el.addClass("x-dd-drag-repair");this.el.hideUnders(true);this.anim=this.el.shift({duration:this.repairDuration||0.5,easing:"easeOut",xy:xy,stopFx:true,callback:this.afterRepair,scope:this})}else{this.afterRepair()}},afterRepair:function(){this.hide(true);if(typeof this.callback=="function"){this.callback.call(this.scope||this)}this.callback=null;this.scope=null}};
-Roo.dd.DragSource=function(el,A){this.el=Roo.get(el);this.dragData={};Roo.apply(this,A);if(!this.proxy){this.proxy=new Roo.dd.StatusProxy()}Roo.dd.DragSource.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{dragElId:this.proxy.id,resizeFrame:false,isTarget:false,scroll:this.scroll===true});this.dragging=false};Roo.extend(Roo.dd.DragSource,Roo.dd.DDProxy,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",getDragData:function(e){return this.dragData},onDragEnter:function(e,id){var B=Roo.dd.DragDropMgr.getDDById(id);this.cachedTarget=B;if(this.beforeDragEnter(B,e,id)!==false){if(B.isNotifyTarget){var A=B.notifyEnter(this,e,this.dragData);this.proxy.setStatus(A)}else{this.proxy.setStatus(this.dropAllowed)}if(this.afterDragEnter){this.afterDragEnter(B,e,id)}}},beforeDragEnter:function(A,e,id){return true},alignElWithMouse:function(){Roo.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);this.proxy.sync()},onDragOver:function(e,id){var B=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOver(B,e,id)!==false){if(B.isNotifyTarget){var A=B.notifyOver(this,e,this.dragData);this.proxy.setStatus(A)}if(this.afterDragOver){this.afterDragOver(B,e,id)}}},beforeDragOver:function(A,e,id){return true},onDragOut:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOut(A,e,id)!==false){if(A.isNotifyTarget){A.notifyOut(this,e,this.dragData)}this.proxy.reset();if(this.afterDragOut){this.afterDragOut(A,e,id)}}this.cachedTarget=null},beforeDragOut:function(A,e,id){return true},onDragDrop:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragDrop(A,e,id)!==false){if(A.isNotifyTarget){if(A.notifyDrop(this,e,this.dragData)){this.onValidDrop(A,e,id)}else{this.onInvalidDrop(A,e,id)}}else{this.onValidDrop(A,e,id)}if(this.afterDragDrop){this.afterDragDrop(A,e,id)}}delete this.cachedTarget},beforeDragDrop:function(A,e,id){return true},onValidDrop:function(A,e,id){this.hideProxy();if(this.afterValidDrop){this.afterValidDrop(A,e,id)}},getRepairXY:function(e,A){return this.el.getXY()},onInvalidDrop:function(A,e,id){this.beforeInvalidDrop(A,e,id);if(this.cachedTarget){if(this.cachedTarget.isNotifyTarget){this.cachedTarget.notifyOut(this,e,this.dragData)}this.cacheTarget=null}this.proxy.repair(this.getRepairXY(e,this.dragData),this.afterRepair,this);if(this.afterInvalidDrop){this.afterInvalidDrop(e,id)}},afterRepair:function(){if(Roo.enableFx){this.el.highlight(this.hlColor||"c3daf9")}this.dragging=false},beforeInvalidDrop:function(A,e,id){return true},handleMouseDown:function(e){if(this.dragging){return}var A=this.getDragData(e);if(A&&this.onBeforeDrag(A,e)!==false){this.dragData=A;this.proxy.stop();Roo.dd.DragSource.superclass.handleMouseDown.apply(this,arguments)}},onBeforeDrag:function(A,e){return true},onStartDrag:Roo.emptyFn,startDrag:function(x,y){this.proxy.reset();this.dragging=true;this.proxy.update("");this.onInitDrag(x,y);this.proxy.show()},onInitDrag:function(x,y){var A=this.el.dom.cloneNode(true);A.id=Roo.id();this.proxy.update(A);this.onStartDrag(x,y);return true},getProxy:function(){return this.proxy},hideProxy:function(){this.proxy.hide();this.proxy.reset(true);this.dragging=false},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups)},b4EndDrag:function(e){},endDrag:function(e){this.onEndDrag(this.dragData,e)},onEndDrag:function(A,e){},autoOffset:function(x,y){this.setDelta(-12,-20)}});
-Roo.dd.DropTarget=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el)}Roo.dd.DropTarget.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{isTarget:true})};Roo.extend(Roo.dd.DropTarget,Roo.dd.DDTarget,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",isTarget:true,isNotifyTarget:true,notifyEnter:function(dd,e,A){if(this.overClass){this.el.addClass(this.overClass)}return this.dropAllowed},notifyOver:function(dd,e,A){return this.dropAllowed},notifyOut:function(dd,e,A){if(this.overClass){this.el.removeClass(this.overClass)}},notifyDrop:function(dd,e,A){return false}});
-Roo.dd.DragZone=function(el,A){Roo.dd.DragZone.superclass.constructor.call(this,el,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el)}};Roo.extend(Roo.dd.DragZone,Roo.dd.DragSource,{getDragData:function(e){return Roo.dd.Registry.getHandleFromEvent(e)},onInitDrag:function(x,y){this.proxy.update(this.dragData.ddel.cloneNode(true));this.onStartDrag(x,y);return true},afterRepair:function(){if(Roo.enableFx){Roo.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9")}this.dragging=false},getRepairXY:function(e){return Roo.Element.fly(this.dragData.ddel).getXY()}});
-Roo.dd.DropZone=function(el,A){Roo.dd.DropZone.superclass.constructor.call(this,el,A)};Roo.extend(Roo.dd.DropZone,Roo.dd.DropTarget,{getTargetFromEvent:function(e){return Roo.dd.Registry.getTargetFromEvent(e)},onNodeEnter:function(n,dd,e,A){},onNodeOver:function(n,dd,e,A){return this.dropAllowed},onNodeOut:function(n,dd,e,A){},onNodeDrop:function(n,dd,e,A){return false},onContainerOver:function(dd,e,A){return this.dropNotAllowed},onContainerDrop:function(dd,e,A){return false},notifyEnter:function(dd,e,A){return this.dropNotAllowed},notifyOver:function(dd,e,A){var n=this.getTargetFromEvent(e);if(!n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null}return this.onContainerOver(dd,e,A)}if(this.lastOverNode!=n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A)}this.onNodeEnter(n,dd,e,A);this.lastOverNode=n}return this.onNodeOver(n,dd,e,A)},notifyOut:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null}},notifyDrop:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null}var n=this.getTargetFromEvent(e);return n?this.onNodeDrop(n,dd,e,A):this.onContainerDrop(dd,e,A)},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups)}});
-Roo.data.SortTypes={none:function(s){return s},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"")},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"")},asUCString:function(s){return String(s).toUpperCase()},asDate:function(s){if(!s){return 0}if(s instanceof Date){return s.getTime()}return Date.parse(String(s))},asFloat:function(s){var A=parseFloat(String(s).replace(/,/g,""));if(isNaN(A))A=0;return A},asInt:function(s){var A=parseInt(String(s).replace(/,/g,""));if(isNaN(A))A=0;return A}};
-Roo.data.Record=function(A,id){this.id=(id||id===0)?id:++Roo.data.Record.AUTO_ID;this.data=A};Roo.data.Record.create=function(o){var f=function(){f.superclass.constructor.apply(this,arguments)};Roo.extend(f,Roo.data.Record);var p=f.prototype;p.fields=new Roo.util.MixedCollection(false,function(B){return B.name});for(var i=0,A=o.length;i<A;i++){p.fields.add(new Roo.data.Field(o[i]))}f.getField=function(B){return p.fields.get(B)};return f};Roo.data.Record.AUTO_ID=1000;Roo.data.Record.EDIT="edit";Roo.data.Record.REJECT="reject";Roo.data.Record.COMMIT="commit";Roo.data.Record.prototype={dirty:false,editing:false,error:null,modified:null,join:function(A){this.store=A},set:function(A,B){if(this.data[A]==B){return}this.dirty=true;if(!this.modified){this.modified={}}if(typeof this.modified[A]=="undefined"){this.modified[A]=this.data[A]}this.data[A]=B;if(!this.editing){this.store.afterEdit(this)}},get:function(A){return this.data[A]},beginEdit:function(){this.editing=true;this.modified={}},cancelEdit:function(){this.editing=false;delete this.modified},endEdit:function(){this.editing=false;if(this.dirty&&this.store){this.store.afterEdit(this)}},reject:function(){var m=this.modified;for(var n in m){if(typeof m[n]!="function"){this.data[n]=m[n]}}this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterReject(this)}},commit:function(){this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterCommit(this)}},hasError:function(){return this.error!=null},clearError:function(){this.error=null},copy:function(A){return new this.constructor(Roo.apply({},this.data),A||this.id)}};
-Roo.data.Store=function(A){this.data=new Roo.util.MixedCollection(false);this.data.getKey=function(o){return o.id;};this.baseParams={};this.paramNames={"start":"start",limit:"limit",sort:"sort",dir:"dir"};if(A&&A.data){this.inlineData=A.data;delete A.data;
-}Roo.apply(this,A);if(this.reader){this.reader=Roo.factory(this.reader,Roo.data);if(!this.recordType){this.recordType=this.reader.recordType;}if(this.reader.onMetaChange){this.reader.onMetaChange=this.onMetaChange.createDelegate(this);}}if(this.recordType){this.fields=this.recordType.prototype.fields;
-}this.modified=[];this.addEvents({datachanged:true,metachange:true,add:true,remove:true,update:true,clear:true,beforeload:true,load:true,loadexception:true});if(this.proxy){this.proxy=Roo.factory(this.proxy,Roo.data);this.relayEvents(this.proxy,["loadexception"]);
-}this.sortToggle={};Roo.data.Store.superclass.constructor.call(this);if(this.inlineData){this.loadData(this.inlineData);delete this.inlineData;}};Roo.extend(Roo.data.Store,Roo.util.Observable,{remoteSort:false,pruneModifiedRecords:false,lastOptions:null,add:function(C){C=[].concat(C);
-for(var i=0,A=C.length;i<A;i++){C[i].join(this);}var B=this.data.length;this.data.addAll(C);this.fireEvent("add",this,C,B);},remove:function(B){var A=this.data.indexOf(B);this.data.removeAt(A);if(this.pruneModifiedRecords){this.modified.remove(B);}this.fireEvent("remove",this,B,A);
-},removeAll:function(){this.data.clear();if(this.pruneModifiedRecords){this.modified=[];}this.fireEvent("clear",this);},insert:function(B,C){C=[].concat(C);for(var i=0,A=C.length;i<A;i++){this.data.insert(B,C[i]);C[i].join(this);}this.fireEvent("add",this,C,B);
-},indexOf:function(A){return this.data.indexOf(A);},indexOfId:function(id){return this.data.indexOfKey(id);},getById:function(id){return this.data.key(id);},getAt:function(A){return this.data.itemAt(A);},getRange:function(B,A){return this.data.getRange(B,A);
-},storeOptions:function(o){o=Roo.apply({},o);delete o.callback;delete o.scope;this.lastOptions=o;},load:function(A){A=A||{};if(this.fireEvent("beforeload",this,A)!==false){this.storeOptions(A);var p=Roo.apply(A.params||{},this.baseParams);if(this.sortInfo&&this.remoteSort){var pn=this.paramNames;
-p[pn["sort"]]=this.sortInfo.field;p[pn["dir"]]=this.sortInfo.direction;}this.proxy.load(p,this.reader,this.loadRecords,this,A);}},reload:function(A){this.load(Roo.applyIf(A||{},this.lastOptions));},loadRecords:function(o,B,C){if(!o||C===false){if(C!==false){this.fireEvent("load",this,[],B);
-}if(B.callback){B.callback.call(B.scope||this,[],B,false);}return;}if(o.success===false){this.fireEvent("loadexception",this,o,B,this.reader.jsonData);return;}var r=o.records,t=o.totalRecords||r.length;if(!B||B.add!==true){if(this.pruneModifiedRecords){this.modified=[];
-}for(var i=0,A=r.length;i<A;i++){r[i].join(this);}if(this.snapshot){this.data=this.snapshot;delete this.snapshot;}this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else{this.totalLength=Math.max(t,this.data.length+r.length);
-this.add(r);}this.fireEvent("load",this,r,B);if(B.callback){B.callback.call(B.scope||this,r,B,true);}},loadData:function(o,A){var r=this.reader.readRecords(o);this.loadRecords(r,{add:A},true);},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;
-},getSortState:function(){return this.sortInfo;},applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);
-};this.data.sort(s.direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(s.direction,fn);}}},setDefaultSort:function(B,A){this.sortInfo={field:B,direction:A?A.toUpperCase():"ASC"};},sort:function(B,A){var f=this.fields.get(B);if(!A){if(this.sortInfo&&this.sortInfo.field==f.name){A=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");
-}else{A=f.sortDir;}}this.sortToggle[f.name]=A;this.sortInfo={field:f.name,direction:A};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else{this.load(this.lastOptions);}},each:function(fn,A){this.data.each(fn,A);},getModifiedRecords:function(){return this.modified;
-},createFilterFn:function(C,A,B){if(!A.exec){A=String(A);if(A.length==0){return false;}A=new RegExp((B===true?"":"^")+Roo.escapeRe(A),"i");}return function(r){return A.test(r.data[C]);};},sum:function(C,B,A){var rs=this.data.items,v=0;B=B||0;A=(A||A===0)?A:rs.length-1;
-for(var i=B;i<=A;i++){v+=(rs[i].data[C]||0);}return v;},filter:function(C,A,B){var fn=this.createFilterFn(C,A,B);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);
-this.fireEvent("datachanged",this);},query:function(C,A,B){var fn=this.createFilterFn(C,A,B);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,B){var A=this.snapshot||this.data;return A.filterBy(fn,B||this);},collect:function(C,B,D){var d=(D===true&&this.snapshot)?this.snapshot.items:this.data.items;
-var v,sv,r=[],l={};for(var i=0,A=d.length;i<A;i++){v=d[i].data[C];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;
-if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}this.fireEvent("update",this,A,Roo.data.Record.EDIT);},afterReject:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.REJECT);
-},afterCommit:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);
-this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].reject();}},onMetaChange:function(A,B,o){this.recordType=B;this.fields=B.prototype.fields;delete this.snapshot;this.sortInfo=A.sortInfo;this.modified=[];this.fireEvent("metachange",this,this.reader.meta);
-}});
-Roo.data.SimpleStore=function(A){Roo.data.SimpleStore.superclass.constructor.call(this,{isLocal:true,reader:new Roo.data.ArrayReader({id:A.id},Roo.data.Record.create(A.fields)),proxy:new Roo.data.MemoryProxy(A.data)});this.load();};Roo.extend(Roo.data.SimpleStore,Roo.data.Store);
-
-Roo.data.JsonStore=function(c){Roo.data.JsonStore.superclass.constructor.call(this,Roo.apply(c,{proxy:!c.data?new Roo.data.HttpProxy({url:c.url}):undefined,reader:new Roo.data.JsonReader(c,c.fields)}))};Roo.extend(Roo.data.JsonStore,Roo.data.Store);
-Roo.data.Field=function(A){if(typeof A=="string"){A={name:A}}Roo.apply(this,A);if(!this.type){this.type="auto"}var st=Roo.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType]}if(!this.sortType){switch(this.type){case "string":this.sortType=st.asUCString;break;case "date":this.sortType=st.asDate;break;default:this.sortType=st.none}}var B=/[\$,%]/g;if(!this.convert){var cv,C=this.dateFormat;switch(this.type){case "":case "auto":case undefined:cv=function(v){return v};break;case "string":cv=function(v){return (v===undefined||v===null)?"":String(v)};break;case "int":cv=function(v){return v!==undefined&&v!==null&&v!==""?parseInt(String(v).replace(B,""),10):""};break;case "float":cv=function(v){return v!==undefined&&v!==null&&v!==""?parseFloat(String(v).replace(B,""),10):""};break;case "bool":case "boolean":cv=function(v){return v===true||v==="true"||v==1};break;case "date":cv=function(v){if(!v){return ""}if(v instanceof Date){return v}if(C){if(C=="timestamp"){return new Date(v*1000)}return Date.parseDate(v,C)}var D=Date.parse(v);return D?new Date(D):null};break}this.convert=cv}};Roo.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"};
-Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){da[c.name]="";});return new this.recordType(Roo.apply(da,d));
-}};
-Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable);
-Roo.data.MemoryProxy=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(C,D,F,B,A){C=C||{};var E;try{E=D.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,A,null,e);
-F.call(B,null,A,false);return;}F.call(B,E,A,true);},update:function(A,B){}});
-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(C,D,E,B,A){if(this.fireEvent("beforeload",this,C)!==false){var o={params:C||{},request:{callback:E,scope:B,arg:A},reader:D,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{E.call(B||this,null,A,false);}},loadResponse:function(o,B,C){delete this.activeRequest;
-if(!B){this.fireEvent("loadexception",this,o,C);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var A;try{A=o.reader.read(C);}catch(e){this.fireEvent("loadexception",this,o,C,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,A,o.request.arg,true);},update:function(A){},updateResponse:function(A){}});
-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(F,G,J,D,A){if(this.fireEvent("beforeload",this,F)!==false){var p=Roo.urlEncode(Roo.apply(F,this.extraParams));var B=this.url;B+=(B.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){B+="&_dc="+(new Date().getTime())}var I=++Roo.data.ScriptTagProxy.TRANS_ID;var E={id:I,cb:"stcCallback"+I,scriptId:"stcScript"+I,params:F,arg:A,url:B,callback:J,scope:D,reader:G};var C=this;window[E.cb]=function(o){C.handleResponse(o,E)};B+=String.format("&{0}={1}",this.callbackParam,E.cb);if(this.autoAbort!==false){this.abort()}E.timeoutId=this.handleFailure.defer(this.timeout,this,[E]);var H=document.createElement("script");H.setAttribute("src",B);H.setAttribute("type","text/javascript");H.setAttribute("id",E.scriptId);this.head.appendChild(H);this.trans=E}else{J.call(D||this,null,A,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=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,{read:function(response){var json=response.responseText;
-var o=eval("("+json+")");if(!o){throw {message:"JsonReader.read: Json object not found"};}if(o.metaData){delete this.ef;this.meta=o.metaData;this.recordType=Roo.data.Record.create(o.metaData.fields);this.onMetaChange(this.meta,this.recordType,o);}return this.readRecords(o);
-},onMetaChange:function(A,B,o){},simpleAccess:function(A,B){return A[B];},getJsonAccessor:function(){var re=/[\[\.]/;return function(A){try{return (re.test(A))?new Function("obj","return obj."+A):function(B){return B[A];};}catch(e){}return Roo.emptyFn;};}(),readRecords:function(o){this.jsonData=o;
-var s=this.meta,C=this.recordType,f=C.prototype.fields,fi=f.items,fl=f.length;if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);}if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);}this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;
-};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(I){var r=g(I);return (r===undefined||r==="")?null:r;};}else{this.getId=function(){return null;};}this.ef=[];for(var i=0;i<fl;i++){f=fi[i];var A=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;
-this.ef[i]=this.getJsonAccessor(A);}}var B=this.getRoot(o),c=B.length,H=c,G=true;if(s.totalProperty){var v=parseInt(this.getTotal(o),10);if(!isNaN(v)){H=v;}}if(s.successProperty){var v=this.getSuccess(o);if(v===false||v==="false"){G=false;}}var F=[];for(var i=0;
-i<c;i++){var n=B[i];var E={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);E[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var D=new C(E,id);D.json=n;F[i]=D;}return {success:G,records:F,totalRecords:H};}});
-Roo.data.XmlReader=function(A,B){A=A||{};Roo.data.XmlReader.superclass.constructor.call(this,A,B||A.fields)};Roo.extend(Roo.data.XmlReader,Roo.data.DataReader,{read:function(B){var A=B.responseXML;if(!A){throw {message:"XmlReader.read: XML Document not available"}}return this.readRecords(A)},readRecords:function(A){this.xmlData=A;var E=A.documentElement||A;var q=Roo.DomQuery;var K=this.recordType,F=K.prototype.fields;var C=this.meta.id;var L=0,J=true;if(this.meta.totalRecords){L=q.selectNumber(this.meta.totalRecords,E,0)}if(this.meta.success){var sv=q.selectValue(this.meta.success,E,true);J=sv!==false&&sv!=="false"}var I=[];var ns=q.select(this.meta.record,E);for(var i=0,B=ns.length;i<B;i++){var n=ns[i];var H={};var id=C?q.selectValue(C,n):undefined;for(var j=0,D=F.length;j<D;j++){var f=F.items[j];var v=q.selectValue(f.mapping||f.name,n,f.defaultValue);v=f.convert(v);H[f.name]=v}var G=new K(H,id);G.node=n;I[I.length]=G}return {success:J,records:I,totalRecords:L||I.length}}});
-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 H=this.recordType,D=H.prototype.fields;var G=[];var C=o;for(var i=0;i<C.length;i++){var n=C[i];var F={};var id=((A||A===0)&&n[A]!==undefined&&n[A]!==""?n[A]:null);for(var j=0,B=D.length;j<B;j++){var f=D.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 E=new H(F,id);E.json=n;G[G.length]=E}return {records:G,totalRecords:G.length}}});
-Roo.data.Tree=function(A){this.nodeHash={};this.root=null;if(A){this.setRootNode(A)}this.addEvents({"append":true,remove:true,move:true,insert:true,beforeappend:true,beforeremove:true,beforemove:true,beforeinsert:true});Roo.data.Tree.superclass.constructor.call(this)};Roo.extend(Roo.data.Tree,Roo.util.Observable,{pathSeparator:"/",proxyNodeEvent:function(){return this.fireEvent.apply(this,arguments)},getRootNode:function(){return this.root},setRootNode:function(A){this.root=A;A.ownerTree=this;A.isRoot=true;this.registerNode(A);return A},getNodeById:function(id){return this.nodeHash[id]},registerNode:function(A){this.nodeHash[A.id]=A},unregisterNode:function(A){delete this.nodeHash[A.id]},toString:function(){return "[Tree"+(this.id?" "+this.id:"")+"]"}});Roo.data.Node=function(A){this.attributes=A||{};this.leaf=this.attributes.leaf;this.id=this.attributes.id;if(!this.id){this.id=Roo.id(null,"ynode-");this.attributes.id=this.id}this.childNodes=[];if(!this.childNodes.indexOf){this.childNodes.indexOf=function(o){for(var i=0,B=this.length;i<B;i++){if(this[i]==o)return i}return -1}}this.parentNode=null;this.firstChild=null;this.lastChild=null;this.previousSibling=null;this.nextSibling=null;this.addEvents({"append":true,remove:true,move:true,insert:true,beforeappend:true,beforeremove:true,beforemove:true,beforeinsert:true});this.listeners=this.attributes.listeners;Roo.data.Node.superclass.constructor.call(this)};Roo.extend(Roo.data.Node,Roo.util.Observable,{fireEvent:function(A){if(Roo.data.Node.superclass.fireEvent.apply(this,arguments)===false){return false}var ot=this.getOwnerTree();if(ot){if(ot.proxyNodeEvent.apply(ot,arguments)===false){return false}}return true},isLeaf:function(){return this.leaf===true},setFirstChild:function(A){this.firstChild=A},setLastChild:function(A){this.lastChild=A},isLast:function(){return (!this.parentNode?true:this.parentNode.lastChild==this)},isFirst:function(){return (!this.parentNode?true:this.parentNode.firstChild==this)},hasChildNodes:function(){return !this.isLeaf()&&this.childNodes.length>0},appendChild:function(B){var D=false;if(B instanceof Array){D=B}else if(arguments.length>1){D=arguments}if(D){for(var i=0,A=D.length;i<A;i++){this.appendChild(D[i])}}else{if(this.fireEvent("beforeappend",this.ownerTree,this,B)===false){return false}var C=this.childNodes.length;var E=B.parentNode;if(E){if(B.fireEvent("beforemove",B.getOwnerTree(),B,E,this,C)===false){return false}E.removeChild(B)}C=this.childNodes.length;if(C==0){this.setFirstChild(B)}this.childNodes.push(B);B.parentNode=this;var ps=this.childNodes[C-1];if(ps){B.previousSibling=ps;ps.nextSibling=B}else{B.previousSibling=null}B.nextSibling=null;this.setLastChild(B);B.setOwnerTree(this.getOwnerTree());this.fireEvent("append",this.ownerTree,this,B,C);if(E){B.fireEvent("move",this.ownerTree,B,E,this,C)}return B}},removeChild:function(A){var B=this.childNodes.indexOf(A);if(B==-1){return false}if(this.fireEvent("beforeremove",this.ownerTree,this,A)===false){return false}this.childNodes.splice(B,1);if(A.previousSibling){A.previousSibling.nextSibling=A.nextSibling}if(A.nextSibling){A.nextSibling.previousSibling=A.previousSibling}if(this.firstChild==A){this.setFirstChild(A.nextSibling)}if(this.lastChild==A){this.setLastChild(A.previousSibling)}A.setOwnerTree(null);A.parentNode=null;A.previousSibling=null;A.nextSibling=null;this.fireEvent("remove",this.ownerTree,this,A);return A},insertBefore:function(A,C){if(!C){return this.appendChild(A)}if(A==C){return false}if(this.fireEvent("beforeinsert",this.ownerTree,this,A,C)===false){return false}var B=this.childNodes.indexOf(C);var E=A.parentNode;var D=B;if(E==this&&this.childNodes.indexOf(A)<B){D--}if(E){if(A.fireEvent("beforemove",A.getOwnerTree(),A,E,this,B,C)===false){return false}E.removeChild(A)}if(D==0){this.setFirstChild(A)}this.childNodes.splice(D,0,A);A.parentNode=this;var ps=this.childNodes[D-1];if(ps){A.previousSibling=ps;ps.nextSibling=A}else{A.previousSibling=null}A.nextSibling=C;C.previousSibling=A;A.setOwnerTree(this.getOwnerTree());this.fireEvent("insert",this.ownerTree,this,A,C);if(E){A.fireEvent("move",this.ownerTree,A,E,this,D,C)}return A},item:function(A){return this.childNodes[A]},replaceChild:function(A,B){this.insertBefore(A,B);this.removeChild(B);return B},indexOf:function(A){return this.childNodes.indexOf(A)},getOwnerTree:function(){if(!this.ownerTree){var p=this;while(p){if(p.ownerTree){this.ownerTree=p.ownerTree;break}p=p.parentNode}}return this.ownerTree},getDepth:function(){var A=0;var p=this;while(p.parentNode){++A;p=p.parentNode}return A},setOwnerTree:function(B){if(B!=this.ownerTree){if(this.ownerTree){this.ownerTree.unregisterNode(this)}this.ownerTree=B;var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].setOwnerTree(B)}if(B){B.registerNode(this)}}},getPath:function(B){B=B||"id";var p=this.parentNode;var b=[this.attributes[B]];while(p){b.unshift(p.attributes[B]);p=p.parentNode}var A=this.getOwnerTree().pathSeparator;return A+b.join(A)},bubble:function(fn,B,A){var p=this;while(p){if(fn.call(B||p,A||p)===false){break}p=p.parentNode}},cascade:function(fn,C,B){if(fn.call(C||this,B||this)!==false){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].cascade(fn,C,B)}}},eachChild:function(fn,C,B){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){if(fn.call(C||this,B||cs[i])===false){break}}},findChild:function(C,B){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){if(cs[i].attributes[C]==B){return cs[i]}}return null},findChildBy:function(fn,B){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){if(fn.call(B||cs[i],cs[i])===true){return cs[i]}}return null},sort:function(fn,B){var cs=this.childNodes;var A=cs.length;if(A>0){var C=B?function(){fn.apply(B,arguments)}:fn;cs.sort(C);for(var i=0;i<A;i++){var n=cs[i];n.previousSibling=cs[i-1];n.nextSibling=cs[i+1];if(i==0){this.setFirstChild(n)}if(i==A-1){this.setLastChild(n)}}}},contains:function(A){return A.isAncestor(this)},isAncestor:function(A){var p=this.parentNode;while(p){if(p==A){return true}p=p.parentNode}return false},toString:function(){return "[Node"+(this.id?" "+this.id:"")+"]"}});
-Roo.ComponentMgr=function(){var A=new Roo.util.MixedCollection();return {register:function(c){A.add(c)},unregister:function(c){A.remove(c)},get:function(id){return A.get(id)},onAvailable:function(id,fn,B){A.on("add",function(C,o){if(o.id==id){fn.call(B||o,o);A.un("add",fn,B)}})}}}();
-Roo.Component=function(A){A=A||{};if(A.tagName||A.dom||typeof A=="string"){A={el:A,id:A.id||A};}this.initialConfig=A;Roo.apply(this,A);this.addEvents({disable:true,enable:true,beforeshow:true,show:true,beforehide:true,hide:true,beforerender:true,render:true,beforedestroy:true,destroy:true});
-if(!this.id){this.id="ext-comp-"+(++Roo.Component.AUTO_ID);}Roo.ComponentMgr.register(this);Roo.Component.superclass.constructor.call(this);this.initComponent();if(this.renderTo){this.render(this.renderTo);delete this.renderTo;}};Roo.Component.AUTO_ID=1000;
-Roo.extend(Roo.Component,Roo.util.Observable,{hidden:false,disabled:false,rendered:false,disabledClass:"x-item-disabled",allowDomMove:true,hideMode:"display",ctype:"Roo.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initComponent:Roo.emptyFn,render:function(B,A){if(!this.rendered&&this.fireEvent("beforerender",this)!==false){if(!B&&this.el){this.el=Roo.get(this.el);
-B=this.el.dom.parentNode;this.allowDomMove=false;}this.container=Roo.get(B);this.rendered=true;if(A!==undefined){if(typeof A=="number"){A=this.container.dom.childNodes[A];}else{A=Roo.getDom(A);}}this.onRender(this.container,A||null);if(this.cls){this.el.addClass(this.cls);
-delete this.cls;}if(this.style){this.el.applyStyles(this.style);delete this.style;}this.fireEvent("render",this);this.afterRender(this.container);if(this.hidden){this.hide();}if(this.disabled){this.disable();}}return this;},onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);
-if(this.allowDomMove!==false){ct.dom.insertBefore(this.el.dom,A);}}},getAutoCreate:function(){var A=typeof this.autoCreate=="object"?this.autoCreate:Roo.apply({},this.defaultAutoCreate);if(this.id&&!A.id){A.id=this.id;}return A;},afterRender:Roo.emptyFn,destroy:function(){if(this.fireEvent("beforedestroy",this)!==false){this.purgeListeners();
-this.beforeDestroy();if(this.rendered){this.el.removeAllListeners();this.el.remove();if(this.actionMode=="container"){this.container.remove();}}this.onDestroy();Roo.ComponentMgr.unregister(this);this.fireEvent("destroy",this);}},beforeDestroy:function(){},onDestroy:function(){},getEl:function(){return this.el;
-},getId:function(){return this.id;},focus:function(A){if(this.rendered){this.el.focus();if(A===true){this.el.dom.select();}}return this;},blur:function(){if(this.rendered){this.el.blur();}return this;},disable:function(){if(this.rendered){this.onDisable();
-}this.disabled=true;this.fireEvent("disable",this);return this;},onDisable:function(){this.getActionEl().addClass(this.disabledClass);this.el.dom.disabled=true;},enable:function(){if(this.rendered){this.onEnable();}this.disabled=false;this.fireEvent("enable",this);
-return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);this.el.dom.disabled=false;},setDisabled:function(A){this[A?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;if(this.rendered){this.onShow();
-}this.fireEvent("show",this);}return this;},onShow:function(){var ae=this.getActionEl();if(this.hideMode=="visibility"){ae.dom.style.visibility="visible";}else if(this.hideMode=="offsets"){ae.removeClass("x-hidden");}else{ae.dom.style.display="";}},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;
-if(this.rendered){this.onHide();}this.fireEvent("hide",this);}return this;},onHide:function(){var ae=this.getActionEl();if(this.hideMode=="visibility"){ae.dom.style.visibility="hidden";}else if(this.hideMode=="offsets"){ae.addClass("x-hidden");}else{ae.dom.style.display="none";
-}},setVisible:function(A){if(A){this.show();}else{this.hide();}return this;},isVisible:function(){return this.getActionEl().isVisible();},cloneConfig:function(B){B=B||{};var id=B.id||Roo.id();var A=Roo.applyIf(B,this.initialConfig);A.id=id;return new this.constructor(A);
-}});
-(function(){Roo.Layer=function(D,E){D=D||{};var dh=Roo.DomHelper;var cp=D.parentEl,C=cp?Roo.getDom(cp):document.body;if(E){this.dom=Roo.getDom(E)}if(!this.dom){var o=D.dh||{tag:"div",cls:"x-layer"};this.dom=dh.append(C,o)}if(D.cls){this.addClass(D.cls)}this.constrain=D.constrain!==false;this.visibilityMode=Roo.Element.VISIBILITY;if(D.id){this.id=this.dom.id=D.id}else{this.id=Roo.id(this.dom)}this.zindex=D.zindex||this.getZIndex();this.position("absolute",this.zindex);if(D.shadow){this.shadowOffset=D.shadowOffset||4;this.shadow=new Roo.Shadow({offset:this.shadowOffset,mode:D.shadow})}else{this.shadowOffset=0}this.useShim=D.shim!==false&&Roo.useShims;this.useDisplay=D.useDisplay;this.hide()};var A=Roo.Element.prototype;var B=[];Roo.extend(Roo.Layer,Roo.Element,{getZIndex:function(){return this.zindex||parseInt(this.getStyle("z-index"),10)||11000},getShim:function(){if(!this.useShim){return null}if(this.shim){return this.shim}var C=B.shift();if(!C){C=this.createShim();C.enableDisplayMode("block");C.dom.style.display="none";C.dom.style.visibility="visible"}var pn=this.dom.parentNode;if(C.dom.parentNode!=pn){pn.insertBefore(C.dom,this.dom)}C.setStyle("z-index",this.getZIndex()-2);this.shim=C;return C},hideShim:function(){if(this.shim){this.shim.setDisplayed(false);B.push(this.shim);delete this.shim}},disableShadow:function(){if(this.shadow){this.shadowDisabled=true;this.shadow.hide();this.lastShadowOffset=this.shadowOffset;this.shadowOffset=0}},enableShadow:function(C){if(this.shadow){this.shadowDisabled=false;this.shadowOffset=this.lastShadowOffset;delete this.lastShadowOffset;if(C){this.sync(true)}}},sync:function(C){var sw=this.shadow;if(!this.updating&&this.isVisible()&&(sw||this.useShim)){var sh=this.getShim();var w=this.getWidth(),h=this.getHeight();var l=this.getLeft(true),t=this.getTop(true);if(sw&&!this.shadowDisabled){if(C&&!sw.isVisible()){sw.show(this)}else{sw.realign(l,t,w,h)}if(sh){if(C){sh.show()}var a=sw.adjusts,s=sh.dom.style;s.left=(Math.min(l,l+a.l))+"px";s.top=(Math.min(t,t+a.t))+"px";s.width=(w+a.w)+"px";s.height=(h+a.h)+"px"}}else if(sh){if(C){sh.show()}sh.setSize(w,h);sh.setLeftTop(l,t)}}},destroy:function(){this.hideShim();if(this.shadow){this.shadow.hide()}this.removeAllListeners();var pn=this.dom.parentNode;if(pn){pn.removeChild(this.dom)}Roo.Element.uncache(this.id)},remove:function(){this.destroy()},beginUpdate:function(){this.updating=true},endUpdate:function(){this.updating=false;this.sync(true)},hideUnders:function(C){if(this.shadow){this.shadow.hide()}this.hideShim()},constrainXY:function(){if(this.constrain){var vw=Roo.lib.Dom.getViewWidth(),vh=Roo.lib.Dom.getViewHeight();var s=Roo.get(document).getScroll();var xy=this.getXY();var x=xy[0],y=xy[1];var w=this.dom.offsetWidth+this.shadowOffset,h=this.dom.offsetHeight+this.shadowOffset;var C=false;if((x+w)>vw+s.left){x=vw-w-this.shadowOffset;C=true}if((y+h)>vh+s.top){y=vh-h-this.shadowOffset;C=true}if(x<s.left){x=s.left;C=true}if(y<s.top){y=s.top;C=true}if(C){if(this.avoidY){var ay=this.avoidY;if(y<=ay&&(y+h)>=ay){y=ay-h-5}}xy=[x,y];this.storeXY(xy);A.setXY.call(this,xy);this.sync()}}},isVisible:function(){return this.visible},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("")}else if(this.lastXY){A.setXY.call(this,this.lastXY)}else if(this.lastLT){A.setLeftTop.call(this,this.lastLT[0],this.lastLT[1])}},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false)}else{this.setLeftTop(-10000,-10000)}},setVisible:function(v,a,d,c,e){if(v){this.showAction()}if(a&&v){var cb=function(){this.sync(true);if(c){c()}}.createDelegate(this);A.setVisible.call(this,true,true,d,cb,e)}else{if(!v){this.hideUnders(true)}var cb=c;if(a){cb=function(){this.hideAction();if(c){c()}}.createDelegate(this)}A.setVisible.call(this,v,a,d,cb,e);if(v){this.sync(true)}else if(!a){this.hideAction()}}},storeXY:function(xy){delete this.lastLT;this.lastXY=xy},storeLeftTop:function(D,C){delete this.lastXY;this.lastLT=[D,C]},beforeFx:function(){this.beforeAction();return Roo.Layer.superclass.beforeFx.apply(this,arguments)},afterFx:function(){Roo.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible())},beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide()}},setLeft:function(C){this.storeLeftTop(C,this.getTop(true));A.setLeft.apply(this,arguments);this.sync()},setTop:function(C){this.storeLeftTop(this.getLeft(true),C);A.setTop.apply(this,arguments);this.sync()},setLeftTop:function(D,C){this.storeLeftTop(D,C);A.setLeftTop.apply(this,arguments);this.sync()},setXY:function(xy,a,d,c,e){this.fixDisplay();this.beforeAction();this.storeXY(xy);var cb=this.createCB(c);A.setXY.call(this,xy,a,d,cb,e);if(!a){cb()}},createCB:function(c){var el=this;return function(){el.constrainXY();el.sync(true);if(c){c()}}},setX:function(x,a,d,c,e){this.setXY([x,this.getY()],a,d,c,e)},setY:function(y,a,d,c,e){this.setXY([this.getX(),y],a,d,c,e)},setSize:function(w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setSize.call(this,w,h,a,d,cb,e);if(!a){cb()}},setWidth:function(w,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setWidth.call(this,w,a,d,cb,e);if(!a){cb()}},setHeight:function(h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setHeight.call(this,h,a,d,cb,e);if(!a){cb()}},setBounds:function(x,y,w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);if(!a){this.storeXY([x,y]);A.setXY.call(this,[x,y]);A.setSize.call(this,w,h,a,d,cb,e);cb()}else{A.setBounds.call(this,x,y,w,h,a,d,cb,e)}return this},setZIndex:function(C){this.zindex=C;this.setStyle("z-index",C+2);if(this.shadow){this.shadow.setZIndex(C+1)}if(this.shim){this.shim.setStyle("z-index",C)}}})})();
-Roo.Shadow=function(B){Roo.apply(this,B);if(typeof this.mode!="string"){this.mode=this.defaultMode}var o=this.offset,a={h:0};var A=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case "drop":a.w=0;a.l=a.t=o;a.t-=1;if(Roo.isIE){a.l-=this.offset+A;a.t-=this.offset+A;a.w-=A;a.h-=A;a.t+=1}break;case "sides":a.w=(o*2);a.l=-o;a.t=o-1;if(Roo.isIE){a.l-=(this.offset-A);a.t-=this.offset+A;a.l+=1;a.w-=(this.offset-A)*2;a.w-=A+1;a.h-=1}break;case "frame":a.w=a.h=(o*2);a.l=a.t=-o;a.t+=1;a.h-=2;if(Roo.isIE){a.l-=(this.offset-A);a.t-=(this.offset-A);a.l+=1;a.w-=(this.offset+A+1);a.h-=(this.offset+A);a.h+=1}break};this.adjusts=a};Roo.Shadow.prototype={offset:4,defaultMode:"drop",show:function(A){A=Roo.get(A);if(!this.el){this.el=Roo.Shadow.Pool.pull();if(this.el.dom.nextSibling!=A.dom){this.el.insertBefore(A)}}this.el.setStyle("z-index",this.zIndex||parseInt(A.getStyle("z-index"),10)-1);if(Roo.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")"}this.realign(A.getLeft(true),A.getTop(true),A.getWidth(),A.getHeight());this.el.dom.style.display="block"},isVisible:function(){return this.el?true:false},realign:function(l,t,w,h){if(!this.el){return}var a=this.adjusts,d=this.el.dom,s=d.style;var A=0;s.left=(l+a.l)+"px";s.top=(t+a.t)+"px";var sw=(w+a.w),sh=(h+a.h),C=sw+"px",B=sh+"px";if(s.width!=C||s.height!=B){s.width=C;s.height=B;if(!Roo.isIE){var cn=d.childNodes;var D=Math.max(0,(sw-12))+"px";cn[0].childNodes[1].style.width=D;cn[1].childNodes[1].style.width=D;cn[2].childNodes[1].style.width=D;cn[1].style.height=Math.max(0,(sh-12))+"px"}}},hide:function(){if(this.el){this.el.dom.style.display="none";Roo.Shadow.Pool.push(this.el);delete this.el}},setZIndex:function(z){this.zIndex=z;if(this.el){this.el.setStyle("z-index",z)}}};Roo.Shadow.Pool=function(){var p=[];var A=Roo.isIE?"<div class=\"x-ie-shadow\"></div>":"<div class=\"x-shadow\"><div class=\"xst\"><div class=\"xstl\"></div><div class=\"xstc\"></div><div class=\"xstr\"></div></div><div class=\"xsc\"><div class=\"xsml\"></div><div class=\"xsmc\"></div><div class=\"xsmr\"></div></div><div class=\"xsb\"><div class=\"xsbl\"></div><div class=\"xsbc\"></div><div class=\"xsbr\"></div></div></div>";return {pull:function(){var sh=p.shift();if(!sh){sh=Roo.get(Roo.DomHelper.insertHtml("beforeBegin",document.body.firstChild,A));sh.autoBoxAdjust=false}return sh},push:function(sh){p.push(sh)}}}();
-Roo.BoxComponent=function(A){Roo.Component.call(this,A);this.addEvents({resize:true,move:true});};Roo.extend(Roo.BoxComponent,Roo.Component,{boxReady:false,deferHeight:false,setSize:function(w,h){if(typeof w=="object"){h=w.height;w=w.width;}if(!this.boxReady){this.width=w;
-this.height=h;return this;}if(this.lastSize&&this.lastSize.width==w&&this.lastSize.height==h){return this;}this.lastSize={width:w,height:h};var A=this.adjustSize(w,h);var aw=A.width,ah=A.height;if(aw!==undefined||ah!==undefined){var rz=this.getResizeEl();
-if(!this.deferHeight&&aw!==undefined&&ah!==undefined){rz.setSize(aw,ah);}else if(!this.deferHeight&&ah!==undefined){rz.setHeight(ah);}else if(aw!==undefined){rz.setWidth(aw);}this.onResize(aw,ah,w,h);this.fireEvent("resize",this,aw,ah,w,h);}return this;},getSize:function(){return this.el.getSize();
-},getPosition:function(A){if(A===true){return [this.el.getLeft(true),this.el.getTop(true)];}return this.xy||this.el.getXY();},getBox:function(A){var s=this.el.getSize();if(A){s.x=this.el.getLeft(true);s.y=this.el.getTop(true);}else{var xy=this.xy||this.el.getXY();
-s.x=xy[0];s.y=xy[1];}return s;},updateBox:function(A){this.setSize(A.width,A.height);this.setPagePosition(A.x,A.y);return this;},getResizeEl:function(){return this.resizeEl||this.el;},getPositionEl:function(){return this.positionEl||this.el;},setPosition:function(x,y){this.x=x;
-this.y=y;if(!this.boxReady){return this;}var A=this.adjustPosition(x,y);var ax=A.x,ay=A.y;var el=this.getPositionEl();if(ax!==undefined||ay!==undefined){if(ax!==undefined&&ay!==undefined){el.setLeftTop(ax,ay);}else if(ax!==undefined){el.setLeft(ax);}else if(ay!==undefined){el.setTop(ay);
-}this.onPosition(ax,ay);this.fireEvent("move",this,ax,ay);}return this;},setPagePosition:function(x,y){this.pageX=x;this.pageY=y;if(!this.boxReady){return;}if(x===undefined||y===undefined){return;}var p=this.el.translatePoints(x,y);this.setPosition(p.left,p.top);
-return this;},onRender:function(ct,A){Roo.BoxComponent.superclass.onRender.call(this,ct,A);if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl);}if(this.positionEl){this.positionEl=Roo.get(this.positionEl);}},afterRender:function(){Roo.BoxComponent.superclass.afterRender.call(this);
-this.boxReady=true;this.setSize(this.width,this.height);if(this.x||this.y){this.setPosition(this.x,this.y);}if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY);}},syncSize:function(){delete this.lastSize;this.setSize(this.el.getWidth(),this.el.getHeight());
-return this;},onResize:function(A,C,B,D){},onPosition:function(x,y){},adjustSize:function(w,h){if(this.autoWidth){w="auto";}if(this.autoHeight){h="auto";}return {width:w,height:h};},adjustPosition:function(x,y){return {x:x,y:y};}});
-Roo.SplitBar=function(B,E,C,A,D){this.el=Roo.get(B,true);this.el.dom.unselectable="on";this.resizingEl=Roo.get(E,true);this.orientation=C||Roo.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!D){this.proxy=Roo.SplitBar.createProxy(this.orientation)}else{this.proxy=Roo.get(D).dom}this.dd=new Roo.dd.DDProxy(this.el.dom.id,"XSplitBars",{dragElId:this.proxy.id});this.dd.b4StartDrag=this.onStartProxyDrag.createDelegate(this);this.dd.endDrag=this.onEndProxyDrag.createDelegate(this);this.dragSpecs={};this.adapter=new Roo.SplitBar.BasicLayoutAdapter();this.adapter.init(this);if(this.orientation==Roo.SplitBar.HORIZONTAL){this.placement=A||(this.el.getX()>this.resizingEl.getX()?Roo.SplitBar.LEFT:Roo.SplitBar.RIGHT);this.el.addClass("x-splitbar-h")}else{this.placement=A||(this.el.getY()>this.resizingEl.getY()?Roo.SplitBar.TOP:Roo.SplitBar.BOTTOM);this.el.addClass("x-splitbar-v")}this.addEvents({"resize":true,moved:true,beforeresize:true,beforeapply:true});Roo.util.Observable.call(this)};Roo.extend(Roo.SplitBar,Roo.util.Observable,{onStartProxyDrag:function(x,y){this.fireEvent("beforeresize",this);if(!this.overlay){var o=Roo.DomHelper.insertFirst(document.body,{cls:"x-drag-overlay",html:"&#160;"},true);o.unselectable();o.enableDisplayMode("block");Roo.SplitBar.prototype.overlay=o}this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.overlay.show();Roo.get(this.proxy).setDisplayed("block");var A=this.adapter.getElementSize(this);this.activeMinSize=this.getMinimumSize();;this.activeMaxSize=this.getMaximumSize();;var c1=A-this.activeMinSize;var c2=Math.max(this.activeMaxSize-A,0);if(this.orientation==Roo.SplitBar.HORIZONTAL){this.dd.resetConstraints();this.dd.setXConstraint(this.placement==Roo.SplitBar.LEFT?c1:c2,this.placement==Roo.SplitBar.LEFT?c2:c1);this.dd.setYConstraint(0,0)}else{this.dd.resetConstraints();this.dd.setXConstraint(0,0);this.dd.setYConstraint(this.placement==Roo.SplitBar.TOP?c1:c2,this.placement==Roo.SplitBar.TOP?c2:c1)}this.dragSpecs.startSize=A;this.dragSpecs.startPoint=[x,y];Roo.dd.DDProxy.prototype.b4StartDrag.call(this.dd,x,y)},onEndProxyDrag:function(e){Roo.get(this.proxy).setDisplayed(false);var B=Roo.lib.Event.getXY(e);if(this.overlay){this.overlay.hide()}var A;if(this.orientation==Roo.SplitBar.HORIZONTAL){A=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.LEFT?B[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-B[0])}else{A=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.TOP?B[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-B[1])}A=Math.min(Math.max(A,this.activeMinSize),this.activeMaxSize);if(A!=this.dragSpecs.startSize){if(this.fireEvent("beforeapply",this,A)!==false){this.adapter.setElementSize(this,A);this.fireEvent("moved",this,A);this.fireEvent("resize",this,A)}}},getAdapter:function(){return this.adapter},setAdapter:function(A){this.adapter=A;this.adapter.init(this)},getMinimumSize:function(){return this.minSize},setMinimumSize:function(A){this.minSize=A},getMaximumSize:function(){return this.maxSize},setMaximumSize:function(A){this.maxSize=A},setCurrentSize:function(A){var B=this.animate;this.animate=false;this.adapter.setElementSize(this,A);this.animate=B},destroy:function(A){if(this.shim){this.shim.remove()}this.dd.unreg();this.proxy.parentNode.removeChild(this.proxy);if(A){this.el.remove()}}});Roo.SplitBar.createProxy=function(B){var C=new Roo.Element(document.createElement("div"));C.unselectable();var A="x-splitbar-proxy";C.addClass(A+" "+(B==Roo.SplitBar.HORIZONTAL?A+"-h":A+"-v"));document.body.appendChild(C.dom);return C.dom};Roo.SplitBar.BasicLayoutAdapter=function(){};Roo.SplitBar.BasicLayoutAdapter.prototype={init:function(s){},getElementSize:function(s){if(s.orientation==Roo.SplitBar.HORIZONTAL){return s.resizingEl.getWidth()}else{return s.resizingEl.getHeight()}},setElementSize:function(s,A,B){if(s.orientation==Roo.SplitBar.HORIZONTAL){if(!s.animate){s.resizingEl.setWidth(A);if(B){B(s,A)}}else{s.resizingEl.setWidth(A,true,0.1,B,"easeOut")}}else{if(!s.animate){s.resizingEl.setHeight(A);if(B){B(s,A)}}else{s.resizingEl.setHeight(A,true,0.1,B,"easeOut")}}}};Roo.SplitBar.AbsoluteLayoutAdapter=function(A){this.basic=new Roo.SplitBar.BasicLayoutAdapter();this.container=Roo.get(A)};Roo.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(s){this.basic.init(s)},getElementSize:function(s){return this.basic.getElementSize(s)},setElementSize:function(s,A,B){this.basic.setElementSize(s,A,this.moveSplitter.createDelegate(this,[s]))},moveSplitter:function(s){var A=Roo.SplitBar;switch(s.placement){case A.LEFT:s.el.setX(s.resizingEl.getRight());break;case A.RIGHT:s.el.setStyle("right",(this.container.getWidth()-s.resizingEl.getLeft())+"px");break;case A.TOP:s.el.setY(s.resizingEl.getBottom());break;case A.BOTTOM:s.el.setY(s.resizingEl.getTop()-s.el.getHeight());break}}};Roo.SplitBar.VERTICAL=1;Roo.SplitBar.HORIZONTAL=2;Roo.SplitBar.LEFT=1;Roo.SplitBar.RIGHT=2;Roo.SplitBar.TOP=3;Roo.SplitBar.BOTTOM=4;
-Roo.View=function(C,A,B){this.el=Roo.get(C);if(typeof A=="string"){A=new Roo.Template(A)}A.compile();this.tpl=A;Roo.apply(this,B);this.addEvents({"beforeclick":true,click:true,dblclick:true,contextmenu:true,selectionchange:true,beforeselect:true});this.el.on({"click":this.onClick,dblclick:this.onDblClick,contextmenu:this.onContextMenu,scope:this});this.selections=[];this.nodes=[];this.cmp=new Roo.CompositeElementLite([]);if(this.store){this.store=Roo.factory(this.store,Roo.data);this.setStore(this.store,true)}Roo.View.superclass.constructor.call(this)};Roo.extend(Roo.View,Roo.util.Observable,{selectedClass:"x-view-selected",emptyText:"",getEl:function(){return this.el},refresh:function(){var t=this.tpl;this.clearSelections();this.el.update("");var C=[];var D=this.store.getRange();if(D.length<1){this.el.update(this.emptyText);return}for(var i=0,A=D.length;i<A;i++){var B=this.prepareData(D[i].data,i,D[i]);C[C.length]=t.apply(B)}this.el.update(C.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0)},prepareData:function(A){return A},onUpdate:function(ds,B){this.clearSelections();var A=this.store.indexOf(B);var n=this.nodes[A];this.tpl.insertBefore(n,this.prepareData(B.data));n.parentNode.removeChild(n);this.updateIndexes(A,A)},onAdd:function(ds,C,B){this.clearSelections();if(this.nodes.length==0){this.refresh();return}var n=this.nodes[B];for(var i=0,A=C.length;i<A;i++){var d=this.prepareData(C[i].data);if(n){this.tpl.insertBefore(n,d)}else{this.tpl.append(this.el,d)}}this.updateIndexes(B)},onRemove:function(ds,B,A){this.clearSelections();this.el.dom.removeChild(this.nodes[A]);this.updateIndexes(A)},refreshNode:function(A){this.onUpdate(this.store,this.store.getAt(A))},updateIndexes:function(B,A){var ns=this.nodes;B=B||0;A=A||ns.length-1;for(var i=B;i<=A;i++){ns[i].nodeIndex=i}},setStore:function(A,B){if(!B&&this.store){this.store.un("datachanged",this.refresh);this.store.un("add",this.onAdd);this.store.un("remove",this.onRemove);this.store.un("update",this.onUpdate);this.store.un("clear",this.refresh)}if(A){A.on("datachanged",this.refresh,this);A.on("add",this.onAdd,this);A.on("remove",this.onRemove,this);A.on("update",this.onUpdate,this);A.on("clear",this.refresh,this)}if(A){this.refresh()}},findItemFromChild:function(A){var el=this.el.dom;if(!A||A.parentNode==el){return A}var p=A.parentNode;while(p&&p!=el){if(p.parentNode==el){return p}p=p.parentNode}return null},onClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){var B=this.indexOf(A);if(this.onItemClick(A,B,e)!==false){this.fireEvent("click",this,B,A,e)}}else{this.clearSelections()}},onContextMenu:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.fireEvent("contextmenu",this,this.indexOf(A),A,e)}},onDblClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.fireEvent("dblclick",this,this.indexOf(A),A,e)}},onItemClick:function(A,B,e){if(this.fireEvent("beforeclick",this,B,A,e)===false){return false}if(this.multiSelect||this.singleSelect){if(this.multiSelect&&e.shiftKey&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),B),false)}else{this.select(A,this.multiSelect&&e.ctrlKey);this.lastSelection=A}e.preventDefault()}return true},getSelectionCount:function(){return this.selections.length},getSelectedNodes:function(){return this.selections},getSelectedIndexes:function(){var B=[],s=this.selections;for(var i=0,A=s.length;i<A;i++){B.push(s[i].nodeIndex)}return B},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(C,D,E){if(C instanceof Array){if(!D){this.clearSelections(true)}for(var i=0,A=C.length;i<A;i++){this.select(C[i],true,true)}}else{var B=this.getNode(C);if(B&&!this.isSelected(B)){if(!D){this.clearSelections(true)}if(this.fireEvent("beforeselect",this,B,this.selections)!==false){Roo.fly(B).addClass(this.selectedClass);this.selections.push(B);if(!E){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(C,A){var ns=this.nodes;C=C||0;A=typeof A=="undefined"?ns.length-1:A;var B=[];if(C<=A){for(var i=C;i<=A;i++){B.push(ns[i])}}else{for(var i=C;i>=A;i--){B.push(ns[i])}}return B},indexOf:function(B){B=this.getNode(B);if(typeof B.nodeIndex=="number"){return B.nodeIndex}var ns=this.nodes;for(var i=0,A=ns.length;i<A;i++){if(ns[i]==B){return i}}return -1}});
-Roo.JsonView=function(C,A,B){Roo.JsonView.superclass.constructor.call(this,C,A,B);var um=this.el.getUpdateManager();um.setRenderer(this);um.on("update",this.onLoad,this);um.on("failure",this.onLoadException,this);this.addEvents({"beforerender":true,load:true,loadexception:true})};Roo.extend(Roo.JsonView,Roo.View,{jsonRoot:"",refresh:function(){this.clearSelections();this.el.update("");var C=[];var o=this.jsonData;if(o&&o.length>0){for(var i=0,A=o.length;i<A;i++){var B=this.prepareData(o[i],i,o);C[C.length]=this.tpl.apply(B)}}else{C.push(this.emptyText)}this.el.update(C.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0)},load:function(){var um=this.el.getUpdateManager();um.update.apply(um,arguments)},render:function(el,A){this.clearSelections();this.el.update("");var o;try{o=Roo.util.JSON.decode(A.responseText);if(this.jsonRoot){o=eval("o."+this.jsonRoot)}}catch(e){}this.jsonData=o;this.beforeRender();this.refresh()},getCount:function(){return this.jsonData?this.jsonData.length:0},getNodeData:function(C){if(C instanceof Array){var B=[];for(var i=0,A=C.length;i<A;i++){B.push(this.getNodeData(C[i]))}return B}return this.jsonData[this.indexOf(C)]||null},beforeRender:function(){this.snapshot=this.jsonData;if(this.sortInfo){this.sort.apply(this,this.sortInfo)}this.fireEvent("beforerender",this,this.jsonData)},onLoad:function(el,o){this.fireEvent("load",this,this.jsonData,o)},onLoadException:function(el,o){this.fireEvent("loadexception",this,o)},filter:function(E,D){if(this.jsonData){var B=[];var ss=this.snapshot;if(typeof D=="string"){var C=D.length;if(C==0){this.clearFilter();return}D=D.toLowerCase();for(var i=0,A=ss.length;i<A;i++){var o=ss[i];if(o[E].substr(0,C).toLowerCase()==D){B.push(o)}}}else if(D.exec){for(var i=0,A=ss.length;i<A;i++){var o=ss[i];if(D.test(o[E])){B.push(o)}}}else{return}this.jsonData=B;this.refresh()}},filterBy:function(fn,C){if(this.jsonData){var B=[];var ss=this.snapshot;for(var i=0,A=ss.length;i<A;i++){var o=ss[i];if(fn.call(C||this,o)){B.push(o)}}this.jsonData=B;this.refresh()}},clearFilter:function(){if(this.snapshot&&this.jsonData!=this.snapshot){this.jsonData=this.snapshot;this.refresh()}},sort:function(C,A,D){this.sortInfo=Array.prototype.slice.call(arguments,0);if(this.jsonData){var p=C;var B=A&&A.toLowerCase()=="desc";var f=function(o1,o2){var v1=D?D(o1[p]):o1[p];var v2=D?D(o2[p]):o2[p];;if(v1<v2){return B?+1:-1}else if(v1>v2){return B?-1:+1}else{return 0}};this.jsonData.sort(f);this.refresh();if(this.jsonData!=this.snapshot){this.snapshot.sort(f)}}}});
-Roo.ColorPalette=function(A){Roo.ColorPalette.superclass.constructor.call(this,A);this.addEvents({select:true});if(this.handler){this.on("select",this.handler,this.scope,true)}};Roo.extend(Roo.ColorPalette,Roo.Component,{itemCls:"x-color-palette",value:null,clickEvent:"click",ctype:"Roo.ColorPalette",allowReselect:false,colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","008000","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","969696","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","99CCFF","CC99FF","FFFFFF"],onRender:function(C,B){var t=new Roo.MasterTemplate("<tpl><a href=\"#\" class=\"color-{0}\" hidefocus=\"on\"><em><span style=\"background:#{0}\" unselectable=\"on\">&#160;</span></em></a></tpl>");var c=this.colors;for(var i=0,A=c.length;i<A;i++){t.add([c[i]])}var el=document.createElement("div");el.className=this.itemCls;t.overwrite(el);C.dom.insertBefore(el,B);this.el=Roo.get(el);this.el.on(this.clickEvent,this.handleClick,this,{delegate:"a"});if(this.clickEvent!="click"){this.el.on("click",Roo.emptyFn,this,{delegate:"a",preventDefault:true})}},afterRender:function(){Roo.ColorPalette.superclass.afterRender.call(this);if(this.value){var s=this.value;this.value=null;this.select(s)}},handleClick:function(e,t){e.preventDefault();if(!this.disabled){var c=t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];this.select(c.toUpperCase())}},select:function(A){A=A.replace("#","");if(A!=this.value||this.allowReselect){var el=this.el;if(this.value){el.child("a.color-"+this.value).removeClass("x-color-palette-sel")}el.child("a.color-"+A).addClass("x-color-palette-sel");this.value=A;this.fireEvent("select",this,A)}}});
-Roo.DatePicker=function(A){Roo.DatePicker.superclass.constructor.call(this,A);this.value=A&&A.value?A.value.clearTime():new Date().clearTime();this.addEvents({select:true});if(this.handler){this.on("select",this.handler,this.scope||this);}if(!this.disabledDatesRE&&this.disabledDates){var dd=this.disabledDates;
-var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|";}this.disabledDatesRE=new RegExp(re+")");}};Roo.extend(Roo.DatePicker,Roo.Component,{todayText:"Today",okText:"&#160;OK&#160;",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minDate:null,maxDate:null,minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDays:null,disabledDaysText:"",disabledDatesRE:null,disabledDatesText:"",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:"Next Month (Control+Right)",prevText:"Previous Month (Control+Left)",monthYearText:"Choose a month (Control+Up/Down to move years)",startDay:0,showClear:false,setValue:function(B){var A=this.value;
-this.value=B.clearTime(true);if(this.el){this.update(this.value);}},getValue:function(){return this.value;},focus:function(){if(this.el){this.update(this.activeDate);}},onRender:function(D,C){var m=["<table cellspacing=\"0\">","<tr><td class=\"x-date-left\"><a href=\"#\" title=\"",this.prevText,"\">&#160;</a></td><td class=\"x-date-middle\" align=\"center\"></td><td class=\"x-date-right\"><a href=\"#\" title=\"",this.nextText,"\">&#160;</a></td></tr>","<tr><td colspan=\"3\"><table class=\"x-date-inner\" cellspacing=\"0\"><thead><tr>"];
-var dn=this.dayNames;for(var i=0;i<7;i++){var d=this.startDay+i;if(d>6){d=d-7;}m.push("<th><span>",dn[d].substr(0,1),"</span></th>");}m[m.length]="</tr></thead><tbody><tr>";for(var i=0;i<42;i++){if(i%7==0&&i!=0){m[m.length]="</tr><tr>";}m[m.length]="<td><a href=\"#\" hidefocus=\"on\" class=\"x-date-date\" tabIndex=\"1\"><em><span></span></em></a></td>";
-}m[m.length]="</tr></tbody></table></td></tr><tr>"+"<td colspan=\"3\" class=\"x-date-bottom\" align=\"center\"></td></tr></table><div class=\"x-date-mp\"></div>";var el=document.createElement("div");el.className="x-date-picker";el.innerHTML=m.join("");D.dom.insertBefore(el,C);
-this.el=Roo.get(el);this.eventEl=Roo.get(el.firstChild);new Roo.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});new Roo.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true});
-this.eventEl.on("mousewheel",this.handleMouseWheel,this);this.monthPicker=this.el.down("div.x-date-mp");this.monthPicker.enableDisplayMode("block");var kn=new Roo.KeyNav(this.eventEl,{"left":function(e){e.ctrlKey?this.showPrevMonth():this.update(this.activeDate.add("d",-1));
-},right:function(e){e.ctrlKey?this.showNextMonth():this.update(this.activeDate.add("d",1));},up:function(e){e.ctrlKey?this.showNextYear():this.update(this.activeDate.add("d",-7));},down:function(e){e.ctrlKey?this.showPrevYear():this.update(this.activeDate.add("d",7));
-},pageUp:function(e){this.showNextMonth();},pageDown:function(e){this.showPrevMonth();},enter:function(e){e.stopPropagation();return true;},scope:this});this.eventEl.on("click",this.handleDateClick,this,{delegate:"a.x-date-date"});this.eventEl.addKeyListener(Roo.EventObject.SPACE,this.selectToday,this);
-this.el.unselectable();this.cells=this.el.select("table.x-date-inner tbody td");this.textNodes=this.el.query("table.x-date-inner tbody span");this.mbtn=new Roo.Button(this.el.child("td.x-date-middle",true),{text:"&#160;",tooltip:this.monthYearText});this.mbtn.on("click",this.showMonthPicker,this);
-this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");var A=(new Date()).dateFormat(this.format);var B=new Roo.Toolbar(this.el.child("td.x-date-bottom",true));B.add({text:String.format(this.todayText,A),tooltip:String.format(this.todayTip,A),handler:this.selectToday,scope:this});
-if(this.showClear){B.add(new Roo.Toolbar.Fill());B.add({text:"&#160;",cls:"x-btn-icon x-btn-clear",handler:function(){this.fireEvent("select",this,"");},scope:this});}if(Roo.isIE){this.el.repaint();}this.update(this.value);},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var A=["<table border=\"0\" cellspacing=\"0\">"];
-for(var i=0;i<6;i++){A.push("<tr><td class=\"x-date-mp-month\"><a href=\"#\">",this.monthNames[i].substr(0,3),"</a></td>","<td class=\"x-date-mp-month x-date-mp-sep\"><a href=\"#\">",this.monthNames[i+6].substr(0,3),"</a></td>",i==0?"<td class=\"x-date-mp-ybtn\" align=\"center\"><a class=\"x-date-mp-prev\"></a></td><td class=\"x-date-mp-ybtn\" align=\"center\"><a class=\"x-date-mp-next\"></a></td></tr>":"<td class=\"x-date-mp-year\"><a href=\"#\"></a></td><td class=\"x-date-mp-year\"><a href=\"#\"></a></td></tr>");
-}A.push("<tr class=\"x-date-mp-btns\"><td colspan=\"4\"><button type=\"button\" class=\"x-date-mp-ok\">",this.okText,"</button><button type=\"button\" class=\"x-date-mp-cancel\">",this.cancelText,"</button></td></tr>","</table>");this.monthPicker.update(A.join(""));
-this.monthPicker.on("click",this.onMonthClick,this);this.monthPicker.on("dblclick",this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select("td.x-date-mp-month");this.mpYears=this.monthPicker.select("td.x-date-mp-year");this.mpMonths.each(function(m,a,i){i+=1;
-if((i%2)==0){m.dom.xmonth=5+Math.round(i*0.5);}else{m.dom.xmonth=Math.round((i-1)*0.5);}});}},showMonthPicker:function(){this.createMonthPicker();var A=this.el.getSize();this.monthPicker.setSize(A);this.monthPicker.child("table").setSize(A);this.mpSelMonth=(this.activeDate||this.value).getMonth();
-this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn("t",{duration:0.2});},updateMPYear:function(y){this.mpyear=y;var ys=this.mpYears.elements;for(var i=1;
-i<=10;i++){var td=ys[i-1],y2;if((i%2)==0){y2=y+Math.round(i*0.5);td.firstChild.innerHTML=y2;td.xyear=y2;}else{y2=y-(5-Math.round(i*0.5));td.firstChild.innerHTML=y2;td.xyear=y2;}this.mpYears.item(i-1)[y2==this.mpSelYear?"addClass":"removeClass"]("x-date-mp-sel");
-}},updateMPMonth:function(sm){this.mpMonths.each(function(m,a,i){m[m.dom.xmonth==sm?"addClass":"removeClass"]("x-date-mp-sel");});},selectMPMonth:function(m){},onMonthClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(el.is("button.x-date-mp-cancel")){this.hideMonthPicker();
-}else if(el.is("button.x-date-mp-ok")){this.update(new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else if(pn=el.up("td.x-date-mp-month",2)){this.mpMonths.removeClass("x-date-mp-sel");pn.addClass("x-date-mp-sel");
-this.mpSelMonth=pn.dom.xmonth;}else if(pn=el.up("td.x-date-mp-year",2)){this.mpYears.removeClass("x-date-mp-sel");pn.addClass("x-date-mp-sel");this.mpSelYear=pn.dom.xyear;}else if(el.is("a.x-date-mp-prev")){this.updateMPYear(this.mpyear-10);}else if(el.is("a.x-date-mp-next")){this.updateMPYear(this.mpyear+10);
-}},onMonthDblClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(pn=el.up("td.x-date-mp-month",2)){this.update(new Date(this.mpSelYear,pn.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}else if(pn=el.up("td.x-date-mp-year",2)){this.update(new Date(pn.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));
-this.hideMonthPicker();}},hideMonthPicker:function(A){if(this.monthPicker){if(A===true){this.monthPicker.hide();}else{this.monthPicker.slideOut("t",{duration:0.2});}}},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1));},showNextMonth:function(e){this.update(this.activeDate.add("mo",1));
-},showPrevYear:function(){this.update(this.activeDate.add("y",-1));},showNextYear:function(){this.update(this.activeDate.add("y",1));},handleMouseWheel:function(e){var A=e.getWheelDelta();if(A>0){this.showPrevMonth();e.stopEvent();}else if(A<0){this.showNextMonth();
-e.stopEvent();}},handleDateClick:function(e,t){e.stopEvent();if(t.dateValue&&!Roo.fly(t.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(t.dateValue));this.fireEvent("select",this,this.value);}},selectToday:function(){this.setValue(new Date().clearTime());
-this.fireEvent("select",this,this.value);},update:function(E){var vd=this.activeDate;this.activeDate=E;if(vd&&this.el){var t=E.getTime();if(vd.getMonth()==E.getMonth()&&vd.getFullYear()==E.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(c){if(c.dom.firstChild.dateValue==t){c.addClass("x-date-selected");
-setTimeout(function(){try{c.dom.firstChild.focus();}catch(e){}},50);return false;}});return;}}var F=E.getDaysInMonth();var S=E.getFirstDateOfMonth();var R=S.getDay()-this.startDay;if(R<=this.startDay){R+=7;}var pm=E.add("mo",-1);var Q=pm.getDaysInMonth()-R;
-var H=this.cells.elements;var N=this.textNodes;F+=R;var A=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),Q)).clearTime();var J=new Date().clearTime().getTime();var D=E.clearTime().getTime();var C=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;
-var B=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var M=this.disabledDatesRE;var K=this.disabledDatesText;var I=this.disabledDays?this.disabledDays.join(""):false;var O=this.disabledDaysText;var L=this.format;var T=function(U,V){V.title="";
-var t=d.getTime();V.firstChild.dateValue=t;if(t==J){V.className+=" x-date-today";V.title=U.todayText;}if(t==D){V.className+=" x-date-selected";setTimeout(function(){try{V.firstChild.focus();}catch(e){}},50);}if(t<C){V.className=" x-date-disabled";V.title=U.minText;
-return;}if(t>B){V.className=" x-date-disabled";V.title=U.maxText;return;}if(I){if(I.indexOf(d.getDay())!=-1){V.title=O;V.className=" x-date-disabled";}}if(M&&L){var W=d.dateFormat(L);if(M.test(W)){V.title=K.replace("%0",W);V.className=" x-date-disabled";}}};
-var i=0;for(;i<R;i++){N[i].innerHTML=(++Q);d.setDate(d.getDate()+1);H[i].className="x-date-prevday";T(this,H[i]);}for(;i<F;i++){intDay=i-R+1;N[i].innerHTML=(intDay);d.setDate(d.getDate()+1);H[i].className="x-date-active";T(this,H[i]);}var P=0;for(;i<42;i++){N[i].innerHTML=(++P);
-d.setDate(d.getDate()+1);H[i].className="x-date-nextday";T(this,H[i]);}this.mbtn.setText(this.monthNames[E.getMonth()]+" "+E.getFullYear());if(!this.internalRender){var G=this.el.dom.firstChild;var w=G.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));
-Roo.fly(G).setWidth(w);this.internalRender=true;if(Roo.isOpera&&!this.secondPass){G.rows[0].cells[1].style.width=(w-(G.rows[0].cells[0].offsetWidth+G.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[E]);}}}});
-Roo.TabPanel=function(B,A){this.el=Roo.get(B,true);if(A){if(typeof A=="boolean"){this.tabPosition=A?"bottom":"top"}else{Roo.apply(this,A)}}if(this.tabPosition=="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-bottom")}this.stripWrap=Roo.get(this.createStrip(this.el.dom),true);this.stripEl=Roo.get(this.createStripList(this.stripWrap.dom),true);this.stripBody=Roo.get(this.stripWrap.dom.firstChild.firstChild,true);if(Roo.isIE){Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x","hidden")}if(this.tabPosition!="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-top")}this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,beforetabchange:true});Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;Roo.TabPanel.superclass.constructor.call(this)};Roo.extend(Roo.TabPanel,Roo.util.Observable,{tabPosition:"top",currentTabWidth:0,minTabWidth:40,maxTabWidth:250,preferredTabWidth:175,resizeTabs:false,monitorResize:true,addTab:function(id,B,C,D){var A=new Roo.TabPanelItem(this,id,B,D);this.addTabItem(A);if(C){A.setContent(C)}return A},getTab:function(id){return this.items[id]},hideTab:function(id){var t=this.items[id];if(!t.isHidden()){t.setHidden(true);this.hiddenCount++;this.autoSizeTabs()}},unhideTab:function(id){var t=this.items[id];if(t.isHidden()){t.setHidden(false);this.hiddenCount--;this.autoSizeTabs()}},addTabItem:function(A){this.items[A.id]=A;this.items.push(A);if(this.resizeTabs){A.setWidth(this.currentTabWidth||this.preferredTabWidth);this.autoSizeTabs()}else{A.autoSize()}},removeTab:function(id){var C=this.items;var A=C[id];if(!A)return;var B=C.indexOf(A);if(this.active==A&&C.length>1){var D=this.getNextAvailable(B);if(D)D.activate()}this.stripEl.dom.removeChild(A.pnode.dom);if(A.bodyEl.dom.parentNode==this.bodyEl.dom){this.bodyEl.dom.removeChild(A.bodyEl.dom)}C.splice(B,1);delete this.items[A.id];A.fireEvent("close",A);A.purgeListeners();this.autoSizeTabs()},getNextAvailable:function(D){var C=this.items;var B=D;while(B<C.length){var A=C[++B];if(A&&!A.isHidden()){return A}}B=D;while(B>=0){var A=C[--B];if(A&&!A.isHidden()){return A}}return null},disableTab:function(id){var A=this.items[id];if(A&&this.active!=A){A.disable()}},enableTab:function(id){var A=this.items[id];A.enable()},activate:function(id){var A=this.items[id];if(!A){return null}if(A==this.active||A.disabled){return A}var e={};this.fireEvent("beforetabchange",this,e,A);if(e.cancel!==true&&!A.disabled){if(this.active){this.active.hide()}this.active=this.items[id];this.active.show();this.fireEvent("tabchange",this,this.active)}return A},getActiveTab:function(){return this.active},syncHeight:function(C){var A=(C||this.el.getHeight())-this.el.getBorderWidth("tb")-this.el.getPadding("tb");var bm=this.bodyEl.getMargins();var B=A-(this.stripWrap.getHeight()||0)-(bm.top+bm.bottom);this.bodyEl.setHeight(B);return B},onResize:function(){if(this.monitorResize){this.autoSizeTabs()}},beginUpdate:function(){this.updating=true},endUpdate:function(){this.updating=false;this.autoSizeTabs()},autoSizeTabs:function(){var B=this.items.length;var C=B-this.hiddenCount;if(!this.resizeTabs||B<1||C<1||this.updating)return;var w=Math.max(this.el.getWidth()-this.cpad,10);var D=Math.floor(w/C);var b=this.stripBody;if(b.getWidth()>w){var A=this.items;this.setTabWidth(Math.max(D,this.minTabWidth)-2);if(D<this.minTabWidth){}}else{if(this.currentTabWidth<this.preferredTabWidth){this.setTabWidth(Math.min(D,this.preferredTabWidth)-2)}}},getCount:function(){return this.items.length},setTabWidth:function(B){this.currentTabWidth=B;for(var i=0,A=this.items.length;i<A;i++){if(!this.items[i].isHidden())this.items[i].setWidth(B)}},destroy:function(B){Roo.EventManager.removeResizeListener(this.onResize,this);for(var i=0,A=this.items.length;i<A;i++){this.items[i].purgeListeners()}if(B===true){this.el.update("");this.el.remove()}}});Roo.TabPanelItem=function(D,id,B,C){this.tabPanel=D;this.id=id;this.disabled=false;this.text=B;this.loaded=false;this.closable=C;this.bodyEl=Roo.get(D.createItemBody(D.bodyEl.dom,id));this.bodyEl.setVisibilityMode(Roo.Element.VISIBILITY);this.bodyEl.setStyle("display","block");this.bodyEl.setStyle("zoom","1");this.hideAction();var A=D.createStripElements(D.stripEl.dom,B,C);this.el=Roo.get(A.el,true);this.inner=Roo.get(A.inner,true);this.textEl=Roo.get(this.el.dom.firstChild.firstChild.firstChild,true);this.pnode=Roo.get(A.el.parentNode,true);this.el.on("mousedown",this.onTabMouseDown,this);this.el.on("click",this.onTabClick,this);if(C){var c=Roo.get(A.close,true);c.dom.title=this.closeText;c.addClassOnOver("close-over");c.on("click",this.closeClick,this)}this.addEvents({"activate":true,beforeclose:true,close:true,deactivate:true});this.hidden=false;Roo.TabPanelItem.superclass.constructor.call(this)};Roo.extend(Roo.TabPanelItem,Roo.util.Observable,{purgeListeners:function(){Roo.util.Observable.prototype.purgeListeners.call(this);this.el.removeAllListeners()},show:function(){this.pnode.addClass("on");this.showAction();if(Roo.isOpera){this.tabPanel.stripWrap.repaint()}this.fireEvent("activate",this.tabPanel,this)},isActive:function(){return this.tabPanel.getActiveTab()==this},hide:function(){this.pnode.removeClass("on");this.hideAction();this.fireEvent("deactivate",this.tabPanel,this)},hideAction:function(){this.bodyEl.hide();this.bodyEl.setStyle("position","absolute");this.bodyEl.setLeft("-20000px");this.bodyEl.setTop("-20000px")},showAction:function(){this.bodyEl.setStyle("position","relative");this.bodyEl.setTop("");this.bodyEl.setLeft("");this.bodyEl.show()},setTooltip:function(A){if(Roo.QuickTips&&Roo.QuickTips.isEnabled()){this.textEl.dom.qtip=A;this.textEl.dom.removeAttribute("title")}else{this.textEl.dom.title=A}},onTabClick:function(e){e.preventDefault();this.tabPanel.activate(this.id)},onTabMouseDown:function(e){e.preventDefault();this.tabPanel.activate(this.id)},getWidth:function(){return this.inner.getWidth()},setWidth:function(A){var B=A-this.pnode.getPadding("lr");this.inner.setWidth(B);this.textEl.setWidth(B-this.inner.getPadding("lr"));this.pnode.setWidth(A)},setHidden:function(A){this.hidden=A;this.pnode.setStyle("display",A?"none":"")},isHidden:function(){return this.hidden},getText:function(){return this.text},autoSize:function(){this.textEl.setWidth(1);this.setWidth(this.textEl.dom.scrollWidth+this.pnode.getPadding("lr")+this.inner.getPadding("lr"))},setText:function(A){this.text=A;this.textEl.update(A);this.setTooltip(A);if(!this.tabPanel.resizeTabs){this.autoSize()}},activate:function(){this.tabPanel.activate(this.id)},disable:function(){if(this.tabPanel.active!=this){this.disabled=true;this.pnode.addClass("disabled")}},enable:function(){this.disabled=false;this.pnode.removeClass("disabled")},setContent:function(A,B){this.bodyEl.update(A,B)},getUpdateManager:function(){return this.bodyEl.getUpdateManager()},setUrl:function(A,B,C){if(this.refreshDelegate){this.un("activate",this.refreshDelegate)}this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);return this.bodyEl.getUpdateManager()},_handleRefresh:function(A,B,D){if(!D||!this.loaded){var C=this.bodyEl.getUpdateManager();C.update(A,B,this._setLoaded.createDelegate(this))}},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate()}},_setLoaded:function(){this.loaded=true},closeClick:function(e){var o={};e.stopEvent();this.fireEvent("beforeclose",this,o);if(o.cancel!==true){this.tabPanel.removeTab(this.id)}},closeText:"Close this tab"});Roo.TabPanel.prototype.createStrip=function(B){var A=document.createElement("div");A.className="x-tabs-wrap";B.appendChild(A);return A};Roo.TabPanel.prototype.createStripList=function(A){A.innerHTML="<div class=\"x-tabs-strip-wrap\"><table class=\"x-tabs-strip\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody><tr></tr></tbody></table></div>";return A.firstChild.firstChild.firstChild.firstChild};Roo.TabPanel.prototype.createBody=function(B){var A=document.createElement("div");Roo.id(A,"tab-body");Roo.fly(A).addClass("x-tabs-body");B.appendChild(A);return A};Roo.TabPanel.prototype.createItemBody=function(B,id){var A=Roo.getDom(id);if(!A){A=document.createElement("div");A.id=id}Roo.fly(A).addClass("x-tabs-item-body");B.insertBefore(A,B.firstChild);return A};Roo.TabPanel.prototype.createStripElements=function(D,A,E){var td=document.createElement("td");D.appendChild(td);if(E){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template("<a href=\"#\" class=\"x-tabs-right\"><span class=\"x-tabs-left\"><em class=\"x-tabs-inner\">"+"<span unselectable=\"on\""+(this.disableTooltips?"":" title=\"{text}\"")+" class=\"x-tabs-text\">{text}</span>"+"<div unselectable=\"on\" class=\"close-icon\">&#160;</div></em></span></a>")}var el=this.closeTpl.overwrite(td,{"text":A});var B=el.getElementsByTagName("div")[0];var C=el.getElementsByTagName("em")[0];return {"el":el,close:B,inner:C}}else{if(!this.tabTpl){this.tabTpl=new Roo.Template("<a href=\"#\" class=\"x-tabs-right\"><span class=\"x-tabs-left\"><em class=\"x-tabs-inner\">"+"<span unselectable=\"on\""+(this.disableTooltips?"":" title=\"{text}\"")+" class=\"x-tabs-text\">{text}</span></em></span></a>")}var el=this.tabTpl.overwrite(td,{"text":A});var C=el.getElementsByTagName("em")[0];return {"el":el,inner:C}}};
-Roo.Button=function(B,A){if(!A){A=B;B=A.renderTo||false;}Roo.apply(this,A);this.addEvents({"click":true,toggle:true,mouseover:true,mouseout:true,render:true});if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);}if(B){this.render(B);}Roo.util.Observable.call(this);
-};Roo.extend(Roo.Button,Roo.util.Observable,{hidden:false,disabled:false,pressed:false,tabIndex:undefined,enableToggle:false,menu:undefined,menuAlign:"tl-bl?",iconCls:undefined,type:"button",menuClassTarget:"tr",clickEvent:"click",handleMouseEvents:true,tooltipType:"qtip",render:function(C){var A;
-if(this.hideParent){this.parentEl=Roo.get(C);}if(!this.dhconfig){if(!this.template){if(!Roo.Button.buttonTemplate){Roo.Button.buttonTemplate=new Roo.Template("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"x-btn-wrap\"><tbody><tr>","<td class=\"x-btn-left\"><i>&#160;</i></td><td class=\"x-btn-center\"><em unselectable=\"on\"><button class=\"x-btn-text\" type=\"{1}\">{0}</button></em></td><td class=\"x-btn-right\"><i>&#160;</i></td>","</tr></tbody></table>");
-}this.template=Roo.Button.buttonTemplate;}A=this.template.append(C,[this.text||"&#160;",this.type],true);var B=A.child("button:first");B.on("focus",this.onFocus,this);B.on("blur",this.onBlur,this);if(this.cls){A.addClass(this.cls);}if(this.icon){B.setStyle("background-image","url("+this.icon+")");
-}if(this.iconCls){B.addClass(this.iconCls);if(!this.cls){A.addClass(this.text?"x-btn-text-icon":"x-btn-icon");}}if(this.tabIndex!==undefined){B.dom.tabIndex=this.tabIndex;}if(this.tooltip){if(typeof this.tooltip=="object"){Roo.QuickTips.tips(Roo.apply({target:B.id},this.tooltip));
-}else{B.dom[this.tooltipType]=this.tooltip;}}}else{A=Roo.DomHelper.append(Roo.get(C).dom,this.dhconfig,true);}this.el=A;if(this.id){this.el.dom.id=this.el.id=this.id;}if(this.menu){this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");this.menu.on("show",this.onMenuShow,this);
-this.menu.on("hide",this.onMenuHide,this);}A.addClass("x-btn");if(Roo.isIE&&!Roo.isIE7){this.autoWidth.defer(1,this);}else{this.autoWidth();}if(this.handleMouseEvents){A.on("mouseover",this.onMouseOver,this);A.on("mouseout",this.onMouseOut,this);A.on("mousedown",this.onMouseDown,this);
-}A.on(this.clickEvent,this.onClick,this);if(this.hidden){this.hide();}if(this.disabled){this.disable();}Roo.ButtonToggleMgr.register(this);if(this.pressed){this.el.addClass("x-btn-pressed");}if(this.repeat){var D=new Roo.util.ClickRepeater(A,typeof this.repeat=="object"?this.repeat:{});
-D.on("click",this.onClick,this);}this.fireEvent("render",this);},getEl:function(){return this.el;},destroy:function(){Roo.ButtonToggleMgr.unregister(this);this.el.removeAllListeners();this.purgeListeners();this.el.remove();},autoWidth:function(){if(this.el){this.el.setWidth("auto");
-if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child("button");if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth("lr"));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if(this.el.getWidth()<this.minWidth){this.el.setWidth(this.minWidth);
-}if(this.hidden){this.el.endMeasure();}}}},setHandler:function(B,A){this.handler=B;this.scope=A;},setText:function(A){this.text=A;if(this.el){this.el.child("td.x-btn-center button.x-btn-text").update(A);}this.autoWidth();},getText:function(){return this.text;
-},show:function(){this.hidden=false;if(this.el){this[this.hideParent?"parentEl":"el"].setStyle("display","");}},hide:function(){this.hidden=true;if(this.el){this[this.hideParent?"parentEl":"el"].setStyle("display","none");}},setVisible:function(A){if(A){this.show();
-}else{this.hide();}},toggle:function(A){A=A===undefined?!this.pressed:A;if(A!=this.pressed){if(A){this.el.addClass("x-btn-pressed");this.pressed=true;this.fireEvent("toggle",this,true);}else{this.el.removeClass("x-btn-pressed");this.pressed=false;this.fireEvent("toggle",this,false);
-}if(this.toggleHandler){this.toggleHandler.call(this.scope||this,this,A);}}},focus:function(){this.el.child("button:first").focus();},disable:function(){if(this.el){this.el.addClass("x-btn-disabled");}this.disabled=true;},enable:function(){if(this.el){this.el.removeClass("x-btn-disabled");
-}this.disabled=false;},setDisabled:function(v){this[v!==true?"enable":"disable"]();},onClick:function(e){if(e){e.preventDefault();}if(e.button!=0){return;}if(!this.disabled){if(this.enableToggle){this.toggle();}if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);
-}this.fireEvent("click",this,e);if(this.handler){this.el.removeClass("x-btn-over");this.handler.call(this.scope||this,this,e);}}},onMouseOver:function(e){if(!this.disabled){this.el.addClass("x-btn-over");this.fireEvent("mouseover",this,e);}},onMouseOut:function(e){if(!e.within(this.el,true)){this.el.removeClass("x-btn-over");
-this.fireEvent("mouseout",this,e);}},onFocus:function(e){if(!this.disabled){this.el.addClass("x-btn-focus");}},onBlur:function(e){this.el.removeClass("x-btn-focus");},onMouseDown:function(e){if(!this.disabled&&e.button==0){this.el.addClass("x-btn-click");
-Roo.get(document).on("mouseup",this.onMouseUp,this);}},onMouseUp:function(e){if(e.button==0){this.el.removeClass("x-btn-click");Roo.get(document).un("mouseup",this.onMouseUp,this);}},onMenuShow:function(e){this.el.addClass("x-btn-menu-active");},onMenuHide:function(e){this.el.removeClass("x-btn-menu-active");
-}});Roo.ButtonToggleMgr=function(){var A={};function B(C,D){if(D){var g=A[C.toggleGroup];for(var i=0,l=g.length;i<l;i++){if(g[i]!=C){g[i].toggle(false);}}}}return {register:function(C){if(!C.toggleGroup){return;}var g=A[C.toggleGroup];if(!g){g=A[C.toggleGroup]=[];
-}g.push(C);C.on("toggle",B);},unregister:function(C){if(!C.toggleGroup){return;}var g=A[C.toggleGroup];if(g){g.remove(C);C.un("toggle",B);}}};}();
-Roo.SplitButton=function(B,A){Roo.SplitButton.superclass.constructor.call(this,B,A);this.addEvents({"arrowclick":true});};Roo.extend(Roo.SplitButton,Roo.Button,{render:function(D){var B=new Roo.Template("<table cellspacing=\"0\" class=\"x-btn-menu-wrap x-btn\"><tr><td>","<table cellspacing=\"0\" class=\"x-btn-wrap x-btn-menu-text-wrap\"><tbody>","<tr><td class=\"x-btn-left\"><i>&#160;</i></td><td class=\"x-btn-center\"><button class=\"x-btn-text\" type=\"{1}\">{0}</button></td></tr>","</tbody></table></td><td>","<table cellspacing=\"0\" class=\"x-btn-wrap x-btn-menu-arrow-wrap\"><tbody>","<tr><td class=\"x-btn-center\"><button class=\"x-btn-menu-arrow-el\" type=\"button\">&#160;</button></td><td class=\"x-btn-right\"><i>&#160;</i></td></tr>","</tbody></table></td></tr></table>");
-var A=B.append(D,[this.text,this.type],true);var C=A.child("button");if(this.cls){A.addClass(this.cls);}if(this.icon){C.setStyle("background-image","url("+this.icon+")");}if(this.iconCls){C.addClass(this.iconCls);if(!this.cls){A.addClass(this.text?"x-btn-text-icon":"x-btn-icon");
-}}this.el=A;if(this.handleMouseEvents){A.on("mouseover",this.onMouseOver,this);A.on("mouseout",this.onMouseOut,this);A.on("mousedown",this.onMouseDown,this);A.on("mouseup",this.onMouseUp,this);}A.on(this.clickEvent,this.onClick,this);if(this.tooltip){if(typeof this.tooltip=="object"){Roo.QuickTips.tips(Roo.apply({target:C.id},this.tooltip));
-}else{C.dom[this.tooltipType]=this.tooltip;}}if(this.arrowTooltip){A.child("button:nth(2)").dom[this.tooltipType]=this.arrowTooltip;}if(this.hidden){this.hide();}if(this.disabled){this.disable();}if(this.pressed){this.el.addClass("x-btn-pressed");}if(Roo.isIE&&!Roo.isIE7){this.autoWidth.defer(1,this);
-}else{this.autoWidth();}if(this.menu){this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this);}this.fireEvent("render",this);},autoWidth:function(){if(this.el){var A=this.el.child("table:first");var B=this.el.child("table:last");
-this.el.setWidth("auto");A.setWidth("auto");if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child("button:first");if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth("lr"));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();
-}if((A.getWidth()+B.getWidth())<this.minWidth){A.setWidth(this.minWidth-B.getWidth());}if(this.hidden){this.el.endMeasure();}}this.el.setWidth(A.getWidth()+B.getWidth());}},setHandler:function(B,A){this.handler=B;this.scope=A;},setArrowHandler:function(B,A){this.arrowHandler=B;
-this.scope=A;},focus:function(){if(this.el){this.el.child("button:first").focus();}},onClick:function(e){e.preventDefault();if(!this.disabled){if(e.getTarget(".x-btn-menu-arrow-wrap")){if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);
-}this.fireEvent("arrowclick",this,e);if(this.arrowHandler){this.arrowHandler.call(this.scope||this,this,e);}}else{this.fireEvent("click",this,e);if(this.handler){this.handler.call(this.scope||this,this,e);}}}},onMouseDown:function(e){if(!this.disabled){Roo.fly(e.getTarget("table")).addClass("x-btn-click");
-}},onMouseUp:function(e){Roo.fly(e.getTarget("table")).removeClass("x-btn-click");}});Roo.MenuButton=Roo.SplitButton;
-Roo.Toolbar=function(D,C,A){if(D instanceof Array){C=D;A=C;D=null;}if(typeof (D)=="object"&&D.xtype){A=D;D=A.container;C=A.buttons;}var B=[];if(A&&A.items){B=A.items;delete A.items;}Roo.apply(this,A);this.buttons=C;if(D){this.render(D);}Roo.each(B,function(b){this.add(b);
-},this);};Roo.Toolbar.prototype={render:function(ct){this.el=Roo.get(ct);if(this.cls){this.el.addClass(this.cls);}this.el.update("<div class=\"x-toolbar x-small-editor\"><table cellspacing=\"0\"><tr></tr></table></div>");this.tr=this.el.child("tr",true);var A=0;
-this.items=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++A));});if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons;}},add:function(){var a=arguments,l=a.length;for(var i=0;i<l;i++){this._add(a[i]);}},_add:function(el){if(el.xtype){el=Roo.factory(el,typeof (Roo.Toolbar[el.xtype])=="undefined"?Roo.form:Roo.Toolbar);
-}if(el.applyTo){return this.addField(el);}if(el.render){return this.addItem(el);}if(typeof el=="string"){if(el=="separator"||el=="-"){return this.addSeparator();}if(el==" "){return this.addSpacer();}if(el=="->"){return this.addFill();}return this.addText(el);
-}if(el.tagName){return this.addElement(el);}if(typeof el=="object"){return this.addButton(el);}return false;},addxtype:function(e){return this.add(e);},getEl:function(){return this.el;},addSeparator:function(){return this.addItem(new Roo.Toolbar.Separator());
-},addSpacer:function(){return this.addItem(new Roo.Toolbar.Spacer());},addFill:function(){return this.addItem(new Roo.Toolbar.Fill());},addElement:function(el){return this.addItem(new Roo.Toolbar.Item(el));},items:false,addItem:function(A){var td=this.nextBlock();
-A.render(td);this.items.add(A);return A;},addButton:function(B){if(B instanceof Array){var C=[];for(var i=0,A=B.length;i<A;i++){C.push(this.addButton(B[i]));}return C;}var b=B;if(!(B instanceof Roo.Toolbar.Button)){b=B.split?new Roo.Toolbar.SplitButton(B):new Roo.Toolbar.Button(B);
-}var td=this.nextBlock();b.render(td);this.items.add(b);return b;},addText:function(A){return this.addItem(new Roo.Toolbar.TextItem(A));},insertButton:function(C,B){if(B instanceof Array){var D=[];for(var i=0,A=B.length;i<A;i++){D.push(this.insertButton(C+i,B[i]));
-}return D;}if(!(B instanceof Roo.Toolbar.Button)){B=new Roo.Toolbar.Button(B);}var td=document.createElement("td");this.tr.insertBefore(td,this.tr.childNodes[C]);B.render(td);this.items.insert(C,B);return B;},addDom:function(A,B){var td=this.nextBlock();Roo.DomHelper.overwrite(td,A);
-var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);return ti;},fields:false,addField:function(A){if(!this.fields){var B=0;this.fields=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++B));});}var td=this.nextBlock();
-A.render(td);var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);this.fields.add(A);return ti;},hide:function(){this.el.child("div").setVisibilityMode(Roo.Element.DISPLAY);this.el.child("div").hide();},show:function(){this.el.child("div").show();
-},nextBlock:function(){var td=document.createElement("td");this.tr.appendChild(td);return td;},destroy:function(){if(this.items){Roo.destroy.apply(Roo,this.items.items);}if(this.fields){Roo.destroy.apply(Roo,this.fields.items);}Roo.Element.uncache(this.el,this.tr);
-}};Roo.Toolbar.Item=function(el){this.el=Roo.getDom(el);this.id=Roo.id(this.el);this.hidden=false;};Roo.Toolbar.Item.prototype={getEl:function(){return this.el;},render:function(td){this.td=td;td.appendChild(this.el);},destroy:function(){this.td.parentNode.removeChild(this.td);
-},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},setVisible:function(A){if(A){this.show();}else{this.hide();}},focus:function(){Roo.fly(this.el).focus();},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");
-this.disabled=true;this.el.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");this.disabled=false;this.el.disabled=false;}};Roo.Toolbar.Separator=function(){var s=document.createElement("span");s.className="ytb-sep";Roo.Toolbar.Separator.superclass.constructor.call(this,s);
-};Roo.extend(Roo.Toolbar.Separator,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Spacer=function(){var s=document.createElement("div");s.className="ytb-spacer";Roo.Toolbar.Spacer.superclass.constructor.call(this,s);
-};Roo.extend(Roo.Toolbar.Spacer,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Fill=Roo.extend(Roo.Toolbar.Spacer,{render:function(td){td.style.width="100%";Roo.Toolbar.Fill.superclass.render.call(this,td);}});Roo.Toolbar.TextItem=function(A){if(typeof (A)=="object"){A=A.text;
-}var s=document.createElement("span");s.className="ytb-text";s.innerHTML=A;Roo.Toolbar.TextItem.superclass.constructor.call(this,s);};Roo.extend(Roo.Toolbar.TextItem,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn});Roo.Toolbar.Button=function(A){Roo.Toolbar.Button.superclass.constructor.call(this,null,A);
-};Roo.extend(Roo.Toolbar.Button,Roo.Button,{render:function(td){this.td=td;Roo.Toolbar.Button.superclass.render.call(this,td);},destroy:function(){Roo.Toolbar.Button.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;
-this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");this.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");this.disabled=false;
-}});Roo.ToolbarButton=Roo.Toolbar.Button;Roo.Toolbar.SplitButton=function(A){Roo.Toolbar.SplitButton.superclass.constructor.call(this,null,A);};Roo.extend(Roo.Toolbar.SplitButton,Roo.SplitButton,{render:function(td){this.td=td;Roo.Toolbar.SplitButton.superclass.render.call(this,td);
-},destroy:function(){Roo.Toolbar.SplitButton.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";}});Roo.Toolbar.MenuButton=Roo.Toolbar.SplitButton;
-
-Roo.PagingToolbar=function(el,ds,A){if(typeof (el)=="object"&&el.xtype){A=el;ds=el.dataSource;el=A.container;}Roo.PagingToolbar.superclass.constructor.call(this,el,null,A);this.ds=ds;this.cursor=0;this.renderButtons(this.el);this.bind(ds);};Roo.extend(Roo.PagingToolbar,Roo.Toolbar,{pageSize:20,displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No data to display",beforePageText:"Page",afterPageText:"of {0}",firstText:"First Page",prevText:"Previous Page",nextText:"Next Page",lastText:"Last Page",refreshText:"Refresh",renderButtons:function(el){Roo.PagingToolbar.superclass.render.call(this,el);
-this.first=this.addButton({tooltip:this.firstText,cls:"x-btn-icon x-grid-page-first",disabled:true,handler:this.onClick.createDelegate(this,["first"])});this.prev=this.addButton({tooltip:this.prevText,cls:"x-btn-icon x-grid-page-prev",disabled:true,handler:this.onClick.createDelegate(this,["prev"])});
-this.addSeparator();this.add(this.beforePageText);this.field=Roo.get(this.addDom({tag:"input",type:"text",size:"3",value:"1",cls:"x-grid-page-number"}).el);this.field.on("keydown",this.onPagingKeydown,this);this.field.on("focus",function(){this.dom.select();
-});this.afterTextEl=this.addText(String.format(this.afterPageText,1));this.field.setHeight(18);this.addSeparator();this.next=this.addButton({tooltip:this.nextText,cls:"x-btn-icon x-grid-page-next",disabled:true,handler:this.onClick.createDelegate(this,["next"])});
-this.last=this.addButton({tooltip:this.lastText,cls:"x-btn-icon x-grid-page-last",disabled:true,handler:this.onClick.createDelegate(this,["last"])});this.addSeparator();this.loading=this.addButton({tooltip:this.refreshText,cls:"x-btn-icon x-grid-loading",handler:this.onClick.createDelegate(this,["refresh"])});
-if(this.displayInfo){this.displayEl=Roo.fly(this.el.dom.firstChild).createChild({cls:"x-paging-info"});}},updateInfo:function(){if(this.displayEl){var B=this.ds.getCount();var A=B==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+B,this.ds.getTotalCount());
-this.displayEl.update(A);}},onLoad:function(ds,r,o){this.cursor=o.params?o.params.start:0;var d=this.getPageData(),ap=d.activePage,ps=d.pages;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,d.pages);this.field.dom.value=ap;this.first.setDisabled(ap==1);
-this.prev.setDisabled(ap==1);this.next.setDisabled(ap==ps);this.last.setDisabled(ap==ps);this.loading.enable();this.updateInfo();},getPageData:function(){var A=this.ds.getTotalCount();return {total:A,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:A<this.pageSize?1:Math.ceil(A/this.pageSize)};
-},onLoadError:function(){this.loading.enable();},onPagingKeydown:function(e){var k=e.getKey();var d=this.getPageData();if(k==e.RETURN){var v=this.field.dom.value,A;if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}A=Math.min(Math.max(1,A),d.pages)-1;
-this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.HOME||(k==e.UP&&e.ctrlKey)||(k==e.PAGEUP&&e.ctrlKey)||(k==e.RIGHT&&e.ctrlKey)||k==e.END||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey)){var A=(k==e.HOME||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey))?1:d.pages;
-this.field.dom.value=A;this.ds.load({params:{start:(A-1)*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.UP||k==e.RIGHT||k==e.PAGEUP||k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN){var v=this.field.dom.value,A;var B=(e.shiftKey)?10:1;if(k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN)B*=-1;
-if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}else if(parseInt(v,10)+B>=1&parseInt(v,10)+B<=d.pages){this.field.dom.value=parseInt(v,10)+B;A=Math.min(Math.max(1,A+B),d.pages)-1;this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}});
-}e.stopEvent();}},beforeLoad:function(){if(this.loading){this.loading.disable();}},onClick:function(C){var ds=this.ds;switch(C){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 A=B%this.pageSize;var D=A?(B-A):B-this.pageSize;ds.load({params:{start:D,limit:this.pageSize}});break;case "refresh":ds.load({params:{start:this.cursor,limit:this.pageSize}});
-break;}},unbind:function(ds){ds.un("beforeload",this.beforeLoad,this);ds.un("load",this.onLoad,this);ds.un("loadexception",this.onLoadError,this);ds.un("remove",this.updateInfo,this);ds.un("add",this.updateInfo,this);this.ds=undefined;},bind:function(ds){ds.on("beforeload",this.beforeLoad,this);
-ds.on("load",this.onLoad,this);ds.on("loadexception",this.onLoadError,this);ds.on("remove",this.updateInfo,this);ds.on("add",this.updateInfo,this);this.ds=ds;}});
-Roo.Resizable=function(el,D){this.el=Roo.get(el);if(D&&D.wrap){D.resizeChild=this.el;this.el=this.el.wrap(typeof D.wrap=="object"?D.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=D.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(D.resizeChild.getPositioning());D.resizeChild.clearPositioning();if(!D.width||!D.height){var C=D.resizeChild.getSize();this.el.setSize(C.width,C.height)}if(D.pinned&&!D.adjustments){D.adjustments="auto"}}this.proxy=this.el.createProxy({tag:"div",cls:"x-resizable-proxy",id:this.el.id+"-rzproxy"});this.proxy.unselectable();this.proxy.enableDisplayMode("block");Roo.apply(this,D);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned")}var E=this.el.getStyle("position");if(E!="absolute"&&E!="fixed"){this.el.setStyle("position","relative")}if(!this.handles){this.handles="s,e,se";if(this.multiDirectional){this.handles+=",n,w"}}if(this.handles=="all"){this.handles="n s e w ne nw se sw"}var hs=this.handles.split(/\s*?[,;]\s*?| /);var ps=Roo.Resizable.positions;for(var i=0,A=hs.length;i<A;i++){if(hs[i]&&ps[hs[i]]){var B=ps[hs[i]];this[B]=new Roo.Resizable.Handle(this,B,this.disableTrackOver,this.transparent)}}this.corner=this.southeast;if(this.handles.indexOf("n")!=-1||this.handles.indexOf("w")!=-1){this.updateBox=true}this.activeHandle=null;if(this.resizeChild){if(typeof this.resizeChild=="boolean"){this.resizeChild=Roo.get(this.el.dom.firstChild,true)}else{this.resizeChild=Roo.get(this.resizeChild,true)}}if(this.adjustments=="auto"){var rc=this.resizeChild;var hw=this.west,he=this.east,hn=this.north,hs=this.south;if(rc&&(hw||hn)){rc.position("relative");rc.setLeft(hw?hw.el.getWidth():0);rc.setTop(hn?hn.el.getHeight():0)}this.adjustments=[(he?-he.el.getWidth():0)+(hw?-hw.el.getWidth():0),(hn?-hn.el.getHeight():0)+(hs?-hs.el.getHeight():0)-1]}if(this.draggable){this.dd=this.dynamic?this.el.initDD(null):this.el.initDDProxy(null,{dragElId:this.proxy.id});this.dd.setHandleElId(this.resizeChild?this.resizeChild.id:this.el.id)}this.addEvents({"beforeresize":true,resize:true});if(this.width!==null&&this.height!==null){this.resizeTo(this.width,this.height)}else{this.updateChildSize()}if(Roo.isIE){this.el.dom.style.zoom=1}Roo.Resizable.superclass.constructor.call(this)};Roo.extend(Roo.Resizable,Roo.util.Observable,{resizeChild:false,adjustments:[0,0],minWidth:5,minHeight:5,maxWidth:10000,maxHeight:10000,enabled:true,animate:false,duration:0.35,dynamic:false,handles:false,multiDirectional:false,disableTrackOver:false,easing:"easeOutStrong",widthIncrement:0,heightIncrement:0,pinned:false,width:null,height:null,preserveRatio:false,transparent:false,minX:0,minY:0,draggable:false,constrainTo:undefined,resizeRegion:undefined,resizeTo:function(A,B){this.el.setSize(A,B);this.updateChildSize();this.fireEvent("resize",this,A,B,null)},startSizing:function(e,A){this.fireEvent("beforeresize",this,e);if(this.enabled){if(!this.overlay){this.overlay=this.el.createProxy({tag:"div",cls:"x-resizable-overlay",html:"&#160;"});this.overlay.unselectable();this.overlay.enableDisplayMode("block");this.overlay.on("mousemove",this.onMouseMove,this);this.overlay.on("mouseup",this.onMouseUp,this)}this.overlay.setStyle("cursor",A.el.getStyle("cursor"));this.resizing=true;this.startBox=this.el.getBox();this.startPoint=e.getXY();this.offsets=[(this.startBox.x+this.startBox.width)-this.startPoint[0],(this.startBox.y+this.startBox.height)-this.startPoint[1]];this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.overlay.show();if(this.constrainTo){var ct=Roo.get(this.constrainTo);this.resizeRegion=ct.getRegion().adjust(ct.getFrameWidth("t"),ct.getFrameWidth("l"),-ct.getFrameWidth("b"),-ct.getFrameWidth("r"))}this.proxy.setStyle("visibility","hidden");this.proxy.show();this.proxy.setBox(this.startBox);if(!this.dynamic){this.proxy.setStyle("visibility","visible")}}},onMouseDown:function(A,e){if(this.enabled){e.stopEvent();this.activeHandle=A;this.startSizing(e,A)}},onMouseUp:function(e){var A=this.resizeElement();this.resizing=false;this.handleOut();this.overlay.hide();this.proxy.hide();this.fireEvent("resize",this,A.width,A.height,e)},updateChildSize:function(){if(this.resizeChild){var el=this.el;var B=this.resizeChild;var A=this.adjustments;if(el.dom.offsetWidth){var b=el.getSize(true);B.setSize(b.width+A[0],b.height+A[1])}if(Roo.isIE){setTimeout(function(){if(el.dom.offsetWidth){var b=el.getSize(true);B.setSize(b.width+A[0],b.height+A[1])}},10)}}},snap:function(C,A,B){if(!A||!C)return C;var D=C;var m=C%A;if(m>0){if(m>(A/2)){D=C+(A-m)}else{D=C-m}}return Math.max(B,D)},resizeElement:function(){var A=this.proxy.getBox();if(this.updateBox){this.el.setBox(A,false,this.animate,this.duration,null,this.easing)}else{this.el.setSize(A.width,A.height,this.animate,this.duration,null,this.easing)}this.updateChildSize();if(!this.dynamic){this.proxy.hide()}return A},constrain:function(v,A,m,mx){if(v-A<m){A=v-m}else if(v-A>mx){A=mx-v}return A},onMouseMove:function(e){if(this.enabled){try{if(this.resizeRegion&&!this.resizeRegion.contains(e.getPoint())){return}var F=this.curSize||this.startBox;var x=this.startBox.x,y=this.startBox.y;var ox=x,oy=y;var w=F.width,h=F.height;var ow=w,oh=h;var mw=this.minWidth,mh=this.minHeight;var B=this.maxWidth,A=this.maxHeight;var wi=this.widthIncrement;var hi=this.heightIncrement;var G=e.getXY();var D=-(this.startPoint[0]-Math.max(this.minX,G[0]));var E=-(this.startPoint[1]-Math.max(this.minY,G[1]));var C=this.activeHandle.position;switch(C){case "east":w+=D;w=Math.min(Math.max(mw,w),B);break;case "south":h+=E;h=Math.min(Math.max(mh,h),A);break;case "southeast":w+=D;h+=E;w=Math.min(Math.max(mw,w),B);h=Math.min(Math.max(mh,h),A);break;case "north":E=this.constrain(h,E,mh,A);y+=E;h-=E;break;case "west":D=this.constrain(w,D,mw,B);x+=D;w-=D;break;case "northeast":w+=D;w=Math.min(Math.max(mw,w),B);E=this.constrain(h,E,mh,A);y+=E;h-=E;break;case "northwest":D=this.constrain(w,D,mw,B);E=this.constrain(h,E,mh,A);y+=E;h-=E;x+=D;w-=D;break;case "southwest":D=this.constrain(w,D,mw,B);h+=E;h=Math.min(Math.max(mh,h),A);x+=D;w-=D;break}var sw=this.snap(w,wi,mw);var sh=this.snap(h,hi,mh);if(sw!=w||sh!=h){switch(C){case "northeast":y-=sh-h;break;case "north":y-=sh-h;break;case "southwest":x-=sw-w;break;case "west":x-=sw-w;break;case "northwest":x-=sw-w;y-=sh-h;break}w=sw;h=sh}if(this.preserveRatio){switch(C){case "southeast":case "east":h=oh*(w/ow);h=Math.min(Math.max(mh,h),A);w=ow*(h/oh);break;case "south":w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);break;case "northeast":w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);break;case "north":var tw=w;w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);x+=(tw-w)/2;break;case "southwest":h=oh*(w/ow);h=Math.min(Math.max(mh,h),A);var tw=w;w=ow*(h/oh);x+=tw-w;break;case "west":var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),A);y+=(th-h)/2;var tw=w;w=ow*(h/oh);x+=tw-w;break;case "northwest":var tw=w;var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),A);w=ow*(h/oh);y+=th-h;x+=tw-w;break}}this.proxy.setBounds(x,y,w,h);if(this.dynamic){this.resizeElement()}}catch(e){}}},handleOver:function(){if(this.enabled){this.el.addClass("x-resizable-over")}},handleOut:function(){if(!this.resizing){this.el.removeClass("x-resizable-over")}},getEl:function(){return this.el},getResizeChild:function(){return this.resizeChild},destroy:function(A){this.proxy.remove();if(this.overlay){this.overlay.removeAllListeners();this.overlay.remove()}var ps=Roo.Resizable.positions;for(var k in ps){if(typeof ps[k]!="function"&&this[ps[k]]){var h=this[ps[k]];h.el.removeAllListeners();h.el.remove()}}if(A){this.el.update("");this.el.remove()}}});Roo.Resizable.positions={n:"north",s:"south",e:"east",w:"west",se:"southeast",sw:"southwest",nw:"northwest",ne:"northeast"};Roo.Resizable.Handle=function(rz,A,D,C){if(!this.tpl){var B=Roo.DomHelper.createTemplate({tag:"div",cls:"x-resizable-handle x-resizable-handle-{0}"});B.compile();Roo.Resizable.Handle.prototype.tpl=B}this.position=A;this.rz=rz;this.el=this.tpl.append(rz.el.dom,[this.position],true);this.el.unselectable();if(C){this.el.setOpacity(0)}this.el.on("mousedown",this.onMouseDown,this);if(!D){this.el.on("mouseover",this.onMouseOver,this);this.el.on("mouseout",this.onMouseOut,this)}};Roo.Resizable.Handle.prototype={afterResize:function(rz){},onMouseDown:function(e){this.rz.onMouseDown(this,e)},onMouseOver:function(e){this.rz.handleOver(this,e)},onMouseOut:function(e){this.rz.handleOut(this,e)}};
-Roo.Editor=function(A,B){Roo.Editor.superclass.constructor.call(this,B);this.field=A;this.addEvents({"beforestartedit":true,startedit:true,beforecomplete:true,complete:true,specialkey:true})};Roo.extend(Roo.Editor,Roo.Component,{value:"",alignment:"c-c?",shadow:"frame",constrain:false,completeOnEnter:false,cancelOnEsc:false,updateEl:false,onRender:function(ct,A){this.el=new Roo.Layer({shadow:this.shadow,cls:"x-editor",parentEl:ct,shim:this.shim,shadowOffset:4,id:this.id,constrain:this.constrain});this.el.setStyle("overflow",Roo.isGecko?"auto":"hidden");if(this.field.msgTarget!="title"){this.field.msgTarget="qtip"}this.field.render(this.el);if(Roo.isGecko){this.field.el.dom.setAttribute("autocomplete","off")}this.field.on("specialkey",this.onSpecialKey,this);if(this.swallowKeys){this.field.el.swallowEvent(["keydown","keypress"])}this.field.show();this.field.on("blur",this.onBlur,this);if(this.field.grow){this.field.on("autosize",this.el.sync,this.el,{delay:1})}},onSpecialKey:function(A,e){if(this.completeOnEnter&&e.getKey()==e.ENTER){e.stopEvent();this.completeEdit()}else if(this.cancelOnEsc&&e.getKey()==e.ESC){this.cancelEdit()}else{this.fireEvent("specialkey",A,e)}},startEdit:function(el,A){if(this.editing){this.completeEdit()}this.boundEl=Roo.get(el);var v=A!==undefined?A:this.boundEl.dom.innerHTML;if(!this.rendered){this.render(this.parentEl||document.body)}if(this.fireEvent("beforestartedit",this,this.boundEl,v)===false){return}this.startValue=v;this.field.setValue(v);if(this.autoSize){var sz=this.boundEl.getSize();switch(this.autoSize){case "width":this.setSize(sz.width,"");break;case "height":this.setSize("",sz.height);break;default:this.setSize(sz.width,sz.height)}}this.el.alignTo(this.boundEl,this.alignment);this.editing=true;if(Roo.QuickTips){Roo.QuickTips.disable()}this.show()},setSize:function(w,h){this.field.setSize(w,h);if(this.el){this.el.sync()}},realign:function(){this.el.alignTo(this.boundEl,this.alignment)},completeEdit:function(A){if(!this.editing){return}var v=this.getValue();if(this.revertInvalid!==false&&!this.field.isValid()){v=this.startValue;this.cancelEdit(true)}if(String(v)===String(this.startValue)&&this.ignoreNoChange){this.editing=false;this.hide();return}if(this.fireEvent("beforecomplete",this,v,this.startValue)!==false){this.editing=false;if(this.updateEl&&this.boundEl){this.boundEl.update(v)}if(A!==true){this.hide()}this.fireEvent("complete",this,v,this.startValue)}},onShow:function(){this.el.show();if(this.hideEl!==false){this.boundEl.hide()}this.field.show();if(Roo.isIE&&!this.fixIEFocus){this.fixIEFocus=true;this.deferredFocus.defer(50,this)}else{this.field.focus()}this.fireEvent("startedit",this.boundEl,this.startValue)},deferredFocus:function(){if(this.editing){this.field.focus()}},cancelEdit:function(A){if(this.editing){this.setValue(this.startValue);if(A!==true){this.hide()}}},onBlur:function(){if(this.allowBlur!==true&&this.editing){this.completeEdit()}},onHide:function(){if(this.editing){this.completeEdit();return}this.field.blur();if(this.field.collapse){this.field.collapse()}this.el.hide();if(this.hideEl!==false){this.boundEl.show()}if(Roo.QuickTips){Roo.QuickTips.enable()}},setValue:function(v){this.field.setValue(v)},getValue:function(){return this.field.getValue()}});
-Roo.BasicDialog=function(el,B){this.el=Roo.get(el);var dh=Roo.DomHelper;if(!this.el&&B&&B.autoCreate){if(typeof B.autoCreate=="object"){if(!B.autoCreate.id){B.autoCreate.id=el;}this.el=dh.append(document.body,B.autoCreate,true);}else{this.el=dh.append(document.body,{tag:"div",id:el,style:"visibility:hidden;"},true);
-}}el=this.el;el.setDisplayed(true);el.hide=this.hideAction;this.id=el.id;el.addClass("x-dlg");Roo.apply(this,B);this.proxy=el.createProxy("x-dlg-proxy");this.proxy.hide=this.hideAction;this.proxy.setOpacity(0.5);this.proxy.hide();if(B.width){el.setWidth(B.width);
-}if(B.height){el.setHeight(B.height);}this.size=el.getSize();if(typeof B.x!="undefined"&&typeof B.y!="undefined"){this.xy=[B.x,B.y];}else{this.xy=el.getCenterXY(true);}this.header=el.child("> .x-dlg-hd");this.body=el.child("> .x-dlg-bd");this.footer=el.child("> .x-dlg-ft");
-if(!this.header){this.header=el.createChild({tag:"div",cls:"x-dlg-hd",html:"&#160;"},this.body?this.body.dom:null);}if(!this.body){this.body=el.createChild({tag:"div",cls:"x-dlg-bd"});}this.header.unselectable();if(this.title){this.header.update(this.title);
-}this.focusEl=el.createChild({tag:"a",href:"#",cls:"x-dlg-focus",tabIndex:"-1"});this.focusEl.swallowEvent("click",true);this.header.wrap({cls:"x-dlg-hd-right"}).wrap({cls:"x-dlg-hd-left"},true);this.bwrap=this.body.wrap({tag:"div",cls:"x-dlg-dlg-body"});
-if(this.footer){this.bwrap.dom.appendChild(this.footer.dom);}this.bg=this.el.createChild({tag:"div",cls:"x-dlg-bg",html:"<div class=\"x-dlg-bg-left\"><div class=\"x-dlg-bg-right\"><div class=\"x-dlg-bg-center\">&#160;</div></div></div>"});this.centerBg=this.bg.child("div.x-dlg-bg-center");
-if(this.autoScroll!==false&&!this.autoTabs){this.body.setStyle("overflow","auto");}this.toolbox=this.el.createChild({cls:"x-dlg-toolbox"});if(this.closable!==false){this.el.addClass("x-dlg-closable");this.close=this.toolbox.createChild({cls:"x-dlg-close"});
-this.close.on("click",this.closeClick,this);this.close.addClassOnOver("x-dlg-close-over");}if(this.collapsible!==false){this.collapseBtn=this.toolbox.createChild({cls:"x-dlg-collapse"});this.collapseBtn.on("click",this.collapseClick,this);this.collapseBtn.addClassOnOver("x-dlg-collapse-over");
-this.header.on("dblclick",this.collapseClick,this);}if(this.resizable!==false){this.el.addClass("x-dlg-resizable");this.resizer=new Roo.Resizable(el,{minWidth:this.minWidth||80,minHeight:this.minHeight||80,handles:this.resizeHandles||"all",pinned:true});this.resizer.on("beforeresize",this.beforeResize,this);
-this.resizer.on("resize",this.onResize,this);}if(this.draggable!==false){el.addClass("x-dlg-draggable");if(!this.proxyDrag){var dd=new Roo.dd.DD(el.dom.id,"WindowDrag");}else{var dd=new Roo.dd.DDProxy(el.dom.id,"WindowDrag",{dragElId:this.proxy.id});}dd.setHandleElId(this.header.id);
-dd.endDrag=this.endMove.createDelegate(this);dd.startDrag=this.startMove.createDelegate(this);dd.onDrag=this.onDrag.createDelegate(this);dd.scroll=false;this.dd=dd;}if(this.modal){this.mask=dh.append(document.body,{tag:"div",cls:"x-dlg-mask"},true);this.mask.enableDisplayMode("block");
-this.mask.hide();this.el.addClass("x-dlg-modal");}if(this.shadow){this.shadow=new Roo.Shadow({mode:typeof this.shadow=="string"?this.shadow:"sides",offset:this.shadowOffset});}else{this.shadowOffset=0;}if(Roo.useShims&&this.shim!==false){this.shim=this.el.createShim();
-this.shim.hide=this.hideAction;this.shim.hide();}else{this.shim=false;}if(this.autoTabs){this.initTabs();}if(this.buttons){var A=this.buttons;this.buttons=[];Roo.each(A,function(b){this.addButton(b);},this);}this.addEvents({"keydown":true,move:true,resize:true,beforehide:true,hide:true,beforeshow:true,show:true});
-el.on("keydown",this.onKeyDown,this);el.on("mousedown",this.toFront,this);Roo.EventManager.onWindowResize(this.adjustViewport,this,true);this.el.hide();Roo.DialogManager.register(this);Roo.BasicDialog.superclass.constructor.call(this);};Roo.extend(Roo.BasicDialog,Roo.util.Observable,{shadowOffset:Roo.isIE?6:5,minHeight:80,minWidth:200,minButtonWidth:75,defaultButton:null,buttonAlign:"right",tabTag:"div",firstShow:true,setTitle:function(A){this.header.update(A);
-return this;},closeClick:function(){this.hide();},collapseClick:function(){this[this.collapsed?"expand":"collapse"]();},collapse:function(){if(!this.collapsed){this.collapsed=true;this.el.addClass("x-dlg-collapsed");this.restoreHeight=this.el.getHeight();
-this.resizeTo(this.el.getWidth(),this.header.getHeight());}},expand:function(){if(this.collapsed){this.collapsed=false;this.el.removeClass("x-dlg-collapsed");this.resizeTo(this.el.getWidth(),this.restoreHeight);}},initTabs:function(){var A=this.getTabs();
-while(A.getTab(0)){A.removeTab(0);}this.el.select(this.tabTag+".x-dlg-tab").each(function(el){var B=el.dom;A.addTab(Roo.id(B),B.title);B.title="";});A.activate(0);return A;},beforeResize:function(){this.resizer.minHeight=Math.max(this.minHeight,this.getHeaderFooterHeight(true)+40);
-},onResize:function(){this.refreshSize();this.syncBodyHeight();this.adjustAssets();this.focus();this.fireEvent("resize",this,this.size.width,this.size.height);},onKeyDown:function(e){if(this.isVisible()){this.fireEvent("keydown",this,e);}},resizeTo:function(A,B){this.el.setSize(A,B);
-this.size={width:A,height:B};this.syncBodyHeight();if(this.fixedcenter){this.center();}if(this.isVisible()){this.constrainXY();this.adjustAssets();}this.fireEvent("resize",this,A,B);return this;},setContentSize:function(w,h){h+=this.getHeaderFooterHeight()+this.body.getMargins("tb");
-w+=this.body.getMargins("lr")+this.bwrap.getMargins("lr")+this.centerBg.getPadding("lr");h+=this.body.getPadding("tb")+this.bwrap.getBorderWidth("tb")+this.body.getBorderWidth("tb")+this.el.getBorderWidth("tb");w+=this.body.getPadding("lr")+this.bwrap.getBorderWidth("lr")+this.body.getBorderWidth("lr")+this.bwrap.getPadding("lr")+this.el.getBorderWidth("lr");
-if(this.tabs){h+=this.tabs.stripWrap.getHeight()+this.tabs.bodyEl.getMargins("tb")+this.tabs.bodyEl.getPadding("tb");w+=this.tabs.bodyEl.getMargins("lr")+this.tabs.bodyEl.getPadding("lr");}this.resizeTo(w,h);return this;},addKeyListener:function(B,fn,D){var G,E,C,A;
-if(typeof B=="object"&&!(B instanceof Array)){G=B["key"];E=B["shift"];C=B["ctrl"];A=B["alt"];}else{G=B;}var F=function(H,e){if((!E||e.shiftKey)&&(!C||e.ctrlKey)&&(!A||e.altKey)){var k=e.getKey();if(G instanceof Array){for(var i=0,I=G.length;i<I;i++){if(G[i]==k){fn.call(D||window,H,k,e);
-return;}}}else{if(k==G){fn.call(D||window,H,k,e);}}}};this.on("keydown",F);return this;},getTabs:function(){if(!this.tabs){this.el.addClass("x-dlg-auto-tabs");this.body.addClass(this.tabPosition=="bottom"?"x-tabs-bottom":"x-tabs-top");this.tabs=new Roo.TabPanel(this.body.dom,this.tabPosition=="bottom");
-}return this.tabs;},addButton:function(C,E,B){var dh=Roo.DomHelper;if(!this.footer){this.footer=dh.append(this.bwrap,{tag:"div",cls:"x-dlg-ft"},true);}if(!this.btnContainer){var tb=this.footer.createChild({cls:"x-dlg-btns x-dlg-btns-"+this.buttonAlign,html:"<table cellspacing=\"0\"><tbody><tr></tr></tbody></table><div class=\"x-clear\"></div>"},null,true);
-this.btnContainer=tb.firstChild.firstChild.firstChild;}var D={handler:E,scope:B,minWidth:this.minButtonWidth,hideParent:true};if(typeof C=="string"){D.text=C;}else{if(C.tag){D.dhconfig=C;}else{Roo.apply(D,C);}}var fc=false;if((typeof (D.position)!="undefined")&&D.position<this.btnContainer.childNodes.length-1){D.position=Math.max(0,D.position);
-fc=this.btnContainer.childNodes[D.position];}var A=new Roo.Button(fc?this.btnContainer.insertBefore(document.createElement("td"),fc):this.btnContainer.appendChild(document.createElement("td")),D);this.syncBodyHeight();if(!this.buttons){this.buttons=[];}this.buttons.push(A);
-return A;},setDefaultButton:function(A){this.defaultButton=A;return this;},getHeaderFooterHeight:function(A){var B=0;if(this.header){B+=this.header.getHeight();}if(this.footer){var fm=this.footer.getMargins();B+=(this.footer.getHeight()+fm.top+fm.bottom);
-}B+=this.bwrap.getPadding("tb")+this.bwrap.getBorderWidth("tb");B+=this.centerBg.getPadding("tb");return B;},syncBodyHeight:function(){var bd=this.body,cb=this.centerBg,bw=this.bwrap;var A=this.size.height-this.getHeaderFooterHeight(false);bd.setHeight(A-bd.getMargins("tb"));
-var hh=this.header.getHeight();var h=this.size.height-hh;cb.setHeight(h);bw.setLeftTop(cb.getPadding("l"),hh+cb.getPadding("t"));bw.setHeight(h-cb.getPadding("tb"));bw.setWidth(this.el.getWidth(true)-cb.getPadding("lr"));bd.setWidth(bw.getWidth(true));if(this.tabs){this.tabs.syncHeight();
-if(Roo.isIE){this.tabs.el.repaint();}}},restoreState:function(){var A=Roo.state.Manager.get(this.stateId||(this.el.id+"-state"));if(A&&A.width){this.xy=[A.x,A.y];this.resizeTo(A.width,A.height);}return this;},beforeShow:function(){this.expand();if(this.fixedcenter){this.xy=this.el.getCenterXY(true);
-}if(this.modal){Roo.get(document.body).addClass("x-body-masked");this.mask.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.mask.show();}this.constrainXY();},animShow:function(){var b=Roo.get(this.animateTarget,true).getBox();this.proxy.setSize(b.width,b.height);
-this.proxy.setLocation(b.x,b.y);this.proxy.show();this.proxy.setBounds(this.xy[0],this.xy[1],this.size.width,this.size.height,true,0.35,this.showEl.createDelegate(this));},show:function(A){if(this.fireEvent("beforeshow",this)===false){return;}if(this.syncHeightBeforeShow){this.syncBodyHeight();
-}else if(this.firstShow){this.firstShow=false;this.syncBodyHeight();}this.animateTarget=A||this.animateTarget;if(!this.el.isVisible()){this.beforeShow();if(this.animateTarget){this.animShow();}else{this.showEl();}}return this;},showEl:function(){this.proxy.hide();
-this.el.setXY(this.xy);this.el.show();this.adjustAssets(true);this.toFront();this.focus();if(Roo.isIE){this.el.repaint();}this.fireEvent("show",this);},focus:function(){if(this.defaultButton){this.defaultButton.focus();}else{this.focusEl.focus();}},constrainXY:function(){if(this.constraintoviewport!==false){if(!this.viewSize){if(this.container){var s=this.container.getSize();
-this.viewSize=[s.width,s.height];}else{this.viewSize=[Roo.lib.Dom.getViewWidth(),Roo.lib.Dom.getViewHeight()];}}var s=Roo.get(this.container||document).getScroll();var x=this.xy[0],y=this.xy[1];var w=this.size.width,h=this.size.height;var vw=this.viewSize[0],vh=this.viewSize[1];
-var A=false;if(x+w>vw+s.left){x=vw-w;A=true;}if(y+h>vh+s.top){y=vh-h;A=true;}if(x<s.left){x=s.left;A=true;}if(y<s.top){y=s.top;A=true;}if(A){this.xy=[x,y];if(this.isVisible()){this.el.setLocation(x,y);this.adjustAssets();}}}},onDrag:function(){if(!this.proxyDrag){this.xy=this.el.getXY();
-this.adjustAssets();}},adjustAssets:function(A){var x=this.xy[0],y=this.xy[1];var w=this.size.width,h=this.size.height;if(A===true){if(this.shadow){this.shadow.show(this.el);}if(this.shim){this.shim.show();}}if(this.shadow&&this.shadow.isVisible()){this.shadow.show(this.el);
-}if(this.shim&&this.shim.isVisible()){this.shim.setBounds(x,y,w,h);}},adjustViewport:function(w,h){if(!w||!h){w=Roo.lib.Dom.getViewWidth();h=Roo.lib.Dom.getViewHeight();}this.viewSize=[w,h];if(this.modal&&this.mask.isVisible()){this.mask.setSize(w,h);this.mask.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));
-}if(this.isVisible()){this.constrainXY();}},destroy:function(B){if(this.isVisible()){this.animateTarget=null;this.hide();}Roo.EventManager.removeResizeListener(this.adjustViewport,this);if(this.tabs){this.tabs.destroy(B);}Roo.destroy(this.shim,this.proxy,this.resizer,this.close,this.mask);
-if(this.dd){this.dd.unreg();}if(this.buttons){for(var i=0,A=this.buttons.length;i<A;i++){this.buttons[i].destroy();}}this.el.removeAllListeners();if(B===true){this.el.update("");this.el.remove();}Roo.DialogManager.unregister(this);},startMove:function(){if(this.proxyDrag){this.proxy.show();
-}if(this.constraintoviewport!==false){this.dd.constrainTo(document.body,{right:this.shadowOffset,bottom:this.shadowOffset});}},endMove:function(){if(!this.proxyDrag){Roo.dd.DD.prototype.endDrag.apply(this.dd,arguments);}else{Roo.dd.DDProxy.prototype.endDrag.apply(this.dd,arguments);
-this.proxy.hide();}this.refreshSize();this.adjustAssets();this.focus();this.fireEvent("move",this,this.xy[0],this.xy[1]);},toFront:function(){Roo.DialogManager.bringToFront(this);return this;},toBack:function(){Roo.DialogManager.sendToBack(this);return this;
-},center:function(){var xy=this.el.getCenterXY(true);this.moveTo(xy[0],xy[1]);return this;},moveTo:function(x,y){this.xy=[x,y];if(this.isVisible()){this.el.setXY(this.xy);this.adjustAssets();}return this;},alignTo:function(A,C,B){this.xy=this.el.getAlignToXY(A,C,B);
-if(this.isVisible()){this.el.setXY(this.xy);this.adjustAssets();}return this;},anchorTo:function(el,C,B,D){var A=function(){this.alignTo(el,C,B);};Roo.EventManager.onWindowResize(A,this);var tm=typeof D;if(tm!="undefined"){Roo.EventManager.on(window,"scroll",A,this,{buffer:tm=="number"?D:50});
-}A.call(this);return this;},isVisible:function(){return this.el.isVisible();},animHide:function(A){var b=Roo.get(this.animateTarget).getBox();this.proxy.show();this.proxy.setBounds(this.xy[0],this.xy[1],this.size.width,this.size.height);this.el.hide();this.proxy.setBounds(b.x,b.y,b.width,b.height,true,0.35,this.hideEl.createDelegate(this,[A]));
-},hide:function(A){if(this.fireEvent("beforehide",this)===false){return;}if(this.shadow){this.shadow.hide();}if(this.shim){this.shim.hide();}if(this.animateTarget){this.animHide(A);}else{this.el.hide();this.hideEl(A);}return this;},hideEl:function(A){this.proxy.hide();
-if(this.modal){this.mask.hide();Roo.get(document.body).removeClass("x-body-masked");}this.fireEvent("hide",this);if(typeof A=="function"){A();}},hideAction:function(){this.setLeft("-10000px");this.setTop("-10000px");this.setStyle("visibility","hidden");},refreshSize:function(){this.size=this.el.getSize();
-this.xy=this.el.getXY();Roo.state.Manager.set(this.stateId||this.el.id+"-state",this.el.getBox());},setZIndex:function(A){if(this.modal){this.mask.setStyle("z-index",A);}if(this.shim){this.shim.setStyle("z-index",++A);}if(this.shadow){this.shadow.setZIndex(++A);
-}this.el.setStyle("z-index",++A);if(this.proxy){this.proxy.setStyle("z-index",++A);}if(this.resizer){this.resizer.proxy.setStyle("z-index",++A);}this.lastZIndex=A;},getEl:function(){return this.el;}});Roo.DialogManager=function(){var A={};var C=[];var B=null;
-var D=function(d1,d2){return (!d1._lastAccess||d1._lastAccess<d2._lastAccess)?-1:1;};var E=function(){C.sort(D);var H=Roo.DialogManager.zseed;for(var i=0,G=C.length;i<G;i++){var F=C[i];if(F){F.setZIndex(H+(i*10));}}};return {zseed:9000,register:function(F){A[F.id]=F;
-C.push(F);},unregister:function(F){delete A[F.id];var i=0;var G=0;if(!C.indexOf){for(i=0,G=C.length;i<G;i++){if(C[i]==F){C.splice(i,1);return;}}}else{i=C.indexOf(F);if(i!=-1){C.splice(i,1);}}},get:function(id){return typeof id=="object"?id:A[id];},bringToFront:function(F){F=this.get(F);
-if(F!=B){B=F;F._lastAccess=new Date().getTime();E();}return F;},sendToBack:function(F){F=this.get(F);F._lastAccess=-(new Date().getTime());E();return F;},hideAll:function(){for(var id in A){if(A[id]&&typeof A[id]!="function"&&A[id].isVisible()){A[id].hide();
-}}}};}();Roo.LayoutDialog=function(el,A){var B=A;if(typeof (A)=="undefined"){B=Roo.apply({},el);el=Roo.get(document.documentElement||document.body).createChild();}B.autoTabs=false;Roo.LayoutDialog.superclass.constructor.call(this,el,B);this.body.setStyle({overflow:"hidden",position:"relative"});
-this.layout=new Roo.BorderLayout(this.body.dom,B);this.layout.monitorWindowResize=false;this.el.addClass("x-dlg-auto-layout");this.center=Roo.BasicDialog.prototype.center;this.on("show",this.layout.layout,this.layout,true);if(B.items){var C=B.items;delete B.items;
-Roo.each(C,this.addxtype,this);}};Roo.extend(Roo.LayoutDialog,Roo.BasicDialog,{endUpdate:function(){this.layout.endUpdate();},beginUpdate:function(){this.layout.beginUpdate();},getLayout:function(){return this.layout;},showEl:function(){Roo.LayoutDialog.superclass.showEl.apply(this,arguments);
-if(Roo.isIE7){this.layout.layout();}},syncBodyHeight:function(){Roo.LayoutDialog.superclass.syncBodyHeight.call(this);if(this.layout){this.layout.layout();}},addxtype:function(c){return this.layout.addxtype(c);}});
-Roo.MessageBox=function(){var A,B,C,J;var E,D,I,M,L,pp;var G,N,F;var O=function(Q){A.hide();Roo.callback(B.fn,B.scope||window,[Q,N.dom.value],1)};var K=function(){if(B&&B.cls){A.el.removeClass(B.cls)}if(J){Roo.TaskMgr.stop(J);J=null}};var P=function(b){var Q=0;if(!b){G["ok"].hide();G["cancel"].hide();G["yes"].hide();G["no"].hide();A.footer.dom.style.display="none";return Q}A.footer.dom.style.display="";for(var k in G){if(typeof G[k]!="function"){if(b[k]){G[k].show();G[k].setText(typeof b[k]=="string"?b[k]:Roo.MessageBox.buttonText[k]);Q+=G[k].el.getWidth()+15}else{G[k].hide()}}}return Q};var H=function(d,k,e){if(B&&B.closable!==false){A.hide()}if(e){e.stopEvent()}};return {getDialog:function(){if(!A){A=new Roo.BasicDialog("x-msg-box",{autoCreate:true,shadow:true,draggable:true,resizable:false,constraintoviewport:false,fixedcenter:true,collapsible:false,shim:true,modal:true,width:400,height:100,buttonAlign:"center",closeClick:function(){if(B&&B.buttons&&B.buttons.no&&!B.buttons.cancel){O("no")}else{O("cancel")}}});A.on("hide",K);C=A.mask;A.addKeyListener(27,H);G={};var bt=this.buttonText;G["ok"]=A.addButton(bt["ok"],O.createCallback("ok"));G["yes"]=A.addButton(bt["yes"],O.createCallback("yes"));G["no"]=A.addButton(bt["no"],O.createCallback("no"));G["cancel"]=A.addButton(bt["cancel"],O.createCallback("cancel"));E=A.body.createChild({html:"<span class=\"roo-mb-text\"></span><br /><input type=\"text\" class=\"roo-mb-input\" /><textarea class=\"roo-mb-textarea\"></textarea><div class=\"roo-mb-progress-wrap\"><div class=\"roo-mb-progress\"><div class=\"roo-mb-progress-bar\">&#160;</div></div></div>"});D=E.dom.firstChild;I=Roo.get(E.dom.childNodes[2]);I.enableDisplayMode();I.addKeyListener([10,13],function(){if(A.isVisible()&&B&&B.buttons){if(B.buttons.ok){O("ok")}else if(B.buttons.yes){O("yes")}}});M=Roo.get(E.dom.childNodes[3]);M.enableDisplayMode();L=Roo.get(E.dom.childNodes[4]);L.enableDisplayMode();var pf=L.dom.firstChild;if(pf){pp=Roo.get(pf.firstChild);pp.setHeight(pf.offsetHeight)}}return A},updateText:function(Q){if(!A.isVisible()&&!B.width){A.resizeTo(this.maxWidth,100)}D.innerHTML=Q||"&#160;";var w=Math.max(Math.min(B.width||D.offsetWidth,this.maxWidth),Math.max(B.minWidth||this.minWidth,F));if(B.prompt){N.setWidth(w)}if(A.isVisible()){A.fixedcenter=false}A.setContentSize(w,E.getHeight());if(A.isVisible()){A.fixedcenter=true}return this},updateProgress:function(R,Q){if(Q){this.updateText(Q)}if(pp){pp.setWidth(Math.floor(R*L.dom.firstChild.offsetWidth))}return this},isVisible:function(){return A&&A.isVisible()},hide:function(){if(this.isVisible()){A.hide()}},show:function(Q){if(this.isVisible()){this.hide()}var d=this.getDialog();B=Q;d.setTitle(B.title||"&#160;");d.close.setDisplayed(B.closable!==false);N=I;B.prompt=B.prompt||(B.multiline?true:false);if(B.prompt){if(B.multiline){I.hide();M.show();M.setHeight(typeof B.multiline=="number"?B.multiline:this.defaultTextHeight);N=M}else{I.show();M.hide()}}else{I.hide();M.hide()}L.setDisplayed(B.progress===true);this.updateProgress(0);N.dom.value=B.value||"";if(B.prompt){A.setDefaultButton(N)}else{var bs=B.buttons;var db=null;if(bs&&bs.ok){db=G["ok"]}else if(bs&&bs.yes){db=G["yes"]}A.setDefaultButton(db)}F=P(B.buttons);this.updateText(B.msg);if(B.cls){d.el.addClass(B.cls)}d.proxyDrag=B.proxyDrag===true;d.modal=B.modal!==false;d.mask=B.modal!==false?C:false;if(!d.isVisible()){document.body.appendChild(A.el.dom);d.animateTarget=null;d.show(Q.animEl)}return this},progress:function(R,Q){this.show({title:R,msg:Q,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,modal:true});return this},alert:function(S,Q,fn,R){this.show({title:S,msg:Q,buttons:this.OK,fn:fn,scope:R,modal:true});return this},wait:function(Q,R){this.show({title:R,msg:Q,buttons:false,closable:false,progress:true,modal:true,width:300,wait:true});J=Roo.TaskMgr.start({run:function(i){Roo.MessageBox.updateProgress(((((i+20)%20)+1)*5)*0.01)},interval:1000});return this},confirm:function(S,Q,fn,R){this.show({title:S,msg:Q,buttons:this.YESNO,fn:fn,scope:R,modal:true});return this},prompt:function(S,Q,fn,R,T){this.show({title:S,msg:Q,buttons:this.OKCANCEL,fn:fn,minWidth:250,scope:R,prompt:true,multiline:T,modal:true});return this},OK:{ok:true},YESNO:{yes:true,no:true},OKCANCEL:{ok:true,cancel:true},YESNOCANCEL:{yes:true,no:true,cancel:true},defaultTextHeight:75,maxWidth:600,minWidth:100,minProgressWidth:250,buttonText:{ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"}}}();Roo.Msg=Roo.MessageBox;
-Roo.QuickTips=function(){var el,P,Z,U,tm,A,E,N={},B,X=null,H,O;var ce,bd,xy,dd;var Q=false,R=true,J=false;var T=1,S=1,Y=1,F=[];var M=function(e){if(R){return}var t=e.getTarget();if(!t||t.nodeType!==1||t==document||t==document.body){return}if(ce&&t==ce.el){clearTimeout(S);return}if(t&&N[t.id]){N[t.id].el=t;T=D.defer(tm.showDelay,tm,[N[t.id]]);return}var a,et=Roo.fly(t);var ns=A.namespace;if(tm.interceptTitles&&t.title){a=t.title;t.qtip=a;t.removeAttribute("title");e.preventDefault()}else{a=t.qtip||et.getAttributeNS(ns,A.attribute)}if(a){T=D.defer(tm.showDelay,tm,[{el:t,text:a,width:et.getAttributeNS(ns,A.width),autoHide:et.getAttributeNS(ns,A.hide)!="user",title:et.getAttributeNS(ns,A.title),cls:et.getAttributeNS(ns,A.cls)}])}};var G=function(e){clearTimeout(T);var t=e.getTarget();if(t&&ce&&ce.el==t&&(tm.autoHide&&ce.autoHide!==false)){S=setTimeout(C,tm.hideDelay)}};var L=function(e){if(R){return}xy=e.getXY();xy[1]+=18;if(tm.trackMouse&&ce){el.setXY(xy)}};var K=function(e){clearTimeout(T);clearTimeout(S);if(!e.within(el)){if(tm.hideOnClick){C();tm.disable();tm.enable.defer(100,tm)}}};var I=function(){return 2};var D=function(o){if(R){return}clearTimeout(Y);ce=o;if(X){el.removeClass(X);X=null}if(ce.cls){el.addClass(ce.cls);X=ce.cls}if(ce.title){U.update(ce.title);U.show()}else{U.update("");U.hide()}el.dom.style.width=tm.maxWidth+"px";Z.update(o.text);var p=I(),w=ce.width;if(!w){var td=Z.dom;var aw=Math.max(td.offsetWidth,td.clientWidth,td.scrollWidth);if(aw>tm.maxWidth){w=tm.maxWidth}else if(aw<tm.minWidth){w=tm.minWidth}else{w=aw}}el.setWidth(parseInt(w,10)+p);if(ce.autoHide===false){E.setDisplayed(true);if(dd){dd.unlock()}}else{E.setDisplayed(false);if(dd){dd.lock()}}if(xy){el.avoidY=xy[1]-18;el.setXY(xy)}if(tm.animate){el.setOpacity(0.1);el.setStyle("visibility","visible");el.fadeIn({callback:W})}else{W()}};var W=function(){if(ce){el.show();B.enable();if(tm.autoDismiss&&ce.autoHide!==false){Y=setTimeout(C,tm.autoDismissDelay)}}};var C=function(a){clearTimeout(Y);clearTimeout(S);ce=null;if(el.isVisible()){B.disable();if(a!==true&&tm.animate){el.fadeOut({callback:V})}else{V()}}};var V=function(){el.hide();if(X){el.removeClass(X);X=null}};return {minWidth:40,maxWidth:300,interceptTitles:false,trackMouse:false,hideOnClick:true,showDelay:500,hideDelay:200,autoHide:true,autoDismiss:true,autoDismissDelay:5000,animate:false,init:function(){tm=Roo.QuickTips;A=tm.tagConfig;if(!J){if(!Roo.isReady){Roo.onReady(Roo.QuickTips.init,Roo.QuickTips);return}el=new Roo.Layer({cls:"x-tip",shadow:"drop",shim:true,constrain:true,shadowOffset:4});el.fxDefaults={stopFx:true};el.update("<div class=\"x-tip-bd\"><div class=\"x-tip-close\"></div><h3></h3><div class=\"x-tip-bd-inner\"></div><div class=\"x-clear\"></div></div>");U=el.child("h3");U.enableDisplayMode("block");P=el.child("div.x-tip-bd");Z=el.child("div.x-tip-bd-inner");E=el.child("div.x-tip-close");E.enableDisplayMode("block");E.on("click",C);var d=Roo.get(document);d.on("mousedown",K);d.on("mouseover",M);d.on("mouseout",G);d.on("mousemove",L);B=d.addKeyListener(27,C);B.disable();if(Roo.dd.DD){dd=el.initDD("default",null,{onDrag:function(){el.sync()}});dd.setHandleElId(U.id);dd.lock()}J=true}this.enable()},register:function(d){var cs=d instanceof Array?d:arguments;for(var i=0,a=cs.length;i<a;i++){var c=cs[i];var e=c.target;if(e){if(e instanceof Array){for(var j=0,b=e.length;j<b;j++){N[e[j]]=c}}else{N[typeof e=="string"?e:Roo.id(e)]=c}}}},unregister:function(el){delete N[Roo.id(el)]},enable:function(){if(J&&R){F.pop();if(F.length<1){R=false}}},disable:function(){R=true;clearTimeout(T);clearTimeout(S);clearTimeout(Y);if(ce){C(true)}F.push(1)},isEnabled:function(){return !R},tagConfig:{namespace:"ext",attribute:"qtip",width:"width",target:"target",title:"qtitle",hide:"hide",cls:"qclass"}}}();Roo.QuickTips.tips=Roo.QuickTips.register;
-Roo.tree.TreePanel=function(el,B){var A=false;var C=false;if(B.root){A=B.root;delete B.root;}if(B.loader){C=B.loader;delete B.loader;}Roo.apply(this,B);Roo.tree.TreePanel.superclass.constructor.call(this);this.el=Roo.get(el);this.el.addClass("x-tree");if(A){this.setRootNode(Roo.factory(A,Roo.tree));
-}if(C){this.loader=Roo.factory(C,Roo.tree);}this.id=this.el.id;this.addEvents({"beforeload":true,load:true,textchange:true,beforeexpand:true,beforecollapse:true,expand:true,disabledchange:true,collapse:true,beforeclick:true,checkchange:true,click:true,dblclick:true,contextmenu:true,beforechildrenrendered:true,startdrag:true,enddrag:true,dragdrop:true,beforenodedrop:true,nodedrop:true,nodedragover:true});
-if(this.singleExpand){this.on("beforeexpand",this.restrictExpand,this);}};Roo.extend(Roo.tree.TreePanel,Roo.data.Tree,{rootVisible:true,animate:Roo.enableFx,lines:true,enableDD:false,hlDrop:Roo.enableFx,renderer:false,rendererTip:false,restrictExpand:function(A){var p=A.parentNode;
-if(p){if(p.expandedChild&&p.expandedChild.parentNode==p){p.expandedChild.collapse();}p.expandedChild=A;}},setRootNode:function(A){Roo.tree.TreePanel.superclass.setRootNode.call(this,A);if(!this.rootVisible){A.ui=new Roo.tree.RootTreeNodeUI(A);}return A;},getEl:function(){return this.el;
-},getLoader:function(){return this.loader;},expandAll:function(){this.root.expand(true);},collapseAll:function(){this.root.collapse(true);},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.tree.DefaultSelectionModel();}return this.selModel;
-},getChecked:function(a,A){A=A||this.root;var r=[];var f=function(){if(this.attributes.checked){r.push(!a?this:(a=="id"?this.id:this.attributes[a]));}};A.cascade(f);return r;},expandPath:function(C,A,F){A=A||"id";var B=C.split(this.pathSeparator);var E=this.root;
-if(E.attributes[A]!=B[1]){if(F){F(false,null);}return;}var D=1;var f=function(){if(++D==B.length){if(F){F(true,E);}return;}var c=E.findChild(A,B[D]);if(!c){if(F){F(false,E);}return;}E=c;c.expand(false,false,f);};E.expand(false,false,f);},selectPath:function(C,A,D){A=A||"id";
-var B=C.split(this.pathSeparator);var v=B.pop();if(B.length>0){var f=function(F,E){if(F&&E){var n=E.findChild(A,v);if(n){n.select();if(D){D(true,n);}}else if(D){D(false,n);}}else{if(D){D(false,n);}}};this.expandPath(B.join(this.pathSeparator),A,f);}else{this.root.select();
-if(D){D(true,this.root);}}},getTreeEl:function(){return this.el;},render:function(){if(this.innerCt){return this;}this.innerCt=this.el.createChild({tag:"ul",cls:"x-tree-root-ct "+(this.lines?"x-tree-lines":"x-tree-no-lines")});if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);
-}if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Roo.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true});}if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Roo.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll});
-}this.getSelectionModel().init(this);if(!this.root){console.log("ROOT not set in tree");return;}this.root.render();if(!this.rootVisible){this.root.renderChildren();}return this;}});
-Roo.tree.DefaultSelectionModel=function(){this.selNode=null;this.addEvents({"selectionchange":true,beforeselect:true})};Roo.extend(Roo.tree.DefaultSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this)},onNodeClick:function(A,e){if(e.ctrlKey&&this.selNode==A){this.unselect(A);return}this.select(A)},select:function(B){var A=this.selNode;if(A!=B&&this.fireEvent("beforeselect",this,B,A)!==false){if(A){A.ui.onSelectedChange(false)}this.selNode=B;B.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,B,A)}return B},unselect:function(A){if(this.selNode==A){this.clearSelections()}},clearSelections:function(){var n=this.selNode;if(n){n.ui.onSelectedChange(false);this.selNode=null;this.fireEvent("selectionchange",this,null)}return n},getSelectedNode:function(){return this.selNode},isSelected:function(A){return this.selNode==A},selectPrevious:function(){var s=this.selNode||this.lastSelNode;if(!s){return null}var ps=s.previousSibling;if(ps){if(!ps.isExpanded()||ps.childNodes.length<1){return this.select(ps)}else{var lc=ps.lastChild;while(lc&&lc.isExpanded()&&lc.childNodes.length>0){lc=lc.lastChild}return this.select(lc)}}else if(s.parentNode&&(this.tree.rootVisible||!s.parentNode.isRoot)){return this.select(s.parentNode)}return null},selectNext:function(){var s=this.selNode||this.lastSelNode;if(!s){return null}if(s.firstChild&&s.isExpanded()){return this.select(s.firstChild)}else if(s.nextSibling){return this.select(s.nextSibling)}else if(s.parentNode){var A=null;s.parentNode.bubble(function(){if(this.nextSibling){A=this.getOwnerTree().selModel.select(this.nextSibling);return false}});return A}return null},onKeyDown:function(e){var s=this.selNode||this.lastSelNode;var sm=this;if(!s){return}var k=e.getKey();switch(k){case e.DOWN:e.stopEvent();this.selectNext();break;case e.UP:e.stopEvent();this.selectPrevious();break;case e.RIGHT:e.preventDefault();if(s.hasChildNodes()){if(!s.isExpanded()){s.expand()}else if(s.firstChild){this.select(s.firstChild,e)}}break;case e.LEFT:e.preventDefault();if(s.hasChildNodes()&&s.isExpanded()){s.collapse()}else if(s.parentNode&&(this.tree.rootVisible||s.parentNode!=this.tree.getRootNode())){this.select(s.parentNode,e)}break}}});Roo.tree.MultiSelectionModel=function(){this.selNodes=[];this.selMap={};this.addEvents({"selectionchange":true})};Roo.extend(Roo.tree.MultiSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this)},onNodeClick:function(A,e){this.select(A,e,e.ctrlKey)},select:function(A,e,B){if(B!==true){this.clearSelections(true)}if(this.isSelected(A)){this.lastSelNode=A;return A}this.selNodes.push(A);this.selMap[A.id]=A;this.lastSelNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return A},unselect:function(B){if(this.selMap[B.id]){B.ui.onSelectedChange(false);var sn=this.selNodes;var C=-1;if(sn.indexOf){C=sn.indexOf(B)}else{for(var i=0,A=sn.length;i<A;i++){if(sn[i]==B){C=i;break}}}if(C!=-1){this.selNodes.splice(C,1)}delete this.selMap[B.id];this.fireEvent("selectionchange",this,this.selNodes)}},clearSelections:function(B){var sn=this.selNodes;if(sn.length>0){for(var i=0,A=sn.length;i<A;i++){sn[i].ui.onSelectedChange(false)}this.selNodes=[];this.selMap={};if(B!==true){this.fireEvent("selectionchange",this,this.selNodes)}}},isSelected:function(A){return this.selMap[A.id]?true:false},getSelectedNodes:function(){return this.selNodes},onKeyDown:Roo.tree.DefaultSelectionModel.prototype.onKeyDown,selectNext:Roo.tree.DefaultSelectionModel.prototype.selectNext,selectPrevious:Roo.tree.DefaultSelectionModel.prototype.selectPrevious});
-Roo.tree.TreeNode=function(B){B=B||{};if(typeof B=="string"){B={text:B}}this.childrenRendered=false;this.rendered=false;Roo.tree.TreeNode.superclass.constructor.call(this,B);this.expanded=B.expanded===true;this.isTarget=B.isTarget!==false;this.draggable=B.draggable!==false&&B.allowDrag!==false;this.allowChildren=B.allowChildren!==false&&B.allowDrop!==false;this.text=B.text;this.disabled=B.disabled===true;this.addEvents({"textchange":true,beforeexpand:true,beforecollapse:true,expand:true,disabledchange:true,collapse:true,beforeclick:true,checkchange:true,click:true,dblclick:true,contextmenu:true,beforechildrenrendered:true});var A=this.attributes.uiProvider||Roo.tree.TreeNodeUI;this.ui=new A(this)};Roo.extend(Roo.tree.TreeNode,Roo.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded},getUI:function(){return this.ui},setFirstChild:function(A){var of=this.firstChild;Roo.tree.TreeNode.superclass.setFirstChild.call(this,A);if(this.childrenRendered&&of&&A!=of){of.renderIndent(true,true)}if(this.rendered){this.renderIndent(true,true)}},setLastChild:function(A){var ol=this.lastChild;Roo.tree.TreeNode.superclass.setLastChild.call(this,A);if(this.childrenRendered&&ol&&A!=ol){ol.renderIndent(true,true)}if(this.rendered){this.renderIndent(true,true)}},appendChild:function(){var A=Roo.tree.TreeNode.superclass.appendChild.apply(this,arguments);if(A&&this.childrenRendered){A.render()}this.ui.updateExpandIcon();return A},removeChild:function(A){this.ownerTree.getSelectionModel().unselect(A);Roo.tree.TreeNode.superclass.removeChild.apply(this,arguments);if(this.childrenRendered){A.ui.remove()}if(this.childNodes.length<1){this.collapse(false,false)}else{this.ui.updateExpandIcon()}if(!this.firstChild){this.childrenRendered=false}return A},insertBefore:function(A,C){var B=Roo.tree.TreeNode.superclass.insertBefore.apply(this,arguments);if(B&&C&&this.childrenRendered){A.render()}this.ui.updateExpandIcon();return B},setText:function(A){var B=this.text;this.text=A;this.attributes.text=A;if(this.rendered){this.ui.onTextChange(this,A,B)}this.fireEvent("textchange",this,A,B)},select:function(){this.getOwnerTree().getSelectionModel().select(this)},unselect:function(){this.getOwnerTree().getSelectionModel().unselect(this)},isSelected:function(){return this.getOwnerTree().getSelectionModel().isSelected(this)},expand:function(B,A,C){if(!this.expanded){if(this.fireEvent("beforeexpand",this,B,A)===false){return}if(!this.childrenRendered){this.renderChildren()}this.expanded=true;if(!this.isHiddenRoot()&&(this.getOwnerTree().animate&&A!==false)||A){this.ui.animExpand(function(){this.fireEvent("expand",this);if(typeof C=="function"){C(this)}if(B===true){this.expandChildNodes(true)}}.createDelegate(this));return}else{this.ui.expand();this.fireEvent("expand",this);if(typeof C=="function"){C(this)}}}else{if(typeof C=="function"){C(this)}}if(B===true){this.expandChildNodes(true)}},isHiddenRoot:function(){return this.isRoot&&!this.getOwnerTree().rootVisible},collapse:function(C,B){if(this.expanded&&!this.isHiddenRoot()){if(this.fireEvent("beforecollapse",this,C,B)===false){return}this.expanded=false;if((this.getOwnerTree().animate&&B!==false)||B){this.ui.animCollapse(function(){this.fireEvent("collapse",this);if(C===true){this.collapseChildNodes(true)}}.createDelegate(this));return}else{this.ui.collapse();this.fireEvent("collapse",this)}}if(C===true){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].collapse(true,false)}}},delayedExpand:function(A){if(!this.expandProcId){this.expandProcId=this.expand.defer(A,this)}},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId)}this.expandProcId=false},toggle:function(){if(this.expanded){this.collapse()}else{this.expand()}},ensureVisible:function(B){var A=this.getOwnerTree();A.expandPath(this.parentNode.getPath(),false,function(){A.getTreeEl().scrollChildIntoView(this.ui.anchor);Roo.callback(B)}.createDelegate(this))},expandChildNodes:function(B){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].expand(B)}},collapseChildNodes:function(B){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].collapse(B)}},disable:function(){this.disabled=true;this.unselect();if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,true)}this.fireEvent("disabledchange",this,true)},enable:function(){this.disabled=false;if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,false)}this.fireEvent("disabledchange",this,false)},renderChildren:function(B){if(B!==false){this.fireEvent("beforechildrenrendered",this)}var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].render(true)}this.childrenRendered=true},sort:function(fn,B){Roo.tree.TreeNode.superclass.sort.apply(this,arguments);if(this.childrenRendered){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].render(true)}}},render:function(A){this.ui.render(A);if(!this.rendered){this.rendered=true;if(this.expanded){this.expanded=false;this.expand(false,false)}}},renderIndent:function(B,C){if(C){this.ui.childIndent=null}this.ui.renderIndent();if(B===true&&this.childrenRendered){var cs=this.childNodes;for(var i=0,A=cs.length;i<A;i++){cs[i].renderIndent(true,C)}}}});
-Roo.tree.AsyncTreeNode=function(A){this.loaded=false;this.loading=false;Roo.tree.AsyncTreeNode.superclass.constructor.apply(this,arguments);this.addEvents({"beforeload":true,load:true});};Roo.extend(Roo.tree.AsyncTreeNode,Roo.tree.TreeNode,{expand:function(B,A,E){if(this.loading){var C;var f=function(){if(!this.loading){clearInterval(C);this.expand(B,A,E)}}.createDelegate(this);C=setInterval(f,200);return}if(!this.loaded){if(this.fireEvent("beforeload",this)===false){return}this.loading=true;this.ui.beforeLoad(this);var D=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();if(D){D.load(this,this.loadComplete.createDelegate(this,[B,A,E]));return}}Roo.tree.AsyncTreeNode.superclass.expand.call(this,B,A,E)},isLoading:function(){return this.loading},loadComplete:function(B,A,C){this.loading=false;this.loaded=true;this.ui.afterLoad(this);this.fireEvent("load",this);this.expand(B,A,C)},isLoaded:function(){return this.loaded},hasChildNodes:function(){if(!this.isLeaf()&&!this.loaded){return true}else{return Roo.tree.AsyncTreeNode.superclass.hasChildNodes.call(this)}},reload:function(A){this.collapse(false,false);while(this.firstChild){this.removeChild(this.firstChild)}this.childrenRendered=false;this.loaded=false;if(this.isHiddenRoot()){this.expanded=false}this.expand(false,false,A)}});
-Roo.tree.TreeNodeUI=function(A){this.node=A;this.rendered=false;this.animating=false;this.emptyIcon=Roo.BLANK_IMAGE_URL};Roo.tree.TreeNodeUI.prototype={removeChild:function(A){if(this.rendered){this.ctNode.removeChild(A.ui.getEl())}},beforeLoad:function(){this.addClass("x-tree-node-loading")},afterLoad:function(){this.removeClass("x-tree-node-loading")},onTextChange:function(A,B,C){if(this.rendered){this.textNode.innerHTML=B}},onDisableChange:function(A,B){this.disabled=B;if(B){this.addClass("x-tree-node-disabled")}else{this.removeClass("x-tree-node-disabled")}},onSelectedChange:function(A){if(A){this.focus();this.addClass("x-tree-selected")}else{this.removeClass("x-tree-selected")}},onMove:function(B,A,F,E,C,D){this.childIndent=null;if(this.rendered){var G=E.ui.getContainer();if(!G){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);return}var H=D?D.ui.getEl():null;if(H){G.insertBefore(this.wrap,H)}else{G.appendChild(this.wrap)}this.node.renderIndent(true)}},addClass:function(A){if(this.elNode){Roo.fly(this.elNode).addClass(A)}},removeClass:function(A){if(this.elNode){Roo.fly(this.elNode).removeClass(A)}},remove:function(){if(this.rendered){this.holder=document.createElement("div");this.holder.appendChild(this.wrap)}},fireEvent:function(){return this.node.fireEvent.apply(this.node,arguments)},initEvents:function(){this.node.on("move",this.onMove,this);var E=Roo.EventManager;var a=this.anchor;var el=Roo.fly(a,"_treeui");if(Roo.isOpera){el.setStyle("text-decoration","none")}el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);if(this.checkbox){Roo.EventManager.on(this.checkbox,Roo.isIE?"click":"change",this.onCheckChange,this)}el.on("contextmenu",this.onContextMenu,this);var A=Roo.fly(this.iconNode);A.on("click",this.onClick,this);A.on("dblclick",this.onDblClick,this);A.on("contextmenu",this.onContextMenu,this);E.on(this.ecNode,"click",this.ecClick,this,true);if(this.node.disabled){this.addClass("x-tree-node-disabled")}if(this.node.hidden){this.addClass("x-tree-node-disabled")}var ot=this.node.getOwnerTree();var dd=ot.enableDD||ot.enableDrag||ot.enableDrop;if(dd&&(!this.node.isRoot||ot.rootVisible)){Roo.dd.Registry.register(this.elNode,{node:this.node,handles:this.getDDHandles(),isHandle:false})}},getDDHandles:function(){return [this.iconNode,this.textNode]},hide:function(){if(this.rendered){this.wrap.style.display="none"}},show:function(){if(this.rendered){this.wrap.style.display=""}},onContextMenu:function(e){if(this.node.hasListener("contextmenu")||this.node.getOwnerTree().hasListener("contextmenu")){e.preventDefault();this.focus();this.fireEvent("contextmenu",this.node,e)}},onClick:function(e){if(this.dropping){e.stopEvent();return}if(this.fireEvent("beforeclick",this.node,e)!==false){if(!this.disabled&&this.node.attributes.href){this.fireEvent("click",this.node,e);return}e.preventDefault();if(this.disabled){return}if(this.node.attributes.singleClickExpand&&!this.animating&&this.node.hasChildNodes()){this.node.toggle()}this.fireEvent("click",this.node,e)}else{e.stopEvent()}},onDblClick:function(e){e.preventDefault();if(this.disabled){return}if(this.checkbox){this.toggleCheck()}if(!this.animating&&this.node.hasChildNodes()){this.node.toggle()}this.fireEvent("dblclick",this.node,e)},onCheckChange:function(){var A=this.checkbox.checked;this.node.attributes.checked=A;this.fireEvent("checkchange",this.node,A)},ecClick:function(e){if(!this.animating&&this.node.hasChildNodes()){this.node.toggle()}},startDrop:function(){this.dropping=true},endDrop:function(){setTimeout(function(){this.dropping=false}.createDelegate(this),50)},expand:function(){this.updateExpandIcon();this.ctNode.style.display=""},focus:function(){if(!this.node.preventHScroll){try{this.anchor.focus()}catch(e){}}else if(!Roo.isIE){try{var A=this.node.getOwnerTree().getTreeEl().dom;var l=A.scrollLeft;this.anchor.focus();A.scrollLeft=l}catch(e){}}},toggleCheck:function(A){var cb=this.checkbox;if(cb){cb.checked=(A===undefined?!cb.checked:A)}},blur:function(){try{this.anchor.blur()}catch(e){}},animExpand:function(A){var ct=Roo.get(this.ctNode);ct.stopFx();if(!this.node.hasChildNodes()){this.updateExpandIcon();this.ctNode.style.display="";Roo.callback(A);return}this.animating=true;this.updateExpandIcon();ct.slideIn("t",{callback:function(){this.animating=false;Roo.callback(A)},scope:this,duration:this.node.ownerTree.duration||0.25})},highlight:function(){var A=this.node.getOwnerTree();Roo.fly(this.wrap).highlight(A.hlColor||"C3DAF9",{endColor:A.hlBaseColor})},collapse:function(){this.updateExpandIcon();this.ctNode.style.display="none"},animCollapse:function(A){var ct=Roo.get(this.ctNode);ct.enableDisplayMode("block");ct.stopFx();this.animating=true;this.updateExpandIcon();ct.slideOut("t",{callback:function(){this.animating=false;Roo.callback(A)},scope:this,duration:this.node.ownerTree.duration||0.25})},getContainer:function(){return this.ctNode},getEl:function(){return this.wrap},appendDDGhost:function(A){A.appendChild(this.elNode.cloneNode(true))},getDDRepairXY:function(){return Roo.lib.Dom.getXY(this.iconNode)},onRender:function(){this.render()},render:function(A){var n=this.node,a=n.attributes;var B=n.parentNode?n.parentNode.ui.getContainer():n.ownerTree.innerCt.dom;if(!this.rendered){this.rendered=true;this.renderElements(n,a,B,A);if(a.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle)}}else{this.textNode.setAttribute("ext:qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttribute("ext:qtitle",a.qtipTitle)}}}else if(a.qtipCfg){a.qtipCfg.target=Roo.id(this.textNode);Roo.QuickTips.register(a.qtipCfg)}this.initEvents();if(!this.node.expanded){this.updateExpandIcon()}}else{if(A===true){B.appendChild(this.wrap)}}},renderElements:function(n,a,G,F){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():"";var t=n.getOwnerTree();var C=t.renderer?t.renderer(n.attributes):Roo.util.Format.htmlEncode(n.text);var B=t.rendererTip?t.rendererTip(n.attributes):C;var cb=typeof a.checked=="boolean";var D=a.href?a.href:Roo.isGecko?"":"#";var A=["<li class=\"x-tree-node\"><div class=\"x-tree-node-el ",a.cls,"\">","<span class=\"x-tree-node-indent\">",this.indentMarkup,"</span>","<img src=\"",this.emptyIcon,"\" class=\"x-tree-ec-icon\" />","<img src=\"",a.icon||this.emptyIcon,"\" class=\"x-tree-node-icon",(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),"\" unselectable=\"on\" />",cb?("<input class=\"x-tree-node-cb\" type=\"checkbox\" "+(a.checked?"checked=\"checked\" />":" />")):"","<a hidefocus=\"on\" href=\"",D,"\" tabIndex=\"1\" ",a.hrefTarget?" target=\""+a.hrefTarget+"\"":"","><span unselectable=\"on\" qtip=\"",B,"\">",C,"</span></a></div>","<ul class=\"x-tree-node-ct\" style=\"display:none;\"></ul>","</li>"];if(F!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),A.join(""))}else{this.wrap=Roo.DomHelper.insertHtml("beforeEnd",G,A.join(""))}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var E=3;if(cb){this.checkbox=cs[3];E++}this.anchor=cs[E];this.textNode=cs[E].firstChild},getAnchor:function(){return this.anchor},getTextEl:function(){return this.textNode},getIconEl:function(){return this.iconNode},isChecked:function(){return this.checkbox?this.checkbox.checked:false},updateExpandIcon:function(){if(this.rendered){var n=this.node,c1,c2;var A=n.isLast()?"x-tree-elbow-end":"x-tree-elbow";var C=n.hasChildNodes();if(C){if(n.expanded){A+="-minus";c1="x-tree-node-collapsed";c2="x-tree-node-expanded"}else{A+="-plus";c1="x-tree-node-expanded";c2="x-tree-node-collapsed"}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false}if(this.c1!=c1||this.c2!=c2){Roo.fly(this.elNode).replaceClass(c1,c2);this.c1=c1;this.c2=c2}}else{if(!this.wasLeaf){Roo.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");delete this.c1;delete this.c2;this.wasLeaf=true}}var B="x-tree-ec-icon "+A;if(this.ecc!=B){this.ecNode.className=B;this.ecc=B}}},getChildIndent:function(){if(!this.childIndent){var A=[];var p=this.node;while(p){if(!p.isRoot||(p.isRoot&&p.ownerTree.rootVisible)){if(!p.isLast()){A.unshift("<img src=\""+this.emptyIcon+"\" class=\"x-tree-elbow-line\" />")}else{A.unshift("<img src=\""+this.emptyIcon+"\" class=\"x-tree-icon\" />")}}p=p.parentNode}this.childIndent=A.join("")}return this.childIndent},renderIndent:function(){if(this.rendered){var A="";var p=this.node.parentNode;if(p){A=p.ui.getChildIndent()}if(this.indentMarkup!=A){this.indentNode.innerHTML=A;this.indentMarkup=A}this.updateExpandIcon()}}};Roo.tree.RootTreeNodeUI=function(){Roo.tree.RootTreeNodeUI.superclass.constructor.apply(this,arguments)};Roo.extend(Roo.tree.RootTreeNodeUI,Roo.tree.TreeNodeUI,{render:function(){if(!this.rendered){var A=this.node.ownerTree.innerCt.dom;this.node.expanded=true;A.innerHTML="<div class=\"x-tree-root-node\"></div>";this.wrap=this.ctNode=A.firstChild}},collapse:function(){},expand:function(){}});
-Roo.tree.TreeLoader=function(A){this.baseParams={};this.requestMethod="POST";Roo.apply(this,A);this.addEvents({"beforeload":true,load:true,loadexception:true});Roo.tree.TreeLoader.superclass.constructor.call(this)};Roo.extend(Roo.tree.TreeLoader,Roo.util.Observable,{uiProviders:{},clearOnLoad:true,root:false,queryParam:false,load:function(B,C){if(this.clearOnLoad){while(B.firstChild){B.removeChild(B.firstChild)}}if(B.attributes.children){var cs=B.attributes.children;for(var i=0,A=cs.length;i<A;i++){B.appendChild(this.createNode(cs[i]))}if(typeof C=="function"){C()}}else if(this.dataUrl){this.requestData(B,C)}},getParams:function(C){var A=[],bp=this.baseParams;for(var B in bp){if(typeof bp[B]!="function"){A.push(encodeURIComponent(B),"=",encodeURIComponent(bp[B]),"&")}}var n=this.queryParam===false?"node":this.queryParam;A.push(n+"=",encodeURIComponent(C.id));return A.join("")},requestData:function(A,B){if(this.fireEvent("beforeload",this,A,B)!==false){this.transId=Roo.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:B,node:A},params:this.getParams(A)})}else{if(typeof B=="function"){B()}}},isLoading:function(){return this.transId?true:false},abort:function(){if(this.isLoading()){Roo.Ajax.abort(this.transId)}},createNode:function(attr){if(this.baseAttrs){Roo.applyIf(attr,this.baseAttrs)}if(this.applyLoader!==false){attr.loader=this}if(typeof (attr.uiProvider)=="string"){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider)}if(typeof (this.uiProviders["default"])!="undefined"){attr.uiProvider=this.uiProviders["default"]}attr.leaf=typeof (attr.leaf)=="string"?attr.leaf*1:attr.leaf;return (attr.leaf?new Roo.tree.TreeNode(attr):new Roo.tree.AsyncTreeNode(attr))},processResponse:function(E,C,D){var B=E.responseText;try{var o=eval("("+B+")");if(this.root!==false){o=o[this.root]}for(var i=0,A=o.length;i<A;i++){var n=this.createNode(o[i]);if(n){C.appendChild(n)}}if(typeof D=="function"){D(this,C)}}catch(e){this.handleFailure(E)}},handleResponse:function(A){this.transId=false;var a=A.argument;this.processResponse(A,a.node,a.callback);this.fireEvent("load",this,a.node,A)},handleFailure:function(A){this.transId=false;var a=A.argument;this.fireEvent("loadexception",this,a.node,A);if(typeof a.callback=="function"){a.callback(this,a.node)}}});
-Roo.tree.TreeFilter=function(A,B){this.tree=A;this.filtered={};Roo.apply(this,B)};Roo.tree.TreeFilter.prototype={clearBlank:false,reverse:false,autoClear:false,remove:false,filter:function(C,A,D){A=A||"text";var f;if(typeof C=="string"){var B=C.length;if(B==0&&this.clearBlank){this.clear();return}C=C.toLowerCase();f=function(n){return n.attributes[A].substr(0,B).toLowerCase()==C}}else if(C.exec){f=function(n){return C.test(n.attributes[A])}}else{throw "Illegal filter type, must be string or regex"}this.filterBy(f,null,D)},filterBy:function(fn,A,B){B=B||this.tree.root;if(this.autoClear){this.clear()}var af=this.filtered,rv=this.reverse;var f=function(n){if(n==B){return true}if(af[n.id]){return false}var m=fn.call(A||n,n);if(!m||rv){af[n.id]=n;n.ui.hide();return false}return true};B.cascade(f);if(this.remove){for(var id in af){if(typeof id!="function"){var n=af[id];if(n&&n.parentNode){n.parentNode.removeChild(n)}}}}},clear:function(){var t=this.tree;var af=this.filtered;for(var id in af){if(typeof id!="function"){var n=af[id];if(n){n.ui.show()}}}this.filtered={}}};
-Roo.tree.TreeSorter=function(B,C){Roo.apply(this,C);B.on("beforechildrenrendered",this.doSort,this);B.on("append",this.updateSort,this);B.on("insert",this.updateSort,this);var A=this.dir&&this.dir.toLowerCase()=="desc";var p=this.property||"text";var E=this.sortType;var fs=this.folderSort;var cs=this.caseSensitive===true;var D=this.leafAttr||"leaf";this.sortFn=function(n1,n2){if(fs){if(n1.attributes[D]&&!n2.attributes[D]){return 1}if(!n1.attributes[D]&&n2.attributes[D]){return -1}}var v1=E?E(n1):(cs?n1.attributes[p]:n1.attributes[p].toUpperCase());var v2=E?E(n2):(cs?n2.attributes[p]:n2.attributes[p].toUpperCase());if(v1<v2){return A?+1:-1}else if(v1>v2){return A?-1:+1}else{return 0}}};Roo.tree.TreeSorter.prototype={doSort:function(A){A.sort(this.sortFn)},compareNodes:function(n1,n2){return (n1.text.toUpperCase()>n2.text.toUpperCase()?1:-1)},updateSort:function(B,A){if(A.childrenRendered){this.doSort.defer(1,this,[A])}}};
-if(Roo.dd.DropZone){Roo.tree.TreeDropZone=function(A,B){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Roo.tree.TreeDropZone.superclass.constructor.call(this,A.innerCt,B);this.tree=A;this.lastInsertClass="x-tree-no-status";this.dragOverData={}};Roo.extend(Roo.tree.TreeDropZone,Roo.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(A){if(A.hasChildNodes()&&!A.isExpanded()){A.expand(false,null,this.triggerCacheRefresh.createDelegate(this))}},queueExpand:function(A){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[A])},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false}},isValidDropPoint:function(n,pt,dd,e,A){if(!n||!A){return false}var E=n.node;var C=A.node;if(!(E&&E.isTarget&&pt)){return false}if(pt=="append"&&E.allowChildren===false){return false}if((pt=="above"||pt=="below")&&(E.parentNode&&E.parentNode.allowChildren===false)){return false}if(C&&(E==C||C.contains(E))){return false}var D=this.dragOverData;D.tree=this.tree;D.target=E;D.data=A;D.point=pt;D.source=dd;D.rawEvent=e;D.dropNode=C;D.cancel=false;var B=this.tree.fireEvent("nodedragover",D);return D.cancel===false&&B!==false},getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false}var A=n.ddel;var t=Roo.lib.Dom.getY(A),b=t+A.offsetHeight;var y=Roo.lib.Event.getPageY(e);var C=tn.allowChildren===false||tn.isLeaf();if(this.appendOnly||tn.parentNode.allowChildren===false){return C?false:"append"}var B=false;if(!this.allowParentInsert){B=tn.hasChildNodes()&&tn.isExpanded()}var q=(b-t)/(C?2:3);if(y>=t&&y<(t+q)){return "above"}else if(!B&&(C||y>=b-q&&y<=b)){return "below"}else{return "append"}},onNodeEnter:function(n,dd,e,A){this.cancelExpand()},onNodeOver:function(n,dd,e,B){var pt=this.getDropPoint(e,n,dd);var C=n.node;if(!this.expandProcId&&pt=="append"&&C.hasChildNodes()&&!n.node.isExpanded()){this.queueExpand(C)}else if(pt!="append"){this.cancelExpand()}var D=this.dropNotAllowed;if(this.isValidDropPoint(n,pt,dd,e,B)){if(pt){var el=n.ddel;var A;if(pt=="above"){D=n.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";A="x-tree-drag-insert-above"}else if(pt=="below"){D=n.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";A="x-tree-drag-insert-below"}else{D="x-tree-drop-ok-append";A="x-tree-drag-append"}if(this.lastInsertClass!=A){Roo.fly(el).replaceClass(this.lastInsertClass,A);this.lastInsertClass=A}}}return D},onNodeOut:function(n,dd,e,A){this.cancelExpand();this.removeDropIndicators(n)},onNodeDrop:function(n,dd,e,A){var B=this.getDropPoint(e,n,dd);var F=n.node;F.ui.startDrop();if(!this.isValidDropPoint(n,B,dd,e,A)){F.ui.endDrop();return false}var D=A.node||(dd.getTreeNode?dd.getTreeNode(A,F,B,e):null);var E={tree:this.tree,target:F,data:A,point:B,source:dd,rawEvent:e,dropNode:D,cancel:!D};var C=this.tree.fireEvent("beforenodedrop",E);if(C===false||E.cancel===true||!E.dropNode){F.ui.endDrop();return false}F=E.target;if(B=="append"&&!F.isExpanded()){F.expand(false,null,function(){this.completeDrop(E)}.createDelegate(this))}else{this.completeDrop(E)}return true},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!(ns instanceof Array)){ns=[ns]}var n;for(var i=0,A=ns.length;i<A;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t)}else if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling)}else{t.appendChild(n)}}n.ui.focus();if(this.tree.hlDrop){n.ui.highlight()}t.ui.endDrop();this.tree.fireEvent("nodedrop",de)},afterNodeMoved:function(dd,A,e,C,B){if(this.tree.hlDrop){B.ui.focus();B.ui.highlight()}this.tree.fireEvent("nodedrop",this.tree,C,A,dd,e)},getTree:function(){return this.tree},removeDropIndicators:function(n){if(n&&n.ddel){var el=n.ddel;Roo.fly(el).removeClass(["x-tree-drag-insert-above","x-tree-drag-insert-below","x-tree-drag-append"]);this.lastInsertClass="_noclass"}},beforeDragDrop:function(A,e,id){this.cancelExpand();return true},afterRepair:function(A){if(A&&Roo.enableFx){A.node.ui.highlight()}this.hideProxy()}})}
-if(Roo.dd.DragZone){Roo.tree.TreeDragZone=function(A,B){Roo.tree.TreeDragZone.superclass.constructor.call(this,A.getTreeEl(),B);this.tree=A};Roo.extend(Roo.tree.TreeDragZone,Roo.dd.DragZone,{ddGroup:"TreeDD",onBeforeDrag:function(A,e){var n=A.node;return n&&n.draggable&&!n.disabled},onInitDrag:function(e){var A=this.dragData;this.tree.getSelectionModel().select(A.node);this.proxy.update("");A.node.ui.appendDDGhost(this.proxy.ghost.dom);this.tree.fireEvent("startdrag",this.tree,A.node,e)},getRepairXY:function(e,A){return A.node.ui.getDDRepairXY()},onEndDrag:function(A,e){this.tree.fireEvent("enddrag",this.tree,A.node,e)},onValidDrop:function(dd,e,id){this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,dd,e);this.hideProxy()},beforeInvalidDrop:function(e,id){var sm=this.tree.getSelectionModel();sm.clearSelections();sm.select(this.dragData.node)}})}
-Roo.tree.TreeEditor=function(A,C){C=C||{};var B=C.events?C:new Roo.form.TextField(C);Roo.tree.TreeEditor.superclass.constructor.call(this,B);this.tree=A;A.on("beforeclick",this.beforeNodeClick,this);A.getTreeEl().on("mousedown",this.hide,this);this.on("complete",this.updateNode,this);this.on("beforestartedit",this.fitToTree,this);this.on("startedit",this.bindScroll,this,{delay:10});this.on("specialkey",this.onSpecialKey,this)};Roo.extend(Roo.tree.TreeEditor,Roo.Editor,{alignment:"l-l",autoSize:false,hideEl:false,cls:"x-small-editor x-tree-editor",shim:false,shadow:"frame",maxWidth:250,editDelay:350,fitToTree:function(ed,el){var td=this.tree.getTreeEl().dom,nd=el.dom;if(td.scrollLeft>nd.offsetLeft){td.scrollLeft=nd.offsetLeft}var w=Math.min(this.maxWidth,(td.clientWidth>20?td.clientWidth:td.offsetWidth)-Math.max(0,nd.offsetLeft-td.scrollLeft)-5);this.setSize(w,"")},triggerEdit:function(A){this.completeEdit();this.editNode=A;this.startEdit(A.ui.textNode,A.text)},bindScroll:function(){this.tree.getTreeEl().on("scroll",this.cancelEdit,this)},beforeNodeClick:function(A,e){var B=(this.lastClick?this.lastClick.getElapsed():0);this.lastClick=new Date();if(B>this.editDelay&&this.tree.getSelectionModel().isSelected(A)){e.stopEvent();this.triggerEdit(A);return false}},updateNode:function(ed,A){this.tree.getTreeEl().un("scroll",this.cancelEdit,this);this.editNode.setText(A)},onHide:function(){Roo.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus()}},onSpecialKey:function(A,e){var k=e.getKey();if(k==e.ESC){e.stopEvent();this.cancelEdit()}else if(k==e.ENTER&&!e.hasModifier()){e.stopEvent();this.completeEdit()}}});
-Roo.tree.ColumnNodeUI=Roo.extend(Roo.tree.TreeNodeUI,{renderElements:function(n,a,I,H){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():"";var t=n.getOwnerTree();var C=Pman.Tab.Document_TypesTree.tree.el.id;var D=t.columns;var bw=t.borderWidth;var c=D[0];var E=a.href?a.href:Roo.isGecko?"":"#";var cb=typeof a.checked=="boolean";var tx=String.format("{0}",n.text||(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));var G="x-t-"+C+"-c0";var A=["<li class=\"x-tree-node\">","<div class=\"x-tree-node-el ",a.cls,"\">","<div class=\"x-tree-col ",G,"\" style=\"width:",c.width-bw,"px;\">","<span class=\"x-tree-node-indent\">",this.indentMarkup,"</span>","<img src=\"",this.emptyIcon,"\" class=\"x-tree-ec-icon  \" />","<img src=\"",a.icon||this.emptyIcon,"\" class=\"x-tree-node-icon",(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),"\" unselectable=\"on\" />",(cb?("<input class=\"x-tree-node-cb\" type=\"checkbox\" "+(a.checked?"checked=\"checked\" />":" />")):""),"<a class=\"x-tree-node-anchor\" hidefocus=\"on\" href=\"",E,"\" tabIndex=\"1\" ",(a.hrefTarget?" target=\""+a.hrefTarget+"\"":""),">","<span unselectable=\"on\" qtip=\""+tx+"\">",tx,"</span></a>","</div>","<a class=\"x-tree-node-anchor\" hidefocus=\"on\" href=\"",E,"\" tabIndex=\"1\" ",(a.hrefTarget?" target=\""+a.hrefTarget+"\"":""),">",];for(var i=1,B=D.length;i<B;i++){c=D[i];G="x-t-"+C+"-c"+i;tx=String.format("{0}",(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));A.push("<div class=\"x-tree-col ",G," ",(c.cls?c.cls:""),"\" style=\"width:",c.width-bw,"px;\">","<div class=\"x-tree-col-text\" qtip=\""+tx+"\">",tx,"</div>","</div>")}A.push("</a>","<div class=\"x-clear\"></div></div>","<ul class=\"x-tree-node-ct\" style=\"display:none;\"></ul>","</li>");if(H!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),A.join(""))}else{this.wrap=Roo.DomHelper.insertHtml("beforeEnd",I,A.join(""))}var el=this.wrap.firstChild;this.elRow=el;this.elNode=el.firstChild;this.ranchor=el.childNodes[1];this.ctNode=this.wrap.childNodes[1];var cs=el.firstChild.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var F=3;if(cb){this.checkbox=cs[3];F++}this.anchor=cs[F];this.textNode=cs[F].firstChild},initEvents:function(){Roo.tree.ColumnNodeUI.superclass.initEvents.call(this);var a=this.ranchor;var el=Roo.get(a);if(Roo.isOpera){el.setStyle("text-decoration","none")}el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);el.on("contextmenu",this.onContextMenu,this)},addClass:function(A){if(this.elRow){Roo.fly(this.elRow).addClass(A)}},removeClass:function(A){if(this.elRow){Roo.fly(this.elRow).removeClass(A)}}});
-Roo.tree.ColumnTree=function(el,A){Roo.tree.ColumnTree.superclass.constructor.call(this,el,A);this.addEvents({"resize":true});this.on("resize",this.onResize,this)};Roo.extend(Roo.tree.ColumnTree,Roo.tree.TreePanel,{borderWidth:Roo.isBorderBox?0:2,headEls:false,render:function(){Roo.tree.ColumnTree.superclass.render.apply(this);this.el.addClass("x-column-tree");this.headers=this.el.createChild({cls:"x-tree-headers"},this.innerCt.dom);var B=this.columns,c;var C=0;this.headEls=[];var A=B.length;for(var i=0;i<A;i++){c=B[i];C+=c.width;this.headEls.push(this.headers.createChild({cls:"x-tree-hd "+(c.cls?c.cls+"-hd":""),cn:{cls:"x-tree-hd-text",html:c.header},style:"width:"+(c.width-this.borderWidth)+"px;"}))}this.headers.createChild({cls:"x-clear"});this.headers.setWidth(C);this.innerCt.setStyle({overflow:"auto"});this.onResize(this.width,this.height)},onResize:function(w,h){this.height=h;this.width=w;this.innerCt.setWidth(this.width);this.innerCt.setHeight(this.height-20);var B=this.columns,c;var D=0;var C=false;var A=B.length;for(var i=0;i<A;i++){c=B[i];if(this.autoExpandColumn!==false&&c.dataIndex==this.autoExpandColumn){C=this.headEls[i];continue}D+=c.width}if(C){C.setWidth(((w-D)-this.borderWidth-20))}this.headers.setWidth(w-20)}});
-Roo.menu.Menu=function(B){Roo.apply(this,B);this.id=this.id||Roo.id();this.addEvents({beforeshow:true,beforehide:true,show:true,hide:true,click:true,mouseover:true,mouseout:true,itemclick:true});if(this.registerMenu){Roo.menu.MenuMgr.register(this)}var A=this.items;this.items=new Roo.util.MixedCollection();if(A){this.add.apply(this,A)}};Roo.extend(Roo.menu.Menu,Roo.util.Observable,{minWidth:120,shadow:"sides",subMenuAlign:"tl-tr?",defaultAlign:"tl-bl?",allowOtherMenus:false,registerMenu:true,hidden:true,render:function(){if(this.el){return}var el=this.el=new Roo.Layer({cls:"x-menu",shadow:this.shadow,constrain:false,parentEl:this.parentEl||document.body,zindex:15000});this.keyNav=new Roo.menu.MenuNav(this);if(this.plain){el.addClass("x-menu-plain")}if(this.cls){el.addClass(this.cls)}this.focusEl=el.createChild({tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"});var ul=el.createChild({tag:"ul",cls:"x-menu-list"});ul.on("click",this.onClick,this);ul.on("mouseover",this.onMouseOver,this);ul.on("mouseout",this.onMouseOut,this);this.items.each(function(A){var li=document.createElement("li");li.className="x-menu-list-item";ul.dom.appendChild(li);A.render(li,this)},this);this.ul=ul;this.autoWidth()},autoWidth:function(){var el=this.el,ul=this.ul;if(!el){return}var w=this.width;if(w){el.setWidth(w)}else if(Roo.isIE){el.setWidth(this.minWidth);var t=el.dom.offsetWidth;el.setWidth(ul.getWidth()+el.getFrameWidth("lr"))}},delayAutoWidth:function(){if(this.rendered){if(!this.awTask){this.awTask=new Roo.util.DelayedTask(this.autoWidth,this)}this.awTask.delay(20)}},findTargetItem:function(e){var t=e.getTarget(".x-menu-list-item",this.ul,true);if(t&&t.menuItemId){return this.items.get(t.menuItemId)}},onClick:function(e){var t;if(t=this.findTargetItem(e)){t.onClick(e);this.fireEvent("click",this,t,e)}},setActiveItem:function(A,B){if(A!=this.activeItem){if(this.activeItem){this.activeItem.deactivate()}this.activeItem=A;A.activate(B)}else if(B){A.expandMenu()}},tryActivate:function(E,C){var D=this.items;for(var i=E,A=D.length;i>=0&&i<A;i+=C){var B=D.get(i);if(!B.disabled&&B.canActivate){this.setActiveItem(B,false);return B}}return false},onMouseOver:function(e){var t;if(t=this.findTargetItem(e)){if(t.canActivate&&!t.disabled){this.setActiveItem(t,true)}}this.fireEvent("mouseover",this,e,t)},onMouseOut:function(e){var t;if(t=this.findTargetItem(e)){if(t==this.activeItem&&t.shouldDeactivate(e)){this.activeItem.deactivate();delete this.activeItem}}this.fireEvent("mouseout",this,e,t)},isVisible:function(){return this.el&&!this.hidden},show:function(el,A,B){this.parentMenu=B;if(!this.el){this.render()}this.fireEvent("beforeshow",this);this.showAt(this.el.getAlignToXY(el,A||this.defaultAlign),B,false)},showAt:function(xy,A,_e){this.parentMenu=A;if(!this.el){this.render()}if(_e!==false){this.fireEvent("beforeshow",this);xy=this.el.adjustForConstraints(xy)}this.el.setXY(xy);this.el.show();this.hidden=false;this.focus();this.fireEvent("show",this)},focus:function(){if(!this.hidden){this.doFocus.defer(50,this)}},doFocus:function(){if(!this.hidden){this.focusEl.focus()}},hide:function(A){if(this.el&&this.isVisible()){this.fireEvent("beforehide",this);if(this.activeItem){this.activeItem.deactivate();this.activeItem=null}this.el.hide();this.hidden=true;this.fireEvent("hide",this)}if(A===true&&this.parentMenu){this.parentMenu.hide(true)}},add:function(){var a=arguments,l=a.length,A;for(var i=0;i<l;i++){var el=a[i];if(el.render){A=this.addItem(el)}else if(typeof el=="string"){if(el=="separator"||el=="-"){A=this.addSeparator()}else{A=this.addText(el)}}else if(el.tagName||el.el){A=this.addElement(el)}else if(typeof el=="object"){A=this.addMenuItem(el)}}return A},getEl:function(){if(!this.el){this.render()}return this.el},addSeparator:function(){return this.addItem(new Roo.menu.Separator())},addElement:function(el){return this.addItem(new Roo.menu.BaseItem(el))},addItem:function(A){this.items.add(A);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.appendChild(li);A.render(li,this);this.delayAutoWidth()}return A},addMenuItem:function(A){if(!(A instanceof Roo.menu.Item)){if(typeof A.checked=="boolean"){A=new Roo.menu.CheckItem(A)}else{A=new Roo.menu.Item(A)}}return this.addItem(A)},addText:function(A){return this.addItem(new Roo.menu.TextItem(A))},insert:function(B,A){this.items.insert(B,A);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.insertBefore(li,this.ul.dom.childNodes[B]);A.render(li,this);this.delayAutoWidth()}return A},remove:function(A){this.items.removeKey(A.id);A.destroy()},removeAll:function(){var f;while(f=this.items.first()){this.remove(f)}}});Roo.menu.MenuNav=function(A){Roo.menu.MenuNav.superclass.constructor.call(this,A.el);this.scope=this.menu=A};Roo.extend(Roo.menu.MenuNav,Roo.KeyNav,{doRelay:function(e,h){var k=e.getKey();if(!this.menu.activeItem&&e.isNavKeyPress()&&k!=e.SPACE&&k!=e.RETURN){this.menu.tryActivate(0,1);return false}return h.call(this.scope||this,e,this.menu)},up:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)-1,-1)){m.tryActivate(m.items.length-1,-1)}},down:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)+1,1)){m.tryActivate(0,1)}},right:function(e,m){if(m.activeItem){m.activeItem.expandMenu(true)}},left:function(e,m){m.hide();if(m.parentMenu&&m.parentMenu.activeItem){m.parentMenu.activeItem.activate()}},enter:function(e,m){if(m.activeItem){e.stopPropagation();m.activeItem.onClick(e);m.fireEvent("click",this,m.activeItem);return true}}});
-Roo.menu.MenuMgr=function(){var B,C,D={},H=false,I=new Date();function A(){B={};C=new Roo.util.MixedCollection();Roo.get(document).addKeyListener(27,function(){if(C.length>0){G()}})}function G(){if(C&&C.length>0){var c=C.clone();c.each(function(m){m.hide()})}}function E(m){C.remove(m);if(C.length<1){Roo.get(document).un("mousedown",J);H=false}}function F(m){var N=C.last();I=new Date();C.add(m);if(!H){Roo.get(document).on("mousedown",J);H=true}if(m.parentMenu){m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"),10)+3);m.parentMenu.activeChild=m}else if(N&&N.isVisible()){m.getEl().setZIndex(parseInt(N.getEl().getStyle("z-index"),10)+3)}}function K(m){if(m.activeChild){m.activeChild.hide()}if(m.autoHideTimer){clearTimeout(m.autoHideTimer);delete m.autoHideTimer}}function L(m){var pm=m.parentMenu;if(!pm&&!m.allowOtherMenus){G()}else if(pm&&pm.activeChild&&C!=m){pm.activeChild.hide()}}function J(e){if(I.getElapsed()>50&&C.length>0&&!e.getTarget(".x-menu")){G()}}function M(mi,N){if(N){var g=D[mi.group];for(var i=0,l=g.length;i<l;i++){if(g[i]!=mi){g[i].setChecked(false)}}}}return {hideAll:function(){G()},register:function(N){if(!B){A()}B[N.id]=N;N.on("beforehide",K);N.on("hide",E);N.on("beforeshow",L);N.on("show",F);var g=N.group;if(g&&N.events["checkchange"]){if(!D[g]){D[g]=[]}D[g].push(N);N.on("checkchange",onCheck)}},get:function(N){if(typeof N=="string"){return B[N]}else if(N.events){return N}else if(typeof N.length=="number"){return new Roo.menu.Menu({items:N})}else{return new Roo.menu.Menu(N)}},unregister:function(N){delete B[N.id];N.un("beforehide",K);N.un("hide",E);N.un("beforeshow",L);N.un("show",F);var g=N.group;if(g&&N.events["checkchange"]){D[g].remove(N);N.un("checkchange",onCheck)}},registerCheckable:function(N){var g=N.group;if(g){if(!D[g]){D[g]=[]}D[g].push(N);N.on("beforecheckchange",M)}},unregisterCheckable:function(N){var g=N.group;if(g){D[g].remove(N);N.un("beforecheckchange",M)}}}}();
-Roo.menu.BaseItem=function(A){Roo.menu.BaseItem.superclass.constructor.call(this,A);this.addEvents({click:true,activate:true,deactivate:true});if(this.handler){this.on("click",this.handler,this.scope,true)}};Roo.extend(Roo.menu.BaseItem,Roo.Component,{canActivate:false,activeClass:"x-menu-item-active",hideOnClick:true,hideDelay:100,ctype:"Roo.menu.BaseItem",actionMode:"container",render:function(A,B){this.parentMenu=B;Roo.menu.BaseItem.superclass.render.call(this,A);this.container.menuItemId=this.id},onRender:function(B,A){this.el=Roo.get(this.el);B.dom.appendChild(this.el.dom)},onClick:function(e){if(!this.disabled&&this.fireEvent("click",this,e)!==false&&this.parentMenu.fireEvent("itemclick",this,e)!==false){this.handleClick(e)}else{e.stopEvent()}},activate:function(){if(this.disabled){return false}var li=this.container;li.addClass(this.activeClass);this.region=li.getRegion().adjust(2,2,-2,-2);this.fireEvent("activate",this);return true},deactivate:function(){this.container.removeClass(this.activeClass);this.fireEvent("deactivate",this)},shouldDeactivate:function(e){return !this.region||!this.region.contains(e.getPoint())},handleClick:function(e){if(this.hideOnClick){this.parentMenu.hide.defer(this.hideDelay,this.parentMenu,[true])}},expandMenu:function(A){},hideMenu:function(){}});
-Roo.menu.Adapter=function(B,A){Roo.menu.Adapter.superclass.constructor.call(this,A);this.component=B};Roo.extend(Roo.menu.Adapter,Roo.menu.BaseItem,{canActivate:true,onRender:function(B,A){this.component.render(B);this.el=this.component.getEl()},activate:function(){if(this.disabled){return false}this.component.focus();this.fireEvent("activate",this);return true},deactivate:function(){this.fireEvent("deactivate",this)},disable:function(){this.component.disable();Roo.menu.Adapter.superclass.disable.call(this)},enable:function(){this.component.enable();Roo.menu.Adapter.superclass.enable.call(this)}});
-Roo.menu.TextItem=function(A){this.text=A;Roo.menu.TextItem.superclass.constructor.call(this)};Roo.extend(Roo.menu.TextItem,Roo.menu.BaseItem,{hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML=this.text;this.el=s;Roo.menu.TextItem.superclass.onRender.apply(this,arguments)}});
-Roo.menu.Separator=function(A){Roo.menu.Separator.superclass.constructor.call(this,A)};Roo.extend(Roo.menu.Separator,Roo.menu.BaseItem,{itemCls:"x-menu-sep",hideOnClick:false,onRender:function(li){var s=document.createElement("span");s.className=this.itemCls;s.innerHTML="&#160;";this.el=s;li.addClass("x-menu-sep-li");Roo.menu.Separator.superclass.onRender.apply(this,arguments)}});
-Roo.menu.Item=function(A){Roo.menu.Item.superclass.constructor.call(this,A);if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu)}};Roo.extend(Roo.menu.Item,Roo.menu.BaseItem,{itemCls:"x-menu-item",canActivate:true,showDelay:200,hideDelay:200,ctype:"Roo.menu.Item",onRender:function(B,A){var el=document.createElement("a");el.hideFocus=true;el.unselectable="on";el.href=this.href||"#";if(this.hrefTarget){el.target=this.hrefTarget}el.className=this.itemCls+(this.menu?" x-menu-item-arrow":"")+(this.cls?" "+this.cls:"");el.innerHTML=String.format("<img src=\"{0}\" class=\"x-menu-item-icon {2}\" />{1}",this.icon||Roo.BLANK_IMAGE_URL,this.text,this.iconCls||"");this.el=el;Roo.menu.Item.superclass.onRender.call(this,B,A)},setText:function(A){this.text=A;if(this.rendered){this.el.update(String.format("<img src=\"{0}\" class=\"x-menu-item-icon {2}\">{1}",this.icon||Roo.BLANK_IMAGE_URL,this.text,this.iconCls||""));this.parentMenu.autoWidth()}},handleClick:function(e){if(!this.href){e.stopEvent()}Roo.menu.Item.superclass.handleClick.apply(this,arguments)},activate:function(A){if(Roo.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(A){this.expandMenu()}}return true},shouldDeactivate:function(e){if(Roo.menu.Item.superclass.shouldDeactivate.call(this,e)){if(this.menu&&this.menu.isVisible()){return !this.menu.getEl().getRegion().contains(e.getPoint())}return true}return false},deactivate:function(){Roo.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu()},expandMenu:function(A){if(!this.disabled&&this.menu){clearTimeout(this.hideTimer);delete this.hideTimer;if(!this.menu.isVisible()&&!this.showTimer){this.showTimer=this.deferExpand.defer(this.showDelay,this,[A])}else if(this.menu.isVisible()&&A){this.menu.tryActivate(0,1)}}},deferExpand:function(A){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(A){this.menu.tryActivate(0,1)}},hideMenu:function(){clearTimeout(this.showTimer);delete this.showTimer;if(!this.hideTimer&&this.menu&&this.menu.isVisible()){this.hideTimer=this.deferHide.defer(this.hideDelay,this)}},deferHide:function(){delete this.hideTimer;this.menu.hide()}});
-Roo.menu.CheckItem=function(A){Roo.menu.CheckItem.superclass.constructor.call(this,A);this.addEvents({"beforecheckchange":true,checkchange:true});if(this.checkHandler){this.on("checkchange",this.checkHandler,this.scope)}};Roo.extend(Roo.menu.CheckItem,Roo.menu.Item,{itemCls:"x-menu-item x-menu-check-item",groupClass:"x-menu-group-item",checked:false,ctype:"Roo.menu.CheckItem",onRender:function(c){Roo.menu.CheckItem.superclass.onRender.apply(this,arguments);if(this.group){this.el.addClass(this.groupClass)}Roo.menu.MenuMgr.registerCheckable(this);if(this.checked){this.checked=false;this.setChecked(true,true)}},destroy:function(){if(this.rendered){Roo.menu.MenuMgr.unregisterCheckable(this)}Roo.menu.CheckItem.superclass.destroy.apply(this,arguments)},setChecked:function(A,B){if(this.checked!=A&&this.fireEvent("beforecheckchange",this,A)!==false){if(this.container){this.container[A?"addClass":"removeClass"]("x-menu-item-checked")}this.checked=A;if(B!==true){this.fireEvent("checkchange",this,A)}}},handleClick:function(e){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked)}Roo.menu.CheckItem.superclass.handleClick.apply(this,arguments)}});
-Roo.menu.DateItem=function(A){Roo.menu.DateItem.superclass.constructor.call(this,new Roo.DatePicker(A),A);this.picker=this.component;this.addEvents({select:true});this.picker.on("render",function(B){B.getEl().swallowEvent("click");B.container.addClass("x-menu-date-item")});this.picker.on("select",this.onSelect,this)};Roo.extend(Roo.menu.DateItem,Roo.menu.Adapter,{onSelect:function(B,A){this.fireEvent("select",this,A,B);Roo.menu.DateItem.superclass.handleClick.call(this)}});
-Roo.menu.ColorItem=function(A){Roo.menu.ColorItem.superclass.constructor.call(this,new Roo.ColorPalette(A),A);this.palette=this.component;this.relayEvents(this.palette,["select"]);if(this.selectHandler){this.on("select",this.selectHandler,this.scope)}};Roo.extend(Roo.menu.ColorItem,Roo.menu.Adapter);
-Roo.menu.DateMenu=function(A){Roo.menu.DateMenu.superclass.constructor.call(this,A);this.plain=true;var di=new Roo.menu.DateItem(A);this.add(di);this.picker=di.picker;this.relayEvents(di,["select"]);this.on("beforeshow",function(){if(this.picker){this.picker.hideMonthPicker(true)}},this)};Roo.extend(Roo.menu.DateMenu,Roo.menu.Menu,{cls:"x-date-menu"});
-Roo.menu.ColorMenu=function(A){Roo.menu.ColorMenu.superclass.constructor.call(this,A);this.plain=true;var ci=new Roo.menu.ColorItem(A);this.add(ci);this.palette=ci.palette;this.relayEvents(ci,["select"])};Roo.extend(Roo.menu.ColorMenu,Roo.menu.Menu);
-Roo.form.Field=function(A){Roo.form.Field.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Field,Roo.BoxComponent,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},fieldClass:"x-form-field",msgTarget:"qtip",msgFx:"normal",readOnly:false,disabled:false,inputType:undefined,tabIndex:undefined,isFormField:true,hasFocus:false,value:undefined,initComponent:function(){Roo.form.Field.superclass.initComponent.call(this);
-this.addEvents({focus:true,blur:true,specialkey:true,change:true,invalid:true,valid:true});},getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:(this.hiddenName||"");},onRender:function(ct,C){Roo.form.Field.superclass.onRender.call(this,ct,C);
-if(!this.el){var A=this.getAutoCreate();if(!A.name){A.name=this.name||this.id;}if(this.inputType){A.type=this.inputType;}this.el=ct.createChild(A,C);}var B=this.el.dom.type;if(B){if(B=="password"){B="text";}this.el.addClass("x-form-"+B);}if(this.readOnly){this.el.dom.readOnly=true;
-}if(this.tabIndex!==undefined){this.el.dom.setAttribute("tabIndex",this.tabIndex);}this.el.addClass([this.fieldClass,this.cls]);this.initValue();},applyTo:function(A){this.allowDomMove=false;this.el=Roo.get(A);this.render(this.el.dom.parentNode);return this;
-},initValue:function(){if(this.value!==undefined){this.setValue(this.value);}else if(this.el.dom.value.length>0){this.setValue(this.el.dom.value);}},isDirty:function(){if(this.disabled){return false;}return String(this.getValue())!==String(this.originalValue);
-},afterRender:function(){Roo.form.Field.superclass.afterRender.call(this);this.initEvents();},fireKey:function(e){if(e.isNavKeyPress()){this.fireEvent("specialkey",this,e);}},reset:function(){this.setValue(this.originalValue);this.clearInvalid();},initEvents:function(){this.el.on(Roo.isIE?"keydown":"keypress",this.fireKey,this);
-this.el.on("focus",this.onFocus,this);this.el.on("blur",this.onBlur,this);this.originalValue=this.getValue();},onFocus:function(){if(!Roo.isOpera&&this.focusClass){this.el.addClass(this.focusClass);}if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();
-this.fireEvent("focus",this);}},beforeBlur:Roo.emptyFn,onBlur:function(){this.beforeBlur();if(!Roo.isOpera&&this.focusClass){this.el.removeClass(this.focusClass);}this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();
-}var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent("change",this,v,this.startValue);}this.fireEvent("blur",this);},isValid:function(B){if(this.disabled){return true;}var A=this.preventMark;this.preventMark=B===true;var v=this.validateValue(this.processValue(this.getRawValue()));
-this.preventMark=A;return v;},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){this.clearInvalid();return true;}return false;},processValue:function(A){return A;},validateValue:function(A){return true;},markInvalid:function(B){if(!this.rendered||this.preventMark){return;
-}this.el.addClass(this.invalidClass);B=B||this.invalidText;switch(this.msgTarget){case "qtip":this.el.dom.qtip=B;this.el.dom.qclass="x-form-invalid-tip";if(Roo.QuickTips){Roo.QuickTips.enable();}break;case "title":this.el.dom.title=B;break;case "under":if(!this.errorEl){var A=this.el.findParent(".x-form-element",5,true);
-this.errorEl=A.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(A.getWidth(true)-20);}this.errorEl.update(B);Roo.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case "side":if(!this.errorIcon){var A=this.el.findParent(".x-form-element",5,true);
-this.errorIcon=A.createChild({cls:"x-form-invalid-icon"});}this.alignErrorIcon();this.errorIcon.dom.qtip=B;this.errorIcon.dom.qclass="x-form-invalid-tip";this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);break;default:var t=Roo.getDom(this.msgTarget);
-t.innerHTML=B;t.style.display=this.msgDisplay;break;}this.fireEvent("invalid",this,B);},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,"tl-tr",[2,0]);},clearInvalid:function(){if(!this.rendered||this.preventMark){return;}this.el.removeClass(this.invalidClass);
-switch(this.msgTarget){case "qtip":this.el.dom.qtip="";break;case "title":this.el.dom.title="";break;case "under":if(this.errorEl){Roo.form.Field.msgFx[this.msgFx].hide(this.errorEl,this);}break;case "side":if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();
-this.un("resize",this.alignErrorIcon,this);}break;default:var t=Roo.getDom(this.msgTarget);t.innerHTML="";t.style.display="none";break;}this.fireEvent("valid",this);},getRawValue:function(){var v=this.el.getValue();if(v===this.emptyText){v="";}return v;},getValue:function(){var v=this.el.getValue();
-if(v===this.emptyText||v===undefined){v="";}return v;},setRawValue:function(v){return this.el.dom.value=(v===null||v===undefined?"":v);},setValue:function(v){this.value=v;if(this.rendered){this.el.dom.value=(v===null||v===undefined?"":v);this.validate();}},adjustSize:function(w,h){var s=Roo.form.Field.superclass.adjustSize.call(this,w,h);
-s.width=this.adjustWidth(this.el.dom.tagName,s.width);return s;},adjustWidth:function(A,w){A=A.toLowerCase();if(typeof w=="number"&&Roo.isStrict&&!Roo.isSafari){if(Roo.isIE&&(A=="input"||A=="textarea")){if(A=="input"){return w+2;}if(A="textarea"){return w-2;
-}}else if(Roo.isOpera){if(A=="input"){return w+2;}if(A="textarea"){return w-2;}}}return w;}});Roo.form.Field.msgFx={normal:{show:function(A,f){A.setDisplayed("block");},hide:function(A,f){A.setDisplayed(false).update("");}},slide:{show:function(A,f){A.slideIn("t",{stopFx:true});
-},hide:function(A,f){A.slideOut("t",{stopFx:true,useDisplay:true});}},slideRight:{show:function(A,f){A.fixDisplay();A.alignTo(f.el,"tl-tr");A.slideIn("l",{stopFx:true});},hide:function(A,f){A.slideOut("l",{stopFx:true,useDisplay:true});}}};
-Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(this,A);this.addEvents({autosize:true})};Roo.extend(Roo.form.TextField,Roo.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,emptyClass:"x-form-empty-field",initEvents:function(){Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=="keyup"){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on("keyup",this.filterValidation,this)}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay})}if(this.selectOnFocus||this.emptyText){this.on("focus",this.preFocus,this);if(this.emptyText){this.on("blur",this.postBlur,this);this.applyEmptyText()}}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+"Mask"]))){this.el.on("keypress",this.filterKeys,this)}if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this)}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,"");if(B!==A){this.setRawValue(B);return B}}return A},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay)}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize()}},reset:function(){Roo.form.TextField.superclass.reset.call(this);this.applyEmptyText()},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass)}},preFocus:function(){if(this.emptyText){if(this.el.dom.value==this.emptyText){this.setRawValue("")}this.el.removeClass(this.emptyClass)}if(this.selectOnFocus){this.el.dom.select()}},postBlur:function(){this.applyEmptyText()},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return}var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return}if(!this.maskRe.test(cc)){e.stopEvent()}},setValue:function(v){if(this.emptyText&&this.el&&v!==undefined&&v!==null&&v!==""){this.el.removeClass(this.emptyClass)}Roo.form.TextField.superclass.setValue.apply(this,arguments);this.applyEmptyText();this.autoSize()},validateValue:function(B){if(B.length<1||B===this.emptyText){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(B.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false}if(B.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false}if(this.vtype){var vt=Roo.form.VTypes;if(!vt[this.vtype](B,this)){this.markInvalid(this.vtypeText||vt[this.vtype+"Text"]);return false}}if(typeof this.validator=="function"){var A=this.validator(B);if(A!==true){this.markInvalid(A);return false}}if(this.regex&&!this.regex.test(B)){this.markInvalid(this.regexText);return false}return true},selectText:function(C,A){var v=this.getRawValue();if(v.length>0){C=C===undefined?0:C;A=A===undefined?v.length:A;var d=this.el.dom;if(d.setSelectionRange){d.setSelectionRange(C,A)}else if(d.createTextRange){var B=d.createTextRange();B.moveStart("character",C);B.moveEnd("character",v.length-A);B.select()}}},autoSize:function(){if(!this.grow||!this.rendered){return}if(!this.metrics){this.metrics=Roo.util.TextMetrics.createInstance(this.el)}var el=this.el;var v=el.dom.value;var d=document.createElement("div");d.appendChild(document.createTextNode(v));v=d.innerHTML;d=null;v+="&#160;";var w=Math.min(this.growMax,Math.max(this.metrics.getWidth(v)+10,this.growMin));this.el.setWidth(w);this.fireEvent("autosize",this,w)}});
-Roo.form.Hidden=function(A){Roo.form.Hidden.superclass.constructor.call(this,A)};Roo.extend(Roo.form.Hidden,Roo.form.TextField,{fieldLabel:"",inputType:"hidden",width:50,allowBlank:true,labelSeparator:"",hidden:true,itemCls:"x-form-item-display-none"});
-Roo.form.TriggerField=function(A){this.mimicing=false;Roo.form.TriggerField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.TriggerField,Roo.form.TextField,{defaultAutoCreate:{tag:"input",type:"text",size:"16",autocomplete:"off"},hideTrigger:false,autoSize:Roo.emptyFn,monitorTab:true,deferHeight:true,actionMode:"wrap",onResize:function(w,h){Roo.form.TriggerField.superclass.onResize.apply(this,arguments);
-if(typeof w=="number"){this.el.setWidth(this.adjustWidth("input",w-this.trigger.getWidth()));}},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0]);
-},onRender:function(ct,A){Roo.form.TriggerField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:"x-form-field-wrap"});this.trigger=this.wrap.createChild(this.triggerConfig||{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});
-if(this.hideTrigger){this.trigger.setDisplayed(false);}this.initTrigger();if(!this.width){this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());}},initTrigger:function(){this.trigger.on("click",this.onTriggerClick,this,{preventDefault:true});this.trigger.addClassOnOver("x-form-trigger-over");
-this.trigger.addClassOnClick("x-form-trigger-click");},onDestroy:function(){if(this.trigger){this.trigger.removeAllListeners();this.trigger.remove();}if(this.wrap){this.wrap.remove();}Roo.form.TriggerField.superclass.onDestroy.call(this);},onFocus:function(){Roo.form.TriggerField.superclass.onFocus.call(this);
-if(!this.mimicing){this.wrap.addClass("x-trigger-wrap-focus");this.mimicing=true;Roo.get(Roo.isIE?document.body:document).on("mousedown",this.mimicBlur,this);if(this.monitorTab){this.el.on("keydown",this.checkTab,this);}}},checkTab:function(e){if(e.getKey()==e.TAB){this.triggerBlur();
-}},onBlur:function(){},mimicBlur:function(e,t){if(!this.wrap.contains(t)&&this.validateBlur()){this.triggerBlur();}},triggerBlur:function(){this.mimicing=false;Roo.get(Roo.isIE?document.body:document).un("mousedown",this.mimicBlur);if(this.monitorTab){this.el.un("keydown",this.checkTab,this);
-}this.wrap.removeClass("x-trigger-wrap-focus");Roo.form.TriggerField.superclass.onBlur.call(this);},validateBlur:function(e,t){return true;},onDisable:function(){Roo.form.TriggerField.superclass.onDisable.call(this);if(this.wrap){this.wrap.addClass("x-item-disabled");
-}},onEnable:function(){Roo.form.TriggerField.superclass.onEnable.call(this);if(this.wrap){this.wrap.removeClass("x-item-disabled");}},onShow:function(){var ae=this.getActionEl();if(ae){ae.dom.style.display="";ae.dom.style.visibility="visible";}},onHide:function(){var ae=this.getActionEl();
-ae.dom.style.display="none";},onTriggerClick:Roo.emptyFn});Roo.form.TwinTriggerField=Roo.extend(Roo.form.TriggerField,{initComponent:function(){Roo.form.TwinTriggerField.superclass.initComponent.call(this);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]};
-},getTrigger:function(A){return this.triggers[A];},initTrigger:function(){var ts=this.trigger.select(".x-form-trigger",true);this.wrap.setStyle("overflow","hidden");var A=this;ts.each(function(t,B,C){t.hide=function(){var w=A.wrap.getWidth();this.dom.style.display="none";
-A.el.setWidth(w-A.trigger.getWidth());};t.show=function(){var w=A.wrap.getWidth();this.dom.style.display="";A.el.setWidth(w-A.trigger.getWidth());};var D="Trigger"+(C+1);if(this["hide"+D]){t.dom.style.display="none";}t.on("click",this["on"+D+"Click"],this,{preventDefault:true});
-t.addClassOnOver("x-form-trigger-over");t.addClassOnClick("x-form-trigger-click");},this);this.triggers=ts.elements;},onTrigger1Click:Roo.emptyFn,onTrigger2Click:Roo.emptyFn});
-Roo.form.TextArea=function(A){Roo.form.TextArea.superclass.constructor.call(this,A);if(this.minHeight!==undefined){this.growMin=this.minHeight}if(this.maxHeight!==undefined){this.growMax=this.maxHeight}};Roo.extend(Roo.form.TextArea,Roo.form.TextField,{growMin:60,growMax:1000,preventScrollbars:false,onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"off"}}Roo.form.TextArea.superclass.onRender.call(this,ct,A);if(this.grow){this.textSizeEl=Roo.DomHelper.append(document.body,{tag:"pre",cls:"x-form-grow-sizer"});if(this.preventScrollbars){this.el.setStyle("overflow","hidden")}this.el.setHeight(this.growMin)}},onDestroy:function(){if(this.textSizeEl){this.textSizeEl.parentNode.removeChild(this.textSizeEl)}Roo.form.TextArea.superclass.onDestroy.call(this)},onKeyUp:function(e){if(!e.isNavKeyPress()||e.getKey()==e.ENTER){this.autoSize()}},autoSize:function(){if(!this.grow||!this.textSizeEl){return}var el=this.el;var v=el.dom.value;var ts=this.textSizeEl;ts.innerHTML="";ts.appendChild(document.createTextNode(v));v=ts.innerHTML;Roo.fly(ts).setWidth(this.el.getWidth());if(v.length<1){v="&#160;&#160;"}else{if(Roo.isIE){v=v.replace(/\n/g,"<p>&#160;</p>")}v+="&#160;\n&#160;"}ts.innerHTML=v;var h=Math.min(this.growMax,Math.max(ts.offsetHeight,this.growMin));if(h!=this.lastHeight){this.lastHeight=h;this.el.setHeight(h);this.fireEvent("autosize",this,h)}}});
-Roo.form.NumberField=function(A){Roo.form.NumberField.superclass.constructor.call(this,A)};Roo.extend(Roo.form.NumberField,Roo.form.TextField,{fieldClass:"x-form-field x-form-num-field",allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",initEvents:function(){Roo.form.NumberField.superclass.initEvents.call(this);var A="0123456789";if(this.allowDecimals){A+=this.decimalSeparator}if(this.allowNegative){A+="-"}this.stripCharsRe=new RegExp("[^"+A+"]","gi");var B=function(e){var k=e.getKey();if(!Roo.isIE&&(e.isSpecialKey()||k==e.BACKSPACE||k==e.DELETE)){return}var c=e.getCharCode();if(A.indexOf(String.fromCharCode(c))===-1){e.stopEvent()}};this.el.on("keypress",B,this)},validateValue:function(B){if(!Roo.form.NumberField.superclass.validateValue.call(this,B)){return false}if(B.length<1){return true}var A=this.parseValue(B);if(isNaN(A)){this.markInvalid(String.format(this.nanText,B));return false}if(A<this.minValue){this.markInvalid(String.format(this.minText,this.minValue));return false}if(A>this.maxValue){this.markInvalid(String.format(this.maxText,this.maxValue));return false}return true},getValue:function(){return this.fixPrecision(this.parseValue(Roo.form.NumberField.superclass.getValue.call(this)))},parseValue:function(A){A=parseFloat(String(A).replace(this.decimalSeparator,"."));return isNaN(A)?"":A},fixPrecision:function(B){var A=isNaN(B);if(!this.allowDecimals||this.decimalPrecision==-1||A||!B){return A?"":B}return parseFloat(B).toFixed(this.decimalPrecision)},setValue:function(v){Roo.form.NumberField.superclass.setValue.call(this,String(v).replace(".",this.decimalSeparator))},decimalPrecisionFcn:function(v){return Math.floor(v)},beforeBlur:function(){var v=this.parseValue(this.getRawValue());if(v){this.setValue(this.fixPrecision(v))}}});
-Roo.form.DateField=function(A){Roo.form.DateField.superclass.constructor.call(this,A);this.addEvents({"select":true});if(typeof this.minValue=="string")this.minValue=this.parseDate(this.minValue);if(typeof this.maxValue=="string")this.maxValue=this.parseDate(this.maxValue);this.ddMatch=null;if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1)re+="|"}this.ddMatch=new RegExp(re+")")}};Roo.extend(Roo.form.DateField,Roo.form.TriggerField,{format:"m/d/y",altFormats:"m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d",disabledDays:null,disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:"x-form-date-trigger",useIso:false,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},hiddenField:false,onRender:function(ct,A){Roo.form.DateField.superclass.onRender.call(this,ct,A);if(this.useIso){this.el.dom.removeAttribute("name");this.hiddenField=this.el.insertSibling({tag:"input",type:"hidden",name:this.name},"before",true);this.hiddenField.value=this.formatDate(this.value,"Y-m-d");this.hiddenName=this.name}},validateValue:function(C){C=this.formatDate(C);if(!Roo.form.DateField.superclass.validateValue.call(this,C)){return false}if(C.length<1){return true}var E=C;C=this.parseDate(C);if(!C){this.markInvalid(String.format(this.invalidText,E,this.format));return false}var B=C.getTime();if(this.minValue&&B<this.minValue.getTime()){this.markInvalid(String.format(this.minText,this.formatDate(this.minValue)));return false}if(this.maxValue&&B>this.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false}if(this.disabledDays){var A=C.getDay();for(var i=0;i<this.disabledDays.length;i++){if(A===this.disabledDays[i]){this.markInvalid(this.disabledDaysText);return false}}}var D=this.formatDate(C);if(this.ddMatch&&this.ddMatch.test(D)){this.markInvalid(String.format(this.disabledDatesText,D));return false}return true},validateBlur:function(){return !this.menu||!this.menu.isVisible()},getValue:function(){return this.hiddenField?this.hiddenField.value:this.parseDate(Roo.form.DateField.superclass.getValue.call(this))||""},setValue:function(A){if(this.hiddenField){this.hiddenField.value=this.formatDate(this.parseDate(A),"Y-m-d")}Roo.form.DateField.superclass.setValue.call(this,this.formatDate(this.parseDate(A)))},parseDate:function(B){if(!B||B instanceof Date){return B}var v=Date.parseDate(B,this.format);if(!v&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|")}for(var i=0,A=this.altFormatsArray.length;i<A&&!v;i++){v=Date.parseDate(B,this.altFormatsArray[i])}}return v},formatDate:function(B,A){return (!B||!(B instanceof Date))?B:B.dateFormat(A||this.format)},menuListeners:{select:function(m,d){this.setValue(d);this.fireEvent("select",this,d)},show:function(){this.onFocus()},hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);this.menu.un("hide",ml.hide,this)}},onTriggerClick:function(){if(this.disabled){return}if(this.menu==null){this.menu=new Roo.menu.DateMenu()}Roo.apply(this.menu.picker,{showClear:this.allowBlank,minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.format,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))});this.menu.on(Roo.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?")},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v)}}});
-Roo.form.ComboBox=function(D){Roo.form.ComboBox.superclass.constructor.call(this,D);this.addEvents({"expand":true,collapse:true,beforeselect:true,select:true,beforequery:true});if(this.transform){this.allowDomMove=false;var s=Roo.getDom(this.transform);if(!this.hiddenName){this.hiddenName=s.name;
-}if(!this.store){this.mode="local";var d=[],B=s.options;for(var i=0,A=B.length;i<A;i++){var o=B[i];var C=(Roo.isIE?o.getAttributeNode("value").specified:o.hasAttribute("value"))?o.value:o.text;if(o.selected){this.value=C;}d.push([C,o.text]);}this.store=new Roo.data.SimpleStore({"id":0,fields:["value","text"],data:d});
-this.valueField="value";this.displayField="text";}s.name=Roo.id();if(!this.lazyRender){this.target=true;this.el=Roo.DomHelper.insertBefore(s,this.autoCreate||this.defaultAutoCreate);s.parentNode.removeChild(s);this.render(this.el.parentNode);}else{s.parentNode.removeChild(s);
-}}if(this.store){this.store=Roo.factory(this.store,Roo.data);}this.selectedIndex=-1;if(this.mode=="local"){if(D.queryDelay===undefined){this.queryDelay=10;}if(D.minChars===undefined){this.minChars=0;}}};Roo.extend(Roo.form.ComboBox,Roo.form.TriggerField,{defaultAutoCreate:{tag:"input",type:"text",size:"24",autocomplete:"off"},listWidth:undefined,displayField:undefined,valueField:undefined,hiddenName:undefined,listClass:"",selectedClass:"x-combo-selected",triggerClass:"x-form-arrow-trigger",shadow:"sides",listAlign:"tl-bl?",maxHeight:300,triggerAction:"query",minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:"query",loadingText:"Loading...",resizable:false,handleHeight:8,editable:true,allQuery:"",mode:"remote",minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,blockFocus:false,disableClear:false,onRender:function(ct,C){Roo.form.ComboBox.superclass.onRender.call(this,ct,C);
-if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:"input",type:"hidden",name:this.hiddenName,id:(this.hiddenId||this.hiddenName)},"before",true);this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:"";
-this.el.dom.removeAttribute("name");}if(Roo.isGecko){this.el.dom.setAttribute("autocomplete","off");}var A="x-combo-list";this.list=new Roo.Layer({shadow:this.shadow,cls:[A,this.listClass].join(" "),constrain:false});var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);
-this.list.setWidth(lw);this.list.swallowEvent("mousewheel");this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:A+"-hd",html:this.title});this.assetHeight+=this.header.getHeight();}this.innerList=this.list.createChild({cls:A+"-inner"});
-this.innerList.on("mouseover",this.onViewOver,this);this.innerList.on("mousemove",this.onViewMove,this);this.innerList.setWidth(lw-this.list.getFrameWidth("lr"));if(this.allowBlank&&!this.pageSize&&!this.disableClear){this.footer=this.list.createChild({cls:A+"-ft"});
-this.pageTb=new Roo.Toolbar(this.footer);}if(this.pageSize){this.footer=this.list.createChild({cls:A+"-ft"});this.pageTb=new Roo.PagingToolbar(this.footer,this.store,{pageSize:this.pageSize});}if(this.pageTb&&this.allowBlank&&!this.disableClear){var B=this;
-this.pageTb.add(new Roo.Toolbar.Fill(),{cls:"x-btn-icon x-btn-clear",text:"&#160;",handler:function(){B.collapse();B.clearValue();B.onSelect(false,-1);}});}if(this.footer){this.assetHeight+=this.footer.getHeight();}if(!this.tpl){this.tpl="<div class=\""+A+"-item\">{"+this.displayField+"}</div>";
-}this.view=new Roo.View(this.innerList,this.tpl,{singleSelect:true,store:this.store,selectedClass:this.selectedClass});this.view.on("click",this.onViewClick,this);this.store.on("beforeload",this.onBeforeLoad,this);this.store.on("load",this.onLoad,this);this.store.on("loadexception",this.collapse,this);
-if(this.resizable){this.resizer=new Roo.Resizable(this.list,{pinned:true,handles:"se"});this.resizer.on("resize",function(r,w,h){this.maxHeight=h-this.handleHeight-this.list.getFrameWidth("tb")-this.assetHeight;this.listWidth=w;this.innerList.setWidth(w-this.list.getFrameWidth("lr"));
-this.restrictHeight();},this);this[this.pageSize?"footer":"innerList"].setStyle("margin-bottom",this.handleHeight+"px");}if(!this.editable){this.editable=true;this.setEditable(false);}},initEvents:function(){Roo.form.ComboBox.superclass.initEvents.call(this);
-this.keyNav=new Roo.KeyNav(this.el,{"up":function(e){this.inKeyMode=true;this.selectPrev();},down:function(e){if(!this.isExpanded()){this.onTriggerClick();}else{this.inKeyMode=true;this.selectNext();}},enter:function(e){this.onViewClick();},esc:function(e){this.collapse();
-},tab:function(e){this.onViewClick(false);return true;},scope:this,doRelay:function(B,A,C){if(C=="down"||this.scope.isExpanded()){return Roo.KeyNav.prototype.doRelay.apply(this,arguments);}return true;},forceKeyDown:true});this.queryDelay=Math.max(this.queryDelay||10,this.mode=="local"?10:250);
-this.dqTask=new Roo.util.DelayedTask(this.initQuery,this);if(this.typeAhead){this.taTask=new Roo.util.DelayedTask(this.onTypeAhead,this);}if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this);}if(this.forceSelection){this.on("blur",this.doForce,this);
-}},onDestroy:function(){if(this.view){this.view.setStore(null);this.view.el.removeAllListeners();this.view.el.remove();this.view.purgeListeners();}if(this.list){this.list.destroy();}if(this.store){this.store.un("beforeload",this.onBeforeLoad,this);this.store.un("load",this.onLoad,this);
-this.store.un("loadexception",this.collapse,this);}Roo.form.ComboBox.superclass.onDestroy.call(this);},fireKey:function(e){if(e.isNavKeyPress()&&!this.list.isVisible()){this.fireEvent("specialkey",this,e);}},onResize:function(w,h){Roo.form.ComboBox.superclass.onResize.apply(this,arguments);
-if(this.list&&this.listWidth===undefined){var lw=Math.max(w,this.minListWidth);this.list.setWidth(lw);this.innerList.setWidth(lw-this.list.getFrameWidth("lr"));}},setEditable:function(A){if(A==this.editable){return;}this.editable=A;if(!A){this.el.dom.setAttribute("readOnly",true);
-this.el.on("mousedown",this.onTriggerClick,this);this.el.addClass("x-combo-noedit");}else{this.el.dom.setAttribute("readOnly",false);this.el.un("mousedown",this.onTriggerClick,this);this.el.removeClass("x-combo-noedit");}},onBeforeLoad:function(){if(!this.hasFocus){return;
-}this.innerList.update(this.loadingText?"<div class=\"loading-indicator\">"+this.loadingText+"</div>":"");this.restrictHeight();this.selectedIndex=-1;},onLoad:function(){if(!this.hasFocus){return;}if(this.store.getCount()>0){this.expand();this.restrictHeight();
-if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select();}if(!this.selectByValue(this.value,true)){this.select(0,true);}}else{this.selectNext();if(this.typeAhead&&this.lastKey!=Roo.EventObject.BACKSPACE&&this.lastKey!=Roo.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay);
-}}}else{this.onEmptyResults();}},onTypeAhead:function(){if(this.store.getCount()>0){var r=this.store.getAt(0);var B=r.data[this.displayField];var A=B.length;var C=this.getRawValue().length;if(C!=A){this.setRawValue(B);this.selectText(C,B.length);}}},onSelect:function(B,A){if(this.fireEvent("beforeselect",this,B,A)!==false){this.setFromData(A>-1?B.data:false);
-this.collapse();this.fireEvent("select",this,B,A);}},getValue:function(){if(this.valueField){return typeof this.value!="undefined"?this.value:"";}else{return Roo.form.ComboBox.superclass.getValue.call(this);}},clearValue:function(){if(this.hiddenField){this.hiddenField.value="";
-}this.value="";this.setRawValue("");this.lastSelectionText="";this.applyEmptyText();},setValue:function(v){var A=v;if(this.valueField){var r=this.findRecord(this.valueField,v);if(r){A=r.data[this.displayField];}else if(this.valueNotFoundText!==undefined){A=this.valueNotFoundText;
-}}this.lastSelectionText=A;if(this.hiddenField){this.hiddenField.value=v;}Roo.form.ComboBox.superclass.setValue.call(this,A);this.value=v;},lastData:false,setFromData:function(o){var dv="";var vv="";this.lastData=o;if(this.displayField){dv=!o||typeof (o[this.displayField])=="undefined"?"":o[this.displayField];
-}else{console.log("no value field set for "+this.name);}if(this.valueField){vv=!o||typeof (o[this.valueField])=="undefined"?dv:o[this.valueField];}if(this.hiddenField){this.hiddenField.value=vv;this.lastSelectionText=dv;Roo.form.ComboBox.superclass.setValue.call(this,dv);
-this.value=vv;return;}this.lastSelectionText=dv;Roo.form.ComboBox.superclass.setValue.call(this,dv);this.value=vv;},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 C;},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(B){var A=this.view.getSelectedIndexes()[0];var r=this.store.getAt(A);if(r){this.onSelect(r,A);
-}if(B!==false&&!this.blockFocus){this.el.focus();}},restrictHeight:function(){this.innerList.dom.style.height="";var A=this.innerList.dom;var h=Math.max(A.clientHeight,A.offsetHeight,A.scrollHeight);this.innerList.setHeight(h<this.maxHeight?"auto":this.maxHeight);
-this.list.beginUpdate();this.list.setHeight(this.innerList.getHeight()+this.list.getFrameWidth("tb")+(this.resizable?this.handleHeight:0)+this.assetHeight);this.list.alignTo(this.el,this.listAlign);this.list.endUpdate();},onEmptyResults:function(){this.collapse();
-},isExpanded:function(){return this.list.isVisible();},selectByValue:function(v,A){if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),A);return true;}}return false;},select:function(A,B){this.selectedIndex=A;
-this.view.select(A);if(B!==false){var el=this.view.getNode(A);if(el){this.innerList.scrollChildIntoView(el,false);}}},selectNext:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex<ct-1){this.select(this.selectedIndex+1);
-}}},selectPrev:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex!=0){this.select(this.selectedIndex-1);}}},onKeyUp:function(e){if(this.editable!==false&&!e.isSpecialKey()){this.lastKey=e.getKey();
-this.dqTask.delay(this.queryDelay);}},validateBlur:function(){return !this.list||!this.list.isVisible();},initQuery:function(){this.doQuery(this.getRawValue());},doForce:function(){if(this.el.dom.value.length>0){this.el.dom.value=this.lastSelectionText===undefined?"":this.lastSelectionText;
-this.applyEmptyText();}},doQuery:function(q,A){if(q===undefined||q===null){q="";}var qe={query:q,forceAll:A,combo:this,cancel:false};if(this.fireEvent("beforequery",qe)===false||qe.cancel){return false;}q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){if(this.lastQuery!=q){this.lastQuery=q;
-if(this.mode=="local"){this.selectedIndex=-1;if(A){this.store.clearFilter();}else{this.store.filter(this.displayField,q);}this.onLoad();}else{this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});this.expand();}}else{this.selectedIndex=-1;
-this.onLoad();}}},getParams:function(q){var p={};if(this.pageSize){p.start=0;p.limit=this.pageSize;}return p;},collapse:function(){if(!this.isExpanded()){return;}this.list.hide();Roo.get(document).un("mousedown",this.collapseIf,this);Roo.get(document).un("mousewheel",this.collapseIf,this);
-this.fireEvent("collapse",this);},collapseIf:function(e){if(!e.within(this.wrap)&&!e.within(this.list)){this.collapse();}},expand:function(){if(this.isExpanded()||!this.hasFocus){return;}this.list.alignTo(this.el,this.listAlign);this.list.show();Roo.get(document).on("mousedown",this.collapseIf,this);
-Roo.get(document).on("mousewheel",this.collapseIf,this);this.fireEvent("expand",this);},onTriggerClick:function(){if(this.disabled){return;}if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.el.focus();}}else{this.hasFocus=true;if(this.triggerAction=="all"){this.doQuery(this.allQuery,true);
-}else{this.doQuery(this.getRawValue());}if(!this.blockFocus){this.el.focus();}}}});
-Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:"hidden",autocomplete:"off"},boxLabel:"",inputValue:"1",valueOff:"0",actionMode:"viewEl",itemCls:"x-menu-check-item x-form-item",groupClass:"x-menu-group-item",inputType:"hidden",inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);
-if(!this.boxLabel){this.el.alignTo(this.wrap,"c-c");}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;
-},onRender:function(ct,B){Roo.form.Checkbox.superclass.onRender.call(this,ct,B);this.wrap=this.el.wrap({cls:"x-menu-check-item "});var A=this.wrap.createChild({tag:"img",cls:"x-menu-item-icon",style:"margin: 0px;",src:Roo.BLANK_IMAGE_URL});this.viewEl=A;this.wrap.on("click",this.onClick,this);
-this.el.on("DOMAttrModified",this.setFromHidden,this);this.el.on("propertychange",this.setFromHidden,this);if(this.boxLabel){this.wrap.createChild({tag:"label",htmlFor:this.el.id,cls:"x-form-cb-label",html:this.boxLabel});}this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;
-}return this.valueOff;},onClick:function(){this.setChecked(!this.checked);},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue));},setChecked:function(A,B){if(this.inSetChecked){this.checked=A;return;}if(this.wrap){this.wrap[A?"addClass":"removeClass"]("x-menu-item-checked");
-}this.checked=A;if(B!==true){this.fireEvent("checkchange",this,A);}this.inSetChecked=true;this.el.dom.value=A?this.inputValue:this.valueOff;this.inSetChecked=false;},setFromHidden:function(){if(!this.el){return;}this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();
-}Roo.form.Checkbox.superclass.onDestroy.call(this);}});
-Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments)};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:"radio",getGroupValue:function(){return this.el.up("form").child("input[name="+this.el.dom.name+"]:checked",true).value}});
-Roo.form.HtmlEditor=Roo.extend(Roo.form.Field,{toolbars:false,createLinkText:"Please enter the URL for the link:",defaultLinkValue:"http:/"+"/",frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:"offsets",defaultAutoCreate:{tag:"textarea",style:"width:500px;height:300px;",autocomplete:"off"},initComponent:function(){this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editmodechange:true,editorevent:true})},createToolbar:function(A){if(!A.toolbars||!A.toolbars.length){A.toolbars=[new Roo.form.HtmlEditor.ToolbarStandard()];
-}for(var i=0;i<A.toolbars.length;i++){A.toolbars[i].init(A);}},getDocMarkup:function(){return "<html><head><style type=\"text/css\">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>";},onRender:function(ct,C){Roo.form.HtmlEditor.superclass.onRender.call(this,ct,C);
-this.el.dom.style.border="0 none";this.el.dom.setAttribute("tabIndex",-1);this.el.addClass("x-hidden");if(Roo.isIE){this.el.applyStyles("margin-top:-1px;margin-bottom:-1px;")}this.wrap=this.el.wrap({cls:"x-html-editor-wrap",cn:{cls:"x-html-editor-tb"}});this.frameId=Roo.id();
-this.createToolbar(this);var B=this.wrap.createChild({tag:"iframe",id:this.frameId,name:this.frameId,frameBorder:"no",src:Roo.SSL_SECURE_URL?Roo.SSL_SECURE_URL:"javascript:false"});this.iframe=B.dom;this.assignDocWin();this.doc.designMode="on";this.doc.open();
-this.doc.write(this.getDocMarkup());this.doc.close();var A={run:function(){this.assignDocWin();if(this.doc.body||this.doc.readyState=="complete"){try{this.doc.designMode="on";}catch(e){return;}Roo.TaskMgr.stop(A);this.initEditor.defer(10,this);}},interval:10,duration:10000,scope:this};
-Roo.TaskMgr.start(A);if(!this.width){this.setSize(this.el.getSize());}},onResize:function(w,h){Roo.form.HtmlEditor.superclass.onResize.apply(this,arguments);if(this.el&&this.iframe){if(typeof w=="number"){var aw=w-this.wrap.getFrameWidth("lr");this.el.setWidth(this.adjustWidth("textarea",aw));
-this.iframe.style.width=aw+"px";}if(typeof h=="number"){var A=0;for(var i=0;i<this.toolbars.length;i++){A+=this.toolbars[i].tb.el.getHeight();}var ah=h-this.wrap.getFrameWidth("tb")-A;this.el.setHeight(this.adjustWidth("textarea",ah));this.iframe.style.height=ah+"px";
-if(this.doc){(this.doc.body||this.doc.documentElement).style.height=(ah-(this.iframePad*2))+"px";}}}},toggleSourceEdit:function(A){this.sourceEditMode=A===true;if(this.sourceEditMode){this.syncValue();this.iframe.className="x-hidden";this.el.removeClass("x-hidden");
-this.el.dom.removeAttribute("tabIndex");this.el.focus();}else{this.pushValue();this.iframe.className="";this.el.addClass("x-hidden");this.el.dom.setAttribute("tabIndex",-1);this.deferFocus();}this.setSize(this.wrap.getSize());this.fireEvent("editmodechange",this,this.sourceEditMode);
-},createLink:function(){var A=prompt(this.createLinkText,this.defaultLinkValue);if(A&&A!="http:/"+"/"){this.relayCmd("createlink",A);}},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;
-},initEvents:function(){this.originalValue=this.getValue();},markInvalid:Roo.emptyFn,clearInvalid:Roo.emptyFn,setValue:function(v){Roo.form.HtmlEditor.superclass.setValue.call(this,v);this.pushValue();},cleanHtml:function(A){A=String(A);if(A.length>5){if(Roo.isSafari){A=A.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,"");
-}}if(A=="&nbsp;"){A="";}return A;},syncValue:function(){if(this.initialized){var bd=(this.doc.body||this.doc.documentElement);var A=bd.innerHTML;if(Roo.isSafari){var bs=bd.getAttribute("style");var m=bs.match(/text-align:(.*?);/i);if(m&&m[1]){A="<div style=\""+m[0]+"\">"+A+"</div>";
-}}A=this.cleanHtml(A);if(this.fireEvent("beforesync",this,A)!==false){this.el.dom.value=A;this.fireEvent("sync",this,A);}}},pushValue:function(){if(this.initialized){var v=this.el.dom.value;if(v.length<1){v="&#160;";}if(this.fireEvent("beforepush",this,v)!==false){(this.doc.body||this.doc.documentElement).innerHTML=v;
-this.fireEvent("push",this,v);}}},deferFocus:function(){this.focus.defer(10,this);},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus();}else{this.el.focus();}},assignDocWin:function(){var A=this.iframe;if(Roo.isIE){this.doc=A.contentWindow.document;
-this.win=A.contentWindow;}else{this.doc=(A.contentDocument||Roo.get(this.frameId).dom.document);this.win=Roo.get(this.frameId).dom.contentWindow;}},initEditor:function(){this.assignDocWin();this.doc.designMode="on";this.doc.open();this.doc.write(this.getDocMarkup());
-this.doc.close();var A=(this.doc.body||this.doc.documentElement);var ss=this.el.getStyles("font-size","background-image","background-repeat");ss["background-attachment"]="fixed";A.bgProperties="fixed";Roo.DomHelper.applyStyles(A,ss);Roo.EventManager.on(this.doc,{"mousedown":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.applyCommand,this);}if(Roo.isIE||Roo.isSafari||Roo.isOpera){Roo.EventManager.on(this.doc,"keydown",this.fixKeys,this);}this.initialized=true;this.fireEvent("initialize",this);this.pushValue();},onDestroy:function(){if(this.rendered){for(var i=0;
-i<this.toolbars.length;i++){this.toolbars[i].onDestroy();}this.wrap.dom.innerHTML="";this.wrap.remove();}},onFirstFocus:function(){this.assignDocWin();this.activated=true;for(var i=0;i<this.toolbars.length;i++){this.toolbars[i].onFirstFocus();}if(Roo.isGecko){this.win.focus();
-var s=this.win.getSelection();if(!s.focusNode||s.focusNode.nodeType!=3){var r=s.getRangeAt(0);r.selectNodeContents((this.doc.body||this.doc.documentElement));r.collapse(true);this.deferFocus();}try{this.execCmd("useCSS",true);this.execCmd("styleWithCSS",false);
-}catch(e){}}this.fireEvent("activate",this);},adjustFont:function(A){var B=A.cmd=="increasefontsize"?1:-1;var v=parseInt(this.doc.queryCommandValue("FontSize")||3,10);if(Roo.isSafari){var sm={10:1,13:2,16:3,18:4,24:5,32:6,48:7};v=(v<10)?10:v;v=(v>48)?48:v;
-v=typeof (sm[v])=="undefined"?1:sm[v];}v=Math.max(1,v+B);this.execCmd("FontSize",v);},onEditorEvent:function(e){this.fireEvent("editorevent",this,e);this.syncValue();},insertTag:function(tg){this.execCmd("formatblock",tg);},insertText:function(A){range=this.createRange();
-range.deleteContents();range.insertNode(this.doc.createTextNode(A));},relayBtnCmd:function(A){this.relayCmd(A.cmd);},relayCmd:function(A,B){this.win.focus();this.execCmd(A,B);this.fireEvent("editorevent",this);this.deferFocus();},execCmd:function(A,B){this.doc.execCommand(A,false,B===undefined?null:B);
-this.syncValue();},applyCommand:function(e){if(e.ctrlKey){var c=e.getCharCode(),A;if(c>0){c=String.fromCharCode(c);switch(c){case "b":A="bold";break;case "i":A="italic";break;case "u":A="underline";break;}if(A){this.win.focus();this.execCmd(A);this.deferFocus();
-e.preventDefault();}}}},insertAtCursor:function(A){if(!this.activated){return;}if(Roo.isIE){this.win.focus();var r=this.doc.selection.createRange();if(r){r.collapse(true);r.pasteHTML(A);this.syncValue();this.deferFocus();}}else if(Roo.isGecko||Roo.isOpera){this.win.focus();
-this.execCmd("InsertHTML",A);this.deferFocus();}else if(Roo.isSafari){this.execCmd("InsertText",A);this.deferFocus();}},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();}}else 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();}}}};}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();}};}else if(Roo.isSafari){return function(e){var k=e.getKey();if(k==e.TAB){e.stopEvent();this.execCmd("InsertText","\t");this.deferFocus();
-}};}}(),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 B=this.createRange(this.getSelection());if(Roo.isIE){var C=B.parentElement();while(true){var D=B.duplicate();D.moveToElementText(C);if(D.inRange(B)){break;}if((C.nodeType!=1)||(C.tagName.toLowerCase()=="body")){break;
-}C=C.parentElement;}return C;}var ar=B.endContainer.childNodes;if(!ar.length){ar=B.commonAncestorContainer.childNodes;}var A=[];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(B,ar[i])&&this.rangeCompareNode(B,ar[i])==3){A.push(ar[i]);
-continue;}if((ar[i].nodeType==1)&&this.rangeIntersectsNode(B,ar[i])&&(this.rangeCompareNode(B,ar[i])>0)){E.push(ar[i]);continue;}if(!this.rangeIntersectsNode(B,ar[i])||(this.rangeCompareNode(B,ar[i])==0)){continue;}F=true;}if(!A.length&&E.length){A=E;}if(F||!A.length||(A.length>1)){return false;
-}return A[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(B,A){var C=A.ownerDocument.createRange();try{C.selectNode(A);}catch(e){C.selectNodeContents(A);
-}return B.compareBoundaryPoints(Range.END_TO_START,C)==-1&&B.compareBoundaryPoints(Range.START_TO_END,C)==1;},rangeCompareNode:function(B,A){var C=A.ownerDocument.createRange();try{C.selectNode(A);}catch(e){C.selectNodeContents(A);}var E=B.compareBoundaryPoints(Range.START_TO_START,C)==1;
-var D=B.compareBoundaryPoints(Range.END_TO_END,C)==-1;if(E&&!D)return 0;if(!E&&D)return 1;if(E&&D)return 2;return 3;}});
-Roo.form.HtmlEditor.ToolbarStandard=function(A){Roo.apply(this,A);};Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype,{tb:false,rendered:false,editor:false,disable:false,fontFamilies:["Arial","Courier New","Tahoma","Times New Roman","Verdana"],specialChars:["&#169;","&#174;","&#8482;","&#163;","&#8230;","&#247;","&#8364;","&#176;"],inputElements:["form","input:text","input:hidden","input:checkbox","input:radio","input:password","input:submit","input:button","select","textarea","label"],formats:[["p"],["h1"],["h2"],["h3"],["h4"],["h5"],["h6"],["pre"],["code"],["abbr"],["acronym"],["address"],["cite"],["samp"],["var"]],defaultFont:"tahoma",fontSelect:false,formatCombo:false,init:function(E){this.editor=E;
-var C=E.frameId;var B=this;function A(id,G,H){var F=C+"-"+id;return {id:F,cmd:id,cls:"x-btn-icon x-edit-"+id,enableToggle:G!==false,scope:E,handler:H||E.relayBtnCmd,clickEvent:"mousedown",tooltip:B.buttonTips[id]||undefined,tabIndex:-1};}var tb=new Roo.Toolbar(E.wrap.dom.firstChild);
-this.tb=tb;tb.el.on("click",function(e){e.preventDefault();});if(!this.disable.font&&!Roo.isSafari){};if(!this.disable.formats){this.formatCombo=new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:"tag",fields:["tag"],data:this.formats}),blockFocus:true,displayField:"tag",typeAhead:false,mode:"local",editable:false,triggerAction:"all",emptyText:"Add tag",selectOnFocus:true,width:135,listeners:{"select":function(c,r,i){E.insertTag(r.get("tag"));
-E.focus();}}});tb.addField(this.formatCombo);}if(!this.disable.format){tb.add(A("bold"),A("italic"),A("underline"));};if(!this.disable.fontSize){tb.add("-",A("increasefontsize",false,E.adjustFont),A("decreasefontsize",false,E.adjustFont));};if(this.disable.colors){tb.add("-",{id:E.frameId+"-forecolor",cls:"x-btn-icon x-edit-forecolor",clickEvent:"mousedown",tooltip:this.buttonTips["forecolor"]||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({allowReselect:true,focus:Roo.emptyFn,value:"000000",plain:true,selectHandler:function(cp,F){E.execCmd("forecolor",Roo.isSafari||Roo.isIE?"#"+F:F);
-E.deferFocus();},scope:E,clickEvent:"mousedown"})},{id:E.frameId+"backcolor",cls:"x-btn-icon x-edit-backcolor",clickEvent:"mousedown",tooltip:this.buttonTips["backcolor"]||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({focus:Roo.emptyFn,value:"FFFFFF",plain:true,allowReselect:true,selectHandler:function(cp,F){if(Roo.isGecko){E.execCmd("useCSS",false);
-E.execCmd("hilitecolor",F);E.execCmd("useCSS",true);E.deferFocus();}else{E.execCmd(Roo.isOpera?"hilitecolor":"backcolor",Roo.isSafari||Roo.isIE?"#"+F:F);E.deferFocus();}},scope:E,clickEvent:"mousedown"})});};if(!this.disable.alignments){tb.add("-",A("justifyleft"),A("justifycenter"),A("justifyright"));
-};if(!this.disable.links){tb.add("-",A("createlink",false,E.createLink));};if(!this.disable.lists){tb.add("-",A("insertorderedlist"),A("insertunorderedlist"));}if(!this.disable.sourceEdit){tb.add("-",A("sourceedit",true,function(F){this.toggleSourceEdit(F.pressed);
-}));}var D={};if(!this.disable.special){D={text:"&#169;",cls:"x-edit-none",menu:{items:[]}};for(var i=0;i<this.specialChars.length;i++){D.menu.items.push({text:this.specialChars[i],handler:function(a,b){E.insertAtCursor(String.fromCharCode(a.text.replace("&#","").replace(";","")));
-},tabIndex:-1});}tb.add(D);}if(this.btns){for(var i=0;i<this.btns.length;i++){var b=this.btns[i];b.cls="x-edit-none";b.scope=E;tb.add(b);}}this.tb.items.each(function(F){if(F.id!=E.frameId+"-sourceedit"){F.disable();}});this.rendered=true;E.on("editorevent",this.updateToolbar,this);
-},updateToolbar:function(){if(!this.editor.activated){this.editor.onFirstFocus();return;}var C=this.tb.items.map,B=this.editor.doc,E=this.editor.frameId;if(!this.disable.font&&!Roo.isSafari){}if(!this.disable.format){C[E+"-bold"].toggle(B.queryCommandState("bold"));
-C[E+"-italic"].toggle(B.queryCommandState("italic"));C[E+"-underline"].toggle(B.queryCommandState("underline"));}if(!this.disable.alignments){C[E+"-justifyleft"].toggle(B.queryCommandState("justifyleft"));C[E+"-justifycenter"].toggle(B.queryCommandState("justifycenter"));
-C[E+"-justifyright"].toggle(B.queryCommandState("justifyright"));}if(!Roo.isSafari&&!this.disable.lists){C[E+"-insertorderedlist"].toggle(B.queryCommandState("insertorderedlist"));C[E+"-insertunorderedlist"].toggle(B.queryCommandState("insertunorderedlist"));
-}var A=this.editor.getAllAncestors();if(this.formatCombo){var D=this.formatCombo.store;this.formatCombo.setValue("");for(var i=0;i<A.length;i++){if(A[i]&&D.query("tag",A[i].tagName.toLowerCase(),true).length){this.formatCombo.setValue(A[i].tagName.toLowerCase());
-break;}}}Roo.menu.MenuMgr.hideAll();},createFontOptions:function(){var A=[],fs=this.fontFamilies,ff,lc;for(var i=0,B=fs.length;i<B;i++){ff=fs[i];lc=ff.toLowerCase();A.push("<option value=\"",lc,"\" style=\"font-family:",ff,";\"",(this.defaultFont==lc?" selected=\"true\">":">"),ff,"</option>");
-}return A.join("");},toggleSourceEdit:function(B){if(B===undefined){B=!this.sourceEditMode;}this.sourceEditMode=B===true;var A=this.tb.items.get(this.editor.frameId+"-sourceedit");if(A.pressed!==this.editor.sourceEditMode){A.toggle(this.editor.sourceEditMode);
-return;}if(this.sourceEditMode){this.tb.items.each(function(C){if(C.cmd!="sourceedit"){C.disable();}});}else{if(this.initialized){this.tb.items.each(function(C){C.enable();});}}this.editor.toggleSourceEdit(B);},buttonTips:{bold:{title:"Bold (Ctrl+B)",text:"Make the selected text bold.",cls:"x-html-editor-tip"},italic:{title:"Italic (Ctrl+I)",text:"Make the selected text italic.",cls:"x-html-editor-tip"},underline:{title:"Underline (Ctrl+U)",text:"Underline the selected text.",cls:"x-html-editor-tip"},increasefontsize:{title:"Grow Text",text:"Increase the font size.",cls:"x-html-editor-tip"},decreasefontsize:{title:"Shrink Text",text:"Decrease the font size.",cls:"x-html-editor-tip"},backcolor:{title:"Text Highlight Color",text:"Change the background color of the selected text.",cls:"x-html-editor-tip"},forecolor:{title:"Font Color",text:"Change the color of the selected text.",cls:"x-html-editor-tip"},justifyleft:{title:"Align Text Left",text:"Align text to the left.",cls:"x-html-editor-tip"},justifycenter:{title:"Center Text",text:"Center text in the editor.",cls:"x-html-editor-tip"},justifyright:{title:"Align Text Right",text:"Align text to the right.",cls:"x-html-editor-tip"},insertunorderedlist:{title:"Bullet List",text:"Start a bulleted list.",cls:"x-html-editor-tip"},insertorderedlist:{title:"Numbered List",text:"Start a numbered list.",cls:"x-html-editor-tip"},createlink:{title:"Hyperlink",text:"Make the selected text a hyperlink.",cls:"x-html-editor-tip"},sourceedit:{title:"Source Edit",text:"Switch to source editing mode.",cls:"x-html-editor-tip"}},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();
-if(A.menu.el){A.menu.el.destroy();}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});}});
-Roo.form.HtmlEditor.ToolbarContext=function(A){Roo.apply(this,A);};Roo.form.HtmlEditor.ToolbarContext.types={"IMG":{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["right"],["center"],["top"]],width:80},border:{title:"Border",width:40},alt:{title:"Alt",width:120},src:{title:"Src",width:220}},A:{name:{title:"Name",width:50},href:{title:"Href",width:220}},TABLE:{rows:{title:"Rows",width:20},cols:{title:"Cols",width:20},width:{title:"Width",width:40},height:{title:"Height",width:40},border:{title:"Border",width:20}},TD:{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["center"],["right"],["justify"],["char"]],width:40},valign:{title:"Valign",opts:[[""],["top"],["middle"],["bottom"],["baseline"]],width:40},colspan:{title:"Colspan",width:20}},INPUT:{name:{title:"name",width:120},value:{title:"Value",width:120},width:{title:"Width",width:40}},LABEL:{"for":{title:"For",width:120}},TEXTAREA:{name:{title:"name",width:120},rows:{title:"Rows",width:20},cols:{title:"Cols",width:20}},SELECT:{name:{title:"name",width:120},selectoptions:{title:"Options",width:200}},BODY:{title:{title:"title",width:120,disabled:true}}};
-Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,{tb:false,rendered:false,editor:false,disable:false,toolbars:false,init:function(E){this.editor=E;var C=E.frameId;var B=this;function A(id,G,H){var F=C+"-"+id;return {id:F,cmd:id,cls:"x-btn-icon x-edit-"+id,enableToggle:G!==false,scope:E,handler:H||E.relayBtnCmd,clickEvent:"mousedown",tooltip:B.buttonTips[id]||undefined,tabIndex:-1};
-}var D=E.wrap.createChild({tag:"div"},E.wrap.dom.firstChild.nextSibling,true);var ty=Roo.form.HtmlEditor.ToolbarContext.types;this.toolbars={};for(var i in ty){this.toolbars[i]=this.buildToolbar(ty[i],i);}this.tb=this.toolbars.BODY;this.tb.el.show();this.rendered=true;
-E.on("editorevent",this.updateToolbar,this);},updateToolbar:function(){if(!this.editor.activated){this.editor.onFirstFocus();return;}var A=this.editor.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;var B=A.length?(A[0]?A[0]:A[1]):this.editor.doc.body;
-B=B?B:this.editor.doc.body;B=B.tagName.length?B:this.editor.doc.body;var tn=B.tagName.toUpperCase();B=typeof (ty[tn])!="undefined"?B:this.editor.doc.body;tn=B.tagName.toUpperCase();if(this.tb.name==tn){return;}this.tb.el.hide();this.tb=this.toolbars[tn];this.tb.el.show();
-this.tb.fields.each(function(e){e.setValue(B.getAttribute(e.name));});this.tb.selectedNode=B;Roo.menu.MenuMgr.hideAll();},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();if(A.menu.el){A.menu.el.destroy();
-}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});},buildToolbar:function(C,nm){var D=this.editor;var B=D.wrap.createChild({tag:"div"},D.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(B);tb.add(nm+":&nbsp;");
-for(var i in C){var A=C[i];tb.add(A.title+":&nbsp;");if(A.opts){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:"val",fields:["val"],data:A.opts}),name:i,displayField:"val",typeAhead:false,mode:"local",editable:false,triggerAction:"all",emptyText:"Select",selectOnFocus:true,width:A.width?A.width:130,listeners:{"select":function(c,r,i){tb.selectedNode.setAttribute(c.name,r.get("val"));
-}}}));continue;tb.addField(new Roo.form.TextField({name:i,width:100,value:""}));continue;}tb.addField(new Roo.form.TextField({name:i,width:A.width,value:"",listeners:{"change":function(f,nv,ov){tb.selectedNode.setAttribute(f.name,nv);}}}));}tb.el.on("click",function(e){e.preventDefault();
-});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();tb.name=nm;return tb;}});
-Roo.form.BasicForm=function(el,A){Roo.apply(this,A);this.items=new Roo.util.MixedCollection(false,function(o){return o.id||(o.id=Roo.id());});this.addEvents({beforeaction:true,actionfailed:true,actioncomplete:true});if(el){this.initEl(el);}Roo.form.BasicForm.superclass.constructor.call(this);
-};Roo.extend(Roo.form.BasicForm,Roo.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,waitMsgTarget:undefined,initEl:function(el){this.el=Roo.get(el);this.id=this.el.id||Roo.id();this.el.on("submit",this.onSubmit,this);this.el.addClass("x-form");
-},onSubmit:function(e){e.stopEvent();},isValid:function(){var A=true;this.items.each(function(f){if(!f.validate()){A=false;}});return A;},isDirty:function(){var A=false;this.items.each(function(f){if(f.isDirty()){A=true;return false;}});return A;},doAction:function(A,B){if(typeof A=="string"){A=new Roo.form.Action.ACTION_TYPES[A](this,B);
-}if(this.fireEvent("beforeaction",this,A)!==false){this.beforeAction(A);A.run.defer(100,A);}return this;},submit:function(A){this.doAction("submit",A);return this;},load:function(A){this.doAction("load",A);return this;},updateRecord:function(A){A.beginEdit();
-var fs=A.fields;fs.each(function(f){var B=this.findField(f.name);if(B){A.set(f.name,B.getValue());}},this);A.endEdit();return this;},loadRecord:function(A){this.setValues(A.data);return this;},beforeAction:function(A){var o=A.options;if(o.waitMsg){if(this.waitMsgTarget===true){this.el.mask(o.waitMsg,"x-mask-loading");
-}else if(this.waitMsgTarget){this.waitMsgTarget=Roo.get(this.waitMsgTarget);this.waitMsgTarget.mask(o.waitMsg,"x-mask-loading");}else{Roo.MessageBox.wait(o.waitMsg,o.waitTitle||this.waitTitle||"Please Wait...");}}},afterAction:function(A,B){this.activeAction=null;
-var o=A.options;if(o.waitMsg){if(this.waitMsgTarget===true){this.el.unmask();}else if(this.waitMsgTarget){this.waitMsgTarget.unmask();}else{Roo.MessageBox.updateProgress(1);Roo.MessageBox.hide();}}if(B){if(o.reset){this.reset();}Roo.callback(o.success,o.scope,[this,A]);
-this.fireEvent("actioncomplete",this,A);}else{Roo.callback(o.failure,o.scope,[this,A]);this.fireEvent("actionfailed",this,A);}},findField:function(id){var A=this.items.get(id);if(!A){this.items.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){A=f;
-return false;}});}return A||null;},markInvalid:function(C){if(C instanceof Array){for(var i=0,A=C.length;i<A;i++){var D=C[i];var f=this.findField(D.id);if(f){f.markInvalid(D.msg);}}}else{var B,id;for(id in C){if(typeof C[id]!="function"&&(B=this.findField(id))){B.markInvalid(C[id]);
-}}}return this;},setValues:function(C){if(C instanceof Array){for(var i=0,A=C.length;i<A;i++){var v=C[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var B,id;for(id in C){if(typeof C[id]!="function"&&(B=this.findField(id))){if(B.setFromData&&B.valueField&&B.displayField&&(B.store&&!B.store.isLocal)){var sd={};
-sd[B.valueField]=typeof (C[B.hiddenName])=="undefined"?"":C[B.hiddenName];sd[B.displayField]=typeof (C[B.name])=="undefined"?"":C[B.name];B.setFromData(sd);}else{B.setValue(C[id]);}if(this.trackResetOnLoad){B.originalValue=B.getValue();}}}}return this;},getValues:function(A){var fs=Roo.lib.Ajax.serializeForm(this.el.dom);
-if(A===true){return fs;}return Roo.urlDecode(fs);},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});return this;},reset:function(){this.items.each(function(f){f.reset();});return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));
-return this;},remove:function(A){this.items.remove(A);return this;},render:function(){this.items.each(function(f){if(f.isFormField&&!f.rendered&&document.getElementById(f.id)){f.applyTo(f.id);}});return this;},applyToFields:function(o){this.items.each(function(f){Roo.apply(f,o);
-});return this;},applyIfToFields:function(o){this.items.each(function(f){Roo.applyIf(f,o);});return this;}});Roo.BasicForm=Roo.form.BasicForm;
-Roo.form.Form=function(A){var B=[];if(A.items){B=A.items;delete A.items;}Roo.form.Form.superclass.constructor.call(this,null,A);this.url=this.url||this.action;if(!this.root){this.root=new Roo.form.Layout(Roo.applyIf({id:Roo.id()},A));}this.active=this.root;
-this.buttons=[];this.allItems=[];this.addEvents({clientvalidation:true,rendered:true});Roo.each(B,this.addxtype,this);};Roo.extend(Roo.form.Form,Roo.form.BasicForm,{buttonAlign:"center",minButtonWidth:75,labelAlign:"left",monitorValid:false,monitorPoll:200,column:function(c){var A=new Roo.form.Column(c);
-this.start(A);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return A;},fieldset:function(c){var fs=new Roo.form.FieldSet(c);this.start(fs);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));
-this.end();}return fs;},container:function(c){var l=new Roo.form.Layout(c);this.start(l);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return l;},start:function(c){Roo.applyIf(c,{"labelAlign":this.active.labelAlign,labelWidth:this.active.labelWidth,itemCls:this.active.itemCls});
-this.active.stack.push(c);c.ownerCt=this.active;this.active=c;return this;},end:function(){if(this.active==this.root){return this;}this.active=this.active.ownerCt;return this;},add:function(){this.active.stack.push.apply(this.active.stack,arguments);this.allItems.push.apply(this.allItems,arguments);
-var r=[];for(var i=0,a=arguments,A=a.length;i<A;i++){if(a[i].isFormField){r.push(a[i]);}}if(r.length>0){Roo.form.Form.superclass.add.apply(this,r);}return this;},findbyId:function(id){var A=false;if(!id){return A;}Ext.each(this.allItems,function(f){if(f.id==id||f.name==id){A=f;
-return false;}});return A;},render:function(ct){ct=Roo.get(ct);var o=this.autoCreate||{tag:"form",method:this.method||"POST",id:this.id||Roo.id()};this.initEl(ct.createChild(o));this.root.render(this.el);this.items.each(function(f){f.render("x-form-el-"+f.id);
-});if(this.buttons.length>0){var tb=this.el.createChild({cls:"x-form-btns-ct",cn:{cls:"x-form-btns x-form-btns-"+this.buttonAlign,html:"<table cellspacing=\"0\"><tbody><tr></tr></tbody></table><div class=\"x-clear\"></div>"}},null,true);var tr=tb.getElementsByTagName("tr")[0];
-for(var i=0,A=this.buttons.length;i<A;i++){var b=this.buttons[i];var td=document.createElement("td");td.className="x-form-btn-td";b.render(tr.appendChild(td));}}if(this.monitorValid){this.startMonitoring();}this.fireEvent("rendered",this);return this;},addButton:function(C,D,B){var bc={handler:D,scope:B,minWidth:this.minButtonWidth,hideParent:true};
-if(typeof C=="string"){bc.text=C;}else{Roo.apply(bc,C);}var A=new Roo.Button(null,bc);this.buttons.push(A);return A;},addxtype:function(){var ar=Array.prototype.slice.call(arguments,0);var A=false;for(var i=0;i<ar.length;i++){if(!ar[i]){continue;}if(Roo.form[ar[i].xtype]){ar[i].form=this;
-var fe=Roo.factory(ar[i],Roo.form);if(!A){A=fe;}fe.form=this;if(fe.store){fe.store.form=this;}if(fe.isLayout){this.start(fe);this.allItems.push(fe);if(fe.items&&fe.addxtype){fe.addxtype.apply(fe,fe.items);delete fe.items;}this.end();continue;}this.add(fe);
-}if(ar[i].xtype=="Button"){this.addButton(ar[i]);this.allItems.push(fe);continue;}if(ar[i].xtype=="end"){alert("end is not supported on xtype any more, use items");}}return A;},startMonitoring:function(){if(!this.bound){this.bound=true;Roo.TaskMgr.start({run:this.bindHandler,interval:this.monitorPoll||200,scope:this});
-}},stopMonitoring:function(){this.bound=false;},bindHandler:function(){if(!this.bound){return false;}var C=true;this.items.each(function(f){if(!f.isValid(true)){C=false;return false;}});for(var i=0,B=this.buttons.length;i<B;i++){var A=this.buttons[i];if(A.formBind===true&&A.disabled===C){A.setDisabled(!C);
-}}this.fireEvent("clientvalidation",this,C);}});Roo.Form=Roo.form.Form;
-Roo.form.Action=function(A,B){this.form=A;this.options=B||{};};Roo.form.Action.CLIENT_INVALID="client";Roo.form.Action.SERVER_INVALID="server";Roo.form.Action.CONNECT_FAILURE="connect";Roo.form.Action.LOAD_FAILURE="load";Roo.form.Action.prototype={type:"default",failureType:undefined,response:undefined,result:undefined,run:function(A){},success:function(A){},handleResponse:function(A){},failure:function(A){this.response=A;
-this.failureType=Roo.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);},processResponse:function(A){this.response=A;if(!A.responseText){return true;}this.result=this.handleResponse(A);return this.result;},getUrl:function(B){var A=this.options.url||this.form.url||this.form.el.dom.action;
-if(B){var p=this.getParams();if(p){A+=(A.indexOf("?")!=-1?"&":"?")+p;}}return A;},getMethod:function(){return (this.options.method||this.form.method||this.form.el.dom.method||"POST").toUpperCase();},getParams:function(){var bp=this.form.baseParams;var p=this.options.params;
-if(p){if(typeof p=="object"){p=Roo.urlEncode(Roo.applyIf(p,bp));}else if(typeof p=="string"&&bp){p+="&"+Roo.urlEncode(bp);}}else if(bp){p=Roo.urlEncode(bp);}return p;},createCallback:function(){return {success:this.success,failure:this.failure,scope:this,timeout:(this.form.timeout*1000),upload:this.form.fileUpload?this.success:undefined};
-}};Roo.form.Action.Submit=function(A,B){Roo.form.Action.Submit.superclass.constructor.call(this,A,B);};Roo.extend(Roo.form.Action.Submit,Roo.form.Action,{type:"submit",run:function(){var o=this.options;var B=this.getMethod();var A=B=="POST";if(o.clientValidation===false||this.form.isValid()){Roo.Ajax.request(Roo.apply(this.createCallback(),{form:this.form.el.dom,url:this.getUrl(!A),method:B,params:A?this.getParams():null,isUpload:this.form.fileUpload}));
-}else if(o.clientValidation!==false){this.failureType=Roo.form.Action.CLIENT_INVALID;this.form.afterAction(this,false);}},success:function(B){var A=this.processResponse(B);if(A===true||A.success){this.form.afterAction(this,true);return;}if(A.errors){this.form.markInvalid(A.errors);
-this.failureType=Roo.form.Action.SERVER_INVALID;}this.form.afterAction(this,false);},handleResponse:function(D){if(this.form.errorReader){var rs=this.form.errorReader.read(D);var C=[];if(rs.records){for(var i=0,A=rs.records.length;i<A;i++){var r=rs.records[i];
-C[i]=r.data;}}if(C.length<1){C=null;}return {success:rs.success,errors:C};}var B=false;try{B=Roo.decode(D.responseText);}catch(e){B={success:false,errorMsg:"Failed to read server message: "+D.responseText,errors:[]};}return B;}});Roo.form.Action.Load=function(A,B){Roo.form.Action.Load.superclass.constructor.call(this,A,B);
-this.reader=this.form.reader;};Roo.extend(Roo.form.Action.Load,Roo.form.Action,{type:"load",run:function(){Roo.Ajax.request(Roo.apply(this.createCallback(),{method:this.getMethod(),url:this.getUrl(false),params:this.getParams()}));},success:function(B){var A=this.processResponse(B);
-if(A===true||!A.success||!A.data){this.failureType=Roo.form.Action.LOAD_FAILURE;this.form.afterAction(this,false);return;}this.form.clearInvalid();this.form.setValues(A.data);this.form.afterAction(this,true);},handleResponse:function(B){if(this.form.reader){var rs=this.form.reader.read(B);
-var A=rs.records&&rs.records[0]?rs.records[0].data:null;return {success:rs.success,data:A};}return Roo.decode(B.responseText);}});Roo.form.Action.ACTION_TYPES={"load":Roo.form.Action.Load,submit:Roo.form.Action.Submit};
-Roo.form.Layout=function(A){var B=[];if(A.items){B=A.items;delete A.items;}Roo.form.Layout.superclass.constructor.call(this,A);this.stack=[];Roo.each(B,this.addxtype,this);};Roo.extend(Roo.form.Layout,Roo.Component,{clear:true,labelSeparator:":",hideLabels:false,defaultAutoCreate:{tag:"div",cls:"x-form-ct"},isLayout:true,onRender:function(ct,D){if(this.el){this.el=Roo.get(this.el);
-}else{var A=this.getAutoCreate();this.el=ct.createChild(A,D);}if(this.style){this.el.applyStyles(this.style);}if(this.labelAlign){this.el.addClass("x-form-label-"+this.labelAlign);}if(this.hideLabels){this.labelStyle="display:none";this.elementStyle="padding-left:0;";
-}else{if(typeof this.labelWidth=="number"){this.labelStyle="width:"+this.labelWidth+"px;";this.elementStyle="padding-left:"+((this.labelWidth+(typeof this.labelPad=="number"?this.labelPad:5))+"px")+";";}if(this.labelAlign=="top"){this.labelStyle="width:auto;";
-this.elementStyle="padding-left:0;";}}var C=this.stack;var B=C.length;if(B>0){if(!this.fieldTpl){var t=new Roo.Template("<div class=\"x-form-item {5}\">","<label for=\"{0}\" style=\"{2}\">{1}{4}</label>","<div class=\"x-form-element\" id=\"x-form-el-{0}\" style=\"{3}\">","</div>","</div><div class=\"x-form-clear-left\"></div>");
-t.disableFormats=true;t.compile();Roo.form.Layout.prototype.fieldTpl=t;}for(var i=0;i<B;i++){if(C[i].isFormField){this.renderField(C[i]);}else{this.renderComponent(C[i]);}}}if(this.clear){this.el.createChild({cls:"x-form-clear"});}},renderField:function(f){f.fieldEl=Roo.get(this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||"",this.elementStyle||"",typeof f.labelSeparator=="undefined"?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||""],true).getPrevSibling());
-},renderComponent:function(c){c.render(c.isLayout?this.el:this.el.createChild());},addxtype:function(o){o.form=this.form;var fe=Roo.factory(o,Roo.form);this.form.allItems.push(fe);this.stack.push(fe);if(fe.isFormField){this.form.items.add(fe);}return fe;}});
-Roo.form.Column=function(A){Roo.form.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Column,Roo.form.Layout,{defaultAutoCreate:{tag:"div",cls:"x-form-ct x-form-column"},onRender:function(ct,A){Roo.form.Column.superclass.onRender.call(this,ct,A);
-if(this.width){this.el.setWidth(this.width);}}});Roo.form.Row=function(A){Roo.form.Row.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Row,Roo.form.Layout,{defaultAutoCreate:{tag:"div",cls:"x-form-ct x-form-row"},padWidth:20,onRender:function(ct,A){if(!this.rowTpl){var t=new Roo.Template("<div class=\"x-form-item {5}\" style=\"float:left;width:{6}px\">","<label for=\"{0}\" style=\"{2}\">{1}{4}</label>","<div class=\"x-form-element\" id=\"x-form-el-{0}\" style=\"{3}\">","</div>","</div>");
-t.disableFormats=true;t.compile();Roo.form.Layout.prototype.rowTpl=t;}this.fieldTpl=this.rowTpl;var B=100;if((this.labelAlign!="top")){if(typeof this.labelWidth=="number"){B=this.labelWidth}this.padWidth=20+B;}Roo.form.Column.superclass.onRender.call(this,ct,A);
-if(this.width){this.el.setWidth(this.width);}if(this.height){this.el.setHeight(this.height);}},renderField:function(f){f.fieldEl=this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||"",this.elementStyle||"",typeof f.labelSeparator=="undefined"?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||"",f.width?f.width+this.padWidth:160+this.padWidth],true);
-}});Roo.form.FieldSet=function(A){Roo.form.FieldSet.superclass.constructor.call(this,A);};Roo.extend(Roo.form.FieldSet,Roo.form.Layout,{defaultAutoCreate:{tag:"fieldset",cn:{tag:"legend"}},onRender:function(ct,A){Roo.form.FieldSet.superclass.onRender.call(this,ct,A);
-if(this.legend){this.setLegend(this.legend);}},setLegend:function(A){if(this.rendered){this.el.child("legend").update(A);}}});
-Roo.form.VTypes=function(){var B=/^[a-zA-Z_]+$/;var D=/^[a-zA-Z0-9_]+$/;var C=/^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;var A=/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;return {"email":function(v){return C.test(v)},emailText:"This field should be an e-mail address in the format \"user@domain.com\"",emailMask:/[a-z0-9_\.\-@]/i,url:function(v){return A.test(v)},urlText:"This field should be a URL in the format \"http:/"+"/www.domain.com\"",alpha:function(v){return B.test(v)},alphaText:"This field should only contain letters and _",alphaMask:/[a-z_]/i,alphanum:function(v){return D.test(v)},alphanumText:"This field should only contain letters, numbers and _",alphanumMask:/[a-z0-9_]/i}}();
-Roo.form.FCKeditor=function(A){Roo.form.FCKeditor.superclass.constructor.call(this,A);this.addEvents({editorinit:true});};Roo.form.FCKeditor.editors={};Roo.extend(Roo.form.FCKeditor,Roo.form.TextArea,{fckconfig:false,toolbarSet:"Basic",basePath:"/fckeditor/",frame:false,value:"",onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"off"};
-}Roo.form.FCKeditor.superclass.onRender.call(this,ct,A);Roo.form.FCKeditor.editors[this.getId()]=this;this.replaceTextarea();},getEditor:function(){return this.fckEditor;},setValue:function(A){if(typeof (A)=="undefined"){return;}Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);
-if(!this.getEditor()){return;}this.getEditor().SetData(A);},getValue:function(){if(this.frame&&this.frame.dom.style.display=="none"){return Roo.form.FCKeditor.superclass.getValue.call(this);}if(!this.el||!this.getEditor()){return this.value;}var A=this.getEditor().GetData();
-Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getValue.call(this);},getRawValue:function(){if(this.frame&&this.frame.dom.style.display=="none"){return Roo.form.FCKeditor.superclass.getRawValue.call(this);}if(!this.el||!this.getEditor()){return this.value;
-return;}var A=this.getEditor().GetData();Roo.form.FCKeditor.superclass.setRawValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getRawValue.call(this);},setSize:function(w,h){Roo.form.FCKeditor.superclass.setSize.apply(this,[w,h]);this.frame.dom.setAttribute("width",w);
-this.frame.dom.setAttribute("height",h);this.frame.setSize(w,h);},toggleSourceEdit:function(A){this.el.dom.style.display=A?"":"none";this.frame.dom.style.display=A?"none":"";},focus:function(A){if(this.frame.dom.style.display=="none"){return Roo.form.FCKeditor.superclass.focus.call(this);
-}if(!this.el||!this.getEditor()){this.focus.defer(100,this,[A]);return;}var B=this.getEditor().EditorDocument.getElementsByTagName(A);this.getEditor().Focus();if(B.length){if(!this.getEditor().Selection.GetSelection()){this.focus.defer(100,this,[A]);return;
-}var r=this.getEditor().EditorDocument.createRange();r.setStart(B[0],0);r.setEnd(B[0],0);this.getEditor().Selection.GetSelection().removeAllRanges();this.getEditor().Selection.GetSelection().addRange(r);this.getEditor().Focus();}},replaceTextarea:function(){if(document.getElementById(this.getId()+"___Frame"))return;
-var A=document.getElementById(this.getId());var B=document.getElementsByName(this.getId());A.style.display="none";if(A.tabIndex){this.TabIndex=A.tabIndex;}this._insertHtmlBefore(this._getConfigHtml(),A);this._insertHtmlBefore(this._getIFrameHtml(),A);this.frame=Roo.get(this.getId()+"___Frame")},_getConfigHtml:function(){var A="";
-for(var o in this.fckconfig){A+=A.length>0?"&amp;":"";A+=encodeURIComponent(o)+"="+encodeURIComponent(this.fckconfig[o]);}return "<input type=\"hidden\" id=\""+this.getId()+"___Config\" value=\""+A+"\" style=\"display:none\" />";},_getIFrameHtml:function(){var B="fckeditor.html";
-var C=this.basePath+"editor/"+B+"?InstanceName="+encodeURIComponent(this.getId());C+=this.toolbarSet?("&amp;Toolbar="+this.toolbarSet):"";var A="<iframe id=\""+this.getId()+"___Frame\" src=\""+C+"\" width=\""+this.width+"\" height=\""+this.height+"\""+(this.tabIndex?" tabindex=\""+this.tabIndex+"\"":"")+" frameborder=\"0\" scrolling=\"no\"></iframe>";
-return A;},_insertHtmlBefore:function(A,C){if(C.insertAdjacentHTML){C.insertAdjacentHTML("beforeBegin",A);}else{var B=document.createRange();B.setStartBefore(C);var D=B.createContextualFragment(A);C.parentNode.insertBefore(D,C);}}});function FCKeditor_OnComplete(A){var f=Roo.form.FCKeditor.editors[A.Name];
-f.fckEditor=A;f.fireEvent("editorinit",f,A);}
-Roo.form.GridField=function(A){Roo.form.GridField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.GridField,Roo.form.Field,{width:100,height:50,xgrid:false,defaultAutoCreate:{tag:"input",type:"hidden",autocomplete:"off"},addTitle:false,onResize:function(){Roo.form.Field.superclass.onResize.apply(this,arguments);
-},initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,B){this.style=this.style||"overflow: hidden; border:1px solid #c3daf9;";var A=this.style;delete this.style;Roo.form.DisplayImage.superclass.onRender.call(this,ct,B);
-this.wrap=this.el.wrap({cls:""});this.viewEl=this.wrap.createChild({tag:"div"});if(A){this.viewEl.applyStyles(A);}if(this.width){this.viewEl.setWidth(this.width);}if(this.height){this.viewEl.setHeight(this.height);}this.grid=new Roo.grid[this.xgrid.xtype](this.viewEl,this.xgrid);
-this.grid.render();this.grid.getDataSource().on("remove",this.refreshValue,this);this.grid.getDataSource().on("update",this.refreshValue,this);this.grid.on("afteredit",this.refreshValue,this);},setValue:function(v){v=v||[];if(this.grid&&this.grid.getDataSource()&&typeof (v)!="undefined"){var ds=this.grid.getDataSource();
-var A={};A[ds.reader.meta.root]=typeof (v)=="string"?Roo.decode(v):v;ds.loadData(A);}Roo.form.GridField.superclass.setValue.call(this,v);this.refreshValue();},refreshValue:function(){var A=[];this.grid.getDataSource().each(function(r){A.push(r.data);});this.el.dom.value=Roo.encode(A);
-}});
-Roo.DDView=function(C,A,B){Roo.DDView.superclass.constructor.apply(this,arguments);this.getEl().setStyle("outline","0px none");this.getEl().unselectable();if(this.dragGroup){this.setDraggable(this.dragGroup.split(","));}if(this.dropGroup){this.setDroppable(this.dropGroup.split(","));
-}if(this.deletable){this.setDeletable();}this.isDirtyFlag=false;this.addEvents({"drop":true});};Roo.extend(Roo.DDView,Roo.View,{isFormField:true,reset:Roo.emptyFn,clearInvalid:Roo.form.Field.prototype.clearInvalid,validate:function(){return true;},destroy:function(){this.purgeListeners();
-this.getEl.removeAllListeners();this.getEl().remove();if(this.dragZone){if(this.dragZone.destroy){this.dragZone.destroy();}}if(this.dropZone){if(this.dropZone.destroy){this.dropZone.destroy();}}},getName:function(){return this.name;},setValue:function(v){if(!this.store){throw "DDView.setValue(). DDView must be constructed with a valid Store";
-}var A={};A[this.store.reader.meta.root]=v?[].concat(v):[];this.store.proxy=new Roo.data.MemoryProxy(A);this.store.load();},getValue:function(){var A="(";this.store.each(function(B){A+=B.id+",";});return A.substr(0,A.length-1)+")";},getIds:function(){var i=0,A=new Array(this.store.getCount());
-this.store.each(function(B){A[i++]=B.id;});return A;},isDirty:function(){return this.isDirtyFlag;},getTargetFromEvent:function(e){var A=e.getTarget();while((A!==null)&&(A.parentNode!=this.el.dom)){A=A.parentNode;}if(!A){A=this.el.dom.lastChild||this.el.dom;
-}return A;},getDragData:function(e){var C=this.findItemFromChild(e.getTarget());if(C){this.handleSelection(e);var E=this.getSelectedNodes();var D={source:this,copy:this.copy||(this.allowCopy&&e.ctrlKey),nodes:E,records:[]};var F=this.getSelectedIndexes();
-for(var i=0;i<F.length;i++){D.records.push(this.store.getAt(F[i]));}if(E.length==1){D.ddel=C.cloneNode(true);}else{var A=document.createElement("div");A.className="multi-proxy";for(var i=0,B=E.length;i<B;i++){A.appendChild(E[i].cloneNode(true));}D.ddel=A;
-}return D;}return false;},setDraggable:function(A){if(A instanceof Array){Roo.each(A,this.setDraggable,this);return;}if(this.dragZone){this.dragZone.addToGroup(A);}else{this.dragZone=new Roo.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:A});if(!this.multiSelect){this.singleSelect=true;
-}this.dragZone.getDragData=this.getDragData.createDelegate(this);}},setDroppable:function(A){if(A instanceof Array){Roo.each(A,this.setDroppable,this);return;}if(this.dropZone){this.dropZone.addToGroup(A);}else{this.dropZone=new Roo.dd.DropZone(this.getEl(),{containerScroll:true,ddGroup:A});
-this.dropZone.getTargetFromEvent=this.getTargetFromEvent.createDelegate(this);this.dropZone.onNodeEnter=this.onNodeEnter.createDelegate(this);this.dropZone.onNodeOver=this.onNodeOver.createDelegate(this);this.dropZone.onNodeOut=this.onNodeOut.createDelegate(this);
-this.dropZone.onNodeDrop=this.onNodeDrop.createDelegate(this);}},getDropPoint:function(e,n,dd){if(n==this.el.dom){return "above";}var t=Roo.lib.Dom.getY(n),b=t+n.offsetHeight;var c=t+(b-t)/2;var y=Roo.lib.Event.getPageY(e);if(y<=c){return "above";}else{return "below";
-}},onNodeEnter:function(n,dd,e,A){return false;},onNodeOver:function(n,dd,e,A){var pt=this.getDropPoint(e,n,dd);var B=this.dropNotAllowed;if(pt){var C;if(pt=="above"){B=n.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";C="x-view-drag-insert-above";
-}else{B=n.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";C="x-view-drag-insert-below";}if(this.lastInsertClass!=C){Roo.fly(n).replaceClass(this.lastInsertClass,C);this.lastInsertClass=C;}}return B;},onNodeOut:function(n,dd,e,A){this.removeDropIndicators(n);
-},onNodeDrop:function(n,dd,e,B){if(this.fireEvent("drop",this,n,dd,e,B)===false){return false;}var pt=this.getDropPoint(e,n,dd);var C=(n==this.el.dom)?this.nodes.length:n.nodeIndex;if(pt=="below"){C++;}for(var i=0;i<B.records.length;i++){var r=B.records[i];
-var A=this.store.getById(r.id);if(A&&(dd!=this.dragZone)){Roo.fly(this.getNode(this.store.indexOf(A))).frame("red",1);}else{if(B.copy){this.store.insert(C++,r.copy());}else{B.source.isDirtyFlag=true;r.store.remove(r);this.store.insert(C++,r);}this.isDirtyFlag=true;
-}}this.dragZone.cachedTarget=null;return true;},removeDropIndicators:function(n){if(n){Roo.fly(n).removeClass(["x-view-drag-insert-above","x-view-drag-insert-below"]);this.lastInsertClass="_noclass";}},setDeletable:function(A){if(!this.singleSelect&&!this.multiSelect){this.singleSelect=true;
-}var c=this.getContextMenu();this.contextMenu.on("itemclick",function(B){switch(B.id){case "delete":this.remove(this.getSelectedIndexes());break;}},this);this.contextMenu.add({icon:A,id:"delete",text:"Delete"});},getContextMenu:function(){if(!this.contextMenu){this.contextMenu=new Roo.menu.Menu({id:this.id+"-contextmenu"});
-this.el.on("contextmenu",this.showContextMenu,this);}return this.contextMenu;},disableContextMenu:function(){if(this.contextMenu){this.el.un("contextmenu",this.showContextMenu,this);}},showContextMenu:function(e,A){A=this.findItemFromChild(e.getTarget());
-if(A){e.stopEvent();this.select(this.getNode(A),this.multiSelect&&e.ctrlKey,true);this.contextMenu.showAt(e.getXY());}},remove:function(B){B=[].concat(B);for(var i=0;i<B.length;i++){var A=this.store.getAt(B[i]);this.store.remove(A);}},onDblClick:function(e){var B=this.findItemFromChild(e.getTarget());
-if(B){if(this.fireEvent("dblclick",this,this.indexOf(B),B,e)===false){return false;}if(this.dragGroup){var C=Roo.dd.DragDropMgr.getRelated(this.dragZone,true);while(C.indexOf(this.dropZone)>-1){C.remove(this.dropZone);}if(C.length==1){this.dragZone.cachedTarget=null;
-var el=Roo.get(C[0].getEl());var A=el.getBox(true);C[0].onNodeDrop(el.dom,{target:el.dom,xy:[A.x,A.y+A.height-1]},null,this.getDragData(e));}}}},handleSelection:function(e){this.dragZone.cachedTarget=null;var A=this.findItemFromChild(e.getTarget());if(!A){this.clearSelections(true);
-return;}if(A&&(this.multiSelect||this.singleSelect)){if(this.multiSelect&&e.shiftKey&&(!e.ctrlKey)&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),A.nodeIndex),false);}else if(this.isSelected(this.getNode(A))&&e.ctrlKey){this.unselect(A);
-}else{this.select(A,this.multiSelect&&e.ctrlKey);this.lastSelection=A;}}},onItemClick:function(A,B,e){if(this.fireEvent("beforeclick",this,B,A,e)===false){return false;}return true;},unselect:function(B,C){var A=this.getNode(B);if(A&&this.isSelected(A)){if(this.fireEvent("beforeselect",this,A,this.selections)!==false){Roo.fly(A).removeClass(this.selectedClass);
-this.selections.remove(A);if(!C){this.fireEvent("selectionchange",this,this.selections);}}}}});
-Roo.LayoutManager=function(B,A){Roo.LayoutManager.superclass.constructor.call(this);this.el=Roo.get(B);if(this.el.dom==document.body&&Roo.isIE&&!A.allowScroll){document.body.scroll="no"}else if(this.el.dom!=document.body&&this.el.getStyle("position")=="static"){this.el.position("relative")}this.id=this.el.id;this.el.addClass("x-layout-container");this.monitorWindowResize=true;this.regions={};this.addEvents({"layout":true,regionresized:true,regioncollapsed:true,regionexpanded:true});this.updating=false;Roo.EventManager.onWindowResize(this.onWindowResize,this,true)};Roo.extend(Roo.LayoutManager,Roo.util.Observable,{isUpdating:function(){return this.updating},beginUpdate:function(){this.updating=true},endUpdate:function(A){this.updating=false;if(!A){this.layout()}},layout:function(){},onRegionResized:function(A,B){this.fireEvent("regionresized",A,B);this.layout()},onRegionCollapsed:function(A){this.fireEvent("regioncollapsed",A)},onRegionExpanded:function(A){this.fireEvent("regionexpanded",A)},getViewSize:function(){var A;if(this.el.dom!=document.body){A=this.el.getSize()}else{A={width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()}}A.width-=this.el.getBorderWidth("lr")-this.el.getPadding("lr");A.height-=this.el.getBorderWidth("tb")-this.el.getPadding("tb");return A},getEl:function(){return this.el},getRegion:function(A){return this.regions[A.toLowerCase()]},onWindowResize:function(){if(this.monitorWindowResize){this.layout()}}});
-Roo.BorderLayout=function(D,B){B=B||{};Roo.BorderLayout.superclass.constructor.call(this,D,B);this.factory=B.factory||Roo.BorderLayout.RegionFactory;for(var i=0,A=this.factory.validRegions.length;i<A;i++){var C=this.factory.validRegions[i];if(B[C]){this.addRegion(C,B[C]);
-}}};Roo.extend(Roo.BorderLayout,Roo.LayoutManager,{addRegion:function(B,A){if(!this.regions[B]){var r=this.factory.create(B,this,A);this.bindRegion(B,r);}return this.regions[B];},bindRegion:function(A,r){this.regions[A]=r;r.on("visibilitychange",this.layout,this);
-r.on("paneladded",this.layout,this);r.on("panelremoved",this.layout,this);r.on("invalidated",this.layout,this);r.on("resized",this.onRegionResized,this);r.on("collapsed",this.onRegionCollapsed,this);r.on("expanded",this.onRegionExpanded,this);},layout:function(){if(this.updating)return;
-var B=this.getViewSize();var w=B.width;var h=B.height;var H=w;var G=h;var J=0;var I=0;var rs=this.regions;var D=rs["north"];var E=rs["south"];var C=rs["west"];var A=rs["east"];var F=rs["center"];if(D&&D.isVisible()){var b=D.getBox();var m=D.getMargins();b.width=w-(m.left+m.right);
-b.x=m.left;b.y=m.top;J=b.height+b.y+m.bottom;G-=J;D.updateBox(this.safeBox(b));}if(E&&E.isVisible()){var b=E.getBox();var m=E.getMargins();b.width=w-(m.left+m.right);b.x=m.left;var M=(b.height+m.top+m.bottom);b.y=h-M+m.top;G-=M;E.updateBox(this.safeBox(b));
-}if(C&&C.isVisible()){var b=C.getBox();var m=C.getMargins();b.height=G-(m.top+m.bottom);b.x=m.left;b.y=J+m.top;var L=(b.width+m.left+m.right);I+=L;H-=L;C.updateBox(this.safeBox(b));}if(A&&A.isVisible()){var b=A.getBox();var m=A.getMargins();b.height=G-(m.top+m.bottom);
-var L=(b.width+m.left+m.right);b.x=w-L+m.left;b.y=J+m.top;H-=L;A.updateBox(this.safeBox(b));}if(F){var m=F.getMargins();var K={x:I+m.left,y:J+m.top,width:H-(m.left+m.right),height:G-(m.top+m.bottom)};F.updateBox(this.safeBox(K));}this.el.repaint();this.fireEvent("layout",this);
-},safeBox:function(A){A.width=Math.max(0,A.width);A.height=Math.max(0,A.height);return A;},add:function(B,A){B=B.toLowerCase();return this.regions[B].add(A);},remove:function(B,A){B=B.toLowerCase();return this.regions[B].remove(A);},findPanel:function(B){var rs=this.regions;
-for(var A in rs){if(typeof rs[A]!="function"){var p=rs[A].getPanel(B);if(p){return p;}}}return null;},showPanel:function(B){var rs=this.regions;for(var A in rs){var r=rs[A];if(typeof r!="function"){if(r.hasPanel(B)){return r.showPanel(B);}}}return null;},restoreState:function(A){if(!A){A=Roo.state.Manager;
-}var sm=new Roo.LayoutStateManager();sm.init(this,A);},batchAdd:function(B){this.beginUpdate();for(var A in B){var lr=this.regions[A];if(lr){this.addTypedPanels(lr,B[A]);}}this.endUpdate();},addTypedPanels:function(lr,ps){if(typeof ps=="string"){lr.add(new Roo.ContentPanel(ps));
-}else if(ps instanceof Array){for(var i=0,A=ps.length;i<A;i++){this.addTypedPanels(lr,ps[i]);}}else if(!ps.events){var el=ps.el;delete ps.el;lr.add(new Roo.ContentPanel(el||Roo.id(),ps));}else{lr.add(ps);}},addxtype:function(A){if(!A.xtype.match(/Panel$/)){return false;
-}var B=false;var E=A.region;delete A.region;var F=[];if(A.items){F=A.items;delete A.items;}switch(A.xtype){case "ContentPanel":var el=this.el.createChild();B=new Roo[A.xtype](el,A);this.add(E,B);break;case "TreePanel":A.el=this.el.createChild();B=new Roo[A.xtype](A);
-this.add(E,B);break;case "NestedLayoutPanel":var el=this.el.createChild();var G=A.layout;delete A.layout;if(E=="center"&&this.active&&this.getRegion("center").panels.length<1){A.background=false;}var D=new Roo.BorderLayout(el,G);B=new Roo[A.xtype](D,A);this.add(E,B);
-break;case "GridPanel":var el=this.el.createChild();var C=new Roo.grid[A.grid.xtype](el,A.grid);delete A.grid;if(E=="center"&&this.active){A.background=false;}B=new Roo[A.xtype](C,A);this.add(E,B);if(A.background){B.on("activate",function(gp){if(!gp.grid.rendered){gp.grid.render();
-}});}else{C.render();}break;default:alert("Can not add '"+A.xtype+"' to BorderLayout");return;}this.beginUpdate();Roo.each(F,function(i){B.addxtype(i);});this.endUpdate();return B;}});Roo.BorderLayout.create=function(B,E){var C=new Roo.BorderLayout(E||document.body,B);
-C.beginUpdate();var D=Roo.BorderLayout.RegionFactory.validRegions;for(var j=0,A=D.length;j<A;j++){var lr=D[j];if(C.regions[lr]&&B[lr].panels){var r=C.regions[lr];var ps=B[lr].panels;C.addTypedPanels(r,ps);}}C.endUpdate();return C;};Roo.BorderLayout.RegionFactory={validRegions:["north","south","east","west","center"],create:function(C,A,B){C=C.toLowerCase();
-if(B.lightweight||B.basic){return new Roo.BasicLayoutRegion(A,B,C);}switch(C){case "north":return new Roo.NorthLayoutRegion(A,B);case "south":return new Roo.SouthLayoutRegion(A,B);case "east":return new Roo.EastLayoutRegion(A,B);case "west":return new Roo.WestLayoutRegion(A,B);
-case "center":return new Roo.CenterLayoutRegion(A,B);}throw "Layout region \""+C+"\" not supported.";}};
-Roo.BasicLayoutRegion=function(A,C,B,D){this.mgr=A;this.position=B;this.events={"beforeremove":true,invalidated:true,visibilitychange:true,paneladded:true,panelremoved:true,collapsed:true,expanded:true,slideshow:true,slidehide:true,panelactivated:true,resized:true};
-this.panels=new Roo.util.MixedCollection();this.panels.getKey=this.getPanelId.createDelegate(this);this.box=null;this.activePanel=null;if(C.listeners||C.events){Roo.BasicLayoutRegion.superclass.constructor.call(this,{listeners:C.listeners||{},events:C.events||{}});
-}if(D!==true){this.applyConfig(C);}};Roo.extend(Roo.BasicLayoutRegion,Roo.util.Observable,{getPanelId:function(p){return p.getId();},applyConfig:function(A){this.margins=A.margins||this.margins||{top:0,left:0,right:0,bottom:0};this.config=A;},resizeTo:function(A){var el=this.el?this.el:(this.activePanel?this.activePanel.getEl():null);
-if(el){switch(this.position){case "east":case "west":el.setWidth(A);this.fireEvent("resized",this,A);break;case "north":case "south":el.setHeight(A);this.fireEvent("resized",this,A);break;}}},getBox:function(){return this.activePanel?this.activePanel.getEl().getBox(false,true):null;
-},getMargins:function(){return this.margins;},updateBox:function(A){this.box=A;var el=this.activePanel.getEl();el.dom.style.left=A.x+"px";el.dom.style.top=A.y+"px";this.activePanel.setSize(A.width,A.height);},getEl:function(){return this.activePanel;},isVisible:function(){return this.activePanel?true:false;
-},setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);this.activePanel.getEl().setLeftTop(-10000,-10000);}this.activePanel=A;A.setActiveState(true);if(this.box){A.setSize(this.box.width,this.box.height);
-}this.fireEvent("panelactivated",this,A);this.fireEvent("invalidated");},showPanel:function(A){if(A=this.getPanel(A)){this.setActivePanel(A);}return A;},getActivePanel:function(){return this.activePanel;},add:function(B){if(arguments.length>1){for(var i=0,A=arguments.length;
-i<A;i++){this.add(arguments[i]);}return null;}if(this.hasPanel(B)){this.showPanel(B);return B;}var el=B.getEl();if(el.dom.parentNode!=this.mgr.el.dom){this.mgr.el.dom.appendChild(el.dom);}if(B.setRegion){B.setRegion(this);}this.panels.add(B);el.setStyle("position","absolute");
-if(!B.background){this.setActivePanel(B);if(this.config.initialSize&&this.panels.getCount()==1){this.resizeTo(this.config.initialSize);}}this.fireEvent("paneladded",this,B);return B;},hasPanel:function(A){if(typeof A=="object"){A=A.getId();}return this.getPanel(A)?true:false;
-},remove:function(A,C){A=this.getPanel(A);if(!A){return null;}var e={};this.fireEvent("beforeremove",this,A,e);if(e.cancel===true){return null;}var B=A.getId();this.panels.removeKey(B);return A;},getPanel:function(id){if(typeof id=="object"){return id;}return this.panels.get(id);
-},getPosition:function(){return this.position;}});
-Roo.LayoutRegion=function(A,C,B){Roo.LayoutRegion.superclass.constructor.call(this,A,C,B,true);var dh=Roo.DomHelper;this.el=dh.append(A.el.dom,{tag:"div",cls:"x-layout-panel x-layout-panel-"+this.position},true);this.titleEl=dh.append(this.el.dom,{tag:"div",unselectable:"on",cls:"x-unselectable x-layout-panel-hd x-layout-title-"+this.position,children:[{tag:"span",cls:"x-unselectable x-layout-panel-hd-text",unselectable:"on",html:"&#160;"},{tag:"div",cls:"x-unselectable x-layout-panel-hd-tools",unselectable:"on"}]},true);
-this.titleEl.enableDisplayMode();this.titleTextEl=this.titleEl.dom.firstChild;this.tools=Roo.get(this.titleEl.dom.childNodes[1],true);this.closeBtn=this.createTool(this.tools.dom,"x-layout-close");this.closeBtn.enableDisplayMode();this.closeBtn.on("click",this.closeClicked,this);
-this.closeBtn.hide();this.createBody(C);this.visible=true;this.collapsed=false;if(C.hideWhenEmpty){this.hide();this.on("paneladded",this.validateVisibility,this);this.on("panelremoved",this.validateVisibility,this);}this.applyConfig(C);};Roo.extend(Roo.LayoutRegion,Roo.BasicLayoutRegion,{createBody:function(){this.bodyEl=this.el.createChild({tag:"div",cls:"x-layout-panel-body"});
-},applyConfig:function(c){if(c.collapsible&&this.position!="center"&&!this.collapsedEl){var dh=Roo.DomHelper;if(c.titlebar!==false){this.collapseBtn=this.createTool(this.tools.dom,"x-layout-collapse-"+this.position);this.collapseBtn.on("click",this.collapse,this);
-this.collapseBtn.enableDisplayMode();if(c.showPin===true||this.showPin){this.stickBtn=this.createTool(this.tools.dom,"x-layout-stick");this.stickBtn.enableDisplayMode();this.stickBtn.on("click",this.expand,this);this.stickBtn.hide();}}this.collapsedEl=dh.append(this.mgr.el.dom,{cls:"x-layout-collapsed x-layout-collapsed-"+this.position,children:[{cls:"x-layout-collapsed-tools",children:[{cls:"x-layout-ctools-inner"}]}]},true);
-if(c.floatable!==false){this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.collapseClick,this);}if(c.collapsedTitle&&(this.position=="north"||this.position=="south")){this.collapsedTitleTextEl=dh.append(this.collapsedEl.dom,{tag:"div",cls:"x-unselectable x-layout-panel-hd-text",id:"message",unselectable:"on",style:{"float":"left"}});
-this.collapsedTitleTextEl.innerHTML=c.collapsedTitle;}this.expandBtn=this.createTool(this.collapsedEl.dom.firstChild.firstChild,"x-layout-expand-"+this.position);this.expandBtn.on("click",this.expand,this);}if(this.collapseBtn){this.collapseBtn.setVisible(c.collapsible==true);
-}this.cmargins=c.cmargins||this.cmargins||(this.position=="west"||this.position=="east"?{top:0,left:2,right:2,bottom:0}:{top:2,left:0,right:0,bottom:2});this.margins=c.margins||this.margins||{top:0,left:0,right:0,bottom:0};this.bottomTabs=c.tabPosition!="top";
-this.autoScroll=c.autoScroll||false;if(this.autoScroll){this.bodyEl.setStyle("overflow","auto");}else{this.bodyEl.setStyle("overflow","hidden");}if((!c.titlebar&&!c.title)||c.titlebar===false){this.titleEl.hide();}else{this.titleEl.show();if(c.title){this.titleTextEl.innerHTML=c.title;
-}}this.duration=c.duration||0.3;this.slideDuration=c.slideDuration||0.45;this.config=c;if(c.collapsed){this.collapse(true);}if(c.hidden){this.hide();}},isVisible:function(){return this.visible;},setCollapsedTitle:function(A){A=A||"&#160;";if(this.collapsedTitleTextEl){this.collapsedTitleTextEl.innerHTML=A;
-}},getBox:function(){var b;if(!this.collapsed){b=this.el.getBox(false,true);}else{b=this.collapsedEl.getBox(false,true);}return b;},getMargins:function(){return this.collapsed?this.cmargins:this.margins;},highlight:function(){this.el.addClass("x-layout-panel-dragover");
-},unhighlight:function(){this.el.removeClass("x-layout-panel-dragover");},updateBox:function(A){this.box=A;if(!this.collapsed){this.el.dom.style.left=A.x+"px";this.el.dom.style.top=A.y+"px";this.updateBody(A.width,A.height);}else{this.collapsedEl.dom.style.left=A.x+"px";
-this.collapsedEl.dom.style.top=A.y+"px";this.collapsedEl.setSize(A.width,A.height);}if(this.tabs){this.tabs.autoSizeTabs();}},updateBody:function(w,h){if(w!==null){this.el.setWidth(w);w-=this.el.getBorderWidth("rl");if(this.config.adjustments){w+=this.config.adjustments[0];
-}}if(h!==null){this.el.setHeight(h);h=this.titleEl&&this.titleEl.isDisplayed()?h-(this.titleEl.getHeight()||0):h;h-=this.el.getBorderWidth("tb");if(this.config.adjustments){h+=this.config.adjustments[1];}this.bodyEl.setHeight(h);if(this.tabs){h=this.tabs.syncHeight(h);
-}}if(this.panelSize){w=w!==null?w:this.panelSize.width;h=h!==null?h:this.panelSize.height;}if(this.activePanel){var el=this.activePanel.getEl();w=w!==null?w:el.getWidth();h=h!==null?h:el.getHeight();this.panelSize={width:w,height:h};this.activePanel.setSize(w,h);
-}if(Roo.isIE&&this.tabs){this.tabs.el.repaint();}},getEl:function(){return this.el;},hide:function(){if(!this.collapsed){this.el.dom.style.left="-2000px";this.el.hide();}else{this.collapsedEl.dom.style.left="-2000px";this.collapsedEl.hide();}this.visible=false;
-this.fireEvent("visibilitychange",this,false);},show:function(){if(!this.collapsed){this.el.show();}else{this.collapsedEl.show();}this.visible=true;this.fireEvent("visibilitychange",this,true);},closeClicked:function(){if(this.activePanel){this.remove(this.activePanel);
-}},collapseClick:function(e){if(this.isSlid){e.stopPropagation();this.slideIn();}else{e.stopPropagation();this.slideOut();}},collapse:function(A){if(this.collapsed)return;this.collapsed=true;if(this.split){this.split.el.hide();}if(this.config.animate&&A!==true){this.fireEvent("invalidated",this);
-this.animateCollapse();}else{this.el.setLocation(-20000,-20000);this.el.hide();this.collapsedEl.show();this.fireEvent("collapsed",this);this.fireEvent("invalidated",this);}},animateCollapse:function(){},expand:function(e,A){if(e)e.stopPropagation();if(!this.collapsed||this.el.hasActiveFx())return;
-if(this.isSlid){this.afterSlideIn();A=true;}this.collapsed=false;if(this.config.animate&&A!==true){this.animateExpand();}else{this.el.show();if(this.split){this.split.el.show();}this.collapsedEl.setLocation(-2000,-2000);this.collapsedEl.hide();this.fireEvent("invalidated",this);
-this.fireEvent("expanded",this);}},animateExpand:function(){},initTabs:function(){this.bodyEl.setStyle("overflow","hidden");var ts=new Roo.TabPanel(this.bodyEl.dom,{tabPosition:this.bottomTabs?"bottom":"top",disableTooltips:this.config.disableTabTips});if(this.config.hideTabs){ts.stripWrap.setDisplayed(false);
-}this.tabs=ts;ts.resizeTabs=this.config.resizeTabs===true;ts.minTabWidth=this.config.minTabWidth||40;ts.maxTabWidth=this.config.maxTabWidth||250;ts.preferredTabWidth=this.config.preferredTabWidth||150;ts.monitorResize=false;ts.bodyEl.setStyle("overflow",this.config.autoScroll?"auto":"hidden");
-ts.bodyEl.addClass("x-layout-tabs-body");this.panels.each(this.initPanelAsTab,this);},initPanelAsTab:function(A){var ti=this.tabs.addTab(A.getEl().id,A.getTitle(),null,this.config.closeOnTab&&A.isClosable());if(A.tabTip!==undefined){ti.setTooltip(A.tabTip);
-}ti.on("activate",function(){this.setActivePanel(A);},this);if(this.config.closeOnTab){ti.on("beforeclose",function(t,e){e.cancel=true;this.remove(A);},this);}return ti;},updatePanelTitle:function(A,B){if(this.activePanel==A){this.updateTitle(B);}if(this.tabs){var ti=this.tabs.getTab(A.getEl().id);
-ti.setText(B);if(A.tabTip!==undefined){ti.setTooltip(A.tabTip);}}},updateTitle:function(A){if(this.titleTextEl&&!this.config.title){this.titleTextEl.innerHTML=(typeof A!="undefined"&&A.length>0?A:"&#160;");}},setActivePanel:function(A){A=this.getPanel(A);
-if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);}this.activePanel=A;A.setActiveState(true);if(this.panelSize){A.setSize(this.panelSize.width,this.panelSize.height);}if(this.closeBtn){this.closeBtn.setVisible(!this.config.closeOnTab&&!this.isSlid&&A.isClosable());
-}this.updateTitle(A.getTitle());if(this.tabs){this.fireEvent("invalidated",this);}this.fireEvent("panelactivated",this,A);},showPanel:function(B){if(B=this.getPanel(B)){if(this.tabs){var A=this.tabs.getTab(B.getEl().id);if(A.isHidden()){this.tabs.unhideTab(A.id);
-}A.activate();}else{this.setActivePanel(B);}}return B;},getActivePanel:function(){return this.activePanel;},validateVisibility:function(){if(this.panels.getCount()<1){this.updateTitle("&#160;");this.closeBtn.hide();this.hide();}else{if(!this.isVisible()){this.show();
-}}},add:function(B){if(arguments.length>1){for(var i=0,A=arguments.length;i<A;i++){this.add(arguments[i]);}return null;}if(this.hasPanel(B)){this.showPanel(B);return B;}B.setRegion(this);this.panels.add(B);if(this.panels.getCount()==1&&!this.config.alwaysShowTabs){this.bodyEl.dom.appendChild(B.getEl().dom);
-if(B.background!==true){this.setActivePanel(B);}this.fireEvent("paneladded",this,B);return B;}if(!this.tabs){this.initTabs();}else{this.initPanelAsTab(B);}if(B.background!==true){this.tabs.activate(B.getEl().id);}this.fireEvent("paneladded",this,B);return B;
-},hidePanel:function(A){if(this.tabs&&(A=this.getPanel(A))){this.tabs.hideTab(A.getEl().id);}},unhidePanel:function(A){if(this.tabs&&(A=this.getPanel(A))){this.tabs.unhideTab(A.getEl().id);}},clearPanels:function(){while(this.panels.getCount()>0){this.remove(this.panels.first());
-}},remove:function(A,D){A=this.getPanel(A);if(!A){return null;}var e={};this.fireEvent("beforeremove",this,A,e);if(e.cancel===true){return null;}D=(typeof D!="undefined"?D:(this.config.preservePanels===true||A.preserve===true));var C=A.getId();this.panels.removeKey(C);
-if(D){document.body.appendChild(A.getEl().dom);}if(this.tabs){this.tabs.removeTab(A.getEl().id);}else if(!D){this.bodyEl.dom.removeChild(A.getEl().dom);}if(this.panels.getCount()==1&&this.tabs&&!this.config.alwaysShowTabs){var p=this.panels.first();var B=document.createElement("div");
-B.appendChild(p.getEl().dom);this.bodyEl.update("");this.bodyEl.dom.appendChild(p.getEl().dom);B=null;this.updateTitle(p.getTitle());this.tabs=null;this.bodyEl.setStyle("overflow",this.config.autoScroll?"auto":"hidden");this.setActivePanel(p);}A.setRegion(null);
-if(this.activePanel==A){this.activePanel=null;}if(this.config.autoDestroy!==false&&D!==true){try{A.destroy();}catch(e){}}this.fireEvent("panelremoved",this,A);return A;},getTabs:function(){return this.tabs;},createTool:function(B,C){var A=Roo.DomHelper.append(B,{tag:"div",cls:"x-layout-tools-button",children:[{tag:"div",cls:"x-layout-tools-button-inner "+C,html:"&#160;"}]},true);
-A.addClassOnOver("x-layout-tools-button-over");return A;}});
-Roo.SplitLayoutRegion=function(A,C,B,D){this.cursor=D;Roo.SplitLayoutRegion.superclass.constructor.call(this,A,C,B)};Roo.extend(Roo.SplitLayoutRegion,Roo.LayoutRegion,{splitTip:"Drag to resize.",collapsibleSplitTip:"Drag to resize. Double click to hide.",useSplitTips:false,applyConfig:function(A){Roo.SplitLayoutRegion.superclass.applyConfig.call(this,A);if(A.split){if(!this.split){var B=Roo.DomHelper.append(this.mgr.el.dom,{tag:"div",id:this.el.id+"-split",cls:"x-layout-split x-layout-split-"+this.position,html:"&#160;"});this.split=new Roo.SplitBar(B,this.el,this.orientation);this.split.on("moved",this.onSplitMove,this);this.split.useShim=A.useShim===true;this.split.getMaximumSize=this[this.position=="north"||this.position=="south"?"getVMaxSize":"getHMaxSize"].createDelegate(this);if(this.useSplitTips){this.split.el.dom.title=A.collapsible?this.collapsibleSplitTip:this.splitTip}if(A.collapsible){this.split.el.on("dblclick",this.collapse,this)}}if(typeof A.minSize!="undefined"){this.split.minSize=A.minSize}if(typeof A.maxSize!="undefined"){this.split.maxSize=A.maxSize}if(A.hideWhenEmpty||A.hidden||A.collapsed){this.hideSplitter()}}},getHMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");return Math.min(A,(this.el.getWidth()+B.getEl().getWidth())-B.getMinWidth())},getVMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");return Math.min(A,(this.el.getHeight()+B.getEl().getHeight())-B.getMinHeight())},onSplitMove:function(A,B){this.fireEvent("resized",this,B)},getSplitBar:function(){return this.split},hide:function(){this.hideSplitter();Roo.SplitLayoutRegion.superclass.hide.call(this)},hideSplitter:function(){if(this.split){this.split.el.setLocation(-2000,-2000);this.split.el.hide()}},show:function(){if(this.split){this.split.el.show()}Roo.SplitLayoutRegion.superclass.show.call(this)},beforeSlide:function(){if(Roo.isGecko){this.bodyEl.clip();if(this.tabs)this.tabs.bodyEl.clip();if(this.activePanel){this.activePanel.getEl().clip();if(this.activePanel.beforeSlide){this.activePanel.beforeSlide()}}}},afterSlide:function(){if(Roo.isGecko){this.bodyEl.unclip();if(this.tabs)this.tabs.bodyEl.unclip();if(this.activePanel){this.activePanel.getEl().unclip();if(this.activePanel.afterSlide){this.activePanel.afterSlide()}}}},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){var st=new Roo.util.DelayedTask(this.slideIn,this);this.autoHideHd={"mouseout":function(e){if(!e.within(this.el,true)){st.delay(500)}},mouseover:function(e){st.cancel()},scope:this}}this.el.on(this.autoHideHd)}},clearAutoHide:function(){if(this.autoHide!==false){this.el.un("mouseout",this.autoHideHd.mouseout);this.el.un("mouseover",this.autoHideHd.mouseover)}},clearMonitor:function(){Roo.get(document).un("click",this.slideInIf,this)},slideOut:function(){if(this.isSlid||this.el.hasActiveFx()){return}this.isSlid=true;if(this.collapseBtn){this.collapseBtn.hide()}this.closeBtnState=this.closeBtn.getStyle("display");this.closeBtn.hide();if(this.stickBtn){this.stickBtn.show()}this.el.show();this.el.alignTo(this.collapsedEl,this.getCollapseAnchor());this.beforeSlide();this.el.setStyle("z-index",10001);this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.afterSlide();this.initAutoHide();Roo.get(document).on("click",this.slideInIf,this);this.fireEvent("slideshow",this)},scope:this,block:true})},afterSlideIn:function(){this.clearAutoHide();this.isSlid=false;this.clearMonitor();this.el.setStyle("z-index","");if(this.collapseBtn){this.collapseBtn.show()}this.closeBtn.setStyle("display",this.closeBtnState);if(this.stickBtn){this.stickBtn.hide()}this.fireEvent("slidehide",this)},slideIn:function(cb){if(!this.isSlid||this.el.hasActiveFx()){Roo.callback(cb);return}this.isSlid=false;this.beforeSlide();this.el.slideOut(this.getSlideAnchor(),{callback:function(){this.el.setLeftTop(-10000,-10000);this.afterSlide();this.afterSlideIn();Roo.callback(cb)},scope:this,block:true})},slideInIf:function(e){if(!e.within(this.el)){this.slideIn()}},animateCollapse:function(){this.beforeSlide();this.el.setStyle("z-index",20000);var A=this.getSlideAnchor();this.el.slideOut(A,{callback:function(){this.el.setStyle("z-index","");this.collapsedEl.slideIn(A,{duration:0.3});this.afterSlide();this.el.setLocation(-10000,-10000);this.el.hide();this.fireEvent("collapsed",this)},scope:this,block:true})},animateExpand:function(){this.beforeSlide();this.el.alignTo(this.collapsedEl,this.getCollapseAnchor(),this.getExpandAdj());this.el.setStyle("z-index",20000);this.collapsedEl.hide({duration:0.1});this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.el.setStyle("z-index","");this.afterSlide();if(this.split){this.split.el.show()}this.fireEvent("invalidated",this);this.fireEvent("expanded",this)},scope:this,block:true})},anchors:{"west":"left",east:"right",north:"top",south:"bottom"},sanchors:{"west":"l",east:"r",north:"t",south:"b"},canchors:{"west":"tl-tr",east:"tr-tl",north:"tl-bl",south:"bl-tl"},getAnchor:function(){return this.anchors[this.position]},getCollapseAnchor:function(){return this.canchors[this.position]},getSlideAnchor:function(){return this.sanchors[this.position]},getAlignAdj:function(){var cm=this.cmargins;switch(this.position){case "west":return [0,0];break;case "east":return [0,0];break;case "north":return [0,0];break;case "south":return [0,0];break}},getExpandAdj:function(){var c=this.collapsedEl,cm=this.cmargins;switch(this.position){case "west":return [-(cm.right+c.getWidth()+cm.left),0];break;case "east":return [cm.right+c.getWidth()+cm.left,0];break;case "north":return [0,-(cm.top+cm.bottom+c.getHeight())];break;case "south":return [0,cm.top+cm.bottom+c.getHeight()];break}}});
-Roo.CenterLayoutRegion=function(A,B){Roo.LayoutRegion.call(this,A,B,"center");this.visible=true;this.minWidth=B.minWidth||20;this.minHeight=B.minHeight||20};Roo.extend(Roo.CenterLayoutRegion,Roo.LayoutRegion,{hide:function(){},show:function(){},getMinWidth:function(){return this.minWidth},getMinHeight:function(){return this.minHeight}});Roo.NorthLayoutRegion=function(A,C){Roo.LayoutRegion.call(this,A,C,"north","n-resize");if(this.split){this.split.placement=Roo.SplitBar.TOP;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v")}var B=C.initialSize||C.height;if(typeof B!="undefined"){this.el.setHeight(B)}};Roo.extend(Roo.NorthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox()}var A=this.el.getBox();if(this.split){A.height+=this.split.el.getHeight()}return A},updateBox:function(A){if(this.split&&!this.collapsed){A.height-=this.split.el.getHeight();this.split.el.setLeft(A.x);this.split.el.setTop(A.y+A.height);this.split.el.setWidth(A.width)}if(this.collapsed){this.updateBody(A.width,null)}Roo.LayoutRegion.prototype.updateBox.call(this,A)}});Roo.SouthLayoutRegion=function(A,C){Roo.SplitLayoutRegion.call(this,A,C,"south","s-resize");if(this.split){this.split.placement=Roo.SplitBar.BOTTOM;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v")}var B=C.initialSize||C.height;if(typeof B!="undefined"){this.el.setHeight(B)}};Roo.extend(Roo.SouthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox()}var A=this.el.getBox();if(this.split){var sh=this.split.el.getHeight();A.height+=sh;A.y-=sh}return A},updateBox:function(A){if(this.split&&!this.collapsed){var sh=this.split.el.getHeight();A.height-=sh;A.y+=sh;this.split.el.setLeft(A.x);this.split.el.setTop(A.y-sh);this.split.el.setWidth(A.width)}if(this.collapsed){this.updateBody(A.width,null)}Roo.LayoutRegion.prototype.updateBox.call(this,A)}});Roo.EastLayoutRegion=function(A,C){Roo.SplitLayoutRegion.call(this,A,C,"east","e-resize");if(this.split){this.split.placement=Roo.SplitBar.RIGHT;this.split.orientation=Roo.SplitBar.HORIZONTAL;this.split.el.addClass("x-layout-split-h")}var B=C.initialSize||C.width;if(typeof B!="undefined"){this.el.setWidth(B)}};Roo.extend(Roo.EastLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox()}var A=this.el.getBox();if(this.split){var sw=this.split.el.getWidth();A.width+=sw;A.x-=sw}return A},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x);this.split.el.setTop(A.y);this.split.el.setHeight(A.height);A.x+=sw}if(this.collapsed){this.updateBody(null,A.height)}Roo.LayoutRegion.prototype.updateBox.call(this,A)}});Roo.WestLayoutRegion=function(A,C){Roo.SplitLayoutRegion.call(this,A,C,"west","w-resize");if(this.split){this.split.placement=Roo.SplitBar.LEFT;this.split.orientation=Roo.SplitBar.HORIZONTAL;this.split.el.addClass("x-layout-split-h")}var B=C.initialSize||C.width;if(typeof B!="undefined"){this.el.setWidth(B)}};Roo.extend(Roo.WestLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox()}var A=this.el.getBox();if(this.split){A.width+=this.split.el.getWidth()}return A},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x+A.width);this.split.el.setTop(A.y);this.split.el.setHeight(A.height)}if(this.collapsed){this.updateBody(null,A.height)}Roo.LayoutRegion.prototype.updateBox.call(this,A)}});
-Roo.LayoutStateManager=function(A){this.state={north:{},south:{},east:{},west:{}}};Roo.LayoutStateManager.prototype={init:function(C,E){this.provider=E;var B=E.get(C.id+"-layout-state");if(B){var F=C.isUpdating();if(!F){C.beginUpdate()}for(var A in B){if(typeof B[A]!="function"){var D=B[A];var r=C.getRegion(A);if(r&&D){if(D.size){r.resizeTo(D.size)}if(D.collapsed==true){r.collapse(true)}else{r.expand(null,true)}}}}if(!F){C.endUpdate()}this.state=B}this.layout=C;C.on("regionresized",this.onRegionResized,this);C.on("regioncollapsed",this.onRegionCollapsed,this);C.on("regionexpanded",this.onRegionExpanded,this)},storeState:function(){this.provider.set(this.layout.id+"-layout-state",this.state)},onRegionResized:function(A,B){this.state[A.getPosition()].size=B;this.storeState()},onRegionCollapsed:function(A){this.state[A.getPosition()].collapsed=true;this.storeState()},onRegionExpanded:function(A){this.state[A.getPosition()].collapsed=false;this.storeState()}};
-Roo.ContentPanel=function(el,A,B){if(el.autoCreate){A=el;el=Roo.id();}this.el=Roo.get(el);if(!this.el&&A&&A.autoCreate){if(typeof A.autoCreate=="object"){if(!A.autoCreate.id){A.autoCreate.id=A.id||el;}this.el=Roo.DomHelper.append(document.body,A.autoCreate,true);
-}else{this.el=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-inactive-content",id:A.id||el},true);}}this.closable=false;this.loaded=false;this.active=false;if(typeof A=="string"){this.title=A;}else{Roo.apply(this,A);}if(this.toolbar&&!this.toolbar.el&&this.toolbar.xtype){this.wrapEl=this.el.wrap();
-this.toolbar=new Roo.Toolbar(this.el.insertSibling(false,"before"),[],this.toolbar);}if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl,true);}else{this.resizeEl=this.el;}this.addEvents({"activate":true,deactivate:true,resize:true});if(this.autoScroll){this.resizeEl.setStyle("overflow","auto");
-}B=B||this.content;if(B){this.setContent(B);}if(A&&A.url){this.setUrl(this.url,this.params,this.loadOnce);}Roo.ContentPanel.superclass.constructor.call(this);};Roo.extend(Roo.ContentPanel,Roo.util.Observable,{tabTip:"",setRegion:function(A){this.region=A;
-if(A){this.el.replaceClass("x-layout-inactive-content","x-layout-active-content");}else{this.el.replaceClass("x-layout-active-content","x-layout-inactive-content");}},getToolbar:function(){return this.toolbar;},setActiveState:function(A){this.active=A;if(!A){this.fireEvent("deactivate",this);
-}else{this.fireEvent("activate",this);}},setContent:function(A,B){this.el.update(A,B);},ignoreResize:function(w,h){if(this.lastSize&&this.lastSize.width==w&&this.lastSize.height==h){return true;}else{this.lastSize={width:w,height:h};return false;}},getUpdateManager:function(){return this.el.getUpdateManager();
-},load:function(){var um=this.el.getUpdateManager();um.update.apply(um,arguments);return this;},setUrl:function(A,B,C){if(this.refreshDelegate){this.removeListener("activate",this.refreshDelegate);}this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);
-this.on("activate",this.refreshDelegate);return this.el.getUpdateManager();},_handleRefresh:function(A,B,D){if(!D||!this.loaded){var C=this.el.getUpdateManager();C.update(A,B,this._setLoaded.createDelegate(this));}},_setLoaded:function(){this.loaded=true;
-},getId:function(){return this.el.id;},getEl:function(){return this.wrapEl||this.el;},adjustForComponents:function(A,B){if(this.resizeEl!=this.el){A-=this.el.getFrameWidth("lr");B-=this.el.getFrameWidth("tb");}if(this.toolbar){var te=this.toolbar.getEl();
-B-=te.getHeight();te.setWidth(A);}if(this.adjustments){A+=this.adjustments[0];B+=this.adjustments[1];}return {"width":A,height:B};},setSize:function(B,C){if(this.fitToFrame&&!this.ignoreResize(B,C)){if(this.fitContainer&&this.resizeEl!=this.el){this.el.setSize(B,C);
-}var A=this.adjustForComponents(B,C);this.resizeEl.setSize(this.autoWidth?"auto":A.width,this.autoHeight?"auto":A.height);this.fireEvent("resize",this,A.width,A.height);}},getTitle:function(){return this.title;},setTitle:function(A){this.title=A;if(this.region){this.region.updatePanelTitle(this,A);
-}},isClosable:function(){return this.closable;},beforeSlide:function(){this.el.clip();this.resizeEl.clip();},afterSlide:function(){this.el.unclip();this.resizeEl.unclip();},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();
-}},destroy:function(){this.el.removeAllListeners();var A=document.createElement("span");A.appendChild(this.el.dom);A.innerHTML="";this.el.remove();this.el=null;},addxtype:function(A){if(!A.xtype.match(/^Form$/)){return false;}var el=this.el.createChild();
-this.form=new Roo.form.Form(A);if(this.form.allItems.length)this.form.render(el.dom);return this.form;}});Roo.GridPanel=function(A,B){this.wrapper=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-grid-wrapper x-layout-inactive-content"},true);this.wrapper.dom.appendChild(A.getGridEl().dom);
-Roo.GridPanel.superclass.constructor.call(this,this.wrapper,B);if(this.toolbar){this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);}if(this.footer&&!this.footer.el&&this.footer.xtype){this.footer.container=this.grid.getView().getFooterPanel(true);this.footer.dataSource=this.grid.dataSource;
-this.footer=Roo.factory(this.footer,Roo);}A.monitorWindowResize=false;A.autoHeight=false;A.autoWidth=false;this.grid=A;this.grid.getGridEl().replaceClass("x-layout-inactive-content","x-layout-component-panel");};Roo.extend(Roo.GridPanel,Roo.ContentPanel,{getId:function(){return this.grid.id;
-},getGrid:function(){return this.grid;},setSize:function(C,D){if(!this.ignoreResize(C,D)){var A=this.grid;var B=this.adjustForComponents(C,D);A.getGridEl().setSize(B.width,B.height);A.autoSize();}},beforeSlide:function(){this.grid.getView().scroller.clip();
-},afterSlide:function(){this.grid.getView().scroller.unclip();},destroy:function(){this.grid.destroy();delete this.grid;Roo.GridPanel.superclass.destroy.call(this);}});Roo.NestedLayoutPanel=function(B,A){Roo.NestedLayoutPanel.superclass.constructor.call(this,B.getEl(),A);
-B.monitorWindowResize=false;this.layout=B;this.layout.getEl().addClass("x-layout-nested-layout");};Roo.extend(Roo.NestedLayoutPanel,Roo.ContentPanel,{setSize:function(C,D){if(!this.ignoreResize(C,D)){var A=this.adjustForComponents(C,D);var el=this.layout.getEl();
-el.setSize(A.width,A.height);var B=el.dom.offsetWidth;this.layout.layout();if(Roo.isIE&&!this.initialized){this.initialized=true;this.layout.layout();}}},setActiveState:function(B){this.active=B;if(!B){this.fireEvent("deactivate",this);return;}this.fireEvent("activate",this);
-if(!this.layout){return;}var A=false;for(var r in this.layout.regions){A=this.layout.getRegion(r);if(A.getActivePanel()){A.setActivePanel(A.getActivePanel());continue;}if(!A.panels.length){continue;}A.showPanel(A.getPanel(0));}},getLayout:function(){return this.layout;
-},addxtype:function(A){return this.layout.addxtype(A);}});Roo.ScrollPanel=function(el,C,D){C=C||{};C.fitToFrame=true;Roo.ScrollPanel.superclass.constructor.call(this,el,C,D);this.el.dom.style.overflow="hidden";var B=this.el.wrap({cls:"x-scroller x-layout-inactive-content"});
-this.el.removeClass("x-layout-inactive-content");this.el.on("mousewheel",this.onWheel,this);var up=B.createChild({cls:"x-scroller-up",html:"&#160;"},this.el.dom);var A=B.createChild({cls:"x-scroller-down",html:"&#160;"});up.unselectable();A.unselectable();
-up.on("click",this.scrollUp,this);A.on("click",this.scrollDown,this);up.addClassOnOver("x-scroller-btn-over");A.addClassOnOver("x-scroller-btn-over");up.addClassOnClick("x-scroller-btn-click");A.addClassOnClick("x-scroller-btn-click");this.adjustments=[0,-(up.getHeight()+A.getHeight())];
-this.resizeEl=this.el;this.el=B;this.up=up;this.down=A;};Roo.extend(Roo.ScrollPanel,Roo.ContentPanel,{increment:100,wheelIncrement:5,scrollUp:function(){this.resizeEl.scroll("up",this.increment,{callback:this.afterScroll,scope:this});},scrollDown:function(){this.resizeEl.scroll("down",this.increment,{callback:this.afterScroll,scope:this});
-},afterScroll:function(){var el=this.resizeEl;var t=el.dom.scrollTop,h=el.dom.scrollHeight,ch=el.dom.clientHeight;this.up[t==0?"addClass":"removeClass"]("x-scroller-btn-disabled");this.down[h-t<=ch?"addClass":"removeClass"]("x-scroller-btn-disabled");},setSize:function(){Roo.ScrollPanel.superclass.setSize.apply(this,arguments);
-this.afterScroll();},onWheel:function(e){var d=e.getWheelDelta();this.resizeEl.dom.scrollTop-=(d*this.wheelIncrement);this.afterScroll();e.stopEvent();},setContent:function(A,B){this.resizeEl.update(A,B);}});Roo.TreePanel=function(B){var el=B.el;var A=B.tree;
-delete B.tree;delete B.el;Roo.TreePanel.superclass.constructor.call(this,el,B);var C=el.createChild();this.tree=new Roo.tree.TreePanel(C,A);this.on("activate",function(){if(this.tree.rendered){return;}this.tree.render();});this.on("resize",function(cp,w,h){this.tree.innerCt.setWidth(w);
-this.tree.innerCt.setHeight(h);this.tree.innerCt.setStyle("overflow-y","auto");});};Roo.extend(Roo.TreePanel,Roo.ContentPanel);
-Roo.ReaderLayout=function(B,C){var c=B||{size:{}};Roo.ReaderLayout.superclass.constructor.call(this,C||document.body,{north:c.north!==false?Roo.apply({split:false,initialSize:32,titlebar:false},c.north):false,west:c.west!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:5,right:0,bottom:5,top:5},cmargins:{left:5,right:5,bottom:5,top:5}},c.west):false,east:c.east!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:0,right:5,bottom:5,top:5},cmargins:{left:5,right:5,bottom:5,top:5}},c.east):false,center:Roo.apply({tabPosition:"top",autoScroll:false,closeOnTab:true,titlebar:false,margins:{left:c.west!==false?0:5,right:c.east!==false?0:5,bottom:5,top:2}},c.center)});this.el.addClass("x-reader");this.beginUpdate();var A=new Roo.BorderLayout(Roo.get(document.body).createChild(),{south:c.preview!==false?Roo.apply({split:true,initialSize:200,minSize:100,autoScroll:true,collapsible:true,titlebar:true,cmargins:{top:5,left:0,right:0,bottom:0}},c.preview):false,center:Roo.apply({autoScroll:false,titlebar:false,minHeight:200},c.listView)});this.add("center",new Roo.NestedLayoutPanel(A,Roo.apply({title:c.mainTitle||"",tabTip:""},c.innerPanelCfg)));this.endUpdate();this.regions.preview=A.getRegion("south");this.regions.listView=A.getRegion("center")};Roo.extend(Roo.ReaderLayout,Roo.BorderLayout);
-Roo.grid.Grid=function(B,A){this.container=Roo.get(B);this.container.update("");this.container.setStyle("overflow","hidden");this.container.addClass("x-grid-container");this.id=this.container.id;Roo.apply(this,A);if(this.ds){this.dataSource=this.ds;delete this.ds;
-}if(this.cm){this.colModel=this.cm;delete this.cm;}if(this.sm){this.selModel=this.sm;delete this.sm;}if(this.selModel){this.selModel=Roo.factory(this.selModel,Roo.grid);}if(typeof (this.colModel.config)=="undefined"){this.colModel=new Roo.grid.ColumnModel(this.colModel);
-}if(this.dataSource){this.dataSource=Roo.factory(this.dataSource,Roo.data);}if(this.width){this.container.setWidth(this.width);}if(this.height){this.container.setHeight(this.height);}this.addEvents({"click":true,dblclick:true,contextmenu:true,mousedown:true,mouseup:true,mouseover:true,mouseout:true,keypress:true,keydown:true,cellclick:true,celldblclick:true,rowclick:true,rowdblclick:true,headerclick:true,headerdblclick:true,rowcontextmenu:true,cellcontextmenu:true,headercontextmenu:true,bodyscroll:true,columnresize:true,columnmove:true,startdrag:true,enddrag:true,dragdrop:true,dragover:true,dragenter:true,dragout:true,render:true});
-Roo.grid.Grid.superclass.constructor.call(this);};Roo.extend(Roo.grid.Grid,Roo.util.Observable,{minColumnWidth:25,autoSizeColumns:false,autoSizeHeaders:true,monitorWindowResize:true,maxRowsToMeasure:0,trackMouseOver:true,enableDragDrop:false,enableColumnMove:true,enableColumnHide:true,enableRowHeightSync:false,stripeRows:true,autoHeight:false,autoExpandColumn:false,autoExpandMin:50,autoExpandMax:1000,view:null,loadMask:false,rendered:false,render:function(){var c=this.container;
-if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){this.autoHeight=true;}var A=this.getView();A.init(this);c.on("click",this.onClick,this);c.on("dblclick",this.onDblClick,this);c.on("contextmenu",this.onContextMenu,this);c.on("keydown",this.onKeyDown,this);
-this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource},this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);
-this.toolbar=new Ext.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true);this.footer=Roo.factory(this.footer,Roo);}this.rendered=true;this.fireEvent("render",this);
-return this;},reconfigure:function(B,A){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:B},this.loadMask));}this.view.bind(B,A);this.dataSource=B;this.colModel=A;this.view.refresh(true);},onKeyDown:function(e){this.fireEvent("keydown",e);
-},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(C,e){this.fireEvent(C,e);
-var t=e.getTarget();var v=this.view;var D=v.findHeaderIndex(t);if(D!==false){this.fireEvent("header"+C,this,D,e);}else{var A=v.findRowIndex(t);var B=v.findCellIndex(t);if(A!==false){this.fireEvent("row"+C,this,A,e);if(B!==false){this.fireEvent("cell"+C,this,A,B,e);
-}}}},onClick:function(e){this.processEvent("click",e);},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);},walkCells:function(B,A,E,fn,G){var cm=this.colModel,C=cm.getColumnCount();var ds=this.dataSource,D=ds.getCount(),F=true;
-if(E<0){if(A<0){B--;F=false;}while(B>=0){if(!F){A=C-1;}F=false;while(A>=0){if(fn.call(G||this,B,A,cm)===true){return [B,A];}A--;}B--;}}else{if(A>=C){B++;F=false;}while(B<D){if(!F){A=0;}F=false;while(A<C){if(fn.call(G||this,B,A,cm)===true){return [B,A];}A++;
-}B++;}}return null;},getSelections:function(){return this.selModel.getSelections();},autoSize:function(){if(this.rendered){this.view.layout();if(this.view.adjustForScroll){this.view.adjustForScroll();}}},getGridEl:function(){return this.container;},stopEditing:function(){},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.grid.RowSelectionModel();
-}return this.selModel;},getDataSource:function(){return this.dataSource;},getColumnModel:function(){return this.colModel;},getView:function(){if(!this.view){this.view=new Roo.grid.GridView(this.viewConfig);}return this.view;},getDragDropText:function(){var A=this.selModel.getCount();
-return String.format(this.ddText,A,A==1?"":"s");}});Roo.grid.Grid.prototype.ddText="{0} selected row{1}";
-Roo.grid.AbstractGridView=function(){this.grid=null;this.events={"beforerowremoved":true,beforerowsinserted:true,beforerefresh:true,rowremoved:true,rowsinserted:true,rowupdated:true,refresh:true};Roo.grid.AbstractGridView.superclass.constructor.call(this)};Roo.extend(Roo.grid.AbstractGridView,Roo.util.Observable,{rowClass:"x-grid-row",cellClass:"x-grid-cell",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-hd-split",init:function(B){this.grid=B;var A=this.grid.getGridEl().id;this.colSelector="#"+A+" ."+this.cellClass+"-";this.tdSelector="#"+A+" ."+this.tdClass+"-";this.hdSelector="#"+A+" ."+this.hdClass+"-";this.splitSelector="#"+A+" ."+this.splitClass+"-"},getColumnRenderers:function(){var B=[];var cm=this.grid.colModel;var A=cm.getColumnCount();for(var i=0;i<A;i++){B[i]=cm.getRenderer(i)}return B},getColumnIds:function(){var A=[];var cm=this.grid.colModel;var B=cm.getColumnCount();for(var i=0;i<B;i++){A[i]=cm.getColumnId(i)}return A},getDataIndexes:function(){if(!this.indexMap){this.indexMap=this.buildIndexMap()}return this.indexMap.colToData},getColumnIndexByDataIndex:function(A){if(!this.indexMap){this.indexMap=this.buildIndexMap()}return this.indexMap.dataToCol[A]},setCSSStyle:function(C,A,B){var D="#"+this.grid.id+" .x-grid-col-"+C;Roo.util.CSS.updateRule(D,A,B)},generateRules:function(cm){var C=[],D=this.grid.id+"-cssrules";Roo.util.CSS.removeStyleSheet(D);for(var i=0,B=cm.getColumnCount();i<B;i++){var A=cm.getColumnId(i);C.push(this.colSelector,A," {\n",cm.config[i].css,"}\n",this.tdSelector,A," {\n}\n",this.hdSelector,A," {\n}\n",this.splitSelector,A," {\n}\n")}return Roo.util.CSS.createStyleSheet(C.join(""),D)}});
-Roo.grid.HeaderDragZone=function(B,hd,A){this.grid=B;this.view=B.getView();this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDragZone.superclass.constructor.call(this,hd);if(A){this.setHandleElId(Roo.id(hd));this.setOuterHandleElId(Roo.id(A))}this.scroll=false};Roo.extend(Roo.grid.HeaderDragZone,Roo.dd.DragZone,{maxDragWidth:120,getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var h=this.view.findHeaderCell(t);if(h){return {ddel:h.firstChild,header:h}}return false},onInitDrag:function(e){this.view.headersDisabled=true;var A=this.dragData.ddel.cloneNode(true);A.id=Roo.id();A.style.width=Math.min(this.dragData.header.offsetWidth,this.maxDragWidth)+"px";this.proxy.update(A);return true},afterValidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false},50)},afterInvalidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false},50)}});
-Roo.grid.HeaderDropZone=function(B,hd,A){this.grid=B;this.view=B.getView();this.proxyTop=Roo.DomHelper.append(document.body,{cls:"col-move-top",html:"&#160;"},true);this.proxyBottom=Roo.DomHelper.append(document.body,{cls:"col-move-bottom",html:"&#160;"},true);this.proxyTop.hide=this.proxyBottom.hide=function(){this.setLeftTop(-100,-100);this.setStyle("visibility","hidden")};this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDropZone.superclass.constructor.call(this,B.getGridEl().dom)};Roo.extend(Roo.grid.HeaderDropZone,Roo.dd.DropZone,{proxyOffsets:[-4,-9],fly:Roo.Element.fly,getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);var A=this.view.findCellIndex(t);if(A!==false){return this.view.getHeaderCell(A)}},nextVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.nextSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h}h=h.nextSibling}return null},prevVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.prevSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h}h=h.prevSibling}return null},positionIndicator:function(h,n,e){var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);var px,pt,py=r.top+this.proxyOffsets[1];if((r.right-x)<=(r.right-r.left)/2){px=r.right+this.view.borderWidth;pt="after"}else{px=r.left;pt="before"}var C=this.view.getCellIndex(h);var B=this.view.getCellIndex(n);if(this.grid.colModel.isFixed(B)){return false}var A=this.grid.colModel.isLocked(B);if(pt=="after"){B++}if(C<B){B--}if(C==B&&(A==this.grid.colModel.isLocked(C))){return false}px+=this.proxyOffsets[0];this.proxyTop.setLeftTop(px,py);this.proxyTop.show();if(!this.bottomOffset){this.bottomOffset=this.view.mainHd.getHeight()}this.proxyBottom.setLeftTop(px,py+this.proxyTop.dom.offsetHeight+this.bottomOffset);this.proxyBottom.show();return pt},onNodeEnter:function(n,dd,e,A){if(A.header!=n){this.positionIndicator(A.header,n,e)}},onNodeOver:function(n,dd,e,A){var B=false;if(A.header!=n){B=this.positionIndicator(A.header,n,e)}if(!B){this.proxyTop.hide();this.proxyBottom.hide()}return B?this.dropAllowed:this.dropNotAllowed},onNodeOut:function(n,dd,e,A){this.proxyTop.hide();this.proxyBottom.hide()},onNodeDrop:function(n,dd,e,A){var h=A.header;if(h!=n){var cm=this.grid.colModel;var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);var pt=(r.right-x)<=((r.right-r.left)/2)?"after":"before";var D=this.view.getCellIndex(h);var C=this.view.getCellIndex(n);var B=cm.isLocked(C);if(pt=="after"){C++}if(D<C){C--}if(D==C&&(B==cm.isLocked(D))){return false}cm.setLocked(D,B,true);cm.moveColumn(D,C);this.grid.fireEvent("columnmove",D,C);return true}return false}});
-Roo.grid.GridView=function(A){Roo.grid.GridView.superclass.constructor.call(this);this.el=null;Roo.apply(this,A);};Roo.extend(Roo.grid.GridView,Roo.grid.AbstractGridView,{rowClass:"x-grid-row",cellClass:"x-grid-col",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-split",sortClasses:["sort-asc","sort-desc"],enableMoveAnim:false,hlColor:"C3DAF9",dh:Roo.DomHelper,fly:Roo.Element.fly,css:Roo.util.CSS,borderWidth:1,splitOffset:3,scrollIncrement:22,cellRE:/(?:.*?)x-grid-(?:hd|cell|csplit)-(?:[\d]+)-([\d]+)(?:.*?)/,findRE:/\s?(?:x-grid-hd|x-grid-col|x-grid-csplit)\s/,bind:function(ds,cm){if(this.ds){this.ds.un("load",this.onLoad,this);
-this.ds.un("datachanged",this.onDataChange,this);this.ds.un("add",this.onAdd,this);this.ds.un("remove",this.onRemove,this);this.ds.un("update",this.onUpdate,this);this.ds.un("clear",this.onClear,this);}if(ds){ds.on("load",this.onLoad,this);ds.on("datachanged",this.onDataChange,this);
-ds.on("add",this.onAdd,this);ds.on("remove",this.onRemove,this);ds.on("update",this.onUpdate,this);ds.on("clear",this.onClear,this);}this.ds=ds;if(this.cm){this.cm.un("widthchange",this.onColWidthChange,this);this.cm.un("headerchange",this.onHeaderChange,this);
-this.cm.un("hiddenchange",this.onHiddenChange,this);this.cm.un("columnmoved",this.onColumnMove,this);this.cm.un("columnlockchange",this.onColumnLock,this);}if(cm){this.generateRules(cm);cm.on("widthchange",this.onColWidthChange,this);cm.on("headerchange",this.onHeaderChange,this);
-cm.on("hiddenchange",this.onHiddenChange,this);cm.on("columnmoved",this.onColumnMove,this);cm.on("columnlockchange",this.onColumnLock,this);}this.cm=cm;},init:function(A){Roo.grid.GridView.superclass.init.call(this,A);this.bind(A.dataSource,A.colModel);A.on("headerclick",this.handleHeaderClick,this);
-if(A.trackMouseOver){A.on("mouseover",this.onRowOver,this);A.on("mouseout",this.onRowOut,this);}A.cancelTextSelection=function(){};this.gridId=A.id;var B=this.templates||{};if(!B.master){B.master=new Roo.Template("<div class=\"x-grid\" hidefocus=\"true\">","<div class=\"x-grid-topbar\"></div>","<div class=\"x-grid-scroller\"><div></div></div>","<div class=\"x-grid-locked\">","<div class=\"x-grid-header\">{lockedHeader}</div>","<div class=\"x-grid-body\">{lockedBody}</div>","</div>","<div class=\"x-grid-viewport\">","<div class=\"x-grid-header\">{header}</div>","<div class=\"x-grid-body\">{body}</div>","</div>","<div class=\"x-grid-bottombar\"></div>","<a href=\"#\" class=\"x-grid-focus\" tabIndex=\"-1\"></a>","<div class=\"x-grid-resize-proxy\">&#160;</div>","</div>");
-B.master.disableformats=true;}if(!B.header){B.header=new Roo.Template("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">","<tbody><tr class=\"x-grid-hd-row\">{cells}</tr></tbody>","</table>{splits}");B.header.disableformats=true;}B.header.compile();
-if(!B.hcell){B.hcell=new Roo.Template("<td class=\"x-grid-hd x-grid-td-{id} {cellId}\"><div title=\"{title}\" class=\"x-grid-hd-inner x-grid-hd-{id}\">","<div class=\"x-grid-hd-text\" unselectable=\"on\">{value}<img class=\"x-grid-sort-icon\" src=\"",Roo.BLANK_IMAGE_URL,"\" /></div>","</div></td>");
-B.hcell.disableFormats=true;}B.hcell.compile();if(!B.hsplit){B.hsplit=new Roo.Template("<div class=\"x-grid-split {splitId} x-grid-split-{id}\" style=\"{style}\" unselectable=\"on\">&#160;</div>");B.hsplit.disableFormats=true;}B.hsplit.compile();if(!B.body){B.body=new Roo.Template("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">","<tbody>{rows}</tbody>","</table>");
-B.body.disableFormats=true;}B.body.compile();if(!B.row){B.row=new Roo.Template("<tr class=\"x-grid-row {alt}\">{cells}</tr>");B.row.disableFormats=true;}B.row.compile();if(!B.cell){B.cell=new Roo.Template("<td class=\"x-grid-col x-grid-td-{id} {cellId} {css}\" tabIndex=\"0\">","<div class=\"x-grid-col-{id} x-grid-cell-inner\"><div class=\"x-grid-cell-text\" unselectable=\"on\" {attr}>{value}</div></div>","</td>");
-B.cell.disableFormats=true;}B.cell.compile();this.templates=B;},onColWidthChange:function(){this.updateColumns.apply(this,arguments);},onHeaderChange:function(){this.updateHeaders.apply(this,arguments);},onHiddenChange:function(){this.handleHiddenChange.apply(this,arguments);
-},onColumnMove:function(){this.handleColumnMove.apply(this,arguments);},onColumnLock:function(){this.handleLockChange.apply(this,arguments);},onDataChange:function(){this.refresh();this.updateHeaderSortState();},onClear:function(){this.refresh();},onUpdate:function(ds,A){this.refreshRow(A);
-},refreshRow:function(B){var ds=this.ds,A;if(typeof B=="number"){A=B;B=ds.getAt(A);}else{A=ds.indexOf(B);}this.insertRows(ds,A,A,true);this.onRemove(ds,B,A+1,true);this.syncRowHeights(A,A);this.layout();this.fireEvent("rowupdated",this,A,B);},onAdd:function(ds,B,A){this.insertRows(ds,A,A+(B.length-1));
-},onRemove:function(ds,B,A,C){if(C!==true){this.fireEvent("beforerowremoved",this,A,B);}var bt=this.getBodyTable(),lt=this.getLockedTable();if(bt.rows[A]){bt.firstChild.removeChild(bt.rows[A]);}if(lt.rows[A]){lt.firstChild.removeChild(lt.rows[A]);}if(C!==true){this.stripeRows(A);
-this.syncRowHeights(A,A);this.layout();this.fireEvent("rowremoved",this,A,B);}},onLoad:function(){this.scrollToTop();},scrollToTop:function(){if(this.scroller){this.scroller.dom.scrollTop=0;this.syncScroll();}},getHeaderPanel:function(A){if(A){this.headerPanel.show();
-}return this.headerPanel;},getFooterPanel:function(A){if(A){this.footerPanel.show();}return this.footerPanel;},initElements:function(){var E=Roo.Element;var el=this.grid.getGridEl().dom.firstChild;var cs=el.childNodes;this.el=new E(el);this.headerPanel=new E(el.firstChild);
-this.headerPanel.enableDisplayMode("block");this.scroller=new E(cs[1]);this.scrollSizer=new E(this.scroller.dom.firstChild);this.lockedWrap=new E(cs[2]);this.lockedHd=new E(this.lockedWrap.dom.firstChild);this.lockedBody=new E(this.lockedWrap.dom.childNodes[1]);
-this.mainWrap=new E(cs[3]);this.mainHd=new E(this.mainWrap.dom.firstChild);this.mainBody=new E(this.mainWrap.dom.childNodes[1]);this.footerPanel=new E(cs[4]);this.footerPanel.enableDisplayMode("block");this.focusEl=new E(cs[5]);this.focusEl.swallowEvent("click",true);
-this.resizeProxy=new E(cs[6]);this.headerSelector=String.format("#{0} td.x-grid-hd, #{1} td.x-grid-hd",this.lockedHd.id,this.mainHd.id);this.splitterSelector=String.format("#{0} div.x-grid-split, #{1} div.x-grid-split",this.lockedHd.id,this.mainHd.id);},getHeaderCell:function(A){return Roo.DomQuery.select(this.headerSelector)[A];
-},getHeaderCellMeasure:function(A){return this.getHeaderCell(A).firstChild;},getHeaderCellText:function(A){return this.getHeaderCell(A).firstChild.firstChild;},getLockedTable:function(){return this.lockedBody.dom.firstChild;},getBodyTable:function(){return this.mainBody.dom.firstChild;
-},getLockedRow:function(A){return this.getLockedTable().rows[A];},getRow:function(A){return this.getBodyTable().rows[A];},getRowComposite:function(D){if(!this.rowEl){this.rowEl=new Roo.CompositeElementLite();}var A=[],B,C;if(B=this.getLockedRow(D)){A.push(B);
-}if(C=this.getRow(D)){A.push(C);}this.rowEl.elements=A;return this.rowEl;},getCell:function(D,C){var A=this.cm.getLockedCount();var B;if(C<A){B=this.lockedBody.dom.firstChild;}else{B=this.mainBody.dom.firstChild;C-=A;}return B.rows[D].childNodes[C];},getCellText:function(B,A){return this.getCell(B,A).firstChild.firstChild;
-},getCellBox:function(A){var b=this.fly(A).getBox();if(Roo.isOpera){b.y=A.offsetTop+this.mainBody.getY();}return b;},getCellIndex:function(A){var id=String(A.className).match(this.cellRE);if(id){return parseInt(id[1],10);}return 0;},findHeaderIndex:function(n){var r=Roo.fly(n).findParent("td."+this.hdClass,6);
-return r?this.getCellIndex(r):false;},findHeaderCell:function(n){var r=Roo.fly(n).findParent("td."+this.hdClass,6);return r?r:false;},findRowIndex:function(n){if(!n){return false;}var r=Roo.fly(n).findParent("tr."+this.rowClass,6);return r?r.rowIndex:false;
-},findCellIndex:function(A){var B=this.el.dom;while(A&&A!=B){if(this.findRE.test(A.className)){return this.getCellIndex(A);}A=A.parentNode;}return false;},getColumnId:function(A){return this.cm.getColumnId(A);},getSplitters:function(){if(this.splitterSelector){return Roo.DomQuery.select(this.splitterSelector);
-}else{return null;}},getSplitter:function(A){return this.getSplitters()[A];},onRowOver:function(e,t){var A;if((A=this.findRowIndex(t))!==false){this.getRowComposite(A).addClass("x-grid-row-over");}},onRowOut:function(e,t){var A;if((A=this.findRowIndex(t))!==false&&A!==this.findRowIndex(e.getRelatedTarget())){this.getRowComposite(A).removeClass("x-grid-row-over");
-}},renderHeaders:function(){var cm=this.cm;var ct=this.templates.hcell,ht=this.templates.header,st=this.templates.hsplit;var cb=[],lb=[],sb=[],B=[],p={};for(var i=0,A=cm.getColumnCount();i<A;i++){p.cellId="x-grid-hd-0-"+i;p.splitId="x-grid-csplit-0-"+i;p.id=cm.getColumnId(i);
-p.title=cm.getColumnTooltip(i)||"";p.value=cm.getColumnHeader(i)||"";p.style=(this.grid.enableColumnResize===false||!cm.isResizable(i)||cm.isFixed(i))?"cursor:default":"";if(!cm.isLocked(i)){cb[cb.length]=ct.apply(p);sb[sb.length]=st.apply(p);}else{lb[lb.length]=ct.apply(p);
-B[B.length]=st.apply(p);}}return [ht.apply({cells:lb.join(""),splits:B.join("")}),ht.apply({cells:cb.join(""),splits:sb.join("")})];},updateHeaders:function(){var A=this.renderHeaders();this.lockedHd.update(A[0]);this.mainHd.update(A[1]);},focusRow:function(A){var x=this.scroller.dom.scrollLeft;
-this.focusCell(A,0,false);this.scroller.dom.scrollLeft=x;},focusCell:function(B,A,C){var el=this.ensureVisible(B,A,C);this.focusEl.alignTo(el,"tl-tl");if(Roo.isGecko){this.focusEl.focus();}else{this.focusEl.focus.defer(1,this.focusEl);}},ensureVisible:function(B,A,K){if(typeof B!="number"){B=B.rowIndex;
-}if(B<0&&B>=this.ds.getCount()){return;}A=(A!==undefined?A:0);var cm=this.grid.colModel;while(cm.isHidden(A)){A++;}var el=this.getCell(B,A);if(!el){return;}var c=this.scroller.dom;var D=parseInt(el.offsetTop,10);var G=parseInt(el.offsetLeft,10);var C=D+el.offsetHeight;
-var I=G+el.offsetWidth;var ch=c.clientHeight-this.mainHd.dom.offsetHeight;var F=parseInt(c.scrollTop,10);var H=parseInt(c.scrollLeft,10);var E=F+ch;var J=H+c.clientWidth;if(D<F){c.scrollTop=D;}else if(C>E){c.scrollTop=C-ch;}if(K!==false){if(G<H){c.scrollLeft=G;
-}else if(I>J){c.scrollLeft=I-c.clientWidth;}}return el;},updateColumns:function(){this.grid.stopEditing();var cm=this.grid.colModel,C=this.getColumnIds();var B=0;for(var i=0,A=cm.getColumnCount();i<A;i++){var w=cm.getColumnWidth(i);this.css.updateRule(this.colSelector+C[i],"width",(w-this.borderWidth)+"px");
-this.css.updateRule(this.hdSelector+C[i],"width",(w-this.borderWidth)+"px");}this.updateSplitters();},generateRules:function(cm){var F=[],G=this.grid.id+"-cssrules";Roo.util.CSS.removeStyleSheet(G);for(var i=0,B=cm.getColumnCount();i<B;i++){var A=cm.getColumnId(i);
-var C="";if(cm.config[i].align){C="text-align:"+cm.config[i].align+";";}var E="";if(cm.isHidden(i)){E="display:none;";}var D="width:"+(cm.getColumnWidth(i)-this.borderWidth)+"px;";F.push(this.colSelector,A," {\n",cm.config[i].css,C,D,"\n}\n",this.hdSelector,A," {\n",C,D,"}\n",this.tdSelector,A," {\n",E,"\n}\n",this.splitSelector,A," {\n",E,"\n}\n");
-}return Roo.util.CSS.createStyleSheet(F.join(""),G);},updateSplitters:function(){var cm=this.cm,s=this.getSplitters();if(s){var B=0,C=true;for(var i=0,A=cm.getColumnCount();i<A;i++){if(cm.isHidden(i))continue;var w=cm.getColumnWidth(i);if(!cm.isLocked(i)&&C){B=0;
-C=false;}B+=w;s[i].style.left=(B-this.splitOffset)+"px";}}},handleHiddenChange:function(C,B,A){if(A){this.hideColumn(B);}else{this.unhideColumn(B);}},hideColumn:function(B){var A=this.getColumnId(B);this.css.updateRule(this.tdSelector+A,"display","none");
-this.css.updateRule(this.splitSelector+A,"display","none");if(Roo.isSafari){this.updateHeaders();}this.updateSplitters();this.layout();},unhideColumn:function(B){var A=this.getColumnId(B);this.css.updateRule(this.tdSelector+A,"display","");this.css.updateRule(this.splitSelector+A,"display","");
-if(Roo.isSafari){this.updateHeaders();}this.updateSplitters();this.layout();},insertRows:function(dm,C,B,D){if(C==0&&B==dm.getCount()-1){this.refresh();}else{if(!D){this.fireEvent("beforerowsinserted",this,C,B);}var s=this.getScrollState();var A=this.renderRows(C,B);
-this.bufferRows(A[0],this.getLockedTable(),C);this.bufferRows(A[1],this.getBodyTable(),C);this.restoreScroll(s);if(!D){this.fireEvent("rowsinserted",this,C,B);this.syncRowHeights(C,B);this.stripeRows(C);this.layout();}}},bufferRows:function(G,H,C){var F=null,E=H.rows,D=H.tBodies[0];
-if(C<E.length){F=E[C];}var b=document.createElement("div");b.innerHTML="<table><tbody>"+G+"</tbody></table>";var B=b.firstChild.rows;for(var i=0,A=B.length;i<A;i++){if(F){D.insertBefore(B[0],F);}else{D.appendChild(B[0]);}}b.innerHTML="";b=null;},deleteRows:function(dm,D,C){if(dm.getRowCount()<1){this.fireEvent("beforerefresh",this);
-this.mainBody.update("");this.lockedBody.update("");this.fireEvent("refresh",this);}else{this.fireEvent("beforerowsdeleted",this,D,C);var bt=this.getBodyTable();var B=bt.firstChild;var A=bt.rows;for(var E=D;E<=C;E++){B.removeChild(A[D]);}this.stripeRows(D);
-this.fireEvent("rowsdeleted",this,D,C);}},updateRows:function(C,B,A){var s=this.getScrollState();this.refresh();this.restoreScroll(s);},handleSort:function(C,D,A,B){if(!B){this.refresh();}this.updateHeaderSortState();},getScrollState:function(){var sb=this.scroller.dom;
-return {left:sb.scrollLeft,top:sb.scrollTop};},stripeRows:function(I){if(!this.grid.stripeRows||this.ds.getCount()<1){return;}I=I||0;var E=this.getBodyTable().rows;var G=this.getLockedTable().rows;var A=" x-grid-row-alt ";for(var i=I,B=E.length;i<B;i++){var C=E[i],D=G[i];
-var F=((i+1)%2==0);var H=(" "+C.className+" ").indexOf(A)!=-1;if(F==H){continue;}if(F){C.className+=" x-grid-row-alt";}else{C.className=C.className.replace("x-grid-row-alt","");}if(D){D.className=C.className;}}},restoreScroll:function(A){var sb=this.scroller.dom;
-sb.scrollLeft=A.left;sb.scrollTop=A.top;this.syncScroll();},syncScroll:function(){var sb=this.scroller.dom;var sh=this.mainHd.dom;var bs=this.mainBody.dom;var lv=this.lockedBody.dom;sh.scrollLeft=bs.scrollLeft=sb.scrollLeft;lv.scrollTop=bs.scrollTop=sb.scrollTop;
-},handleScroll:function(e){this.syncScroll();var sb=this.scroller.dom;this.grid.fireEvent("bodyscroll",sb.scrollLeft,sb.scrollTop);e.stopEvent();},handleWheel:function(e){var d=e.getWheelDelta();this.scroller.dom.scrollTop-=d*22;this.lockedBody.dom.scrollTop=this.mainBody.dom.scrollTop=this.scroller.dom.scrollTop;
-e.stopEvent();},renderRows:function(E,B){var g=this.grid,cm=g.colModel,ds=g.dataSource,C=g.stripeRows;var D=cm.getColumnCount();if(ds.getCount()<1){return ["",""];}var cs=[];for(var i=0;i<D;i++){var A=cm.getDataIndex(i);cs[i]={name:typeof A=="undefined"?ds.fields.get(i).name:A,renderer:cm.getRenderer(i),id:cm.getColumnId(i),locked:cm.isLocked(i)};
-}E=E||0;B=typeof B=="undefined"?ds.getCount()-1:B;var rs=ds.getRange(E,B);return this.doRender(cs,rs,ds,E,D,C);},doRender:Roo.isGecko?function(cs,rs,ds,J,H,G){var ts=this.templates,ct=ts.cell,rt=ts.row;var B="",E="",cb,C,c,p={},rp={},r,I;for(var j=0,D=rs.length;
-j<D;j++){r=rs[j];cb="";C="";I=(j+J);for(var i=0;i<H;i++){c=cs[i];p.cellId="x-grid-cell-"+I+"-"+i;p.id=c.id;p.css=p.attr="";p.value=c.renderer(r.data[c.name],p,r,I,i,ds);if(p.value==undefined||p.value==="")p.value="&#160;";if(r.dirty&&typeof r.modified[c.name]!=="undefined"){p.css+=p.css?" x-grid-dirty-cell":"x-grid-dirty-cell";
-}var F=ct.apply(p);if(!c.locked){cb+=F;}else{C+=F;}}var A=[];if(G&&((I+1)%2==0)){A[0]="x-grid-row-alt";}if(r.dirty){A[1]=" x-grid-dirty-row";}rp.cells=C;if(this.getRowClass){A[2]=this.getRowClass(r,I);}rp.alt=A.join(" ");E+=rt.apply(rp);rp.cells=cb;B+=rt.apply(rp);
-}return [E,B];}:function(cs,rs,ds,J,H,G){var ts=this.templates,ct=ts.cell,rt=ts.row;var B=[],E=[],cb,C,c,p={},rp={},r,I;for(var j=0,D=rs.length;j<D;j++){r=rs[j];cb=[];C=[];I=(j+J);for(var i=0;i<H;i++){c=cs[i];p.cellId="x-grid-cell-"+I+"-"+i;p.id=c.id;p.css=p.attr="";
-p.value=c.renderer(r.data[c.name],p,r,I,i,ds);if(p.value==undefined||p.value==="")p.value="&#160;";if(r.dirty&&typeof r.modified[c.name]!=="undefined"){p.css+=p.css?" x-grid-dirty-cell":"x-grid-dirty-cell";}var F=ct.apply(p);if(!c.locked){cb[cb.length]=F;
-}else{C[C.length]=F;}}var A=[];if(G&&((I+1)%2==0)){A[0]="x-grid-row-alt";}if(r.dirty){A[1]=" x-grid-dirty-row";}rp.cells=C;if(this.getRowClass){A[2]=this.getRowClass(r,I);}rp.alt=A.join(" ");rp.cells=C.join("");E[E.length]=rt.apply(rp);rp.cells=cb.join("");
-B[B.length]=rt.apply(rp);}return [E.join(""),B.join("")];},renderBody:function(){var A=this.renderRows();var bt=this.templates.body;return [bt.apply({rows:A[0]}),bt.apply({rows:A[1]})];},refresh:function(B){this.fireEvent("beforerefresh",this);this.grid.stopEditing();
-var A=this.renderBody();this.lockedBody.update(A[0]);this.mainBody.update(A[1]);if(B===true){this.updateHeaders();this.updateColumns();this.updateSplitters();this.updateHeaderSortState();}this.syncRowHeights();this.layout();this.fireEvent("refresh",this);
-},handleColumnMove:function(cm,B,A){this.indexMap=null;var s=this.getScrollState();this.refresh(true);this.restoreScroll(s);this.afterMove(A);},afterMove:function(A){if(this.enableMoveAnim&&Roo.enableFx){this.fly(this.getHeaderCell(A).firstChild).highlight(this.hlColor);
-}},updateCell:function(dm,F,G){var D=this.getColumnIndexByDataIndex(G);if(typeof D=="undefined"){return;}var cm=this.grid.colModel;var B=this.getCell(F,D);var C=this.getCellText(F,D);var p={cellId:"x-grid-cell-"+F+"-"+D,id:cm.getColumnId(D),css:D==cm.getColumnCount()-1?"x-grid-col-last":""};
-var E=cm.getRenderer(D);var A=E(dm.getValueAt(F,G),p,F,D,dm);if(typeof A=="undefined"||A==="")A="&#160;";C.innerHTML=A;B.className=this.cellClass+" "+p.cellId+" "+p.css;this.syncRowHeights(F,F);},calcColumnWidth:function(D,G){var E=0;if(this.grid.autoSizeHeaders){var h=this.getHeaderCellMeasure(D);
-E=Math.max(E,h.scrollWidth);}var tb,C;if(this.cm.isLocked(D)){tb=this.getLockedTable();C=D;}else{tb=this.getBodyTable();C=D-this.cm.getLockedCount();}if(tb&&tb.rows){var B=tb.rows;var F=Math.min(G||B.length,B.length);for(var i=0;i<F;i++){var A=B[i].childNodes[C].firstChild;
-E=Math.max(E,A.scrollWidth);}}return E+5;},autoSizeColumn:function(B,D,E){if(this.cm.isHidden(B)){return;}if(D){var A=this.cm.getColumnId(B);this.css.updateRule(this.colSelector+A,"width",this.grid.minColumnWidth+"px");if(this.grid.autoSizeHeaders){this.css.updateRule(this.hdSelector+A,"width",this.grid.minColumnWidth+"px");
-}}var C=this.calcColumnWidth(B);this.cm.setColumnWidth(B,Math.max(this.grid.minColumnWidth,C),E);if(!E){this.grid.fireEvent("columnresize",B,C);}},autoSizeColumns:function(){var cm=this.grid.colModel;var A=cm.getColumnCount();for(var i=0;i<A;i++){this.autoSizeColumn(i,true,true);
-}if(cm.getTotalWidth()<this.scroller.dom.clientWidth){this.fitColumns();}else{this.updateColumns();this.layout();}},fitColumns:function(F){var cm=this.grid.colModel;var E=cm.getColumnCount();var A=[];var D=0;var i,w;for(i=0;i<E;i++){if(!cm.isHidden(i)&&!cm.isFixed(i)){w=cm.getColumnWidth(i);
-A.push(i);A.push(w);D+=w;}}var C=Math.min(this.scroller.dom.clientWidth,this.el.getWidth());if(F){C-=17;}var B=(C-cm.getTotalWidth())/D;while(A.length){w=A.pop();i=A.pop();cm.setColumnWidth(i,Math.floor(w+w*B),true);}this.updateColumns();this.layout();},onRowSelect:function(B){var A=this.getRowComposite(B);
-A.addClass("x-grid-row-selected");},onRowDeselect:function(B){var A=this.getRowComposite(B);A.removeClass("x-grid-row-selected");},onCellSelect:function(B,A){var C=this.getCell(B,A);if(C){Roo.fly(C).addClass("x-grid-cell-selected");}},onCellDeselect:function(B,A){var C=this.getCell(B,A);
-if(C){Roo.fly(C).removeClass("x-grid-cell-selected");}},updateHeaderSortState:function(){var B=this.ds.getSortState();if(!B){return;}this.sortState=B;var D=this.cm.findColumnIndex(B.field);if(D!=-1){var C=B.direction;var sc=this.sortClasses;var A=this.el.select(this.headerSelector).removeClass(sc);
-A.item(D).addClass(sc[C=="DESC"?1:0]);}},handleHeaderClick:function(g,A){if(this.headersDisabled){return;}var dm=g.dataSource,cm=g.colModel;if(!cm.isSortable(A)){return;}g.stopEditing();dm.sort(cm.getDataIndex(A));},destroy:function(){if(this.colMenu){this.colMenu.removeAll();
-Roo.menu.MenuMgr.unregister(this.colMenu);this.colMenu.getEl().remove();delete this.colMenu;}if(this.hmenu){this.hmenu.removeAll();Roo.menu.MenuMgr.unregister(this.hmenu);this.hmenu.getEl().remove();delete this.hmenu;}if(this.grid.enableColumnMove){var A=Roo.dd.DDM.ids["gridHeader"+this.grid.getGridEl().id];
-if(A){for(var dd in A){if(!A[dd].config.isTarget&&A[dd].dragElId){var B=A[dd].dragElId;A[dd].unreg();Roo.get(B).remove();}else if(A[dd].config.isTarget){A[dd].proxyTop.remove();A[dd].proxyBottom.remove();A[dd].unreg();}if(Roo.dd.DDM.locationCache[dd]){delete Roo.dd.DDM.locationCache[dd];
-}}delete Roo.dd.DDM.ids["gridHeader"+this.grid.getGridEl().id];}}Roo.util.CSS.removeStyleSheet(this.grid.id+"-cssrules");this.bind(null,null);Roo.EventManager.removeResizeListener(this.onWindowResize,this);},handleLockChange:function(){this.refresh(true);
-},onDenyColumnLock:function(){},onDenyColumnHide:function(){},handleHdMenuClick:function(A){var B=this.hdCtxIndex;var cm=this.cm,ds=this.ds;switch(A.id){case "asc":ds.sort(cm.getDataIndex(B),"ASC");break;case "desc":ds.sort(cm.getDataIndex(B),"DESC");break;
-case "lock":var lc=cm.getLockedCount();if(cm.getColumnCount(true)<=lc+1){this.onDenyColumnLock();return;}if(lc!=B){cm.setLocked(B,true,true);cm.moveColumn(B,lc);this.grid.fireEvent("columnmove",B,lc);}else{cm.setLocked(B,true);}break;case "unlock":var lc=cm.getLockedCount();
-if((lc-1)!=B){cm.setLocked(B,false,true);cm.moveColumn(B,lc-1);this.grid.fireEvent("columnmove",B,lc-1);}else{cm.setLocked(B,false);}break;default:B=cm.getIndexById(A.id.substr(4));if(B!=-1){if(A.checked&&cm.getColumnCount(true)<=1){this.onDenyColumnHide();
-return false;}cm.setHidden(B,A.checked);}}return true;},beforeColMenuShow:function(){var cm=this.cm,A=cm.getColumnCount();this.colMenu.removeAll();for(var i=0;i<A;i++){this.colMenu.add(new Roo.menu.CheckItem({id:"col-"+cm.getColumnId(i),text:cm.getColumnHeader(i),checked:!cm.isHidden(i),hideOnClick:false}));
-}},handleHdCtx:function(g,A,e){e.stopEvent();var hd=this.getHeaderCell(A);this.hdCtxIndex=A;var ms=this.hmenu.items,cm=this.cm;ms.get("asc").setDisabled(!cm.isSortable(A));ms.get("desc").setDisabled(!cm.isSortable(A));if(this.grid.enableColLock!==false){ms.get("lock").setDisabled(cm.isLocked(A));
-ms.get("unlock").setDisabled(!cm.isLocked(A));}this.hmenu.show(hd,"tl-bl");},handleHdOver:function(e){var hd=this.findHeaderCell(e.getTarget());if(hd&&!this.headersDisabled){if(this.grid.colModel.isSortable(this.getCellIndex(hd))){this.fly(hd).addClass("x-grid-hd-over");
-}}},handleHdOut:function(e){var hd=this.findHeaderCell(e.getTarget());if(hd){this.fly(hd).removeClass("x-grid-hd-over");}},handleSplitDblClick:function(e,t){var i=this.getCellIndex(t);if(this.grid.enableColumnResize!==false&&this.cm.isResizable(i)&&!this.cm.isFixed(i)){this.autoSizeColumn(i,true);
-this.layout();}},render:function(){var cm=this.cm;var D=cm.getColumnCount();if(this.grid.monitorWindowResize===true){Roo.EventManager.onWindowResize(this.onWindowResize,this,true);}var C=this.renderHeaders();var A=this.templates.body.apply({rows:""});var B=this.templates.master.apply({lockedBody:A,body:A,lockedHeader:C[0],header:C[1]});
-this.grid.getGridEl().dom.innerHTML=B;this.initElements();this.scroller.on("scroll",this.handleScroll,this);this.lockedBody.on("mousewheel",this.handleWheel,this);this.mainBody.on("mousewheel",this.handleWheel,this);this.mainHd.on("mouseover",this.handleHdOver,this);
-this.mainHd.on("mouseout",this.handleHdOut,this);this.mainHd.on("dblclick",this.handleSplitDblClick,this,{delegate:"."+this.splitClass});this.lockedHd.on("mouseover",this.handleHdOver,this);this.lockedHd.on("mouseout",this.handleHdOut,this);this.lockedHd.on("dblclick",this.handleSplitDblClick,this,{delegate:"."+this.splitClass});
-if(this.grid.enableColumnResize!==false&&Roo.grid.SplitDragZone){new Roo.grid.SplitDragZone(this.grid,this.lockedHd.dom,this.mainHd.dom);}this.updateSplitters();if(this.grid.enableColumnMove&&Roo.grid.HeaderDragZone){new Roo.grid.HeaderDragZone(this.grid,this.lockedHd.dom,this.mainHd.dom);
-new Roo.grid.HeaderDropZone(this.grid,this.lockedHd.dom,this.mainHd.dom);}if(this.grid.enableCtxMenu!==false&&Roo.menu.Menu){this.hmenu=new Roo.menu.Menu({id:this.grid.id+"-hctx"});this.hmenu.add({id:"asc",text:this.sortAscText,cls:"xg-hmenu-sort-asc"},{id:"desc",text:this.sortDescText,cls:"xg-hmenu-sort-desc"});
-if(this.grid.enableColLock!==false){this.hmenu.add("-",{id:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{id:"unlock",text:this.unlockText,cls:"xg-hmenu-unlock"});}if(this.grid.enableColumnHide!==false){this.colMenu=new Roo.menu.Menu({id:this.grid.id+"-hcols-menu"});
-this.colMenu.on("beforeshow",this.beforeColMenuShow,this);this.colMenu.on("itemclick",this.handleHdMenuClick,this);this.hmenu.add("-",{id:"columns",text:this.columnsText,menu:this.colMenu});}this.hmenu.on("itemclick",this.handleHdMenuClick,this);this.grid.on("headercontextmenu",this.handleHdCtx,this);
-}if((this.grid.enableDragDrop||this.grid.enableDrag)&&Roo.grid.GridDragZone){this.dd=new Roo.grid.GridDragZone(this.grid,{ddGroup:this.grid.ddGroup||"GridDD"});}this.updateHeaderSortState();this.beforeInitialResize();this.layout(true);this.renderPhase2.defer(1,this);
-},renderPhase2:function(){this.refresh();if(this.grid.autoSizeColumns){this.autoSizeColumns();}},beforeInitialResize:function(){},onColumnSplitterMoved:function(i,w){this.userResized=true;var cm=this.grid.colModel;cm.setColumnWidth(i,w,true);var A=cm.getColumnId(i);
-this.css.updateRule(this.colSelector+A,"width",(w-this.borderWidth)+"px");this.css.updateRule(this.hdSelector+A,"width",(w-this.borderWidth)+"px");this.updateSplitters();this.layout();this.grid.fireEvent("columnresize",i,w);},syncRowHeights:function(E,D){if(this.grid.enableRowHeightSync===true&&this.cm.getLockedCount()>0){E=E||0;
-var C=this.getBodyTable().rows;var B=this.getLockedTable().rows;var A=C.length-1;D=Math.min(D||A,A);for(var i=E;i<=D;i++){var m=C[i],l=B[i];var h=Math.max(m.offsetHeight,l.offsetHeight);m.style.height=l.style.height=h+"px";}}},layout:function(P,K){var g=this.grid;
-var C=g.autoHeight;var O=16;var c=g.getGridEl(),cm=this.cm,J=g.autoExpandColumn,gv=this;if(!c.dom.offsetWidth){if(P){this.lockedWrap.show();this.mainWrap.show();}return;}var E=this.cm.isLocked(0);var B=this.headerPanel.getHeight();var A=this.footerPanel.getHeight();
-if(C){var ch=this.getBodyTable().offsetHeight+B+A+this.mainHd.getHeight();var L=ch+c.getBorderWidth("tb");if(g.maxHeight){L=Math.min(g.maxHeight,L);}c.setHeight(L);}if(g.autoWidth){c.setWidth(cm.getTotalWidth()+c.getBorderWidth("lr"));}var s=this.scroller;
-var D=c.getSize(true);this.el.setSize(D.width,D.height);this.headerPanel.setWidth(D.width);this.footerPanel.setWidth(D.width);var I=this.mainHd.getHeight();var vw=D.width;var vh=D.height-(B+A);s.setSize(vw,vh);var bt=this.getBodyTable();var G=E?Math.max(this.getLockedTable().offsetWidth,this.lockedHd.dom.firstChild.offsetWidth):0;
-var N=bt.offsetHeight;var M=G+bt.offsetWidth;var H=false,F=false;this.scrollSizer.setSize(M,N+I);var lw=this.lockedWrap,mw=this.mainWrap;var lb=this.lockedBody,mb=this.mainBody;setTimeout(function(){var t=s.dom.offsetTop;var w=s.dom.clientWidth,h=s.dom.clientHeight;
-lw.setTop(t);lw.setSize(G,h);mw.setLeftTop(G,t);mw.setSize(w-G,h);lb.setHeight(h-I);mb.setHeight(h-I);if(K!==true&&!gv.userResized&&J){var ci=cm.getIndexById(J);if(ci<0){ci=cm.findColumnIndex(J);}ci=Math.max(0,ci);var Q=cm.getColumnId(ci);var tw=cm.getTotalWidth(false);
-var R=cm.getColumnWidth(ci);var cw=Math.min(Math.max(((w-tw)+R-2)-(w<=s.dom.offsetWidth?0:18),g.autoExpandMin),g.autoExpandMax);if(R!=cw){cm.setColumnWidth(ci,cw,true);gv.css.updateRule(gv.colSelector+Q,"width",(cw-gv.borderWidth)+"px");gv.css.updateRule(gv.hdSelector+Q,"width",(cw-gv.borderWidth)+"px");
-gv.updateSplitters();gv.layout(false,true);}}if(P){lw.show();mw.show();}},10);},onWindowResize:function(){if(!this.grid.monitorWindowResize||this.grid.autoHeight){return;}this.layout();},appendFooter:function(A){return null;},sortAscText:"Sort Ascending",sortDescText:"Sort Descending",lockText:"Lock Column",unlockText:"Unlock Column",columnsText:"Columns"});
-Roo.grid.GridView.ColumnDragZone=function(A,hd){Roo.grid.GridView.ColumnDragZone.superclass.constructor.call(this,A,hd,null);this.proxy.el.addClass("x-grid3-col-dd");};Roo.extend(Roo.grid.GridView.ColumnDragZone,Roo.grid.HeaderDragZone,{handleMouseDown:function(e){},callHandleMouseDown:function(e){Roo.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this,e);
-}});
-Roo.grid.SplitDragZone=function(B,hd,A){this.grid=B;this.view=B.getView();this.proxy=this.view.resizeProxy;Roo.grid.SplitDragZone.superclass.constructor.call(this,hd,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Roo.id(this.proxy.dom),resizeFrame:false});this.setHandleElId(Roo.id(hd));this.setOuterHandleElId(Roo.id(A));this.scroll=false};Roo.extend(Roo.grid.SplitDragZone,Roo.dd.DDProxy,{fly:Roo.Element.fly,b4StartDrag:function(x,y){this.view.headersDisabled=true;this.proxy.setHeight(this.view.mainWrap.getHeight());var w=this.cm.getColumnWidth(this.cellIndex);var A=Math.max(w-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(A,1000);this.setYConstraint(0,0);this.minX=x-A;this.maxX=x+1000;this.startPos=x;Roo.dd.DDProxy.prototype.b4StartDrag.call(this,x,y)},handleMouseDown:function(e){ev=Roo.EventObject.setEvent(e);var t=this.fly(ev.getTarget());if(t.hasClass("x-grid-split")){this.cellIndex=this.view.getCellIndex(t.dom);this.split=t.dom;this.cm=this.grid.colModel;if(this.cm.isResizable(this.cellIndex)&&!this.cm.isFixed(this.cellIndex)){Roo.grid.SplitDragZone.superclass.handleMouseDown.apply(this,arguments)}}},endDrag:function(e){this.view.headersDisabled=false;var B=Math.max(this.minX,Roo.lib.Event.getPageX(e));var A=B-this.startPos;this.view.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+A)},autoOffset:function(){this.setDelta(0,0)}});
-Roo.grid.GridDragZone=function(A,B){this.view=A.getView();Roo.grid.GridDragZone.superclass.constructor.call(this,this.view.mainBody.dom,B);if(this.view.lockedBody){this.setHandleElId(Roo.id(this.view.mainBody.dom));this.setOuterHandleElId(Roo.id(this.view.lockedBody.dom))}this.scroll=false;this.grid=A;this.ddel=document.createElement("div");this.ddel.className="x-grid-dd-wrap"};Roo.extend(Roo.grid.GridDragZone,Roo.dd.DragZone,{ddGroup:"GridDD",getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var A=this.view.findRowIndex(t);if(A!==false){var sm=this.grid.selModel;if(e.hasModifier()){sm.handleMouseDown(e,t)}return {grid:this.grid,ddel:this.ddel,rowIndex:A,selections:sm.getSelections()}}return false},onInitDrag:function(e){var A=this.dragData;this.ddel.innerHTML=this.grid.getDragDropText();this.proxy.update(this.ddel)},afterRepair:function(){this.dragging=false},getRepairXY:function(e,A){return false},onEndDrag:function(A,e){},onValidDrop:function(dd,e,id){this.hideProxy()},beforeInvalidDrop:function(e,id){}});
-Roo.grid.ColumnModel=function(B){this.config=B;this.lookup={};for(var i=0,A=B.length;i<A;i++){var c=B[i];if(typeof c.dataIndex=="undefined"){c.dataIndex=i;}if(typeof c.renderer=="string"){c.renderer=Roo.util.Format[c.renderer];}if(typeof c.id=="undefined"){c.id=Roo.id();
-}if(c.editor&&c.editor.xtype){c.editor=Roo.factory(c.editor,Roo.grid);}if(c.editor&&c.editor.isFormField){c.editor=new Roo.grid.GridEditor(c.editor);}this.lookup[c.id]=c;}this.defaultWidth=100;this.defaultSortable=false;this.addEvents({"widthchange":true,headerchange:true,hiddenchange:true,columnmoved:true,columnlockchange:true});
-Roo.grid.ColumnModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.ColumnModel,Roo.util.Observable,{getColumnId:function(A){return this.config[A].id;},getColumnById:function(id){return this.lookup[id];},getIndexById:function(id){for(var i=0,A=this.config.length;
-i<A;i++){if(this.config[i].id==id){return i;}}return -1;},findColumnIndex:function(B){for(var i=0,A=this.config.length;i<A;i++){if(this.config[i].dataIndex==B){return i;}}return -1;},moveColumn:function(B,A){var c=this.config[B];this.config.splice(B,1);this.config.splice(A,0,c);
-this.dataMap=null;this.fireEvent("columnmoved",this,B,A);},isLocked:function(A){return this.config[A].locked===true;},setLocked:function(B,A,C){if(this.isLocked(B)==A){return;}this.config[B].locked=A;if(!C){this.fireEvent("columnlockchange",this,B,A);}},getTotalLockedWidth:function(){var A=0;
-for(var i=0;i<this.config.length;i++){if(this.isLocked(i)&&!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}return A;},getLockedCount:function(){for(var i=0,A=this.config.length;i<A;i++){if(!this.isLocked(i)){return i;}}},getColumnCount:function(B){if(B===true){var c=0;
-for(var i=0,A=this.config.length;i<A;i++){if(!this.isHidden(i)){c++;}}return c;}return this.config.length;},getColumnsBy:function(fn,B){var r=[];for(var i=0,A=this.config.length;i<A;i++){var c=this.config[i];if(fn.call(B||this,c,i)===true){r[r.length]=c;}}return r;
-},isSortable:function(A){if(typeof this.config[A].sortable=="undefined"){return this.defaultSortable;}return this.config[A].sortable;},getRenderer:function(A){if(!this.config[A].renderer){return Roo.grid.ColumnModel.defaultRenderer;}return this.config[A].renderer;
-},setRenderer:function(A,fn){this.config[A].renderer=fn;},getColumnWidth:function(A){return this.config[A].width||this.defaultWidth;},setColumnWidth:function(A,B,C){this.config[A].width=B;this.totalWidth=null;if(!C){this.fireEvent("widthchange",this,A,B);
-}},getTotalWidth:function(B){if(!this.totalWidth){this.totalWidth=0;for(var i=0,A=this.config.length;i<A;i++){if(B||!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}}return this.totalWidth;},getColumnHeader:function(A){return this.config[A].header;
-},setColumnHeader:function(A,B){this.config[A].header=B;this.fireEvent("headerchange",this,A,B);},getColumnTooltip:function(A){return this.config[A].tooltip;},setColumnTooltip:function(A,B){this.config[A].tooltip=B;},getDataIndex:function(A){return this.config[A].dataIndex;
-},setDataIndex:function(A,B){this.config[A].dataIndex=B;},isCellEditable:function(A,B){return (this.config[A].editable||(typeof this.config[A].editable=="undefined"&&this.config[A].editor))?true:false;},getCellEditor:function(A,B){return this.config[A].editor;
-},setEditable:function(A,B){this.config[A].editable=B;},isHidden:function(A){return this.config[A].hidden;},isFixed:function(A){return this.config[A].fixed;},isResizable:function(A){return A>=0&&this.config[A].resizable!==false&&this.config[A].fixed!==true;
-},setHidden:function(B,A){this.config[B].hidden=A;this.totalWidth=null;this.fireEvent("hiddenchange",this,B,A);},setEditor:function(A,B){this.config[A].editor=B;}});Roo.grid.ColumnModel.defaultRenderer=function(A){if(typeof A=="string"&&A.length<1){return "&#160;";
-}return A;};Roo.grid.DefaultColumnModel=Roo.grid.ColumnModel;
-Roo.grid.AbstractSelectionModel=function(){this.locked=false;Roo.grid.AbstractSelectionModel.superclass.constructor.call(this)};Roo.extend(Roo.grid.AbstractSelectionModel,Roo.util.Observable,{init:function(A){this.grid=A;this.initEvents()},lock:function(){this.locked=true},unlock:function(){this.locked=false},isLocked:function(){return this.locked}});
-Roo.grid.RowSelectionModel=function(A){Roo.apply(this,A);this.selections=new Roo.util.MixedCollection(false,function(o){return o.id});this.last=false;this.lastActive=false;this.addEvents({"selectionchange":true,afterselectionchange:true,beforerowselect:true,rowselect:true,rowdeselect:true});Roo.grid.RowSelectionModel.superclass.constructor.call(this);this.locked=false};Roo.extend(Roo.grid.RowSelectionModel,Roo.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("mousedown",this.handleMouseDown,this)}else{this.grid.on("rowclick",this.handleDragableRowClick,this)}this.rowNav=new Roo.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey)}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B}}else{this.selectFirstRow()}this.fireEvent("afterselectionchange",this)},down:function(e){if(!e.shiftKey){this.selectNext(e.shiftKey)}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B}}else{this.selectFirstRow()}this.fireEvent("afterselectionchange",this)},scope:this});var A=this.grid.view;A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);A.on("rowremoved",this.onRemove,this)},onRefresh:function(){var ds=this.grid.dataSource,i,v=this.grid.view;var s=this.selections;s.each(function(r){if((i=ds.indexOfId(r.id))!=-1){v.onRowSelect(i)}else{s.remove(r)}})},onRemove:function(v,A,r){this.selections.remove(r)},onRowUpdated:function(v,A,r){if(this.isSelected(r)){v.onRowSelect(A)}},selectRecords:function(B,C){if(!C){this.clearSelections()}var ds=this.grid.dataSource;for(var i=0,A=B.length;i<A;i++){this.selectRow(ds.indexOf(B[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 B=this.grid.getView(),C;if(this.isLocked()||(C=B.findRowIndex(t))===false){return};if(e.shiftKey&&this.last!==false){var A=this.last;this.selectRange(A,C,e.ctrlKey);this.last=A;B.focusRow(C)}else{var D=this.isSelected(C);if(e.button!==0&&D){B.focusRow(C)}else if(e.ctrlKey&&D){this.deselectRow(C)}else if(!D){this.selectRow(C,e.button===0&&(e.ctrlKey||e.shiftKey));B.focusRow(C)}}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(B,C){if(!C){this.clearSelections()}for(var i=0,A=B.length;i<A;i++){this.selectRow(B[i],true)}},selectRange:function(B,A,C){if(this.locked)return;if(!C){this.clearSelections()}if(B<=A){for(var i=B;i<=A;i++){this.selectRow(i,true)}}else{for(var i=B;i>=A;i--){this.selectRow(i,true)}}},deselectRange:function(B,A,C){if(this.locked)return;for(var i=B;i<=A;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(B,A,cm){return !cm.isHidden(A)&&cm.isCellEditable(A,B)},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(k==e.TAB){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this)}else{B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this)}}else if(k==e.ENTER&&!e.ctrlKey){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row-1,ed.col,-1,this.acceptsNav,this)}else{B=g.walkCells(ed.row+1,ed.col,1,this.acceptsNav,this)}}else if(k==e.ESC){ed.cancelEdit()}if(B){g.startEditing(B[0],B[1])}}});
-Roo.grid.CellSelectionModel=function(A){Roo.apply(this,A);this.selection=null;this.addEvents({"beforecellselect":true,cellselect:true,selectionchange:true});Roo.grid.CellSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.CellSelectionModel,Roo.grid.AbstractSelectionModel,{initEvents:function(){this.grid.on("mousedown",this.handleMouseDown,this);
-this.grid.getGridEl().on(Roo.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);
-if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this);}},beforeEdit:function(e){this.select(e.row,e.column,false,true,e.record);},onRowUpdated:function(v,A,r){if(this.selection&&this.selection.record==r){v.onCellSelect(A,this.selection.cell[1]);
-}},onViewChange:function(){this.clearSelections(true);},getSelectedCell:function(){return this.selection?this.selection.cell:null;},clearSelections:function(A){var s=this.selection;if(s){if(A!==true){this.grid.view.onCellDeselect(s.cell[0],s.cell[1]);}this.selection=null;
-this.fireEvent("selectionchange",this,null);}},hasSelection:function(){return this.selection?true:false;},handleMouseDown:function(e,t){var v=this.grid.getView();if(this.isLocked()){return;};var A=v.findRowIndex(t);var B=v.findCellIndex(t);if(A!==false&&B!==false){this.select(A,B);
-}},select:function(B,A,D,C,r){if(this.fireEvent("beforecellselect",this,B,A)!==false){this.clearSelections();r=r||this.grid.dataSource.getAt(B);this.selection={record:r,cell:[B,A]};if(!D){var v=this.grid.getView();v.onCellSelect(B,A);if(C!==true){v.focusCell(B,A);
-}}this.fireEvent("cellselect",this,B,A);this.fireEvent("selectionchange",this,this.selection);}},isSelectable:function(B,A,cm){return !cm.isHidden(A);},handleKeyDown:function(e){if(!e.isNavKeyPress()){return;}var g=this.grid,s=this.selection;if(!s){e.stopEvent();
-var A=g.walkCells(0,0,1,this.isSelectable,this);if(A){this.select(A[0],A[1]);}return;}var sm=this;var B=function(E,D,F){return g.walkCells(E,D,F,sm.isSelectable,sm);};var k=e.getKey(),r=s.cell[0],c=s.cell[1];var C;switch(k){case e.TAB:if(e.shiftKey){C=B(r,c-1,-1);
-}else{C=B(r,c+1,1);}break;case e.DOWN:C=B(r+1,c,1);break;case e.UP:C=B(r-1,c,-1);break;case e.RIGHT:C=B(r,c+1,1);break;case e.LEFT:C=B(r,c-1,-1);break;case e.ENTER:if(g.isEditor&&!g.editing){g.startEditing(r,c);e.stopEvent();return;}break;};if(C){this.select(C[0],C[1]);
-e.stopEvent();}},acceptsNav:function(B,A,cm){return !cm.isHidden(A)&&cm.isCellEditable(A,B);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(k==e.TAB){if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else{B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);
-}e.stopEvent();}else if(k==e.ENTER&&!e.ctrlKey){ed.completeEdit();e.stopEvent();}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing(B[0],B[1]);}}});
-Roo.grid.EditorGrid=function(B,A){Roo.grid.EditorGrid.superclass.constructor.call(this,B,A);this.getGridEl().addClass("xedit-grid");if(!this.selModel){this.selModel=new Roo.grid.CellSelectionModel();}this.activeEditor=null;this.addEvents({"beforeedit":true,afteredit:true,validateedit:true});
-this.on("bodyscroll",this.stopEditing,this);this.on(this.clicksToEdit==1?"cellclick":"celldblclick",this.onCellDblClick,this);};Roo.extend(Roo.grid.EditorGrid,Roo.grid.Grid,{clicksToEdit:2,isEditor:true,trackMouseOver:false,onCellDblClick:function(g,B,A){this.startEditing(B,A);
-},onEditComplete:function(ed,B,C){this.editing=false;this.activeEditor=null;ed.un("specialkey",this.selModel.onEditorKey,this.selModel);var r=ed.record;var A=this.colModel.getDataIndex(ed.col);var e={grid:this,record:r,field:A,originalValue:C,value:B,row:ed.row,column:ed.col,cancel:false,editor:ed};
-if(String(B)!==String(C)){if(this.fireEvent("validateedit",e)!==false&&!e.cancel){r.set(A,e.value);delete e.cancel;this.fireEvent("afteredit",e);}}else{this.fireEvent("afteredit",e);}this.view.focusCell(ed.row,ed.col);},startEditing:function(B,A){this.stopEditing();
-if(this.colModel.isCellEditable(A,B)){this.view.ensureVisible(B,A,true);var r=this.dataSource.getAt(B);var C=this.colModel.getDataIndex(A);var e={grid:this,record:r,field:C,value:r.data[C],row:B,column:A,cancel:false};if(this.fireEvent("beforeedit",e)!==false&&!e.cancel){this.editing=true;
-var ed=this.colModel.getCellEditor(A,B);if(!ed){return;}if(!ed.rendered){ed.render(ed.parentEl||document.body);}(function(){ed.row=B;ed.col=A;ed.record=r;ed.on("complete",this.onEditComplete,this,{single:true});ed.on("specialkey",this.selModel.onEditorKey,this.selModel);
-this.activeEditor=ed;var v=r.data[C];ed.startEdit(this.view.getCell(B,A),v);}).defer(50,this);}}},stopEditing:function(){if(this.activeEditor){this.activeEditor.completeEdit();}this.activeEditor=null;}});
-Roo.grid.GridEditor=function(A,B){if(!B&&A.field){B=A;A=Roo.factory(B.field,Roo.form);}Roo.grid.GridEditor.superclass.constructor.call(this,A,B);A.monitorTab=false;};Roo.extend(Roo.grid.GridEditor,Roo.Editor,{alignment:"tl-tl",autoSize:"width",hideEl:false,cls:"x-small-editor x-grid-editor",shim:false,shadow:"frame"});
-
-Roo.grid.PropertyRecord=Roo.data.Record.create([{name:"name",type:"string"},"value"]);Roo.grid.PropertyStore=function(A,B){this.grid=A;this.store=new Roo.data.Store({recordType:Roo.grid.PropertyRecord});this.store.on("update",this.onUpdate,this);if(B){this.setSource(B);
-}Roo.grid.PropertyStore.superclass.constructor.call(this);};Roo.extend(Roo.grid.PropertyStore,Roo.util.Observable,{setSource:function(o){this.source=o;this.store.removeAll();var A=[];for(var k in o){if(this.isEditableValue(o[k])){A.push(new Roo.grid.PropertyRecord({name:k,value:o[k]},k));
-}}this.store.loadRecords({records:A},{},true);},onUpdate:function(ds,B,A){if(A==Roo.data.Record.EDIT){var v=B.data["value"];var C=B.modified["value"];if(this.grid.fireEvent("beforepropertychange",this.source,B.id,v,C)!==false){this.source[B.id]=v;B.commit();
-this.grid.fireEvent("propertychange",this.source,B.id,v,C);}else{B.reject();}}},getProperty:function(A){return this.store.getAt(A);},isEditableValue:function(A){if(A&&A instanceof Date){return true;}else if(typeof A=="object"||typeof A=="function"){return false;
-}return true;},setValue:function(A,B){this.source[A]=B;this.store.getById(A).set("value",B);},getSource:function(){return this.source;}});Roo.grid.PropertyColumnModel=function(A,B){this.grid=A;var g=Roo.grid;g.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,sortable:true,dataIndex:"name",id:"name"},{header:this.valueText,resizable:false,dataIndex:"value",id:"value"}]);
-this.store=B;this.bselect=Roo.DomHelper.append(document.body,{tag:"select",style:"display:none",cls:"x-grid-editor",children:[{tag:"option",value:"true",html:"true"},{tag:"option",value:"false",html:"false"}]});Roo.id(this.bselect);var f=Roo.form;this.editors={"date":new g.GridEditor(new f.DateField({selectOnFocus:true})),string:new g.GridEditor(new f.TextField({selectOnFocus:true})),number:new g.GridEditor(new f.NumberField({selectOnFocus:true,style:"text-align:left;"})),"int":new g.GridEditor(new f.NumberField({selectOnFocus:true,allowDecimals:false,style:"text-align:left;"})),"boolean":new g.GridEditor(new f.Field({el:this.bselect,selectOnFocus:true}))};
-this.renderCellDelegate=this.renderCell.createDelegate(this);this.renderPropDelegate=this.renderProp.createDelegate(this);};Roo.extend(Roo.grid.PropertyColumnModel,Roo.grid.ColumnModel,{nameText:"Name",valueText:"Value",dateFormat:"m/j/Y",renderDate:function(A){return A.dateFormat(this.dateFormat);
-},renderBool:function(A){return A?"true":"false";},isCellEditable:function(A,B){return A==1;},getRenderer:function(A){return A==1?this.renderCellDelegate:this.renderPropDelegate;},renderProp:function(v){return this.getPropertyName(v);},renderCell:function(A){var rv=A;
-if(A instanceof Date){rv=this.renderDate(A);}else if(typeof A=="boolean"){rv=this.renderBool(A);}return Roo.util.Format.htmlEncode(rv);},getPropertyName:function(A){var pn=this.grid.propertyNames;return pn&&pn[A]?pn[A]:A;},getCellEditor:function(B,C){var p=this.store.getProperty(C);
-var n=p.data["name"],A=p.data["value"];if(typeof (this.grid.customEditors[n])=="string"){return this.editors[this.grid.customEditors[n]];}if(typeof (this.grid.customEditors[n])!="undefined"){return this.grid.customEditors[n];}if(A instanceof Date){return this.editors["date"];
-}else if(typeof A=="number"){return this.editors["number"];}else if(typeof A=="boolean"){return this.editors["boolean"];}else{return this.editors["string"];}}});Roo.grid.PropertyGrid=function(C,B){B=B||{};var A=new Roo.grid.PropertyStore(this);this.store=A;
-var cm=new Roo.grid.PropertyColumnModel(this,A);A.store.sort("name","ASC");Roo.grid.PropertyGrid.superclass.constructor.call(this,C,Roo.apply({ds:A.store,cm:cm,enableColLock:false,enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1},B));
-this.getGridEl().addClass("x-props-grid");this.lastEditRow=null;this.on("columnresize",this.onColumnResize,this);this.addEvents({"beforepropertychange":true,propertychange:true});this.customEditors=this.customEditors||{};};Roo.extend(Roo.grid.PropertyGrid,Roo.grid.EditorGrid,{render:function(){Roo.grid.PropertyGrid.superclass.render.call(this);
-this.autoSize.defer(100,this);},autoSize:function(){Roo.grid.PropertyGrid.superclass.autoSize.call(this);if(this.view){this.view.fitColumns();}},onColumnResize:function(){this.colModel.setColumnWidth(1,this.container.getWidth(true)-this.colModel.getColumnWidth(0));
-this.autoSize();},setSource:function(A){this.store.setSource(A);},getSource:function(){return this.store.getSource();}});
-Roo.LoadMask=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(this.store){this.store.on("beforeload",this.onBeforeLoad,this);this.store.on("load",this.onLoad,this);this.store.on("loadexception",this.onLoad,this);this.removeMask=false}else{var um=this.el.getUpdateManager();um.showLoadIndicator=false;um.on("beforeupdate",this.onBeforeLoad,this);um.on("update",this.onLoad,this);um.on("failure",this.onLoad,this);this.removeMask=true}};Roo.LoadMask.prototype={msg:"Loading...",msgCls:"x-mask-loading",disabled:false,disable:function(){this.disabled=true},enable:function(){this.disabled=false},onLoad:function(){this.el.unmask(this.removeMask)},onBeforeLoad:function(){if(!this.disabled){this.el.mask(this.msg,this.msgCls)}},destroy:function(){if(this.store){this.store.un("beforeload",this.onBeforeLoad,this);this.store.un("load",this.onLoad,this);this.store.un("loadexception",this.onLoad,this)}else{var um=this.el.getUpdateManager();um.un("beforeupdate",this.onBeforeLoad,this);um.un("update",this.onLoad,this);um.un("failure",this.onLoad,this)}}};
-Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,arguments);var s=this.html;s=["<tpl>",s,"</tpl>"].join("");var re=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var G=/^<tpl\b[^>]*?for="(.*?)"/;var C=/^<tpl\b[^>]*?if="(.*?)"/;var F=/^<tpl\b[^>]*?exec="(.*?)"/;var m,id=0;var E=[];while(m=s.match(re)){var m2=m[0].match(G);var m3=m[0].match(C);var m4=m[0].match(F);var A=null,fn=null,B=null;var D=m2&&m2[1]?m2[1]:"";if(m3){A=m3&&m3[1]?m3[1]:null;if(A){fn=new Function("values","parent","with(values){ return "+(Roo.util.Format.htmlDecode(A))+"; }")}}if(m4){A=m4&&m4[1]?m4[1]:null;if(A){B=new Function("values","parent","with(values){ "+(Roo.util.Format.htmlDecode(A))+"; }")}}if(D){switch(D){case ".":D=new Function("values","parent","with(values){ return values; }");break;case "..":D=new Function("values","parent","with(values){ return parent; }");break;default:D=new Function("values","parent","with(values){ return "+D+"; }")}}E.push({id:id,target:D,exec:B,test:fn,body:m[1]||""});s=s.replace(m[0],"{xtpl"+id+"}");++id}for(var i=E.length-1;i>=0;--i){this.compileTpl(E[i])}this.master=E[E.length-1];this.tpls=E};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applySubTemplate:function(id,D,C){var t=this.tpls[id];if(t.test&&!t.test.call(this,D,C)){return ""}if(t.exec&&t.exec.call(this,D,C)){return ""}var vs=t.target?t.target.call(this,D,C):D;C=t.target?D:C;if(t.target&&vs instanceof Array){var A=[];for(var i=0,B=vs.length;i<B;i++){A[A.length]=t.compiled.call(this,vs[i],C)}return A.join("")}return t.compiled.call(this,vs,C)},compileTpl:function(B){var fm=Roo.util.Format;var D=this.disableFormats!==true;var A=Roo.isGecko?"+":",";var fn=function(m,F,G,E){if(F.substr(0,4)=="xtpl"){return "'"+A+"this.applySubTemplate("+F.substr(4)+", values, parent)"+A+"'"}var v;if(F.indexOf(".")!=-1){v=F}else{v="values['"+F+"']"}if(G&&D){E=E?","+E:"";if(G.substr(0,5)!="this."){G="fm."+G+"("}else{G="this.call(\""+G.substr(5)+"\", ";E=", values"}}else{E="";G="("+v+" === undefined ? '' : "}return "'"+A+G+v+E+")"+A+"'"};var C;if(Roo.isGecko){C="tpl.compiled = function(values, parent){ return '"+B.body.replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn)+"';};"}else{C=["tpl.compiled = function(values, parent){ return ['"];C.push(B.body.replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn));C.push("'].join('');};");C=C.join("")}eval(C);return this},applyTemplate:function(A){return this.master.compiled.call(this,A,{});var s=this.subs},apply:function(){return this.applyTemplate.apply(this,arguments)},compile:function(){return this}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML)};