sync
[roojs1] / roojs-all.js
index b7b601a..66a4552 100644 (file)
@@ -1,40 +1,40 @@
-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 B=0;var ua=navigator.userAgent.toLowerCase();var C=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isSafari=(/webkit|khtml/).test(ua),isIE=ua.indexOf("msie")>-1,isIE7=ua.indexOf("msie 7")>-1,isGecko=!isSafari&&ua.indexOf("gecko")>-1,isBorderBox=isIE&&!C,isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),isLinux=(ua.indexOf("linux")!=-1),isSecure=window.location.href.toLowerCase().indexOf("https")===0;if(isIE&&!isIE7){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
-Roo.apply(Roo,{isStrict:C,isSecure:isSecure,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 D={};for(var b in o){var parts=b.split('@');if(parts[1]){var s=parts[0];if(!D[s]){D[s]=Roo.select(s);}
-D[s].on(parts[1],o[b]);}}
-D=null;},id:function(el,E){E=E||"roo-gen";el=Roo.getDom(el);var id=E+(++B);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,G){if(typeof sp=='object'){G=sp;sp=sb;sb=function(){sp.apply(this,arguments);};}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==Object.prototype.constructor){spp.constructor=sp;}
-sb.override=function(o){Roo.override(sb,o);};sbp.override=io;Roo.override(sb,G);return sb;};}(),override:function(F,G){if(G){var p=F.prototype;for(var method in G){p[method]=G[method];}}},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]){console.log("Roo.Factory("+c.xtype+")");var ret=new ns[c.xtype](c);ret.xns=false;return ret;}
-c.xns=false;return c;},urlEncode:function(o){if(!o){return "";}var H=[];for(var key in o){var ov=o[key],k=encodeURIComponent(key);var type=typeof ov;if(type=='undefined'){H.push(k,"=&");}else if(type!="function"&&type!="object"){H.push(k,"=",encodeURIComponent(ov),"&");}else if(ov instanceof Array){if(ov.length){for(var i=0,len=ov.length;i<len;i++){H.push(k,"=",encodeURIComponent(ov[i]===undefined?'':ov[i]),"&");}}else {H.push(k,"=&");}}}
-H.pop();return H.join("");},urlDecode:function(I,J){if(!I||!I.length){return {};}var K={};var L=I.split('&');var M,name,value;for(var i=0,len=L.length;i<len;i++){M=L[i].split('=');name=decodeURIComponent(M[0]);value=decodeURIComponent(M[1]);if(J!==true){if(typeof K[name]=="undefined"){K[name]=value;}else if(typeof K[name]=="string"){K[name]=[K[name]];K[name].push(value);}else {K[name].push(value);}}else {K[name]=value;}}return K;},each:function(N,fn,O){if(typeof N.length=="undefined"||typeof N=="string"){N=[N];}for(var i=0,len=N.length;i<len;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,P,Q,R){if(typeof cb=="function"){if(R){cb.defer(R,P,Q||[]);}else {cb.apply(P,Q||[]);}}},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,S){if(typeof v!='number'){return S;}return v;},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;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,T){return v===null||v===undefined||(!T?v==='':false);},isOpera:isOpera,isSafari:isSafari,isIE:isIE,isIE7:isIE7,isGecko:isGecko,isBorderBox:isBorderBox,isWindows:isWindows,isLinux:isLinux,isMac:isMac,useShims:((isIE&&!isIE7)||(isGecko&&isMac))});})();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");
+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 idSeed=0;var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isSafari=(/webkit|khtml/).test(ua),isIE=ua.indexOf("msie")>-1,isIE7=ua.indexOf("msie 7")>-1,isGecko=!isSafari&&ua.indexOf("gecko")>-1,isBorderBox=isIE&&!isStrict,isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),isLinux=(ua.indexOf("linux")!=-1),isSecure=window.location.href.toLowerCase().indexOf("https")===0;if(isIE&&!isIE7){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
+Roo.apply(Roo,{isStrict:isStrict,isSecure:isSecure,isReady:false,debug: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 cache={};for(var b in o){var parts=b.split('@');if(parts[1]){var s=parts[0];if(!cache[s]){cache[s]=Roo.select(s);}
+cache[s].on(parts[1],o[b]);}}
+cache=null;},id:function(el,prefix){prefix=prefix||"roo-gen";el=Roo.getDom(el);var id=prefix+(++idSeed);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,overrides){if(typeof sp=='object'){overrides=sp;sp=sb;sb=function(){sp.apply(this,arguments);};}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==Object.prototype.constructor){spp.constructor=sp;}
+sb.override=function(o){Roo.override(sb,o);};sbp.override=io;Roo.override(sb,overrides);return sb;};}(),override:function(origclass,overrides){if(overrides){var p=origclass.prototype;for(var method in overrides){p[method]=overrides[method];}}},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]){if(Roo.debug)Roo.log("Roo.Factory("+c.xtype+")");var ret=new ns[c.xtype](c);ret.xns=false;return ret;}
+c.xns=false;return c;},log:function(s){if((typeof(console)=='undefined')||typeof(console.log)=='undefined')){return;}
+console.log(s);},urlEncode:function(o){if(!o){return "";}var buf=[];for(var key in o){var ov=o[key],k=encodeURIComponent(key);var type=typeof ov;if(type=='undefined'){buf.push(k,"=&");}else if(type!="function"&&type!="object"){buf.push(k,"=",encodeURIComponent(ov),"&");}else if(ov instanceof Array){if(ov.length){for(var i=0,len=ov.length;i<len;i++){buf.push(k,"=",encodeURIComponent(ov[i]===undefined?'':ov[i]),"&");}}else {buf.push(k,"=&");}}}
+buf.pop();return buf.join("");},urlDecode:function(string,overwrite){if(!string||!string.length){return {};}var obj={};var pairs=string.split('&');var pair,name,value;for(var i=0,len=pairs.length;i<len;i++){pair=pairs[i].split('=');name=decodeURIComponent(pair[0]);value=decodeURIComponent(pair[1]);if(overwrite!==true){if(typeof obj[name]=="undefined"){obj[name]=value;}else if(typeof obj[name]=="string"){obj[name]=[obj[name]];obj[name].push(value);}else {obj[name].push(value);}}else {obj[name]=value;}}return obj;},each:function(array,fn,scope){if(typeof array.length=="undefined"||typeof array=="string"){array=[array];}for(var i=0,len=array.length;i<len;i++){if(fn.call(scope||array[i],array[i],i,array)===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,scope,args,delay){if(typeof cb=="function"){if(delay){cb.defer(delay,scope,args||[]);}else {cb.apply(scope,args||[]);}}},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,defaultValue){if(typeof v!='number'){return defaultValue;}return v;},destroy:function(){for(var i=0,a=arguments,len=a.length;i<len;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,allowBlank){return v===null||v===undefined||(!allowBlank?v==='':false);},isOpera:isOpera,isSafari:isSafari,isIE:isIE,isIE7:isIE7,isGecko:isGecko,isBorderBox:isBorderBox,isWindows:isWindows,isLinux:isLinux,isMac:isMac,useShims:((isIE&&!isIE7)||(isGecko&&isMac))});})();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 B=arguments;var C=this;return function(){return C.apply(window,B);};},createDelegate:function(D,E,F){var G=this;return function(){var H=E||arguments;if(F===true){H=Array.prototype.slice.call(arguments,0);H=H.concat(E);}else if(typeof F=="number"){H=Array.prototype.slice.call(arguments,0);var applyArgs=[F,0].concat(E);Array.prototype.splice.apply(H,applyArgs);}return G.apply(D||window,H);};},defer:function(H,I,J,K){var fn=this.createDelegate(I,J,K);if(H){return setTimeout(fn,H);}
 fn();return 0;},createSequence:function(L,M){if(typeof L!="function"){return this;}var N=this;return function(){var O=N.apply(this||window,arguments);L.apply(M||this||window,arguments);return O;};},createInterceptor:function(O,P){if(typeof O!="function"){return this;}var Q=this;return function(){O.target=this;O.method=Q;if(O.apply(P||this||window,arguments)===false){return;}return Q.apply(this||window,arguments);};}});
 Roo.applyIf(String,{escape:function(A){return A.replace(/('|\\)/g,"\\$1");},leftPad:function(B,C,ch){var D=new String(B);if(ch===null||ch===undefined||ch===''){ch=" ";}while(D.length<C){D=ch+D;}return D;},format:function(E){var F=Array.prototype.slice.call(arguments,1);return E.replace(/\{(\d+)\}/g,function(m,i){return Roo.util.Format.htmlEncode(F[i]);});}});String.prototype.toggle=function(G,H){return this==G?H:G;};
 Roo.applyIf(Number.prototype,{constrain:function(A,B){return Math.min(Math.max(this,A),B);}});
-Roo.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,len=this.length;i<len;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 C=Date.formatFunctions[B];return this[C]();};Date.prototype.format=Date.prototype.dateFormat;Date.createNewFormat=function(D){var E="format"+Date.formatFunctions.count++;Date.formatFunctions[D]=E;var F="Date.prototype."+E+" = function(){return ";var G=false;var ch='';for(var i=0;i<D.length;++i){ch=D.charAt(i);if(!G&&ch=="\\"){G=true;}else if(G){G=false;F+="'"+String.escape(ch)+"' + ";}else {F+=Date.getFormatCode(ch);}}
-eval(F.substring(0,F.length-3)+";}");};Date.getFormatCode=function(H){switch(H){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(H)+"' + ";}};Date.parseDate=function(I,J){if(Date.parseFunctions[J]==null){Date.createParser(J);}var K=Date.parseFunctions[J];return Date[K](I);};Date.createParser=function(L){var M="parse"+Date.parseFunctions.count++;var N=Date.parseRegexes.length;var O=1;Date.parseFunctions[L]=M;var P="Date."+M+" = 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["+N+"]);\n"+"if (results && results.length > 0) {";var Q="";var R=false;var ch='';for(var i=0;i<L.length;++i){ch=L.charAt(i);if(!R&&ch=="\\"){R=true;}else if(R){R=false;Q+=String.escape(ch);}else {var obj=Date.formatCodeToRegex(ch,O);O+=obj.g;Q+=obj.s;if(obj.g&&obj.c){P+=obj.c;}}}
+Roo.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,len=this.length;i<len;i++){if(this[i]==o)return i;}return -1;},remove:function(o){var A=this.indexOf(o);if(A!=-1){this.splice(A,1);}},map:function(B){var C=this.length>>>0;if(typeof B!="function")throw new TypeError();var D=new Array(C);var E=arguments[1];for(var i=0;i<C;i++){if(i in this)D[i]=B.call(E,this[i],i,this);}return D;}});
+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 C=Date.formatFunctions[B];return this[C]();};Date.prototype.format=Date.prototype.dateFormat;Date.createNewFormat=function(D){var E="format"+Date.formatFunctions.count++;Date.formatFunctions[D]=E;var F="Date.prototype."+E+" = function(){return ";var G=false;var ch='';for(var i=0;i<D.length;++i){ch=D.charAt(i);if(!G&&ch=="\\"){G=true;}else if(G){G=false;F+="'"+String.escape(ch)+"' + ";}else {F+=Date.getFormatCode(ch);}}eval(F.substring(0,F.length-3)+";}");};Date.getFormatCode=function(H){switch(H){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(H)+"' + ";}};Date.parseDate=function(I,J){if(Date.parseFunctions[J]==null){Date.createParser(J);}var K=Date.parseFunctions[J];return Date[K](I);};Date.createParser=function(L){var M="parse"+Date.parseFunctions.count++;var N=Date.parseRegexes.length;var O=1;Date.parseFunctions[L]=M;var P="Date."+M+" = 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["+N+"]);\n"+"if (results && results.length > 0) {";var Q="";var R=false;var ch='';for(var i=0;i<L.length;++i){ch=L.charAt(i);if(!R&&ch=="\\"){R=true;}else if(R){R=false;Q+=String.escape(ch);}else {var obj=Date.formatCodeToRegex(ch,O);O+=obj.g;Q+=obj.s;if(obj.g&&obj.c){P+=obj.c;}}}
 P+="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[N]=new RegExp("^"+Q+"$");eval(P);};Date.formatCodeToRegex=function(S,T){switch(S){case "D":return {g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case "j":return {g:1,c:"d = parseInt(results["+T+"], 10);\n",s:"(\\d{1,2})"};case "d":return {g:1,c:"d = parseInt(results["+T+"], 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["+T+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case "M":return {g:1,c:"m = parseInt(Date.monthNumbers[results["+T+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case "n":return {g:1,c:"m = parseInt(results["+T+"], 10) - 1;\n",s:"(\\d{1,2})"};case "m":return {g:1,c:"m = parseInt(results["+T+"], 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["+T+"], 10);\n",s:"(\\d{4})"};case "y":return {g:1,c:"var ty = parseInt(results["+T+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case "a":return {g:1,c:"if (results["+T+"] == '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["+T+"] == '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["+T+"], 10);\n",s:"(\\d{1,2})"};case "h":case "H":return {g:1,c:"h = parseInt(results["+T+"], 10);\n",s:"(\\d{2})"};case "i":return {g:1,c:"i = parseInt(results["+T+"], 10);\n",s:"(\\d{2})"};case "s":return {g:1,c:"s = parseInt(results["+T+"], 10);\n",s:"(\\d{2})"};case "O":return {g:1,c:["o = results[",T,"];\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["+T+"];\n"+"z = (-43200 <= z*1 && z*1 <= 50400)? z : null;\n",s:"([+\-]?\\d{1,5})"};default:return {g:0,c:null,s:String.escape(S)};}};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 U=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){U+=Date.daysInMonth[i];}return U+this.getDate()-1;};Date.prototype.getWeekOfYear=function(){var V=this.getDayOfYear()+(4-this.getDay());var W=new Date(this.getFullYear(),0,1);var X=(7-W.getDay()+4);return String.leftPad(((V-X)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var Y=this.getFullYear();return ((Y&3)==0&&(Y%100||(Y%400==0&&Y)));};Date.prototype.getFirstDayOfMonth=function(){var Z=(this.getDay()-(this.getDate()-1))%7;return (Z<0)?(Z+7):Z;};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(b){if(b){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(c){if(c<=-1){var n=Math.ceil(-c);var back_year=Math.ceil(n/12);var month=(n%12)?12-n%12:0;this.setFullYear(this.getFullYear()-back_year);return Date.brokenSetMonth.call(this,month);}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(e,f){var d=this.clone();if(!e||f===0)return d;switch(e.toLowerCase()){case Date.MILLI:d.setMilliseconds(this.getMilliseconds()+f);break;case Date.SECOND:d.setSeconds(this.getSeconds()+f);break;case Date.MINUTE:d.setMinutes(this.getMinutes()+f);break;case Date.HOUR:d.setHours(this.getHours()+f);break;case Date.DAY:d.setDate(this.getDate()+f);break;case Date.MONTH:var a=this.getDate();if(a>28){a=Math.min(a,this.getFirstDateOfMonth().add('mo',f).getLastDateOfMonth().getDate());}
 d.setDate(a);d.setMonth(this.getMonth()+f);break;case Date.YEAR:d.setFullYear(this.getFullYear()+f);break;}return d;};
 Roo.lib.Dom={getViewWidth:function(A){return A?this.getDocumentWidth():this.getViewportWidth();},getViewHeight:function(B){return B?this.getDocumentHeight():this.getViewportHeight();},getDocumentHeight:function(){var C=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(C,this.getViewportHeight());},getDocumentWidth:function(){var D=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(D,this.getViewportWidth());},getViewportHeight:function(){var E=self.innerHeight;var F=document.compatMode;if((F||Roo.isIE)&&!Roo.isOpera){E=(F=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return E;},getViewportWidth:function(){var G=self.innerWidth;var H=document.compatMode;if(H||Roo.isIE){G=(H=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return G;},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 parent=c.parentNode;while(parent){if(parent==p){return true;}else if(!parent.tagName||parent.tagName.toUpperCase()=="HTML"){return false;}
-parent=parent.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,scroll,bd=document.body;el=Roo.getDom(el);var I=Roo.lib.AnimBase.fly;if(el.getBoundingClientRect){b=el.getBoundingClientRect();scroll=I(document).getScroll();return [b.left+scroll.left,b.top+scroll.top];}var x=0,y=0;p=el;var J=I(el).getStyle("position")=="absolute";while(p){x+=p.offsetLeft;y+=p.offsetTop;if(!J&&I(p).getStyle("position")=="absolute"){J=true;}if(Roo.isGecko){pe=I(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&&J){x-=bd.offsetLeft;y-=bd.offsetTop;}if(Roo.isGecko&&!J){var dbd=I(bd);x+=parseInt(dbd.getStyle("borderLeftWidth"),10)||0;y+=parseInt(dbd.getStyle("borderTopWidth"),10)||0;}
-p=el.parentNode;while(p&&p!=bd){if(!Roo.isOpera||(p.tagName!='TR'&&I(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 K=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=K.left+"px";}if(xy[1]!==false){el.dom.style.top=K.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 A=false;var B=[];var C=[];var D=0;var E=[];var F=0;var G=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 self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(b,d,f,g){E.push({id:b,fn:d,obj:f,override:g,checkReady:false});D=this.POLL_RETRYS;this.startInterval();},addListener:function(el,h,fn){el=Roo.getDom(el);if(!el||!fn){return false;}if("unload"==h){C[C.length]=[el,h,fn];return true;}var k=function(e){return fn(Roo.lib.Event.getEvent(e));};var li=[el,h,fn,k];var m=B.length;B[m]=li;this.doAdd(el,h,k,false);return true;},removeListener:function(el,n,fn){var i,len;el=Roo.getDom(el);if(!fn){return this.purgeElement(el,false,n);}if("unload"==n){for(i=0,len=C.length;i<len;i++){var li=C[i];if(li&&li[0]==el&&li[1]==n&&li[2]==fn){C.splice(i,1);return true;}}return false;}var o=null;var p=arguments[3];if("undefined"==typeof p){p=this._getCacheIndex(el,n,fn);}if(p>=0){o=B[p];}if(!el||!o){return false;}
-this.doRemove(el,n,o[this.WFN],false);delete B[p][this.WFN];delete B[p][this.FN];B.splice(p,1);return true;},getTarget:function(ev,q){ev=ev.browserEvent||ev;var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(r){if(Roo.isSafari&&r&&3==r.nodeType){return r.parentNode;}else {return r;}},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,s,fn){for(var i=0,len=B.length;i<len;++i){var li=B[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==s){return i;}}return -1;},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){A=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 u=!A;if(!u){u=(D>0);}var v=[];for(var i=0,len=E.length;i<len;++i){var item=E[i];if(item){var el=this.getEl(item.id);if(el){if(!item.checkReady||A||el.nextSibling||(document&&document.body)){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else {scope=item.override;}}
-item.fn.call(scope,item.obj);E[i]=null;}}else {v.push(item);}}}
-D=(v.length===0)?0:D-1;if(u){this.startInterval();}else {clearInterval(this._interval);this._interval=null;}
-this.locked=false;return true;},purgeElement:function(el,w,z){var AA=this.getListeners(el,z);if(AA){for(var i=0,len=AA.length;i<len;++i){var l=AA[i];this.removeListener(el,l.type,l.fn);}}if(w&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],w,z);}}},getListeners:function(el,AB){var AC=[],searchLists;if(!AB){searchLists=[B,C];}else if(AB=="unload"){searchLists=[C];}else {searchLists=[B];}for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!AB||AB===l[this.TYPE])){AC.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}return (AC.length)?AC:null;},_unload:function(e){var EU=Roo.lib.Event,i,j,l,len,p;for(i=0,len=C.length;i<len;++i){l=C[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else {scope=l[EU.ADJ_SCOPE];}}
+parent=parent.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,I,bd=document.body;el=Roo.getDom(el);var J=Roo.lib.AnimBase.fly;if(el.getBoundingClientRect){b=el.getBoundingClientRect();I=J(document).getScroll();return [b.left+I.left,b.top+I.top];}var x=0,y=0;p=el;var K=J(el).getStyle("position")=="absolute";while(p){x+=p.offsetLeft;y+=p.offsetTop;if(!K&&J(p).getStyle("position")=="absolute"){K=true;}if(Roo.isGecko){pe=J(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&&K){x-=bd.offsetLeft;y-=bd.offsetTop;}if(Roo.isGecko&&!K){var dbd=J(bd);x+=parseInt(dbd.getStyle("borderLeftWidth"),10)||0;y+=parseInt(dbd.getStyle("borderTopWidth"),10)||0;}
+p=el.parentNode;while(p&&p!=bd){if(!Roo.isOpera||(p.tagName!='TR'&&J(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 L=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=L.left+"px";}if(xy[1]!==false){el.dom.style.top=L.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 A=false;var B=[];var C=[];var D=0;var E=[];var F=0;var G=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 self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(h,k,m,n){E.push({id:h,fn:k,obj:m,override:n,checkReady:false});D=this.POLL_RETRYS;this.startInterval();},addListener:function(el,o,fn){el=Roo.getDom(el);if(!el||!fn){return false;}if("unload"==o){C[C.length]=[el,o,fn];return true;}var p=function(e){return fn(Roo.lib.Event.getEvent(e));};var li=[el,o,fn,p];var q=B.length;B[q]=li;this.doAdd(el,o,p,false);return true;},removeListener:function(el,r,fn){var i,s;el=Roo.getDom(el);if(!fn){return this.purgeElement(el,false,r);}if("unload"==r){for(i=0,s=C.length;i<s;i++){var li=C[i];if(li&&li[0]==el&&li[1]==r&&li[2]==fn){C.splice(i,1);return true;}}return false;}var u=null;var v=arguments[3];if("undefined"==typeof v){v=this._getCacheIndex(el,r,fn);}if(v>=0){u=B[v];}if(!el||!u){return false;}
+this.doRemove(el,r,u[this.WFN],false);delete B[v][this.WFN];delete B[v][this.FN];B.splice(v,1);return true;},getTarget:function(ev,w){ev=ev.browserEvent||ev;var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(z){if(Roo.isSafari&&z&&3==z.nodeType){return z.parentNode;}else {return z;}},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,AA,fn){for(var i=0,s=B.length;i<s;++i){var li=B[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==AA){return i;}}return -1;},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){A=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 AB=!A;if(!AB){AB=(D>0);}var AC=[];for(var i=0,s=E.length;i<s;++i){var item=E[i];if(item){var el=this.getEl(item.id);if(el){if(!item.checkReady||A||el.nextSibling||(document&&document.body)){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else {scope=item.override;}}
+item.fn.call(scope,item.obj);E[i]=null;}}else {AC.push(item);}}}
+D=(AC.length===0)?0:D-1;if(AB){this.startInterval();}else {clearInterval(this._interval);this._interval=null;}
+this.locked=false;return true;},purgeElement:function(el,AD,AE){var AF=this.getListeners(el,AE);if(AF){for(var i=0,s=AF.length;i<s;++i){var l=AF[i];this.removeListener(el,l.type,l.fn);}}if(AD&&el&&el.childNodes){for(i=0,s=el.childNodes.length;i<s;++i){this.purgeElement(el.childNodes[i],AD,AE);}}},getListeners:function(el,AG){var AH=[],AI;if(!AG){AI=[B,C];}else if(AG=="unload"){AI=[C];}else {AI=[B];}for(var j=0;j<AI.length;++j){var searchList=AI[j];if(searchList&&searchList.length>0){for(var i=0,s=searchList.length;i<s;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!AG||AG===l[this.TYPE])){AH.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}return (AH.length)?AH:null;},_unload:function(e){var EU=Roo.lib.Event,i,j,l,AJ,AK;for(i=0,AJ=C.length;i<AJ;++i){l=C[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else {scope=l[EU.ADJ_SCOPE];}}
 l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);C[i]=null;l=null;scope=null;}}
-C=null;if(B&&B.length>0){j=B.length;while(j){p=j-1;l=B[p];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],p);}
+C=null;if(B&&B.length>0){j=B.length;while(j){AK=j-1;l=B[AK];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],AK);}
 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,AD,fn,AE){el.addEventListener(AD,fn,(AE));};}else if(window.attachEvent){return function(el,AD,fn,AE){el.attachEvent("on"+AD,fn);};}else {return function(){};}}(),doRemove:function(){if(window.removeEventListener){return function(el,AD,fn,AE){el.removeEventListener(AD,fn,(AE));};}else if(window.detachEvent){return function(el,AD,fn){el.detachEvent("on"+AD,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);}
+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,AL,fn,AM){el.addEventListener(AL,fn,(AM));};}else if(window.attachEvent){return function(el,AL,fn,AM){el.attachEvent("on"+AL,fn);};}else {return function(){};}}(),doRemove:function(){if(window.removeEventListener){return function(el,AL,fn,AM){el.removeEventListener(AL,fn,(AM));};}else if(window.detachEvent){return function(el,AL,fn){el.detachEvent("on"+AL,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(A,B,cb,C,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);A='POST';C=D.xmlData;}}return this.asyncRequest(A,B,cb,C);},serializeForm:function(E){if(typeof E=='string'){E=(document.getElementById(E)||document.forms[E]);}var el,F,G,H,I='',J=false;for(var i=0;i<E.elements.length;i++){el=E.elements[i];H=E.elements[i].disabled;F=E.elements[i].name;G=E.elements[i].value;if(!H&&F){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){I+=encodeURIComponent(F)+'='+encodeURIComponent(el.options[j].attributes['value'].specified?el.options[j].value:el.options[j].text)+'&';}else {I+=encodeURIComponent(F)+'='+encodeURIComponent(el.options[j].hasAttribute('value')?el.options[j].value:el.options[j].text)+'&';}}}break;case 'radio':case 'checkbox':if(el.checked){I+=encodeURIComponent(F)+'='+encodeURIComponent(G)+'&';}break;case 'file':case undefined:case 'reset':case 'button':break;case 'submit':if(J==false){I+=encodeURIComponent(F)+'='+encodeURIComponent(G)+'&';J=true;}break;default:I+=encodeURIComponent(F)+'='+encodeURIComponent(G)+'&';break;}}}
 I=I.substr(0,I.length-1);return I;},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(K){var L,M;try{M=new XMLHttpRequest();L={conn:M,tId:K};}catch(e){for(var i=0;i<this.activeX.length;++i){try{http=new ActiveXObject(this.activeX[i]);obj={conn:http,tId:transactionId};break;}catch(e){}}}finally{return L;}},getConnectionObject:function(){var o;var N=this.transactionId;try{o=this.createXhrObject(N);if(o){this.transactionId++;}}catch(e){}finally{return o;}},asyncRequest:function(O,P,Q,R){var o=this.getConnectionObject();if(!o){return null;}else {o.conn.open(O,P,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders['X-Requested-With']){this.initHeader('X-Requested-With',this.defaultXhrHeader,true);}}if(R&&this.useDefaultHeader){this.initHeader('Content-Type',this.defaultPostHeader);}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(o);}
@@ -92,18 +92,17 @@ P=G(2,ts,O,te);}
 el.insertBefore(P,Q);return P;};return {useDom:false,markup:function(o){return E(o);},applyStyles:function(el,c){if(c){el=Roo.fly(el);if(typeof c=="string"){var re=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var matches;while((matches=re.exec(c))!=null){el.setStyle(matches[1],matches[2]);}}else if(typeof c=="object"){for(var style in c){el.setStyle(style,c[style]);}}else if(typeof c=="function"){Roo.DomHelper.applyStyles(el,c.call());}}},insertHtml:function(d,el,e){d=d.toLowerCase();if(el.insertAdjacentHTML){if(C.test(el.tagName)){var rs;if(rs=L(el.tagName.toLowerCase(),d,el,e)){return rs;}}switch(d){case "beforebegin":el.insertAdjacentHTML('BeforeBegin',e);return el.previousSibling;case "afterbegin":el.insertAdjacentHTML('AfterBegin',e);return el.firstChild;case "beforeend":el.insertAdjacentHTML('BeforeEnd',e);return el.lastChild;case "afterend":el.insertAdjacentHTML('AfterEnd',e);return el.nextSibling;}throw 'Illegal insertion point -> "'+d+'"';}var f=el.ownerDocument.createRange();var g;switch(d){case "beforebegin":f.setStartBefore(el);g=f.createContextualFragment(e);el.parentNode.insertBefore(g,el);return el.previousSibling;case "afterbegin":if(el.firstChild){f.setStartBefore(el.firstChild);g=f.createContextualFragment(e);el.insertBefore(g,el.firstChild);return el.firstChild;}else {el.innerHTML=e;return el.firstChild;}case "beforeend":if(el.lastChild){f.setStartAfter(el.lastChild);g=f.createContextualFragment(e);el.appendChild(g);return el.lastChild;}else {el.innerHTML=e;return el.lastChild;}case "afterend":f.setStartAfter(el);g=f.createContextualFragment(e);el.parentNode.insertBefore(g,el.nextSibling);return el.nextSibling;}throw 'Illegal insertion point -> "'+d+'"';},insertBefore:function(el,o,h){return this.doInsert(el,o,h,"beforeBegin");},insertAfter:function(el,o,j){return this.doInsert(el,o,j,"afterEnd","nextSibling");},insertFirst:function(el,o,k){return this.doInsert(el,o,k,"afterBegin");},doInsert:function(el,o,l,m,n){el=Roo.getDom(el);var p;if(this.useDom||o.ns){p=F(o,null);el.parentNode.insertBefore(p,n?el[n]:el);}else {var e=E(o);p=this.insertHtml(m,el,e);}return l?Roo.get(p,true):p;},append:function(el,o,q){el=Roo.getDom(el);var r;if(this.useDom||o.ns){r=F(o,null);el.appendChild(r);}else {var e=E(o);r=this.insertHtml("beforeEnd",el,e);}return q?Roo.get(r,true):r;},overwrite:function(el,o,t){el=Roo.getDom(el);if(o.ns){while(el.childNodes.length){el.removeChild(el.firstChild);}
 F(o,el);}else {el.innerHTML=E(o);}return t?Roo.get(el.firstChild,true):el.firstChild;},createTemplate:function(o){var u=E(o);return new Roo.Template(u);}};}();
 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(B){if(this.compiled){return this.compiled(B);}var C=this.disableFormats!==true;var fm=Roo.util.Format,D=this;var fn=function(m,E,F,G){if(F&&C){if(F.substr(0,5)=="this."){return D.call(F.substr(5),B[E],B);}else {if(G){var re=/^\s*['"](.*)["']\s*$/;G=G.split(',');for(var i=0,len=G.length;i<len;i++){G[i]=G[i].replace(re,"$1");}
-G=[B[E]].concat(G);}else {G=[B[E]];}return fm[F].apply(fm,G);}}else {return B[E]!==undefined?B[E]:"";}};return this.html.replace(this.re,fn);},set:function(E,F){this.html=E;this.compiled=null;if(F){this.compile();}return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Roo.util.Format;var G=this.disableFormats!==true;var H=Roo.isGecko?"+":",";var fn=function(m,J,K,L){if(K&&G){L=L?','+L:"";if(K.substr(0,5)!="this."){K="fm."+K+'(';}else {K='this.call("'+K.substr(5)+'", ';L=", values";}}else {L='';K="(values['"+J+"'] == undefined ? '' : ";}return "'"+H+K+"values['"+J+"']"+L+")"+H+"'";};var I;if(Roo.isGecko){I="this.compiled = function(values){ return '"+this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {I=["this.compiled = function(values){ return ['"];I.push(this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));I.push("'].join('');};");I=I.join('');}
-eval(I);return this;},call:function(J,K,L){return this[J](K,L);},insertFirst:function(el,M,N){return this.doInsert('afterBegin',el,M,N);},insertBefore:function(el,O,P){return this.doInsert('beforeBegin',el,O,P);},insertAfter:function(el,Q,R){return this.doInsert('afterEnd',el,Q,R);},append:function(el,S,T){return this.doInsert('beforeEnd',el,S,T);},doInsert:function(U,el,V,W){el=Roo.getDom(el);var X=Roo.DomHelper.insertHtml(U,el,this.applyTemplate(V));return W?Roo.get(X,true):X;},overwrite:function(el,Y,Z){el=Roo.getDom(el);el.innerHTML=this.applyTemplate(Y);return Z?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 A={},simpleCache={},valueCache={};var B=/\S/;var C=/^\s+|\s+$/g;var D=/\{(\d+)\}/g;var E=/^(\s?[\/>+~]\s?|\s|$)/;var F=/^(#)?([\w-\*]+)/;var G=/(\d*)n\+?(\d*)/,H=/\D/;function I(p,f){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==f){return n;}}
+this.html=A;};Roo.Template.prototype={applyTemplate:function(values){try{if(this.compiled){return this.compiled(values);}var useF=this.disableFormats!==true;var fm=Roo.util.Format,tpl=this;var fn=function(m,E,F,G){if(F&&useF){if(F.substr(0,5)=="this."){return tpl.call(F.substr(5),values[E],values);}else {if(G){var re=/^\s*['"](.*)["']\s*$/;G=G.split(',');for(var i=0,len=G.length;i<len;i++){G[i]=G[i].replace(re,"$1");}
+G=[values[E]].concat(G);}else {G=[values[E]];}return fm[F].apply(fm,G);}}else {return values[E]!==undefined?values[E]:"";}};return this.html.replace(this.re,fn);}catch(e){Roo.log(e);throw e;}},set:function(B,C){this.html=B;this.compiled=null;if(C){this.compile();}return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Roo.util.Format;var D=this.disableFormats!==true;var E=Roo.isGecko?"+":",";var fn=function(m,G,H,I){if(H&&D){I=I?','+I:"";if(H.substr(0,5)!="this."){H="fm."+H+'(';}else {H='this.call("'+H.substr(5)+'", ';I=", values";}}else {I='';H="(values['"+G+"'] == undefined ? '' : ";}return "'"+E+H+"values['"+G+"']"+I+")"+E+"'";};var F;if(Roo.isGecko){F="this.compiled = function(values){ return '"+this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {F=["this.compiled = function(values){ return ['"];F.push(this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));F.push("'].join('');};");F=F.join('');}eval(F);return this;},call:function(G,H,I){return this[G](H,I);},insertFirst:function(el,J,K){return this.doInsert('afterBegin',el,J,K);},insertBefore:function(el,L,M){return this.doInsert('beforeBegin',el,L,M);},insertAfter:function(el,N,O){return this.doInsert('afterEnd',el,N,O);},append:function(el,P,Q){return this.doInsert('beforeEnd',el,P,Q);},doInsert:function(R,el,S,T){el=Roo.getDom(el);var U=Roo.DomHelper.insertHtml(R,el,this.applyTemplate(S));return T?Roo.get(U,true):U;},overwrite:function(el,V,W){el=Roo.getDom(el);el.innerHTML=this.applyTemplate(V);return W?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 A={},simpleCache={},valueCache={};var B=/\S/;var C=/^\s+|\s+$/g;var D=/\{(\d+)\}/g;var E=/^(\s?[\/>+~]\s?|\s|$)/;var F=/^(#)?([\w-\*]+)/;var G=/(\d*)n\+?(\d*)/,H=/\D/;function I(p,T){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==T){return n;}}
 n=n.nextSibling;}return null;};function J(n){while((n=n.nextSibling)&&n.nodeType!=1);return n;};function K(n){while((n=n.previousSibling)&&n.nodeType!=1);return n;};function L(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!B.test(n.nodeValue)){d.removeChild(n);}else {n.nodeIndex=++ni;}
-n=nx;}return this;};function M(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 N(n,f){if(!n.tagName&&typeof n.length!="undefined"){n=n[0];}if(!n){return null;}if(f=="for"){return n.htmlFor;}if(f=="class"||f=="className"){return n.className;}return n.getAttribute(f)||n[f];};function O(ns,f,g){var h=[],ri=-1,cs;if(!ns){return h;}
-g=g||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns];}if(!f){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(g);for(var j=0,ci;ci=cs[j];j++){h[++ri]=ci;}}}else if(f=="/"||f==">"){var utag=g.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==utag||cj.nodeName==g||g=='*'){h[++ri]=cj;}}}}else if(f=="+"){var utag=g.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(n&&(n.nodeName==utag||n.nodeName==g||g=='*')){h[++ri]=n;}}}else if(f=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(g=='*'||n.tagName.toLowerCase()!=g)));if(n){h[++ri]=n;}}}return h;};function P(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 Q(cs,f){if(cs.tagName||cs==document){cs=[cs];}if(!f){return cs;}var r=[],ri=-1;f=f.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==f){r[++ri]=ci;}}return r;};function R(cs,f,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 S(cs,g,h,op,k){var r=[],ri=-1,st=k=="{";var f=Roo.DomQuery.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Roo.DomQuery.getStyle(ci,g);}else if(g=="class"||g=="className"){a=ci.className;}else if(g=="for"){a=ci.htmlFor;}else if(g=="href"){a=ci.getAttribute("href",2);}else {a=ci.getAttribute(g);}if((f&&f(a,h))||(!f&&a)){r[++ri]=ci;}}return r;};function T(cs,f,g){return Roo.DomQuery.pseudos[f](cs,g);};var U=window.ActiveXObject?true:false;var V=30803;var W=30803;function X(cs){var d=++W;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,len=cs.length;i<len;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c;}}for(var i=0,len=cs.length;i<len;i++){cs[i].removeAttribute("_nodup");}return r;}function Y(cs){if(!cs){return [];}var f=cs.length,c,i,r=cs,cj,ri=-1;if(!f||typeof cs.nodeType!="undefined"||f==1){return cs;}if(U&&typeof cs[0].selectSingleNode!="undefined"){return X(cs);}var d=++W;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 Z(c1,c2){var d=++W;for(var i=0,len=c1.length;i<len;i++){c1[i].setAttribute("_qdiff",d);}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i];}}for(var i=0,len=c1.length;i<len;i++){c1[i].removeAttribute("_qdiff");}return r;}function b(c1,c2){var f=c1.length;if(!f){return c2;}if(U&&c1[0].selectSingleNode){return Z(c1,c2);}var d=++W;for(var i=0;i<f;i++){c1[i]._qdiff=d;}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i];}}return r;}function e(ns,f,g,id){if(ns==g){var d=g.ownerDocument||g;return d.getElementById(id);}
-ns=O(ns,f,"*");return R(ns,null,id);}return {getStyle:function(el,AK){return Roo.fly(el).getStyle(AK);},compile:function(AL,AM){AM=AM||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];var q=AL,AN,lq;var tk=Roo.DomQuery.matchers;var AO=tk.length;var mm;var AP=q.match(E);if(AP&&AP[1]){fn[fn.length]='mode="'+AP[1].replace(C,"")+'";';q=q.replace(AP[1],"");}while(AL.substr(0,1)=="/"){AL=AL.substr(1);}while(q&&lq!=q){lq=q;var tm=q.match(F);if(AM=="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]+'");';}
+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,T){if(!n.tagName&&typeof n.length!="undefined"){n=n[0];}if(!n){return null;}if(T=="for"){return n.htmlFor;}if(T=="class"||T=="className"){return n.className;}return n.getAttribute(T)||n[T];};function getNodes(ns,T,U){var V=[],ri=-1,cs;if(!ns){return V;}
+U=U||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns];}if(!T){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(U);for(var j=0,ci;ci=cs[j];j++){V[++ri]=ci;}}}else if(T=="/"||T==">"){var utag=U.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==utag||cj.nodeName==U||U=='*'){V[++ri]=cj;}}}}else if(T=="+"){var utag=U.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(n&&(n.nodeName==utag||n.nodeName==U||U=='*')){V[++ri]=n;}}}else if(T=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(U=='*'||n.tagName.toLowerCase()!=U)));if(n){V[++ri]=n;}}}return V;};function M(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,T){if(cs.tagName||cs==document){cs=[cs];}if(!T){return cs;}var r=[],ri=-1;T=T.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==T){r[++ri]=ci;}}return r;};function N(cs,T,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,T,U,op,V){var r=[],ri=-1,st=V=="{";var f=Roo.DomQuery.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Roo.DomQuery.getStyle(ci,T);}else if(T=="class"||T=="className"){a=ci.className;}else if(T=="for"){a=ci.htmlFor;}else if(T=="href"){a=ci.getAttribute("href",2);}else {a=ci.getAttribute(T);}if((f&&f(a,U))||(!f&&a)){r[++ri]=ci;}}return r;};function byPseudo(cs,T,U){return Roo.DomQuery.pseudos[T](cs,U);};var O=window.ActiveXObject?true:false;var batch=30803;var P=30803;function Q(cs){var d=++P;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,len=cs.length;i<len;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c;}}for(var i=0,len=cs.length;i<len;i++){cs[i].removeAttribute("_nodup");}return r;}function nodup(cs){if(!cs){return [];}var T=cs.length,c,i,r=cs,cj,ri=-1;if(!T||typeof cs.nodeType!="undefined"||T==1){return cs;}if(O&&typeof cs[0].selectSingleNode!="undefined"){return Q(cs);}var d=++P;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 R(c1,c2){var d=++P;for(var i=0,len=c1.length;i<len;i++){c1[i].setAttribute("_qdiff",d);}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i];}}for(var i=0,len=c1.length;i<len;i++){c1[i].removeAttribute("_qdiff");}return r;}function S(c1,c2){var T=c1.length;if(!T){return c2;}if(O&&c1[0].selectSingleNode){return R(c1,c2);}var d=++P;for(var i=0;i<T;i++){c1[i]._qdiff=d;}var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i];}}return r;}function quickId(ns,T,U,id){if(ns==U){var d=U.ownerDocument||U;return d.getElementById(id);}
+ns=getNodes(ns,T,"*");return N(ns,null,id);}return {getStyle:function(el,AA){return Roo.fly(el).getStyle(AA);},compile:function(AB,AC){AC=AC||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];var q=AB,mode,lq;var tk=Roo.DomQuery.matchers;var AD=tk.length;var mm;var AE=q.match(E);if(AE&&AE[1]){fn[fn.length]='mode="'+AE[1].replace(C,"")+'";';q=q.replace(AE[1],"");}while(AB.substr(0,1)=="/"){AB=AB.substr(1);}while(q&&lq!=q){lq=q;var tm=q.match(F);if(AC=="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(E))){var matched=false;for(var j=0;j<AO;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(D,function(x,i){return m[i];});q=q.replace(m[0],"");matched=true;break;}}if(!matched){throw 'Error parsing selector, parsing failed at "'+q+'"';}}if(mm[1]){fn[fn.length]='mode="'+mm[1].replace(C,"")+'";';q=q.replace(mm[1],"");}}
-fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f;},select:function(AQ,AR,AS){if(!AR||AR==document){AR=document;}if(typeof AR=="string"){AR=document.getElementById(AR);}var AT=AQ.split(",");var AU=[];for(var i=0,len=AT.length;i<len;i++){var p=AT[i].replace(C,"");if(!A[p]){A[p]=Roo.DomQuery.compile(p);if(!A[p]){throw p+" is not a valid selector";}}var AJ=A[p](AR);if(AJ&&AJ!=document){AU=AU.concat(AJ);}}if(AT.length>1){return Y(AU);}return AU;},selectNode:function(AV,AW){return Roo.DomQuery.select(AV,AW)[0];},selectValue:function(AX,AY,AZ){AX=AX.replace(C,"");if(!valueCache[AX]){valueCache[AX]=Roo.DomQuery.compile(AX,"select");}var n=valueCache[AX](AY);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return ((v===null||v===undefined||v==='')?AZ:v);},selectNumber:function(Aa,Ab,Ac){var v=Roo.DomQuery.selectValue(Aa,Ab,Ac||0);return parseFloat(v);},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el);}var Ad=(el instanceof Array);var Ae=Roo.DomQuery.filter(Ad?el:[el],ss);return Ad?(Ae.length==el.length):(Ae.length>0);},filter:function(Af,ss,Ag){ss=ss.replace(C,"");if(!simpleCache[ss]){simpleCache[ss]=Roo.DomQuery.compile(ss,"simple");}var Ah=simpleCache[ss](Af);return Ag?b(Ah,Af):Ah;},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=G.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!H.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(V!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j;}}
-pn._batch=V;}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(!K(ci)&&!J(ci)){r[++ri]=ci;}}return r;},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break;}}if(empty){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=J(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=K(ci);if(n&&is(n,ss)){r[++ri]=ci;}}return r;}}};}();Roo.query=Roo.DomQuery.select;
+q=q.replace(tm[0],"");}}while(!(mm=q.match(E))){var matched=false;for(var j=0;j<AD;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(D,function(x,i){return m[i];});q=q.replace(m[0],"");matched=true;break;}}if(!matched){throw 'Error parsing selector, parsing failed at "'+q+'"';}}if(mm[1]){fn[fn.length]='mode="'+mm[1].replace(C,"")+'";';q=q.replace(mm[1],"");}}
+fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f;},select:function(AF,AG,AH){if(!AG||AG==document){AG=document;}if(typeof AG=="string"){AG=document.getElementById(AG);}var AI=AF.split(",");var AJ=[];for(var i=0,len=AI.length;i<len;i++){var p=AI[i].replace(C,"");if(!A[p]){A[p]=Roo.DomQuery.compile(p);if(!A[p]){throw p+" is not a valid selector";}}var z=A[p](AG);if(z&&z!=document){AJ=AJ.concat(z);}}if(AI.length>1){return nodup(AJ);}return AJ;},selectNode:function(AK,AL){return Roo.DomQuery.select(AK,AL)[0];},selectValue:function(AM,AN,AO){AM=AM.replace(C,"");if(!valueCache[AM]){valueCache[AM]=Roo.DomQuery.compile(AM,"select");}var n=valueCache[AM](AN);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return ((v===null||v===undefined||v==='')?AO:v);},selectNumber:function(AP,AQ,AR){var v=Roo.DomQuery.selectValue(AP,AQ,AR||0);return parseFloat(v);},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el);}var AS=(el instanceof Array);var AT=Roo.DomQuery.filter(AS?el:[el],ss);return AS?(AT.length==el.length):(AT.length>0);},filter:function(AU,ss,AV){ss=ss.replace(C,"");if(!simpleCache[ss]){simpleCache[ss]=Roo.DomQuery.compile(ss,"simple");}var AW=simpleCache[ss](AU);return AV?S(AW,AU):AW;},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=G.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!H.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(!K(ci)&&!J(ci)){r[++ri]=ci;}}return r;},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break;}}if(empty){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=J(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=K(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,C,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;}
@@ -134,7 +133,7 @@ this.anim({opacity:{to:(AY?1:0)}},this.preanim(arguments,1),null,.35,'easeIn',fu
 Roo.get(dom).setOpacity(1);}});}return this;},isDisplayed:function(){return this.getStyle("display")!="none";},toggle:function(Aa){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this;},setDisplayed:function(Ab){if(typeof Ab=="boolean"){Ab=Ab?this.originalDisplay:"none";}
 this.setStyle("display",Ab);return this;},focus:function(){try{this.dom.focus();}catch(e){}return this;},blur:function(){try{this.dom.blur();}catch(e){}return this;},addClass:function(Ac){if(Ac instanceof Array){for(var i=0,len=Ac.length;i<len;i++){this.addClass(Ac[i]);}}else {if(Ac&&!this.hasClass(Ac)){this.dom.className=this.dom.className+" "+Ac;}}return this;},radioClass:function(Ad){var Ae=this.dom.parentNode.childNodes;for(var i=0;i<Ae.length;i++){var s=Ae[i];if(s.nodeType==1){Roo.get(s).removeClass(Ad);}}
 this.addClass(Ad);return this;},removeClass:function(Af){if(!Af||!this.dom.className){return this;}if(Af instanceof Array){for(var i=0,len=Af.length;i<len;i++){this.removeClass(Af[i]);}}else {if(this.hasClass(Af)){var re=this.classReCache[Af];if(!re){re=new RegExp('(?:^|\\s+)'+Af+'(?:\\s+|$)',"g");this.classReCache[Af]=re;}
-this.dom.className=this.dom.className.replace(re," ");}}return this;},classReCache:{},toggleClass:function(Ag){if(this.hasClass(Ag)){this.removeClass(Ag);}else {this.addClass(Ag);}return this;},hasClass:function(Ah){return Ah&&(' '+this.dom.className+' ').indexOf(' '+Ah+' ')!=-1;},replaceClass:function(Ai,Aj){this.removeClass(Ai);this.addClass(Aj);return this;},getStyles:function(){var a=arguments,Ak=a.length,r={};for(var i=0;i<Ak;i++){r[a[i]]=this.getStyle(a[i]);}return r;},getStyle:function(){return G&&G.getComputedStyle?function(Al){var el=this.dom,v,cs,Am;if(Al=='float'){Al="cssFloat";}if(el.style&&(v=el.style[Al])){return v;}if(cs=G.getComputedStyle(el,"")){if(!(Am=B[Al])){Am=B[Al]=Al.replace(C,F);}return cs[Am];}return null;}:function(Al){var el=this.dom,v,cs,Am;if(Al=='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(Al=='float'){Al="styleFloat";}if(!(Am=B[Al])){Am=B[Al]=Al.replace(C,F);}if(v=el.style[Am]){return v;}if(cs=el.currentStyle){return cs[Am];}return null;};}(),setStyle:function(Al,Am){if(typeof Al=="string"){var camel;if(!(camel=B[Al])){camel=B[Al]=Al.replace(C,F);}if(camel=='opacity'){this.setOpacity(Am);}else {this.dom.style[camel]=Am;}}else {for(var style in Al){if(typeof Al[style]!="function"){this.setStyle(style,Al[style]);}}}return this;},applyStyles:function(An){Roo.DomHelper.applyStyles(this.dom,An);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,Ao){if(!Ao||!A){D.setX(this.dom,x);}else {this.setXY([x,this.getY()],this.preanim(arguments,1));}return this;},setY:function(y,Ap){if(!Ap||!A){D.setY(this.dom,y);}else {this.setXY([this.getX(),y],this.preanim(arguments,1));}return this;},setLeft:function(Aq){this.setStyle("left",this.addUnits(Aq));return this;},setTop:function(Ar){this.setStyle("top",this.addUnits(Ar));return this;},setRight:function(As){this.setStyle("right",this.addUnits(As));return this;},setBottom:function(At){this.setStyle("bottom",this.addUnits(At));return this;},setXY:function(Au,Av){if(!Av||!A){D.setXY(this.dom,Au);}else {this.anim({points:{to:Au}},this.preanim(arguments,1),'motion');}return this;},setLocation:function(x,y,Aw){this.setXY([x,y],this.preanim(arguments,2));return this;},moveTo:function(x,y,Ax){this.setXY([x,y],this.preanim(arguments,2));return this;},getRegion:function(){return D.getRegion(this.dom);},getHeight:function(Ay){var h=this.dom.offsetHeight||0;return Ay!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");},getWidth:function(Az){var w=this.dom.offsetWidth||0;return Az!==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(A0){return {width:this.getWidth(A0),height:this.getHeight(A0)};},getViewSize:function(){var d=this.dom,A1=document,aw=0,ah=0;if(d==A1||d==A1.body){return {width:D.getViewWidth(),height:D.getViewHeight()};}else {return {width:d.clientWidth,height:d.clientHeight};}},getValue:function(A2){return A2?parseInt(this.dom.value,10):this.dom.value;},adjustWidth:function(A3){if(typeof A3=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){A3-=(this.getBorderWidth("lr")+this.getPadding("lr"));}if(A3<0){A3=0;}}return A3;},adjustHeight:function(A4){if(typeof A4=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){A4-=(this.getBorderWidth("tb")+this.getPadding("tb"));}if(A4<0){A4=0;}}return A4;},setWidth:function(A5,A6){A5=this.adjustWidth(A5);if(!A6||!A){this.dom.style.width=this.addUnits(A5);}else {this.anim({width:{to:A5}},this.preanim(arguments,1));}return this;},setHeight:function(A7,A8){A7=this.adjustHeight(A7);if(!A8||!A){this.dom.style.height=this.addUnits(A7);}else {this.anim({height:{to:A7}},this.preanim(arguments,1));}return this;},setSize:function(A9,BA,BB){if(typeof A9=="object"){BA=A9.height;A9=A9.width;}
+this.dom.className=this.dom.className.replace(re," ");}}return this;},classReCache:{},toggleClass:function(Ag){if(this.hasClass(Ag)){this.removeClass(Ag);}else {this.addClass(Ag);}return this;},hasClass:function(Ah){return Ah&&(' '+this.dom.className+' ').indexOf(' '+Ah+' ')!=-1;},replaceClass:function(Ai,Aj){this.removeClass(Ai);this.addClass(Aj);return this;},getStyles:function(){var a=arguments,Ak=a.length,r={};for(var i=0;i<Ak;i++){r[a[i]]=this.getStyle(a[i]);}return r;},getStyle:function(){return G&&G.getComputedStyle?function(Al){var el=this.dom,v,cs,Am;if(Al=='float'){Al="cssFloat";}if(el.style&&(v=el.style[Al])){return v;}if(cs=G.getComputedStyle(el,"")){if(!(Am=B[Al])){Am=B[Al]=Al.replace(C,F);}return cs[Am];}return null;}:function(Al){var el=this.dom,v,cs,Am;if(Al=='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(Al=='float'){Al="styleFloat";}if(!(Am=B[Al])){Am=B[Al]=Al.replace(C,F);}if(v=el.style[Am]){return v;}if(cs=el.currentStyle){return cs[Am];}return null;};}(),setStyle:function(Al,Am){if(typeof Al=="string"){if(Al=='float'){this.setStyle(Roo.isIE?'styleFloat':'cssFloat',Am);return this;}var camel;if(!(camel=B[Al])){camel=B[Al]=Al.replace(C,F);}if(camel=='opacity'){this.setOpacity(Am);}else {this.dom.style[camel]=Am;}}else {for(var style in Al){if(typeof Al[style]!="function"){this.setStyle(style,Al[style]);}}}return this;},applyStyles:function(An){Roo.DomHelper.applyStyles(this.dom,An);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,Ao){if(!Ao||!A){D.setX(this.dom,x);}else {this.setXY([x,this.getY()],this.preanim(arguments,1));}return this;},setY:function(y,Ap){if(!Ap||!A){D.setY(this.dom,y);}else {this.setXY([this.getX(),y],this.preanim(arguments,1));}return this;},setLeft:function(Aq){this.setStyle("left",this.addUnits(Aq));return this;},setTop:function(Ar){this.setStyle("top",this.addUnits(Ar));return this;},setRight:function(As){this.setStyle("right",this.addUnits(As));return this;},setBottom:function(At){this.setStyle("bottom",this.addUnits(At));return this;},setXY:function(Au,Av){if(!Av||!A){D.setXY(this.dom,Au);}else {this.anim({points:{to:Au}},this.preanim(arguments,1),'motion');}return this;},setLocation:function(x,y,Aw){this.setXY([x,y],this.preanim(arguments,2));return this;},moveTo:function(x,y,Ax){this.setXY([x,y],this.preanim(arguments,2));return this;},getRegion:function(){return D.getRegion(this.dom);},getHeight:function(Ay){var h=this.dom.offsetHeight||0;return Ay!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");},getWidth:function(Az){var w=this.dom.offsetWidth||0;return Az!==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(A0){return {width:this.getWidth(A0),height:this.getHeight(A0)};},getViewSize:function(){var d=this.dom,A1=document,aw=0,ah=0;if(d==A1||d==A1.body){return {width:D.getViewWidth(),height:D.getViewHeight()};}else {return {width:d.clientWidth,height:d.clientHeight};}},getValue:function(A2){return A2?parseInt(this.dom.value,10):this.dom.value;},adjustWidth:function(A3){if(typeof A3=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){A3-=(this.getBorderWidth("lr")+this.getPadding("lr"));}if(A3<0){A3=0;}}return A3;},adjustHeight:function(A4){if(typeof A4=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){A4-=(this.getBorderWidth("tb")+this.getPadding("tb"));}if(A4<0){A4=0;}}return A4;},setWidth:function(A5,A6){A5=this.adjustWidth(A5);if(!A6||!A){this.dom.style.width=this.addUnits(A5);}else {this.anim({width:{to:A5}},this.preanim(arguments,1));}return this;},setHeight:function(A7,A8){A7=this.adjustHeight(A7);if(!A8||!A){this.dom.style.height=this.addUnits(A7);}else {this.anim({height:{to:A7}},this.preanim(arguments,1));}return this;},setSize:function(A9,BA,BB){if(typeof A9=="object"){BA=A9.height;A9=A9.width;}
 A9=this.adjustWidth(A9);BA=this.adjustHeight(BA);if(!BB||!A){this.dom.style.width=this.addUnits(A9);this.dom.style.height=this.addUnits(BA);}else {this.anim({width:{to:A9},height:{to:BA}},this.preanim(arguments,2));}return this;},setBounds:function(x,y,BC,BD,BE){if(!BE||!A){this.setSize(BC,BD);this.setLocation(x,y);}else {BC=this.adjustWidth(BC);BD=this.adjustHeight(BD);this.anim({points:{to:[x,y]},width:{to:BC},height:{to:BD}},this.preanim(arguments,4),'motion');}return this;},setRegion:function(BF,BG){this.setBounds(BF.left,BF.top,BF.right-BF.left,BF.bottom-BF.top,this.preanim(arguments,1));return this;},addListener:function(BH,fn,BI,BJ){Roo.EventManager.on(this.dom,BH,fn,BI||this,BJ);},removeListener:function(BK,fn){Roo.EventManager.removeListener(this.dom,BK,fn);return this;},removeAllListeners:function(){E.purgeElement(this.dom);return this;},relayEvent:function(BL,BM){this.on(BL,function(e){BM.fireEvent(BL,e);});},setOpacity:function(BN,BO){if(!BO||!A){var s=this.dom.style;if(Roo.isIE){s.zoom=1;s.filter=(s.filter||'').replace(/alpha\([^\)]*\)/gi,"")+(BN==1?"":"alpha(opacity="+BN*100+")");}else {s.opacity=BN;}}else {this.anim({opacity:{to:BN}},this.preanim(arguments,1),null,.35,'easeIn');}return this;},getLeft:function(BP){if(!BP){return this.getX();}else {return parseInt(this.getStyle("left"),10)||0;}},getRight:function(BQ){if(!BQ){return this.getX()+this.getWidth();}else {return (this.getLeft(true)+this.getWidth())||0;}},getTop:function(BR){if(!BR){return this.getY();}else {return parseInt(this.getStyle("top"),10)||0;}},getBottom:function(BS){if(!BS){return this.getY()+this.getHeight();}else {return (this.getTop(true)+this.getHeight())||0;}},position:function(BT,BU,x,y){if(!BT){if(this.getStyle('position')=='static'){this.setStyle('position','relative');}}else {this.setStyle("position",BT);}if(BU){this.setStyle("z-index",BU);}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(BV){BV=BV||'';this.setStyle({"left":BV,"right":BV,"top":BV,"bottom":BV,"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(BW){return this.addStyles(BW,El.borders);},getPadding:function(BX){return this.addStyles(BX,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(BY,BZ){this.dom.style.left=this.addUnits(BY);this.dom.style.top=this.addUnits(BZ);return this;},move:function(Ba,Bb,Bc){var xy=this.getXY();Ba=Ba.toLowerCase();switch(Ba){case "l":case "left":this.moveTo(xy[0]-Bb,xy[1],this.preanim(arguments,2));break;case "r":case "right":this.moveTo(xy[0]+Bb,xy[1],this.preanim(arguments,2));break;case "t":case "top":case "up":this.moveTo(xy[0],xy[1]-Bb,this.preanim(arguments,2));break;case "b":case "bottom":case "down":this.moveTo(xy[0],xy[1]+Bb,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(Bd,Be,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((Bd||"tl").toLowerCase()){case "c":x=r(w*.5);y=r(h*.5);break;case "t":x=r(w*.5);y=0;break;case "l":x=0;y=r(h*.5);break;case "r":x=w;y=r(h*.5);break;case "b":x=r(w*.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(Be===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 p1y=p1.charAt(0),p1x=p1.charAt(p1.length-1);var p2y=p2.charAt(0),p2x=p2.charAt(p2.length-1);var swapY=((p1y=="t"&&p2y=="b")||(p1y=="b"&&p2y=="t"));var swapX=((p1x=="r"&&p2x=="l")||(p1x=="l"&&p2x=="r"));var A1=document;var scrollX=(A1.documentElement.scrollLeft||A1.body.scrollLeft||0)+5;var scrollY=(A1.documentElement.scrollTop||A1.body.scrollTop||0)+5;if((x+w)>dw+scrollX){x=swapX?r.left-w:dw+scrollX-w;}if(x<scrollX){x=swapX?r.right:scrollX;}if((y+h)>dh+scrollY){y=swapY?r.top-h:dh+scrollY-h;}if(y<scrollY){y=swapY?r.bottom:scrollY;}}return [x,y];},getConstrainToXY:function(){var os={top:0,left:0,bottom:0,right:0};return function(el,Bf,Bg,Bh){el=Roo.get(el);Bg=Bg?Roo.applyIf(Bg,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(!Bf){var vxy=el.getXY();vx=vxy[0];vy=vxy[1];}}var s=el.getScroll();vx+=Bg.left+s.left;vy+=Bg.top+s.top;vw-=Bg.right;vh-=Bg.bottom;var vr=vx+vw;var vb=vy+vh;var xy=Bh||(!Bf?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 Bi=false;if((x+w)>vr){x=vr-w;Bi=true;}if((y+h)>vb){y=vb-h;Bi=true;}if(x<vx){x=vx;Bi=true;}if(y<vy){y=vy;Bi=true;}return Bi?[x,y]:false;};}(),adjustForConstraints:function(xy,Bf,Bg){return this.getConstrainToXY(Bf||document,false,Bg,xy)||xy;},alignTo:function(Bh,Bi,Bj,Bk){var xy=this.getAlignToXY(Bh,Bi,Bj);this.setXY(xy,this.preanim(arguments,3));return this;},anchorTo:function(el,Bl,Bm,Bn,Bo,Bp){var Bq=function(){this.alignTo(el,Bl,Bm,Bn);Roo.callback(Bp,this);};Roo.EventManager.onWindowResize(Bq,this);var tm=typeof Bo;if(tm!='undefined'){Roo.EventManager.on(window,'scroll',Bq,this,{buffer:tm=='number'?Bo:50});}
@@ -204,13 +203,13 @@ this.fireEvent("sort",this);},sort:function(Z,fn){this._sort("value",Z,fn);},key
 b=b||0;d=Math.min(typeof d=="undefined"?this.length-1:d,this.length-1);var r=[];if(b<=d){for(var i=b;i<=d;i++){r[r.length]=e[i];}}else {for(var i=b;i>=d;i--){r[r.length]=e[i];}}return r;},filter:function(f,g){if(!g.exec){g=String(g);if(g.length==0){return this.clone();}
 g=new RegExp("^"+Roo.escapeRe(g),"i");}return this.filterBy(function(o){return o&&g.test(o[f]);});},filterBy:function(fn,h){var r=new Roo.util.MixedCollection();r.getKey=this.getKey;var k=this.keys,it=this.items;for(var i=0,len=it.length;i<len;i++){if(fn.call(h||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,len=it.length;i<len;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 A={}.hasOwnProperty?true:false;var B=function(n){return n<10?"0"+n:n;};var m={"\b":'\\b',"\t":'\\t',"\n":'\\n',"\f":'\\f',"\r":'\\r','"':'\\"',"\\":'\\\\'};var C=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 D=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(',');}
+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 E=function(o){return '"'+o.getFullYear()+"-"+B(o.getMonth()+1)+"-"+B(o.getDate())+"T"+B(o.getHours())+":"+B(o.getMinutes())+":"+B(o.getSeconds())+'"';};this.encode=function(o){if(typeof o=="undefined"||o===null){return "null";}else if(o instanceof Array){return D(o);}else if(o instanceof Date){return E(o);}else if(typeof o=="string"){return C(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(!A||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case "undefined":case "function":case "unknown":break;default:if(b){a.push(',');}
+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(F){return eval("("+F+')');};})();Roo.encode=Roo.util.JSON.encode;Roo.decode=Roo.util.JSON.decode;
-Roo.util.Format=function(){var A=/^\s+|\s+$/g;return {ellipsis:function(S,T){if(S&&S.length>T){return S.substr(0,T-3)+"...";}return S;},undef:function(U){return typeof U!="undefined"?U:"";},htmlEncode:function(V){return !V?V:String(V).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");},htmlDecode:function(W){return !W?W:String(W).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"');},trim:function(X){return String(X).replace(A,"");},substr:function(Y,Z,a){return String(Y).substr(Z,a);},lowercase:function(b){return String(b).toLowerCase();},uppercase:function(c){return String(c).toUpperCase();},capitalize:function(d){return !d?d:d.charAt(0).toUpperCase()+d.substr(1).toLowerCase();},call:function(e,fn){if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);args.unshift(e);return eval(fn).apply(window,args);}else {return eval(fn).call(window,e);}},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 f=ps[0];var g=ps[1]?'.'+ps[1]:'.00';var r=/(\d+)(\d{3})/;while(r.test(f)){f=f.replace(r,'$1'+','+'$2');}return "$"+f+g;},date:function(v,h){if(!v){return "";}if(!(v instanceof Date)){v=new Date(Date.parse(v));}return v.dateFormat(h||"m/d/Y");},dateRenderer:function(i){return function(v){return Roo.util.Format.date(v,i);};},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return !v?v:String(v).replace(this.stripTagsRE,"");}};}();
+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(R,S){if(R&&R.length>S){return R.substr(0,S-3)+"...";}return R;},undef:function(T){return typeof T!="undefined"?T:"";},htmlEncode:function(U){return !U?U:String(U).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");},htmlDecode:function(V){return !V?V:String(V).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"');},trim:function(W){return String(W).replace(A,"");},substr:function(X,Y,Z){return String(X).substr(Y,Z);},lowercase:function(a){return String(a).toLowerCase();},uppercase:function(b){return String(b).toUpperCase();},capitalize:function(c){return !c?c:c.charAt(0).toUpperCase()+c.substr(1).toLowerCase();},call:function(value,fn){if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);args.unshift(value);return eval(fn).apply(window,args);}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 d=ps[0];var e=ps[1]?'.'+ps[1]:'.00';var r=/(\d+)(\d{3})/;while(r.test(d)){d=d.replace(r,'$1'+','+'$2');}return "$"+d+e;},date:function(v,f){if(!v){return "";}if(!(v instanceof Date)){v=new Date(Date.parse(v));}return v.dateFormat(f||"m/d/Y");},dateRenderer:function(g){return function(v){return Roo.util.Format.date(v,g);};},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 A=0;while(m=re.exec(this.html)){var name=m[1],content=m[2];st[A]={name:name,index:A,buffer:[],tpl:new Roo.Template(content)};if(name){st[name]=st[A];}
 st[A].tpl.compile();st[A].tpl.call=this.call.createDelegate(this);A++;}
 this.subCount=A;this.subs=st;};Roo.extend(Roo.MasterTemplate,Roo.Template,{subTemplateRe:/<tpl(?:\sname="([\w-]+)")?>((?:.|\n)*?)<\/tpl>/gi,add:function(B,C){if(arguments.length==1){C=arguments[0];B=0;}var s=this.subs[B];s.buffer[s.buffer.length]=s.tpl.apply(C);return this;},fill:function(D,E,F){var a=arguments;if(a.length==1||(a.length==2&&typeof a[1]=="boolean")){E=a[0];D=0;F=a[1];}if(F){this.reset();}for(var i=0,len=E.length;i<len;i++){this.add(D,E[i]);}return this;},reset:function(){var s=this.subs;for(var i=0;i<this.subCount;i++){s[i].buffer=[];}return this;},applyTemplate:function(G){var s=this.subs;var H=-1;this.html=this.originalHtml.replace(this.subTemplateRe,function(m,I){return s[++H].buffer.join("");});return Roo.MasterTemplate.superclass.applyTemplate.call(this,G);},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,I){el=Roo.getDom(el);return new Roo.MasterTemplate(el.value||el.innerHTML,I||'');};
@@ -331,9 +330,9 @@ this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.sc
 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(B,C,D,E,F){if(this.fireEvent("beforeload",this,B)!==false){var p=Roo.urlEncode(Roo.apply(B,this.extraParams));var url=this.url;url+=(url.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){url+="&_dc="+(new Date().getTime());}var transId=++Roo.data.ScriptTagProxy.TRANS_ID;var trans={id:transId,cb:"stcCallback"+transId,scriptId:"stcScript"+transId,params:B,arg:F,url:url,callback:D,scope:E,reader:C};var conn=this;window[trans.cb]=function(o){conn.handleResponse(o,trans);};url+=String.format("&{0}={1}",this.callbackParam,trans.cb);if(this.autoAbort!==false){this.abort();}
 trans.timeoutId=this.handleFailure.defer(this.timeout,this,[trans]);var script=document.createElement("script");script.setAttribute("src",url);script.setAttribute("type","text/javascript");script.setAttribute("id",trans.scriptId);this.head.appendChild(script);this.trans=trans;}else {D.call(E||this,null,F,false);}},isLoading:function(){return this.trans?true:false;},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans);}},destroyTrans:function(G,H){this.head.removeChild(document.getElementById(G.scriptId));clearTimeout(G.timeoutId);if(H){window[G.cb]=undefined;try{delete window[G.cb];}catch(e){}}else {window[G.cb]=function(){window[G.cb]=undefined;try{delete window[G.cb];}catch(e){}};}},handleResponse:function(o,I){this.trans=false;this.destroyTrans(I,true);var J;try{J=I.reader.readRecords(o);}catch(e){this.fireEvent("loadexception",this,o,trans.arg,e);trans.callback.call(trans.scope||window,null,trans.arg,false);return;}
 this.fireEvent("load",this,o,I.arg);I.callback.call(I.scope||window,J,I.arg,true);},handleFailure:function(K){this.trans=false;this.destroyTrans(K,false);this.fireEvent("loadexception",this,null,K.arg);K.callback.call(K.scope||window,null,K.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(C){var D=C.responseText;var o=eval("("+D+")");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(E,F,o){},simpleAccess:function(G,H){return G[H];},getJsonAccessor:function(){var re=/[\[\.]/;return function(I){try{return (re.test(I))?new Function("obj","return obj."+I):function(K){return K[I];};}catch(e){}return Roo.emptyFn;};}(),readRecords:function(o){this.jsonData=o;var s=this.meta,I=this.recordType,f=I.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(N){var r=g(N);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 map=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[i]=this.getJsonAccessor(map);}}var J=this.getRoot(o),c=J.length,K=c,L=true;if(s.totalProperty){var v=parseInt(this.getTotal(o),10);if(!isNaN(v)){K=v;}}if(s.successProperty){var v=this.getSuccess(o);if(v===false||v==='false'){L=false;}}var M=[];for(var i=0;i<c;i++){var n=J[i];var values={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);values[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var record=new I(values,id);record.json=n;M[i]=record;}return {success:L,records:M,totalRecords:K};}});
+Roo.data.JsonReader=function(meta,recordType){meta=meta||{};Roo.applyIf(meta,{totalProperty:'total',successProperty:'success',root:'data',id:'id'});Roo.data.JsonReader.superclass.constructor.call(this,meta,recordType||meta.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(meta,recordType,o){},simpleAccess:function(obj,subsc){return obj[subsc];},getJsonAccessor:function(){var re=/[\[\.]/;return function(expr){try{return (re.test(expr))?new Function("obj","return obj."+expr):function(obj){return obj[expr];};}catch(e){}return Roo.emptyFn;};}(),readRecords:function(o){this.jsonData=o;var s=this.meta,Record=this.recordType,f=Record.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(rec){var r=g(rec);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 map=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[i]=this.getJsonAccessor(map);}}var root=this.getRoot(o),c=root.length,totalRecords=c,success=true;if(s.totalProperty){var v=parseInt(this.getTotal(o),10);if(!isNaN(v)){totalRecords=v;}}if(s.successProperty){var v=this.getSuccess(o);if(v===false||v==='false'){success=false;}}var records=[];for(var i=0;i<c;i++){var n=root[i];var values={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);values[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var record=new Record(values,id);record.json=n;records[i]=record;}return {success:success,records:records,totalRecords:totalRecords};}});
 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(C){var D=C.responseXML;if(!D){throw {message:"XmlReader.read: XML Document not available"};}return this.readRecords(D);},readRecords:function(E){this.xmlData=E;var F=E.documentElement||E;var q=Roo.DomQuery;var G=this.recordType,H=G.prototype.fields;var I=this.meta.id;var J=0,K=true;if(this.meta.totalRecords){J=q.selectNumber(this.meta.totalRecords,F,0);}if(this.meta.success){var sv=q.selectValue(this.meta.success,F,true);K=sv!==false&&sv!=='false';}var L=[];var ns=q.select(this.meta.record,F);for(var i=0,len=ns.length;i<len;i++){var n=ns[i];var values={};var id=I?q.selectValue(I,n):undefined;for(var j=0,jlen=H.length;j<jlen;j++){var f=H.items[j];var v=q.selectValue(f.mapping||f.name,n,f.defaultValue);v=f.convert(v);values[f.name]=v;}var record=new G(values,id);record.node=n;L[L.length]=record;}return {success:K,records:L,totalRecords:J||L.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 C=this.meta?this.meta.id:null;var D=this.recordType,E=D.prototype.fields;var F=[];var G=o;for(var i=0;i<G.length;i++){var n=G[i];var values={};var id=((C||C===0)&&n[C]!==undefined&&n[C]!==""?n[C]:null);for(var j=0,jlen=E.length;j<jlen;j++){var f=E.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);values[f.name]=v;}var record=new D(values,id);record.json=n;F[F.length]=record;}return {records:F,totalRecords:F.length};}});
 Roo.data.Tree=function(A){this.nodeHash={};this.root=null;if(A){this.setRootNode(A);}
@@ -390,9 +389,8 @@ this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(tr
 this.dragSpecs.startSize=F;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 G=Roo.lib.Event.getXY(e);if(this.overlay){this.overlay.hide();}var H;if(this.orientation==Roo.SplitBar.HORIZONTAL){H=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.LEFT?G[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-G[0]);}else {H=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.TOP?G[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-G[1]);}
 H=Math.min(Math.max(H,this.activeMinSize),this.activeMaxSize);if(H!=this.dragSpecs.startSize){if(this.fireEvent('beforeapply',this,H)!==false){this.adapter.setElementSize(this,H);this.fireEvent("moved",this,H);this.fireEvent("resize",this,H);}}},getAdapter:function(){return this.adapter;},setAdapter:function(I){this.adapter=I;this.adapter.init(this);},getMinimumSize:function(){return this.minSize;},setMinimumSize:function(J){this.minSize=J;},getMaximumSize:function(){return this.maxSize;},setMaximumSize:function(K){this.maxSize=K;},setCurrentSize:function(L){var M=this.animate;this.animate=false;this.adapter.setElementSize(this,L);this.animate=M;},destroy:function(N){if(this.shim){this.shim.remove();}
 this.dd.unreg();this.proxy.parentNode.removeChild(this.proxy);if(N){this.el.remove();}}});Roo.SplitBar.createProxy=function(O){var P=new Roo.Element(document.createElement("div"));P.unselectable();var Q='x-splitbar-proxy';P.addClass(Q+' '+(O==Roo.SplitBar.HORIZONTAL?Q+'-h':Q+'-v'));document.body.appendChild(P.dom);return P.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,R,S){if(s.orientation==Roo.SplitBar.HORIZONTAL){if(!s.animate){s.resizingEl.setWidth(R);if(S){S(s,R);}}else {s.resizingEl.setWidth(R,true,.1,S,'easeOut');}}else {if(!s.animate){s.resizingEl.setHeight(R);if(S){S(s,R);}}else {s.resizingEl.setHeight(R,true,.1,S,'easeOut');}}}};Roo.SplitBar.AbsoluteLayoutAdapter=function(T){this.basic=new Roo.SplitBar.BasicLayoutAdapter();this.container=Roo.get(T);};Roo.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(s){this.basic.init(s);},getElementSize:function(s){return this.basic.getElementSize(s);},setElementSize:function(s,U,V){this.basic.setElementSize(s,U,this.moveSplitter.createDelegate(this,[s]));},moveSplitter:function(s){var W=Roo.SplitBar;switch(s.placement){case W.LEFT:s.el.setX(s.resizingEl.getRight());break;case W.RIGHT:s.el.setStyle("right",(this.container.getWidth()-s.resizingEl.getLeft())+"px");break;case W.TOP:s.el.setY(s.resizingEl.getBottom());break;case W.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(A,B,C){this.el=Roo.get(A);if(typeof B=="string"){B=new Roo.Template(B);}
-B.compile();this.tpl=B;Roo.apply(this,C);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 D=[];var E=this.store.getRange();if(E.length<1){this.el.update(this.emptyText);return;}for(var i=0,len=E.length;i<len;i++){var data=this.prepareData(E[i].data,i,E[i]);D[D.length]=t.apply(data);}
+Roo.View=function(A,B,C){if(typeof(B)=='undefined'){Roo.apply(this,A);this.el=Roo.get(this.el);}else {this.el=Roo.get(A);this.tpl=B;Roo.apply(this,C);}if(typeof(this.tpl)=="string"){this.tpl=new Roo.Template(this.tpl);}this.tpl.compile();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,{store:false,el:'',tpl:false,selectedClass:"x-view-selected",emptyText:"",getEl:function(){return this.el;},refresh:function(){var t=this.tpl;this.clearSelections();this.el.update("");var D=[];var E=this.store.getRange();if(E.length<1){this.el.update(this.emptyText);return;}for(var i=0,len=E.length;i<len;i++){var data=this.prepareData(E[i].data,i,E[i]);D[D.length]=t.apply(data);}
 this.el.update(D.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0);},prepareData:function(F){return F;},onUpdate:function(ds,G){this.clearSelections();var H=this.store.indexOf(G);var n=this.nodes[H];this.tpl.insertBefore(n,this.prepareData(G.data));n.parentNode.removeChild(n);this.updateIndexes(H,H);},onAdd:function(ds,I,J){this.clearSelections();if(this.nodes.length==0){this.refresh();return;}var n=this.nodes[J];for(var i=0,len=I.length;i<len;i++){var d=this.prepareData(I[i].data);if(n){this.tpl.insertBefore(n,d);}else {this.tpl.append(this.el,d);}}
 this.updateIndexes(J);},onRemove:function(ds,K,L){this.clearSelections();this.el.dom.removeChild(this.nodes[L]);this.updateIndexes(L);},refreshNode:function(M){this.onUpdate(this.store,this.store.getAt(M));},updateIndexes:function(N,O){var ns=this.nodes;N=N||0;O=O||ns.length-1;for(var i=N;i<=O;i++){ns[i].nodeIndex=i;}},setStore:function(P,Q){if(!Q&&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(P){P.on("datachanged",this.refresh,this);P.on("add",this.onAdd,this);P.on("remove",this.onRemove,this);P.on("update",this.onUpdate,this);P.on("clear",this.refresh,this);}if(P){this.refresh();}},findItemFromChild:function(R){var el=this.el.dom;if(!R||R.parentNode==el){return R;}var p=R.parentNode;while(p&&p!=el){if(p.parentNode==el){return p;}
 p=p.parentNode;}return null;},onClick:function(e){var S=this.findItemFromChild(e.getTarget());if(S){var M=this.indexOf(S);if(this.onItemClick(S,M,e)!==false){this.fireEvent("click",this,M,S,e);}}else {this.clearSelections();}},onContextMenu:function(e){var T=this.findItemFromChild(e.getTarget());if(T){this.fireEvent("contextmenu",this,this.indexOf(T),T,e);}},onDblClick:function(e){var U=this.findItemFromChild(e.getTarget());if(U){this.fireEvent("dblclick",this,this.indexOf(U),U,e);}},onItemClick:function(V,W,e){if(this.fireEvent("beforeclick",this,W,V,e)===false){return false;}if(this.multiSelect||this.singleSelect){if(this.multiSelect&&e.shiftKey&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),W),false);}else {this.select(V,this.multiSelect&&e.ctrlKey);this.lastSelection=V;}
@@ -577,8 +575,8 @@ this.anchor=cs[h];this.textNode=cs[h].firstChild;},getAnchor:function(){return t
 p=p.parentNode;}
 this.childIndent=g.join("");}return this.childIndent;},renderIndent:function(){if(this.rendered){var indent="";var p=this.node.parentNode;if(p){indent=p.ui.getChildIndent();}if(this.indentMarkup!=indent){this.indentNode.innerHTML=indent;this.indentMarkup=indent;}
 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 Z=this.node.ownerTree.innerCt.dom;this.node.expanded=true;Z.innerHTML='<div class="x-tree-root-node"></div>';this.wrap=this.ctNode=Z.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,"create":true});Roo.tree.TreeLoader.superclass.constructor.call(this);};Roo.extend(Roo.tree.TreeLoader,Roo.util.Observable,{uiProviders:{},clearOnLoad:true,root:false,queryParam:false,load:function(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,len=cs.length;i<len;i++){B.appendChild(this.createNode(cs[i]));}if(typeof C=="function"){C();}}else if(this.dataUrl){this.requestData(B,C);}},getParams:function(D){var E=[],bp=this.baseParams;for(var key in bp){if(typeof bp[key]!="function"){E.push(encodeURIComponent(key),"=",encodeURIComponent(bp[key]),"&");}}var n=this.queryParam===false?'node':this.queryParam;E.push(n+"=",encodeURIComponent(D.id));return E.join("");},requestData:function(F,G){if(this.fireEvent("beforeload",this,F,G)!==false){this.transId=Roo.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:G,node:F},params:this.getParams(F)});}else {if(typeof G=="function"){G();}}},isLoading:function(){return this.transId?true:false;},abort:function(){if(this.isLoading()){Roo.Ajax.abort(this.transId);}},createNode:function(H){if(this.baseAttrs){Roo.applyIf(H,this.baseAttrs);}if(this.applyLoader!==false){H.loader=this;}if(typeof(H.uiProvider)=='string'){H.uiProvider=this.uiProviders[H.uiProvider]||eval(H.uiProvider);}if(typeof(this.uiProviders['default'])!='undefined'){H.uiProvider=this.uiProviders['default'];}
-this.fireEvent('create',this,H);H.leaf=typeof(H.leaf)=='string'?H.leaf*1:H.leaf;return (H.leaf?new Roo.tree.TreeNode(H):new Roo.tree.AsyncTreeNode(H));},processResponse:function(I,J,K){var L=I.responseText;try{var o=eval("("+L+")");if(this.root!==false){o=o[this.root];}for(var i=0,len=o.length;i<len;i++){var n=this.createNode(o[i]);if(n){J.appendChild(n);}}if(typeof K=="function"){K(this,J);}}catch(e){this.handleFailure(response);}},handleResponse:function(M){this.transId=false;var a=M.argument;this.processResponse(M,a.node,a.callback);this.fireEvent("load",this,a.node,M);},handleFailure:function(N){this.transId=false;var a=N.argument;this.fireEvent("loadexception",this,a.node,N);if(typeof a.callback=="function"){a.callback(this,a.node);}}});
+Roo.tree.TreeLoader=function(A){this.baseParams={};this.requestMethod="POST";Roo.apply(this,A);this.addEvents({beforeload:true,load:true,loadexception:true,create:true});Roo.tree.TreeLoader.superclass.constructor.call(this);};Roo.extend(Roo.tree.TreeLoader,Roo.util.Observable,{uiProviders:{},clearOnLoad:true,root:false,queryParam:false,load:function(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,len=cs.length;i<len;i++){B.appendChild(this.createNode(cs[i]));}if(typeof C=="function"){C();}}else if(this.dataUrl){this.requestData(B,C);}},getParams:function(D){var E=[],bp=this.baseParams;for(var key in bp){if(typeof bp[key]!="function"){E.push(encodeURIComponent(key),"=",encodeURIComponent(bp[key]),"&");}}var n=this.queryParam===false?'node':this.queryParam;E.push(n+"=",encodeURIComponent(D.id));return E.join("");},requestData:function(F,G){if(this.fireEvent("beforeload",this,F,G)!==false){this.transId=Roo.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:G,node:F},params:this.getParams(F)});}else {if(typeof G=="function"){G();}}},isLoading:function(){return this.transId?true:false;},abort:function(){if(this.isLoading()){Roo.Ajax.abort(this.transId);}},createNode:function(attr){if(this.baseAttrs){Roo.applyIf(attr,this.baseAttrs);}if(this.applyLoader!==false){attr.loader=this;}if(typeof(attr.uiProvider)=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}if(typeof(this.uiProviders['default'])!='undefined'){attr.uiProvider=this.uiProviders['default'];}
+this.fireEvent('create',this,attr);attr.leaf=typeof(attr.leaf)=='string'?attr.leaf*1:attr.leaf;return (attr.leaf?new Roo.tree.TreeNode(attr):new Roo.tree.AsyncTreeNode(attr));},processResponse:function(H,I,J){var K=H.responseText;try{var o=eval("("+K+")");if(this.root!==false){o=o[this.root];}for(var i=0,len=o.length;i<len;i++){var n=this.createNode(o[i]);if(n){I.appendChild(n);}}if(typeof J=="function"){J(this,I);}}catch(e){this.handleFailure(response);}},handleResponse:function(L){this.transId=false;var a=L.argument;this.processResponse(L,a.node,a.callback);this.fireEvent("load",this,a.node,L);},handleFailure:function(M){this.transId=false;var a=M.argument;this.fireEvent("loadexception",this,a.node,M);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,D,E){D=D||"text";var f;if(typeof C=="string"){var vlen=C.length;if(vlen==0&&this.clearBlank){this.clear();return;}
 C=C.toLowerCase();f=function(n){return n.attributes[D].substr(0,vlen).toLowerCase()==C;};}else if(C.exec){f=function(n){return C.test(n.attributes[D]);};}else {throw 'Illegal filter type, must be string or regex';}
 this.filterBy(f,null,E);},filterBy:function(fn,F,G){G=G||this.tree.root;if(this.autoClear){this.clear();}var af=this.filtered,rv=this.reverse;var f=function(n){if(n==G){return true;}if(af[n.id]){return false;}var m=fn.call(F||n,n);if(!m||rv){af[n.id]=n;n.ui.hide();return false;}return true;};G.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();}}}
@@ -676,7 +674,7 @@ this.innerList.update(this.loadingText?'<div class="loading-indicator">'+this.lo
 this.value='';this.setRawValue('');this.lastSelectionText='';this.applyEmptyText();},setValue:function(v){var G=v;if(this.valueField){var r=this.findRecord(this.valueField,v);if(r){G=r.data[this.displayField];}else if(this.valueNotFoundText!==undefined){G=this.valueNotFoundText;}}
 this.lastSelectionText=G;if(this.hiddenField){this.hiddenField.value=v;}
 Roo.form.ComboBox.superclass.setValue.call(this,G);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(H,I){var J;if(this.store.getCount()>0){this.store.each(function(r){if(r.data[H]==I){J=r;return false;}});}return J;},onViewMove:function(e,t){this.inKeyMode=false;},onViewOver:function(e,t){if(this.inKeyMode){return;}var K=this.view.findItemFromChild(t);if(K){var F=this.view.indexOf(K);this.select(F,false);}},onViewClick:function(L){var M=this.view.getSelectedIndexes()[0];var r=this.store.getAt(M);if(r){this.onSelect(r,M);}if(L!==false&&!this.blockFocus){this.el.focus();}},restrictHeight:function(){this.innerList.dom.style.height='';var N=this.innerList.dom;var h=Math.max(N.clientHeight,N.offsetHeight,N.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,O){if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),O);return true;}}return false;},select:function(P,Q){this.selectedIndex=P;this.view.select(P);if(Q!==false){var el=this.view.getNode(P);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,R){if(q===undefined||q===null){q='';}var qe={query:q,forceAll:R,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
+this.lastSelectionText=dv;Roo.form.ComboBox.superclass.setValue.call(this,dv);this.value=vv;},reset:function(){this.setValue(this.originalValue);this.clearInvalid();this.lastData=false;},findRecord:function(H,I){var J;if(this.store.getCount()>0){this.store.each(function(r){if(r.data[H]==I){J=r;return false;}});}return J;},onViewMove:function(e,t){this.inKeyMode=false;},onViewOver:function(e,t){if(this.inKeyMode){return;}var K=this.view.findItemFromChild(t);if(K){var F=this.view.indexOf(K);this.select(F,false);}},onViewClick:function(L){var M=this.view.getSelectedIndexes()[0];var r=this.store.getAt(M);if(r){this.onSelect(r,M);}if(L!==false&&!this.blockFocus){this.el.focus();}},restrictHeight:function(){this.innerList.dom.style.height='';var N=this.innerList.dom;var h=Math.max(N.clientHeight,N.offsetHeight,N.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,O){if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),O);return true;}}return false;},select:function(P,Q){this.selectedIndex=P;this.view.select(P);if(Q!==false){var el=this.view.getNode(P);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,R){if(q===undefined||q===null){q='';}var qe={query:q,forceAll:R,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}
 q=qe.query;R=qe.forceAll;if(R===true||(q.length>=this.minChars)){if(this.lastQuery!=q){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(R){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;}
@@ -715,9 +713,12 @@ this.tb.el.hide();this.tb=this.toolbars[tn];this.tb.el.show();this.tb.fields.eac
 I.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(I){I.enable();});},buildToolbar:function(I,nm){var J=this.editor;var K=J.wrap.createChild({tag:'div'},J.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(K);tb.add(nm+":&nbsp;");for(var i in I){var item=I[i];tb.add(item.title+":&nbsp;");if(item.opts){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val'],data:item.opts}),name:i,displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:item.width?item.width:130,listeners:{'select':function(c,r,i){tb.selectedNode.setAttribute(c.name,r.get('val'));}}}));continue;tb.addField(new Roo.form.TextField({name:i,width:100,value:''}));continue;}
 tb.addField(new Roo.form.TextField({name:i,width:item.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 B=true;this.items.each(function(f){if(!f.validate()){B=false;}});return B;},isDirty:function(){var C=false;this.items.each(function(f){if(f.isDirty()){C=true;return false;}});return C;},doAction:function(D,E){if(typeof D=='string'){D=new Roo.form.Action.ACTION_TYPES[D](this,E);}if(this.fireEvent('beforeaction',this,D)!==false){this.beforeAction(D);D.run.defer(100,D);}return this;},submit:function(F){this.doAction('submit',F);return this;},load:function(G){this.doAction('load',G);return this;},updateRecord:function(H){H.beginEdit();var fs=H.fields;fs.each(function(f){var I=this.findField(f.name);if(I){H.set(f.name,I.getValue());}},this);H.endEdit();return this;},loadRecord:function(I){this.setValues(I.data);return this;},beforeAction:function(J){var o=J.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(K,L){this.activeAction=null;var o=K.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(L){if(o.reset){this.reset();}
-Roo.callback(o.success,o.scope,[this,K]);this.fireEvent('actioncomplete',this,K);}else {Roo.callback(o.failure,o.scope,[this,K]);this.fireEvent('actionfailed',this,K);}},findField:function(id){var M=this.items.get(id);if(!M){this.items.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){M=f;return false;}});}return M||null;},markInvalid:function(N){if(N instanceof Array){for(var i=0,len=N.length;i<len;i++){var fieldError=N[i];var f=this.findField(fieldError.id);if(f){f.markInvalid(fieldError.msg);}}}else {var M,id;for(id in N){if(typeof N[id]!='function'&&(M=this.findField(id))){M.markInvalid(N[id]);}}}return this;},setValues:function(O){if(O instanceof Array){for(var i=0,len=O.length;i<len;i++){var v=O[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else {var M,id;for(id in O){if(typeof O[id]!='function'&&(M=this.findField(id))){if(M.setFromData&&M.valueField&&M.displayField&&(M.store&&!M.store.isLocal)){var sd={};sd[M.valueField]=typeof(O[M.hiddenName])=='undefined'?'':O[M.hiddenName];sd[M.displayField]=typeof(O[M.name])=='undefined'?'':O[M.name];M.setFromData(sd);}else {M.setValue(O[id]);}if(this.trackResetOnLoad){M.originalValue=M.getValue();}}}}return this;},getValues:function(P){var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(P===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(Q){this.items.remove(Q);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.BasicForm=function(el,A){this.allItems=[];this.childForms=[];Roo.apply(this,A);this.items=new Roo.util.MixedCollection(false,function(o){return o.id||(o.id=Roo.id());});this.addEvents({beforeaction:true,actionfailed:true,actioncomplete:true});if(el){this.initEl(el);}
+Roo.form.BasicForm.superclass.constructor.call(this);};Roo.extend(Roo.form.BasicForm,Roo.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,childForms:false,allItems:false,waitMsgTarget: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 B=true;this.items.each(function(f){if(!f.validate()){B=false;}});return B;},isDirty:function(){var C=false;this.items.each(function(f){if(f.isDirty()){C=true;return false;}});return C;},doAction:function(D,E){if(typeof D=='string'){D=new Roo.form.Action.ACTION_TYPES[D](this,E);}if(this.fireEvent('beforeaction',this,D)!==false){this.beforeAction(D);D.run.defer(100,D);}return this;},submit:function(F){this.doAction('submit',F);return this;},load:function(G){this.doAction('load',G);return this;},updateRecord:function(H){H.beginEdit();var fs=H.fields;fs.each(function(f){var I=this.findField(f.name);if(I){H.set(f.name,I.getValue());}},this);H.endEdit();return this;},loadRecord:function(I){this.setValues(I.data);return this;},beforeAction:function(J){var o=J.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(K,L){this.activeAction=null;var o=K.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(L){if(o.reset){this.reset();}
+Roo.callback(o.success,o.scope,[this,K]);this.fireEvent('actioncomplete',this,K);}else {Roo.callback(o.failure,o.scope,[this,K]);this.fireEvent('actionfailed',this,K);}},findField:function(id){var M=this.items.get(id);if(!M){this.items.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){M=f;return false;}});}return M||null;},addForm:function(N){this.childForms.push(N);Roo.each(N.allItems,function(fe){if(this.findField(fe.name)){return;}
+this.add(new Roo.form.Hidden({name:fe.name}));},this);},markInvalid:function(O){if(O instanceof Array){for(var i=0,len=O.length;i<len;i++){var fieldError=O[i];var f=this.findField(fieldError.id);if(f){f.markInvalid(fieldError.msg);}}}else {var M,id;for(id in O){if(typeof O[id]!='function'&&(M=this.findField(id))){M.markInvalid(O[id]);}}}
+Roo.each(this.childForms||[],function(f){f.markInvalid(O);});return this;},setValues:function(P){if(P instanceof Array){for(var i=0,len=P.length;i<len;i++){var v=P[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else {var M,id;for(id in P){if(typeof P[id]!='function'&&(M=this.findField(id))){if(M.setFromData&&M.valueField&&M.displayField&&(M.store&&!M.store.isLocal)){var sd={};sd[M.valueField]=typeof(P[M.hiddenName])=='undefined'?'':P[M.hiddenName];sd[M.displayField]=typeof(P[M.name])=='undefined'?'':P[M.name];M.setFromData(sd);}else {M.setValue(P[id]);}if(this.trackResetOnLoad){M.originalValue=M.getValue();}}}}
+Roo.each(this.childForms||[],function(f){f.setValues(P);});return this;},getValues:function(Q){if(this.childForms){Roo.each(this.childForms,function(f){if(f.allFields){Roo.each(f.allFields,function(e){if(e.name&&e.getValue&&this.findField(e.name)){this.findField(e.name).setValue(e.getValue());}});}},this);}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(Q===true){return fs;}return Roo.urlDecode(fs);},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();});return this;},reset:function(){this.items.each(function(f){f.reset();});Roo.each(this.childForms||[],function(f){f.reset();});return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this;},remove:function(R){this.items.remove(R);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 C=new Roo.form.Column(c);this.start(C);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return C;},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;}
@@ -816,7 +817,7 @@ this.closable=false;this.loaded=false;this.active=false;if(typeof A=="string"){t
 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(C){this.region=C;if(C){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(D){this.active=D;if(!D){this.fireEvent("deactivate",this);}else {this.fireEvent("activate",this);}},setContent:function(E,F){this.el.update(E,F);},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(G,H,I){if(this.refreshDelegate){this.removeListener("activate",this.refreshDelegate);}
-this.refreshDelegate=this._handleRefresh.createDelegate(this,[G,H,I]);this.on("activate",this.refreshDelegate);return this.el.getUpdateManager();},_handleRefresh:function(J,K,L){if(!L||!this.loaded){var updater=this.el.getUpdateManager();updater.update(J,K,this._setLoaded.createDelegate(this));}},_setLoaded:function(){this.loaded=true;},getId:function(){return this.el.id;},getEl:function(){return this.wrapEl||this.el;},adjustForComponents:function(M,N){if(this.resizeEl!=this.el){M-=this.el.getFrameWidth('lr');N-=this.el.getFrameWidth('tb');}if(this.toolbar){var te=this.toolbar.getEl();N-=te.getHeight();te.setWidth(M);}if(this.adjustments){M+=this.adjustments[0];N+=this.adjustments[1];}return {"width":M,"height":N};},setSize:function(O,P){if(this.fitToFrame&&!this.ignoreResize(O,P)){if(this.fitContainer&&this.resizeEl!=this.el){this.el.setSize(O,P);}var size=this.adjustForComponents(O,P);this.resizeEl.setSize(this.autoWidth?"auto":size.width,this.autoHeight?"auto":size.height);this.fireEvent('resize',this,size.width,size.height);}},getTitle:function(){return this.title;},setTitle:function(Q){this.title=Q;if(this.region){this.region.updatePanelTitle(this,Q);}},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 R=document.createElement("span");R.appendChild(this.el.dom);R.innerHTML="";this.el.remove();this.el=null;},addxtype:function(S){if(!S.xtype.match(/^Form$/)){return false;}var el=this.el.createChild();this.form=new Roo.form.Form(S);if(this.form.allItems.length)this.form.render(el.dom);return this.form;}});Roo.GridPanel=function(T,U){this.wrapper=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-grid-wrapper x-layout-inactive-content"},true);this.wrapper.dom.appendChild(T.getGridEl().dom);Roo.GridPanel.superclass.constructor.call(this,this.wrapper,U);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);}
+this.refreshDelegate=this._handleRefresh.createDelegate(this,[G,H,I]);this.on("activate",this.refreshDelegate);return this.el.getUpdateManager();},_handleRefresh:function(J,K,L){if(!L||!this.loaded){var updater=this.el.getUpdateManager();updater.update(J,K,this._setLoaded.createDelegate(this));}},_setLoaded:function(){this.loaded=true;},getId:function(){return this.el.id;},getEl:function(){return this.wrapEl||this.el;},adjustForComponents:function(M,N){if(this.resizeEl!=this.el){M-=this.el.getFrameWidth('lr');N-=this.el.getFrameWidth('tb');}if(this.toolbar){var te=this.toolbar.getEl();N-=te.getHeight();te.setWidth(M);}if(this.adjustments){M+=this.adjustments[0];N+=this.adjustments[1];}return {"width":M,"height":N};},setSize:function(O,P){if(this.fitToFrame&&!this.ignoreResize(O,P)){if(this.fitContainer&&this.resizeEl!=this.el){this.el.setSize(O,P);}var size=this.adjustForComponents(O,P);this.resizeEl.setSize(this.autoWidth?"auto":size.width,this.autoHeight?"auto":size.height);this.fireEvent('resize',this,size.width,size.height);}},getTitle:function(){return this.title;},setTitle:function(Q){this.title=Q;if(this.region){this.region.updatePanelTitle(this,Q);}},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 R=document.createElement("span");R.appendChild(this.el.dom);R.innerHTML="";this.el.remove();this.el=null;},addxtype:function(S){if(S.xtype.match(/^Form$/)){var el=this.el.createChild();this.form=new Roo.form.Form(S);if(this.form.allItems.length)this.form.render(el.dom);return this.form;}if(['View','JsonView'].indexOf(S.xtype)>-1){S.el=this.el;var ret=new Roo[S.xtype](S);ret.render(false,'');return ret;}return false;}});Roo.GridPanel=function(T,U){this.wrapper=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-grid-wrapper x-layout-inactive-content"},true);this.wrapper.dom.appendChild(T.getGridEl().dom);Roo.GridPanel.superclass.constructor.call(this,this.wrapper,U);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);}
 T.monitorWindowResize=false;T.autoHeight=false;T.autoWidth=false;this.grid=T;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(V,W){if(!this.ignoreResize(V,W)){var T=this.grid;var size=this.adjustForComponents(V,W);T.getGridEl().setSize(size.width,size.height);T.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(X,Y){Roo.NestedLayoutPanel.superclass.constructor.call(this,X.getEl(),Y);X.monitorWindowResize=false;this.layout=X;this.layout.getEl().addClass("x-layout-nested-layout");};Roo.extend(Roo.NestedLayoutPanel,Roo.ContentPanel,{setSize:function(Z,a){if(!this.ignoreResize(Z,a)){var size=this.adjustForComponents(Z,a);var el=this.layout.getEl();el.setSize(size.width,size.height);var touch=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 c=false;for(var r in this.layout.regions){c=this.layout.getRegion(r);if(c.getActivePanel()){c.setActivePanel(c.getActivePanel());continue;}if(!c.panels.length){continue;}
 c.showPanel(c.getPanel(0));}},getLayout:function(){return this.layout;},addxtype:function(d){return this.layout.addxtype(d);}});Roo.ScrollPanel=function(el,e,f){e=e||{};e.fitToFrame=true;Roo.ScrollPanel.superclass.constructor.call(this,el,e,f);this.el.dom.style.overflow="hidden";var g=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=g.createChild({cls:"x-scroller-up",html:"&#160;"},this.el.dom);var i=g.createChild({cls:"x-scroller-down",html:"&#160;"});up.unselectable();i.unselectable();up.on("click",this.scrollUp,this);i.on("click",this.scrollDown,this);up.addClassOnOver("x-scroller-btn-over");i.addClassOnOver("x-scroller-btn-over");up.addClassOnClick("x-scroller-btn-click");i.addClassOnClick("x-scroller-btn-click");this.adjustments=[0,-(up.getHeight()+i.getHeight())];this.resizeEl=this.el;this.el=g;this.up=up;this.down=i;};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(j,k){this.resizeEl.update(j,k);}});Roo.TreePanel=function(l){var el=l.el;var m=l.tree;delete l.tree;delete l.el;Roo.TreePanel.superclass.constructor.call(this,el,l);var n=el.createChild();this.tree=new Roo.tree.TreePanel(n,m);this.on('activate',function(){if(this.tree.rendered){return;}
@@ -904,7 +905,8 @@ this.fireEvent("cellselect",this,G,H);this.fireEvent("selectionchange",this,this
 e.stopEvent();}else if(k==e.ENTER&&!e.ctrlKey){ed.completeEdit();e.stopEvent();}else if(k==e.ESC){ed.cancelEdit();}if(R){g.startEditing(R[0],R[1]);}}});
 Roo.grid.EditorGrid=function(A,B){Roo.grid.EditorGrid.superclass.constructor.call(this,A,B);this.getGridEl().addClass("xedit-grid");if(!this.selModel){this.selModel=new Roo.grid.CellSelectionModel();}
 this.activeEditor=null;this.addEvents({"beforeedit":true,"afteredit":true,"validateedit":true});this.on("bodyscroll",this.stopEditing,this);this.on(this.clicksToEdit==1?"cellclick":"celldblclick",this.onCellDblClick,this);};Roo.extend(Roo.grid.EditorGrid,Roo.grid.Grid,{clicksToEdit:2,isEditor:true,trackMouseOver:false,onCellDblClick:function(g,C,D){this.startEditing(C,D);},onEditComplete:function(ed,E,F){this.editing=false;this.activeEditor=null;ed.un("specialkey",this.selModel.onEditorKey,this.selModel);var r=ed.record;var G=this.colModel.getDataIndex(ed.col);var e={grid:this,record:r,field:G,originalValue:F,value:E,row:ed.row,column:ed.col,cancel:false,editor:ed};if(String(E)!==String(F)){if(this.fireEvent("validateedit",e)!==false&&!e.cancel){r.set(G,e.value);delete e.cancel;this.fireEvent("afteredit",e);}}else {this.fireEvent("afteredit",e);}
-this.view.focusCell(ed.row,ed.col);},startEditing:function(H,I){this.stopEditing();if(this.colModel.isCellEditable(I,H)){this.view.ensureVisible(H,I,true);var r=this.dataSource.getAt(H);var G=this.colModel.getDataIndex(I);var e={grid:this,record:r,field:G,value:r.data[G],row:H,column:I,cancel:false};if(this.fireEvent("beforeedit",e)!==false&&!e.cancel){this.editing=true;var ed=this.colModel.getCellEditor(I,H);if(!ed){return;}if(!ed.rendered){ed.render(ed.parentEl||document.body);}(function(){ed.row=H;ed.col=I;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[G];ed.startEdit(this.view.getCell(H,I),v);}).defer(50,this);}}},stopEditing:function(){if(this.activeEditor){this.activeEditor.completeEdit();}
+this.view.focusCell(ed.row,ed.col);},startEditing:function(H,I){this.stopEditing();if(this.colModel.isCellEditable(I,H)){this.view.ensureVisible(H,I,true);var r=this.dataSource.getAt(H);var G=this.colModel.getDataIndex(I);var e={grid:this,record:r,field:G,value:r.data[G],row:H,column:I,cancel:false};if(this.fireEvent("beforeedit",e)!==false&&!e.cancel){this.editing=true;var ed=this.colModel.getCellEditor(I,H);if(!ed){return;}if(!ed.rendered){ed.render(ed.parentEl||document.body);}
+ed.field.reset();(function(){ed.row=H;ed.col=I;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[G];ed.startEdit(this.view.getCell(H,I),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"});
@@ -914,5 +916,25 @@ this.store.loadRecords({records:C},{},true);},onUpdate:function(ds,D,E){if(E==Ro
 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 A=/^<tpl\b[^>]*?for="(.*?)"/;var B=/^<tpl\b[^>]*?if="(.*?)"/;var C=/^<tpl\b[^>]*?exec="(.*?)"/;var m,id=0;var D=[];while(m=s.match(re)){var m2=m[0].match(A);var m3=m[0].match(B);var m4=m[0].match(C);var exp=null,fn=null,exec=null;var name=m2&&m2[1]?m2[1]:'';if(m3){exp=m3&&m3[1]?m3[1]:null;if(exp){fn=new Function('values','parent','with(values){ return '+(Roo.util.Format.htmlDecode(exp))+'; }');}}if(m4){exp=m4&&m4[1]?m4[1]:null;if(exp){exec=new Function('values','parent','with(values){ '+(Roo.util.Format.htmlDecode(exp))+'; }');}}if(name){switch(name){case '.':name=new Function('values','parent','with(values){ return values; }');break;case '..':name=new Function('values','parent','with(values){ return parent; }');break;default:name=new Function('values','parent','with(values){ return '+name+'; }');}}
 D.push({id:id,target:name,exec:exec,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}for(var i=D.length-1;i>=0;--i){this.compileTpl(D[i]);}
-this.master=D[D.length-1];this.tpls=D;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applySubTemplate:function(id,E,F){var t=this.tpls[id];if(t.test&&!t.test.call(this,E,F)){return '';}if(t.exec&&t.exec.call(this,E,F)){return '';}var vs=t.target?t.target.call(this,E,F):E;F=t.target?E:F;if(t.target&&vs instanceof Array){var buf=[];for(var i=0,len=vs.length;i<len;i++){buf[buf.length]=t.compiled.call(this,vs[i],F);}return buf.join('');}return t.compiled.call(this,vs,F);},compileTpl:function(G){var fm=Roo.util.Format;var H=this.disableFormats!==true;var I=Roo.isGecko?"+":",";var fn=function(m,K,L,M){if(K.substr(0,4)=='xtpl'){return "'"+I+'this.applySubTemplate('+K.substr(4)+', values, parent)'+I+"'";}var v;if(K.indexOf('.')!=-1){v=K;}else {v="values['"+K+"']";}if(L&&H){M=M?','+M:"";if(L.substr(0,5)!="this."){L="fm."+L+'(';}else {L='this.call("'+L.substr(5)+'", ';M=", values";}}else {M='';L="("+v+" === undefined ? '' : ";}return "'"+I+L+v+M+")"+I+"'";};var J;if(Roo.isGecko){J="tpl.compiled = function(values, parent){ return '"+G.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {J=["tpl.compiled = function(values, parent){ return ['"];J.push(G.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));J.push("'].join('');};");J=J.join('');}
-eval(J);return this;},applyTemplate:function(K){return this.master.compiled.call(this,K,{});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);};
+this.master=D[D.length-1];this.tpls=D;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applySubTemplate:function(id,E,F){var t=this.tpls[id];if(t.test&&!t.test.call(this,E,F)){return '';}if(t.exec&&t.exec.call(this,E,F)){return '';}var vs=t.target?t.target.call(this,E,F):E;F=t.target?E:F;if(t.target&&vs instanceof Array){var buf=[];for(var i=0,len=vs.length;i<len;i++){buf[buf.length]=t.compiled.call(this,vs[i],F);}return buf.join('');}return t.compiled.call(this,vs,F);},compileTpl:function(G){var fm=Roo.util.Format;var H=this.disableFormats!==true;var I=Roo.isGecko?"+":",";var fn=function(m,K,L,M){if(K.substr(0,4)=='xtpl'){return "'"+I+'this.applySubTemplate('+K.substr(4)+', values, parent)'+I+"'";}var v;if(K.indexOf('.')!=-1){v=K;}else {v="values['"+K+"']";}if(L&&H){M=M?','+M:"";if(L.substr(0,5)!="this."){L="fm."+L+'(';}else {L='this.call("'+L.substr(5)+'", ';M=", values";}}else {M='';L="("+v+" === undefined ? '' : ";}return "'"+I+L+v+M+")"+I+"'";};var J;if(Roo.isGecko){J="tpl.compiled = function(values, parent){ return '"+G.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {J=["tpl.compiled = function(values, parent){ return ['"];J.push(G.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));J.push("'].join('');};");J=J.join('');}eval(J);return this;},applyTemplate:function(K){return this.master.compiled.call(this,K,{});var s=this.subs;},apply:function(){return this.applyTemplate.apply(this,arguments);},compile:function(){return this;}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};
+Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true,'buildcomplete':true,});Roo.XComponent.register(this);this.modules=false;this.el=false;}
+Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,items:false,});Roo.apply(Roo.XComponent,{buildCompleted:false,topModule:false,modules:[],register:function(B){this.modules.push(B);},toObject:function(C){if(!C||typeof(C)=='object'){return C;}var ar=C.split('.');var rt,o;rt=ar.shift();eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');if(o===false){throw "Module not found : "+C;}
+Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+C;}
+o=o[e];});return o;},preBuild:function(){Roo.each(this.modules,function(D){D.parent=this.toObject(D.parent);if(!D.parent){this.topModule=D;return;}if(!D.parent.modules){D.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}
+D.parent.modules.add(D);},this);},buildOrder:function(){var D=this;var E=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if(!this.topModule||!this.topModule.modules){throw "No top level modules to build";}var F=[this.topModule];var G=function(m){F.push(m);if(m.modules){m.modules.keySort('ASC',E);m.modules.each(G);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";F.push(m.finalize);}}
+this.topModule.modules.keySort('ASC',E);this.topModule.modules.each(G);return F;},build:function(){this.preBuild();var H=this.buildOrder();if(!H.length){throw "NO modules!!!";}
+Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var I=H.length;var J=this;var K=function(){if(!H.length){console.log('hide?');Roo.MessageBox.hide();J.topModule.fireEvent('buildcomplete',J.topModule);return;}var m=H.shift();console.log(m);if(typeof(m)=='function'){m.call(this);return K.defer(10,J);}Roo.MessageBox.updateProgress((I-H.length)/I,"Building Interface "+(I-H.length)+" of "+I+(m.name?(' - '+m.name):''));var L=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(L){return K();}if(!m.parent){var layoutbase=new Ext.BorderLayout(document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:true,minTabWidth:140}});var M=m.tree();M.region='center';m.el=layoutbase.addxtype(M);m.panel=m.el;m.layout=m.panel.layout;return K.defer(10,J);}var M=m.tree();M.region=M.region||m.region;m.el=m.parent.el.addxtype(M);m.fireEvent('built',m);m.panel=m.el;m.layout=m.panel.layout;K.defer(10,J);}
+K.defer(1,J);}});
+Roo.Login=function(A){this.addEvents({'refreshed':true,});Roo.apply(this,A);Roo.onReady(function(){this.onLoad();},this);Roo.Login.superclass.constructor.call(this,this);}
+Roo.extend(Roo.Login,Roo.LayoutDialog,{method:'POST',url:'',user:false,checkFails:0,intervalID:0,onLoad:function(){if(Roo.get('loading')){Roo.get('loading').remove();}
+this.check({success:function(B,C){var D=this.processResponse(B);this.checkFails=0;if(!D.success){this.checkFails=5;return this.failure(B,C);}if(!D.data.id){return this.show();}
+this.fillAuth(D.data);this.checkFails=0;Roo.XComponent.build();},failure:this.show});},check:function(B){if(B.again){this.checkFails++;}else {this.checkFails=0;}var C=this;if(this.sending){if(this.checkFails>4){Roo.MessageBox.alert("Error","Error getting authentication status. - try reloading, or wait a while",function(){C.sending=false;});return;}
+B.again=true;C.check.defer(10000,C,[B]);return;}
+this.sending=true;Roo.Ajax.request({url:this.url,params:{getAuthUser:true},method:this.method,success:B.success||this.success,failure:B.failure||this.failure,scope:this,callCfg:B});},logout:function(){window.onbeforeunload=function(){};this.user=false;var D=this;Roo.Ajax.request({url:this.url,params:{logout:1},method:'GET',failure:function(){Roo.MessageBox.alert("Error","Error logging out. - continuing anyway.",function(){document.location=document.location.toString()+'?ts='+Math.random();});},success:function(){D.user=false;this.checkFails=0;document.location=document.location.toString()+'?ts='+Math.random();}});},processResponse:function(E){var F='';try{F=Roo.decode(E.responseText);if(typeof(F)!='object'){F={success:false,errorMsg:F,errors:true};}if(typeof(F.success)=='undefined'){F.success=false;}}catch(e){res={success:false,errorMsg:response.responseText,errors:true};}return F;},success:function(G,H){this.sending=false;var I=this.processResponse(G);if(!I.success){return this.failure(G,H);}if(!I.data||!I.data.id){return this.failure(G,H);}
+this.fillAuth(I.data);this.checkFails=0;},failure:function(J,K){this.authUser=-1;this.sending=false;var L=this.processResponse(J);if(this.checkFails>2){Roo.MessageBox.alert("Error",L.errorMsg?L.errorMsg:"Error getting authentication status. - try reloading");return;}
+K.callCfg.again=true;this.check.defer(1000,this,[K.callCfg]);return;},fillAuth:function(au){this.startAuthCheck();this.authUserId=au.id;this.authUser=au;this.lastChecked=new Date();this.fireEvent('refreshed',au);au.lang=au.lang||'en';Roo.state.Manager.set(this.realm+'lang',au.lang);this.switchLang(au.lang);if(this.authUserId<0){Roo.MessageBox.alert("Warning","This is an open system - please set up a admin user with a password.");}},startAuthCheck:function(){if(this.intervalID){return false;}var M=this;this.intervalID=window.setInterval(function(){M.check(false);},120000);},switchLang:function(N){_T=typeof(_T)=='undefined'?false:_T;if(!_T||!N.length){return;}if(!_T&&N!='en'){Roo.MessageBox.alert("Sorry","Language not available yet ("+N+')');return;}if(typeof(_T.en)=='undefined'){_T.en={};Roo.apply(_T.en,_T);}if(typeof(_T[N])=='undefined'){Roo.MessageBox.alert("Sorry","Language not available yet ("+N+')');return;}
+Roo.apply(_T,_T[N]);var O=this;},title:"Login",modal:true,width:350,height:180,shadow:true,minWidth:200,minHeight:180,closable:false,draggable:false,collapsible:false,resizable:false,center:{autoScroll:false,titlebar:false,hideTabs:true,closeOnTab:true,alwaysShowTabs:false},listeners:{show:function(P){this.form=this.layout.getRegion('center').activePanel.form;this.form.dialog=P;this.buttons[0].form=this.form;this.buttons[0].dialog=Pthis.buttons[1].form=this.form;this.buttons[1].dialog=P;if(this.disabled){this.hide();return;}if(this.user.id<0){return;}if(this.intervalID){window.clearInterval(this.intervalID);this.intervalID=false;}if(Roo.get('loading')){Roo.get('loading').remove();}if(Roo.get('loading-mask')){Roo.get('loading-mask').hide();}
+this.form.reset();this.el.unmask();this.form.setValues({'username':Roo.state.Manager.get(this.realm+'.username',''),'lang':Roo.state.Manager.get(this.realm+'.lang','en')});this.switchLang(Roo.state.Manager.get(this.realm+'.lang','en'));if(this.form.findField('username').getValue().length>0){this.form.findField('password').focus();}else {this.form.findField('username').focus();}}},items:[{xtype:'ContentPanel',xns:Roo,region:'center',fitToFrame:true,items:[{xtype:'Form',xns:Roo.form,labelWidth:100,style:'margin: 10px;',listeners:{actionfailed:function(f,Q){this.dialog.el.unmask();Roo.MessageBox.alert("Error",Q.result.errorMsg?Q.result.errorMsg:"Login failed - communication error - try again.");},actioncomplete:function(re,R){Roo.state.Manager.set(this.dialog.realm+'.username',this.findField('username').getValue());Roo.state.Manager.set(this.dialog.realm+'.lang',this.findField('lang').getValue());this.dialog.fillAuth(R.result.data);this.dialog.hide();if(Roo.get('loading-mask')){Roo.get('loading-mask').show();}
+Roo.XComponent.build();}},items:[{xtype:'TextField',xns:Roo.form,fieldLabel:"Email Address",name:'username',width:200,autoCreate:{tag:"input",type:"text",size:"20"}},{xtype:'TextField',xns:Roo.form,fieldLabel:"Password",inputType:'password',name:'password',width:200,autoCreate:{tag:"input",type:"text",size:"20"},listeners:{specialkey:function(e,ev){if(ev.keyCode==13){this.form.dialog.el.mask("Logging in");this.form.doAction('submit',{url:this.form.dialog.url,method:this.form.dialog.method,});}}}},{xtype:'ComboBox',xns:Roo.form,fieldLabel:"Language",name:'langdisp',store:{xtype:'SimpleStore',fields:['lang','ldisp'],data:[['en','English'],['zh_HK','\u7E41\u4E2D'],['zh_CN','\u7C21\u4E2D']]},valueField:'lang',hiddenName:'lang',width:200,displayField:'ldisp',typeAhead:false,editable:false,mode:'local',triggerAction:'all',emptyText:'Select a Language...',selectOnFocus:true,listeners:{select:function(cb,S,ix){this.form.switchLang(S.data.lang);}}}]}]}],buttons:[{xtype:'Button',xns:'Roo',text:"Forgot Password",listeners:{click:function(){var n=this.form.findField('username').getValue();if(!n.length){Roo.MessageBox.alert("Error","Fill in your email address");return;}
+Roo.Ajax.request({url:this.dialog.url,params:{passwordRequest:n},method:this.dialog.method,success:function(T,U){var V=this.dialog.processResponse(T);if(!V.success){Roo.MessageBox.alert("Error",V.errorMsg?V.errorMsg:"Problem Requesting Password Reset");return;}
+Roo.MessageBox.alert("Notice","Please check you email for the Password Reset message");},failure:function(){Roo.MessageBox.alert("Error","Problem Requesting Password Reset");}});}}},{xtype:'Button',xns:'Roo',text:"Login",listeners:{click:function(){this.dialog.el.mask("Logging in");this.form.doAction('submit',{url:this.dialog.url,method:this.dialog.method});}}}]})