sync
[roojs1] / roojs-all.js
index c51aaf8..66a4552 100644 (file)
@@ -1,17 +1,18 @@
-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",D=ua.indexOf("opera")>-1,E=(/webkit|khtml/).test(ua),F=ua.indexOf("msie")>-1,G=ua.indexOf("msie 7")>-1,H=!E&&ua.indexOf("gecko")>-1,I=F&&!C,J=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),K=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),L=(ua.indexOf("linux")!=-1),M=window.location.href.toLowerCase().indexOf("https")===0;if(F&&!G){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
-Roo.apply(Roo,{isStrict:C,isSecure:M,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 N={};for(var b in o){var parts=b.split('@');if(parts[1]){var s=parts[0];if(!N[s]){N[s]=Roo.select(s);}
-N[s].on(parts[1],o[b]);}}
-N=null;},id:function(el,O){O=O||"roo-gen";el=Roo.getDom(el);var id=O+(++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,P){if(typeof sp=='object'){P=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,P);return sb;};}(),override:function(P,Q){if(Q){var p=P.prototype;for(var method in Q){p[method]=Q[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 R=[];for(var key in o){var ov=o[key],k=encodeURIComponent(key);var type=typeof ov;if(type=='undefined'){R.push(k,"=&");}else if(type!="function"&&type!="object"){R.push(k,"=",encodeURIComponent(ov),"&");}else if(ov instanceof Array){if(ov.length){for(var i=0,len=ov.length;i<len;i++){R.push(k,"=",encodeURIComponent(ov[i]===undefined?'':ov[i]),"&");}}else {R.push(k,"=&");}}}
-R.pop();return R.join("");},urlDecode:function(S,T){if(!S||!S.length){return {};}var U={};var V=S.split('&');var W,X,Y;for(var i=0,len=V.length;i<len;i++){W=V[i].split('=');X=decodeURIComponent(W[0]);Y=decodeURIComponent(W[1]);if(T!==true){if(typeof U[X]=="undefined"){U[X]=Y;}else if(typeof U[X]=="string"){U[X]=[U[X]];U[X].push(Y);}else {U[X].push(Y);}}else {U[X]=Y;}}return U;},each:function(Z,fn,f){if(typeof Z.length=="undefined"||typeof Z=="string"){Z=[Z];}for(var i=0,len=Z.length;i<len;i++){if(fn.call(f||Z[i],Z[i],i,Z)===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,g,h,n){if(typeof cb=="function"){if(n){cb.defer(n,g,h||[]);}else {cb.apply(g,h||[]);}}},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,q){if(typeof v!='number'){return q;}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,u){return v===null||v===undefined||(!u?v==='':false);},isOpera:D,isSafari:E,isIE:F,isIE7:G,isGecko:H,isBorderBox:I,isWindows:J,isLinux:L,isMac:K,useShims:((F&&!G)||(H&&K))});})();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);}}});
+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);}};}
@@ -91,8 +92,8 @@ 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(values){if(this.compiled){return this.compiled(values);}var B=this.disableFormats!==true;var fm=Roo.util.Format,C=this;var fn=function(m,D,E,F){if(E&&B){if(E.substr(0,5)=="this."){return C.call(E.substr(5),values[D],values);}else {if(F){var re=/^\s*['"](.*)["']\s*$/;F=F.split(',');for(var i=0,len=F.length;i<len;i++){F[i]=F[i].replace(re,"$1");}
-F=[values[D]].concat(F);}else {F=[values[D]];}return fm[E].apply(fm,F);}}else {return values[D]!==undefined?values[D]:"";}};return this.html.replace(this.re,fn);},set:function(D,E){this.html=D;this.compiled=null;if(E){this.compile();}return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Roo.util.Format;var F=this.disableFormats!==true;var G=Roo.isGecko?"+":",";var fn=function(m,I,J,K){if(J&&F){K=K?','+K:"";if(J.substr(0,5)!="this."){J="fm."+J+'(';}else {J='this.call("'+J.substr(5)+'", ';K=", values";}}else {K='';J="(values['"+I+"'] == undefined ? '' : ";}return "'"+G+J+"values['"+I+"']"+K+")"+G+"'";};var H;if(Roo.isGecko){H="this.compiled = function(values){ return '"+this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else {H=["this.compiled = function(values){ return ['"];H.push(this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));H.push("'].join('');};");H=H.join('');}eval(H);return this;},call:function(I,J,K){return this[I](J,K);},insertFirst:function(el,L,M){return this.doInsert('afterBegin',el,L,M);},insertBefore:function(el,N,O){return this.doInsert('beforeBegin',el,N,O);},insertAfter:function(el,P,Q){return this.doInsert('afterEnd',el,P,Q);},append:function(el,R,S){return this.doInsert('beforeEnd',el,R,S);},doInsert:function(T,el,U,V){el=Roo.getDom(el);var W=Roo.DomHelper.insertHtml(T,el,this.applyTemplate(U));return V?Roo.get(W,true):W;},overwrite:function(el,X,Y){el=Roo.getDom(el);el.innerHTML=this.applyTemplate(X);return Y?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);};
+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 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;}
@@ -132,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});}
@@ -388,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;}
@@ -713,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;}
@@ -814,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;}
@@ -914,3 +917,24 @@ Roo.LoadMask=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(this.store)
 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);};
+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});}}}]})