Viewing File: /usr/local/cpanel/whostmgr/docroot/js2-min/install_ssl_form.js

var Handlebars={};(function(Handlebars,undefined){Handlebars.VERSION="1.0.0";Handlebars.COMPILER_REVISION=4;Handlebars.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};Handlebars.helpers={};Handlebars.partials={};var toString=Object.prototype.toString,functionType="[object Function]",objectType="[object Object]";Handlebars.registerHelper=function(name,fn,inverse){if(toString.call(name)===objectType){if(inverse||fn){throw new Handlebars.Exception("Arg not supported with multiple helpers")}Handlebars.Utils.extend(this.helpers,name)}else{if(inverse){fn.not=inverse}this.helpers[name]=fn}};Handlebars.registerPartial=function(name,str){if(toString.call(name)===objectType){Handlebars.Utils.extend(this.partials,name)}else{this.partials[name]=str}};Handlebars.registerHelper("helperMissing",(function(arg){if(arguments.length===2){return undefined}else{throw new Error("Missing helper: '"+arg+"'")}}));Handlebars.registerHelper("blockHelperMissing",(function(context,options){var inverse=options.inverse||function(){},fn=options.fn;var type=toString.call(context);if(type===functionType){context=context.call(this)}if(context===true){return fn(this)}else if(context===false||context==null){return inverse(this)}else if(type==="[object Array]"){if(context.length>0){return Handlebars.helpers.each(context,options)}else{return inverse(this)}}else{return fn(context)}}));Handlebars.K=function(){};Handlebars.createFrame=Object.create||function(object){Handlebars.K.prototype=object;var obj=new Handlebars.K;Handlebars.K.prototype=null;return obj};Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(level,obj){if(Handlebars.logger.level<=level){var method=Handlebars.logger.methodMap[level];if(typeof console!=="undefined"&&console[method]){console[method].call(console,obj)}}}};Handlebars.log=function(level,obj){Handlebars.logger.log(level,obj)};Handlebars.registerHelper("each",(function(context,options){var fn=options.fn,inverse=options.inverse;var i=0,ret="",data;var type=toString.call(context);if(type===functionType){context=context.call(this)}if(options.data){data=Handlebars.createFrame(options.data)}if(context&&typeof context==="object"){if(context instanceof Array){for(var j=context.length;i<j;i++){if(data){data.index=i}ret=ret+fn(context[i],{data:data})}}else{for(var key in context){if(context.hasOwnProperty(key)){if(data){data.key=key}ret=ret+fn(context[key],{data:data});i++}}}}if(i===0){ret=inverse(this)}return ret}));Handlebars.registerHelper("if",(function(conditional,options){var type=toString.call(conditional);if(type===functionType){conditional=conditional.call(this)}if(!conditional||Handlebars.Utils.isEmpty(conditional)){return options.inverse(this)}else{return options.fn(this)}}));Handlebars.registerHelper("unless",(function(conditional,options){return Handlebars.helpers["if"].call(this,conditional,{fn:options.inverse,inverse:options.fn})}));Handlebars.registerHelper("with",(function(context,options){var type=toString.call(context);if(type===functionType){context=context.call(this)}if(!Handlebars.Utils.isEmpty(context))return options.fn(context)}));Handlebars.registerHelper("log",(function(context,options){var level=options.data&&options.data.level!=null?parseInt(options.data.level,10):1;Handlebars.log(level,context)}));var handlebars=function(){var parser={trace:function trace(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,simpleInverse:6,statements:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,params:27,hash:28,dataName:29,param:30,STRING:31,INTEGER:32,BOOLEAN:33,hashSegments:34,hashSegment:35,ID:36,EQUALS:37,DATA:38,pathSegments:39,SEP:40,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",31:"STRING",32:"INTEGER",33:"BOOLEAN",36:"ID",37:"EQUALS",38:"DATA",40:"SEP"},productions_:[0,[3,2],[4,2],[4,3],[4,2],[4,1],[4,1],[4,0],[7,1],[7,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[6,2],[17,3],[17,2],[17,2],[17,1],[17,1],[27,2],[27,1],[30,1],[30,1],[30,1],[30,1],[30,1],[28,1],[34,2],[34,1],[35,3],[35,3],[35,3],[35,3],[35,3],[26,1],[26,1],[26,1],[29,2],[21,1],[39,3],[39,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];break;case 2:this.$=new yy.ProgramNode([],$$[$0]);break;case 3:this.$=new yy.ProgramNode($$[$0-2],$$[$0]);break;case 4:this.$=new yy.ProgramNode($$[$0-1],[]);break;case 5:this.$=new yy.ProgramNode($$[$0]);break;case 6:this.$=new yy.ProgramNode([],[]);break;case 7:this.$=new yy.ProgramNode([]);break;case 8:this.$=[$$[$0]];break;case 9:$$[$0-1].push($$[$0]);this.$=$$[$0-1];break;case 10:this.$=new yy.BlockNode($$[$0-2],$$[$0-1].inverse,$$[$0-1],$$[$0]);break;case 11:this.$=new yy.BlockNode($$[$0-2],$$[$0-1],$$[$0-1].inverse,$$[$0]);break;case 12:this.$=$$[$0];break;case 13:this.$=$$[$0];break;case 14:this.$=new yy.ContentNode($$[$0]);break;case 15:this.$=new yy.CommentNode($$[$0]);break;case 16:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1]);break;case 17:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1]);break;case 18:this.$=$$[$0-1];break;case 19:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1],$$[$0-2][2]==="&");break;case 20:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1],true);break;case 21:this.$=new yy.PartialNode($$[$0-1]);break;case 22:this.$=new yy.PartialNode($$[$0-2],$$[$0-1]);break;case 23:break;case 24:this.$=[[$$[$0-2]].concat($$[$0-1]),$$[$0]];break;case 25:this.$=[[$$[$0-1]].concat($$[$0]),null];break;case 26:this.$=[[$$[$0-1]],$$[$0]];break;case 27:this.$=[[$$[$0]],null];break;case 28:this.$=[[$$[$0]],null];break;case 29:$$[$0-1].push($$[$0]);this.$=$$[$0-1];break;case 30:this.$=[$$[$0]];break;case 31:this.$=$$[$0];break;case 32:this.$=new yy.StringNode($$[$0]);break;case 33:this.$=new yy.IntegerNode($$[$0]);break;case 34:this.$=new yy.BooleanNode($$[$0]);break;case 35:this.$=$$[$0];break;case 36:this.$=new yy.HashNode($$[$0]);break;case 37:$$[$0-1].push($$[$0]);this.$=$$[$0-1];break;case 38:this.$=[$$[$0]];break;case 39:this.$=[$$[$0-2],$$[$0]];break;case 40:this.$=[$$[$0-2],new yy.StringNode($$[$0])];break;case 41:this.$=[$$[$0-2],new yy.IntegerNode($$[$0])];break;case 42:this.$=[$$[$0-2],new yy.BooleanNode($$[$0])];break;case 43:this.$=[$$[$0-2],$$[$0]];break;case 44:this.$=new yy.PartialNameNode($$[$0]);break;case 45:this.$=new yy.PartialNameNode(new yy.StringNode($$[$0]));break;case 46:this.$=new yy.PartialNameNode(new yy.IntegerNode($$[$0]));break;case 47:this.$=new yy.DataNode($$[$0]);break;case 48:this.$=new yy.IdNode($$[$0]);break;case 49:$$[$0-2].push({part:$$[$0],separator:$$[$0-1]});this.$=$$[$0-2];break;case 50:this.$=[{part:$$[$0]}];break}},table:[{3:1,4:2,5:[2,7],6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],22:[1,14],23:[1,15],25:[1,16]},{1:[3]},{5:[1,17]},{5:[2,6],7:18,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,6],22:[1,14],23:[1,15],25:[1,16]},{5:[2,5],6:20,8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,5],22:[1,14],23:[1,15],25:[1,16]},{17:23,18:[1,22],21:24,29:25,36:[1,28],38:[1,27],39:26},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],25:[2,8]},{4:29,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],25:[1,16]},{4:30,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],25:[1,16]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{17:31,21:24,29:25,36:[1,28],38:[1,27],39:26},{17:32,21:24,29:25,36:[1,28],38:[1,27],39:26},{17:33,21:24,29:25,36:[1,28],38:[1,27],39:26},{21:35,26:34,31:[1,36],32:[1,37],36:[1,28],39:26},{1:[2,1]},{5:[2,2],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,2],22:[1,14],23:[1,15],25:[1,16]},{17:23,21:24,29:25,36:[1,28],38:[1,27],39:26},{5:[2,4],7:38,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,4],22:[1,14],23:[1,15],25:[1,16]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{18:[1,39]},{18:[2,27],21:44,24:[2,27],27:40,28:41,29:48,30:42,31:[1,45],32:[1,46],33:[1,47],34:43,35:49,36:[1,50],38:[1,27],39:26},{18:[2,28],24:[2,28]},{18:[2,48],24:[2,48],31:[2,48],32:[2,48],33:[2,48],36:[2,48],38:[2,48],40:[1,51]},{21:52,36:[1,28],39:26},{18:[2,50],24:[2,50],31:[2,50],32:[2,50],33:[2,50],36:[2,50],38:[2,50],40:[2,50]},{10:53,20:[1,54]},{10:55,20:[1,54]},{18:[1,56]},{18:[1,57]},{24:[1,58]},{18:[1,59],21:60,36:[1,28],39:26},{18:[2,44],36:[2,44]},{18:[2,45],36:[2,45]},{18:[2,46],36:[2,46]},{5:[2,3],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,3],22:[1,14],23:[1,15],25:[1,16]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{18:[2,25],21:44,24:[2,25],28:61,29:48,30:62,31:[1,45],32:[1,46],33:[1,47],34:43,35:49,36:[1,50],38:[1,27],39:26},{18:[2,26],24:[2,26]},{18:[2,30],24:[2,30],31:[2,30],32:[2,30],33:[2,30],36:[2,30],38:[2,30]},{18:[2,36],24:[2,36],35:63,36:[1,64]},{18:[2,31],24:[2,31],31:[2,31],32:[2,31],33:[2,31],36:[2,31],38:[2,31]},{18:[2,32],24:[2,32],31:[2,32],32:[2,32],33:[2,32],36:[2,32],38:[2,32]},{18:[2,33],24:[2,33],31:[2,33],32:[2,33],33:[2,33],36:[2,33],38:[2,33]},{18:[2,34],24:[2,34],31:[2,34],32:[2,34],33:[2,34],36:[2,34],38:[2,34]},{18:[2,35],24:[2,35],31:[2,35],32:[2,35],33:[2,35],36:[2,35],38:[2,35]},{18:[2,38],24:[2,38],36:[2,38]},{18:[2,50],24:[2,50],31:[2,50],32:[2,50],33:[2,50],36:[2,50],37:[1,65],38:[2,50],40:[2,50]},{36:[1,66]},{18:[2,47],24:[2,47],31:[2,47],32:[2,47],33:[2,47],36:[2,47],38:[2,47]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{21:67,36:[1,28],39:26},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,68]},{18:[2,24],24:[2,24]},{18:[2,29],24:[2,29],31:[2,29],32:[2,29],33:[2,29],36:[2,29],38:[2,29]},{18:[2,37],24:[2,37],36:[2,37]},{37:[1,65]},{21:69,29:73,31:[1,70],32:[1,71],33:[1,72],36:[1,28],38:[1,27],39:26},{18:[2,49],24:[2,49],31:[2,49],32:[2,49],33:[2,49],36:[2,49],38:[2,49],40:[2,49]},{18:[1,74]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{18:[2,39],24:[2,39],36:[2,39]},{18:[2,40],24:[2,40],36:[2,40]},{18:[2,41],24:[2,41],36:[2,41]},{18:[2,42],24:[2,42],36:[2,42]},{18:[2,43],24:[2,43],36:[2,43]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]}],defaultActions:{17:[2,1]},parseError:function parseError(str,hash){throw new Error(str)},parse:function parse(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;this.lexer.setInput(input);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined")this.lexer.yylloc={};var yyloc=this.lexer.yylloc;lstack.push(yyloc);var ranges=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")this.parseError=this.yy.parseError;function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n}function lex(){var token;token=self.lexer.lex()||1;if(typeof token!=="number"){token=self.symbols_[token]||token}return token}var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";if(!recovering){expected=[];for(p in table[state])if(this.terminals_[p]&&p>2){expected.push("'"+this.terminals_[p]+"'")}if(this.lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==1?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected})}}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(this.lexer.yytext);lstack.push(this.lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=this.lexer.yyleng;yytext=this.lexer.yytext;yylineno=this.lexer.yylineno;yyloc=this.lexer.yylloc;if(recovering>0)recovering--}else{symbol=preErrorSymbol;preErrorSymbol=null}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack);if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};var lexer=function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash)}else{throw new Error(str)}},setInput:function(input){this._input=input;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges)this.yylloc.range=[0,0];this.offset=0;return this},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges)this.yylloc.range[1]++;this._input=this._input.slice(1);return ch},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len-1);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1)this.yylineno-=lines.length-1;var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len]}return this},more:function(){this._more=true;return this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length)}return(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},next:function(){if(this.done){return this.EOF}if(!this._input)this.done=true;var token,match,tempMatch,index,col,lines;if(!this._more){this.yytext="";this.match=""}var rules=this._currentRules();for(var i=0;i<rules.length;i++){tempMatch=this._input.match(this.rules[rules[i]]);if(tempMatch&&(!match||tempMatch[0].length>match[0].length)){match=tempMatch;index=i;if(!this.options.flex)break}}if(match){lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines)this.yylineno+=lines.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,rules[index],this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input)this.done=false;if(token)return token;else return}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function lex(){var r=this.next();if(typeof r!=="undefined"){return r}else{return this.lex()}},begin:function begin(condition){this.conditionStack.push(condition)},popState:function popState(){return this.conditionStack.pop()},_currentRules:function _currentRules(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function begin(condition){this.begin(condition)}};lexer.options={};lexer.performAction=function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){var YYSTATE=YY_START;switch($avoiding_name_collisions){case 0:yy_.yytext="\\";return 14;break;case 1:if(yy_.yytext.slice(-1)!=="\\")this.begin("mu");if(yy_.yytext.slice(-1)==="\\")yy_.yytext=yy_.yytext.substr(0,yy_.yyleng-1),this.begin("emu");if(yy_.yytext)return 14;break;case 2:return 14;break;case 3:if(yy_.yytext.slice(-1)!=="\\")this.popState();if(yy_.yytext.slice(-1)==="\\")yy_.yytext=yy_.yytext.substr(0,yy_.yyleng-1);return 14;break;case 4:yy_.yytext=yy_.yytext.substr(0,yy_.yyleng-4);this.popState();return 15;break;case 5:return 25;break;case 6:return 16;break;case 7:return 20;break;case 8:return 19;break;case 9:return 19;break;case 10:return 23;break;case 11:return 22;break;case 12:this.popState();this.begin("com");break;case 13:yy_.yytext=yy_.yytext.substr(3,yy_.yyleng-5);this.popState();return 15;break;case 14:return 22;break;case 15:return 37;break;case 16:return 36;break;case 17:return 36;break;case 18:return 40;break;case 19:break;case 20:this.popState();return 24;break;case 21:this.popState();return 18;break;case 22:yy_.yytext=yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"');return 31;break;case 23:yy_.yytext=yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'");return 31;break;case 24:return 38;break;case 25:return 33;break;case 26:return 33;break;case 27:return 32;break;case 28:return 36;break;case 29:yy_.yytext=yy_.yytext.substr(1,yy_.yyleng-2);return 36;break;case 30:return"INVALID";break;case 31:return 5;break}};lexer.rules=[/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}\/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];lexer.conditions={mu:{rules:[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],inclusive:false},emu:{rules:[3],inclusive:false},com:{rules:[4],inclusive:false},INITIAL:{rules:[0,1,2,31],inclusive:true}};return lexer}();parser.lexer=lexer;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();Handlebars.Parser=handlebars;Handlebars.parse=function(input){if(input.constructor===Handlebars.AST.ProgramNode){return input}Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(input)};Handlebars.AST={};Handlebars.AST.ProgramNode=function(statements,inverse){this.type="program";this.statements=statements;if(inverse){this.inverse=new Handlebars.AST.ProgramNode(inverse)}};Handlebars.AST.MustacheNode=function(rawParams,hash,unescaped){this.type="mustache";this.escaped=!unescaped;this.hash=hash;var id=this.id=rawParams[0];var params=this.params=rawParams.slice(1);var eligibleHelper=this.eligibleHelper=id.isSimple;this.isHelper=eligibleHelper&&(params.length||hash)};Handlebars.AST.PartialNode=function(partialName,context){this.type="partial";this.partialName=partialName;this.context=context};Handlebars.AST.BlockNode=function(mustache,program,inverse,close){var verifyMatch=function(open,close){if(open.original!==close.original){throw new Handlebars.Exception(open.original+" doesn't match "+close.original)}};verifyMatch(mustache.id,close);this.type="block";this.mustache=mustache;this.program=program;this.inverse=inverse;if(this.inverse&&!this.program){this.isInverse=true}};Handlebars.AST.ContentNode=function(string){this.type="content";this.string=string};Handlebars.AST.HashNode=function(pairs){this.type="hash";this.pairs=pairs};Handlebars.AST.IdNode=function(parts){this.type="ID";var original="",dig=[],depth=0;for(var i=0,l=parts.length;i<l;i++){var part=parts[i].part;original+=(parts[i].separator||"")+part;if(part===".."||part==="."||part==="this"){if(dig.length>0){throw new Handlebars.Exception("Invalid path: "+original)}else if(part===".."){depth++}else{this.isScoped=true}}else{dig.push(part)}}this.original=original;this.parts=dig;this.string=dig.join(".");this.depth=depth;this.isSimple=parts.length===1&&!this.isScoped&&depth===0;this.stringModeValue=this.string};Handlebars.AST.PartialNameNode=function(name){this.type="PARTIAL_NAME";this.name=name.original};Handlebars.AST.DataNode=function(id){this.type="DATA";this.id=id};Handlebars.AST.StringNode=function(string){this.type="STRING";this.original=this.string=this.stringModeValue=string};Handlebars.AST.IntegerNode=function(integer){this.type="INTEGER";this.original=this.integer=integer;this.stringModeValue=Number(integer)};Handlebars.AST.BooleanNode=function(bool){this.type="BOOLEAN";this.bool=bool;this.stringModeValue=bool==="true"};Handlebars.AST.CommentNode=function(comment){this.type="comment";this.comment=comment};var errorProps=["description","fileName","lineNumber","message","name","number","stack"];Handlebars.Exception=function(message){var tmp=Error.prototype.constructor.apply(this,arguments);for(var idx=0;idx<errorProps.length;idx++){this[errorProps[idx]]=tmp[errorProps[idx]]}};Handlebars.Exception.prototype=new Error;Handlebars.SafeString=function(string){this.string=string};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};var escape={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var badChars=/[&<>"'`]/g;var possible=/[&<>"'`]/;var escapeChar=function(chr){return escape[chr]||"&amp;"};Handlebars.Utils={extend:function(obj,value){for(var key in value){if(value.hasOwnProperty(key)){obj[key]=value[key]}}},escapeExpression:function(string){if(string instanceof Handlebars.SafeString){return string.toString()}else if(string==null||string===false){return""}string=string.toString();if(!possible.test(string)){return string}return string.replace(badChars,escapeChar)},isEmpty:function(value){if(!value&&value!==0){return true}else if(toString.call(value)==="[object Array]"&&value.length===0){return true}else{return false}}};var Compiler=Handlebars.Compiler=function(){};var JavaScriptCompiler=Handlebars.JavaScriptCompiler=function(){};Compiler.prototype={compiler:Compiler,disassemble:function(){var opcodes=this.opcodes,opcode,out=[],params,param;for(var i=0,l=opcodes.length;i<l;i++){opcode=opcodes[i];if(opcode.opcode==="DECLARE"){out.push("DECLARE "+opcode.name+"="+opcode.value)}else{params=[];for(var j=0;j<opcode.args.length;j++){param=opcode.args[j];if(typeof param==="string"){param='"'+param.replace("\n","\\n")+'"'}params.push(param)}out.push(opcode.opcode+" "+params.join(" "))}}return out.join("\n")},equals:function(other){var len=this.opcodes.length;if(other.opcodes.length!==len){return false}for(var i=0;i<len;i++){var opcode=this.opcodes[i],otherOpcode=other.opcodes[i];if(opcode.opcode!==otherOpcode.opcode||opcode.args.length!==otherOpcode.args.length){return false}for(var j=0;j<opcode.args.length;j++){if(opcode.args[j]!==otherOpcode.args[j]){return false}}}len=this.children.length;if(other.children.length!==len){return false}for(i=0;i<len;i++){if(!this.children[i].equals(other.children[i])){return false}}return true},guid:0,compile:function(program,options){this.children=[];this.depths={list:[]};this.options=options;var knownHelpers=this.options.knownHelpers;this.options.knownHelpers={helperMissing:true,blockHelperMissing:true,each:true,if:true,unless:true,with:true,log:true};if(knownHelpers){for(var name in knownHelpers){this.options.knownHelpers[name]=knownHelpers[name]}}return this.program(program)},accept:function(node){return this[node.type](node)},program:function(program){var statements=program.statements,statement;this.opcodes=[];for(var i=0,l=statements.length;i<l;i++){statement=statements[i];this[statement.type](statement)}this.isSimple=l===1;this.depths.list=this.depths.list.sort((function(a,b){return a-b}));return this},compileProgram:function(program){var result=(new this.compiler).compile(program,this.options);var guid=this.guid++,depth;this.usePartial=this.usePartial||result.usePartial;this.children[guid]=result;for(var i=0,l=result.depths.list.length;i<l;i++){depth=result.depths.list[i];if(depth<2){continue}else{this.addDepth(depth-1)}}return guid},block:function(block){var mustache=block.mustache,program=block.program,inverse=block.inverse;if(program){program=this.compileProgram(program)}if(inverse){inverse=this.compileProgram(inverse)}var type=this.classifyMustache(mustache);if(type==="helper"){this.helperMustache(mustache,program,inverse)}else if(type==="simple"){this.simpleMustache(mustache);this.opcode("pushProgram",program);this.opcode("pushProgram",inverse);this.opcode("emptyHash");this.opcode("blockValue")}else{this.ambiguousMustache(mustache,program,inverse);this.opcode("pushProgram",program);this.opcode("pushProgram",inverse);this.opcode("emptyHash");this.opcode("ambiguousBlockValue")}this.opcode("append")},hash:function(hash){var pairs=hash.pairs,pair,val;this.opcode("pushHash");for(var i=0,l=pairs.length;i<l;i++){pair=pairs[i];val=pair[1];if(this.options.stringParams){if(val.depth){this.addDepth(val.depth)}this.opcode("getContext",val.depth||0);this.opcode("pushStringParam",val.stringModeValue,val.type)}else{this.accept(val)}this.opcode("assignToHash",pair[0])}this.opcode("popHash")},partial:function(partial){var partialName=partial.partialName;this.usePartial=true;if(partial.context){this.ID(partial.context)}else{this.opcode("push","depth0")}this.opcode("invokePartial",partialName.name);this.opcode("append")},content:function(content){this.opcode("appendContent",content.string)},mustache:function(mustache){var options=this.options;var type=this.classifyMustache(mustache);if(type==="simple"){this.simpleMustache(mustache)}else if(type==="helper"){this.helperMustache(mustache)}else{this.ambiguousMustache(mustache)}if(mustache.escaped&&!options.noEscape){this.opcode("appendEscaped")}else{this.opcode("append")}},ambiguousMustache:function(mustache,program,inverse){var id=mustache.id,name=id.parts[0],isBlock=program!=null||inverse!=null;this.opcode("getContext",id.depth);this.opcode("pushProgram",program);this.opcode("pushProgram",inverse);this.opcode("invokeAmbiguous",name,isBlock)},simpleMustache:function(mustache){var id=mustache.id;if(id.type==="DATA"){this.DATA(id)}else if(id.parts.length){this.ID(id)}else{this.addDepth(id.depth);this.opcode("getContext",id.depth);this.opcode("pushContext")}this.opcode("resolvePossibleLambda")},helperMustache:function(mustache,program,inverse){var params=this.setupFullMustacheParams(mustache,program,inverse),name=mustache.id.parts[0];if(this.options.knownHelpers[name]){this.opcode("invokeKnownHelper",params.length,name)}else if(this.options.knownHelpersOnly){throw new Error("You specified knownHelpersOnly, but used the unknown helper "+name)}else{this.opcode("invokeHelper",params.length,name)}},ID:function(id){this.addDepth(id.depth);this.opcode("getContext",id.depth);var name=id.parts[0];if(!name){this.opcode("pushContext")}else{this.opcode("lookupOnContext",id.parts[0])}for(var i=1,l=id.parts.length;i<l;i++){this.opcode("lookup",id.parts[i])}},DATA:function(data){this.options.data=true;if(data.id.isScoped||data.id.depth){throw new Handlebars.Exception("Scoped data references are not supported: "+data.original)}this.opcode("lookupData");var parts=data.id.parts;for(var i=0,l=parts.length;i<l;i++){this.opcode("lookup",parts[i])}},STRING:function(string){this.opcode("pushString",string.string)},INTEGER:function(integer){this.opcode("pushLiteral",integer.integer)},BOOLEAN:function(bool){this.opcode("pushLiteral",bool.bool)},comment:function(){},opcode:function(name){this.opcodes.push({opcode:name,args:[].slice.call(arguments,1)})},declare:function(name,value){this.opcodes.push({opcode:"DECLARE",name:name,value:value})},addDepth:function(depth){if(isNaN(depth)){throw new Error("EWOT")}if(depth===0){return}if(!this.depths[depth]){this.depths[depth]=true;this.depths.list.push(depth)}},classifyMustache:function(mustache){var isHelper=mustache.isHelper;var isEligible=mustache.eligibleHelper;var options=this.options;if(isEligible&&!isHelper){var name=mustache.id.parts[0];if(options.knownHelpers[name]){isHelper=true}else if(options.knownHelpersOnly){isEligible=false}}if(isHelper){return"helper"}else if(isEligible){return"ambiguous"}else{return"simple"}},pushParams:function(params){var i=params.length,param;while(i--){param=params[i];if(this.options.stringParams){if(param.depth){this.addDepth(param.depth)}this.opcode("getContext",param.depth||0);this.opcode("pushStringParam",param.stringModeValue,param.type)}else{this[param.type](param)}}},setupMustacheParams:function(mustache){var params=mustache.params;this.pushParams(params);if(mustache.hash){this.hash(mustache.hash)}else{this.opcode("emptyHash")}return params},setupFullMustacheParams:function(mustache,program,inverse){var params=mustache.params;this.pushParams(params);this.opcode("pushProgram",program);this.opcode("pushProgram",inverse);if(mustache.hash){this.hash(mustache.hash)}else{this.opcode("emptyHash")}return params}};var Literal=function(value){this.value=value};JavaScriptCompiler.prototype={nameLookup:function(parent,name){if(/^[0-9]+$/.test(name)){return parent+"["+name+"]"}else if(JavaScriptCompiler.isValidJavaScriptVariableName(name)){return parent+"."+name}else{return parent+"['"+name+"']"}},appendToBuffer:function(string){if(this.environment.isSimple){return"return "+string+";"}else{return{appendToBuffer:true,content:string,toString:function(){return"buffer += "+string+";"}}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(environment,options,context,asObject){this.environment=environment;this.options=options||{};Handlebars.log(Handlebars.logger.DEBUG,this.environment.disassemble()+"\n\n");this.name=this.environment.name;this.isChild=!!context;this.context=context||{programs:[],environments:[],aliases:{}};this.preamble();this.stackSlot=0;this.stackVars=[];this.registers={list:[]};this.compileStack=[];this.inlineStack=[];this.compileChildren(environment,options);var opcodes=environment.opcodes,opcode;this.i=0;for(l=opcodes.length;this.i<l;this.i++){opcode=opcodes[this.i];if(opcode.opcode==="DECLARE"){this[opcode.name]=opcode.value}else{this[opcode.opcode].apply(this,opcode.args)}}return this.createFunctionContext(asObject)},nextOpcode:function(){var opcodes=this.environment.opcodes;return opcodes[this.i+1]},eat:function(){this.i=this.i+1},preamble:function(){var out=[];if(!this.isChild){var namespace=this.namespace;var copies="helpers = this.merge(helpers, "+namespace+".helpers);";if(this.environment.usePartial){copies=copies+" partials = this.merge(partials, "+namespace+".partials);"}if(this.options.data){copies=copies+" data = data || {};"}out.push(copies)}else{out.push("")}if(!this.environment.isSimple){out.push(", buffer = "+this.initializeBuffer())}else{out.push("")}this.lastContext=0;this.source=out},createFunctionContext:function(asObject){var locals=this.stackVars.concat(this.registers.list);if(locals.length>0){this.source[1]=this.source[1]+", "+locals.join(", ")}if(!this.isChild){for(var alias in this.context.aliases){if(this.context.aliases.hasOwnProperty(alias)){this.source[1]=this.source[1]+", "+alias+"="+this.context.aliases[alias]}}}if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";"}if(!this.isChild){this.source[1]+="\n"+this.context.programs.join("\n")+"\n"}if(!this.environment.isSimple){this.source.push("return buffer;")}var params=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var i=0,l=this.environment.depths.list.length;i<l;i++){params.push("depth"+this.environment.depths.list[i])}var source=this.mergeSource();if(!this.isChild){var revision=Handlebars.COMPILER_REVISION,versions=Handlebars.REVISION_CHANGES[revision];source="this.compilerInfo = ["+revision+",'"+versions+"'];\n"+source}if(asObject){params.push(source);return Function.apply(this,params)}else{var functionSource="function "+(this.name||"")+"("+params.join(",")+") {\n  "+source+"}";Handlebars.log(Handlebars.logger.DEBUG,functionSource+"\n\n");return functionSource}},mergeSource:function(){var source="",buffer;for(var i=0,len=this.source.length;i<len;i++){var line=this.source[i];if(line.appendToBuffer){if(buffer){buffer=buffer+"\n    + "+line.content}else{buffer=line.content}}else{if(buffer){source+="buffer += "+buffer+";\n  ";buffer=undefined}source+=line+"\n  "}}return source},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var params=["depth0"];this.setupParams(0,params);this.replaceStack((function(current){params.splice(1,0,current);return"blockHelperMissing.call("+params.join(", ")+")"}))},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var params=["depth0"];this.setupParams(0,params);var current=this.topStack();params.splice(1,0,current);params[params.length-1]="options";this.source.push("if (!"+this.lastHelper+") { "+current+" = blockHelperMissing.call("+params.join(", ")+"); }")},appendContent:function(content){this.source.push(this.appendToBuffer(this.quotedString(content)))},append:function(){this.flushInline();var local=this.popStack();this.source.push("if("+local+" || "+local+" === 0) { "+this.appendToBuffer(local)+" }");if(this.environment.isSimple){this.source.push("else { "+this.appendToBuffer("''")+" }")}},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression";this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(depth){if(this.lastContext!==depth){this.lastContext=depth}},lookupOnContext:function(name){this.push(this.nameLookup("depth"+this.lastContext,name,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"';this.replaceStack((function(current){return"typeof "+current+" === functionType ? "+current+".apply(depth0) : "+current}))},lookup:function(name){this.replaceStack((function(current){return current+" == null || "+current+" === false ? "+current+" : "+this.nameLookup(current,name,"context")}))},lookupData:function(id){this.push("data")},pushStringParam:function(string,type){this.pushStackLiteral("depth"+this.lastContext);this.pushString(type);if(typeof string==="string"){this.pushString(string)}else{this.pushStackLiteral(string)}},emptyHash:function(){this.pushStackLiteral("{}");if(this.options.stringParams){this.register("hashTypes","{}");this.register("hashContexts","{}")}},pushHash:function(){this.hash={values:[],types:[],contexts:[]}},popHash:function(){var hash=this.hash;this.hash=undefined;if(this.options.stringParams){this.register("hashContexts","{"+hash.contexts.join(",")+"}");this.register("hashTypes","{"+hash.types.join(",")+"}")}this.push("{\n    "+hash.values.join(",\n    ")+"\n  }")},pushString:function(string){this.pushStackLiteral(this.quotedString(string))},push:function(expr){this.inlineStack.push(expr);return expr},pushLiteral:function(value){this.pushStackLiteral(value)},pushProgram:function(guid){if(guid!=null){this.pushStackLiteral(this.programExpression(guid))}else{this.pushStackLiteral(null)}},invokeHelper:function(paramSize,name){this.context.aliases.helperMissing="helpers.helperMissing";var helper=this.lastHelper=this.setupHelper(paramSize,name,true);var nonHelper=this.nameLookup("depth"+this.lastContext,name,"context");this.push(helper.name+" || "+nonHelper);this.replaceStack((function(name){return name+" ? "+name+".call("+helper.callParams+") "+": helperMissing.call("+helper.helperMissingParams+")"}))},invokeKnownHelper:function(paramSize,name){var helper=this.setupHelper(paramSize,name);this.push(helper.name+".call("+helper.callParams+")")},invokeAmbiguous:function(name,helperCall){this.context.aliases.functionType='"function"';this.pushStackLiteral("{}");var helper=this.setupHelper(0,name,helperCall);var helperName=this.lastHelper=this.nameLookup("helpers",name,"helper");var nonHelper=this.nameLookup("depth"+this.lastContext,name,"context");var nextStack=this.nextStack();this.source.push("if ("+nextStack+" = "+helperName+") { "+nextStack+" = "+nextStack+".call("+helper.callParams+"); }");this.source.push("else { "+nextStack+" = "+nonHelper+"; "+nextStack+" = typeof "+nextStack+" === functionType ? "+nextStack+".apply(depth0) : "+nextStack+"; }")},invokePartial:function(name){var params=[this.nameLookup("partials",name,"partial"),"'"+name+"'",this.popStack(),"helpers","partials"];if(this.options.data){params.push("data")}this.context.aliases.self="this";this.push("self.invokePartial("+params.join(", ")+")")},assignToHash:function(key){var value=this.popStack(),context,type;if(this.options.stringParams){type=this.popStack();context=this.popStack()}var hash=this.hash;if(context){hash.contexts.push("'"+key+"': "+context)}if(type){hash.types.push("'"+key+"': "+type)}hash.values.push("'"+key+"': ("+value+")")},compiler:JavaScriptCompiler,compileChildren:function(environment,options){var children=environment.children,child,compiler;for(var i=0,l=children.length;i<l;i++){child=children[i];compiler=new this.compiler;var index=this.matchExistingProgram(child);if(index==null){this.context.programs.push("");index=this.context.programs.length;child.index=index;child.name="program"+index;this.context.programs[index]=compiler.compile(child,options,this.context);this.context.environments[index]=child}else{child.index=index;child.name="program"+index}}},matchExistingProgram:function(child){for(var i=0,len=this.context.environments.length;i<len;i++){var environment=this.context.environments[i];if(environment&&environment.equals(child)){return i}}},programExpression:function(guid){this.context.aliases.self="this";if(guid==null){return"self.noop"}var child=this.environment.children[guid],depths=child.depths.list,depth;var programParams=[child.index,child.name,"data"];for(var i=0,l=depths.length;i<l;i++){depth=depths[i];if(depth===1){programParams.push("depth0")}else{programParams.push("depth"+(depth-1))}}return(depths.length===0?"self.program(":"self.programWithDepth(")+programParams.join(", ")+")"},register:function(name,val){this.useRegister(name);this.source.push(name+" = "+val+";")},useRegister:function(name){if(!this.registers[name]){this.registers[name]=true;this.registers.list.push(name)}},pushStackLiteral:function(item){return this.push(new Literal(item))},pushStack:function(item){this.flushInline();var stack=this.incrStack();if(item){this.source.push(stack+" = "+item+";")}this.compileStack.push(stack);return stack},replaceStack:function(callback){var prefix="",inline=this.isInline(),stack;if(inline){var top=this.popStack(true);if(top instanceof Literal){stack=top.value}else{var name=this.stackSlot?this.topStackName():this.incrStack();prefix="("+this.push(name)+" = "+top+"),";stack=this.topStack()}}else{stack=this.topStack()}var item=callback.call(this,stack);if(inline){if(this.inlineStack.length||this.compileStack.length){this.popStack()}this.push("("+prefix+item+")")}else{if(!/^stack/.test(stack)){stack=this.nextStack()}this.source.push(stack+" = ("+prefix+item+");")}return stack},nextStack:function(){return this.pushStack()},incrStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot)}return this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var inlineStack=this.inlineStack;if(inlineStack.length){this.inlineStack=[];for(var i=0,len=inlineStack.length;i<len;i++){var entry=inlineStack[i];if(entry instanceof Literal){this.compileStack.push(entry)}else{this.pushStack(entry)}}}},isInline:function(){return this.inlineStack.length},popStack:function(wrapped){var inline=this.isInline(),item=(inline?this.inlineStack:this.compileStack).pop();if(!wrapped&&item instanceof Literal){return item.value}else{if(!inline){this.stackSlot--}return item}},topStack:function(wrapped){var stack=this.isInline()?this.inlineStack:this.compileStack,item=stack[stack.length-1];if(!wrapped&&item instanceof Literal){return item.value}else{return item}},quotedString:function(str){return'"'+str.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(paramSize,name,missingParams){var params=[];this.setupParams(paramSize,params,missingParams);var foundHelper=this.nameLookup("helpers",name,"helper");return{params:params,name:foundHelper,callParams:["depth0"].concat(params).join(", "),helperMissingParams:missingParams&&["depth0",this.quotedString(name)].concat(params).join(", ")}},setupParams:function(paramSize,params,useRegister){var options=[],contexts=[],types=[],param,inverse,program;options.push("hash:"+this.popStack());inverse=this.popStack();program=this.popStack();if(program||inverse){if(!program){this.context.aliases.self="this";program="self.noop"}if(!inverse){this.context.aliases.self="this";inverse="self.noop"}options.push("inverse:"+inverse);options.push("fn:"+program)}for(var i=0;i<paramSize;i++){param=this.popStack();params.push(param);if(this.options.stringParams){types.push(this.popStack());contexts.push(this.popStack())}}if(this.options.stringParams){options.push("contexts:["+contexts.join(",")+"]");options.push("types:["+types.join(",")+"]");options.push("hashContexts:hashContexts");options.push("hashTypes:hashTypes")}if(this.options.data){options.push("data:data")}options="{"+options.join(",")+"}";if(useRegister){this.register("options",options);params.push("options")}else{params.push(options)}return params.join(", ")}};var reservedWords=("break else new var"+" case finally return void"+" catch for switch while"+" continue function this with"+" default if throw"+" delete in try"+" do instanceof typeof"+" abstract enum int short"+" boolean export interface static"+" byte extends long super"+" char final native synchronized"+" class float package throws"+" const goto private transient"+" debugger implements protected volatile"+" double import public let yield").split(" ");var compilerWords=JavaScriptCompiler.RESERVED_WORDS={};for(var i=0,l=reservedWords.length;i<l;i++){compilerWords[reservedWords[i]]=true}JavaScriptCompiler.isValidJavaScriptVariableName=function(name){if(!JavaScriptCompiler.RESERVED_WORDS[name]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)){return true}return false};Handlebars.precompile=function(input,options){if(input==null||typeof input!=="string"&&input.constructor!==Handlebars.AST.ProgramNode){throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+input)}options=options||{};if(!("data"in options)){options.data=true}var ast=Handlebars.parse(input);var environment=(new Compiler).compile(ast,options);return(new JavaScriptCompiler).compile(environment,options)};Handlebars.compile=function(input,options){if(input==null||typeof input!=="string"&&input.constructor!==Handlebars.AST.ProgramNode){throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+input)}options=options||{};if(!("data"in options)){options.data=true}var compiled;function compile(){var ast=Handlebars.parse(input);var environment=(new Compiler).compile(ast,options);var templateSpec=(new JavaScriptCompiler).compile(environment,options,undefined,true);return Handlebars.template(templateSpec)}return function(context,options){if(!compiled){compiled=compile()}return compiled.call(this,context,options)}};Handlebars.VM={template:function(templateSpec){var container={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(i,fn,data){var programWrapper=this.programs[i];if(data){programWrapper=Handlebars.VM.program(i,fn,data)}else if(!programWrapper){programWrapper=this.programs[i]=Handlebars.VM.program(i,fn)}return programWrapper},merge:function(param,common){var ret=param||common;if(param&&common){ret={};Handlebars.Utils.extend(ret,common);Handlebars.Utils.extend(ret,param)}return ret},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop,compilerInfo:null};return function(context,options){options=options||{};var result=templateSpec.call(container,Handlebars,context,options.helpers,options.partials,options.data);var compilerInfo=container.compilerInfo||[],compilerRevision=compilerInfo[0]||1,currentRevision=Handlebars.COMPILER_REVISION;if(compilerRevision!==currentRevision){if(compilerRevision<currentRevision){var runtimeVersions=Handlebars.REVISION_CHANGES[currentRevision],compilerVersions=Handlebars.REVISION_CHANGES[compilerRevision];throw"Template was precompiled with an older version of Handlebars than the current runtime. "+"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."}else{throw"Template was precompiled with a newer version of Handlebars than the current runtime. "+"Please update your runtime to a newer version ("+compilerInfo[1]+")."}}return result}},programWithDepth:function(i,fn,data){var args=Array.prototype.slice.call(arguments,3);var program=function(context,options){options=options||{};return fn.apply(this,[context,options.data||data].concat(args))};program.program=i;program.depth=args.length;return program},program:function(i,fn,data){var program=function(context,options){options=options||{};return fn(context,options.data||data)};program.program=i;program.depth=0;return program},noop:function(){return""},invokePartial:function(partial,name,context,helpers,partials,data){var options={helpers:helpers,partials:partials,data:data};if(partial===undefined){throw new Handlebars.Exception("The partial "+name+" could not be found")}else if(partial instanceof Function){return partial(context,options)}else if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+name+" could not be compiled when running in runtime-only mode")}else{partials[name]=Handlebars.compile(partial,{data:data!==undefined});return partials[name](context,options)}}};Handlebars.template=Handlebars.VM.template})(Handlebars);(function(undefined){"use strict";var hardLimit=100,ellipsis="…",DOM={tag:function(tagName,className){var t=document.createElement(tagName);t.className=className;return t},text:function(str){return document.createTextNode(str)}};function Stream(enc,pos){if(enc instanceof Stream){this.enc=enc.enc;this.pos=enc.pos}else{this.enc=enc;this.pos=pos}}Stream.prototype.get=function(pos){if(pos===undefined)pos=this.pos++;if(pos>=this.enc.length)throw"Requesting byte offset "+pos+" on a stream of length "+this.enc.length;return this.enc[pos]};Stream.prototype.hexDigits="0123456789ABCDEF";Stream.prototype.hexByte=function(b){return this.hexDigits.charAt(b>>4&15)+this.hexDigits.charAt(b&15)};Stream.prototype.parseStringBMP=function(start,end){var char_codes=[];for(var i=start;i<end;i+=2){var high_byte=this.get(i);var low_byte=this.get(i+1);char_codes.push((high_byte<<8)+low_byte)}return String.fromCharCode.apply(String,char_codes)};Stream.prototype.parseStringISO=function(start,end){var s="";for(var i=start;i<end;++i)s+=String.fromCharCode(this.get(i));return s};Stream.prototype.parseStringUTF=function(start,end){var s="";for(var i=start;i<end;){var c=this.get(i++);if(c<128)s+=String.fromCharCode(c);else if(c>191&&c<224)s+=String.fromCharCode((c&31)<<6|this.get(i++)&63);else s+=String.fromCharCode((c&15)<<12|(this.get(i++)&63)<<6|this.get(i++)&63)}return s};Stream.prototype.parseInteger=function(start,end){var len=end-start;if(len>4){len<<=3;var s=this.get(start);if(s===0)len-=8;else while(s<128){s<<=1;--len}return"("+len+" bit)"}var n=0;for(var i=start;i<end;++i)n=n<<8|this.get(i);return n};Stream.prototype.parseBitString=function(start,end){var unusedBit=this.get(start),lenBit=(end-start-1<<3)-unusedBit,s="("+lenBit+" bit)";if(lenBit<=20){var skip=unusedBit;s+=" ";for(var i=end-1;i>start;--i){var b=this.get(i);for(var j=skip;j<8;++j)s+=b>>j&1?"1":"0";skip=0}}return s};Stream.prototype.parseOctetString=function(start,end){var len=end-start,s="("+len+" byte) ";if(len>hardLimit)end=start+hardLimit;for(var i=start;i<end;++i)s+=this.hexByte(this.get(i));if(len>hardLimit)s+=ellipsis;return s};Stream.prototype.parseOID=function(start,end){var s="",n=0,bits=0;for(var i=start;i<end;++i){var v=this.get(i);n=n<<7|v&127;bits+=7;if(!(v&128)){if(s===""){var m=n<80?n<40?0:1:2;s=m+"."+(n-m*40)}else s+="."+(bits>=31?"bigint":n);n=bits=0}}return s};function ASN1(stream,header,length,tag,sub){this.stream=stream;this.header=header;this.length=length;this.tag=tag;this.sub=sub}ASN1.prototype.reSeemsASCII=/^[ -~]+$/;ASN1.prototype.content=function(){if(this.tag===undefined)return null;var tagClass=this.tag>>6,tagNumber=this.tag&31,content=this.posContent(),len=Math.abs(this.length);if(tagClass!==0){if(this.sub!==null)return"("+this.sub.length+" elem)";var s=this.stream.parseStringISO(content,content+Math.min(len,hardLimit));if(this.reSeemsASCII.test(s))return s.substring(0,2*hardLimit)+(s.length>2*hardLimit?ellipsis:"");else return this.stream.parseOctetString(content,content+len)}switch(tagNumber){case 1:return this.stream.get(content)===0?"false":"true";case 2:return this.stream.parseInteger(content,content+len);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(content,content+len);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(content,content+len);case 6:return this.stream.parseOID(content,content+len);case 16:case 17:return"("+this.sub.length+" elem)";case 12:return this.stream.parseStringUTF(content,content+len);case 18:case 19:case 20:case 21:case 22:case 26:return this.stream.parseStringISO(content,content+len);case 23:case 24:return this.stream.parseTime(content,content+len);case 30:return this.stream.parseStringBMP(content,content+len)}return null};ASN1.prototype.posStart=function(){return this.stream.pos};ASN1.prototype.posContent=function(){return this.stream.pos+this.header};ASN1.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)};ASN1.decodeLength=function(stream){var buf=stream.get(),len=buf&127;if(len==buf)return len;if(len>3)throw"Length over 24 bits not supported at position "+(stream.pos-1);if(len===0)return-1;buf=0;for(var i=0;i<len;++i)buf=buf<<8|stream.get();return buf};ASN1.decode=function(stream){if(!(stream instanceof Stream))stream=new Stream(stream,0);var streamStart=new Stream(stream),tag=stream.get(),len=ASN1.decodeLength(stream),header=stream.pos-streamStart.pos,sub=null;if(tag&32){var start=stream.pos;if(tag==3)stream.get();sub=[];if(len>=0){var end=start+len;while(stream.pos<end)sub[sub.length]=ASN1.decode(stream);if(stream.pos!=end)throw"Content size is not correct for container starting at offset "+start}else{try{for(;;){var s=ASN1.decode(stream);if(s.tag===0)break;sub[sub.length]=s}len=start-stream.pos}catch(e){throw"Exception while decoding undefined length content: "+e}}}else stream.pos+=len;return new ASN1(streamStart,header,len,tag,sub)};window.ASN1=ASN1})();(function ssl_js(window){"use strict";var atob=window.atob;var ASN1=window.ASN1;var ONE_DAY=1e3*60*60*24;var NEARLY_EXPIRED_WINDOW=30*ONE_DAY;var toLowerCase=Function.prototype.call.bind(String.prototype.toLowerCase);var DEFAULT_KEY_SIZE=2048;var ECDSA_CURVES={"1.2.840.10045.3.1.7":"prime256v1","1.3.132.0.34":"secp384r1"};var KEY_TEXT_REGEXP=/^[^-]*(-+\s*BEGIN\s+(?:EC\s+|RSA\s+)?PRIVATE\s+KEY\s*-+[^-]*-+\s*END\s+(?:EC\s+|RSA\s+)?PRIVATE\s+KEY\s*-+)[^-]*$/;var CERTIFICATE_TEXT_REGEXP=/^[^-]*(-+\s*BEGIN\s+CERTIFICATE\s*-+[^-]*-+\s*END\s+CERTIFICATE\s*-+)[^-]*$/;var X509_EXTENSION_OID={"netscape-cert-type":"2.16.840.1.113730.1",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",basicConstraints:"2.5.29.19"};var OID_NAME={"1.2.840.113549.1.1.5":"sha1WithRSAEncryption","1.2.840.113549.1.9.1":"emailAddress","2.5.4.3":"commonName","2.5.4.5":"serialNumber","2.5.4.6":"countryName","2.5.4.7":"localityName","2.5.4.8":"stateOrProvinceName","2.5.4.9":"streetAddress","2.5.4.10":"organizationName","2.5.4.11":"organizationalUnitName","0.9.2342.19200300.100.1.1":"userId"};Object.assign(OID_NAME,ECDSA_CURVES);Object.keys(X509_EXTENSION_OID).forEach((function(name){OID_NAME[X509_EXTENSION_OID[name]]=name}));var rsaEncryption_OID="1.2.840.113549.1.1.1";var id_ecPublicKey_OID="1.2.840.10045.2.1";var TIME_REGEXP=/^([0-9]*)([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})Z$/;var X509V3_ORDER=["version","serial",null,"issuer","dates","subject","key"];var RSA_ORDER=[null,"modulus","publicExponent","privateExponent","prime1","prime2","exponent1","exponent2","coefficient"];var keyUsage_order=["digitalSignature","contentCommitment","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var _getContentOctets=function(asn1){return asn1.stream.enc.slice(asn1.posContent(),asn1.posEnd())};var _getBinary=function(asn1){return String.fromCharCode.apply(String,_getContentOctets(asn1))};var _getHex=function(asn1){var octets=_getContentOctets(asn1);var hex=[];for(var o=octets.length-1;o>=0;o--){var octet=octets[o];hex[o]=(octet<16?"0":"")+octet.toString(16)}return hex.join("").toLowerCase().replace(/^00/,"")};var _parseSubject=function(asn1){var attrs=[];var sub=asn1.sub;for(var s=sub.length-1;s>=0;s--){var sequence_sub=sub[s].sub[0].sub;var label=sequence_sub[0].content();if(label in OID_NAME){label=OID_NAME[label]}attrs.unshift([label,sequence_sub[1].content()])}return attrs};var _unrollKeyValueList=function(theArray){var attrs={};var len=theArray.length;for(var l=0;l<len;l++){attrs[theArray[l][0]]=theArray[l][1]}return attrs};var _asn1DecodeOctets=function(octets){if(octets[0]===0){octets.shift()}return ASN1.decode(octets)};var _startParse=function(text){var b64=text.replace(/-[^\n]+-/g,"").replace(/\s+/g,"");if(b64.length%4){throw new Error("Invalid base64: must be a multiple of 4 in length.")}var binary=atob(b64);var stream=[];for(var c=binary.length-1;c>=0;c--){stream[c]=binary.charCodeAt(c)}var decode=ASN1.decode(stream);var second_byte=binary.charCodeAt(1);var should_be_length;if(second_byte>128){var size_octets_length=second_byte-128;var size_octets=binary.substr(2,size_octets_length).split("");should_be_length=2+size_octets_length+size_octets.reduce((function(a,b){return a*256+b.charCodeAt(0)}),0)}else{should_be_length=2+second_byte}if(should_be_length!==binary.length){throw new Error("ASN.1 data length mismatch: expected "+should_be_length+", got "+binary.length)}return decode};var _hexBinaryLength=function(hex){hex=hex.replace(/^0+/,"");return 4*(hex.length-1)+parseInt(hex.charAt(0),16).toString(2).length};var _parseRSA=function(asn){var parsed={};for(var i=RSA_ORDER.length-1;i>=0;i--){var part=RSA_ORDER[i];if(part){parsed[part]=_getHex(asn.sub[i])}}parsed.keyAlgorithm="rsaEncryption";parsed.modulusLength=_hexBinaryLength(parsed.modulus);return parsed};function _parseECDSAPublic(asn){var hex=_compressECDSAPublic(_getHex(asn));if(!/^0[23]/.test(hex)){throw new Error("Unrecognized public point encoding: the leading non-null byte is “_”.".replace(/_/,hex.substr(0,2)))}return hex}function _compressECDSAPublic(pubHex){if(/^0[467]/.test(pubHex)){var x=pubHex.substr(2);if(x.length%4){throw"Public hex (_) should be even … ?".replace(/_/,pubHex)}var leading_octet=parseInt(pubHex.substr(-1),16)%2?"03":"02";return leading_octet+x.substr(0,x.length/2)}return pubHex}function _getCurveName(curveOID){if(OID_NAME[curveOID]){return OID_NAME[curveOID]}throw new Error("Unknown ECDSA curve OID: “_”".replace(/_/,curveOID))}function _packageECDSAParse(curveName,pubASN1){return{keyAlgorithm:"id-ecPublicKey",ecdsaCurveName:curveName,ecdsaPublic:_parseECDSAPublic(pubASN1)}}function _checkECDSAVersion(asn){var version=asn.sub[0].content();if(version!==1){throw new Error("Unsupported ECDSA version: “_”".replace(/_/,version))}}var _cachedKeyParses={};function parseKeyText(text){if(!(text in _cachedKeyParses)){if(!KEY_TEXT_REGEXP.test(text)){throw new Error("The key text was not valid.")}var decoded=_startParse(text);var curveOID,curveName,pubPart;if(/BEGIN RSA/.test(text)){_cachedKeyParses[text]=_parseRSA(decoded)}else if(/BEGIN EC /.test(text)){_checkECDSAVersion(decoded);curveOID=decoded.sub[2].sub[0].content();curveName=_getCurveName(curveOID);pubPart=decoded.sub[3].sub[0];_cachedKeyParses[text]=_packageECDSAParse(curveName,pubPart)}else{var format=decoded.sub[1].sub[0].content();if(format===rsaEncryption_OID){var subRSA=_asn1DecodeOctets(_getContentOctets(decoded.sub[2]));_cachedKeyParses[text]=_parseRSA(subRSA)}else if(format===id_ecPublicKey_OID){curveOID=decoded.sub[1].sub[1].content();curveName=_getCurveName(curveOID);var subECDSA=_asn1DecodeOctets(_getContentOctets(decoded.sub[2]));_checkECDSAVersion(subECDSA);pubPart=subECDSA.sub[2].sub[0];return _packageECDSAParse(curveName,pubPart)}else{_throwUnknownKeyOID(format)}}}return JSON.parse(JSON.stringify(_cachedKeyParses[text]))}function _throwUnknownKeyOID(format){throw new Error("Unknown key algorithm OID: “_”".replace(/_/,format))}function parseTime(text){var match=TIME_REGEXP.exec(text);if(!match){return}if(match[1].length===2){match[1]=(match[1]<=50?"20":"19")+match[1]}var date=new Date(Date.UTC(match[1],Number(match[2])-1,match[3],match[4],match[5],match[6]));return date}function _parseSubjectKey(keyASN1){var algOID=keyASN1.sub[0].sub[0].content();if(algOID===rsaEncryption_OID){var modulusSubStructureOctets=_getContentOctets(keyASN1.sub[1]);var modulus=_getHex(_asn1DecodeOctets(modulusSubStructureOctets).sub[0]);return{keyAlgorithm:"rsaEncryption",modulus:modulus,modulusLength:_hexBinaryLength(modulus)}}else if(algOID===id_ecPublicKey_OID){var curveOID=keyASN1.sub[0].sub[1].content();var curveName=_getCurveName(curveOID);var pubPart=keyASN1.sub[1];return{keyAlgorithm:"id-ecPublicKey",ecdsaCurveName:curveName,ecdsaPublic:_compressECDSAPublic(_getHex(pubPart))}}_throwUnknownKeyOID(algOID)}var ecdsaCurveNickname={prime256v1:"P-256",secp384r1:"P-384"};function _ecdsaCurveDisplayName(curveName){return ecdsaCurveNickname[curveName]+"/"+curveName}function CertificateParse(source){Object.assign(this,source)}Object.assign(CertificateParse.prototype,{dispatchForKeyAlgorithm:function dispatchForKeyAlgorithm(onRsa,onEcdsa){switch(this.keyAlgorithm){case"rsaEncryption":return onRsa.bind(this)();case"id-ecPublicKey":return onEcdsa.bind(this)()}throw"Bad key algorithm: "+this.keyAlgorithm},getKeyType:function getKeyType(){return this.dispatchForKeyAlgorithm((function(){return"rsa-"+this.modulusLength}),(function(){return"ecdsa-"+this.ecdsaCurveName}))},getKeyTypeLabel:function getKeyLabel(){return this.dispatchForKeyAlgorithm((function(){return"RSA, "+LOCALE.maketext("[numf,_1]-bit",this.modulusLength)}),(function(){return"ECDSA, "+_ecdsaCurveDisplayName(this.ecdsaCurveName)}))}});var _cachedCertificateParses={};function parseCertificateText(text){if(!(text in _cachedCertificateParses)){if(!CERTIFICATE_TEXT_REGEXP.test(text)){throw new Error("The certificate text was not valid.")}var decoded=_startParse(text).sub[0];var order=X509V3_ORDER.slice(0);var version;try{version=_getContentOctets(decoded.sub[0].sub[0])[0]}catch(e){version=0;order.shift()}var parsed_extensions;var componentIndex={};for(var o=order.length;o>=0;o--){componentIndex[order[o]]=o}var keyASN1=decoded.sub[componentIndex.key];var subjectKeyParse=_parseSubjectKey(keyASN1);var subjectList=_parseSubject(decoded.sub[componentIndex.subject]);var issuerList=_parseSubject(decoded.sub[componentIndex.issuer]);var extensions=version>0?decoded.sub[decoded.sub.length-1]:undefined;extensions=extensions&&extensions.sub[0];if(extensions){var extensions_count=extensions.sub.length;parsed_extensions={};EXTENSION:for(var e=0;e<extensions_count;e++){var curExt=extensions.sub[e];var oid=curExt.sub&&curExt.sub[0]&&curExt.sub[0].content();var name=oid&&OID_NAME[oid];if(!name){continue EXTENSION}var payload_node=curExt.sub.slice(-1)[0];var ext_value=_asn1DecodeOctets(_getContentOctets(payload_node));switch(name){case"subjectAltName":var san_values=[];for(var s=0;s<ext_value.sub.length;s++){var value=ext_value.sub[s];if(value.sub){try{san_values.push({oid:value.sub[0].content(),value:_getBinary(value.sub[1].sub[0])})}catch(err){if(window.console&&console.warn){console.warn("Unparsable subjectAltName entry in certificate: ");console.warn(value,err)}}}else{san_values.push(_getBinary(ext_value.sub[s]))}}ext_value=san_values;break;case"basicConstraints":ext_value={cA:ext_value.sub[0]&&_getBinary(ext_value.sub[0])!=="0",pathLenConstraint:ext_value.sub[1]&&ext_value.sub[1].content()};break;case"keyUsage":var ones_zeros=ext_value.content().match(/[01]+$/)[0];ext_value={};for(var b=0;b<ones_zeros.length;b++){if(ones_zeros.charAt(ones_zeros.length-1-b)==="1"){ext_value[keyUsage_order[b]]=true}}break;case"netscape-cert-type":continue EXTENSION}var is_critical=false;if(curExt.sub.length>2){var critical_node=curExt.sub[1];is_critical=critical_node.tag===1&&critical_node.content()==="true"}parsed_extensions[name]={critical:is_critical,value:ext_value}}}var subject=_unrollKeyValueList(subjectList);var subjectAltName=parsed_extensions&&parsed_extensions.subjectAltName&&parsed_extensions.subjectAltName.value||[];var domains;if(subject.commonName&&subjectAltName.indexOf(subject.commonName)===-1){domains=[subject.commonName].concat(subjectAltName)}else{domains=subjectAltName.slice(0)}domains=domains.filter((function(d){return typeof d!=="object"}));var the_parse={version:1+version,notBefore:_getBinary(decoded.sub[componentIndex.dates].sub[0]),notAfter:_getBinary(decoded.sub[componentIndex.dates].sub[1]),issuer:_unrollKeyValueList(issuerList),subject:subject,subjectList:subjectList,issuerList:issuerList,extensions:parsed_extensions,domains:domains,isSelfSigned:_getBinary(decoded.sub[componentIndex.subject])===_getBinary(decoded.sub[componentIndex.issuer])};Object.assign(the_parse,subjectKeyParse);the_parse=new CertificateParse(the_parse);_cachedCertificateParses[text]=the_parse}var clone=JSON.parse(JSON.stringify(_cachedCertificateParses[text]));clone.notBefore=parseTime(clone.notBefore);clone.notAfter=parseTime(clone.notAfter);return new CertificateParse(clone)}function parseCABundleText(text){var certs=text.match(/(-+BEGIN[^\n]+-+\s+[a-zA-Z0-9\/+=\s]+\s+-+END[^\n]+-+)/g);if(!certs||!certs.length){return}var parses=certs.map((function(c){var parsed=parseCertificateText(c);parsed.text=c;return parsed}));var cab_chain=[];if(certs.length===1){cab_chain.push(parses[0])}else{var subjectLookup={};var issuers=[];var chain={};var cur,subject,issuer;while(parses.length){cur=parses.shift();subject=JSON.stringify(cur.subjectList);issuer=JSON.stringify(cur.issuerList);subjectLookup[subject]=cur;issuers.push(issuer);if(subject!==issuer){chain[subject]=cur}}while(issuers.length){delete chain[issuers.shift()]}var chainKeys=Object.keys(chain);if(chainKeys.length!==1){throw new Error("The certificates do not form a chain.")}var leafSubject=chainKeys[0];cur=subjectLookup[leafSubject];while(cur){subject=JSON.stringify(cur.subjectList);issuer=JSON.stringify(cur.issuerList);cab_chain.push(cur);if(subject===issuer){break}cur=subjectLookup[issuer]}}var root_exts_ok;try{root_exts_ok=cab_chain[0].extensions.keyUsage.value.keyCertSign;root_exts_ok=root_exts_ok||cab_chain[0].extensions.basicConstraints.value.cA}catch(e){}if(!_check_ca(cab_chain[0])){throw new Error("Root node is not a CA cert.")}return cab_chain}function _check_ca(cert){var exts=cert.extensions;if(exts){if(exts.basicConstraints){return exts.basicConstraints.value.cA?1:0}else if(exts.keyUsage){return exts.keyUsage.value.keyCertSign?4:0}}else if(cert.isSelfSigned&&cert.version===1){return 3}return 0}function validateCertificateForDomain(text,domain){var parsed=parseCertificateText(text);return doesDomainMatchOneOf(domain,parsed.domains)}function _ascii_lower_case(domain){return domain.replace(/([A-Z]+)/g,toLowerCase)}function doesDomainMatchOneOf(domain,domains){if(domains===null||domain===null){return false}domain=_ascii_lower_case(domain);domains=domains.map(_ascii_lower_case);var domains_count=domains.length;for(var i=0;i<domains_count;i++){if(!domains[i]){continue}if(domains[i]===domain){return true}else{var domain_1=domains[i];var domain_2=domain;var possible_wildcard;var domain_to_match;if(/^\*/.test(domain_1)){possible_wildcard=domain_1;domain_to_match=domain_2}else if(/^\*/.test(domain_2)){possible_wildcard=domain_2;domain_to_match=domain_1}else{continue}possible_wildcard=possible_wildcard.replace(/^\*\./,"");domain_to_match=domain_to_match.replace(/^[^\.]+\./,"");if(possible_wildcard===domain_to_match){return true}}}return false}function ecdsaEquivalentRSAModulusLength(curveName){switch(curveName){case"prime256v1":return 2529;case"secp384r1":return 6692;default:throw"Bad curve name: "+curveName}}var ssl={DEFAULT_KEY_SIZE:DEFAULT_KEY_SIZE,NEARLY_EXPIRED_WINDOW:NEARLY_EXPIRED_WINDOW,parseTime:parseTime,parseKeyText:parseKeyText,parseCertificateText:parseCertificateText,parseCABundleText:parseCABundleText,validateCertificateForDomain:validateCertificateForDomain,doesDomainMatchOneOf:doesDomainMatchOneOf,ecdsaEquivalentRSAModulusLength:ecdsaEquivalentRSAModulusLength};if(typeof window.CPANEL!=="undefined"){window.CPANEL.namespace("CPANEL.ssl");window.YAHOO.lang.augmentObject(window.CPANEL.ssl,ssl)}return ssl})(window);(function(window){"use strict";var CPANEL=window.CPANEL;var DOM=window.DOM;var EVENT=window.EVENT;var YAHOO=window.YAHOO;var ONE_DAY=1e3*60*60*24;var DEFAULT_KEY_SIZE=CPANEL.ssl.DEFAULT_KEY_SIZE;var TOKEN_PLUS_THEME=location.pathname.match(/^\/.+?\/.+?\/[^/]+/)[0];function isCertificateExpired(notAfter){return notAfter<Date.now()}function isCertificateNearlyExpired(notAfter){return notAfter.getTime()-Date.now()<CPANEL.ssl.NEARLY_EXPIRED_WINDOW}function _generateKeyInfoString(certParse){var header=certParse.getKeyTypeLabel();var detail=certParse.dispatchForKeyAlgorithm((function(){return certParse.modulus}),(function(){return certParse.ecdsaPublic}));return header+" ("+detail.substr(0,8)+" …)"}function showCertificateParse(certText,container,opts){var certParse;container=DOM.get(container);try{certParse=CPANEL.ssl.parseCertificateText(certText)}catch(e){}if(certParse){var keyinfo_html=_generateKeyInfoString(certParse);var expireTime=new Date(certParse.notAfter.getTime()+1e3);var expiration_html=LOCALE.datetime(expireTime,"datetime_format_medium");var templateEl=DOM.get("ssl_certificate_parse_template");var daysUntilExpiration=Math.floor((expireTime.getTime()-Date.now())/ONE_DAY);var template=window.Handlebars.compile(templateEl.text);var is_expired=isCertificateExpired(certParse.notAfter);var is_too_short=certParse.modulusLength&&certParse.modulusLength<DEFAULT_KEY_SIZE;var about_to_expire=!is_expired&&isCertificateNearlyExpired(certParse.notAfter);container.innerHTML=template({leading_rows:opts&&opts.leading_rows,domains:certParse.domains,issuer:certParse.issuer.organizationName,keyinfo_html:keyinfo_html,expiration_html:expiration_html,isSelfSigned:certParse.isSelfSigned,days_to_expire:daysUntilExpiration,domains_error:certParse.domains.length===0,issuer_warn:certParse.isSelfSigned,key_strength_critical:is_too_short,expiration_warn:about_to_expire,expiration_error:is_expired,expire_warn_msg:LOCALE.maketext("This certificate will expire in [quant,_1,day,days].",daysUntilExpiration)});if(certParse.isSelfSigned){EVENT.on(CPANEL.Y(container).one("a.self-signed-info"),"click",(function(){CPANEL.ajax.toggleToolTip(this,LOCALE.maketext("Self-Signed Certificates"))}))}var the_link,link_warning;if(is_too_short){the_link=CPANEL.Y(container).one("a.modulus-info");link_warning=LOCALE.maketext("This certificate’s key is too short ([quant,_1,bit,bits]). This key will not protect against a spoofing attack.",certParse.modulusLength);link_warning+=" "+LOCALE.maketext("The recommended key size for a certificate is currently [quant,_1,bit,bits].",DEFAULT_KEY_SIZE);if(certParse.isSelfSigned){link_warning+=" "+LOCALE.maketext("You should generate another self-signed certificate for [quant,_1,this domain,these domains] with a [numf,_2]-bit key.",certParse.domains.length,DEFAULT_KEY_SIZE)}else if(certParse.issuer&&certParse.issuer.organizationName){link_warning+=" "+LOCALE.maketext("Contact your certificate authority ([_1]) to reissue this certificate with a [numf,_2]-bit key.",certParse.issuer.organizationName,DEFAULT_KEY_SIZE)}else{link_warning+=" "+LOCALE.maketext("Contact your certificate authority to reissue this certificate with a longer key.")}link_warning+="\n\n"+LOCALE.maketext("It is highly recommended that you do not install this certificate.");the_link.title=link_warning+"\n\n"+the_link.title;EVENT.on(the_link,"click",(function(e){CPANEL.ajax.toggleToolTip(this,LOCALE.maketext("Certificate Key Sizes"))}))}if(about_to_expire||is_expired){the_link=CPANEL.Y(container).one("a.expiration-info");var cpmarket_can_sell_ssl=CPANEL.is_cpanel()&&window.PAGE&&window.PAGE.cpmarket_can_sell_ssl;var warning;if(certParse.isSelfSigned){warning=LOCALE.maketext("Generate and install a new self-signed certificate immediately. Then, replace this certificate with a certificate signed by a valid certificate authority as soon as possible.")}else if(cpmarket_can_sell_ssl){var url=TOKEN_PLUS_THEME+"/security/tls_wizard/";the_link.textContent=LOCALE.maketext("Purchase a new certificate.");the_link.href=url}else if(certParse.issuer&&certParse.issuer.organizationName){warning=LOCALE.maketext("You should request a replacement certificate from the issuer ([_1]) as soon as possible.",certParse.issuer.organizationName)}var shouldUseTooltip=!!warning;if(shouldUseTooltip){the_link.title=warning+"\n\n"+the_link.title;EVENT.on(the_link,"click",(function(){CPANEL.ajax.toggleToolTip(this,LOCALE.maketext("Certificate Expiration"))}))}}}else{container.innerHTML=""}return certParse||false}CPANEL.namespace("CPANEL.widgets.ssl");YAHOO.lang.augmentObject(CPANEL.widgets.ssl,{showCertificateParse:showCertificateParse})})(window);(function(window){"use strict";var YAHOO=window.YAHOO;var CPANEL=window.CPANEL;var DOM=YAHOO.util.Dom;var EVENT=YAHOO.util.Event;var LANG=YAHOO.lang;var REGION=YAHOO.util.Region;var document=window.document;var Handlebars=window.Handlebars;var PAGE=window.PAGE;var nvdata=PAGE&&PAGE.nvdata||{};var certificates_table_sort=nvdata.certificates_table_sort||{key:"domains"};var IP_COMBOBOX_CONFIG={useShadow:false,expander:"ipexpander",applyLocalFilter:true,queryMatchCase:false,typeAhead:true,autoHighlight:false};var MAX_COLUMN_WIDTH={user:90,apache:130};var STAR_DOT_REGEXP=/^[*][.]/;var SORRY_COMMA_REGEXP=/sorry,/i;var FQDN_TO_CREATED_DOMAIN={};var errorNotice;var validators={};var formProgressOverlay;var sslResultsPanel;var hiddenWhiteSpaceListTemplate;var pageHasDomainSelector=false;var lastCaughtFocus=null;var pageProgressPanel;var certificatesDataTable=null;var current_user=null;var current_browse_source=nvdata.browse_source||"user";var dialogEventsSetup=false;var installMessageMaker;var ipSelectorItemTemplate;var wildcard_subdomain_warning;function browsessl(clicked_el){clearErrorNotice();pageProgressPanel=new CPANEL.ajax.Progress_Panel(null,{zIndex:2e3,effect:CPANEL.ajax.FADE_MODAL});if(clicked_el){pageProgressPanel.show_from_source(clicked_el)}else{pageProgressPanel.show()}pageProgressPanel.after_hideEvent.subscribe(pageProgressPanel.destroy,pageProgressPanel,true);var api_call;if(CPANEL.is_whm()){if(current_browse_source==="user"){api_call={func:"listcrts",data:{user:current_user}}}else{api_call={func:"fetch_ssl_vhosts"}}}else{api_call={version:3,module:"SSL",func:"list_certs",api_data:{filter:[["domain_is_configured","eq",1]]}}}api_call.callback={success:searchOk,failure:searchFailure};CPANEL.api(api_call)}var installSuccessDomainListXform=function(d){return{domain:d,makeLink:!/^[*]/.test(d)}};function sendApacheInstall(form){form=DOM.get(form);var formdata=CPANEL.dom.get_data_from_form(form);var certParse=CPANEL.ssl.parseCertificateText(formdata.crt);var progress=new CPANEL.ajax.Progress_Panel(null,{show_status:true,status_html:LOCALE.maketext("Installing …")});progress.show_from_source(form);progress.after_hideEvent.subscribe(progress.destroy,progress,true);var reload_button_handler=function(e){var this_button=this.getButtons()[0];this_button.disabled=true;if(document.activeElement===this_button){this_button.blur()}window.location.href=window.location.pathname};var non_reload_button_handler=function(e){this.cancel()};var onsuccess=function(o){var ip=o.cpanel_data.ip||o.argument&&o.argument.ip;var tData={};if(o.cpanel_data.working_domains){tData.workingDomains=o.cpanel_data.working_domains.map(installSuccessDomainListXform);tData.workingDomainsMessage=LOCALE.maketext("The SSL website is now active and accessible via HTTPS on [numerate,_1,this domain,these domains]:",tData.workingDomains.length)}if(o.cpanel_data.warning_domains&&o.cpanel_data.warning_domains.length){tData.warningDomains=o.cpanel_data.warning_domains.map(installSuccessDomainListXform);tData.warningDomainsMessage=LOCALE.maketext("The SSL website is also accessible via [numerate,_1,this domain,these domains], but the certificate does not support [numerate,_1,it,them]. Web browsers will show a warning when accessing [numerate,_1,this domain,these domains] via HTTPS:",tData.warningDomains.length)}if(o.cpanel_data.extra_certificate_domains&&o.cpanel_data.extra_certificate_domains.length){tData.extraCertificateDomains=o.cpanel_data.extra_certificate_domains.map((function(d){return{domain:d}}));tData.extraCertificateDomainsMessage=LOCALE.maketext("The SSL certificate also supports [numerate,_1,this domain,these domains], but [numerate,_1,this domain does,these domains do] not refer to the SSL website mentioned above:",tData.extraCertificateDomains.length)}var okHandler,messageTemplate;switch(o.cpanel_data.action){case"install":tData.statusMessageHTML=LOCALE.maketext("You have successfully configured SSL.");okHandler=reload_button_handler;tData.needReload=true;break;case"update":tData.statusMessageHTML=LOCALE.maketext("You have successfully updated the SSL website’s certificate.");okHandler=reload_button_handler;tData.needReload=true;break;case"none":tData.statusMessageHTML=LOCALE.maketext("This SSL certificate was already installed.");okHandler=non_reload_button_handler}if(!messageTemplate){messageTemplate=DOM.get("installSuccessTemplate").text}if(!installMessageMaker){installMessageMaker=Handlebars.compile(messageTemplate)}var message=installMessageMaker(tData);var dialog=new CPANEL.ajax.Common_Dialog(null,{effect:CPANEL.ajax.FADE_MODAL,buttons:[{text:LOCALE.maketext("OK"),isDefault:true,handler:okHandler}]});var header_text;if(o.cpanel_data.action==="update"){header_text=LOCALE.maketext("SSL Certificate Successfully Updated")}else{header_text=LOCALE.maketext("SSL Host Successfully Installed")}dialog.setHeader(CPANEL.widgets.Dialog.applyDialogHeader(header_text));dialog.beforeShowEvent.subscribe((function(){dialog.form.innerHTML=message;dialog.center()}));progress.fade_to(dialog)};var apicall;if(CPANEL.is_cpanel()){apicall={version:3,module:"SSL",func:"install_ssl",data:{domain:formdata.domain,cert:formdata.crt,key:formdata.key,cabundle:formdata.cabundle}}}else{apicall={func:"installssl",data:{domain:formdata.domain,ip:formdata.ip,crt:formdata.crt,key:formdata.key,cab:formdata.cabundle}}}apicall.callback=CPANEL.ajax.build_page_callback(onsuccess,{on_error:function(){progress.hide()}});apicall.callback.argument={ip:formdata.ip,domain:formdata.domain};CPANEL.api(apicall)}function handleBeforeSubmit(type,args,obj){var selected=certificatesDataTable.getSelectedRows()[0];var record=certificatesDataTable.getRecord(selected);if(current_browse_source==="user"){fetchByCertId(record.getData("id"),current_user)}else{_populateFormByVhost(record.getData("servername"))}}function _populateFormByVhost(servername){CPANEL.sharedjs.sslinstall.showFormProgressOverlay();CPANEL.api({func:"fetch_vhost_ssl_components",api_data:{filter:[["servername","eq",servername]]},callback:CPANEL.ajax.build_page_callback(populate_form_with_ssl_components,{on_error:CPANEL.sharedjs.sslinstall.hideFormProgressOverlay})})}var populate_form_with_ssl_components=function(o){var payload=o.cpanel_data[0];var mainform=DOM.get("mainform");mainform.crt.value=payload.certificate;mainform.key.value=payload.key;mainform.cabundle.value=payload.cabundle||"";try{_populate_domain_from_parsed_cert(CPANEL.ssl.parseCertificateText(payload.certificate))}catch(e){}CPANEL.sharedjs.sslinstall.hideFormProgressOverlay();CPANEL.sharedjs.sslinstall.runValidation();CPANEL.sharedjs.sslinstall.updateUI()};var injectHiddenWhiteSpace=function(elCell,oRecord,oColumn,oData){if(LANG.isValue(oData)){elCell.innerHTML=oData.html_encode().replace(/\./g,'.<wbr><a class="wbr"></a>');elCell.title=oData}};var injectHiddenWhiteSpaceList=function(elCell,oRecord,oColumn,oData){if(oData&&oData.length){var array=oData;var data=[];for(var i=0,l=array.length;i<l;i++){var tmp=array[i].html_encode();var item={title:tmp,value:tmp.replace(/\./g,'.<wbr><a class="wbr"></a>')};data.push(item)}elCell.innerHTML=hiddenWhiteSpaceListTemplate({data:data})}};var formatLocaleDate=function(elCell,oRecord,oColumn,oData){if(LANG.isValue(oData)){elCell.innerHTML=LOCALE.datetime(oData,"date_format_short");elCell.title=LOCALE.datetime(oData,"datetime_format_long")}};var formatIssuer=function(elCell,oRecord,oColumn,oData){if(oRecord&&oRecord.getData("is_self_signed")){elCell.innerHTML=LOCALE.maketext("Self-Signed")}else{injectHiddenWhiteSpace.apply(this,arguments)}};var formatRadio=function(el,oRecord,oColumn,oData){var value=oData+"";el.innerHTML='<input type="radio"'+' name="selected-cert"'+' class="'+YAHOO.widget.DataTable.CLASS_RADIO+'"'+' value="'+value.html_encode()+'" />'};var parseLinuxTimeStamp=function(oData){var date=null;if(LANG.isValue(oData)&&!(oData instanceof Date)){date=new Date(parseInt(oData*1e3,10))}else{return oData}if(date instanceof Date){return date}else{YAHOO.log("Could not convert data "+LANG.dump(oData)+" to type Date","warn",this.toString());return null}};var parsePerlBoolean=function(oData){var value=null;if(LANG.isValue(oData)&&typeof oData!=="boolean"){if(oData&&parseInt(oData,10)===1){value=true}else{value=false}}else{return oData}if(typeof value==="boolean"){return value}else{YAHOO.log("Could not convert data "+LANG.dump(oData)+" to type Date","warn",this.toString());return null}};var sortIssuer=function(a,b,desc){var a_is_self_signed=a.getData("is_self_signed");var b_is_self_signed=b.getData("is_self_signed");if(a_is_self_signed){if(b_is_self_signed){return 0}return desc?-1:1}else if(b_is_self_signed){return desc?1:-1}return YAHOO.util.Sort.compare(a.getData("issuer.organizationName"),b.getData("issuer.organizationName"),desc)};var sortDomains=function(a,b,desc){return YAHOO.util.Sort.compare(a.getData("domains").join("\n"),b.getData("domains").join("\n"),desc)};var certResponseSchema={fields:["id","domain","issuer.organizationName",{key:"not_after",parser:parseLinuxTimeStamp},"friendly_name","servername","domains",{key:"is_self_signed",parser:parsePerlBoolean}]};var certColumnDefs=[{key:"id",label:"",formatter:formatRadio,sortable:false,abbr:LOCALE.maketext("Select a certificate below:")},{key:"domains",maxAutoWidth:MAX_COLUMN_WIDTH.user,label:LOCALE.maketext("Domains"),formatter:injectHiddenWhiteSpaceList,sortable:true,sortOptions:{sortFunction:sortDomains},abbr:LOCALE.maketext("Domain names on the certificate.")},{key:"issuer.organizationName",maxAutoWidth:MAX_COLUMN_WIDTH.user,label:LOCALE.maketext("Issuer"),formatter:formatIssuer,sortable:true,sortOptions:{sortFunction:sortIssuer},abbr:LOCALE.maketext("Issuer organization name.")},{key:"not_after",label:LOCALE.maketext("Expiration"),formatter:formatLocaleDate,sortable:true,abbr:LOCALE.maketext("The certificate’s expiration date")},{key:"friendly_name",maxAutoWidth:MAX_COLUMN_WIDTH.user,label:LOCALE.maketext("Description"),formatter:injectHiddenWhiteSpace,sortable:true,abbr:LOCALE.maketext("A user-defined description for the certificate.")}];function _changeUserOnReturn(o){var users=DOM.get("users");if(o.argument&&o.argument.oldActiveElement===users&&!lastCaughtFocus){users.focus()}}function changeUserComplete(o){_changeUserOnReturn(o);_set_column_widths_for_browse_source("user");certificatesDataTable.showColumn("friendly_name");_update_cert_browser_table_with_new_certs(o.cpanel_data);current_user=o.argument.user}function _set_column_widths_for_browse_source(browse_source){var colset=certificatesDataTable.getColumnSet();for(var c=0;c<colset.flat.length;c++){colset.flat[c].maxAutoWidth=MAX_COLUMN_WIDTH[browse_source]}}function _format_fetch_ssl_vhosts_for_cert_browser(vhosts){var with_cert=vhosts.filter((function(v){return v.crt}));var crts=with_cert.map((function(v){v.crt.servername=v.servername;return v.crt}));var certs_already_seen={};crts=crts.filter((function(c){if(certs_already_seen[c.id]){return false}certs_already_seen[c.id]=true;return true}));return crts}function loadApacheCertsComplete(o){certificatesDataTable.hideColumn("friendly_name");_set_column_widths_for_browse_source("apache");var crts=_format_fetch_ssl_vhosts_for_cert_browser(o.cpanel_data);_update_cert_browser_table_with_new_certs(crts)}function _update_cert_browser_table_with_new_certs(crts){_enable_cert_browser_controls();certificatesDataTable.hideTableMessage();var certDataSource=new YAHOO.util.LocalDataSource(crts);certDataSource.responseType=YAHOO.util.DataSource.TYPE_JSARRAY;certDataSource.responseSchema=certResponseSchema;certificatesDataTable.load({datasource:certDataSource});var state=certificatesDataTable.getState();if(state.sortedBy){certificatesDataTable.sortColumn(certificatesDataTable.getColumn(state.sortedBy.key),state.sortedBy.dir)}certificatesDataTable.selectRow(0)}function loadNewCertsFailed(o){_changeUserOnReturn(o);var postRenderOnFail=function(){certificatesDataTable.unsubscribe("postRenderEvent",postRenderOnFail);certificatesDataTable.showTableMessage(LOCALE.maketext("The certificate list could not be retrieved because of an error: [_1]",o.cpanel_error.html_encode()),YAHOO.widget.DataTable.CLASS_ERROR)};certificatesDataTable.subscribe("postRenderEvent",postRenderOnFail);var length=certificatesDataTable.getRecordSet().getLength();if(length>0){certificatesDataTable.deleteRows(0,length)}else{postRenderOnFail()}}function catchNextFocus(){lastCaughtFocus=null;var listener=function(e){EVENT.removeListener(this,"focusin",listener);lastCaughtFocus=e};EVENT.on(document.body,"focusin",listener)}var preventDefault=function(e){EVENT.preventDefault(e)};var _onBrowseSourceChange=function(e){var clicked_el=this;current_browse_source=clicked_el.value;if(current_browse_source==="user"){var select=DOM.get("users");_update_cert_table_for_user(select[select.selectedIndex].value)}else{_update_cert_table_for_apache()}};var _onUserChange=function(e){if(this.selectedIndex===-1){return}var new_user=this.options[this.selectedIndex].value;if(new_user!==current_user){_update_cert_table_for_user(new_user)}};var _update_cert_table_for_apache=function(){var what_to_do=function(){certificatesDataTable.showTableMessage(LOCALE.maketext("Loading installed Apache certificates …"),YAHOO.widget.DataTable.CLASS_LOADING);CPANEL.api({func:"fetch_ssl_vhosts",callback:{success:loadApacheCertsComplete,failure:loadNewCertsFailed}})};_update_cert_table(what_to_do)};var _get_cert_browser_controls=function(){return CPANEL.Y.all("input[name=browse_source], select#users")};var _set_cert_browser_controls_disabled=function(to_disable){_get_cert_browser_controls().forEach((function(el){if(to_disable||current_browse_source==="user"||el!==DOM.get("users")){el.disabled=to_disable}}))};var _enable_cert_browser_controls=function(){_set_cert_browser_controls_disabled(false)};var _disable_cert_browser_controls=function(){_set_cert_browser_controls_disabled(true)};var _update_cert_table=function(what_to_do_after_clearing_table){_disable_cert_browser_controls();catchNextFocus();var postRender=function(){certificatesDataTable.unsubscribe("postRenderEvent",postRender);return what_to_do_after_clearing_table.apply(this,arguments)};var length=certificatesDataTable.getRecordSet().getLength();if(length>0){certificatesDataTable.subscribe("postRenderEvent",postRender);certificatesDataTable.deleteRows(0,length)}else{postRender()}};var _update_cert_table_for_user=function(new_user){var oldActiveElement=document.activeElement;var postRender=function(){certificatesDataTable.showTableMessage(LOCALE.maketext("Loading certificates for “[output,strong,_1]” …",new_user),YAHOO.widget.DataTable.CLASS_LOADING);CPANEL.api({func:"listcrts",data:{user:new_user},callback:{success:changeUserComplete,failure:loadNewCertsFailed,argument:{user:new_user,oldActiveElement:oldActiveElement}}})};_update_cert_table(postRender)};function searchFailure(o){showErrorNotice(LOCALE.maketext("The certificate list could not be retrieved because of an error: [_1]",o.cpanel_error.html_encode()))}function searchOk(o){var beforeShowResultsPanel=function(){sslResultsPanel.beforeShowEvent.unsubscribe(beforeShowResultsPanel);EVENT.addListener(document.body,"scroll",preventDefault);_enable_cert_browser_controls();if(DOM.get("users")){var users=DOM.get("users");CPANEL.dom.set_form_el_value(users,current_user)}var crts=o.cpanel_data;if(CPANEL.is_cpanel()&&PAGE&&PAGE.data){var c;var installable_domains=PAGE.data.installable_domains;for(c=crts.length-1;c>=0;c--){var l=installable_domains.length;var cert_matches_at_least_one_account_domain=false;for(var i=0;i<l;i++){if(CPANEL.ssl.doesDomainMatchOneOf(installable_domains[i],crts[c].domains)){cert_matches_at_least_one_account_domain=true;break}}if(!cert_matches_at_least_one_account_domain){crts.splice(c,1)}}}else if(current_browse_source==="apache"){crts=_format_fetch_ssl_vhosts_for_cert_browser(crts);for(var cd=0;cd<certColumnDefs.length;cd++){certColumnDefs[cd].maxAutoWidth=MAX_COLUMN_WIDTH.apache;if(certColumnDefs[cd].key==="friendly_name"){certColumnDefs[cd].hidden=true}}}var certDataSource=new YAHOO.util.LocalDataSource(crts);certDataSource.responseType=YAHOO.util.DataSource.TYPE_JSARRAY;certDataSource.responseSchema=certResponseSchema;var list=DOM.get("certlist");if(list){certificatesDataTable=new YAHOO.widget.ScrollingDataTable("certlist",certColumnDefs,certDataSource,{height:"250px",className:"sortable",MSG_EMPTY:LOCALE.maketext("This account does not have any installable certificates.")});certificatesDataTable.sortColumn(certificatesDataTable.getColumn(certificates_table_sort.key),certificates_table_sort.dir||YAHOO.widget.DataTable.CLASS_ASC);certificatesDataTable.set("selectionMode","single");certificatesDataTable.subscribe("theadCellClickEvent",(function(e){if(selectedRecord){this.unselectAllRows();actionSource="sort";this.selectRow(selectedRecord)}}));certificatesDataTable.subscribe("columnSortEvent",(function(oArgs){var the_sort=this.get("sortedBy");certificates_table_sort={dir:the_sort.dir,key:the_sort.key};CPANEL.nvdata.save()}));var actionSource=null;var selectedRow=null;var selectedRecord=null;certificatesDataTable.subscribe("radioClickEvent",(function(e){var radio=e.target;if(radio.checked){this.unselectAllRows();var row=this.getTrEl(radio);actionSource="radio";this.selectRow(row)}}));certificatesDataTable.subscribe("rowSelectEvent",(function(e){this.clearTextSelection();var row=e.el;var targetRecord=this.getRecord(row);selectedRecord=targetRecord;CPANEL.Y(row).one("input.yui-dt-radio").checked=true;if(actionSource!==null){selectedRow=row;actionSource=null;return}var parentContainer=row.offsetParent.parentNode;var regionParent=REGION.getRegion(parentContainer);var regionRow=REGION.getRegion(row);var regionIntersect=regionRow.intersect(regionParent);if(regionIntersect===null||regionIntersect.getArea()===0||regionIntersect.height<regionRow.height){var deltaHeight=regionIntersect?regionIntersect.height:0;var nextRow=this.getNextTrEl(row);var scrollingUp=selectedRow===nextRow;if(scrollingUp){parentContainer.scrollTop-=regionRow.height+deltaHeight}else{parentContainer.scrollTop+=regionRow.height+deltaHeight}}selectedRow=row}));certificatesDataTable.subscribe("rowDblclickEvent",(function(e){this.clearTextSelection();EVENT.preventDefault(e);var row=DOM.get(e.target);this.getRecord(row);sslResultsPanel.submit()}));certificatesDataTable.subscribe("rowClickEvent",(function(e){EVENT.preventDefault(e);this.unselectAllRows();var row=DOM.get(e.target);actionSource="click";this.selectRow(row)}));certificatesDataTable.subscribe("postRenderEvent",(function(e){sslResultsPanel.center()}));certificatesDataTable.selectRow(0)}};if(!dialogEventsSetup){sslResultsPanel.beforeHideEvent.subscribe((function(){EVENT.removeListener(document.body,"scroll",preventDefault);certificatesDataTable.destroy();certificatesDataTable=null}));dialogEventsSetup=true}sslResultsPanel.beforeShowEvent.subscribe(beforeShowResultsPanel);pageProgressPanel.fade_to(sslResultsPanel)}function clearErrorNotice(){if(errorNotice&&errorNotice.cfg){errorNotice.hide();errorNotice.destroy();errorNotice=null}}function showErrorNotice(text,extraText,extraOpenLabel,extraCloseLabel){if(formProgressOverlay&&formProgressOverlay.cfg){formProgressOverlay.hide()}if(pageProgressPanel&&pageProgressPanel.cfg){pageProgressPanel.hide()}var BUTTON_PREFIX="en_btn_";var AREA_PREFIX="en_area_";var buttonId,areaId;var elID=DOM.generateId();if(extraText){extraOpenLabel=extraOpenLabel||LOCALE.maketext("Show");extraCloseLabel=extraCloseLabel||LOCALE.maketext("Hide");buttonId=BUTTON_PREFIX+elID;areaId=AREA_PREFIX+elID;text+=YAHOO.lang.substitute(DOM.get("error-extra-block").text,{btnId:buttonId,areaId:areaId,label:extraOpenLabel,content:extraText.html_encode()})}errorNotice=new CPANEL.widgets.Dynamic_Page_Notice({level:"error",content:text,visible:false});if(extraText){errorNotice.beforeShowEvent.subscribe((function(e){var theButtonId=buttonId;var btn=DOM.get(theButtonId);EVENT.on(btn,"click",(function(e){var el=DOM.get(areaId);if(DOM.getStyle(el,"display")==="none"){DOM.setStyle(el,"display","");this.innerHTML=extraCloseLabel}else{DOM.setStyle(el,"display","none");this.innerHTML=extraOpenLabel}errorNotice=null}))}))}errorNotice.show();errorNotice.hideEvent.subscribe((function(){CPANEL.align_panels_event.fire()}));CPANEL.align_panels_event.fire()}function showFormProgressOverlay(content_html){if(!formProgressOverlay||!formProgressOverlay.cfg){formProgressOverlay=new CPANEL.ajax.Page_Progress_Overlay(null,{zIndex:2e3,covers:DOM.get("mainform"),show_status:!!content_html,status_html:content_html})}else{formProgressOverlay.set_status_now(content_html)}formProgressOverlay.show()}function hideFormProgressOverlay(content_html){formProgressOverlay.hide()}var validateDomain=function(el){var val=typeof el==="object"?el.value:el;val=val.trim();return!val||CPANEL.validate.host(val.replace(/^\*\./,""))};function _validate_services_selected(){return!!CPANEL.dom.get_data_from_form("mainform").service}var validateIP=function(el){return!validateIP_fail_reason(el)?true:false};var validateIP_fail_reason=function(el){var val=typeof el==="object"?el.value:el;if(val.length){if(!CPANEL.validate.ip(val)){return LOCALE.maketext("Enter a valid IP address.")}var sslips=PAGE.properties&&PAGE.properties.sslips;if(sslips&&!sslips[val]){return LOCALE.maketext("The IP address “[_1]” is not available, or you do not have permission to use it.",val)}}return""};var validateCert=function(el){var val=el.value.trim();if(!val){return true}try{return!!CPANEL.ssl.parseCertificateText(val)}catch(e){return false}return true};var validateKey=function(el){var val=el.value.trim();if(!val){return true}var parse;try{parse=CPANEL.ssl.parseKeyText(val)}catch(e){}return!!parse};var validateCABundle=function(el){var val=el.value.trim();if(!val){return true}try{return!!CPANEL.ssl.parseCABundleText(val)}catch(e){return false}return true};var validateDomainCertificateMatch=function(el){var cert=el.value.trim();if(!cert){return true}var formData=CPANEL.dom.get_data_from_form("mainform");var domain=formData.domain;if(!validateDomain(domain)){return true}var all_fqdns=[domain];if(pageHasDomainSelector){var alias_subdomains=PAGE.data.domain_aliases[domain]||[];all_fqdns=all_fqdns.concat(alias_subdomains.map((function(as){return as+"."+domain})))}return all_fqdns.some((function(fqdn){try{return CPANEL.ssl.validateCertificateForDomain(cert,fqdn)}catch(e){return true}}))};var validateKeyCert=function(el){var val=el.value.trim();if(!val){return true}try{var key_parse=CPANEL.ssl.parseKeyText(val);var cert_text=el.form.crt.value.trim();var cert_parse=CPANEL.ssl.parseCertificateText(cert_text);return cert_parse.modulus===key_parse.modulus}catch(e){return true}};var validateCABundleCert=function(el){var cab=el.value.trim();if(!cab){return true}var cert=el.form.crt.value.trim();try{var cert_parse=CPANEL.ssl.parseCertificateText(cert);var cab_parse=CPANEL.ssl.parseCABundleText(cab);var cabLeafSubject=JSON.stringify(cab_parse.shift().subjectList);var certIssuer=JSON.stringify(cert_parse.issuerList);return cabLeafSubject===certIssuer}catch(e){return true}};var wrapCode=function(str){return"<code>"+str.html_encode()+"</code>"};var delayed_updateUI=function(opts){window.setTimeout((function(){updateUI(opts)}),1)};var updateUI=function(opts){var certParse;var pageForm=DOM.get("mainform");var formData=CPANEL.dom.get_data_from_form(pageForm);var formDomain=formData.domain;var formCrt=formData.crt;try{certParse=CPANEL.ssl.parseCertificateText(formCrt)}catch(e){}var shown=CPANEL.widgets.ssl.showCertificateParse(formCrt.trim(),"cert_parse",{});DOM.setStyle("cert_parse","display",shown?"":"none");if(DOM.get("fetch-cert")){DOM.get("fetch-cert").disabled=!certParse}if(DOM.get("fetch-domain")){DOM.get("fetch-domain").disabled=!validateDomain(formDomain)}if(opts&&opts.active_element){var domainFieldHasText=formDomain&&formDomain.trim()?1:0;var crtFieldHasText=formCrt&&formCrt.trim()?1:0;if(opts.active_element==="domain"&&domainFieldHasText||!crtFieldHasText&&domainFieldHasText){if(DOM.getStyle("fetch-cert","display")!=="none"){CPANEL.animate.fade_out("fetch-cert")}if(DOM.getStyle("fetch-domain","display")==="none"){CPANEL.animate.fade_in("fetch-domain")}}else if(certParse){if(PAGE.ui_mode!=="services"&&DOM.getStyle("fetch-domain","display")!=="none"){CPANEL.animate.fade_out("fetch-domain")}if(DOM.getStyle("fetch-cert","display")==="none"){CPANEL.animate.fade_in("fetch-cert")}}}CPANEL.align_panels_event.fire()};function sslInfoFailure(o){showErrorNotice(LOCALE.maketext("The lookup failed because of an error: [_1]",o.cpanel_error.html_encode()))}function sslInfoOk(o){formProgressOverlay.hide();var result=o.cpanel_data[0]||o.cpanel_data;if(!result){return}var need=o.argument&&o.argument.need;var exceptions=o.argument&&o.argument.exceptions;var formParse=CPANEL.dom.get_data_from_form("mainform");var setCert=!o.argument||o.argument.known!=="crt";var setIp=!formParse.ip||!validateIP(formParse.ip);["key","cab","crt","domain","ip"].forEach((function(i){var curResult=result[i];var elId="ssl"+i;if(!exceptions||exceptions.indexOf(elId)===-1){if(!curResult||SORRY_COMMA_REGEXP.test(curResult)||!DOM.get(elId)||need&&need!==i){return}else if(setIp&&i==="ip"&&!result.user&&PAGE.properties.sslips[curResult]){CPANEL.dom.set_form_el_value(elId,curResult)}else if(i==="domain"){setDomain(curResult)}else if(i==="crt"&&setCert||i==="key"||i==="cab"){CPANEL.dom.set_form_el_value(elId,curResult)}}}));if(!o.cpanel_data.crt&&o.cpanel_messages[0]){var notice=new CPANEL.widgets.Dynamic_Page_Notice({container:"autofill_message_container",visible:false,level:o.cpanel_messages[0].level,content:o.cpanel_messages[0].content.html_encode()});var slide=notice.animated_show();slide.onTween.subscribe(CPANEL.align_panels);notice.hideEvent.subscribe(CPANEL.align_panels)}updateUI();runValidation()}function setDomain(domain){var domainsToSet=[domain,domain.replace(STAR_DOT_REGEXP,""),""];var curDomain;while(domainsToSet[0]){curDomain=domainsToSet.shift();if(CPANEL.dom.set_form_el_value("ssldomain",curDomain)){return curDomain}}}function clearValidation(){["ip","domain","cert","key","cab"].forEach((function(validation_type){if(validators[validation_type]){validators[validation_type].clear_messages()}}))}function runValidation(){var form_values=CPANEL.dom.get_data_from_form("mainform");var validation_types=["cert","key"];if(PAGE.ui_mode!=="services"){validation_types.push("domain")}validation_types.forEach((function(validation_type){validators[validation_type].verify()}));if(validators.ip&&form_values.ip){validators.ip.verify()}validators.cab.verify()}function fetchByCertId(certId,user){showFormProgressOverlay();var api_call;if(CPANEL.is_whm()){api_call={func:"fetchcrtinfo",data:{id:certId,user:user}}}else{api_call={version:3,module:"SSL",func:"fetch_cert_info",data:{id:certId}}}api_call.callback={success:function(o){formProgressOverlay.hide();var certParse;if(o.cpanel_data.certificate){DOM.get("sslcrt").value=o.cpanel_data.certificate;if(PAGE.ui_mode!=="services"){try{certParse=CPANEL.ssl.parseCertificateText(o.cpanel_data.certificate)}catch(e){}_populate_domain_from_parsed_cert(certParse)}}if(o.cpanel_data.key&&!SORRY_COMMA_REGEXP.test(o.cpanel_data.key)){DOM.get("sslkey").value=o.cpanel_data.key}if(certParse&&certParse.isSelfSigned){DOM.get("sslcab").value=""}else if(o.cpanel_data.cabundle&&!SORRY_COMMA_REGEXP.test(o.cpanel_data.cabundle)){DOM.get("sslcab").value=o.cpanel_data.cabundle}updateUI();runValidation()},failure:function(o){showErrorNotice(LOCALE.maketext("The certificate information could not be retrieved because of an error: [_1]",(o.cpanel_error||o.statusText).html_encode()))}};CPANEL.api(api_call)}function fetch_for_install_form(known,exceptions){clearErrorNotice();var formData=CPANEL.dom.get_data_from_form("mainform");var domain=formData.domain;if(domain){domain=domain.trim()}var sslcrt=formData.crt;if(sslcrt){sslcrt=sslcrt.trim()}var callData={};if(known==="crt"&&sslcrt&&!SORRY_COMMA_REGEXP.test(sslcrt)){callData.crtdata=sslcrt;callData.certificate=sslcrt}else if(known==="domain"&&domain){callData.domain=domain}else if(sslcrt&&!SORRY_COMMA_REGEXP.test(sslcrt)){callData.crtdata=sslcrt;callData.certificate=sslcrt;known="crt"}else if(domain){callData.domain=domain;known="domain"}else{return}var api_req={data:callData,callback:{success:sslInfoOk,failure:sslInfoFailure,argument:{known:known,exceptions:exceptions}}};if(known==="domain"){api_req.api_data={paginate:{start:0,size:1}};var all_domains=[callData.domain];if(callData.domain.substr(0,1)!=="*"){var aliases;if(CPANEL.is_whm()){aliases=PAGE.auto_domains}else{aliases=PAGE.data.domain_aliases[callData.domain]}aliases=aliases.map((function(ad){return ad+"."+callData.domain}));all_domains.push.apply(all_domains,aliases)}callData.domains=all_domains.join(",");delete callData.domain}if(CPANEL.is_whm()){api_req.func=known==="domain"?"fetch_ssl_certificates_for_fqdns":"fetchsslinfo"}else{api_req.version=3;api_req.module="SSL";api_req.func=known==="domain"?"fetch_certificates_for_fqdns":"fetch_key_and_cabundle_for_certificate"}CPANEL.api(api_req);if(formProgressOverlay&&formProgressOverlay.cfg){formProgressOverlay.destroy()}showFormProgressOverlay()}var _initializeIpSelector=function(){var ips=PAGE.properties.sslips;var ip_options=PAGE.properties.ip_options;var cfg=YAHOO.lang.augmentObject({maxResultsDisplayed:ip_options.length},IP_COMBOBOX_CONFIG);var ipcombo=new CPANEL.widgets.Combobox(DOM.get("sslip"),null,ip_options,cfg);ipcombo.itemSelectEvent.subscribe((function(type,ACo){var selected_ip=ACo[2][0];if(!DOM.get("ssldomain").value&&ips[selected_ip]&&ips[selected_ip].sslhost){if(ips[selected_ip].hasssl){DOM.get("ssldomain").value=ips[selected_ip].sslhost}else if(ips[selected_ip].iptype==="dedicated"){}ssldomain_change_delayed()}runValidation()}));ipcombo.formatResult=function(oResultItem,sQuery){var ip=oResultItem[0];var ip_info;if(ips[ip].primary_ssl_servername){if(ips[ip].primary_ssl_aliases&&ips[ip].primary_ssl_aliases.length){ip_info=LOCALE.maketext("SSL is installed; “[_1]” ([numerate,_2,alias,aliases] [list_and,_3]) is primary.",ips[ip].primary_ssl_servername,ips[ip].primary_ssl_aliases.length,ips[ip].primary_ssl_aliases.sort())}else{ip_info=LOCALE.maketext("SSL is installed; “[_1]” is primary.",ips[ip].primary_ssl_servername)}}var sMarkup=ipSelectorItemTemplate({ip:ip,hasssl:!!ips[ip].primary_ssl_servername,isShared:!!parseInt(ips[ip].is_shared_ip,10),ipInfo_html:ip_info});return sMarkup}};var parse_and_do_cert_validate=function(opts){updateUI(opts);validators.cert.verify()};var delayed_parse_and_do_cert_validate=function(opts){delayed_updateUI(opts);window.setTimeout(validators.cert.verify.bind(validators.cert),1)};var ssldomain_change_delayed=function(){delayed_parse_and_do_cert_validate({active_element:"domain"})};var ssldomain_change=function(){parse_and_do_cert_validate({active_element:"domain"})};var delayed_ip_domain_validate=function(){window.setTimeout((function(){validators.ip.verify()}),1)};var delayed_key_cab_validate=function(){window.setTimeout((function(){validators.key.verify();validators.cab.verify()}),1)};var sslcrt_change=function(){updateUI({active_element:"crt"})};var sslcrt_change_delayed=function(){delayed_updateUI({active_element:"crt"})};var _hide_wildcard_subdomain_warning=function(){if(wildcard_subdomain_warning){wildcard_subdomain_warning.hide()}};var _process_wildcard_subdomain_warning=function(){var formDomain=this.value.trim();if(formDomain&&/^\*\./.test(formDomain)){var base_domain=formDomain.substr(2)||"domain.com";var wildcard_domain=formDomain.substr(0,2)+base_domain;var content=LOCALE.maketext("We recommend that users manage individual subdomains (e.g., “[_1]”, “[_2]”) instead of a single wildcard subdomain (e.g., “[_3]”).","sample1."+base_domain,"sample2."+base_domain,wildcard_domain);if(!wildcard_subdomain_warning){wildcard_subdomain_warning=new CPANEL.widgets.Page_Notice({container:"wildcard_subdomain_warning",level:"warn",visible:false,content:content})}else{wildcard_subdomain_warning.cfg.setProperty("content",content)}wildcard_subdomain_warning.show()}else{_hide_wildcard_subdomain_warning()}};var _set_up_validators=function(){if(PAGE.ui_mode==="services"){validators.services=new CPANEL.validate.validator(LOCALE.maketext("Service"));validators.services.add_for_submit("service_to_install",_validate_services_selected,LOCALE.maketext("Choose a service."));validators.services.attach();EVENT.on(DOM.get("mainform").service,"click",validators.services.verify.bind(validators.services))}else{validators.domain=new CPANEL.validate.validator(LOCALE.maketext("Domain"));validators.domain.add_for_submit("ssldomain","min_length($input$,1)",LOCALE.maketext("Choose a domain."));validators.domain.add("ssldomain",validateDomain,LOCALE.maketext("This is not a valid domain."));validators.domain.validateSuccess.subscribe(_process_wildcard_subdomain_warning,DOM.get("ssldomain"),true);validators.domain.validateFailure.subscribe(_hide_wildcard_subdomain_warning);validators.domain.attach();if(DOM.get("sslip")){validators.ip=new CPANEL.validate.validator(LOCALE.maketext("IP"));validators.ip.add_for_submit("sslip",validateIP,validateIP_fail_reason);validators.ip.attach()}}validators.cert=new CPANEL.validate.validator(LOCALE.maketext("Certificate"));validators.cert.add_for_submit("sslcrt","min_length($input$.trim(),1)",LOCALE.maketext("Provide or retrieve a certificate."));validators.cert.add("sslcrt",validateCert,LOCALE.maketext("The certificate is not valid."));if(PAGE.ui_mode!=="services"){validators.cert.add("sslcrt",validateDomainCertificateMatch,LOCALE.maketext("The certificate does not match your selected domain."))}validators.cert.attach();validators.key=new CPANEL.validate.validator(LOCALE.maketext("Key"));validators.key.add_for_submit("sslkey","min_length($input$.trim(),1)",LOCALE.maketext("Provide or retrieve a key."));validators.key.add("sslkey",validateKey,LOCALE.maketext("The key is invalid."));validators.key.add("sslkey",validateKeyCert,LOCALE.maketext("The key does not match the certificate."));validators.key.attach();validators.cab=new CPANEL.validate.validator(LOCALE.maketext("Certificate Authority Bundle"));validators.cab.add("sslcab",validateCABundle,LOCALE.maketext("The CA bundle is invalid."));validators.cab.add("sslcab",validateCABundleCert,LOCALE.maketext("The CA bundle does not match the certificate."));validators.cab.attach();var submit_button=CPANEL.Y.one("#mainform input[type=submit], #mainform button[type=submit]");CPANEL.validate.attach_to_form(submit_button.id,validators,{no_panel:true,success_callback:_send_install})};var _send_install=function(){var install_function=PAGE.ui_mode==="services"?PAGE.sendInstall:sendApacheInstall;return install_function("mainform")};var _set_up_listeners=function(){EVENT.on("fetch-cert","click",(function(e){fetch_for_install_form("crt")}));if(DOM.get("fetch-domain")){EVENT.on("fetch-domain","click",(function(e){fetch_for_install_form("domain")}))}if(PAGE.ui_mode!=="services"){if(pageHasDomainSelector){EVENT.on("ssldomain","change",ssldomain_change_delayed)}else if(CPANEL.dom.has_oninput){EVENT.on("ssldomain","input",ssldomain_change)}else{EVENT.on("ssldomain","paste",ssldomain_change_delayed);EVENT.on("ssldomain","keyup",ssldomain_change_delayed);EVENT.on("ssldomain","change",ssldomain_change_delayed)}}EVENT.on("mainform","reset",(function(){delayed_updateUI();window.setTimeout(runValidation,1)}));if(CPANEL.dom.has_oninput){EVENT.on("sslcrt","input",validators.key.verify.bind(validators.key));EVENT.on("sslcrt","input",validators.cab.verify.bind(validators.cab))}else{EVENT.on("sslcrt","paste",delayed_key_cab_validate);EVENT.on("sslcrt","keyup",delayed_key_cab_validate);EVENT.on("sslcrt","change",delayed_key_cab_validate)}if(CPANEL.dom.has_oninput){EVENT.on("sslcrt","input",sslcrt_change)}else{EVENT.on("sslcrt","paste",sslcrt_change_delayed);EVENT.on("sslcrt","keyup",sslcrt_change);EVENT.on("sslcrt","change",sslcrt_change)}if(DOM.get("sslip")){if(CPANEL.dom.has_oninput){EVENT.on("ssldomain","input",validators.ip.verify.bind(validators.ip))}else{EVENT.on("ssldomain","paste",delayed_ip_domain_validate);EVENT.on("ssldomain","keyup",delayed_ip_domain_validate);EVENT.on("ssldomain","change",delayed_ip_domain_validate)}}};var make_ssl_browser_panel=function(){var new_panel=new YAHOO.widget.Dialog(DOM.generateId(),{fixedcenter:true,close:true,draggable:true,modal:true,postMethod:"none",buttons:[{text:LOCALE.maketext("Use Certificate"),handler:function(){this.submit()},isDefault:true},{text:LOCALE.maketext("Cancel"),classes:["cancel"],handler:function(){this.cancel()}}],visible:false});new_panel.setBody("");DOM.addClass(new_panel.element,"ssl-results-panel");new_panel.render(document.body);return new_panel};var _set_up_ssl_browser=function(){sslResultsPanel=make_ssl_browser_panel();sslResultsPanel.beforeSubmitEvent.subscribe(handleBeforeSubmit,sslResultsPanel);if(PAGE&&PAGE.properties){current_user=PAGE.properties.selectedUser}sslResultsPanel.setHeader(CPANEL.widgets.Dialog.applyDialogHeader(LOCALE.maketext("SSL Certificate List")));var formTemplate=Handlebars.compile(DOM.get("browsessl_default_form").text);var introBlurb;if(CPANEL.is_cpanel()){introBlurb=LOCALE.maketext("Choose a certificate to install.");var limitationBlurb=LOCALE.maketext("Certificates that do not have a domain associated with your account are not listed here.")+" ";introBlurb+=" "+limitationBlurb+" "+LOCALE.maketext("You can manage all of your saved certificates on the [output,url,_1,“Certificates” page].","crts.html")}else{introBlurb=LOCALE.maketext("Choose the account or Apache domain that contains the desired certificate to install. Then, select the certificate.")}sslResultsPanel.form.innerHTML=formTemplate({introBlurb_html:introBlurb});var template=DOM.get("hiddenWhiteSpaceListTemplate");if(template){hiddenWhiteSpaceListTemplate=Handlebars.compile(template.text)}EVENT.on("sslbrowse","click",(function(e){browsessl(this)}));EVENT.on(sslResultsPanel.form.users,"change",_onUserChange);EVENT.on(sslResultsPanel.form.browse_source,"click",_onBrowseSourceChange)};function _populate_FQDN_TO_CREATED_DOMAIN(){for(var created in PAGE.data.domain_aliases){FQDN_TO_CREATED_DOMAIN[created]=created;var aliases=PAGE.data.domain_aliases[created];for(var a=0;a<aliases.length;a++){FQDN_TO_CREATED_DOMAIN[aliases[a]+"."+created]=created}}}var _populate_domain_from_parsed_cert=function(certParse){if(certParse){var cert_domains=certParse.domains;if(CPANEL.is_whm()){DOM.get("ssldomain").value=cert_domains[0]}else{var form_data=CPANEL.dom.get_data_from_form("mainform");var selected_domain=form_data.domain.trim();var sel_dom_matches_cert=CPANEL.ssl.doesDomainMatchOneOf(selected_domain,cert_domains);if(!sel_dom_matches_cert){var set_ok;var created_domain=FQDN_TO_CREATED_DOMAIN[cert_domains[0]];if(created_domain){set_ok=CPANEL.dom.set_form_el_value("ssldomain",created_domain)}if(!set_ok){MATCH_SEEK:for(var fqdn in FQDN_TO_CREATED_DOMAIN){if(CPANEL.ssl.doesDomainMatchOneOf(fqdn,cert_domains)){created_domain=FQDN_TO_CREATED_DOMAIN[fqdn];if(CPANEL.dom.set_form_el_value("ssldomain",created_domain)){break}}}}}}}};var initialize=function(){if(PAGE.ui_mode!=="services"){new CPANEL.widgets.Page_Notice({visible:false,level:"info",content:DOM.get("ssl-install-require-template").text}).show();new CPANEL.widgets.Page_Notice(null,{visible:false,level:"info",content:LOCALE.maketext("To give website clients the best experience, ensure that each [asis,SSL] website’s certificate matches every domain on the website.")+"<br><br>"+LOCALE.maketext("When you install a valid certificate onto a website, the system also configures email, calendar, web disk, and [asis,cPanel]-related services to use that certificate for all of the website’s domains that match the certificate. Requests to these services from [asis,SNI]-enabled clients via the matching domains will receive the installed certificate.")+"<br><br>"+LOCALE.maketext("For more information, read our [output,url,_1,SSL Installation Workflow] documentation.","https://go.cpanel.net/whmdocs66sslinstallworkflow")}).show()}pageHasDomainSelector=!!CPANEL.Y.one("select#ssldomain");if(pageHasDomainSelector){CPANEL.dom.normalize_select_arrows("ssldomain")}_set_up_validators();_set_up_listeners();_set_up_ssl_browser();if(DOM.get("sslip")){ipSelectorItemTemplate=Handlebars.compile(DOM.get("ipSelectorItemTemplate").text.trim());_initializeIpSelector()}updateUI();if(DOM.get("sslcrt").value.trim()){if(PAGE.ui_mode!=="services"){DOM.setStyle("fetch-cert","display","");try{var certParse=CPANEL.ssl.parseCertificateText(DOM.get("sslcrt").value.trim());var certDomains=certParse.domains.slice(0);while(certDomains[0]){if(setDomain(certDomains.shift())){break}}}catch(e){}}runValidation()}CPANEL.namespace("CPANEL.sharedjs.sslinstall");YAHOO.lang.augmentObject(CPANEL.sharedjs.sslinstall,{domain_change_delayed:ssldomain_change_delayed,updateUI:updateUI,runValidation:runValidation,clearValidation:clearValidation,showFormProgressOverlay:showFormProgressOverlay,hideFormProgressOverlay:hideFormProgressOverlay,populate_form_with_ssl_components:populate_form_with_ssl_components,make_ssl_browser_panel:make_ssl_browser_panel});if(pageHasDomainSelector){_populate_FQDN_TO_CREATED_DOMAIN()}};CPANEL.nvdata.register("certificates_table_sort",(function(){return certificates_table_sort}));if(CPANEL.is_whm()){CPANEL.nvdata.register("browse_source",(function(){return current_browse_source}))}window.fetch_for_install_form=fetch_for_install_form;YAHOO.util.Event.onDOMReady(initialize)})(window);(function(window){"use strict";var YAHOO=window.YAHOO;var CPANEL=window.CPANEL;var LOCALE=window.LOCALE;var has_submitted_once=false;function enable_all_submit_buttons(){var buttonEls=CPANEL.Y.all("input[type=submit], button[type=submit]");for(var i=0;i<buttonEls.length;i++){buttonEls[i].disabled=false}return true}function handle_single_submission_lockout(e){if(has_submitted_once){if(e){YAHOO.util.Event.preventDefault(e)}return false}else{has_submitted_once=true;var pp=new CPANEL.ajax.Progress_Panel(null,{status_html:LOCALE.maketext("Processing …"),effect:CPANEL.ajax.FADE_MODAL});var target;if(e){target=YAHOO.util.Event.getTarget(e)}if(target){pp.show_from_source(target)}else{pp.show()}return true}}YAHOO.util.Event.addListener(window,"load",enable_all_submit_buttons);YAHOO.lang.augmentObject(window,{handle_single_submission_lockout:handle_single_submission_lockout})})(window);(function(){var lang=YAHOO.lang,util=YAHOO.util,Ev=util.Event;util.DataSourceBase=function(oLiveData,oConfigs){if(oLiveData===null||oLiveData===undefined){return}this.liveData=oLiveData;this._oQueue={interval:null,conn:null,requests:[]};this.responseSchema={};if(oConfigs&&oConfigs.constructor==Object){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig]}}}var maxCacheEntries=this.maxCacheEntries;if(!lang.isNumber(maxCacheEntries)||maxCacheEntries<0){maxCacheEntries=0}this._aIntervals=[];this.createEvent("cacheRequestEvent");this.createEvent("cacheResponseEvent");this.createEvent("requestEvent");this.createEvent("responseEvent");this.createEvent("responseParseEvent");this.createEvent("responseCacheEvent");this.createEvent("dataErrorEvent");this.createEvent("cacheFlushEvent");var DS=util.DataSourceBase;this._sName="DataSource instance"+DS._nIndex;DS._nIndex++};var DS=util.DataSourceBase;lang.augmentObject(DS,{TYPE_UNKNOWN:-1,TYPE_JSARRAY:0,TYPE_JSFUNCTION:1,TYPE_XHR:2,TYPE_JSON:3,TYPE_XML:4,TYPE_TEXT:5,TYPE_HTMLTABLE:6,TYPE_SCRIPTNODE:7,TYPE_LOCAL:8,ERROR_DATAINVALID:"Invalid data",ERROR_DATANULL:"Null data",_nIndex:0,_nTransactionId:0,_cloneObject:function(o){if(!lang.isValue(o)){return o}var copy={};if(Object.prototype.toString.apply(o)==="[object RegExp]"){copy=o}else if(lang.isFunction(o)){copy=o}else if(lang.isArray(o)){var array=[];for(var i=0,len=o.length;i<len;i++){array[i]=DS._cloneObject(o[i])}copy=array}else if(lang.isObject(o)){for(var x in o){if(lang.hasOwnProperty(o,x)){if(lang.isValue(o[x])&&lang.isObject(o[x])||lang.isArray(o[x])){copy[x]=DS._cloneObject(o[x])}else{copy[x]=o[x]}}}}else{copy=o}return copy},_getLocationValue:function(field,context){var locator=field.locator||field.key||field,xmldoc=context.ownerDocument||context,result,res,value=null;try{if(!lang.isUndefined(xmldoc.evaluate)){result=xmldoc.evaluate(locator,context,xmldoc.createNSResolver(!context.ownerDocument?context.documentElement:context.ownerDocument.documentElement),0,null);while(res=result.iterateNext()){value=res.textContent}}else{xmldoc.setProperty("SelectionLanguage","XPath");result=context.selectNodes(locator)[0];value=result.value||result.text||null}return value}catch(e){}},issueCallback:function(callback,params,error,scope){if(lang.isFunction(callback)){callback.apply(scope,params)}else if(lang.isObject(callback)){scope=callback.scope||scope||window;var callbackFunc=callback.success;if(error){callbackFunc=callback.failure}if(callbackFunc){callbackFunc.apply(scope,params.concat([callback.argument]))}}},parseString:function(oData){if(!lang.isValue(oData)){return null}var string=oData+"";if(lang.isString(string)){return string}else{return null}},parseNumber:function(oData){if(!lang.isValue(oData)||oData===""){return null}var number=oData*1;if(lang.isNumber(number)){return number}else{return null}},convertNumber:function(oData){return DS.parseNumber(oData)},parseDate:function(oData){var date=null;if(lang.isValue(oData)&&!(oData instanceof Date)){date=new Date(oData)}else{return oData}if(date instanceof Date){return date}else{return null}},convertDate:function(oData){return DS.parseDate(oData)}});DS.Parser={string:DS.parseString,number:DS.parseNumber,date:DS.parseDate};DS.prototype={_sName:null,_aCache:null,_oQueue:null,_aIntervals:null,maxCacheEntries:0,liveData:null,dataType:DS.TYPE_UNKNOWN,responseType:DS.TYPE_UNKNOWN,responseSchema:null,useXPath:false,cloneBeforeCaching:false,toString:function(){return this._sName},getCachedResponse:function(oRequest,oCallback,oCaller){var aCache=this._aCache;if(this.maxCacheEntries>0){if(!aCache){this._aCache=[]}else{var nCacheLength=aCache.length;if(nCacheLength>0){var oResponse=null;this.fireEvent("cacheRequestEvent",{request:oRequest,callback:oCallback,caller:oCaller});for(var i=nCacheLength-1;i>=0;i--){var oCacheElem=aCache[i];if(this.isCacheHit(oRequest,oCacheElem.request)){oResponse=oCacheElem.response;this.fireEvent("cacheResponseEvent",{request:oRequest,response:oResponse,callback:oCallback,caller:oCaller});if(i<nCacheLength-1){aCache.splice(i,1);this.addToCache(oRequest,oResponse)}oResponse.cached=true;break}}return oResponse}}}else if(aCache){this._aCache=null}return null},isCacheHit:function(oRequest,oCachedRequest){return oRequest===oCachedRequest},addToCache:function(oRequest,oResponse){var aCache=this._aCache;if(!aCache){return}while(aCache.length>=this.maxCacheEntries){aCache.shift()}oResponse=this.cloneBeforeCaching?DS._cloneObject(oResponse):oResponse;var oCacheElem={request:oRequest,response:oResponse};aCache[aCache.length]=oCacheElem;this.fireEvent("responseCacheEvent",{request:oRequest,response:oResponse})},flushCache:function(){if(this._aCache){this._aCache=[];this.fireEvent("cacheFlushEvent")}},setInterval:function(nMsec,oRequest,oCallback,oCaller){if(lang.isNumber(nMsec)&&nMsec>=0){var oSelf=this;var nId=setInterval((function(){oSelf.makeConnection(oRequest,oCallback,oCaller)}),nMsec);this._aIntervals.push(nId);return nId}else{}},clearInterval:function(nId){var tracker=this._aIntervals||[];for(var i=tracker.length-1;i>-1;i--){if(tracker[i]===nId){tracker.splice(i,1);clearInterval(nId)}}},clearAllIntervals:function(){var tracker=this._aIntervals||[];for(var i=tracker.length-1;i>-1;i--){clearInterval(tracker[i])}tracker=[]},sendRequest:function(oRequest,oCallback,oCaller){var oCachedResponse=this.getCachedResponse(oRequest,oCallback,oCaller);if(oCachedResponse){DS.issueCallback(oCallback,[oRequest,oCachedResponse],false,oCaller);return null}return this.makeConnection(oRequest,oCallback,oCaller)},makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oRawResponse=this.liveData;this.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);return tId},handleResponse:function(oRequest,oRawResponse,oCallback,oCaller,tId){this.fireEvent("responseEvent",{tId:tId,request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller});var xhr=this.dataType==DS.TYPE_XHR?true:false;var oParsedResponse=null;var oFullResponse=oRawResponse;if(this.responseType===DS.TYPE_UNKNOWN){var ctype=oRawResponse&&oRawResponse.getResponseHeader?oRawResponse.getResponseHeader["Content-Type"]:null;if(ctype){if(ctype.indexOf("text/xml")>-1){this.responseType=DS.TYPE_XML}else if(ctype.indexOf("application/json")>-1){this.responseType=DS.TYPE_JSON}else if(ctype.indexOf("text/plain")>-1){this.responseType=DS.TYPE_TEXT}}else{if(YAHOO.lang.isArray(oRawResponse)){this.responseType=DS.TYPE_JSARRAY}else if(oRawResponse&&oRawResponse.nodeType&&(oRawResponse.nodeType===9||oRawResponse.nodeType===1||oRawResponse.nodeType===11)){this.responseType=DS.TYPE_XML}else if(oRawResponse&&oRawResponse.nodeName&&oRawResponse.nodeName.toLowerCase()=="table"){this.responseType=DS.TYPE_HTMLTABLE}else if(YAHOO.lang.isObject(oRawResponse)){this.responseType=DS.TYPE_JSON}else if(YAHOO.lang.isString(oRawResponse)){this.responseType=DS.TYPE_TEXT}}}switch(this.responseType){case DS.TYPE_JSARRAY:if(xhr&&oRawResponse&&oRawResponse.responseText){oFullResponse=oRawResponse.responseText}try{if(lang.isString(oFullResponse)){var parseArgs=[oFullResponse].concat(this.parseJSONArgs);if(lang.JSON){oFullResponse=lang.JSON.parse.apply(lang.JSON,parseArgs)}else if(window.JSON&&JSON.parse){oFullResponse=JSON.parse.apply(JSON,parseArgs)}else if(oFullResponse.parseJSON){oFullResponse=oFullResponse.parseJSON.apply(oFullResponse,parseArgs.slice(1))}else{while(oFullResponse.length>0&&oFullResponse.charAt(0)!="{"&&oFullResponse.charAt(0)!="["){oFullResponse=oFullResponse.substring(1,oFullResponse.length)}if(oFullResponse.length>0){var arrayEnd=Math.max(oFullResponse.lastIndexOf("]"),oFullResponse.lastIndexOf("}"));oFullResponse=oFullResponse.substring(0,arrayEnd+1);oFullResponse=eval("("+oFullResponse+")")}}}}catch(e1){}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseArrayData(oRequest,oFullResponse);break;case DS.TYPE_JSON:if(xhr&&oRawResponse&&oRawResponse.responseText){oFullResponse=oRawResponse.responseText}try{if(lang.isString(oFullResponse)){var parseArgs=[oFullResponse].concat(this.parseJSONArgs);if(lang.JSON){oFullResponse=lang.JSON.parse.apply(lang.JSON,parseArgs)}else if(window.JSON&&JSON.parse){oFullResponse=JSON.parse.apply(JSON,parseArgs)}else if(oFullResponse.parseJSON){oFullResponse=oFullResponse.parseJSON.apply(oFullResponse,parseArgs.slice(1))}else{while(oFullResponse.length>0&&oFullResponse.charAt(0)!="{"&&oFullResponse.charAt(0)!="["){oFullResponse=oFullResponse.substring(1,oFullResponse.length)}if(oFullResponse.length>0){var objEnd=Math.max(oFullResponse.lastIndexOf("]"),oFullResponse.lastIndexOf("}"));oFullResponse=oFullResponse.substring(0,objEnd+1);oFullResponse=eval("("+oFullResponse+")")}}}}catch(e){}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseJSONData(oRequest,oFullResponse);break;case DS.TYPE_HTMLTABLE:if(xhr&&oRawResponse.responseText){var el=document.createElement("div");el.innerHTML=oRawResponse.responseText;oFullResponse=el.getElementsByTagName("table")[0]}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseHTMLTableData(oRequest,oFullResponse);break;case DS.TYPE_XML:if(xhr&&oRawResponse.responseXML){oFullResponse=oRawResponse.responseXML}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseXMLData(oRequest,oFullResponse);break;case DS.TYPE_TEXT:if(xhr&&lang.isString(oRawResponse.responseText)){oFullResponse=oRawResponse.responseText}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseTextData(oRequest,oFullResponse);break;default:oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseData(oRequest,oFullResponse);break}oParsedResponse=oParsedResponse||{};if(!oParsedResponse.results){oParsedResponse.results=[]}if(!oParsedResponse.meta){oParsedResponse.meta={}}if(!oParsedResponse.error){oParsedResponse=this.doBeforeCallback(oRequest,oFullResponse,oParsedResponse,oCallback);this.fireEvent("responseParseEvent",{request:oRequest,response:oParsedResponse,callback:oCallback,caller:oCaller});this.addToCache(oRequest,oParsedResponse)}else{oParsedResponse.error=true;this.fireEvent("dataErrorEvent",{request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller,message:DS.ERROR_DATANULL})}oParsedResponse.tId=tId;DS.issueCallback(oCallback,[oRequest,oParsedResponse],oParsedResponse.error,oCaller)},doBeforeParseData:function(oRequest,oFullResponse,oCallback){return oFullResponse},doBeforeCallback:function(oRequest,oFullResponse,oParsedResponse,oCallback){return oParsedResponse},parseData:function(oRequest,oFullResponse){if(lang.isValue(oFullResponse)){var oParsedResponse={results:oFullResponse,meta:{}};return oParsedResponse}return null},parseArrayData:function(oRequest,oFullResponse){if(lang.isArray(oFullResponse)){var results=[],i,j,rec,field,data;if(lang.isArray(this.responseSchema.fields)){var fields=this.responseSchema.fields;for(i=fields.length-1;i>=0;--i){if(typeof fields[i]!=="object"){fields[i]={key:fields[i]}}}var parsers={},p;for(i=fields.length-1;i>=0;--i){p=(typeof fields[i].parser==="function"?fields[i].parser:DS.Parser[fields[i].parser+""])||fields[i].converter;if(p){parsers[fields[i].key]=p}}var arrType=lang.isArray(oFullResponse[0]);for(i=oFullResponse.length-1;i>-1;i--){var oResult={};rec=oFullResponse[i];if(typeof rec==="object"){for(j=fields.length-1;j>-1;j--){field=fields[j];data=arrType?rec[j]:rec[field.key];if(parsers[field.key]){data=parsers[field.key].call(this,data)}if(data===undefined){data=null}oResult[field.key]=data}}else if(lang.isString(rec)){for(j=fields.length-1;j>-1;j--){field=fields[j];data=rec;if(parsers[field.key]){data=parsers[field.key].call(this,data)}if(data===undefined){data=null}oResult[field.key]=data}}results[i]=oResult}}else{results=oFullResponse}var oParsedResponse={results:results};return oParsedResponse}return null},parseTextData:function(oRequest,oFullResponse){if(lang.isString(oFullResponse)){if(lang.isString(this.responseSchema.recordDelim)&&lang.isString(this.responseSchema.fieldDelim)){var oParsedResponse={results:[]};var recDelim=this.responseSchema.recordDelim;var fieldDelim=this.responseSchema.fieldDelim;if(oFullResponse.length>0){var newLength=oFullResponse.length-recDelim.length;if(oFullResponse.substr(newLength)==recDelim){oFullResponse=oFullResponse.substr(0,newLength)}if(oFullResponse.length>0){var recordsarray=oFullResponse.split(recDelim);for(var i=0,len=recordsarray.length,recIdx=0;i<len;++i){var bError=false,sRecord=recordsarray[i];if(lang.isString(sRecord)&&sRecord.length>0){var fielddataarray=recordsarray[i].split(fieldDelim);var oResult={};if(lang.isArray(this.responseSchema.fields)){var fields=this.responseSchema.fields;for(var j=fields.length-1;j>-1;j--){try{var data=fielddataarray[j];if(lang.isString(data)){if(data.charAt(0)=='"'){data=data.substr(1)}if(data.charAt(data.length-1)=='"'){data=data.substr(0,data.length-1)}var field=fields[j];var key=lang.isValue(field.key)?field.key:field;if(!field.parser&&field.converter){field.parser=field.converter}var parser=typeof field.parser==="function"?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data)}if(data===undefined){data=null}oResult[key]=data}else{bError=true}}catch(e){bError=true}}}else{oResult=fielddataarray}if(!bError){oParsedResponse.results[recIdx++]=oResult}}}}}return oParsedResponse}}return null},parseXMLResult:function(result){var oResult={},schema=this.responseSchema;try{for(var m=schema.fields.length-1;m>=0;m--){var field=schema.fields[m];var key=lang.isValue(field.key)?field.key:field;var data=null;if(this.useXPath){data=YAHOO.util.DataSource._getLocationValue(field,result)}else{var xmlAttr=result.attributes.getNamedItem(key);if(xmlAttr){data=xmlAttr.value}else{var xmlNode=result.getElementsByTagName(key);if(xmlNode&&xmlNode.item(0)){var item=xmlNode.item(0);data=item?item.text?item.text:item.textContent?item.textContent:null:null;if(!data){var datapieces=[];for(var j=0,len=item.childNodes.length;j<len;j++){if(item.childNodes[j].nodeValue){datapieces[datapieces.length]=item.childNodes[j].nodeValue}}if(datapieces.length>0){data=datapieces.join("")}}}}}if(data===null){data=""}if(!field.parser&&field.converter){field.parser=field.converter}var parser=typeof field.parser==="function"?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data)}if(data===undefined){data=null}oResult[key]=data}}catch(e){}return oResult},parseXMLData:function(oRequest,oFullResponse){var bError=false,schema=this.responseSchema,oParsedResponse={meta:{}},xmlList=null,metaNode=schema.metaNode,metaLocators=schema.metaFields||{},i,k,loc,v;try{if(this.useXPath){for(k in metaLocators){oParsedResponse.meta[k]=YAHOO.util.DataSource._getLocationValue(metaLocators[k],oFullResponse)}}else{metaNode=metaNode?oFullResponse.getElementsByTagName(metaNode)[0]:oFullResponse;if(metaNode){for(k in metaLocators){if(lang.hasOwnProperty(metaLocators,k)){loc=metaLocators[k];v=metaNode.getElementsByTagName(loc)[0];if(v){v=v.firstChild.nodeValue}else{v=metaNode.attributes.getNamedItem(loc);if(v){v=v.value}}if(lang.isValue(v)){oParsedResponse.meta[k]=v}}}}}xmlList=schema.resultNode?oFullResponse.getElementsByTagName(schema.resultNode):null}catch(e){}if(!xmlList||!lang.isArray(schema.fields)){bError=true}else{oParsedResponse.results=[];for(i=xmlList.length-1;i>=0;--i){var oResult=this.parseXMLResult(xmlList.item(i));oParsedResponse.results[i]=oResult}}if(bError){oParsedResponse.error=true}else{}return oParsedResponse},parseJSONData:function(oRequest,oFullResponse){var oParsedResponse={results:[],meta:{}};if(lang.isObject(oFullResponse)&&this.responseSchema.resultsList){var schema=this.responseSchema,fields=schema.fields,resultsList=oFullResponse,results=[],metaFields=schema.metaFields||{},fieldParsers=[],fieldPaths=[],simpleFields=[],bError=false,i,len,j,v,key,parser,path;var buildPath=function(needle){var path=null,keys=[],i=0;if(needle){needle=needle.replace(/\[(['"])(.*?)\1\]/g,(function(x,$1,$2){keys[i]=$2;return".@"+i++})).replace(/\[(\d+)\]/g,(function(x,$1){keys[i]=parseInt($1,10)|0;return".@"+i++})).replace(/^\./,"");if(!/[^\w\.\$@]/.test(needle)){path=needle.split(".");for(i=path.length-1;i>=0;--i){if(path[i].charAt(0)==="@"){path[i]=keys[parseInt(path[i].substr(1),10)]}}}else{}}return path};var walkPath=function(path,origin){var v=origin,i=0,len=path.length;for(;i<len&&v;++i){v=v[path[i]]}return v};path=buildPath(schema.resultsList);if(path){resultsList=walkPath(path,oFullResponse);if(resultsList===undefined){bError=true}}else{bError=true}if(!resultsList){resultsList=[]}if(!lang.isArray(resultsList)){resultsList=[resultsList]}if(!bError){if(schema.fields){var field;for(i=0,len=fields.length;i<len;i++){field=fields[i];key=field.key||field;parser=(typeof field.parser==="function"?field.parser:DS.Parser[field.parser+""])||field.converter;path=buildPath(key);if(parser){fieldParsers[fieldParsers.length]={key:key,parser:parser}}if(path){if(path.length>1){fieldPaths[fieldPaths.length]={key:key,path:path}}else{simpleFields[simpleFields.length]={key:key,path:path[0]}}}else{}}for(i=resultsList.length-1;i>=0;--i){var r=resultsList[i],rec={};if(r){for(j=simpleFields.length-1;j>=0;--j){rec[simpleFields[j].key]=r[simpleFields[j].path]!==undefined?r[simpleFields[j].path]:r[j]}for(j=fieldPaths.length-1;j>=0;--j){rec[fieldPaths[j].key]=walkPath(fieldPaths[j].path,r)}for(j=fieldParsers.length-1;j>=0;--j){var p=fieldParsers[j].key;rec[p]=fieldParsers[j].parser.call(this,rec[p]);if(rec[p]===undefined){rec[p]=null}}}results[i]=rec}}else{results=resultsList}for(key in metaFields){if(lang.hasOwnProperty(metaFields,key)){path=buildPath(metaFields[key]);if(path){v=walkPath(path,oFullResponse);oParsedResponse.meta[key]=v}}}}else{oParsedResponse.error=true}oParsedResponse.results=results}else{oParsedResponse.error=true}return oParsedResponse},parseHTMLTableData:function(oRequest,oFullResponse){var bError=false;var elTable=oFullResponse;var fields=this.responseSchema.fields;var oParsedResponse={results:[]};if(lang.isArray(fields)){for(var i=0;i<elTable.tBodies.length;i++){var elTbody=elTable.tBodies[i];for(var j=elTbody.rows.length-1;j>-1;j--){var elRow=elTbody.rows[j];var oResult={};for(var k=fields.length-1;k>-1;k--){var field=fields[k];var key=lang.isValue(field.key)?field.key:field;var data=elRow.cells[k].innerHTML;if(!field.parser&&field.converter){field.parser=field.converter}var parser=typeof field.parser==="function"?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data)}if(data===undefined){data=null}oResult[key]=data}oParsedResponse.results[j]=oResult}}}else{bError=true}if(bError){oParsedResponse.error=true}else{}return oParsedResponse}};lang.augmentProto(DS,util.EventProvider);util.LocalDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_LOCAL;if(oLiveData){if(YAHOO.lang.isArray(oLiveData)){this.responseType=DS.TYPE_JSARRAY}else if(oLiveData.nodeType&&oLiveData.nodeType==9){this.responseType=DS.TYPE_XML}else if(oLiveData.nodeName&&oLiveData.nodeName.toLowerCase()=="table"){this.responseType=DS.TYPE_HTMLTABLE;oLiveData=oLiveData.cloneNode(true)}else if(YAHOO.lang.isString(oLiveData)){this.responseType=DS.TYPE_TEXT}else if(YAHOO.lang.isObject(oLiveData)){this.responseType=DS.TYPE_JSON}}else{oLiveData=[];this.responseType=DS.TYPE_JSARRAY}util.LocalDataSource.superclass.constructor.call(this,oLiveData,oConfigs)};lang.extend(util.LocalDataSource,DS);lang.augmentObject(util.LocalDataSource,DS);util.FunctionDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_JSFUNCTION;oLiveData=oLiveData||function(){};util.FunctionDataSource.superclass.constructor.call(this,oLiveData,oConfigs)};lang.extend(util.FunctionDataSource,DS,{scope:null,makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oRawResponse=this.scope?this.liveData.call(this.scope,oRequest,this,oCallback):this.liveData(oRequest,oCallback);if(this.responseType===DS.TYPE_UNKNOWN){if(YAHOO.lang.isArray(oRawResponse)){this.responseType=DS.TYPE_JSARRAY}else if(oRawResponse&&oRawResponse.nodeType&&oRawResponse.nodeType==9){this.responseType=DS.TYPE_XML}else if(oRawResponse&&oRawResponse.nodeName&&oRawResponse.nodeName.toLowerCase()=="table"){this.responseType=DS.TYPE_HTMLTABLE}else if(YAHOO.lang.isObject(oRawResponse)){this.responseType=DS.TYPE_JSON}else if(YAHOO.lang.isString(oRawResponse)){this.responseType=DS.TYPE_TEXT}}this.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);return tId}});lang.augmentObject(util.FunctionDataSource,DS);util.ScriptNodeDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_SCRIPTNODE;oLiveData=oLiveData||"";util.ScriptNodeDataSource.superclass.constructor.call(this,oLiveData,oConfigs)};lang.extend(util.ScriptNodeDataSource,DS,{getUtility:util.Get,asyncMode:"allowAll",scriptCallbackParam:"callback",generateRequestCallback:function(id){return"&"+this.scriptCallbackParam+"=YAHOO.util.ScriptNodeDataSource.callbacks["+id+"]"},doBeforeGetScriptNode:function(sUri){return sUri},makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});if(util.ScriptNodeDataSource._nPending===0){util.ScriptNodeDataSource.callbacks=[];util.ScriptNodeDataSource._nId=0}var id=util.ScriptNodeDataSource._nId;util.ScriptNodeDataSource._nId++;var oSelf=this;util.ScriptNodeDataSource.callbacks[id]=function(oRawResponse){if(oSelf.asyncMode!=="ignoreStaleResponses"||id===util.ScriptNodeDataSource.callbacks.length-1){if(oSelf.responseType===DS.TYPE_UNKNOWN){if(YAHOO.lang.isArray(oRawResponse)){oSelf.responseType=DS.TYPE_JSARRAY}else if(oRawResponse.nodeType&&oRawResponse.nodeType==9){oSelf.responseType=DS.TYPE_XML}else if(oRawResponse.nodeName&&oRawResponse.nodeName.toLowerCase()=="table"){oSelf.responseType=DS.TYPE_HTMLTABLE}else if(YAHOO.lang.isObject(oRawResponse)){oSelf.responseType=DS.TYPE_JSON}else if(YAHOO.lang.isString(oRawResponse)){oSelf.responseType=DS.TYPE_TEXT}}oSelf.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId)}else{}delete util.ScriptNodeDataSource.callbacks[id]};util.ScriptNodeDataSource._nPending++;var sUri=this.liveData+oRequest+this.generateRequestCallback(id);sUri=this.doBeforeGetScriptNode(sUri);this.getUtility.script(sUri,{autopurge:true,onsuccess:util.ScriptNodeDataSource._bumpPendingDown,onfail:util.ScriptNodeDataSource._bumpPendingDown});return tId}});lang.augmentObject(util.ScriptNodeDataSource,DS);lang.augmentObject(util.ScriptNodeDataSource,{_nId:0,_nPending:0,callbacks:[]});util.XHRDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_XHR;this.connMgr=this.connMgr||util.Connect;oLiveData=oLiveData||"";util.XHRDataSource.superclass.constructor.call(this,oLiveData,oConfigs)};lang.extend(util.XHRDataSource,DS,{connMgr:null,connXhrMode:"allowAll",connMethodPost:false,connTimeout:0,makeConnection:function(oRequest,oCallback,oCaller){var oRawResponse=null;var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oSelf=this;var oConnMgr=this.connMgr;var oQueue=this._oQueue;var _xhrSuccess=function(oResponse){if(oResponse&&this.connXhrMode=="ignoreStaleResponses"&&oResponse.tId!=oQueue.conn.tId){return null}else if(!oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,response:null,callback:oCallback,caller:oCaller,message:DS.ERROR_DATANULL});DS.issueCallback(oCallback,[oRequest,{error:true}],true,oCaller);return null}else{if(this.responseType===DS.TYPE_UNKNOWN){var ctype=oResponse.getResponseHeader?oResponse.getResponseHeader["Content-Type"]:null;if(ctype){if(ctype.indexOf("text/xml")>-1){this.responseType=DS.TYPE_XML}else if(ctype.indexOf("application/json")>-1){this.responseType=DS.TYPE_JSON}else if(ctype.indexOf("text/plain")>-1){this.responseType=DS.TYPE_TEXT}}}this.handleResponse(oRequest,oResponse,oCallback,oCaller,tId)}};var _xhrFailure=function(oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,response:oResponse,callback:oCallback,caller:oCaller,message:DS.ERROR_DATAINVALID});if(lang.isString(this.liveData)&&lang.isString(oRequest)&&this.liveData.lastIndexOf("?")!==this.liveData.length-1&&oRequest.indexOf("?")!==0){}oResponse=oResponse||{};oResponse.error=true;DS.issueCallback(oCallback,[oRequest,oResponse],true,oCaller);return null};var _xhrCallback={success:_xhrSuccess,failure:_xhrFailure,scope:this};if(lang.isNumber(this.connTimeout)){_xhrCallback.timeout=this.connTimeout}if(this.connXhrMode=="cancelStaleRequests"){if(oQueue.conn){if(oConnMgr.abort){oConnMgr.abort(oQueue.conn);oQueue.conn=null}else{}}}if(oConnMgr&&oConnMgr.asyncRequest){var sLiveData=this.liveData;var isPost=this.connMethodPost;var sMethod=isPost?"POST":"GET";var sUri=isPost||!lang.isValue(oRequest)?sLiveData:sLiveData+oRequest;var sRequest=isPost?oRequest:null;if(this.connXhrMode!="queueRequests"){oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,_xhrCallback,sRequest)}else{if(oQueue.conn){var allRequests=oQueue.requests;allRequests.push({request:oRequest,callback:_xhrCallback});if(!oQueue.interval){oQueue.interval=setInterval((function(){if(oConnMgr.isCallInProgress(oQueue.conn)){return}else{if(allRequests.length>0){sUri=isPost||!lang.isValue(allRequests[0].request)?sLiveData:sLiveData+allRequests[0].request;sRequest=isPost?allRequests[0].request:null;oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,allRequests[0].callback,sRequest);allRequests.shift()}else{clearInterval(oQueue.interval);oQueue.interval=null}}}),50)}}else{oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,_xhrCallback,sRequest)}}}else{DS.issueCallback(oCallback,[oRequest,{error:true}],true,oCaller)}return tId}});lang.augmentObject(util.XHRDataSource,DS);util.DataSource=function(oLiveData,oConfigs){oConfigs=oConfigs||{};var dataType=oConfigs.dataType;if(dataType){if(dataType==DS.TYPE_LOCAL){return new util.LocalDataSource(oLiveData,oConfigs)}else if(dataType==DS.TYPE_XHR){return new util.XHRDataSource(oLiveData,oConfigs)}else if(dataType==DS.TYPE_SCRIPTNODE){return new util.ScriptNodeDataSource(oLiveData,oConfigs)}else if(dataType==DS.TYPE_JSFUNCTION){return new util.FunctionDataSource(oLiveData,oConfigs)}}if(YAHOO.lang.isString(oLiveData)){return new util.XHRDataSource(oLiveData,oConfigs)}else if(YAHOO.lang.isFunction(oLiveData)){return new util.FunctionDataSource(oLiveData,oConfigs)}else{return new util.LocalDataSource(oLiveData,oConfigs)}};lang.augmentObject(util.DataSource,DS)})();YAHOO.util.Number={format:function(n,cfg){if(n===""||n===null||!isFinite(n)){return""}n=+n;cfg=YAHOO.lang.merge(YAHOO.util.Number.format.defaults,cfg||{});var stringN=n+"",absN=Math.abs(n),places=cfg.decimalPlaces||0,sep=cfg.thousandsSeparator,negFmt=cfg.negativeFormat||"-"+cfg.format,s,bits,i,precision;if(negFmt.indexOf("#")>-1){negFmt=negFmt.replace(/#/,cfg.format)}if(places<0){s=absN-absN%1+"";i=s.length+places;if(i>0){s=Number("."+s).toFixed(i).slice(2)+new Array(s.length-i+1).join("0")}else{s="0"}}else{var unfloatedN=absN+"";if(places>0||unfloatedN.indexOf(".")>0){var power=Math.pow(10,places);s=Math.round(absN*power)/power+"";var dot=s.indexOf("."),padding,zeroes;if(dot<0){padding=places;zeroes=(Math.pow(10,padding)+"").substring(1);if(places>0){s=s+"."+zeroes}}else{padding=places-(s.length-dot-1);zeroes=(Math.pow(10,padding)+"").substring(1);s=s+zeroes}}else{s=absN.toFixed(places)+""}}bits=s.split(/\D/);if(absN>=1e3){i=bits[0].length%3||3;bits[0]=bits[0].slice(0,i)+bits[0].slice(i).replace(/(\d{3})/g,sep+"$1")}return YAHOO.util.Number.format._applyFormat(n<0?negFmt:cfg.format,bits.join(cfg.decimalSeparator),cfg)}};YAHOO.util.Number.format.defaults={format:"{prefix}{number}{suffix}",negativeFormat:null,decimalSeparator:".",decimalPlaces:null,thousandsSeparator:""};YAHOO.util.Number.format._applyFormat=function(tmpl,num,data){return tmpl.replace(/\{(\w+)\}/g,(function(_,token){return token==="number"?num:token in data?data[token]:""}))};(function(){var xPad=function(x,pad,r){if(typeof r==="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};var Dt={formats:{a:function(d,l){return l.a[d.getDay()]},A:function(d,l){return l.A[d.getDay()]},b:function(d,l){return l.b[d.getMonth()]},B:function(d,l){return l.B[d.getMonth()]},C:function(d){return xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return xPad(parseInt(Dt.formats.G(d)%100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Dt.formats.V(d),10);var W=parseInt(Dt.formats.W(d),10);if(W>V){y++}else if(W===0&&V>=52){y--}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return xPad(I===0?12:I,0)},j:function(d){var gmd_1=new Date(""+d.getFullYear()+"/1/1 GMT");var gmdate=new Date(""+d.getFullYear()+"/"+(d.getMonth()+1)+"/"+d.getDate()+" GMT");var ms=gmdate-gmd_1;var doy=parseInt(ms/6e4/60/24,10)+1;return xPad(doy,0,100)},k:["getHours"," "],l:function(d){var I=d.getHours()%12;return xPad(I===0?12:I," ")},m:function(d){return xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d,l){return l.p[d.getHours()>=12?1:0]},P:function(d,l){return l.P[d.getHours()>=12?1:0]},s:function(d,l){return parseInt(d.getTime()/1e3,10)},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Dt.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return xPad(woy,0)},V:function(d){var woy=parseInt(Dt.formats.W(d),10);var dow1_1=new Date(""+d.getFullYear()+"/1/1").getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow===53&&new Date(""+d.getFullYear()+"/12/31").getDay()<4){idow=1}else if(idow===0){idow=Dt.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}return xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Dt.formats.j(d),10);var rdow=7-Dt.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return xPad(woy,0,10)},y:function(d){return xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=xPad(parseInt(Math.abs(o/60),10),0);var M=xPad(Math.abs(o%60),0);return(o>0?"-":"+")+H+M},Z:function(d){var tz=d.toString().replace(/^.*:\d\d( GMT[+-]\d+)? \(?([A-Za-z ]+)\)?\d*$/,"$2").replace(/[a-z ]/g,"");if(tz.length>4){tz=Dt.formats.z(d)}return tz},"%":function(d){return"%"}},aggregates:{c:"locale",D:"%m/%d/%y",F:"%Y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"},format:function(oDate,oConfig,sLocale){oConfig=oConfig||{};if(!(oDate instanceof Date)){return YAHOO.lang.isValue(oDate)?oDate:""}var format=oConfig.format||"%m/%d/%Y";if(format==="YYYY/MM/DD"){format="%Y/%m/%d"}else if(format==="DD/MM/YYYY"){format="%d/%m/%Y"}else if(format==="MM/DD/YYYY"){format="%m/%d/%Y"}sLocale=sLocale||"en";if(!(sLocale in YAHOO.util.DateLocale)){if(sLocale.replace(/-[a-zA-Z]+$/,"")in YAHOO.util.DateLocale){sLocale=sLocale.replace(/-[a-zA-Z]+$/,"")}else{sLocale="en"}}var aLocale=YAHOO.util.DateLocale[sLocale];var replace_aggs=function(m0,m1){var f=Dt.aggregates[m1];return f==="locale"?aLocale[m1]:f};var replace_formats=function(m0,m1){var f=Dt.formats[m1];if(typeof f==="string"){return oDate[f]()}else if(typeof f==="function"){return f.call(oDate,oDate,aLocale)}else if(typeof f==="object"&&typeof f[0]==="string"){return xPad(oDate[f[0]](),f[1])}else{return m1}};while(format.match(/%[cDFhnrRtTxX]/)){format=format.replace(/%([cDFhnrRtTxX])/g,replace_aggs)}var str=format.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,replace_formats);replace_aggs=replace_formats=undefined;return str}};YAHOO.namespace("YAHOO.util");YAHOO.util.Date=Dt;YAHOO.util.DateLocale={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%d/%m/%y",X:"%T"};YAHOO.util.DateLocale["en"]=YAHOO.lang.merge(YAHOO.util.DateLocale,{});YAHOO.util.DateLocale["en-US"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"],{c:"%a %d %b %Y %I:%M:%S %p %Z",x:"%m/%d/%Y",X:"%I:%M:%S %p"});YAHOO.util.DateLocale["en-GB"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"],{r:"%l:%M:%S %P %Z"});YAHOO.util.DateLocale["en-AU"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"])})();YAHOO.register("datasource",YAHOO.util.DataSource,{version:"2.9.0",build:"2800"});YAHOO.util.Chain=function(){this.q=[].slice.call(arguments);this.createEvent("end")};YAHOO.util.Chain.prototype={id:0,run:function(){var c=this.q[0],fn;if(!c){this.fireEvent("end");return this}else if(this.id){return this}fn=c.method||c;if(typeof fn==="function"){var o=c.scope||{},args=c.argument||[],ms=c.timeout||0,me=this;if(!(args instanceof Array)){args=[args]}if(ms<0){this.id=ms;if(c.until){for(;!c.until();){fn.apply(o,args)}}else if(c.iterations){for(;c.iterations-- >0;){fn.apply(o,args)}}else{fn.apply(o,args)}this.q.shift();this.id=0;return this.run()}else{if(c.until){if(c.until()){this.q.shift();return this.run()}}else if(!c.iterations||! --c.iterations){this.q.shift()}this.id=setTimeout((function(){fn.apply(o,args);if(me.id){me.id=0;me.run()}}),ms)}}return this},add:function(c){this.q.push(c);return this},pause:function(){if(this.id>0){clearTimeout(this.id)}this.id=0;return this},stop:function(){this.pause();this.q=[];return this}};YAHOO.lang.augmentProto(YAHOO.util.Chain,YAHOO.util.EventProvider);(function(){var Event=YAHOO.util.Event,Lang=YAHOO.lang,delegates=[],getMatch=function(el,selector,container){var returnVal;if(!el||el===container){returnVal=false}else{returnVal=YAHOO.util.Selector.test(el,selector)?el:getMatch(el.parentNode,selector,container)}return returnVal};Lang.augmentObject(Event,{_createDelegate:function(fn,filter,obj,overrideContext){return function(event){var container=this,target=Event.getTarget(event),selector=filter,bDocument=container.nodeType===9,matchedEl,context,sID,sIDSelector;if(Lang.isFunction(filter)){matchedEl=filter(target)}else if(Lang.isString(filter)){if(!bDocument){sID=container.id;if(!sID){sID=Event.generateId(container)}sIDSelector="#"+sID+" ";selector=(sIDSelector+filter).replace(/,/gi,","+sIDSelector)}if(YAHOO.util.Selector.test(target,selector)){matchedEl=target}else if(YAHOO.util.Selector.test(target,selector.replace(/,/gi," *,")+" *")){matchedEl=getMatch(target,selector,container)}}if(matchedEl){context=matchedEl;if(overrideContext){if(overrideContext===true){context=obj}else{context=overrideContext}}return fn.call(context,event,matchedEl,container,obj)}}},delegate:function(container,type,fn,filter,obj,overrideContext){var sType=type,fnMouseDelegate,fnDelegate;if(Lang.isString(filter)&&!YAHOO.util.Selector){return false}if(type=="mouseenter"||type=="mouseleave"){if(!Event._createMouseDelegate){return false}sType=Event._getType(type);fnMouseDelegate=Event._createMouseDelegate(fn,obj,overrideContext);fnDelegate=Event._createDelegate((function(event,matchedEl,container){return fnMouseDelegate.call(matchedEl,event,container)}),filter,obj,overrideContext)}else{fnDelegate=Event._createDelegate(fn,filter,obj,overrideContext)}delegates.push([container,sType,fn,fnDelegate]);return Event.on(container,sType,fnDelegate)},removeDelegate:function(container,type,fn){var sType=type,returnVal=false,index,cacheItem;if(type=="mouseenter"||type=="mouseleave"){sType=Event._getType(type)}index=Event._getCacheIndex(delegates,container,sType,fn);if(index>=0){cacheItem=delegates[index]}if(container&&cacheItem){returnVal=Event.removeListener(cacheItem[0],cacheItem[1],cacheItem[3]);if(returnVal){delete delegates[index][2];delete delegates[index][3];delegates.splice(index,1)}}return returnVal}})})();(function(){var Event=YAHOO.util.Event,Lang=YAHOO.lang,addListener=Event.addListener,removeListener=Event.removeListener,getListeners=Event.getListeners,delegates=[],specialTypes={mouseenter:"mouseover",mouseleave:"mouseout"},remove=function(el,type,fn){var index=Event._getCacheIndex(delegates,el,type,fn),cacheItem,returnVal;if(index>=0){cacheItem=delegates[index]}if(el&&cacheItem){returnVal=removeListener.call(Event,cacheItem[0],type,cacheItem[3]);if(returnVal){delete delegates[index][2];delete delegates[index][3];delegates.splice(index,1)}}return returnVal};Lang.augmentObject(Event._specialTypes,specialTypes);Lang.augmentObject(Event,{_createMouseDelegate:function(fn,obj,overrideContext){return function(event,container){var el=this,relatedTarget=Event.getRelatedTarget(event),context,args;if(el!=relatedTarget&&!YAHOO.util.Dom.isAncestor(el,relatedTarget)){context=el;if(overrideContext){if(overrideContext===true){context=obj}else{context=overrideContext}}args=[event,obj];if(container){args.splice(1,0,el,container)}return fn.apply(context,args)}}},addListener:function(el,type,fn,obj,overrideContext){var fnDelegate,returnVal;if(specialTypes[type]){fnDelegate=Event._createMouseDelegate(fn,obj,overrideContext);fnDelegate.mouseDelegate=true;delegates.push([el,type,fn,fnDelegate]);returnVal=addListener.call(Event,el,type,fnDelegate)}else{returnVal=addListener.apply(Event,arguments)}return returnVal},removeListener:function(el,type,fn){var returnVal;if(specialTypes[type]){returnVal=remove.apply(Event,arguments)}else{returnVal=removeListener.apply(Event,arguments)}return returnVal},getListeners:function(el,type){var listeners=[],elListeners,bMouseOverOrOut=type==="mouseover"||type==="mouseout",bMouseDelegate,i,l;if(type&&(bMouseOverOrOut||specialTypes[type])){elListeners=getListeners.call(Event,el,this._getType(type));if(elListeners){for(i=elListeners.length-1;i>-1;i--){l=elListeners[i];bMouseDelegate=l.fn.mouseDelegate;if(specialTypes[type]&&bMouseDelegate||bMouseOverOrOut&&!bMouseDelegate){listeners.push(l)}}}}else{listeners=getListeners.apply(Event,arguments)}return listeners&&listeners.length?listeners:null}},true);Event.on=Event.addListener})();YAHOO.register("event-mouseenter",YAHOO.util.Event,{version:"2.9.0",build:"2800"});var Y_DOM=YAHOO.util.Dom,EMPTY_ARRAY=[],Y_UA=YAHOO.env.ua,Y_Lang=YAHOO.lang,Y_DOC=document,Y_DOCUMENT_ELEMENT=Y_DOC.documentElement,Y_DOM_inDoc=Y_DOM.inDocument,Y_mix=Y_Lang.augmentObject,Y_guid=Y_DOM.generateId,Y_getDoc=function(element){var doc=Y_DOC;if(element){doc=element.nodeType===9?element:element.ownerDocument||element.document||Y_DOC}return doc},Y_Array=function(o,startIdx){var l,a,start=startIdx||0;try{return Array.prototype.slice.call(o,start)}catch(e){a=[];l=o.length;for(;start<l;start++){a.push(o[start])}return a}},Y_DOM_allById=function(id,root){root=root||Y_DOC;var nodes=[],ret=[],i,node;if(root.querySelectorAll){ret=root.querySelectorAll('[id="'+id+'"]')}else if(root.all){nodes=root.all(id);if(nodes){if(nodes.nodeName){if(nodes.id===id){ret.push(nodes);nodes=EMPTY_ARRAY}else{nodes=[nodes]}}if(nodes.length){for(i=0;node=nodes[i++];){if(node.id===id||node.attributes&&node.attributes.id&&node.attributes.id.value===id){ret.push(node)}}}}}else{ret=[Y_getDoc(root).getElementById(id)]}return ret};var COMPARE_DOCUMENT_POSITION="compareDocumentPosition",OWNER_DOCUMENT="ownerDocument",Selector={_foundCache:[],useNative:true,_compare:"sourceIndex"in Y_DOCUMENT_ELEMENT?function(nodeA,nodeB){var a=nodeA.sourceIndex,b=nodeB.sourceIndex;if(a===b){return 0}else if(a>b){return 1}return-1}:Y_DOCUMENT_ELEMENT[COMPARE_DOCUMENT_POSITION]?function(nodeA,nodeB){if(nodeA[COMPARE_DOCUMENT_POSITION](nodeB)&4){return-1}else{return 1}}:function(nodeA,nodeB){var rangeA,rangeB,compare;if(nodeA&&nodeB){rangeA=nodeA[OWNER_DOCUMENT].createRange();rangeA.setStart(nodeA,0);rangeB=nodeB[OWNER_DOCUMENT].createRange();rangeB.setStart(nodeB,0);compare=rangeA.compareBoundaryPoints(1,rangeB)}return compare},_sort:function(nodes){if(nodes){nodes=Y_Array(nodes,0,true);if(nodes.sort){nodes.sort(Selector._compare)}}return nodes},_deDupe:function(nodes){var ret=[],i,node;for(i=0;node=nodes[i++];){if(!node._found){ret[ret.length]=node;node._found=true}}for(i=0;node=ret[i++];){node._found=null;node.removeAttribute("_found")}return ret},query:function(selector,root,firstOnly,skipNative){if(typeof root=="string"){root=Y_DOM.get(root);if(!root){return firstOnly?null:[]}}else{root=root||Y_DOC}var ret=[],useNative=Selector.useNative&&Y_DOC.querySelector&&!skipNative,queries=[[selector,root]],query,result,i,fn=useNative?Selector._nativeQuery:Selector._bruteQuery;if(selector&&fn){if(!skipNative&&(!useNative||root.tagName)){queries=Selector._splitQueries(selector,root)}for(i=0;query=queries[i++];){result=fn(query[0],query[1],firstOnly);if(!firstOnly){result=Y_Array(result,0,true)}if(result){ret=ret.concat(result)}}if(queries.length>1){ret=Selector._sort(Selector._deDupe(ret))}}YAHOO.log("query: "+selector+" returning: "+ret.length,"info","Selector");return firstOnly?ret[0]||null:ret},_splitQueries:function(selector,node){var groups=selector.split(","),queries=[],prefix="",i,len;if(node){if(node.tagName){node.id=node.id||Y_guid();prefix='[id="'+node.id+'"] '}for(i=0,len=groups.length;i<len;++i){selector=prefix+groups[i];queries.push([selector,node])}}return queries},_nativeQuery:function(selector,root,one){if(Y_UA.webkit&&selector.indexOf(":checked")>-1&&(Selector.pseudos&&Selector.pseudos.checked)){return Selector.query(selector,root,one,true)}try{return root["querySelector"+(one?"":"All")](selector)}catch(e){return Selector.query(selector,root,one,true)}},filter:function(nodes,selector){var ret=[],i,node;if(nodes&&selector){for(i=0;node=nodes[i++];){if(Selector.test(node,selector)){ret[ret.length]=node}}}else{YAHOO.log("invalid filter input (nodes: "+nodes+", selector: "+selector+")","warn","Selector")}return ret},test:function(node,selector,root){var ret=false,groups=selector.split(","),useFrag=false,parent,item,items,frag,i,j,group;if(node&&node.tagName){if(!root&&!Y_DOM_inDoc(node)){parent=node.parentNode;if(parent){root=parent}else{frag=node[OWNER_DOCUMENT].createDocumentFragment();frag.appendChild(node);root=frag;useFrag=true}}root=root||node[OWNER_DOCUMENT];if(!node.id){node.id=Y_guid()}for(i=0;group=groups[i++];){group+='[id="'+node.id+'"]';items=Selector.query(group,root);for(j=0;item=items[j++];){if(item===node){ret=true;break}}if(ret){break}}if(useFrag){frag.removeChild(node)}}return ret}};YAHOO.util.Selector=Selector;var PARENT_NODE="parentNode",TAG_NAME="tagName",ATTRIBUTES="attributes",COMBINATOR="combinator",PSEUDOS="pseudos",SelectorCSS2={_reRegExpTokens:/([\^\$\?\[\]\*\+\-\.\(\)\|\\])/,SORT_RESULTS:true,_children:function(node,tag){var ret=node.children,i,children=[],childNodes,child;if(node.children&&tag&&node.children.tags){children=node.children.tags(tag)}else if(!ret&&node[TAG_NAME]||ret&&tag){childNodes=ret||node.childNodes;ret=[];for(i=0;child=childNodes[i++];){if(child.tagName){if(!tag||tag===child.tagName){ret.push(child)}}}}return ret||[]},_re:{attr:/(\[[^\]]*\])/g,esc:/\\[:\[\]\(\)#\.\'\>+~"]/gi,pseudos:/(\([^\)]*\))/g},shorthand:{"\\#(-?[_a-z]+[-\\w\\uE000]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w\\uE000]*)":"[className~=$1]"},operators:{"":function(node,attr){return!!node.getAttribute(attr)},"~=":"(?:^|\\s+){val}(?:\\s+|$)","|=":"^{val}(?:-|$)"},pseudos:{"first-child":function(node){return Selector._children(node[PARENT_NODE])[0]===node}},_bruteQuery:function(selector,root,firstOnly){var ret=[],nodes=[],tokens=Selector._tokenize(selector),token=tokens[tokens.length-1],rootDoc=Y_getDoc(root),child,id,className,tagName;if(token){id=token.id;className=token.className;tagName=token.tagName||"*";if(root.getElementsByTagName){if(id&&(root.all||(root.nodeType===9||Y_DOM_inDoc(root)))){nodes=Y_DOM_allById(id,root)}else if(className){nodes=root.getElementsByClassName(className)}else{nodes=root.getElementsByTagName(tagName)}}else{child=root.firstChild;while(child){if(child.tagName){nodes.push(child)}child=child.nextSilbing||child.firstChild}}if(nodes.length){ret=Selector._filterNodes(nodes,tokens,firstOnly)}}return ret},_filterNodes:function(nodes,tokens,firstOnly){var i=0,j,len=tokens.length,n=len-1,result=[],node=nodes[0],tmpNode=node,getters=Selector.getters,operator,combinator,token,path,pass,value,tests,test;for(i=0;tmpNode=node=nodes[i++];){n=len-1;path=null;testLoop:while(tmpNode&&tmpNode.tagName){token=tokens[n];tests=token.tests;j=tests.length;if(j&&!pass){while(test=tests[--j]){operator=test[1];if(getters[test[0]]){value=getters[test[0]](tmpNode,test[0])}else{value=tmpNode[test[0]];if(value===undefined&&tmpNode.getAttribute){value=tmpNode.getAttribute(test[0])}}if(operator==="="&&value!==test[2]||typeof operator!=="string"&&operator.test&&!operator.test(value)||!operator.test&&typeof operator==="function"&&!operator(tmpNode,test[0],test[2])){if(tmpNode=tmpNode[path]){while(tmpNode&&(!tmpNode.tagName||token.tagName&&token.tagName!==tmpNode.tagName)){tmpNode=tmpNode[path]}}continue testLoop}}}n--;if(!pass&&(combinator=token.combinator)){path=combinator.axis;tmpNode=tmpNode[path];while(tmpNode&&!tmpNode.tagName){tmpNode=tmpNode[path]}if(combinator.direct){path=null}}else{result.push(node);if(firstOnly){return result}break}}}node=tmpNode=null;return result},combinators:{" ":{axis:"parentNode"},">":{axis:"parentNode",direct:true},"+":{axis:"previousSibling",direct:true}},_parsers:[{name:ATTRIBUTES,re:/^\uE003(-?[a-z]+[\w\-]*)+([~\|\^\$\*!=]=?)?['"]?([^\uE004'"]*)['"]?\uE004/i,fn:function(match,token){var operator=match[2]||"",operators=Selector.operators,escVal=match[3]?match[3].replace(/\\/g,""):"",test;if(match[1]==="id"&&operator==="="||match[1]==="className"&&Y_DOCUMENT_ELEMENT.getElementsByClassName&&(operator==="~="||operator==="=")){token.prefilter=match[1];match[3]=escVal;token[match[1]]=match[1]==="id"?match[3]:escVal}if(operator in operators){test=operators[operator];if(typeof test==="string"){match[3]=escVal.replace(Selector._reRegExpTokens,"\\$1");test=new RegExp(test.replace("{val}",match[3]))}match[2]=test}if(!token.last||token.prefilter!==match[1]){return match.slice(1)}}},{name:TAG_NAME,re:/^((?:-?[_a-z]+[\w-]*)|\*)/i,fn:function(match,token){var tag=match[1].toUpperCase();token.tagName=tag;if(tag!=="*"&&(!token.last||token.prefilter)){return[TAG_NAME,"=",tag]}if(!token.prefilter){token.prefilter="tagName"}}},{name:COMBINATOR,re:/^\s*([>+~]|\s)\s*/,fn:function(match,token){}},{name:PSEUDOS,re:/^:([\-\w]+)(?:\uE005['"]?([^\uE005]*)['"]?\uE006)*/i,fn:function(match,token){var test=Selector[PSEUDOS][match[1]];if(test){if(match[2]){match[2]=match[2].replace(/\\/g,"")}return[match[2],test]}else{return false}}}],_getToken:function(token){return{tagName:null,id:null,className:null,attributes:{},combinator:null,tests:[]}},_tokenize:function(selector){selector=selector||"";selector=Selector._replaceShorthand(Y_Lang.trim(selector));var token=Selector._getToken(),query=selector,tokens=[],found=false,match,test,i,parser;outer:do{found=false;for(i=0;parser=Selector._parsers[i++];){if(match=parser.re.exec(selector)){if(parser.name!==COMBINATOR){token.selector=selector}selector=selector.replace(match[0],"");if(!selector.length){token.last=true}if(Selector._attrFilters[match[1]]){match[1]=Selector._attrFilters[match[1]]}test=parser.fn(match,token);if(test===false){found=false;break outer}else if(test){token.tests.push(test)}if(!selector.length||parser.name===COMBINATOR){tokens.push(token);token=Selector._getToken(token);if(parser.name===COMBINATOR){token.combinator=Selector.combinators[match[1]]}}found=true}}}while(found&&selector.length);if(!found||selector.length){YAHOO.log("query: "+query+" contains unsupported token in: "+selector,"warn","Selector");tokens=[]}return tokens},_replaceShorthand:function(selector){var shorthand=Selector.shorthand,esc=selector.match(Selector._re.esc),attrs,pseudos,re,i,len;if(esc){selector=selector.replace(Selector._re.esc,"")}attrs=selector.match(Selector._re.attr);pseudos=selector.match(Selector._re.pseudos);if(attrs){selector=selector.replace(Selector._re.attr,"")}if(pseudos){selector=selector.replace(Selector._re.pseudos,"")}for(re in shorthand){if(shorthand.hasOwnProperty(re)){selector=selector.replace(new RegExp(re,"gi"),shorthand[re])}}if(attrs){for(i=0,len=attrs.length;i<len;++i){selector=selector.replace(/\uE001/,attrs[i])}}if(pseudos){for(i=0,len=pseudos.length;i<len;++i){selector=selector.replace(/\uE002/,pseudos[i])}}selector=selector.replace(/\[/g,"");selector=selector.replace(/\]/g,"");selector=selector.replace(/\(/g,"");selector=selector.replace(/\)/g,"");if(esc){for(i=0,len=esc.length;i<len;++i){selector=selector.replace("",esc[i])}}return selector},_attrFilters:{class:"className",for:"htmlFor"},getters:{href:function(node,attr){return Y_DOM.getAttribute(node,attr)}}};Y_mix(Selector,SelectorCSS2,true);Selector.getters.src=Selector.getters.rel=Selector.getters.href;if(Selector.useNative&&Y_DOC.querySelector){Selector.shorthand["\\.([^\\s\\\\(\\[:]*)"]="[class~=$1]"}Selector._reNth=/^(?:([\-]?\d*)(n){1}|(odd|even)$)*([\-+]?\d*)$/;Selector._getNth=function(node,expr,tag,reverse){Selector._reNth.test(expr);var a=parseInt(RegExp.$1,10),n=RegExp.$2,oddeven=RegExp.$3,b=parseInt(RegExp.$4,10)||0,result=[],siblings=Selector._children(node.parentNode,tag),op;if(oddeven){a=2;op="+";n="n";b=oddeven==="odd"?1:0}else if(isNaN(a)){a=n?1:0}if(a===0){if(reverse){b=siblings.length-b+1}if(siblings[b-1]===node){return true}else{return false}}else if(a<0){reverse=!!reverse;a=Math.abs(a)}if(!reverse){for(var i=b-1,len=siblings.length;i<len;i+=a){if(i>=0&&siblings[i]===node){return true}}}else{for(var i=siblings.length-b,len=siblings.length;i>=0;i-=a){if(i<len&&siblings[i]===node){return true}}}return false};Y_mix(Selector.pseudos,{root:function(node){return node===node.ownerDocument.documentElement},"nth-child":function(node,expr){return Selector._getNth(node,expr)},"nth-last-child":function(node,expr){return Selector._getNth(node,expr,null,true)},"nth-of-type":function(node,expr){return Selector._getNth(node,expr,node.tagName)},"nth-last-of-type":function(node,expr){return Selector._getNth(node,expr,node.tagName,true)},"last-child":function(node){var children=Selector._children(node.parentNode);return children[children.length-1]===node},"first-of-type":function(node){return Selector._children(node.parentNode,node.tagName)[0]===node},"last-of-type":function(node){var children=Selector._children(node.parentNode,node.tagName);return children[children.length-1]===node},"only-child":function(node){var children=Selector._children(node.parentNode);return children.length===1&&children[0]===node},"only-of-type":function(node){var children=Selector._children(node.parentNode,node.tagName);return children.length===1&&children[0]===node},empty:function(node){return node.childNodes.length===0},not:function(node,expr){return!Selector.test(node,expr)},contains:function(node,expr){var text=node.innerText||node.textContent||"";return text.indexOf(expr)>-1},checked:function(node){return node.checked===true||node.selected===true},enabled:function(node){return node.disabled!==undefined&&!node.disabled},disabled:function(node){return node.disabled}});Y_mix(Selector.operators,{"^=":"^{val}","!=":function(node,attr,val){return node[attr]!==val},"$=":"{val}$","*=":"{val}"});Selector.combinators["~"]={axis:"previousSibling"};YAHOO.register("selector",YAHOO.util.Selector,{version:"2.9.0",build:"2800"});var Dom=YAHOO.util.Dom;YAHOO.widget.ColumnSet=function(aDefinitions){this._sId=Dom.generateId(null,"yui-cs");aDefinitions=YAHOO.widget.DataTable._cloneObject(aDefinitions);this._init(aDefinitions);YAHOO.widget.ColumnSet._nCount++};YAHOO.widget.ColumnSet._nCount=0;YAHOO.widget.ColumnSet.prototype={_sId:null,_aDefinitions:null,tree:null,flat:null,keys:null,headers:null,_init:function(aDefinitions){var tree=[];var flat=[];var keys=[];var headers=[];var nodeDepth=-1;var parseColumns=function(nodeList,parent){nodeDepth++;if(!tree[nodeDepth]){tree[nodeDepth]=[]}for(var j=0;j<nodeList.length;j++){var currentNode=nodeList[j];var oColumn=new YAHOO.widget.Column(currentNode);currentNode.yuiColumnId=oColumn._sId;flat.push(oColumn);if(parent){oColumn._oParent=parent}if(YAHOO.lang.isArray(currentNode.children)){oColumn.children=currentNode.children;var terminalChildNodes=0;var countTerminalChildNodes=function(ancestor){var descendants=ancestor.children;for(var k=0;k<descendants.length;k++){if(YAHOO.lang.isArray(descendants[k].children)){countTerminalChildNodes(descendants[k])}else{terminalChildNodes++}}};countTerminalChildNodes(currentNode);oColumn._nColspan=terminalChildNodes;var currentChildren=currentNode.children;for(var k=0;k<currentChildren.length;k++){var child=currentChildren[k];if(oColumn.className&&child.className===undefined){child.className=oColumn.className}if(oColumn.editor&&child.editor===undefined){child.editor=oColumn.editor}if(oColumn.editorOptions&&child.editorOptions===undefined){child.editorOptions=oColumn.editorOptions}if(oColumn.formatter&&child.formatter===undefined){child.formatter=oColumn.formatter}if(oColumn.resizeable&&child.resizeable===undefined){child.resizeable=oColumn.resizeable}if(oColumn.sortable&&child.sortable===undefined){child.sortable=oColumn.sortable}if(oColumn.hidden){child.hidden=true}if(oColumn.width&&child.width===undefined){child.width=oColumn.width}if(oColumn.minWidth&&child.minWidth===undefined){child.minWidth=oColumn.minWidth}if(oColumn.maxAutoWidth&&child.maxAutoWidth===undefined){child.maxAutoWidth=oColumn.maxAutoWidth}if(oColumn.type&&child.type===undefined){child.type=oColumn.type}if(oColumn.type&&!oColumn.formatter){oColumn.formatter=oColumn.type}if(oColumn.text&&!YAHOO.lang.isValue(oColumn.label)){oColumn.label=oColumn.text}if(oColumn.parser){}if(oColumn.sortOptions&&(oColumn.sortOptions.ascFunction||oColumn.sortOptions.descFunction)){}}if(!tree[nodeDepth+1]){tree[nodeDepth+1]=[]}parseColumns(currentChildren,oColumn)}else{oColumn._nKeyIndex=keys.length;oColumn._nColspan=1;keys.push(oColumn)}tree[nodeDepth].push(oColumn)}nodeDepth--};if(YAHOO.lang.isArray(aDefinitions)){parseColumns(aDefinitions);this._aDefinitions=aDefinitions}else{return null}var i;var parseTreeForRowspan=function(tree){var maxRowDepth=1;var currentRow;var currentColumn;var countMaxRowDepth=function(row,tmpRowDepth){tmpRowDepth=tmpRowDepth||1;for(var n=0;n<row.length;n++){var col=row[n];if(YAHOO.lang.isArray(col.children)){tmpRowDepth++;countMaxRowDepth(col.children,tmpRowDepth);tmpRowDepth--}else{if(tmpRowDepth>maxRowDepth){maxRowDepth=tmpRowDepth}}}};for(var m=0;m<tree.length;m++){currentRow=tree[m];countMaxRowDepth(currentRow);for(var p=0;p<currentRow.length;p++){currentColumn=currentRow[p];if(!YAHOO.lang.isArray(currentColumn.children)){currentColumn._nRowspan=maxRowDepth}else{currentColumn._nRowspan=1}}maxRowDepth=1}};parseTreeForRowspan(tree);for(i=0;i<tree[0].length;i++){tree[0][i]._nTreeIndex=i}var recurseAncestorsForHeaders=function(i,oColumn){headers[i].push(oColumn.getSanitizedKey());if(oColumn._oParent){recurseAncestorsForHeaders(i,oColumn._oParent)}};for(i=0;i<keys.length;i++){headers[i]=[];recurseAncestorsForHeaders(i,keys[i]);headers[i]=headers[i].reverse()}this.tree=tree;this.flat=flat;this.keys=keys;this.headers=headers},getId:function(){return this._sId},toString:function(){return"ColumnSet instance "+this._sId},getDefinitions:function(){var aDefinitions=this._aDefinitions;var parseColumns=function(nodeList,oSelf){for(var j=0;j<nodeList.length;j++){var currentNode=nodeList[j];var oColumn=oSelf.getColumnById(currentNode.yuiColumnId);if(oColumn){var oDefinition=oColumn.getDefinition();for(var name in oDefinition){if(YAHOO.lang.hasOwnProperty(oDefinition,name)){currentNode[name]=oDefinition[name]}}}if(YAHOO.lang.isArray(currentNode.children)){parseColumns(currentNode.children,oSelf)}}};parseColumns(aDefinitions,this);this._aDefinitions=aDefinitions;return aDefinitions},getColumnById:function(column){if(YAHOO.lang.isString(column)){var allColumns=this.flat;for(var i=allColumns.length-1;i>-1;i--){if(allColumns[i]._sId===column){return allColumns[i]}}}return null},getColumn:function(column){if(YAHOO.lang.isNumber(column)&&this.keys[column]){return this.keys[column]}else if(YAHOO.lang.isString(column)){var allColumns=this.flat;var aColumns=[];for(var i=0;i<allColumns.length;i++){if(allColumns[i].key===column){aColumns.push(allColumns[i])}}if(aColumns.length===1){return aColumns[0]}else if(aColumns.length>1){return aColumns}}return null},getDescendants:function(oColumn){var oSelf=this;var allDescendants=[];var i;var parse=function(oParent){allDescendants.push(oParent);if(oParent.children){for(i=0;i<oParent.children.length;i++){parse(oSelf.getColumn(oParent.children[i].key))}}};parse(oColumn);return allDescendants}};YAHOO.widget.Column=function(oConfigs){this._sId=Dom.generateId(null,"yui-col");if(oConfigs&&YAHOO.lang.isObject(oConfigs)){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig]}}}if(!YAHOO.lang.isValue(this.key)){this.key=Dom.generateId(null,"yui-dt-col")}if(!YAHOO.lang.isValue(this.field)){this.field=this.key}YAHOO.widget.Column._nCount++;if(this.width&&!YAHOO.lang.isNumber(this.width)){this.width=null}if(this.editor&&YAHOO.lang.isString(this.editor)){this.editor=new YAHOO.widget.CellEditor(this.editor,this.editorOptions)}};YAHOO.lang.augmentObject(YAHOO.widget.Column,{_nCount:0,formatCheckbox:function(elCell,oRecord,oColumn,oData){YAHOO.widget.DataTable.formatCheckbox(elCell,oRecord,oColumn,oData)},formatCurrency:function(elCell,oRecord,oColumn,oData){YAHOO.widget.DataTable.formatCurrency(elCell,oRecord,oColumn,oData)},formatDate:function(elCell,oRecord,oColumn,oData){YAHOO.widget.DataTable.formatDate(elCell,oRecord,oColumn,oData)},formatEmail:function(elCell,oRecord,oColumn,oData){YAHOO.widget.DataTable.formatEmail(elCell,oRecord,oColumn,oData)},formatLink:function(elCell,oRecord,oColumn,oData){YAHOO.widget.DataTable.formatLink(elCell,oRecord,oColumn,oData)},formatNumber:function(elCell,oRecord,oColumn,oData){YAHOO.widget.DataTable.formatNumber(elCell,oRecord,oColumn,oData)},formatSelect:function(elCell,oRecord,oColumn,oData){YAHOO.widget.DataTable.formatDropdown(elCell,oRecord,oColumn,oData)}});YAHOO.widget.Column.prototype={_sId:null,_nKeyIndex:null,_nTreeIndex:null,_nColspan:1,_nRowspan:1,_oParent:null,_elTh:null,_elThLiner:null,_elThLabel:null,_elResizer:null,_nWidth:null,_dd:null,_ddResizer:null,key:null,field:null,label:null,abbr:null,children:null,width:null,minWidth:null,maxAutoWidth:null,hidden:false,selected:false,className:null,formatter:null,currencyOptions:null,dateOptions:null,dropdownOptions:null,editor:null,resizeable:false,sortable:false,sortOptions:null,getId:function(){return this._sId},toString:function(){return"Column instance "+this._sId},getDefinition:function(){var oDefinition={};oDefinition.abbr=this.abbr;oDefinition.className=this.className;oDefinition.editor=this.editor;oDefinition.editorOptions=this.editorOptions;oDefinition.field=this.field;oDefinition.formatter=this.formatter;oDefinition.hidden=this.hidden;oDefinition.key=this.key;oDefinition.label=this.label;oDefinition.minWidth=this.minWidth;oDefinition.maxAutoWidth=this.maxAutoWidth;oDefinition.resizeable=this.resizeable;oDefinition.selected=this.selected;oDefinition.sortable=this.sortable;oDefinition.sortOptions=this.sortOptions;oDefinition.width=this.width;oDefinition._calculatedWidth=this._calculatedWidth;return oDefinition},getKey:function(){return this.key},getField:function(){return this.field},getSanitizedKey:function(){return this.getKey().replace(/[^\w\-]/g,"")},getKeyIndex:function(){return this._nKeyIndex},getTreeIndex:function(){return this._nTreeIndex},getParent:function(){return this._oParent},getColspan:function(){return this._nColspan},getColSpan:function(){return this.getColspan()},getRowspan:function(){return this._nRowspan},getThEl:function(){return this._elTh},getThLinerEl:function(){return this._elThLiner},getResizerEl:function(){return this._elResizer},getColEl:function(){return this.getThEl()},getIndex:function(){return this.getKeyIndex()},format:function(){}};YAHOO.util.Sort={compare:function(a,b,desc){if(a===null||typeof a=="undefined"){if(b===null||typeof b=="undefined"){return 0}else{return 1}}else if(b===null||typeof b=="undefined"){return-1}if(a.constructor==String){a=a.toLowerCase()}if(b.constructor==String){b=b.toLowerCase()}if(a<b){return desc?1:-1}else if(a>b){return desc?-1:1}else{return 0}}};YAHOO.widget.ColumnDD=function(oDataTable,oColumn,elTh,elTarget){if(oDataTable&&oColumn&&elTh&&elTarget){this.datatable=oDataTable;this.table=oDataTable.getTableEl();this.column=oColumn;this.headCell=elTh;this.pointer=elTarget;this.newIndex=null;this.init(elTh);this.initFrame();this.invalidHandleTypes={};this.setPadding(10,0,this.datatable.getTheadEl().offsetHeight+10,0);YAHOO.util.Event.on(window,"resize",(function(){this.initConstraints()}),this,true)}else{}};if(YAHOO.util.DDProxy){YAHOO.extend(YAHOO.widget.ColumnDD,YAHOO.util.DDProxy,{initConstraints:function(){var region=YAHOO.util.Dom.getRegion(this.table),el=this.getEl(),xy=YAHOO.util.Dom.getXY(el),width=parseInt(YAHOO.util.Dom.getStyle(el,"width"),10),height=parseInt(YAHOO.util.Dom.getStyle(el,"height"),10),left=xy[0]-region.left+15,right=region.right-xy[0]-width+15;this.setXConstraint(left,right);this.setYConstraint(10,10)},_resizeProxy:function(){YAHOO.widget.ColumnDD.superclass._resizeProxy.apply(this,arguments);var dragEl=this.getDragEl(),el=this.getEl();YAHOO.util.Dom.setStyle(this.pointer,"height",this.table.parentNode.offsetHeight+10+"px");YAHOO.util.Dom.setStyle(this.pointer,"display","block");var xy=YAHOO.util.Dom.getXY(el);YAHOO.util.Dom.setXY(this.pointer,[xy[0],xy[1]-5]);YAHOO.util.Dom.setStyle(dragEl,"height",this.datatable.getContainerEl().offsetHeight+"px");YAHOO.util.Dom.setStyle(dragEl,"width",parseInt(YAHOO.util.Dom.getStyle(dragEl,"width"),10)+4+"px");YAHOO.util.Dom.setXY(this.dragEl,xy)},onMouseDown:function(){this.initConstraints();this.resetConstraints()},clickValidator:function(e){if(!this.column.hidden){var target=YAHOO.util.Event.getTarget(e);return this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id))}},onDragOver:function(ev,id){var target=this.datatable.getColumn(id);if(target){var targetIndex=target.getTreeIndex();while(targetIndex===null&&target.getParent()){target=target.getParent();targetIndex=target.getTreeIndex()}if(targetIndex!==null){var elTarget=target.getThEl();var newIndex=targetIndex;var mouseX=YAHOO.util.Event.getPageX(ev),targetX=YAHOO.util.Dom.getX(elTarget),midX=targetX+YAHOO.util.Dom.get(elTarget).offsetWidth/2,currentIndex=this.column.getTreeIndex();if(mouseX<midX){YAHOO.util.Dom.setX(this.pointer,targetX)}else{var targetWidth=parseInt(elTarget.offsetWidth,10);YAHOO.util.Dom.setX(this.pointer,targetX+targetWidth);newIndex++}if(targetIndex>currentIndex){newIndex--}if(newIndex<0){newIndex=0}else if(newIndex>this.datatable.getColumnSet().tree[0].length){newIndex=this.datatable.getColumnSet().tree[0].length}this.newIndex=newIndex}}},onDragDrop:function(){this.datatable.reorderColumn(this.column,this.newIndex)},endDrag:function(){this.newIndex=null;YAHOO.util.Dom.setStyle(this.pointer,"display","none")}})}YAHOO.util.ColumnResizer=function(oDataTable,oColumn,elTh,sHandleId,elProxy){if(oDataTable&&oColumn&&elTh&&sHandleId){this.datatable=oDataTable;this.column=oColumn;this.headCell=elTh;this.headCellLiner=oColumn.getThLinerEl();this.resizerLiner=elTh.firstChild;this.init(sHandleId,sHandleId,{dragOnly:true,dragElId:elProxy.id});this.initFrame();this.resetResizerEl();this.setPadding(0,1,0,0)}else{}};if(YAHOO.util.DD){YAHOO.extend(YAHOO.util.ColumnResizer,YAHOO.util.DDProxy,{resetResizerEl:function(){var resizerStyle=YAHOO.util.Dom.get(this.handleElId).style;resizerStyle.left="auto";resizerStyle.right=0;resizerStyle.top="auto";resizerStyle.bottom=0;resizerStyle.height=this.headCell.offsetHeight+"px"},onMouseUp:function(e){var allKeys=this.datatable.getColumnSet().keys,col;for(var i=0,len=allKeys.length;i<len;i++){col=allKeys[i];if(col._ddResizer){col._ddResizer.resetResizerEl()}}this.resetResizerEl();var el=this.headCellLiner;var newWidth=el.offsetWidth-(parseInt(YAHOO.util.Dom.getStyle(el,"paddingLeft"),10)|0)-(parseInt(YAHOO.util.Dom.getStyle(el,"paddingRight"),10)|0);this.datatable.fireEvent("columnResizeEvent",{column:this.column,target:this.headCell,width:newWidth})},onMouseDown:function(e){this.startWidth=this.headCellLiner.offsetWidth;this.startX=YAHOO.util.Event.getXY(e)[0];this.nLinerPadding=(parseInt(YAHOO.util.Dom.getStyle(this.headCellLiner,"paddingLeft"),10)|0)+(parseInt(YAHOO.util.Dom.getStyle(this.headCellLiner,"paddingRight"),10)|0)},clickValidator:function(e){if(!this.column.hidden){var target=YAHOO.util.Event.getTarget(e);return this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id))}},startDrag:function(){var allKeys=this.datatable.getColumnSet().keys,thisKey=this.column.getKeyIndex(),col;for(var i=0,len=allKeys.length;i<len;i++){col=allKeys[i];if(col._ddResizer){YAHOO.util.Dom.get(col._ddResizer.handleElId).style.height="1em"}}},onDrag:function(e){var newX=YAHOO.util.Event.getXY(e)[0];if(newX>YAHOO.util.Dom.getX(this.headCellLiner)){var offsetX=newX-this.startX;var newWidth=this.startWidth+offsetX-this.nLinerPadding;if(newWidth>0){this.datatable.setColumnWidth(this.column,newWidth)}}}})}(function(){var lang=YAHOO.lang,util=YAHOO.util,widget=YAHOO.widget,Dom=util.Dom,Ev=util.Event,DT=widget.DataTable;YAHOO.widget.RecordSet=function(data){this._init(data)};var RS=widget.RecordSet;RS._nCount=0;RS.prototype={_sId:null,_init:function(data){this._sId=Dom.generateId(null,"yui-rs");widget.RecordSet._nCount++;this._records=[];this._initEvents();if(data){if(lang.isArray(data)){this.addRecords(data)}else if(lang.isObject(data)){this.addRecord(data)}}},_initEvents:function(){this.createEvent("recordAddEvent");this.createEvent("recordsAddEvent");this.createEvent("recordSetEvent");this.createEvent("recordsSetEvent");this.createEvent("recordUpdateEvent");this.createEvent("recordDeleteEvent");this.createEvent("recordsDeleteEvent");this.createEvent("resetEvent");this.createEvent("recordValueUpdateEvent")},_addRecord:function(oData,index){var oRecord=new YAHOO.widget.Record(oData);if(YAHOO.lang.isNumber(index)&&index>-1){this._records.splice(index,0,oRecord)}else{this._records[this._records.length]=oRecord}return oRecord},_setRecord:function(oData,index){if(!lang.isNumber(index)||index<0){index=this._records.length}return this._records[index]=new widget.Record(oData)},_deleteRecord:function(index,range){if(!lang.isNumber(range)||range<0){range=1}this._records.splice(index,range)},getId:function(){return this._sId},toString:function(){return"RecordSet instance "+this._sId},getLength:function(){return this._records.length},getRecord:function(record){var i;if(record instanceof widget.Record){for(i=0;i<this._records.length;i++){if(this._records[i]&&this._records[i]._sId===record._sId){return record}}}else if(lang.isNumber(record)){if(record>-1&&record<this.getLength()){return this._records[record]}}else if(lang.isString(record)){for(i=0;i<this._records.length;i++){if(this._records[i]&&this._records[i]._sId===record){return this._records[i]}}}return null},getRecords:function(index,range){if(!lang.isNumber(index)){return this._records}if(!lang.isNumber(range)){return this._records.slice(index)}return this._records.slice(index,index+range)},hasRecords:function(index,range){var recs=this.getRecords(index,range);for(var i=0;i<range;++i){if(typeof recs[i]==="undefined"){return false}}return true},getRecordIndex:function(oRecord){if(oRecord){for(var i=this._records.length-1;i>-1;i--){if(this._records[i]&&oRecord.getId()===this._records[i].getId()){return i}}}return null},addRecord:function(oData,index){if(lang.isObject(oData)){var oRecord=this._addRecord(oData,index);this.fireEvent("recordAddEvent",{record:oRecord,data:oData});return oRecord}else{return null}},addRecords:function(aData,index){if(lang.isArray(aData)){var newRecords=[],idx,i,len;index=lang.isNumber(index)?index:this._records.length;idx=index;for(i=0,len=aData.length;i<len;++i){if(lang.isObject(aData[i])){var record=this._addRecord(aData[i],idx++);newRecords.push(record)}}this.fireEvent("recordsAddEvent",{records:newRecords,data:aData});return newRecords}else if(lang.isObject(aData)){var oRecord=this._addRecord(aData);this.fireEvent("recordsAddEvent",{records:[oRecord],data:aData});return oRecord}else{return null}},setRecord:function(oData,index){if(lang.isObject(oData)){var oRecord=this._setRecord(oData,index);this.fireEvent("recordSetEvent",{record:oRecord,data:oData});return oRecord}else{return null}},setRecords:function(aData,index){var Rec=widget.Record,a=lang.isArray(aData)?aData:[aData],added=[],i=0,l=a.length,j=0;index=parseInt(index,10)|0;for(;i<l;++i){if(typeof a[i]==="object"&&a[i]){added[j++]=this._records[index+i]=new Rec(a[i])}}this.fireEvent("recordsSetEvent",{records:added,data:aData});this.fireEvent("recordsSet",{records:added,data:aData});if(a.length&&!added.length){}return added},updateRecord:function(record,oData){var oRecord=this.getRecord(record);if(oRecord&&lang.isObject(oData)){var oldData={};for(var key in oRecord._oData){if(lang.hasOwnProperty(oRecord._oData,key)){oldData[key]=oRecord._oData[key]}}oRecord._oData=oData;this.fireEvent("recordUpdateEvent",{record:oRecord,newData:oData,oldData:oldData});return oRecord}else{return null}},updateKey:function(record,sKey,oData){this.updateRecordValue(record,sKey,oData)},updateRecordValue:function(record,sKey,oData){var oRecord=this.getRecord(record);if(oRecord){var oldData=null;var keyValue=oRecord._oData[sKey];if(keyValue&&lang.isObject(keyValue)){oldData={};for(var key in keyValue){if(lang.hasOwnProperty(keyValue,key)){oldData[key]=keyValue[key]}}}else{oldData=keyValue}oRecord._oData[sKey]=oData;this.fireEvent("keyUpdateEvent",{record:oRecord,key:sKey,newData:oData,oldData:oldData});this.fireEvent("recordValueUpdateEvent",{record:oRecord,key:sKey,newData:oData,oldData:oldData})}else{}},replaceRecords:function(data){this.reset();return this.addRecords(data)},sortRecords:function(fnSort,desc,field){return this._records.sort((function(a,b){return fnSort(a,b,desc,field)}))},reverseRecords:function(){return this._records.reverse()},deleteRecord:function(index){if(lang.isNumber(index)&&index>-1&&index<this.getLength()){var oData=this.getRecord(index).getData();this._deleteRecord(index);this.fireEvent("recordDeleteEvent",{data:oData,index:index});return oData}else{return null}},deleteRecords:function(index,range){if(!lang.isNumber(range)){range=1}if(lang.isNumber(index)&&index>-1&&index<this.getLength()){var recordsToDelete=this.getRecords(index,range);var deletedData=[],deletedObjects=[];for(var i=0;i<recordsToDelete.length;i++){deletedData[deletedData.length]=recordsToDelete[i];deletedObjects[deletedObjects.length]=recordsToDelete[i].getData()}this._deleteRecord(index,range);this.fireEvent("recordsDeleteEvent",{data:deletedData,deletedData:deletedObjects,index:index});return deletedData}else{return null}},reset:function(){this._records=[];this.fireEvent("resetEvent")}};lang.augmentProto(RS,util.EventProvider);YAHOO.widget.Record=function(oLiteral){this._nCount=widget.Record._nCount;this._sId=Dom.generateId(null,"yui-rec");widget.Record._nCount++;this._oData={};if(lang.isObject(oLiteral)){for(var sKey in oLiteral){if(lang.hasOwnProperty(oLiteral,sKey)){this._oData[sKey]=oLiteral[sKey]}}}};YAHOO.widget.Record._nCount=0;YAHOO.widget.Record.prototype={_nCount:null,_sId:null,_oData:null,getCount:function(){return this._nCount},getId:function(){return this._sId},getData:function(sField){if(lang.isString(sField)){return this._oData[sField]}else{return this._oData}},setData:function(sKey,oData){this._oData[sKey]=oData}}})();(function(){var lang=YAHOO.lang,util=YAHOO.util,widget=YAHOO.widget,ua=YAHOO.env.ua,Dom=util.Dom,Ev=util.Event,DS=util.DataSourceBase;YAHOO.widget.DataTable=function(elContainer,aColumnDefs,oDataSource,oConfigs){var DT=widget.DataTable;if(oConfigs&&oConfigs.scrollable){return new YAHOO.widget.ScrollingDataTable(elContainer,aColumnDefs,oDataSource,oConfigs)}this._nIndex=DT._nCount;this._sId=Dom.generateId(null,"yui-dt");this._oChainRender=new YAHOO.util.Chain;this._oChainRender.subscribe("end",this._onRenderChainEnd,this,true);this._initConfigs(oConfigs);this._initDataSource(oDataSource);if(!this._oDataSource){return}this._initColumnSet(aColumnDefs);if(!this._oColumnSet){return}this._initRecordSet();if(!this._oRecordSet){}DT.superclass.constructor.call(this,elContainer,this.configs);var okDom=this._initDomElements(elContainer);if(!okDom){return}this.showTableMessage(this.get("MSG_LOADING"),DT.CLASS_LOADING);this._initEvents();DT._nCount++;DT._nCurrentCount++;var oCallback={success:this.onDataReturnSetRows,failure:this.onDataReturnSetRows,scope:this,argument:this.getState()};var initialLoad=this.get("initialLoad");if(initialLoad===true){this._oDataSource.sendRequest(this.get("initialRequest"),oCallback)}else if(initialLoad===false){this.showTableMessage(this.get("MSG_EMPTY"),DT.CLASS_EMPTY)}else{var oCustom=initialLoad||{};oCallback.argument=oCustom.argument||{};this._oDataSource.sendRequest(oCustom.request,oCallback)}};var DT=widget.DataTable;lang.augmentObject(DT,{CLASS_DATATABLE:"yui-dt",CLASS_LINER:"yui-dt-liner",CLASS_LABEL:"yui-dt-label",CLASS_MESSAGE:"yui-dt-message",CLASS_MASK:"yui-dt-mask",CLASS_DATA:"yui-dt-data",CLASS_COLTARGET:"yui-dt-coltarget",CLASS_RESIZER:"yui-dt-resizer",CLASS_RESIZERLINER:"yui-dt-resizerliner",CLASS_RESIZERPROXY:"yui-dt-resizerproxy",CLASS_EDITOR:"yui-dt-editor",CLASS_EDITOR_SHIM:"yui-dt-editor-shim",CLASS_PAGINATOR:"yui-dt-paginator",CLASS_PAGE:"yui-dt-page",CLASS_DEFAULT:"yui-dt-default",CLASS_PREVIOUS:"yui-dt-previous",CLASS_NEXT:"yui-dt-next",CLASS_FIRST:"yui-dt-first",CLASS_LAST:"yui-dt-last",CLASS_REC:"yui-dt-rec",CLASS_EVEN:"yui-dt-even",CLASS_ODD:"yui-dt-odd",CLASS_SELECTED:"yui-dt-selected",CLASS_HIGHLIGHTED:"yui-dt-highlighted",CLASS_HIDDEN:"yui-dt-hidden",CLASS_DISABLED:"yui-dt-disabled",CLASS_EMPTY:"yui-dt-empty",CLASS_LOADING:"yui-dt-loading",CLASS_ERROR:"yui-dt-error",CLASS_EDITABLE:"yui-dt-editable",CLASS_DRAGGABLE:"yui-dt-draggable",CLASS_RESIZEABLE:"yui-dt-resizeable",CLASS_SCROLLABLE:"yui-dt-scrollable",CLASS_SORTABLE:"yui-dt-sortable",CLASS_ASC:"yui-dt-asc",CLASS_DESC:"yui-dt-desc",CLASS_BUTTON:"yui-dt-button",CLASS_CHECKBOX:"yui-dt-checkbox",CLASS_DROPDOWN:"yui-dt-dropdown",CLASS_RADIO:"yui-dt-radio",_nCount:0,_nCurrentCount:0,_elDynStyleNode:null,_bDynStylesFallback:ua.ie?true:false,_oDynStyles:{},_cloneObject:function(o){if(!lang.isValue(o)){return o}var copy={};if(o instanceof YAHOO.widget.BaseCellEditor){copy=o}else if(Object.prototype.toString.apply(o)==="[object RegExp]"){copy=o}else if(lang.isFunction(o)){copy=o}else if(lang.isArray(o)){var array=[];for(var i=0,len=o.length;i<len;i++){array[i]=DT._cloneObject(o[i])}copy=array}else if(lang.isObject(o)){for(var x in o){if(lang.hasOwnProperty(o,x)){if(lang.isValue(o[x])&&lang.isObject(o[x])||lang.isArray(o[x])){copy[x]=DT._cloneObject(o[x])}else{copy[x]=o[x]}}}}else{copy=o}return copy},formatButton:function(el,oRecord,oColumn,oData,oDataTable){var sValue=lang.isValue(oData)?oData:"Click";el.innerHTML='<button type="button" class="'+DT.CLASS_BUTTON+'">'+sValue+"</button>"},formatCheckbox:function(el,oRecord,oColumn,oData,oDataTable){var bChecked=oData;bChecked=bChecked?' checked="checked"':"";el.innerHTML='<input type="checkbox"'+bChecked+' class="'+DT.CLASS_CHECKBOX+'" />'},formatCurrency:function(el,oRecord,oColumn,oData,oDataTable){var oDT=oDataTable||this;el.innerHTML=util.Number.format(oData,oColumn.currencyOptions||oDT.get("currencyOptions"))},formatDate:function(el,oRecord,oColumn,oData,oDataTable){var oDT=oDataTable||this,oConfig=oColumn.dateOptions||oDT.get("dateOptions");el.innerHTML=util.Date.format(oData,oConfig,oConfig.locale)},formatDropdown:function(el,oRecord,oColumn,oData,oDataTable){var oDT=oDataTable||this,selectedValue=lang.isValue(oData)?oData:oRecord.getData(oColumn.field),options=lang.isArray(oColumn.dropdownOptions)?oColumn.dropdownOptions:null,selectEl,collection=el.getElementsByTagName("select");if(collection.length===0){selectEl=document.createElement("select");selectEl.className=DT.CLASS_DROPDOWN;selectEl=el.appendChild(selectEl);Ev.addListener(selectEl,"change",oDT._onDropdownChange,oDT)}selectEl=collection[0];if(selectEl){selectEl.innerHTML="";if(options){for(var i=0;i<options.length;i++){var option=options[i];var optionEl=document.createElement("option");optionEl.value=lang.isValue(option.value)?option.value:option;optionEl.innerHTML=lang.isValue(option.text)?option.text:lang.isValue(option.label)?option.label:option;optionEl=selectEl.appendChild(optionEl);if(optionEl.value==selectedValue){optionEl.selected=true}}}else{selectEl.innerHTML='<option selected value="'+selectedValue+'">'+selectedValue+"</option>"}}else{el.innerHTML=lang.isValue(oData)?oData:""}},formatEmail:function(el,oRecord,oColumn,oData,oDataTable){if(lang.isString(oData)){oData=lang.escapeHTML(oData);el.innerHTML='<a href="mailto:'+oData+'">'+oData+"</a>"}else{el.innerHTML=lang.isValue(oData)?lang.escapeHTML(oData.toString()):""}},formatLink:function(el,oRecord,oColumn,oData,oDataTable){if(lang.isString(oData)){oData=lang.escapeHTML(oData);el.innerHTML='<a href="'+oData+'">'+oData+"</a>"}else{el.innerHTML=lang.isValue(oData)?lang.escapeHTML(oData.toString()):""}},formatNumber:function(el,oRecord,oColumn,oData,oDataTable){var oDT=oDataTable||this;el.innerHTML=util.Number.format(oData,oColumn.numberOptions||oDT.get("numberOptions"))},formatRadio:function(el,oRecord,oColumn,oData,oDataTable){var oDT=oDataTable||this,bChecked=oData;bChecked=bChecked?' checked="checked"':"";el.innerHTML='<input type="radio"'+bChecked+' name="'+oDT.getId()+"-col-"+oColumn.getSanitizedKey()+'"'+' class="'+DT.CLASS_RADIO+'" />'},formatText:function(el,oRecord,oColumn,oData,oDataTable){var value=lang.isValue(oData)?oData:"";el.innerHTML=lang.escapeHTML(value.toString())},formatTextarea:function(el,oRecord,oColumn,oData,oDataTable){var value=lang.isValue(oData)?lang.escapeHTML(oData.toString()):"",markup="<textarea>"+value+"</textarea>";el.innerHTML=markup},formatTextbox:function(el,oRecord,oColumn,oData,oDataTable){var value=lang.isValue(oData)?lang.escapeHTML(oData.toString()):"",markup='<input type="text" value="'+value+'" />';el.innerHTML=markup},formatDefault:function(el,oRecord,oColumn,oData,oDataTable){el.innerHTML=lang.isValue(oData)&&oData!==""?oData.toString():"&#160;"},validateNumber:function(oData){var number=oData*1;if(lang.isNumber(number)){return number}else{return undefined}}});DT.Formatter={button:DT.formatButton,checkbox:DT.formatCheckbox,currency:DT.formatCurrency,date:DT.formatDate,dropdown:DT.formatDropdown,email:DT.formatEmail,link:DT.formatLink,number:DT.formatNumber,radio:DT.formatRadio,text:DT.formatText,textarea:DT.formatTextarea,textbox:DT.formatTextbox,defaultFormatter:DT.formatDefault};lang.extend(DT,util.Element,{initAttributes:function(oConfigs){oConfigs=oConfigs||{};DT.superclass.initAttributes.call(this,oConfigs);this.setAttributeConfig("summary",{value:"",validator:lang.isString,method:function(sSummary){if(this._elTable){this._elTable.summary=sSummary}}});this.setAttributeConfig("selectionMode",{value:"standard",validator:lang.isString});this.setAttributeConfig("sortedBy",{value:null,validator:function(oNewSortedBy){if(oNewSortedBy){return lang.isObject(oNewSortedBy)&&oNewSortedBy.key}else{return oNewSortedBy===null}},method:function(oNewSortedBy){var oOldSortedBy=this.get("sortedBy");this._configs.sortedBy.value=oNewSortedBy;var oOldColumn,nOldColumnKeyIndex,oNewColumn,nNewColumnKeyIndex;if(this._elThead){if(oOldSortedBy&&oOldSortedBy.key&&oOldSortedBy.dir){oOldColumn=this._oColumnSet.getColumn(oOldSortedBy.key);nOldColumnKeyIndex=oOldColumn.getKeyIndex();var elOldTh=oOldColumn.getThEl();Dom.removeClass(elOldTh,oOldSortedBy.dir);this.formatTheadCell(oOldColumn.getThLinerEl().firstChild,oOldColumn,oNewSortedBy)}if(oNewSortedBy){oNewColumn=oNewSortedBy.column?oNewSortedBy.column:this._oColumnSet.getColumn(oNewSortedBy.key);nNewColumnKeyIndex=oNewColumn.getKeyIndex();var elNewTh=oNewColumn.getThEl();if(oNewSortedBy.dir&&(oNewSortedBy.dir=="asc"||oNewSortedBy.dir=="desc")){var newClass=oNewSortedBy.dir=="desc"?DT.CLASS_DESC:DT.CLASS_ASC;Dom.addClass(elNewTh,newClass)}else{var sortClass=oNewSortedBy.dir||DT.CLASS_ASC;Dom.addClass(elNewTh,sortClass)}this.formatTheadCell(oNewColumn.getThLinerEl().firstChild,oNewColumn,oNewSortedBy)}}if(this._elTbody){this._elTbody.style.display="none";var allRows=this._elTbody.rows,allCells;for(var i=allRows.length-1;i>-1;i--){allCells=allRows[i].childNodes;if(allCells[nOldColumnKeyIndex]){Dom.removeClass(allCells[nOldColumnKeyIndex],oOldSortedBy.dir)}if(allCells[nNewColumnKeyIndex]){Dom.addClass(allCells[nNewColumnKeyIndex],oNewSortedBy.dir)}}this._elTbody.style.display=""}this._clearTrTemplateEl()}});this.setAttributeConfig("paginator",{value:null,validator:function(val){return val===null||val instanceof widget.Paginator},method:function(){this._updatePaginator.apply(this,arguments)}});this.setAttributeConfig("caption",{value:null,validator:lang.isString,method:function(sCaption){this._initCaptionEl(sCaption)}});this.setAttributeConfig("draggableColumns",{value:false,validator:lang.isBoolean,method:function(oParam){if(this._elThead){if(oParam){this._initDraggableColumns()}else{this._destroyDraggableColumns()}}}});this.setAttributeConfig("renderLoopSize",{value:0,validator:lang.isNumber});this.setAttributeConfig("sortFunction",{value:function(a,b,desc,field){var compare=YAHOO.util.Sort.compare,sorted=compare(a.getData(field),b.getData(field),desc);if(sorted===0){return compare(a.getCount(),b.getCount(),desc)}else{return sorted}}});this.setAttributeConfig("formatRow",{value:null,validator:lang.isFunction});this.setAttributeConfig("generateRequest",{value:function(oState,oSelf){oState=oState||{pagination:null,sortedBy:null};var sort=encodeURIComponent(oState.sortedBy?oState.sortedBy.key:oSelf.getColumnSet().keys[0].getKey());var dir=oState.sortedBy&&oState.sortedBy.dir===YAHOO.widget.DataTable.CLASS_DESC?"desc":"asc";var startIndex=oState.pagination?oState.pagination.recordOffset:0;var results=oState.pagination?oState.pagination.rowsPerPage:null;return"sort="+sort+"&dir="+dir+"&startIndex="+startIndex+(results!==null?"&results="+results:"")},validator:lang.isFunction});this.setAttributeConfig("initialRequest",{value:null});this.setAttributeConfig("initialLoad",{value:true});this.setAttributeConfig("dynamicData",{value:false,validator:lang.isBoolean});this.setAttributeConfig("MSG_EMPTY",{value:"No records found.",validator:lang.isString});this.setAttributeConfig("MSG_LOADING",{value:"Loading...",validator:lang.isString});this.setAttributeConfig("MSG_ERROR",{value:"Data error.",validator:lang.isString});this.setAttributeConfig("MSG_SORTASC",{value:"Click to sort ascending",validator:lang.isString,method:function(sParam){if(this._elThead){for(var i=0,allKeys=this.getColumnSet().keys,len=allKeys.length;i<len;i++){if(allKeys[i].sortable&&this.getColumnSortDir(allKeys[i])===DT.CLASS_ASC){allKeys[i]._elThLabel.firstChild.title=sParam}}}}});this.setAttributeConfig("MSG_SORTDESC",{value:"Click to sort descending",validator:lang.isString,method:function(sParam){if(this._elThead){for(var i=0,allKeys=this.getColumnSet().keys,len=allKeys.length;i<len;i++){if(allKeys[i].sortable&&this.getColumnSortDir(allKeys[i])===DT.CLASS_DESC){allKeys[i]._elThLabel.firstChild.title=sParam}}}}});this.setAttributeConfig("currencySymbol",{value:"$",validator:lang.isString});this.setAttributeConfig("currencyOptions",{value:{prefix:this.get("currencySymbol"),decimalPlaces:2,decimalSeparator:".",thousandsSeparator:","}});this.setAttributeConfig("dateOptions",{value:{format:"%m/%d/%Y",locale:"en"}});this.setAttributeConfig("numberOptions",{value:{decimalPlaces:0,thousandsSeparator:","}})},_bInit:true,_nIndex:null,_nTrCount:0,_nTdCount:0,_sId:null,_oChainRender:null,_elContainer:null,_elMask:null,_elTable:null,_elCaption:null,_elColgroup:null,_elThead:null,_elTbody:null,_elMsgTbody:null,_elMsgTr:null,_elMsgTd:null,_elColumnDragTarget:null,_elColumnResizerProxy:null,_oDataSource:null,_oColumnSet:null,_oRecordSet:null,_oCellEditor:null,_sFirstTrId:null,_sLastTrId:null,_elTrTemplate:null,_aDynFunctions:[],_disabled:false,clearTextSelection:function(){var sel;if(window.getSelection){sel=window.getSelection()}else if(document.getSelection){sel=document.getSelection()}else if(document.selection){sel=document.selection}if(sel){if(sel.empty){sel.empty()}else if(sel.removeAllRanges){sel.removeAllRanges()}else if(sel.collapse){sel.collapse()}}},_focusEl:function(el){el=el||this._elTbody;setTimeout((function(){try{el.focus()}catch(e){}}),0)},_repaintGecko:ua.gecko?function(el){el=el||this._elContainer;var parent=el.parentNode;var nextSibling=el.nextSibling;parent.insertBefore(parent.removeChild(el),nextSibling)}:function(){},_repaintOpera:ua.opera?function(){if(ua.opera){document.documentElement.className+=" ";document.documentElement.className=YAHOO.lang.trim(document.documentElement.className)}}:function(){},_repaintWebkit:ua.webkit?function(el){el=el||this._elContainer;var parent=el.parentNode;var nextSibling=el.nextSibling;parent.insertBefore(parent.removeChild(el),nextSibling)}:function(){},_initConfigs:function(oConfigs){if(!oConfigs||!lang.isObject(oConfigs)){oConfigs={}}this.configs=oConfigs},_initColumnSet:function(aColumnDefs){var oColumn,i,len;if(this._oColumnSet){for(i=0,len=this._oColumnSet.keys.length;i<len;i++){oColumn=this._oColumnSet.keys[i];DT._oDynStyles["."+this.getId()+"-col-"+oColumn.getSanitizedKey()+" ."+DT.CLASS_LINER]=undefined;if(oColumn.editor&&oColumn.editor.unsubscribeAll){oColumn.editor.unsubscribeAll()}}this._oColumnSet=null;this._clearTrTemplateEl()}if(lang.isArray(aColumnDefs)){this._oColumnSet=new YAHOO.widget.ColumnSet(aColumnDefs)}else if(aColumnDefs instanceof YAHOO.widget.ColumnSet){this._oColumnSet=aColumnDefs}var allKeys=this._oColumnSet.keys;for(i=0,len=allKeys.length;i<len;i++){oColumn=allKeys[i];if(oColumn.editor&&oColumn.editor.subscribe){oColumn.editor.subscribe("showEvent",this._onEditorShowEvent,this,true);oColumn.editor.subscribe("keydownEvent",this._onEditorKeydownEvent,this,true);oColumn.editor.subscribe("revertEvent",this._onEditorRevertEvent,this,true);oColumn.editor.subscribe("saveEvent",this._onEditorSaveEvent,this,true);oColumn.editor.subscribe("cancelEvent",this._onEditorCancelEvent,this,true);oColumn.editor.subscribe("blurEvent",this._onEditorBlurEvent,this,true);oColumn.editor.subscribe("blockEvent",this._onEditorBlockEvent,this,true);oColumn.editor.subscribe("unblockEvent",this._onEditorUnblockEvent,this,true)}}},_initDataSource:function(oDataSource){this._oDataSource=null;if(oDataSource&&lang.isFunction(oDataSource.sendRequest)){this._oDataSource=oDataSource}else{var tmpTable=null;var tmpContainer=this._elContainer;var i=0;if(tmpContainer.hasChildNodes()){var tmpChildren=tmpContainer.childNodes;for(i=0;i<tmpChildren.length;i++){if(tmpChildren[i].nodeName&&tmpChildren[i].nodeName.toLowerCase()=="table"){tmpTable=tmpChildren[i];break}}if(tmpTable){var tmpFieldsArray=[];for(;i<this._oColumnSet.keys.length;i++){tmpFieldsArray.push({key:this._oColumnSet.keys[i].key})}this._oDataSource=new DS(tmpTable);this._oDataSource.responseType=DS.TYPE_HTMLTABLE;this._oDataSource.responseSchema={fields:tmpFieldsArray}}}}},_initRecordSet:function(){if(this._oRecordSet){this._oRecordSet.reset()}else{this._oRecordSet=new YAHOO.widget.RecordSet}},_initDomElements:function(elContainer){this._initContainerEl(elContainer);this._initTableEl(this._elContainer);this._initColgroupEl(this._elTable);this._initTheadEl(this._elTable);this._initMsgTbodyEl(this._elTable);this._initTbodyEl(this._elTable);if(!this._elContainer||!this._elTable||!this._elColgroup||!this._elThead||!this._elTbody||!this._elMsgTbody){return false}else{return true}},_destroyContainerEl:function(elContainer){var columns=this._oColumnSet.keys,elements,i;Dom.removeClass(elContainer,DT.CLASS_DATATABLE);Ev.purgeElement(elContainer);Ev.purgeElement(this._elThead,true);Ev.purgeElement(this._elTbody);Ev.purgeElement(this._elMsgTbody);elements=elContainer.getElementsByTagName("select");if(elements.length){Ev.detachListener(elements,"change")}for(i=columns.length-1;i>=0;--i){if(columns[i].editor){Ev.purgeElement(columns[i].editor._elContainer)}}elContainer.innerHTML="";this._elContainer=null;this._elColgroup=null;this._elThead=null;this._elTbody=null},_initContainerEl:function(elContainer){elContainer=Dom.get(elContainer);if(elContainer&&elContainer.nodeName&&elContainer.nodeName.toLowerCase()=="div"){this._destroyContainerEl(elContainer);Dom.addClass(elContainer,DT.CLASS_DATATABLE);Ev.addListener(elContainer,"focus",this._onTableFocus,this);Ev.addListener(elContainer,"dblclick",this._onTableDblclick,this);this._elContainer=elContainer;var elMask=document.createElement("div");elMask.className=DT.CLASS_MASK;elMask.style.display="none";this._elMask=elContainer.appendChild(elMask)}},_destroyTableEl:function(){var elTable=this._elTable;if(elTable){Ev.purgeElement(elTable,true);elTable.parentNode.removeChild(elTable);this._elCaption=null;this._elColgroup=null;this._elThead=null;this._elTbody=null}},_initCaptionEl:function(sCaption){if(this._elTable&&sCaption){if(!this._elCaption){this._elCaption=this._elTable.createCaption()}this._elCaption.innerHTML=sCaption}else if(this._elCaption){this._elCaption.parentNode.removeChild(this._elCaption)}},_initTableEl:function(elContainer){if(elContainer){this._destroyTableEl();this._elTable=elContainer.appendChild(document.createElement("table"));this._elTable.summary=this.get("summary");if(this.get("caption")){this._initCaptionEl(this.get("caption"))}Ev.delegate(this._elTable,"mouseenter",this._onTableMouseover,"thead ."+DT.CLASS_LABEL,this);Ev.delegate(this._elTable,"mouseleave",this._onTableMouseout,"thead ."+DT.CLASS_LABEL,this);Ev.delegate(this._elTable,"mouseenter",this._onTableMouseover,"tbody.yui-dt-data>tr>td",this);Ev.delegate(this._elTable,"mouseleave",this._onTableMouseout,"tbody.yui-dt-data>tr>td",this);Ev.delegate(this._elTable,"mouseenter",this._onTableMouseover,"tbody.yui-dt-message>tr>td",this);Ev.delegate(this._elTable,"mouseleave",this._onTableMouseout,"tbody.yui-dt-message>tr>td",this)}},_destroyColgroupEl:function(){var elColgroup=this._elColgroup;if(elColgroup){var elTable=elColgroup.parentNode;Ev.purgeElement(elColgroup,true);elTable.removeChild(elColgroup);this._elColgroup=null}},_initColgroupEl:function(elTable){if(elTable){this._destroyColgroupEl();var allCols=this._aColIds||[],allKeys=this._oColumnSet.keys,i=0,len=allCols.length,elCol,oColumn,elFragment=document.createDocumentFragment(),elColTemplate=document.createElement("col");for(i=0,len=allKeys.length;i<len;i++){oColumn=allKeys[i];elCol=elFragment.appendChild(elColTemplate.cloneNode(false))}var elColgroup=elTable.insertBefore(document.createElement("colgroup"),elTable.firstChild);elColgroup.appendChild(elFragment);this._elColgroup=elColgroup}},_insertColgroupColEl:function(index){if(lang.isNumber(index)&&this._elColgroup){var nextSibling=this._elColgroup.childNodes[index]||null;this._elColgroup.insertBefore(document.createElement("col"),nextSibling)}},_removeColgroupColEl:function(index){if(lang.isNumber(index)&&this._elColgroup&&this._elColgroup.childNodes[index]){this._elColgroup.removeChild(this._elColgroup.childNodes[index])}},_reorderColgroupColEl:function(aKeyIndexes,newIndex){if(lang.isArray(aKeyIndexes)&&lang.isNumber(newIndex)&&this._elColgroup&&this._elColgroup.childNodes.length>aKeyIndexes[aKeyIndexes.length-1]){var i,tmpCols=[];for(i=aKeyIndexes.length-1;i>-1;i--){tmpCols.push(this._elColgroup.removeChild(this._elColgroup.childNodes[aKeyIndexes[i]]))}var nextSibling=this._elColgroup.childNodes[newIndex]||null;for(i=tmpCols.length-1;i>-1;i--){this._elColgroup.insertBefore(tmpCols[i],nextSibling)}}},_destroyTheadEl:function(){var elThead=this._elThead;if(elThead){var elTable=elThead.parentNode;Ev.purgeElement(elThead,true);this._destroyColumnHelpers();elTable.removeChild(elThead);this._elThead=null}},_initTheadEl:function(elTable){elTable=elTable||this._elTable;if(elTable){this._destroyTheadEl();var elThead=this._elColgroup?elTable.insertBefore(document.createElement("thead"),this._elColgroup.nextSibling):elTable.appendChild(document.createElement("thead"));Ev.addListener(elThead,"focus",this._onTheadFocus,this);Ev.addListener(elThead,"keydown",this._onTheadKeydown,this);Ev.addListener(elThead,"mousedown",this._onTableMousedown,this);Ev.addListener(elThead,"mouseup",this._onTableMouseup,this);Ev.addListener(elThead,"click",this._onTheadClick,this);var oColumnSet=this._oColumnSet,oColumn,i,j,l;var colTree=oColumnSet.tree;var elTh;for(i=0;i<colTree.length;i++){var elTheadTr=elThead.appendChild(document.createElement("tr"));for(j=0;j<colTree[i].length;j++){oColumn=colTree[i][j];elTh=elTheadTr.appendChild(document.createElement("th"));this._initThEl(elTh,oColumn)}if(i===0){Dom.addClass(elTheadTr,DT.CLASS_FIRST)}if(i===colTree.length-1){Dom.addClass(elTheadTr,DT.CLASS_LAST)}}var aFirstHeaders=oColumnSet.headers[0]||[];for(i=0;i<aFirstHeaders.length;i++){Dom.addClass(Dom.get(this.getId()+"-th-"+aFirstHeaders[i]),DT.CLASS_FIRST)}var aLastHeaders=oColumnSet.headers[oColumnSet.headers.length-1]||[];for(i=0;i<aLastHeaders.length;i++){Dom.addClass(Dom.get(this.getId()+"-th-"+aLastHeaders[i]),DT.CLASS_LAST)}if(ua.webkit&&ua.webkit<420){var oSelf=this;setTimeout((function(){elThead.style.display=""}),0);elThead.style.display="none"}this._elThead=elThead;this._initColumnHelpers()}},_initThEl:function(elTh,oColumn){elTh.id=this.getId()+"-th-"+oColumn.getSanitizedKey();elTh.innerHTML="";elTh.rowSpan=oColumn.getRowspan();elTh.colSpan=oColumn.getColspan();oColumn._elTh=elTh;var elThLiner=elTh.appendChild(document.createElement("div"));elThLiner.id=elTh.id+"-liner";elThLiner.className=DT.CLASS_LINER;oColumn._elThLiner=elThLiner;var elThLabel=elThLiner.appendChild(document.createElement("span"));elThLabel.className=DT.CLASS_LABEL;if(oColumn.abbr){elTh.abbr=oColumn.abbr}if(oColumn.hidden){this._clearMinWidth(oColumn)}elTh.className=this._getColumnClassNames(oColumn);if(oColumn.width){var nWidth=oColumn.minWidth&&oColumn.width<oColumn.minWidth?oColumn.minWidth:oColumn.width;if(DT._bDynStylesFallback){elTh.firstChild.style.overflow="hidden";elTh.firstChild.style.width=nWidth+"px"}else{this._setColumnWidthDynStyles(oColumn,nWidth+"px","hidden")}}this.formatTheadCell(elThLabel,oColumn,this.get("sortedBy"));oColumn._elThLabel=elThLabel},formatTheadCell:function(elCellLabel,oColumn,oSortedBy){var sKey=oColumn.getKey();var sLabel=lang.isValue(oColumn.label)?oColumn.label:sKey;if(oColumn.sortable){var sSortClass=this.getColumnSortDir(oColumn,oSortedBy);var bDesc=sSortClass===DT.CLASS_DESC;if(oSortedBy&&oColumn.key===oSortedBy.key){bDesc=!(oSortedBy.dir===DT.CLASS_DESC)}var sHref=this.getId()+"-href-"+oColumn.getSanitizedKey();var sTitle=bDesc?this.get("MSG_SORTDESC"):this.get("MSG_SORTASC");elCellLabel.innerHTML='<a href="'+sHref+'" title="'+sTitle+'" class="'+DT.CLASS_SORTABLE+'">'+sLabel+"</a>"}else{elCellLabel.innerHTML=sLabel}},_destroyDraggableColumns:function(){var oColumn,elTh;for(var i=0,len=this._oColumnSet.tree[0].length;i<len;i++){oColumn=this._oColumnSet.tree[0][i];if(oColumn._dd){oColumn._dd=oColumn._dd.unreg();Dom.removeClass(oColumn.getThEl(),DT.CLASS_DRAGGABLE)}}this._destroyColumnDragTargetEl()},_initDraggableColumns:function(){this._destroyDraggableColumns();if(util.DD){var oColumn,elTh,elDragTarget;for(var i=0,len=this._oColumnSet.tree[0].length;i<len;i++){oColumn=this._oColumnSet.tree[0][i];elTh=oColumn.getThEl();Dom.addClass(elTh,DT.CLASS_DRAGGABLE);elDragTarget=this._initColumnDragTargetEl();oColumn._dd=new YAHOO.widget.ColumnDD(this,oColumn,elTh,elDragTarget)}}else{}},_destroyColumnDragTargetEl:function(){if(this._elColumnDragTarget){var el=this._elColumnDragTarget;YAHOO.util.Event.purgeElement(el);el.parentNode.removeChild(el);this._elColumnDragTarget=null}},_initColumnDragTargetEl:function(){if(!this._elColumnDragTarget){var elColumnDragTarget=document.createElement("div");elColumnDragTarget.id=this.getId()+"-coltarget";elColumnDragTarget.className=DT.CLASS_COLTARGET;elColumnDragTarget.style.display="none";document.body.insertBefore(elColumnDragTarget,document.body.firstChild);this._elColumnDragTarget=elColumnDragTarget}return this._elColumnDragTarget},_destroyResizeableColumns:function(){var aKeys=this._oColumnSet.keys;for(var i=0,len=aKeys.length;i<len;i++){if(aKeys[i]._ddResizer){aKeys[i]._ddResizer=aKeys[i]._ddResizer.unreg();Dom.removeClass(aKeys[i].getThEl(),DT.CLASS_RESIZEABLE)}}this._destroyColumnResizerProxyEl()},_initResizeableColumns:function(){this._destroyResizeableColumns();if(util.DD){var oColumn,elTh,elThLiner,elThResizerLiner,elThResizer,elResizerProxy,cancelClick;for(var i=0,len=this._oColumnSet.keys.length;i<len;i++){oColumn=this._oColumnSet.keys[i];if(oColumn.resizeable){elTh=oColumn.getThEl();Dom.addClass(elTh,DT.CLASS_RESIZEABLE);elThLiner=oColumn.getThLinerEl();elThResizerLiner=elTh.appendChild(document.createElement("div"));elThResizerLiner.className=DT.CLASS_RESIZERLINER;elThResizerLiner.appendChild(elThLiner);elThResizer=elThResizerLiner.appendChild(document.createElement("div"));elThResizer.id=elTh.id+"-resizer";elThResizer.className=DT.CLASS_RESIZER;oColumn._elResizer=elThResizer;elResizerProxy=this._initColumnResizerProxyEl();oColumn._ddResizer=new YAHOO.util.ColumnResizer(this,oColumn,elTh,elThResizer,elResizerProxy);cancelClick=function(e){Ev.stopPropagation(e)};Ev.addListener(elThResizer,"click",cancelClick)}}}else{}},_destroyColumnResizerProxyEl:function(){if(this._elColumnResizerProxy){var el=this._elColumnResizerProxy;YAHOO.util.Event.purgeElement(el);el.parentNode.removeChild(el);this._elColumnResizerProxy=null}},_initColumnResizerProxyEl:function(){if(!this._elColumnResizerProxy){var elColumnResizerProxy=document.createElement("div");elColumnResizerProxy.id=this.getId()+"-colresizerproxy";elColumnResizerProxy.className=DT.CLASS_RESIZERPROXY;document.body.insertBefore(elColumnResizerProxy,document.body.firstChild);this._elColumnResizerProxy=elColumnResizerProxy}return this._elColumnResizerProxy},_destroyColumnHelpers:function(){this._destroyDraggableColumns();this._destroyResizeableColumns()},_initColumnHelpers:function(){if(this.get("draggableColumns")){this._initDraggableColumns()}this._initResizeableColumns()},_destroyTbodyEl:function(){var elTbody=this._elTbody;if(elTbody){var elTable=elTbody.parentNode;Ev.purgeElement(elTbody,true);elTable.removeChild(elTbody);this._elTbody=null}},_initTbodyEl:function(elTable){if(elTable){this._destroyTbodyEl();var elTbody=elTable.appendChild(document.createElement("tbody"));elTbody.tabIndex=0;elTbody.className=DT.CLASS_DATA;Ev.addListener(elTbody,"focus",this._onTbodyFocus,this);Ev.addListener(elTbody,"mousedown",this._onTableMousedown,this);Ev.addListener(elTbody,"mouseup",this._onTableMouseup,this);Ev.addListener(elTbody,"keydown",this._onTbodyKeydown,this);Ev.addListener(elTbody,"click",this._onTbodyClick,this);if(ua.ie){elTbody.hideFocus=true}this._elTbody=elTbody}},_destroyMsgTbodyEl:function(){var elMsgTbody=this._elMsgTbody;if(elMsgTbody){var elTable=elMsgTbody.parentNode;Ev.purgeElement(elMsgTbody,true);elTable.removeChild(elMsgTbody);this._elTbody=null}},_initMsgTbodyEl:function(elTable){if(elTable){var elMsgTbody=document.createElement("tbody");elMsgTbody.className=DT.CLASS_MESSAGE;var elMsgTr=elMsgTbody.appendChild(document.createElement("tr"));elMsgTr.className=DT.CLASS_FIRST+" "+DT.CLASS_LAST;this._elMsgTr=elMsgTr;var elMsgTd=elMsgTr.appendChild(document.createElement("td"));elMsgTd.colSpan=this._oColumnSet.keys.length||1;elMsgTd.className=DT.CLASS_FIRST+" "+DT.CLASS_LAST;this._elMsgTd=elMsgTd;elMsgTbody=elTable.insertBefore(elMsgTbody,this._elTbody);var elMsgLiner=elMsgTd.appendChild(document.createElement("div"));elMsgLiner.className=DT.CLASS_LINER;this._elMsgTbody=elMsgTbody;Ev.addListener(elMsgTbody,"focus",this._onTbodyFocus,this);Ev.addListener(elMsgTbody,"mousedown",this._onTableMousedown,this);Ev.addListener(elMsgTbody,"mouseup",this._onTableMouseup,this);Ev.addListener(elMsgTbody,"keydown",this._onTbodyKeydown,this);Ev.addListener(elMsgTbody,"click",this._onTbodyClick,this)}},_initEvents:function(){this._initColumnSort();YAHOO.util.Event.addListener(document,"click",this._onDocumentClick,this);this.subscribe("paginatorChange",(function(){this._handlePaginatorChange.apply(this,arguments)}));this.subscribe("initEvent",(function(){this.renderPaginator()}));this._initCellEditing()},_initColumnSort:function(){this.subscribe("theadCellClickEvent",this.onEventSortColumn);var oSortedBy=this.get("sortedBy");if(oSortedBy){if(oSortedBy.dir=="desc"){this._configs.sortedBy.value.dir=DT.CLASS_DESC}else if(oSortedBy.dir=="asc"){this._configs.sortedBy.value.dir=DT.CLASS_ASC}}},_initCellEditing:function(){this.subscribe("editorBlurEvent",(function(){this.onEditorBlurEvent.apply(this,arguments)}));this.subscribe("editorBlockEvent",(function(){this.onEditorBlockEvent.apply(this,arguments)}));this.subscribe("editorUnblockEvent",(function(){this.onEditorUnblockEvent.apply(this,arguments)}))},_getColumnClassNames:function(oColumn,aAddClasses){var allClasses;if(lang.isString(oColumn.className)){allClasses=[oColumn.className]}else if(lang.isArray(oColumn.className)){allClasses=oColumn.className}else{allClasses=[]}allClasses[allClasses.length]=this.getId()+"-col-"+oColumn.getSanitizedKey();allClasses[allClasses.length]="yui-dt-col-"+oColumn.getSanitizedKey();var isSortedBy=this.get("sortedBy")||{};if(oColumn.key===isSortedBy.key){allClasses[allClasses.length]=isSortedBy.dir||""}if(oColumn.hidden){allClasses[allClasses.length]=DT.CLASS_HIDDEN}if(oColumn.selected){allClasses[allClasses.length]=DT.CLASS_SELECTED}if(oColumn.sortable){allClasses[allClasses.length]=DT.CLASS_SORTABLE}if(oColumn.resizeable){allClasses[allClasses.length]=DT.CLASS_RESIZEABLE}if(oColumn.editor){allClasses[allClasses.length]=DT.CLASS_EDITABLE}if(aAddClasses){allClasses=allClasses.concat(aAddClasses)}return allClasses.join(" ")},_clearTrTemplateEl:function(){this._elTrTemplate=null},_getTrTemplateEl:function(oRecord,index){if(this._elTrTemplate){return this._elTrTemplate}else{var d=document,tr=d.createElement("tr"),td=d.createElement("td"),div=d.createElement("div");td.appendChild(div);var df=document.createDocumentFragment(),allKeys=this._oColumnSet.keys,elTd;var aAddClasses;for(var i=0,keysLen=allKeys.length;i<keysLen;i++){elTd=td.cloneNode(true);elTd=this._formatTdEl(allKeys[i],elTd,i,i===keysLen-1);df.appendChild(elTd)}tr.appendChild(df);tr.className=DT.CLASS_REC;this._elTrTemplate=tr;return tr}},_formatTdEl:function(oColumn,elTd,index,isLast){var oColumnSet=this._oColumnSet;var allHeaders=oColumnSet.headers,allColHeaders=allHeaders[index],sTdHeaders="",sHeader;for(var j=0,headersLen=allColHeaders.length;j<headersLen;j++){sHeader=this._sId+"-th-"+allColHeaders[j]+" ";sTdHeaders+=sHeader}elTd.headers=sTdHeaders;var aAddClasses=[];if(index===0){aAddClasses[aAddClasses.length]=DT.CLASS_FIRST}if(isLast){aAddClasses[aAddClasses.length]=DT.CLASS_LAST}elTd.className=this._getColumnClassNames(oColumn,aAddClasses);elTd.firstChild.className=DT.CLASS_LINER;if(oColumn.width&&DT._bDynStylesFallback){var nWidth=oColumn.minWidth&&oColumn.width<oColumn.minWidth?oColumn.minWidth:oColumn.width;elTd.firstChild.style.overflow="hidden";elTd.firstChild.style.width=nWidth+"px"}return elTd},_addTrEl:function(oRecord){var elTrTemplate=this._getTrTemplateEl();var elTr=elTrTemplate.cloneNode(true);return this._updateTrEl(elTr,oRecord)},_updateTrEl:function(elTr,oRecord){var ok=this.get("formatRow")?this.get("formatRow").call(this,elTr,oRecord):true;if(ok){elTr.style.display="none";var allTds=elTr.childNodes,elTd;for(var i=0,len=allTds.length;i<len;++i){elTd=allTds[i];this.formatCell(allTds[i].firstChild,oRecord,this._oColumnSet.keys[i])}elTr.style.display=""}var oldId=elTr.id,newId=oRecord.getId();if(this._sFirstTrId===oldId){this._sFirstTrId=newId}if(this._sLastTrId===oldId){this._sLastTrId=newId}elTr.id=newId;return elTr},_deleteTrEl:function(row){var rowIndex;if(!lang.isNumber(row)){rowIndex=Dom.get(row).sectionRowIndex}else{rowIndex=row}if(lang.isNumber(rowIndex)&&rowIndex>-2&&rowIndex<this._elTbody.rows.length){return this._elTbody.removeChild(this._elTbody.rows[row])}else{return null}},_unsetFirstRow:function(){if(this._sFirstTrId){Dom.removeClass(this._sFirstTrId,DT.CLASS_FIRST);this._sFirstTrId=null}},_setFirstRow:function(){this._unsetFirstRow();var elTr=this.getFirstTrEl();if(elTr){Dom.addClass(elTr,DT.CLASS_FIRST);this._sFirstTrId=elTr.id}},_unsetLastRow:function(){if(this._sLastTrId){Dom.removeClass(this._sLastTrId,DT.CLASS_LAST);this._sLastTrId=null}},_setLastRow:function(){this._unsetLastRow();var elTr=this.getLastTrEl();if(elTr){Dom.addClass(elTr,DT.CLASS_LAST);this._sLastTrId=elTr.id}},_setRowStripes:function(row,range){var allRows=this._elTbody.rows,nStartIndex=0,nEndIndex=allRows.length,aOdds=[],nOddIdx=0,aEvens=[],nEvenIdx=0;if(row!==null&&row!==undefined){var elStartRow=this.getTrEl(row);if(elStartRow){nStartIndex=elStartRow.sectionRowIndex;if(lang.isNumber(range)&&range>1){nEndIndex=nStartIndex+range}}}for(var i=nStartIndex;i<nEndIndex;i++){if(i%2){aOdds[nOddIdx++]=allRows[i]}else{aEvens[nEvenIdx++]=allRows[i]}}if(aOdds.length){Dom.replaceClass(aOdds,DT.CLASS_EVEN,DT.CLASS_ODD)}if(aEvens.length){Dom.replaceClass(aEvens,DT.CLASS_ODD,DT.CLASS_EVEN)}},_setSelections:function(){var allSelectedRows=this.getSelectedRows();var allSelectedCells=this.getSelectedCells();if(allSelectedRows.length>0||allSelectedCells.length>0){var oColumnSet=this._oColumnSet,el;for(var i=0;i<allSelectedRows.length;i++){el=Dom.get(allSelectedRows[i]);if(el){Dom.addClass(el,DT.CLASS_SELECTED)}}for(i=0;i<allSelectedCells.length;i++){el=Dom.get(allSelectedCells[i].recordId);if(el){Dom.addClass(el.childNodes[oColumnSet.getColumn(allSelectedCells[i].columnKey).getKeyIndex()],DT.CLASS_SELECTED)}}}},_onRenderChainEnd:function(){this.hideTableMessage();if(this._elTbody.rows.length===0){this.showTableMessage(this.get("MSG_EMPTY"),DT.CLASS_EMPTY)}var oSelf=this;setTimeout((function(){if(oSelf instanceof DT&&oSelf._sId){if(oSelf._bInit){oSelf._bInit=false;oSelf.fireEvent("initEvent")}oSelf.fireEvent("renderEvent");oSelf.fireEvent("refreshEvent");oSelf.validateColumnWidths();oSelf.fireEvent("postRenderEvent")}}),0)},_onDocumentClick:function(e,oSelf){var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName.toLowerCase();if(!Dom.isAncestor(oSelf._elContainer,elTarget)){oSelf.fireEvent("tableBlurEvent");if(oSelf._oCellEditor){if(oSelf._oCellEditor.getContainerEl){var elContainer=oSelf._oCellEditor.getContainerEl();if(!Dom.isAncestor(elContainer,elTarget)&&elContainer.id!==elTarget.id){oSelf._oCellEditor.fireEvent("blurEvent",{editor:oSelf._oCellEditor})}}else if(oSelf._oCellEditor.isActive){if(!Dom.isAncestor(oSelf._oCellEditor.container,elTarget)&&oSelf._oCellEditor.container.id!==elTarget.id){oSelf.fireEvent("editorBlurEvent",{editor:oSelf._oCellEditor})}}}}},_onTableFocus:function(e,oSelf){oSelf.fireEvent("tableFocusEvent")},_onTheadFocus:function(e,oSelf){oSelf.fireEvent("theadFocusEvent");oSelf.fireEvent("tableFocusEvent")},_onTbodyFocus:function(e,oSelf){oSelf.fireEvent("tbodyFocusEvent");oSelf.fireEvent("tableFocusEvent")},_onTableMouseover:function(e,origTarget,container,oSelf){var elTarget=origTarget;var elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"a":break;case"td":bKeepBubbling=oSelf.fireEvent("cellMouseoverEvent",{target:elTarget,event:e});break;case"span":if(Dom.hasClass(elTarget,DT.CLASS_LABEL)){bKeepBubbling=oSelf.fireEvent("theadLabelMouseoverEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerLabelMouseoverEvent",{target:elTarget,event:e})}break;case"th":bKeepBubbling=oSelf.fireEvent("theadCellMouseoverEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerCellMouseoverEvent",{target:elTarget,event:e});break;case"tr":if(elTarget.parentNode.nodeName.toLowerCase()=="thead"){bKeepBubbling=oSelf.fireEvent("theadRowMouseoverEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerRowMouseoverEvent",{target:elTarget,event:e})}else{bKeepBubbling=oSelf.fireEvent("rowMouseoverEvent",{target:elTarget,event:e})}break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableMouseoverEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTableMouseout:function(e,origTarget,container,oSelf){var elTarget=origTarget;var elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"a":break;case"td":bKeepBubbling=oSelf.fireEvent("cellMouseoutEvent",{target:elTarget,event:e});break;case"span":if(Dom.hasClass(elTarget,DT.CLASS_LABEL)){bKeepBubbling=oSelf.fireEvent("theadLabelMouseoutEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerLabelMouseoutEvent",{target:elTarget,event:e})}break;case"th":bKeepBubbling=oSelf.fireEvent("theadCellMouseoutEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerCellMouseoutEvent",{target:elTarget,event:e});break;case"tr":if(elTarget.parentNode.nodeName.toLowerCase()=="thead"){bKeepBubbling=oSelf.fireEvent("theadRowMouseoutEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerRowMouseoutEvent",{target:elTarget,event:e})}else{bKeepBubbling=oSelf.fireEvent("rowMouseoutEvent",{target:elTarget,event:e})}break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableMouseoutEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTableMousedown:function(e,oSelf){var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"a":break;case"td":bKeepBubbling=oSelf.fireEvent("cellMousedownEvent",{target:elTarget,event:e});break;case"span":if(Dom.hasClass(elTarget,DT.CLASS_LABEL)){bKeepBubbling=oSelf.fireEvent("theadLabelMousedownEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerLabelMousedownEvent",{target:elTarget,event:e})}break;case"th":bKeepBubbling=oSelf.fireEvent("theadCellMousedownEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerCellMousedownEvent",{target:elTarget,event:e});break;case"tr":if(elTarget.parentNode.nodeName.toLowerCase()=="thead"){bKeepBubbling=oSelf.fireEvent("theadRowMousedownEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerRowMousedownEvent",{target:elTarget,event:e})}else{bKeepBubbling=oSelf.fireEvent("rowMousedownEvent",{target:elTarget,event:e})}break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableMousedownEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTableMouseup:function(e,oSelf){var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"a":break;case"td":bKeepBubbling=oSelf.fireEvent("cellMouseupEvent",{target:elTarget,event:e});break;case"span":if(Dom.hasClass(elTarget,DT.CLASS_LABEL)){bKeepBubbling=oSelf.fireEvent("theadLabelMouseupEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerLabelMouseupEvent",{target:elTarget,event:e})}break;case"th":bKeepBubbling=oSelf.fireEvent("theadCellMouseupEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerCellMouseupEvent",{target:elTarget,event:e});break;case"tr":if(elTarget.parentNode.nodeName.toLowerCase()=="thead"){bKeepBubbling=oSelf.fireEvent("theadRowMouseupEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerRowMouseupEvent",{target:elTarget,event:e})}else{bKeepBubbling=oSelf.fireEvent("rowMouseupEvent",{target:elTarget,event:e})}break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableMouseupEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTableDblclick:function(e,oSelf){var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"td":bKeepBubbling=oSelf.fireEvent("cellDblclickEvent",{target:elTarget,event:e});break;case"span":if(Dom.hasClass(elTarget,DT.CLASS_LABEL)){bKeepBubbling=oSelf.fireEvent("theadLabelDblclickEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerLabelDblclickEvent",{target:elTarget,event:e})}break;case"th":bKeepBubbling=oSelf.fireEvent("theadCellDblclickEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerCellDblclickEvent",{target:elTarget,event:e});break;case"tr":if(elTarget.parentNode.nodeName.toLowerCase()=="thead"){bKeepBubbling=oSelf.fireEvent("theadRowDblclickEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerRowDblclickEvent",{target:elTarget,event:e})}else{bKeepBubbling=oSelf.fireEvent("rowDblclickEvent",{target:elTarget,event:e})}break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableDblclickEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTheadKeydown:function(e,oSelf){var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"input":case"textarea":break;case"thead":bKeepBubbling=oSelf.fireEvent("theadKeyEvent",{target:elTarget,event:e});break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableKeyEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTbodyKeydown:function(e,oSelf){var sMode=oSelf.get("selectionMode");if(sMode=="standard"){oSelf._handleStandardSelectionByKey(e)}else if(sMode=="single"){oSelf._handleSingleSelectionByKey(e)}else if(sMode=="cellblock"){oSelf._handleCellBlockSelectionByKey(e)}else if(sMode=="cellrange"){oSelf._handleCellRangeSelectionByKey(e)}else if(sMode=="singlecell"){oSelf._handleSingleCellSelectionByKey(e)}if(oSelf._oCellEditor){if(oSelf._oCellEditor.fireEvent){oSelf._oCellEditor.fireEvent("blurEvent",{editor:oSelf._oCellEditor})}else if(oSelf._oCellEditor.isActive){oSelf.fireEvent("editorBlurEvent",{editor:oSelf._oCellEditor})}}var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"tbody":bKeepBubbling=oSelf.fireEvent("tbodyKeyEvent",{target:elTarget,event:e});break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableKeyEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTheadClick:function(e,oSelf){if(oSelf._oCellEditor){if(oSelf._oCellEditor.fireEvent){oSelf._oCellEditor.fireEvent("blurEvent",{editor:oSelf._oCellEditor})}else if(oSelf._oCellEditor.isActive){oSelf.fireEvent("editorBlurEvent",{editor:oSelf._oCellEditor})}}var elTarget=Ev.getTarget(e),elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase(),bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"input":var sType=elTarget.type.toLowerCase();if(sType=="checkbox"){bKeepBubbling=oSelf.fireEvent("theadCheckboxClickEvent",{target:elTarget,event:e})}else if(sType=="radio"){bKeepBubbling=oSelf.fireEvent("theadRadioClickEvent",{target:elTarget,event:e})}else if(sType=="button"||sType=="image"||sType=="submit"||sType=="reset"){if(!elTarget.disabled){bKeepBubbling=oSelf.fireEvent("theadButtonClickEvent",{target:elTarget,event:e})}else{bKeepBubbling=false}}else if(elTarget.disabled){bKeepBubbling=false}break;case"a":bKeepBubbling=oSelf.fireEvent("theadLinkClickEvent",{target:elTarget,event:e});break;case"button":if(!elTarget.disabled){bKeepBubbling=oSelf.fireEvent("theadButtonClickEvent",{target:elTarget,event:e})}else{bKeepBubbling=false}break;case"span":if(Dom.hasClass(elTarget,DT.CLASS_LABEL)){bKeepBubbling=oSelf.fireEvent("theadLabelClickEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerLabelClickEvent",{target:elTarget,event:e})}break;case"th":bKeepBubbling=oSelf.fireEvent("theadCellClickEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerCellClickEvent",{target:elTarget,event:e});break;case"tr":bKeepBubbling=oSelf.fireEvent("theadRowClickEvent",{target:elTarget,event:e});bKeepBubbling=oSelf.fireEvent("headerRowClickEvent",{target:elTarget,event:e});break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableClickEvent",{target:elTarget||oSelf._elContainer,event:e})},_onTbodyClick:function(e,oSelf){if(oSelf._oCellEditor){if(oSelf._oCellEditor.fireEvent){oSelf._oCellEditor.fireEvent("blurEvent",{editor:oSelf._oCellEditor})}else if(oSelf._oCellEditor.isActive){oSelf.fireEvent("editorBlurEvent",{editor:oSelf._oCellEditor})}}var elTarget=Ev.getTarget(e),elTag=elTarget.nodeName&&elTarget.nodeName.toLowerCase(),bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"input":var sType=elTarget.type.toLowerCase();if(sType=="checkbox"){bKeepBubbling=oSelf.fireEvent("checkboxClickEvent",{target:elTarget,event:e})}else if(sType=="radio"){bKeepBubbling=oSelf.fireEvent("radioClickEvent",{target:elTarget,event:e})}else if(sType=="button"||sType=="image"||sType=="submit"||sType=="reset"){if(!elTarget.disabled){bKeepBubbling=oSelf.fireEvent("buttonClickEvent",{target:elTarget,event:e})}else{bKeepBubbling=false}}else if(elTarget.disabled){bKeepBubbling=false}break;case"a":bKeepBubbling=oSelf.fireEvent("linkClickEvent",{target:elTarget,event:e});break;case"button":if(!elTarget.disabled){bKeepBubbling=oSelf.fireEvent("buttonClickEvent",{target:elTarget,event:e})}else{bKeepBubbling=false}break;case"td":bKeepBubbling=oSelf.fireEvent("cellClickEvent",{target:elTarget,event:e});break;case"tr":bKeepBubbling=oSelf.fireEvent("rowClickEvent",{target:elTarget,event:e});break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableClickEvent",{target:elTarget||oSelf._elContainer,event:e})},_onDropdownChange:function(e,oSelf){var elTarget=Ev.getTarget(e);oSelf.fireEvent("dropdownChangeEvent",{event:e,target:elTarget})},configs:null,getId:function(){return this._sId},toString:function(){return"DataTable instance "+this._sId},getDataSource:function(){return this._oDataSource},getColumnSet:function(){return this._oColumnSet},getRecordSet:function(){return this._oRecordSet},getState:function(){return{totalRecords:this.get("paginator")?this.get("paginator").get("totalRecords"):this._oRecordSet.getLength(),pagination:this.get("paginator")?this.get("paginator").getState():null,sortedBy:this.get("sortedBy"),selectedRows:this.getSelectedRows(),selectedCells:this.getSelectedCells()}},getContainerEl:function(){return this._elContainer},getTableEl:function(){return this._elTable},getTheadEl:function(){return this._elThead},getTbodyEl:function(){return this._elTbody},getMsgTbodyEl:function(){return this._elMsgTbody},getMsgTdEl:function(){return this._elMsgTd},getTrEl:function(row){if(row instanceof YAHOO.widget.Record){return document.getElementById(row.getId())}else if(lang.isNumber(row)){var dataRows=Dom.getElementsByClassName(DT.CLASS_REC,"tr",this._elTbody);return dataRows&&dataRows[row]?dataRows[row]:null}else if(row){var elRow=lang.isString(row)?document.getElementById(row):row;if(elRow&&elRow.ownerDocument==document){if(elRow.nodeName.toLowerCase()!="tr"){elRow=Dom.getAncestorByTagName(elRow,"tr")}return elRow}}return null},getFirstTrEl:function(){var allRows=this._elTbody.rows,i=0;while(allRows[i]){if(this.getRecord(allRows[i])){return allRows[i]}i++}return null},getLastTrEl:function(){var allRows=this._elTbody.rows,i=allRows.length-1;while(i>-1){if(this.getRecord(allRows[i])){return allRows[i]}i--}return null},getNextTrEl:function(row,forcePrimary){var nThisTrIndex=this.getTrIndex(row);if(nThisTrIndex!==null){var allRows=this._elTbody.rows;if(forcePrimary){while(nThisTrIndex<allRows.length-1){row=allRows[nThisTrIndex+1];if(this.getRecord(row)){return row}nThisTrIndex++}}else{if(nThisTrIndex<allRows.length-1){return allRows[nThisTrIndex+1]}}}return null},getPreviousTrEl:function(row,forcePrimary){var nThisTrIndex=this.getTrIndex(row);if(nThisTrIndex!==null){var allRows=this._elTbody.rows;if(forcePrimary){while(nThisTrIndex>0){row=allRows[nThisTrIndex-1];if(this.getRecord(row)){return row}nThisTrIndex--}}else{if(nThisTrIndex>0){return allRows[nThisTrIndex-1]}}}return null},getCellIndex:function(cell){cell=this.getTdEl(cell);if(cell){if(ua.ie>0){var i=0,tr=cell.parentNode,allCells=tr.childNodes,len=allCells.length;for(;i<len;i++){if(allCells[i]==cell){return i}}}else{return cell.cellIndex}}},getTdLinerEl:function(cell){var elCell=this.getTdEl(cell);return elCell.firstChild||null},getTdEl:function(cell){var elCell;var el=Dom.get(cell);if(el&&el.ownerDocument==document){if(el.nodeName.toLowerCase()!="td"){elCell=Dom.getAncestorByTagName(el,"td")}else{elCell=el}if(elCell&&(elCell.parentNode.parentNode==this._elTbody||elCell.parentNode.parentNode===null||elCell.parentNode.parentNode.nodeType===11)){return elCell}}else if(cell){var oRecord,nColKeyIndex;if(lang.isString(cell.columnKey)&&lang.isString(cell.recordId)){oRecord=this.getRecord(cell.recordId);var oColumn=this.getColumn(cell.columnKey);if(oColumn){nColKeyIndex=oColumn.getKeyIndex()}}if(cell.record&&cell.column&&cell.column.getKeyIndex){oRecord=cell.record;nColKeyIndex=cell.column.getKeyIndex()}var elRow=this.getTrEl(oRecord);if(nColKeyIndex!==null&&elRow&&elRow.cells&&elRow.cells.length>0){return elRow.cells[nColKeyIndex]||null}}return null},getFirstTdEl:function(row){var elRow=lang.isValue(row)?this.getTrEl(row):this.getFirstTrEl();if(elRow){if(elRow.cells&&elRow.cells.length>0){return elRow.cells[0]}else if(elRow.childNodes&&elRow.childNodes.length>0){return elRow.childNodes[0]}}return null},getLastTdEl:function(row){var elRow=lang.isValue(row)?this.getTrEl(row):this.getLastTrEl();if(elRow){if(elRow.cells&&elRow.cells.length>0){return elRow.cells[elRow.cells.length-1]}else if(elRow.childNodes&&elRow.childNodes.length>0){return elRow.childNodes[elRow.childNodes.length-1]}}return null},getNextTdEl:function(cell){var elCell=this.getTdEl(cell);if(elCell){var nThisTdIndex=this.getCellIndex(elCell);var elRow=this.getTrEl(elCell);if(elRow.cells&&elRow.cells.length>0&&nThisTdIndex<elRow.cells.length-1){return elRow.cells[nThisTdIndex+1]}else if(elRow.childNodes&&elRow.childNodes.length>0&&nThisTdIndex<elRow.childNodes.length-1){return elRow.childNodes[nThisTdIndex+1]}else{var elNextRow=this.getNextTrEl(elRow);if(elNextRow){return elNextRow.cells[0]}}}return null},getPreviousTdEl:function(cell){var elCell=this.getTdEl(cell);if(elCell){var nThisTdIndex=this.getCellIndex(elCell);var elRow=this.getTrEl(elCell);if(nThisTdIndex>0){if(elRow.cells&&elRow.cells.length>0){return elRow.cells[nThisTdIndex-1]}else if(elRow.childNodes&&elRow.childNodes.length>0){return elRow.childNodes[nThisTdIndex-1]}}else{var elPreviousRow=this.getPreviousTrEl(elRow);if(elPreviousRow){return this.getLastTdEl(elPreviousRow)}}}return null},getAboveTdEl:function(cell,forcePrimary){var elCell=this.getTdEl(cell);if(elCell){var elPreviousRow=this.getPreviousTrEl(elCell,forcePrimary);if(elPreviousRow){var cellIndex=this.getCellIndex(elCell);if(elPreviousRow.cells&&elPreviousRow.cells.length>0){return elPreviousRow.cells[cellIndex]?elPreviousRow.cells[cellIndex]:null}else if(elPreviousRow.childNodes&&elPreviousRow.childNodes.length>0){return elPreviousRow.childNodes[cellIndex]?elPreviousRow.childNodes[cellIndex]:null}}}return null},getBelowTdEl:function(cell,forcePrimary){var elCell=this.getTdEl(cell);if(elCell){var elNextRow=this.getNextTrEl(elCell,forcePrimary);if(elNextRow){var cellIndex=this.getCellIndex(elCell);if(elNextRow.cells&&elNextRow.cells.length>0){return elNextRow.cells[cellIndex]?elNextRow.cells[cellIndex]:null}else if(elNextRow.childNodes&&elNextRow.childNodes.length>0){return elNextRow.childNodes[cellIndex]?elNextRow.childNodes[cellIndex]:null}}}return null},getThLinerEl:function(theadCell){var oColumn=this.getColumn(theadCell);return oColumn?oColumn.getThLinerEl():null},getThEl:function(theadCell){var elTh;if(theadCell instanceof YAHOO.widget.Column){var oColumn=theadCell;elTh=oColumn.getThEl();if(elTh){return elTh}}else{var el=Dom.get(theadCell);if(el&&el.ownerDocument==document){if(el.nodeName.toLowerCase()!="th"){elTh=Dom.getAncestorByTagName(el,"th")}else{elTh=el}return elTh}}return null},getTrIndex:function(row){var record=this.getRecord(row),index=this.getRecordIndex(record),tr;if(record){tr=this.getTrEl(record);if(tr){return tr.sectionRowIndex}else{var oPaginator=this.get("paginator");if(oPaginator){return oPaginator.get("recordOffset")+index}else{return index}}}return null},load:function(oConfig){oConfig=oConfig||{};(oConfig.datasource||this._oDataSource).sendRequest(oConfig.request||this.get("initialRequest"),oConfig.callback||{success:this.onDataReturnInitializeTable,failure:this.onDataReturnInitializeTable,scope:this,argument:this.getState()})},initializeTable:function(){this._bInit=true;this._oRecordSet.reset();var pag=this.get("paginator");if(pag){pag.set("totalRecords",0)}this._unselectAllTrEls();this._unselectAllTdEls();this._aSelections=null;this._oAnchorRecord=null;this._oAnchorCell=null;this.set("sortedBy",null)},_runRenderChain:function(){this._oChainRender.run()},_getViewRecords:function(){var oPaginator=this.get("paginator");if(oPaginator){return this._oRecordSet.getRecords(oPaginator.getStartIndex(),oPaginator.getRowsPerPage())}else{return this._oRecordSet.getRecords()}},render:function(){this._oChainRender.stop();this.fireEvent("beforeRenderEvent");var i,j,k,len,allRecords=this._getViewRecords();var elTbody=this._elTbody,loopN=this.get("renderLoopSize"),nRecordsLength=allRecords.length;if(nRecordsLength>0){elTbody.style.display="none";while(elTbody.lastChild){elTbody.removeChild(elTbody.lastChild)}elTbody.style.display="";this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var i=oArg.nCurrentRecord,endRecordIndex=oArg.nCurrentRecord+oArg.nLoopLength>nRecordsLength?nRecordsLength:oArg.nCurrentRecord+oArg.nLoopLength,elRow,nextSibling;elTbody.style.display="none";for(;i<endRecordIndex;i++){elRow=Dom.get(allRecords[i].getId());elRow=elRow||this._addTrEl(allRecords[i]);nextSibling=elTbody.childNodes[i]||null;elTbody.insertBefore(elRow,nextSibling)}elTbody.style.display="";oArg.nCurrentRecord=i}},scope:this,iterations:loopN>0?Math.ceil(nRecordsLength/loopN):1,argument:{nCurrentRecord:0,nLoopLength:loopN>0?loopN:nRecordsLength},timeout:loopN>0?0:-1});this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){while(elTbody.rows.length>nRecordsLength){elTbody.removeChild(elTbody.lastChild)}this._setFirstRow();this._setLastRow();this._setRowStripes();this._setSelections()}},scope:this,timeout:loopN>0?0:-1})}else{var nTotal=elTbody.rows.length;if(nTotal>0){this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var i=oArg.nCurrent,loopN=oArg.nLoopLength,nIterEnd=i-loopN<0?0:i-loopN;elTbody.style.display="none";for(;i>nIterEnd;i--){elTbody.deleteRow(-1)}elTbody.style.display="";oArg.nCurrent=i}},scope:this,iterations:loopN>0?Math.ceil(nTotal/loopN):1,argument:{nCurrent:nTotal,nLoopLength:loopN>0?loopN:nTotal},timeout:loopN>0?0:-1})}}this._runRenderChain()},disable:function(){this._disabled=true;var elTable=this._elTable;var elMask=this._elMask;elMask.style.width=elTable.offsetWidth+"px";elMask.style.height=elTable.offsetHeight+"px";elMask.style.left=elTable.offsetLeft+"px";elMask.style.display="";this.fireEvent("disableEvent")},undisable:function(){this._disabled=false;this._elMask.style.display="none";this.fireEvent("undisableEvent")},isDisabled:function(){return this._disabled},destroy:function(){var instanceName=this.toString();this._oChainRender.stop();this._destroyColumnHelpers();var oCellEditor;for(var i=0,len=this._oColumnSet.flat.length;i<len;i++){oCellEditor=this._oColumnSet.flat[i].editor;if(oCellEditor&&oCellEditor.destroy){oCellEditor.destroy();this._oColumnSet.flat[i].editor=null}}this._destroyPaginator();this._oRecordSet.unsubscribeAll();this.unsubscribeAll();Ev.removeListener(document,"click",this._onDocumentClick);this._destroyContainerEl(this._elContainer);for(var param in this){if(lang.hasOwnProperty(this,param)){this[param]=null}}DT._nCurrentCount--;if(DT._nCurrentCount<1){if(DT._elDynStyleNode){document.getElementsByTagName("head")[0].removeChild(DT._elDynStyleNode);DT._elDynStyleNode=null}}},showTableMessage:function(sHTML,sClassName){var elCell=this._elMsgTd;if(lang.isString(sHTML)){elCell.firstChild.innerHTML=sHTML}if(lang.isString(sClassName)){elCell.className=sClassName}this._elMsgTbody.style.display="";this.fireEvent("tableMsgShowEvent",{html:sHTML,className:sClassName})},hideTableMessage:function(){if(this._elMsgTbody.style.display!="none"){this._elMsgTbody.style.display="none";this._elMsgTbody.parentNode.style.width="";this.fireEvent("tableMsgHideEvent")}},focus:function(){this.focusTbodyEl()},focusTheadEl:function(){this._focusEl(this._elThead)},focusTbodyEl:function(){this._focusEl(this._elTbody)},onShow:function(){this.validateColumnWidths();for(var allKeys=this._oColumnSet.keys,i=0,len=allKeys.length,col;i<len;i++){col=allKeys[i];if(col._ddResizer){col._ddResizer.resetResizerEl()}}},getRecordIndex:function(row){var nTrIndex;if(!lang.isNumber(row)){if(row instanceof YAHOO.widget.Record){return this._oRecordSet.getRecordIndex(row)}else{var el=this.getTrEl(row);if(el){nTrIndex=el.sectionRowIndex}}}else{nTrIndex=row}if(lang.isNumber(nTrIndex)){var oPaginator=this.get("paginator");if(oPaginator){return oPaginator.get("recordOffset")+nTrIndex}else{return nTrIndex}}return null},getRecord:function(row){var oRecord=this._oRecordSet.getRecord(row);if(!oRecord){var elRow=this.getTrEl(row);if(elRow){oRecord=this._oRecordSet.getRecord(elRow.id)}}if(oRecord instanceof YAHOO.widget.Record){return this._oRecordSet.getRecord(oRecord)}else{return null}},getColumn:function(column){var oColumn=this._oColumnSet.getColumn(column);if(!oColumn){var elCell=this.getTdEl(column);if(elCell){oColumn=this._oColumnSet.getColumn(this.getCellIndex(elCell))}else{elCell=this.getThEl(column);if(elCell){var allColumns=this._oColumnSet.flat;for(var i=0,len=allColumns.length;i<len;i++){if(allColumns[i].getThEl().id===elCell.id){oColumn=allColumns[i]}}}}}if(!oColumn){}return oColumn},getColumnById:function(column){return this._oColumnSet.getColumnById(column)},getColumnSortDir:function(oColumn,oSortedBy){if(oColumn.sortOptions&&oColumn.sortOptions.defaultDir){if(oColumn.sortOptions.defaultDir=="asc"){oColumn.sortOptions.defaultDir=DT.CLASS_ASC}else if(oColumn.sortOptions.defaultDir=="desc"){oColumn.sortOptions.defaultDir=DT.CLASS_DESC}}var sortDir=oColumn.sortOptions&&oColumn.sortOptions.defaultDir?oColumn.sortOptions.defaultDir:DT.CLASS_ASC;var bSorted=false;oSortedBy=oSortedBy||this.get("sortedBy");if(oSortedBy&&oSortedBy.key===oColumn.key){bSorted=true;if(oSortedBy.dir){sortDir=oSortedBy.dir===DT.CLASS_ASC?DT.CLASS_DESC:DT.CLASS_ASC}else{sortDir=sortDir===DT.CLASS_ASC?DT.CLASS_DESC:DT.CLASS_ASC}}return sortDir},doBeforeSortColumn:function(oColumn,sSortDir){this.showTableMessage(this.get("MSG_LOADING"),DT.CLASS_LOADING);return true},sortColumn:function(oColumn,sDir){if(oColumn&&oColumn instanceof YAHOO.widget.Column){if(!oColumn.sortable){Dom.addClass(this.getThEl(oColumn),DT.CLASS_SORTABLE)}if(sDir&&sDir!==DT.CLASS_ASC&&sDir!==DT.CLASS_DESC){sDir=null}var sSortDir=sDir||this.getColumnSortDir(oColumn);var oSortedBy=this.get("sortedBy")||{};var bSorted=oSortedBy.key===oColumn.key?true:false;var ok=this.doBeforeSortColumn(oColumn,sSortDir);if(ok){if(this.get("dynamicData")){var oState=this.getState();if(oState.pagination){oState.pagination.recordOffset=0}oState.sortedBy={key:oColumn.key,dir:sSortDir};var request=this.get("generateRequest")(oState,this);this.unselectAllRows();this.unselectAllCells();var callback={success:this.onDataReturnSetRows,failure:this.onDataReturnSetRows,argument:oState,scope:this};this._oDataSource.sendRequest(request,callback)}else{var sortFnc=oColumn.sortOptions&&lang.isFunction(oColumn.sortOptions.sortFunction)?oColumn.sortOptions.sortFunction:null;if(!bSorted||sDir||sortFnc){sortFnc=sortFnc||this.get("sortFunction");var sField=oColumn.sortOptions&&oColumn.sortOptions.field?oColumn.sortOptions.field:oColumn.field;this._oRecordSet.sortRecords(sortFnc,sSortDir==DT.CLASS_DESC?true:false,sField)}else{this._oRecordSet.reverseRecords()}var oPaginator=this.get("paginator");if(oPaginator){oPaginator.setPage(1,true)}this.render();this.set("sortedBy",{key:oColumn.key,dir:sSortDir,column:oColumn})}this.fireEvent("columnSortEvent",{column:oColumn,dir:sSortDir});return}}},setColumnWidth:function(oColumn,nWidth){if(!(oColumn instanceof YAHOO.widget.Column)){oColumn=this.getColumn(oColumn)}if(oColumn){if(lang.isNumber(nWidth)){nWidth=nWidth>oColumn.minWidth?nWidth:oColumn.minWidth;oColumn.width=nWidth;this._setColumnWidth(oColumn,nWidth+"px");this.fireEvent("columnSetWidthEvent",{column:oColumn,width:nWidth})}else if(nWidth===null){oColumn.width=nWidth;this._setColumnWidth(oColumn,"auto");this.validateColumnWidths(oColumn);this.fireEvent("columnUnsetWidthEvent",{column:oColumn})}this._clearTrTemplateEl()}else{}},_setColumnWidth:function(oColumn,sWidth,sOverflow){if(oColumn&&oColumn.getKeyIndex()!==null){sOverflow=sOverflow||(sWidth===""||sWidth==="auto"?"visible":"hidden");if(!DT._bDynStylesFallback){this._setColumnWidthDynStyles(oColumn,sWidth,sOverflow)}else{this._setColumnWidthDynFunction(oColumn,sWidth,sOverflow)}}else{}},_setColumnWidthDynStyles:function(oColumn,sWidth,sOverflow){var s=DT._elDynStyleNode,rule;if(!s){s=document.createElement("style");s.type="text/css";s=document.getElementsByTagName("head").item(0).appendChild(s);DT._elDynStyleNode=s}if(s){var sClassname="."+this.getId()+"-col-"+oColumn.getSanitizedKey()+" ."+DT.CLASS_LINER;if(this._elTbody){this._elTbody.style.display="none"}rule=DT._oDynStyles[sClassname];if(!rule){if(s.styleSheet&&s.styleSheet.addRule){s.styleSheet.addRule(sClassname,"overflow:"+sOverflow);s.styleSheet.addRule(sClassname,"width:"+sWidth);rule=s.styleSheet.rules[s.styleSheet.rules.length-1];DT._oDynStyles[sClassname]=rule}else if(s.sheet&&s.sheet.insertRule){s.sheet.insertRule(sClassname+" {overflow:"+sOverflow+";width:"+sWidth+";}",s.sheet.cssRules.length);rule=s.sheet.cssRules[s.sheet.cssRules.length-1];DT._oDynStyles[sClassname]=rule}}else{rule.style.overflow=sOverflow;rule.style.width=sWidth}if(this._elTbody){this._elTbody.style.display=""}}if(!rule){DT._bDynStylesFallback=true;this._setColumnWidthDynFunction(oColumn,sWidth)}},_setColumnWidthDynFunction:function(oColumn,sWidth,sOverflow){if(sWidth=="auto"){sWidth=""}var rowslen=this._elTbody?this._elTbody.rows.length:0;if(!this._aDynFunctions[rowslen]){var i,j,k;var resizerDef=["var colIdx=oColumn.getKeyIndex();","oColumn.getThLinerEl().style.overflow="];for(i=rowslen-1,j=2;i>=0;--i){resizerDef[j++]="this._elTbody.rows[";resizerDef[j++]=i;resizerDef[j++]="].cells[colIdx].firstChild.style.overflow="}resizerDef[j]="sOverflow;";resizerDef[j+1]="oColumn.getThLinerEl().style.width=";for(i=rowslen-1,k=j+2;i>=0;--i){resizerDef[k++]="this._elTbody.rows[";resizerDef[k++]=i;resizerDef[k++]="].cells[colIdx].firstChild.style.width="}resizerDef[k]="sWidth;";this._aDynFunctions[rowslen]=new Function("oColumn","sWidth","sOverflow",resizerDef.join(""))}var resizerFn=this._aDynFunctions[rowslen];if(resizerFn){resizerFn.call(this,oColumn,sWidth,sOverflow)}},validateColumnWidths:function(oColumn){var elColgroup=this._elColgroup;var elColgroupClone=elColgroup.cloneNode(true);var bNeedsValidation=false;var allKeys=this._oColumnSet.keys;var elThLiner;if(oColumn&&!oColumn.hidden&&!oColumn.width&&oColumn.getKeyIndex()!==null){elThLiner=oColumn.getThLinerEl();if(oColumn.minWidth>0&&elThLiner.offsetWidth<oColumn.minWidth){elColgroupClone.childNodes[oColumn.getKeyIndex()].style.width=oColumn.minWidth+(parseInt(Dom.getStyle(elThLiner,"paddingLeft"),10)|0)+(parseInt(Dom.getStyle(elThLiner,"paddingRight"),10)|0)+"px";bNeedsValidation=true}else if(oColumn.maxAutoWidth>0&&elThLiner.offsetWidth>oColumn.maxAutoWidth){this._setColumnWidth(oColumn,oColumn.maxAutoWidth+"px","hidden")}}else{for(var i=0,len=allKeys.length;i<len;i++){oColumn=allKeys[i];if(!oColumn.hidden&&!oColumn.width){elThLiner=oColumn.getThLinerEl();if(oColumn.minWidth>0&&elThLiner.offsetWidth<oColumn.minWidth){elColgroupClone.childNodes[i].style.width=oColumn.minWidth+(parseInt(Dom.getStyle(elThLiner,"paddingLeft"),10)|0)+(parseInt(Dom.getStyle(elThLiner,"paddingRight"),10)|0)+"px";bNeedsValidation=true}else if(oColumn.maxAutoWidth>0&&elThLiner.offsetWidth>oColumn.maxAutoWidth){this._setColumnWidth(oColumn,oColumn.maxAutoWidth+"px","hidden")}}}}if(bNeedsValidation){elColgroup.parentNode.replaceChild(elColgroupClone,elColgroup);this._elColgroup=elColgroupClone}},_clearMinWidth:function(oColumn){if(oColumn.getKeyIndex()!==null){this._elColgroup.childNodes[oColumn.getKeyIndex()].style.width=""}},_restoreMinWidth:function(oColumn){if(oColumn.minWidth&&oColumn.getKeyIndex()!==null){this._elColgroup.childNodes[oColumn.getKeyIndex()].style.width=oColumn.minWidth+"px"}},hideColumn:function(oColumn){if(!(oColumn instanceof YAHOO.widget.Column)){oColumn=this.getColumn(oColumn)}if(oColumn&&!oColumn.hidden&&oColumn.getTreeIndex()!==null){var allrows=this.getTbodyEl().rows;var l=allrows.length;var allDescendants=this._oColumnSet.getDescendants(oColumn);for(var i=0,len=allDescendants.length;i<len;i++){var thisColumn=allDescendants[i];thisColumn.hidden=true;Dom.addClass(thisColumn.getThEl(),DT.CLASS_HIDDEN);var thisKeyIndex=thisColumn.getKeyIndex();if(thisKeyIndex!==null){this._clearMinWidth(oColumn);for(var j=0;j<l;j++){Dom.addClass(allrows[j].cells[thisKeyIndex],DT.CLASS_HIDDEN)}}this.fireEvent("columnHideEvent",{column:thisColumn})}this._repaintOpera();this._clearTrTemplateEl()}else{}},showColumn:function(oColumn){if(!(oColumn instanceof YAHOO.widget.Column)){oColumn=this.getColumn(oColumn)}if(oColumn&&oColumn.hidden&&oColumn.getTreeIndex()!==null){var allrows=this.getTbodyEl().rows;var l=allrows.length;var allDescendants=this._oColumnSet.getDescendants(oColumn);for(var i=0,len=allDescendants.length;i<len;i++){var thisColumn=allDescendants[i];thisColumn.hidden=false;Dom.removeClass(thisColumn.getThEl(),DT.CLASS_HIDDEN);var thisKeyIndex=thisColumn.getKeyIndex();if(thisKeyIndex!==null){this._restoreMinWidth(oColumn);for(var j=0;j<l;j++){Dom.removeClass(allrows[j].cells[thisKeyIndex],DT.CLASS_HIDDEN)}}this.fireEvent("columnShowEvent",{column:thisColumn})}this._clearTrTemplateEl()}else{}},removeColumn:function(oColumn){if(!(oColumn instanceof YAHOO.widget.Column)){oColumn=this.getColumn(oColumn)}if(oColumn){var nColTreeIndex=oColumn.getTreeIndex();if(nColTreeIndex!==null){var i,len,aKeyIndexes=oColumn.getKeyIndex();if(aKeyIndexes===null){var descKeyIndexes=[];var allDescendants=this._oColumnSet.getDescendants(oColumn);for(i=0,len=allDescendants.length;i<len;i++){var thisKey=allDescendants[i].getKeyIndex();if(thisKey!==null){descKeyIndexes[descKeyIndexes.length]=thisKey}}if(descKeyIndexes.length>0){aKeyIndexes=descKeyIndexes}}else{aKeyIndexes=[aKeyIndexes]}if(aKeyIndexes!==null){aKeyIndexes.sort((function(a,b){return YAHOO.util.Sort.compare(a,b)}));this._destroyTheadEl();var aOrigColumnDefs=this._oColumnSet.getDefinitions();oColumn=aOrigColumnDefs.splice(nColTreeIndex,1)[0];this._initColumnSet(aOrigColumnDefs);this._initTheadEl();for(i=aKeyIndexes.length-1;i>-1;i--){this._removeColgroupColEl(aKeyIndexes[i])}var allRows=this._elTbody.rows;if(allRows.length>0){var loopN=this.get("renderLoopSize"),loopEnd=allRows.length;this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var i=oArg.nCurrentRow,len=loopN>0?Math.min(i+loopN,allRows.length):allRows.length,aIndexes=oArg.aIndexes,j;for(;i<len;++i){for(j=aIndexes.length-1;j>-1;j--){allRows[i].removeChild(allRows[i].childNodes[aIndexes[j]])}}oArg.nCurrentRow=i}},iterations:loopN>0?Math.ceil(loopEnd/loopN):1,argument:{nCurrentRow:0,aIndexes:aKeyIndexes},scope:this,timeout:loopN>0?0:-1});this._runRenderChain()}this.fireEvent("columnRemoveEvent",{column:oColumn});return oColumn}}}},insertColumn:function(oColumn,index){if(oColumn instanceof YAHOO.widget.Column){oColumn=oColumn.getDefinition()}else if(oColumn.constructor!==Object){return}var oColumnSet=this._oColumnSet;if(!lang.isValue(index)||!lang.isNumber(index)){index=oColumnSet.tree[0].length}this._destroyTheadEl();var aNewColumnDefs=this._oColumnSet.getDefinitions();aNewColumnDefs.splice(index,0,oColumn);this._initColumnSet(aNewColumnDefs);this._initTheadEl();oColumnSet=this._oColumnSet;var oNewColumn=oColumnSet.tree[0][index];var i,len,descKeyIndexes=[];var allDescendants=oColumnSet.getDescendants(oNewColumn);for(i=0,len=allDescendants.length;i<len;i++){var thisKey=allDescendants[i].getKeyIndex();if(thisKey!==null){descKeyIndexes[descKeyIndexes.length]=thisKey}}if(descKeyIndexes.length>0){var newIndex=descKeyIndexes.sort((function(a,b){return YAHOO.util.Sort.compare(a,b)}))[0];for(i=descKeyIndexes.length-1;i>-1;i--){this._insertColgroupColEl(descKeyIndexes[i])}var allRows=this._elTbody.rows;if(allRows.length>0){var loopN=this.get("renderLoopSize"),loopEnd=allRows.length;var aTdTemplates=[],elTdTemplate;for(i=0,len=descKeyIndexes.length;i<len;i++){var thisKeyIndex=descKeyIndexes[i];elTdTemplate=this._getTrTemplateEl().childNodes[i].cloneNode(true);elTdTemplate=this._formatTdEl(this._oColumnSet.keys[thisKeyIndex],elTdTemplate,thisKeyIndex,thisKeyIndex===this._oColumnSet.keys.length-1);aTdTemplates[thisKeyIndex]=elTdTemplate}this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var i=oArg.nCurrentRow,j,descKeyIndexes=oArg.descKeyIndexes,len=loopN>0?Math.min(i+loopN,allRows.length):allRows.length,nextSibling;for(;i<len;++i){nextSibling=allRows[i].childNodes[newIndex]||null;for(j=descKeyIndexes.length-1;j>-1;j--){allRows[i].insertBefore(oArg.aTdTemplates[descKeyIndexes[j]].cloneNode(true),nextSibling)}}oArg.nCurrentRow=i}},iterations:loopN>0?Math.ceil(loopEnd/loopN):1,argument:{nCurrentRow:0,aTdTemplates:aTdTemplates,descKeyIndexes:descKeyIndexes},scope:this,timeout:loopN>0?0:-1});this._runRenderChain()}this.fireEvent("columnInsertEvent",{column:oColumn,index:index});return oNewColumn}},reorderColumn:function(oColumn,index){if(!(oColumn instanceof YAHOO.widget.Column)){oColumn=this.getColumn(oColumn)}if(oColumn&&YAHOO.lang.isNumber(index)){var nOrigTreeIndex=oColumn.getTreeIndex();if(nOrigTreeIndex!==null&&nOrigTreeIndex!==index){var i,len,aOrigKeyIndexes=oColumn.getKeyIndex(),allDescendants,descKeyIndexes=[],thisKey;if(aOrigKeyIndexes===null){allDescendants=this._oColumnSet.getDescendants(oColumn);for(i=0,len=allDescendants.length;i<len;i++){thisKey=allDescendants[i].getKeyIndex();if(thisKey!==null){descKeyIndexes[descKeyIndexes.length]=thisKey}}if(descKeyIndexes.length>0){aOrigKeyIndexes=descKeyIndexes}}else{aOrigKeyIndexes=[aOrigKeyIndexes]}if(aOrigKeyIndexes!==null){aOrigKeyIndexes.sort((function(a,b){return YAHOO.util.Sort.compare(a,b)}));this._destroyTheadEl();var aColumnDefs=this._oColumnSet.getDefinitions();var oColumnDef=aColumnDefs.splice(nOrigTreeIndex,1)[0];aColumnDefs.splice(index,0,oColumnDef);this._initColumnSet(aColumnDefs);this._initTheadEl();var oNewColumn=this._oColumnSet.tree[0][index];var aNewKeyIndexes=oNewColumn.getKeyIndex();if(aNewKeyIndexes===null){descKeyIndexes=[];allDescendants=this._oColumnSet.getDescendants(oNewColumn);for(i=0,len=allDescendants.length;i<len;i++){thisKey=allDescendants[i].getKeyIndex();if(thisKey!==null){descKeyIndexes[descKeyIndexes.length]=thisKey}}if(descKeyIndexes.length>0){aNewKeyIndexes=descKeyIndexes}}else{aNewKeyIndexes=[aNewKeyIndexes]}var newIndex=aNewKeyIndexes.sort((function(a,b){return YAHOO.util.Sort.compare(a,b)}))[0];this._reorderColgroupColEl(aOrigKeyIndexes,newIndex);var allRows=this._elTbody.rows;if(allRows.length>0){var loopN=this.get("renderLoopSize"),loopEnd=allRows.length;this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var i=oArg.nCurrentRow,j,tmpTds,nextSibling,len=loopN>0?Math.min(i+loopN,allRows.length):allRows.length,aIndexes=oArg.aIndexes,thisTr;for(;i<len;++i){tmpTds=[];thisTr=allRows[i];for(j=aIndexes.length-1;j>-1;j--){tmpTds.push(thisTr.removeChild(thisTr.childNodes[aIndexes[j]]))}nextSibling=thisTr.childNodes[newIndex]||null;for(j=tmpTds.length-1;j>-1;j--){thisTr.insertBefore(tmpTds[j],nextSibling)}}oArg.nCurrentRow=i}},iterations:loopN>0?Math.ceil(loopEnd/loopN):1,argument:{nCurrentRow:0,aIndexes:aOrigKeyIndexes},scope:this,timeout:loopN>0?0:-1});this._runRenderChain()}this.fireEvent("columnReorderEvent",{column:oNewColumn,oldIndex:nOrigTreeIndex});return oNewColumn}}}},selectColumn:function(oColumn){oColumn=this.getColumn(oColumn);if(oColumn&&!oColumn.selected){if(oColumn.getKeyIndex()!==null){oColumn.selected=true;var elTh=oColumn.getThEl();Dom.addClass(elTh,DT.CLASS_SELECTED);var allRows=this.getTbodyEl().rows;var oChainRender=this._oChainRender;oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId&&allRows[oArg.rowIndex]&&allRows[oArg.rowIndex].cells[oArg.cellIndex]){Dom.addClass(allRows[oArg.rowIndex].cells[oArg.cellIndex],DT.CLASS_SELECTED)}oArg.rowIndex++},scope:this,iterations:allRows.length,argument:{rowIndex:0,cellIndex:oColumn.getKeyIndex()}});this._clearTrTemplateEl();this._elTbody.style.display="none";this._runRenderChain();this._elTbody.style.display="";this.fireEvent("columnSelectEvent",{column:oColumn})}else{}}},unselectColumn:function(oColumn){oColumn=this.getColumn(oColumn);if(oColumn&&oColumn.selected){if(oColumn.getKeyIndex()!==null){oColumn.selected=false;var elTh=oColumn.getThEl();Dom.removeClass(elTh,DT.CLASS_SELECTED);var allRows=this.getTbodyEl().rows;var oChainRender=this._oChainRender;oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId&&allRows[oArg.rowIndex]&&allRows[oArg.rowIndex].cells[oArg.cellIndex]){Dom.removeClass(allRows[oArg.rowIndex].cells[oArg.cellIndex],DT.CLASS_SELECTED)}oArg.rowIndex++},scope:this,iterations:allRows.length,argument:{rowIndex:0,cellIndex:oColumn.getKeyIndex()}});this._clearTrTemplateEl();this._elTbody.style.display="none";this._runRenderChain();this._elTbody.style.display="";this.fireEvent("columnUnselectEvent",{column:oColumn})}else{}}},getSelectedColumns:function(oColumn){var selectedColumns=[];var aKeys=this._oColumnSet.keys;for(var i=0,len=aKeys.length;i<len;i++){if(aKeys[i].selected){selectedColumns[selectedColumns.length]=aKeys[i]}}return selectedColumns},highlightColumn:function(column){var oColumn=this.getColumn(column);if(oColumn&&oColumn.getKeyIndex()!==null){var elTh=oColumn.getThEl();Dom.addClass(elTh,DT.CLASS_HIGHLIGHTED);var allRows=this.getTbodyEl().rows;var oChainRender=this._oChainRender;oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId&&allRows[oArg.rowIndex]&&allRows[oArg.rowIndex].cells[oArg.cellIndex]){Dom.addClass(allRows[oArg.rowIndex].cells[oArg.cellIndex],DT.CLASS_HIGHLIGHTED)}oArg.rowIndex++},scope:this,iterations:allRows.length,argument:{rowIndex:0,cellIndex:oColumn.getKeyIndex()},timeout:-1});this._elTbody.style.display="none";this._runRenderChain();this._elTbody.style.display="";this.fireEvent("columnHighlightEvent",{column:oColumn})}else{}},unhighlightColumn:function(column){var oColumn=this.getColumn(column);if(oColumn&&oColumn.getKeyIndex()!==null){var elTh=oColumn.getThEl();Dom.removeClass(elTh,DT.CLASS_HIGHLIGHTED);var allRows=this.getTbodyEl().rows;var oChainRender=this._oChainRender;oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId&&allRows[oArg.rowIndex]&&allRows[oArg.rowIndex].cells[oArg.cellIndex]){Dom.removeClass(allRows[oArg.rowIndex].cells[oArg.cellIndex],DT.CLASS_HIGHLIGHTED)}oArg.rowIndex++},scope:this,iterations:allRows.length,argument:{rowIndex:0,cellIndex:oColumn.getKeyIndex()},timeout:-1});this._elTbody.style.display="none";this._runRenderChain();this._elTbody.style.display="";this.fireEvent("columnUnhighlightEvent",{column:oColumn})}else{}},addRow:function(oData,index){if(lang.isNumber(index)&&(index<0||index>this._oRecordSet.getLength())){return}if(oData&&lang.isObject(oData)){var oRecord=this._oRecordSet.addRecord(oData,index);if(oRecord){var recIndex;var oPaginator=this.get("paginator");if(oPaginator){var totalRecords=oPaginator.get("totalRecords");if(totalRecords!==widget.Paginator.VALUE_UNLIMITED){oPaginator.set("totalRecords",totalRecords+1)}recIndex=this.getRecordIndex(oRecord);var endRecIndex=oPaginator.getPageRecords()[1];if(recIndex<=endRecIndex){this.render()}this.fireEvent("rowAddEvent",{record:oRecord});return}else{recIndex=this.getRecordIndex(oRecord);if(lang.isNumber(recIndex)){this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var oRecord=oArg.record;var recIndex=oArg.recIndex;var elNewTr=this._addTrEl(oRecord);if(elNewTr){var elNext=this._elTbody.rows[recIndex]?this._elTbody.rows[recIndex]:null;this._elTbody.insertBefore(elNewTr,elNext);if(recIndex===0){this._setFirstRow()}if(elNext===null){this._setLastRow()}this._setRowStripes();this.hideTableMessage();this.fireEvent("rowAddEvent",{record:oRecord})}}},argument:{record:oRecord,recIndex:recIndex},scope:this,timeout:this.get("renderLoopSize")>0?0:-1});this._runRenderChain();return}}}}},addRows:function(aData,index){if(lang.isNumber(index)&&(index<0||index>this._oRecordSet.getLength())){return}if(lang.isArray(aData)){var aRecords=this._oRecordSet.addRecords(aData,index);if(aRecords){var recIndex=this.getRecordIndex(aRecords[0]);var oPaginator=this.get("paginator");if(oPaginator){var totalRecords=oPaginator.get("totalRecords");if(totalRecords!==widget.Paginator.VALUE_UNLIMITED){oPaginator.set("totalRecords",totalRecords+aRecords.length)}var endRecIndex=oPaginator.getPageRecords()[1];if(recIndex<=endRecIndex){this.render()}this.fireEvent("rowsAddEvent",{records:aRecords});return}else{var loopN=this.get("renderLoopSize");var loopEnd=recIndex+aData.length;var nRowsNeeded=loopEnd-recIndex;var isLast=recIndex>=this._elTbody.rows.length;this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var aRecords=oArg.aRecords,i=oArg.nCurrentRow,j=oArg.nCurrentRecord,len=loopN>0?Math.min(i+loopN,loopEnd):loopEnd,df=document.createDocumentFragment(),elNext=this._elTbody.rows[i]?this._elTbody.rows[i]:null;for(;i<len;i++,j++){df.appendChild(this._addTrEl(aRecords[j]))}this._elTbody.insertBefore(df,elNext);oArg.nCurrentRow=i;oArg.nCurrentRecord=j}},iterations:loopN>0?Math.ceil(loopEnd/loopN):1,argument:{nCurrentRow:recIndex,nCurrentRecord:0,aRecords:aRecords},scope:this,timeout:loopN>0?0:-1});this._oChainRender.add({method:function(oArg){var recIndex=oArg.recIndex;if(recIndex===0){this._setFirstRow()}if(oArg.isLast){this._setLastRow()}this._setRowStripes();this.fireEvent("rowsAddEvent",{records:aRecords})},argument:{recIndex:recIndex,isLast:isLast},scope:this,timeout:-1});this._runRenderChain();this.hideTableMessage();return}}}},updateRow:function(row,oData){var index=row;if(!lang.isNumber(index)){index=this.getRecordIndex(row)}if(lang.isNumber(index)&&index>=0){var oRecordSet=this._oRecordSet,oldRecord=oRecordSet.getRecord(index);if(oldRecord){var updatedRecord=this._oRecordSet.setRecord(oData,index),elRow=this.getTrEl(oldRecord),oldData=oldRecord?oldRecord.getData():null;if(updatedRecord){var tracker=this._aSelections||[],i=0,oldId=oldRecord.getId(),newId=updatedRecord.getId();for(;i<tracker.length;i++){if(tracker[i]===oldId){tracker[i]=newId}else if(tracker[i].recordId===oldId){tracker[i].recordId=newId}}if(this._oAnchorRecord&&this._oAnchorRecord.getId()===oldId){this._oAnchorRecord=updatedRecord}if(this._oAnchorCell&&this._oAnchorCell.record.getId()===oldId){this._oAnchorCell.record=updatedRecord}this._oChainRender.add({method:function(){if(this instanceof DT&&this._sId){var oPaginator=this.get("paginator");if(oPaginator){var pageStartIndex=oPaginator.getPageRecords()[0],pageLastIndex=oPaginator.getPageRecords()[1];if(index>=pageStartIndex||index<=pageLastIndex){this.render()}}else{if(elRow){this._updateTrEl(elRow,updatedRecord)}else{this.getTbodyEl().appendChild(this._addTrEl(updatedRecord))}}this.fireEvent("rowUpdateEvent",{record:updatedRecord,oldData:oldData})}},scope:this,timeout:this.get("renderLoopSize")>0?0:-1});this._runRenderChain();return}}}return},updateRows:function(startrow,aData){if(lang.isArray(aData)){var startIndex=startrow,oRecordSet=this._oRecordSet,lastRowIndex=oRecordSet.getLength();if(!lang.isNumber(startrow)){startIndex=this.getRecordIndex(startrow)}if(lang.isNumber(startIndex)&&startIndex>=0&&startIndex<oRecordSet.getLength()){var lastIndex=startIndex+aData.length,aOldRecords=oRecordSet.getRecords(startIndex,aData.length),aNewRecords=oRecordSet.setRecords(aData,startIndex);if(aNewRecords){var tracker=this._aSelections||[],i=0,j,newRecord,newId,oldId,anchorRecord=this._oAnchorRecord?this._oAnchorRecord.getId():null,anchorCell=this._oAnchorCell?this._oAnchorCell.record.getId():null;for(;i<aOldRecords.length;i++){oldId=aOldRecords[i].getId();newRecord=aNewRecords[i];newId=newRecord.getId();for(j=0;j<tracker.length;j++){if(tracker[j]===oldId){tracker[j]=newId}else if(tracker[j].recordId===oldId){tracker[j].recordId=newId}}if(anchorRecord&&anchorRecord===oldId){this._oAnchorRecord=newRecord}if(anchorCell&&anchorCell===oldId){this._oAnchorCell.record=newRecord}}var oPaginator=this.get("paginator");if(oPaginator){var pageStartIndex=oPaginator.getPageRecords()[0],pageLastIndex=oPaginator.getPageRecords()[1];if(startIndex>=pageStartIndex||lastIndex<=pageLastIndex){this.render()}this.fireEvent("rowsAddEvent",{newRecords:aNewRecords,oldRecords:aOldRecords});return}else{var loopN=this.get("renderLoopSize"),rowCount=aData.length,isLast=lastIndex>=lastRowIndex,isAdding=lastIndex>lastRowIndex;this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var aRecords=oArg.aRecords,i=oArg.nCurrentRow,j=oArg.nDataPointer,len=loopN>0?Math.min(i+loopN,startIndex+aRecords.length):startIndex+aRecords.length;for(;i<len;i++,j++){if(isAdding&&i>=lastRowIndex){this._elTbody.appendChild(this._addTrEl(aRecords[j]))}else{this._updateTrEl(this._elTbody.rows[i],aRecords[j])}}oArg.nCurrentRow=i;oArg.nDataPointer=j}},iterations:loopN>0?Math.ceil(rowCount/loopN):1,argument:{nCurrentRow:startIndex,aRecords:aNewRecords,nDataPointer:0,isAdding:isAdding},scope:this,timeout:loopN>0?0:-1});this._oChainRender.add({method:function(oArg){var recIndex=oArg.recIndex;if(recIndex===0){this._setFirstRow()}if(oArg.isLast){this._setLastRow()}this._setRowStripes();this.fireEvent("rowsAddEvent",{newRecords:aNewRecords,oldRecords:aOldRecords})},argument:{recIndex:startIndex,isLast:isLast},scope:this,timeout:-1});this._runRenderChain();this.hideTableMessage();return}}}}},deleteRow:function(row){var nRecordIndex=lang.isNumber(row)?row:this.getRecordIndex(row);if(lang.isNumber(nRecordIndex)){var oRecord=this.getRecord(nRecordIndex);if(oRecord){var nTrIndex=this.getTrIndex(nRecordIndex);var sRecordId=oRecord.getId();var tracker=this._aSelections||[];for(var j=tracker.length-1;j>-1;j--){if(lang.isString(tracker[j])&&tracker[j]===sRecordId||lang.isObject(tracker[j])&&tracker[j].recordId===sRecordId){tracker.splice(j,1)}}var oData=this._oRecordSet.deleteRecord(nRecordIndex);if(oData){var oPaginator=this.get("paginator");if(oPaginator){var totalRecords=oPaginator.get("totalRecords"),rng=oPaginator.getPageRecords();if(totalRecords!==widget.Paginator.VALUE_UNLIMITED){oPaginator.set("totalRecords",totalRecords-1)}if(!rng||nRecordIndex<=rng[1]){this.render()}this._oChainRender.add({method:function(){if(this instanceof DT&&this._sId){this.fireEvent("rowDeleteEvent",{recordIndex:nRecordIndex,oldData:oData,trElIndex:nTrIndex})}},scope:this,timeout:this.get("renderLoopSize")>0?0:-1});this._runRenderChain()}else{if(lang.isNumber(nTrIndex)){this._oChainRender.add({method:function(){if(this instanceof DT&&this._sId){var isLast=nRecordIndex===this._oRecordSet.getLength();this._deleteTrEl(nTrIndex);if(this._elTbody.rows.length>0){if(nTrIndex===0){this._setFirstRow()}if(isLast){this._setLastRow()}if(nTrIndex!=this._elTbody.rows.length){this._setRowStripes(nTrIndex)}}this.fireEvent("rowDeleteEvent",{recordIndex:nRecordIndex,oldData:oData,trElIndex:nTrIndex})}},scope:this,timeout:this.get("renderLoopSize")>0?0:-1});this._runRenderChain();return}}}}}return null},deleteRows:function(row,count){var nRecordIndex=lang.isNumber(row)?row:this.getRecordIndex(row);if(lang.isNumber(nRecordIndex)){var oRecord=this.getRecord(nRecordIndex);if(oRecord){var nTrIndex=this.getTrIndex(nRecordIndex);var sRecordId=oRecord.getId();var tracker=this._aSelections||[];for(var j=tracker.length-1;j>-1;j--){if(lang.isString(tracker[j])&&tracker[j]===sRecordId||lang.isObject(tracker[j])&&tracker[j].recordId===sRecordId){tracker.splice(j,1)}}var highIndex=nRecordIndex;var lowIndex=nRecordIndex;if(count&&lang.isNumber(count)){highIndex=count>0?nRecordIndex+count-1:nRecordIndex;lowIndex=count>0?nRecordIndex:nRecordIndex+count+1;count=count>0?count:count*-1;if(lowIndex<0){lowIndex=0;count=highIndex-lowIndex+1}}else{count=1}var aData=this._oRecordSet.deleteRecords(lowIndex,count);if(aData){var oPaginator=this.get("paginator"),loopN=this.get("renderLoopSize");if(oPaginator){var totalRecords=oPaginator.get("totalRecords"),rng=oPaginator.getPageRecords();if(totalRecords!==widget.Paginator.VALUE_UNLIMITED){oPaginator.set("totalRecords",totalRecords-aData.length)}if(!rng||lowIndex<=rng[1]){this.render()}this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){this.fireEvent("rowsDeleteEvent",{recordIndex:lowIndex,oldData:aData,count:count})}},scope:this,timeout:loopN>0?0:-1});this._runRenderChain();return}else{if(lang.isNumber(nTrIndex)){var loopEnd=lowIndex;var nRowsNeeded=count;this._oChainRender.add({method:function(oArg){if(this instanceof DT&&this._sId){var i=oArg.nCurrentRow,len=loopN>0?Math.max(i-loopN,loopEnd)-1:loopEnd-1;for(;i>len;--i){this._deleteTrEl(i)}oArg.nCurrentRow=i}},iterations:loopN>0?Math.ceil(count/loopN):1,argument:{nCurrentRow:highIndex},scope:this,timeout:loopN>0?0:-1});this._oChainRender.add({method:function(){if(this._elTbody.rows.length>0){this._setFirstRow();this._setLastRow();this._setRowStripes()}this.fireEvent("rowsDeleteEvent",{recordIndex:lowIndex,oldData:aData,count:count})},scope:this,timeout:-1});this._runRenderChain();return}}}}}return null},formatCell:function(elLiner,oRecord,oColumn){if(!oRecord){oRecord=this.getRecord(elLiner)}if(!oColumn){oColumn=this.getColumn(this.getCellIndex(elLiner.parentNode))}if(oRecord&&oColumn){var sField=oColumn.field;var oData=oRecord.getData(sField);var fnFormatter=typeof oColumn.formatter==="function"?oColumn.formatter:DT.Formatter[oColumn.formatter+""]||DT.Formatter.defaultFormatter;if(fnFormatter){fnFormatter.call(this,elLiner,oRecord,oColumn,oData)}else{elLiner.innerHTML=oData}this.fireEvent("cellFormatEvent",{record:oRecord,column:oColumn,key:oColumn.key,el:elLiner})}else{}},updateCell:function(oRecord,oColumn,oData,skipRender){oColumn=oColumn instanceof YAHOO.widget.Column?oColumn:this.getColumn(oColumn);if(oColumn&&oColumn.getField()&&oRecord instanceof YAHOO.widget.Record){var sKey=oColumn.getField(),oldData=oRecord.getData(sKey);this._oRecordSet.updateRecordValue(oRecord,sKey,oData);var elTd=this.getTdEl({record:oRecord,column:oColumn});if(elTd){this._oChainRender.add({method:function(){if(this instanceof DT&&this._sId){this.formatCell(elTd.firstChild,oRecord,oColumn);this.fireEvent("cellUpdateEvent",{record:oRecord,column:oColumn,oldData:oldData})}},scope:this,timeout:this.get("renderLoopSize")>0?0:-1});if(!skipRender){this._runRenderChain()}}else{this.fireEvent("cellUpdateEvent",{record:oRecord,column:oColumn,oldData:oldData})}}},_updatePaginator:function(newPag){var oldPag=this.get("paginator");if(oldPag&&newPag!==oldPag){oldPag.unsubscribe("changeRequest",this.onPaginatorChangeRequest,this,true)}if(newPag){newPag.subscribe("changeRequest",this.onPaginatorChangeRequest,this,true)}},_handlePaginatorChange:function(e){if(e.prevValue===e.newValue){return}var newPag=e.newValue,oldPag=e.prevValue,containers=this._defaultPaginatorContainers();if(oldPag){if(oldPag.getContainerNodes()[0]==containers[0]){oldPag.set("containers",[])}oldPag.destroy();if(containers[0]){if(newPag&&!newPag.getContainerNodes().length){newPag.set("containers",containers)}else{for(var i=containers.length-1;i>=0;--i){if(containers[i]){containers[i].parentNode.removeChild(containers[i])}}}}}if(!this._bInit){this.render()}if(newPag){this.renderPaginator()}},_defaultPaginatorContainers:function(create){var above_id=this._sId+"-paginator0",below_id=this._sId+"-paginator1",above=Dom.get(above_id),below=Dom.get(below_id);if(create&&(!above||!below)){if(!above){above=document.createElement("div");above.id=above_id;Dom.addClass(above,DT.CLASS_PAGINATOR);this._elContainer.insertBefore(above,this._elContainer.firstChild)}if(!below){below=document.createElement("div");below.id=below_id;Dom.addClass(below,DT.CLASS_PAGINATOR);this._elContainer.appendChild(below)}}return[above,below]},_destroyPaginator:function(){var oldPag=this.get("paginator");if(oldPag){oldPag.destroy()}},renderPaginator:function(){var pag=this.get("paginator");if(!pag){return}if(!pag.getContainerNodes().length){pag.set("containers",this._defaultPaginatorContainers(true))}pag.render()},doBeforePaginatorChange:function(oPaginatorState){this.showTableMessage(this.get("MSG_LOADING"),DT.CLASS_LOADING);return true},onPaginatorChangeRequest:function(oPaginatorState){var ok=this.doBeforePaginatorChange(oPaginatorState);if(ok){if(this.get("dynamicData")){var oState=this.getState();oState.pagination=oPaginatorState;var request=this.get("generateRequest")(oState,this);this.unselectAllRows();this.unselectAllCells();var callback={success:this.onDataReturnSetRows,failure:this.onDataReturnSetRows,argument:oState,scope:this};this._oDataSource.sendRequest(request,callback)}else{oPaginatorState.paginator.setStartIndex(oPaginatorState.recordOffset,true);oPaginatorState.paginator.setRowsPerPage(oPaginatorState.rowsPerPage,true);this.render()}}else{}},_elLastHighlightedTd:null,_aSelections:null,_oAnchorRecord:null,_oAnchorCell:null,_unselectAllTrEls:function(){var selectedRows=Dom.getElementsByClassName(DT.CLASS_SELECTED,"tr",this._elTbody);Dom.removeClass(selectedRows,DT.CLASS_SELECTED)},_getSelectionTrigger:function(){var sMode=this.get("selectionMode");var oTrigger={};var oTriggerCell,oTriggerRecord,nTriggerRecordIndex,elTriggerRow,nTriggerTrIndex;if(sMode=="cellblock"||sMode=="cellrange"||sMode=="singlecell"){oTriggerCell=this.getLastSelectedCell();if(!oTriggerCell){return null}else{oTriggerRecord=this.getRecord(oTriggerCell.recordId);nTriggerRecordIndex=this.getRecordIndex(oTriggerRecord);elTriggerRow=this.getTrEl(oTriggerRecord);nTriggerTrIndex=this.getTrIndex(elTriggerRow);if(nTriggerTrIndex===null){return null}else{oTrigger.record=oTriggerRecord;oTrigger.recordIndex=nTriggerRecordIndex;oTrigger.el=this.getTdEl(oTriggerCell);oTrigger.trIndex=nTriggerTrIndex;oTrigger.column=this.getColumn(oTriggerCell.columnKey);oTrigger.colKeyIndex=oTrigger.column.getKeyIndex();oTrigger.cell=oTriggerCell;return oTrigger}}}else{oTriggerRecord=this.getLastSelectedRecord();if(!oTriggerRecord){return null}else{oTriggerRecord=this.getRecord(oTriggerRecord);nTriggerRecordIndex=this.getRecordIndex(oTriggerRecord);elTriggerRow=this.getTrEl(oTriggerRecord);nTriggerTrIndex=this.getTrIndex(elTriggerRow);if(nTriggerTrIndex===null){return null}else{oTrigger.record=oTriggerRecord;oTrigger.recordIndex=nTriggerRecordIndex;oTrigger.el=elTriggerRow;oTrigger.trIndex=nTriggerTrIndex;return oTrigger}}}},_getSelectionAnchor:function(oTrigger){var sMode=this.get("selectionMode");var oAnchor={};var oAnchorRecord,nAnchorRecordIndex,nAnchorTrIndex;if(sMode=="cellblock"||sMode=="cellrange"||sMode=="singlecell"){var oAnchorCell=this._oAnchorCell;if(!oAnchorCell){if(oTrigger){oAnchorCell=this._oAnchorCell=oTrigger.cell}else{return null}}oAnchorRecord=this._oAnchorCell.record;nAnchorRecordIndex=this._oRecordSet.getRecordIndex(oAnchorRecord);nAnchorTrIndex=this.getTrIndex(oAnchorRecord);if(nAnchorTrIndex===null){if(nAnchorRecordIndex<this.getRecordIndex(this.getFirstTrEl())){nAnchorTrIndex=0}else{nAnchorTrIndex=this.getRecordIndex(this.getLastTrEl())}}oAnchor.record=oAnchorRecord;oAnchor.recordIndex=nAnchorRecordIndex;oAnchor.trIndex=nAnchorTrIndex;oAnchor.column=this._oAnchorCell.column;oAnchor.colKeyIndex=oAnchor.column.getKeyIndex();oAnchor.cell=oAnchorCell;return oAnchor}else{oAnchorRecord=this._oAnchorRecord;if(!oAnchorRecord){if(oTrigger){oAnchorRecord=this._oAnchorRecord=oTrigger.record}else{return null}}nAnchorRecordIndex=this.getRecordIndex(oAnchorRecord);nAnchorTrIndex=this.getTrIndex(oAnchorRecord);if(nAnchorTrIndex===null){if(nAnchorRecordIndex<this.getRecordIndex(this.getFirstTrEl())){nAnchorTrIndex=0}else{nAnchorTrIndex=this.getRecordIndex(this.getLastTrEl())}}oAnchor.record=oAnchorRecord;oAnchor.recordIndex=nAnchorRecordIndex;oAnchor.trIndex=nAnchorTrIndex;return oAnchor}},_handleStandardSelectionByMouse:function(oArgs){var elTarget=oArgs.target;var elTargetRow=this.getTrEl(elTarget);if(elTargetRow){var e=oArgs.event;var bSHIFT=e.shiftKey;var bCTRL=e.ctrlKey||navigator.userAgent.toLowerCase().indexOf("mac")!=-1&&e.metaKey;var oTargetRecord=this.getRecord(elTargetRow);var nTargetRecordIndex=this._oRecordSet.getRecordIndex(oTargetRecord);var oAnchor=this._getSelectionAnchor();var i;if(bSHIFT&&bCTRL){if(oAnchor){if(this.isSelected(oAnchor.record)){if(oAnchor.recordIndex<nTargetRecordIndex){for(i=oAnchor.recordIndex+1;i<=nTargetRecordIndex;i++){if(!this.isSelected(i)){this.selectRow(i)}}}else{for(i=oAnchor.recordIndex-1;i>=nTargetRecordIndex;i--){if(!this.isSelected(i)){this.selectRow(i)}}}}else{if(oAnchor.recordIndex<nTargetRecordIndex){for(i=oAnchor.recordIndex+1;i<=nTargetRecordIndex-1;i++){if(this.isSelected(i)){this.unselectRow(i)}}}else{for(i=nTargetRecordIndex+1;i<=oAnchor.recordIndex-1;i++){if(this.isSelected(i)){this.unselectRow(i)}}}this.selectRow(oTargetRecord)}}else{this._oAnchorRecord=oTargetRecord;if(this.isSelected(oTargetRecord)){this.unselectRow(oTargetRecord)}else{this.selectRow(oTargetRecord)}}}else if(bSHIFT){this.unselectAllRows();if(oAnchor){if(oAnchor.recordIndex<nTargetRecordIndex){for(i=oAnchor.recordIndex;i<=nTargetRecordIndex;i++){this.selectRow(i)}}else{for(i=oAnchor.recordIndex;i>=nTargetRecordIndex;i--){this.selectRow(i)}}}else{this._oAnchorRecord=oTargetRecord;this.selectRow(oTargetRecord)}}else if(bCTRL){this._oAnchorRecord=oTargetRecord;if(this.isSelected(oTargetRecord)){this.unselectRow(oTargetRecord)}else{this.selectRow(oTargetRecord)}}else{this._handleSingleSelectionByMouse(oArgs);return}}},_handleStandardSelectionByKey:function(e){var nKey=Ev.getCharCode(e);if(nKey==38||nKey==40){var bSHIFT=e.shiftKey;var oTrigger=this._getSelectionTrigger();if(!oTrigger){return null}Ev.stopEvent(e);var oAnchor=this._getSelectionAnchor(oTrigger);if(bSHIFT){if(nKey==40&&oAnchor.recordIndex<=oTrigger.trIndex){this.selectRow(this.getNextTrEl(oTrigger.el))}else if(nKey==38&&oAnchor.recordIndex>=oTrigger.trIndex){this.selectRow(this.getPreviousTrEl(oTrigger.el))}else{this.unselectRow(oTrigger.el)}}else{this._handleSingleSelectionByKey(e)}}},_handleSingleSelectionByMouse:function(oArgs){var elTarget=oArgs.target;var elTargetRow=this.getTrEl(elTarget);if(elTargetRow){var oTargetRecord=this.getRecord(elTargetRow);this._oAnchorRecord=oTargetRecord;this.unselectAllRows();this.selectRow(oTargetRecord)}},_handleSingleSelectionByKey:function(e){var nKey=Ev.getCharCode(e);if(nKey==38||nKey==40){var oTrigger=this._getSelectionTrigger();if(!oTrigger){return null}Ev.stopEvent(e);var elNew;if(nKey==38){elNew=this.getPreviousTrEl(oTrigger.el);if(elNew===null){elNew=this.getFirstTrEl()}}else if(nKey==40){elNew=this.getNextTrEl(oTrigger.el);if(elNew===null){elNew=this.getLastTrEl()}}this.unselectAllRows();this.selectRow(elNew);this._oAnchorRecord=this.getRecord(elNew)}},_handleCellBlockSelectionByMouse:function(oArgs){var elTarget=oArgs.target;var elTargetCell=this.getTdEl(elTarget);if(elTargetCell){var e=oArgs.event;var bSHIFT=e.shiftKey;var bCTRL=e.ctrlKey||navigator.userAgent.toLowerCase().indexOf("mac")!=-1&&e.metaKey;var elTargetRow=this.getTrEl(elTargetCell);var nTargetTrIndex=this.getTrIndex(elTargetRow);var oTargetColumn=this.getColumn(elTargetCell);var nTargetColKeyIndex=oTargetColumn.getKeyIndex();var oTargetRecord=this.getRecord(elTargetRow);var nTargetRecordIndex=this._oRecordSet.getRecordIndex(oTargetRecord);var oTargetCell={record:oTargetRecord,column:oTargetColumn};var oAnchor=this._getSelectionAnchor();var allRows=this.getTbodyEl().rows;var startIndex,endIndex,currentRow,i,j;if(bSHIFT&&bCTRL){if(oAnchor){if(this.isSelected(oAnchor.cell)){if(oAnchor.recordIndex===nTargetRecordIndex){if(oAnchor.colKeyIndex<nTargetColKeyIndex){for(i=oAnchor.colKeyIndex+1;i<=nTargetColKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}else if(nTargetColKeyIndex<oAnchor.colKeyIndex){for(i=nTargetColKeyIndex;i<oAnchor.colKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}}else if(oAnchor.recordIndex<nTargetRecordIndex){startIndex=Math.min(oAnchor.colKeyIndex,nTargetColKeyIndex);endIndex=Math.max(oAnchor.colKeyIndex,nTargetColKeyIndex);for(i=oAnchor.trIndex;i<=nTargetTrIndex;i++){for(j=startIndex;j<=endIndex;j++){this.selectCell(allRows[i].cells[j])}}}else{startIndex=Math.min(oAnchor.trIndex,nTargetColKeyIndex);endIndex=Math.max(oAnchor.trIndex,nTargetColKeyIndex);for(i=oAnchor.trIndex;i>=nTargetTrIndex;i--){for(j=endIndex;j>=startIndex;j--){this.selectCell(allRows[i].cells[j])}}}}else{if(oAnchor.recordIndex===nTargetRecordIndex){if(oAnchor.colKeyIndex<nTargetColKeyIndex){for(i=oAnchor.colKeyIndex+1;i<nTargetColKeyIndex;i++){this.unselectCell(elTargetRow.cells[i])}}else if(nTargetColKeyIndex<oAnchor.colKeyIndex){for(i=nTargetColKeyIndex+1;i<oAnchor.colKeyIndex;i++){this.unselectCell(elTargetRow.cells[i])}}}if(oAnchor.recordIndex<nTargetRecordIndex){for(i=oAnchor.trIndex;i<=nTargetTrIndex;i++){currentRow=allRows[i];for(j=0;j<currentRow.cells.length;j++){if(currentRow.sectionRowIndex===oAnchor.trIndex){if(j>oAnchor.colKeyIndex){this.unselectCell(currentRow.cells[j])}}else if(currentRow.sectionRowIndex===nTargetTrIndex){if(j<nTargetColKeyIndex){this.unselectCell(currentRow.cells[j])}}else{this.unselectCell(currentRow.cells[j])}}}}else{for(i=nTargetTrIndex;i<=oAnchor.trIndex;i++){currentRow=allRows[i];for(j=0;j<currentRow.cells.length;j++){if(currentRow.sectionRowIndex==nTargetTrIndex){if(j>nTargetColKeyIndex){this.unselectCell(currentRow.cells[j])}}else if(currentRow.sectionRowIndex==oAnchor.trIndex){if(j<oAnchor.colKeyIndex){this.unselectCell(currentRow.cells[j])}}else{this.unselectCell(currentRow.cells[j])}}}}this.selectCell(elTargetCell)}}else{this._oAnchorCell=oTargetCell;if(this.isSelected(oTargetCell)){this.unselectCell(oTargetCell)}else{this.selectCell(oTargetCell)}}}else if(bSHIFT){this.unselectAllCells();if(oAnchor){if(oAnchor.recordIndex===nTargetRecordIndex){if(oAnchor.colKeyIndex<nTargetColKeyIndex){for(i=oAnchor.colKeyIndex;i<=nTargetColKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}else if(nTargetColKeyIndex<oAnchor.colKeyIndex){for(i=nTargetColKeyIndex;i<=oAnchor.colKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}}else if(oAnchor.recordIndex<nTargetRecordIndex){startIndex=Math.min(oAnchor.colKeyIndex,nTargetColKeyIndex);endIndex=Math.max(oAnchor.colKeyIndex,nTargetColKeyIndex);for(i=oAnchor.trIndex;i<=nTargetTrIndex;i++){for(j=startIndex;j<=endIndex;j++){this.selectCell(allRows[i].cells[j])}}}else{startIndex=Math.min(oAnchor.colKeyIndex,nTargetColKeyIndex);endIndex=Math.max(oAnchor.colKeyIndex,nTargetColKeyIndex);for(i=nTargetTrIndex;i<=oAnchor.trIndex;i++){for(j=startIndex;j<=endIndex;j++){this.selectCell(allRows[i].cells[j])}}}}else{this._oAnchorCell=oTargetCell;this.selectCell(oTargetCell)}}else if(bCTRL){this._oAnchorCell=oTargetCell;if(this.isSelected(oTargetCell)){this.unselectCell(oTargetCell)}else{this.selectCell(oTargetCell)}}else{this._handleSingleCellSelectionByMouse(oArgs)}}},_handleCellBlockSelectionByKey:function(e){var nKey=Ev.getCharCode(e);var bSHIFT=e.shiftKey;if(nKey==9||!bSHIFT){this._handleSingleCellSelectionByKey(e);return}if(nKey>36&&nKey<41){var oTrigger=this._getSelectionTrigger();if(!oTrigger){return null}Ev.stopEvent(e);var oAnchor=this._getSelectionAnchor(oTrigger);var i,startIndex,endIndex,elNew,elNewRow;var allRows=this.getTbodyEl().rows;var elThisRow=oTrigger.el.parentNode;if(nKey==40){if(oAnchor.recordIndex<=oTrigger.recordIndex){elNewRow=this.getNextTrEl(oTrigger.el);if(elNewRow){startIndex=oAnchor.colKeyIndex;endIndex=oTrigger.colKeyIndex;if(startIndex>endIndex){for(i=startIndex;i>=endIndex;i--){elNew=elNewRow.cells[i];this.selectCell(elNew)}}else{for(i=startIndex;i<=endIndex;i++){elNew=elNewRow.cells[i];this.selectCell(elNew)}}}}else{startIndex=Math.min(oAnchor.colKeyIndex,oTrigger.colKeyIndex);endIndex=Math.max(oAnchor.colKeyIndex,oTrigger.colKeyIndex);for(i=startIndex;i<=endIndex;i++){this.unselectCell(elThisRow.cells[i])}}}else if(nKey==38){if(oAnchor.recordIndex>=oTrigger.recordIndex){elNewRow=this.getPreviousTrEl(oTrigger.el);if(elNewRow){startIndex=oAnchor.colKeyIndex;endIndex=oTrigger.colKeyIndex;if(startIndex>endIndex){for(i=startIndex;i>=endIndex;i--){elNew=elNewRow.cells[i];this.selectCell(elNew)}}else{for(i=startIndex;i<=endIndex;i++){elNew=elNewRow.cells[i];this.selectCell(elNew)}}}}else{startIndex=Math.min(oAnchor.colKeyIndex,oTrigger.colKeyIndex);endIndex=Math.max(oAnchor.colKeyIndex,oTrigger.colKeyIndex);for(i=startIndex;i<=endIndex;i++){this.unselectCell(elThisRow.cells[i])}}}else if(nKey==39){if(oAnchor.colKeyIndex<=oTrigger.colKeyIndex){if(oTrigger.colKeyIndex<elThisRow.cells.length-1){startIndex=oAnchor.trIndex;endIndex=oTrigger.trIndex;if(startIndex>endIndex){for(i=startIndex;i>=endIndex;i--){elNew=allRows[i].cells[oTrigger.colKeyIndex+1];this.selectCell(elNew)}}else{for(i=startIndex;i<=endIndex;i++){elNew=allRows[i].cells[oTrigger.colKeyIndex+1];this.selectCell(elNew)}}}}else{startIndex=Math.min(oAnchor.trIndex,oTrigger.trIndex);endIndex=Math.max(oAnchor.trIndex,oTrigger.trIndex);for(i=startIndex;i<=endIndex;i++){this.unselectCell(allRows[i].cells[oTrigger.colKeyIndex])}}}else if(nKey==37){if(oAnchor.colKeyIndex>=oTrigger.colKeyIndex){if(oTrigger.colKeyIndex>0){startIndex=oAnchor.trIndex;endIndex=oTrigger.trIndex;if(startIndex>endIndex){for(i=startIndex;i>=endIndex;i--){elNew=allRows[i].cells[oTrigger.colKeyIndex-1];this.selectCell(elNew)}}else{for(i=startIndex;i<=endIndex;i++){elNew=allRows[i].cells[oTrigger.colKeyIndex-1];this.selectCell(elNew)}}}}else{startIndex=Math.min(oAnchor.trIndex,oTrigger.trIndex);endIndex=Math.max(oAnchor.trIndex,oTrigger.trIndex);for(i=startIndex;i<=endIndex;i++){this.unselectCell(allRows[i].cells[oTrigger.colKeyIndex])}}}}},_handleCellRangeSelectionByMouse:function(oArgs){var elTarget=oArgs.target;var elTargetCell=this.getTdEl(elTarget);if(elTargetCell){var e=oArgs.event;var bSHIFT=e.shiftKey;var bCTRL=e.ctrlKey||navigator.userAgent.toLowerCase().indexOf("mac")!=-1&&e.metaKey;var elTargetRow=this.getTrEl(elTargetCell);var nTargetTrIndex=this.getTrIndex(elTargetRow);var oTargetColumn=this.getColumn(elTargetCell);var nTargetColKeyIndex=oTargetColumn.getKeyIndex();var oTargetRecord=this.getRecord(elTargetRow);var nTargetRecordIndex=this._oRecordSet.getRecordIndex(oTargetRecord);var oTargetCell={record:oTargetRecord,column:oTargetColumn};var oAnchor=this._getSelectionAnchor();var allRows=this.getTbodyEl().rows;var currentRow,i,j;if(bSHIFT&&bCTRL){if(oAnchor){if(this.isSelected(oAnchor.cell)){if(oAnchor.recordIndex===nTargetRecordIndex){if(oAnchor.colKeyIndex<nTargetColKeyIndex){for(i=oAnchor.colKeyIndex+1;i<=nTargetColKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}else if(nTargetColKeyIndex<oAnchor.colKeyIndex){for(i=nTargetColKeyIndex;i<oAnchor.colKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}}else if(oAnchor.recordIndex<nTargetRecordIndex){for(i=oAnchor.colKeyIndex+1;i<elTargetRow.cells.length;i++){this.selectCell(elTargetRow.cells[i])}for(i=oAnchor.trIndex+1;i<nTargetTrIndex;i++){for(j=0;j<allRows[i].cells.length;j++){this.selectCell(allRows[i].cells[j])}}for(i=0;i<=nTargetColKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}else{for(i=nTargetColKeyIndex;i<elTargetRow.cells.length;i++){this.selectCell(elTargetRow.cells[i])}for(i=nTargetTrIndex+1;i<oAnchor.trIndex;i++){for(j=0;j<allRows[i].cells.length;j++){this.selectCell(allRows[i].cells[j])}}for(i=0;i<oAnchor.colKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}}else{if(oAnchor.recordIndex===nTargetRecordIndex){if(oAnchor.colKeyIndex<nTargetColKeyIndex){for(i=oAnchor.colKeyIndex+1;i<nTargetColKeyIndex;i++){this.unselectCell(elTargetRow.cells[i])}}else if(nTargetColKeyIndex<oAnchor.colKeyIndex){for(i=nTargetColKeyIndex+1;i<oAnchor.colKeyIndex;i++){this.unselectCell(elTargetRow.cells[i])}}}if(oAnchor.recordIndex<nTargetRecordIndex){for(i=oAnchor.trIndex;i<=nTargetTrIndex;i++){currentRow=allRows[i];for(j=0;j<currentRow.cells.length;j++){if(currentRow.sectionRowIndex===oAnchor.trIndex){if(j>oAnchor.colKeyIndex){this.unselectCell(currentRow.cells[j])}}else if(currentRow.sectionRowIndex===nTargetTrIndex){if(j<nTargetColKeyIndex){this.unselectCell(currentRow.cells[j])}}else{this.unselectCell(currentRow.cells[j])}}}}else{for(i=nTargetTrIndex;i<=oAnchor.trIndex;i++){currentRow=allRows[i];for(j=0;j<currentRow.cells.length;j++){if(currentRow.sectionRowIndex==nTargetTrIndex){if(j>nTargetColKeyIndex){this.unselectCell(currentRow.cells[j])}}else if(currentRow.sectionRowIndex==oAnchor.trIndex){if(j<oAnchor.colKeyIndex){this.unselectCell(currentRow.cells[j])}}else{this.unselectCell(currentRow.cells[j])}}}}this.selectCell(elTargetCell)}}else{this._oAnchorCell=oTargetCell;if(this.isSelected(oTargetCell)){this.unselectCell(oTargetCell)}else{this.selectCell(oTargetCell)}}}else if(bSHIFT){this.unselectAllCells();if(oAnchor){if(oAnchor.recordIndex===nTargetRecordIndex){if(oAnchor.colKeyIndex<nTargetColKeyIndex){for(i=oAnchor.colKeyIndex;i<=nTargetColKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}else if(nTargetColKeyIndex<oAnchor.colKeyIndex){for(i=nTargetColKeyIndex;i<=oAnchor.colKeyIndex;i++){this.selectCell(elTargetRow.cells[i])}}}else if(oAnchor.recordIndex<nTargetRecordIndex){for(i=oAnchor.trIndex;i<=nTargetTrIndex;i++){currentRow=allRows[i];for(j=0;j<currentRow.cells.length;j++){if(currentRow.sectionRowIndex==oAnchor.trIndex){if(j>=oAnchor.colKeyIndex){this.selectCell(currentRow.cells[j])}}else if(currentRow.sectionRowIndex==nTargetTrIndex){if(j<=nTargetColKeyIndex){this.selectCell(currentRow.cells[j])}}else{this.selectCell(currentRow.cells[j])}}}}else{for(i=nTargetTrIndex;i<=oAnchor.trIndex;i++){currentRow=allRows[i];for(j=0;j<currentRow.cells.length;j++){if(currentRow.sectionRowIndex==nTargetTrIndex){if(j>=nTargetColKeyIndex){this.selectCell(currentRow.cells[j])}}else if(currentRow.sectionRowIndex==oAnchor.trIndex){if(j<=oAnchor.colKeyIndex){this.selectCell(currentRow.cells[j])}}else{this.selectCell(currentRow.cells[j])}}}}}else{this._oAnchorCell=oTargetCell;this.selectCell(oTargetCell)}}else if(bCTRL){this._oAnchorCell=oTargetCell;if(this.isSelected(oTargetCell)){this.unselectCell(oTargetCell)}else{this.selectCell(oTargetCell)}}else{this._handleSingleCellSelectionByMouse(oArgs)}}},_handleCellRangeSelectionByKey:function(e){var nKey=Ev.getCharCode(e);var bSHIFT=e.shiftKey;if(nKey==9||!bSHIFT){this._handleSingleCellSelectionByKey(e);return}if(nKey>36&&nKey<41){var oTrigger=this._getSelectionTrigger();if(!oTrigger){return null}Ev.stopEvent(e);var oAnchor=this._getSelectionAnchor(oTrigger);var i,elNewRow,elNew;var allRows=this.getTbodyEl().rows;var elThisRow=oTrigger.el.parentNode;if(nKey==40){elNewRow=this.getNextTrEl(oTrigger.el);if(oAnchor.recordIndex<=oTrigger.recordIndex){for(i=oTrigger.colKeyIndex+1;i<elThisRow.cells.length;i++){elNew=elThisRow.cells[i];this.selectCell(elNew)}if(elNewRow){for(i=0;i<=oTrigger.colKeyIndex;i++){elNew=elNewRow.cells[i];this.selectCell(elNew)}}}else{for(i=oTrigger.colKeyIndex;i<elThisRow.cells.length;i++){this.unselectCell(elThisRow.cells[i])}if(elNewRow){for(i=0;i<oTrigger.colKeyIndex;i++){this.unselectCell(elNewRow.cells[i])}}}}else if(nKey==38){elNewRow=this.getPreviousTrEl(oTrigger.el);if(oAnchor.recordIndex>=oTrigger.recordIndex){for(i=oTrigger.colKeyIndex-1;i>-1;i--){elNew=elThisRow.cells[i];this.selectCell(elNew)}if(elNewRow){for(i=elThisRow.cells.length-1;i>=oTrigger.colKeyIndex;i--){elNew=elNewRow.cells[i];this.selectCell(elNew)}}}else{for(i=oTrigger.colKeyIndex;i>-1;i--){this.unselectCell(elThisRow.cells[i])}if(elNewRow){for(i=elThisRow.cells.length-1;i>oTrigger.colKeyIndex;i--){this.unselectCell(elNewRow.cells[i])}}}}else if(nKey==39){elNewRow=this.getNextTrEl(oTrigger.el);if(oAnchor.recordIndex<oTrigger.recordIndex){if(oTrigger.colKeyIndex<elThisRow.cells.length-1){elNew=elThisRow.cells[oTrigger.colKeyIndex+1];this.selectCell(elNew)}else if(elNewRow){elNew=elNewRow.cells[0];this.selectCell(elNew)}}else if(oAnchor.recordIndex>oTrigger.recordIndex){this.unselectCell(elThisRow.cells[oTrigger.colKeyIndex]);if(oTrigger.colKeyIndex<elThisRow.cells.length-1){}else{}}else{if(oAnchor.colKeyIndex<=oTrigger.colKeyIndex){if(oTrigger.colKeyIndex<elThisRow.cells.length-1){elNew=elThisRow.cells[oTrigger.colKeyIndex+1];this.selectCell(elNew)}else if(oTrigger.trIndex<allRows.length-1){elNew=elNewRow.cells[0];this.selectCell(elNew)}}else{this.unselectCell(elThisRow.cells[oTrigger.colKeyIndex])}}}else if(nKey==37){elNewRow=this.getPreviousTrEl(oTrigger.el);if(oAnchor.recordIndex<oTrigger.recordIndex){this.unselectCell(elThisRow.cells[oTrigger.colKeyIndex]);if(oTrigger.colKeyIndex>0){}else{}}else if(oAnchor.recordIndex>oTrigger.recordIndex){if(oTrigger.colKeyIndex>0){elNew=elThisRow.cells[oTrigger.colKeyIndex-1];this.selectCell(elNew)}else if(oTrigger.trIndex>0){elNew=elNewRow.cells[elNewRow.cells.length-1];this.selectCell(elNew)}}else{if(oAnchor.colKeyIndex>=oTrigger.colKeyIndex){if(oTrigger.colKeyIndex>0){elNew=elThisRow.cells[oTrigger.colKeyIndex-1];this.selectCell(elNew)}else if(oTrigger.trIndex>0){elNew=elNewRow.cells[elNewRow.cells.length-1];this.selectCell(elNew)}}else{this.unselectCell(elThisRow.cells[oTrigger.colKeyIndex]);if(oTrigger.colKeyIndex>0){}else{}}}}}},_handleSingleCellSelectionByMouse:function(oArgs){var elTarget=oArgs.target;var elTargetCell=this.getTdEl(elTarget);if(elTargetCell){var elTargetRow=this.getTrEl(elTargetCell);var oTargetRecord=this.getRecord(elTargetRow);var oTargetColumn=this.getColumn(elTargetCell);var oTargetCell={record:oTargetRecord,column:oTargetColumn};this._oAnchorCell=oTargetCell;this.unselectAllCells();this.selectCell(oTargetCell)}},_handleSingleCellSelectionByKey:function(e){var nKey=Ev.getCharCode(e);if(nKey==9||nKey>36&&nKey<41){var bSHIFT=e.shiftKey;var oTrigger=this._getSelectionTrigger();if(!oTrigger){return null}var elNew;if(nKey==40){elNew=this.getBelowTdEl(oTrigger.el);if(elNew===null){elNew=oTrigger.el}}else if(nKey==38){elNew=this.getAboveTdEl(oTrigger.el);if(elNew===null){elNew=oTrigger.el}}else if(nKey==39||!bSHIFT&&nKey==9){elNew=this.getNextTdEl(oTrigger.el);if(elNew===null){return}}else if(nKey==37||bSHIFT&&nKey==9){elNew=this.getPreviousTdEl(oTrigger.el);if(elNew===null){return}}Ev.stopEvent(e);this.unselectAllCells();this.selectCell(elNew);this._oAnchorCell={record:this.getRecord(elNew),column:this.getColumn(elNew)}}},getSelectedTrEls:function(){return Dom.getElementsByClassName(DT.CLASS_SELECTED,"tr",this._elTbody)},selectRow:function(row){var oRecord,elRow;if(row instanceof YAHOO.widget.Record){oRecord=this._oRecordSet.getRecord(row);elRow=this.getTrEl(oRecord)}else if(lang.isNumber(row)){oRecord=this.getRecord(row);elRow=this.getTrEl(oRecord)}else{elRow=this.getTrEl(row);oRecord=this.getRecord(elRow)}if(oRecord){var tracker=this._aSelections||[];var sRecordId=oRecord.getId();var index=-1;if(tracker.indexOf){index=tracker.indexOf(sRecordId)}else{for(var j=tracker.length-1;j>-1;j--){if(tracker[j]===sRecordId){index=j;break}}}if(index>-1){tracker.splice(index,1)}tracker.push(sRecordId);this._aSelections=tracker;if(!this._oAnchorRecord){this._oAnchorRecord=oRecord}if(elRow){Dom.addClass(elRow,DT.CLASS_SELECTED)}this.fireEvent("rowSelectEvent",{record:oRecord,el:elRow})}else{}},unselectRow:function(row){var elRow=this.getTrEl(row);var oRecord;if(row instanceof YAHOO.widget.Record){oRecord=this._oRecordSet.getRecord(row)}else if(lang.isNumber(row)){oRecord=this.getRecord(row)}else{oRecord=this.getRecord(elRow)}if(oRecord){var tracker=this._aSelections||[];var sRecordId=oRecord.getId();var index=-1;if(tracker.indexOf){index=tracker.indexOf(sRecordId)}else{for(var j=tracker.length-1;j>-1;j--){if(tracker[j]===sRecordId){index=j;break}}}if(index>-1){tracker.splice(index,1);this._aSelections=tracker;Dom.removeClass(elRow,DT.CLASS_SELECTED);this.fireEvent("rowUnselectEvent",{record:oRecord,el:elRow});return}}},unselectAllRows:function(){var tracker=this._aSelections||[],recId,removed=[];for(var j=tracker.length-1;j>-1;j--){if(lang.isString(tracker[j])){recId=tracker.splice(j,1);removed[removed.length]=this.getRecord(lang.isArray(recId)?recId[0]:recId)}}this._aSelections=tracker;this._unselectAllTrEls();this.fireEvent("unselectAllRowsEvent",{records:removed})},_unselectAllTdEls:function(){var selectedCells=Dom.getElementsByClassName(DT.CLASS_SELECTED,"td",this._elTbody);Dom.removeClass(selectedCells,DT.CLASS_SELECTED)},getSelectedTdEls:function(){return Dom.getElementsByClassName(DT.CLASS_SELECTED,"td",this._elTbody)},selectCell:function(cell){var elCell=this.getTdEl(cell);if(elCell){var oRecord=this.getRecord(elCell);var oColumn=this.getColumn(this.getCellIndex(elCell));var sColumnKey=oColumn.getKey();if(oRecord&&sColumnKey){var tracker=this._aSelections||[];var sRecordId=oRecord.getId();for(var j=tracker.length-1;j>-1;j--){if(tracker[j].recordId===sRecordId&&tracker[j].columnKey===sColumnKey){tracker.splice(j,1);break}}tracker.push({recordId:sRecordId,columnKey:sColumnKey});this._aSelections=tracker;if(!this._oAnchorCell){this._oAnchorCell={record:oRecord,column:oColumn}}Dom.addClass(elCell,DT.CLASS_SELECTED);this.fireEvent("cellSelectEvent",{record:oRecord,column:oColumn,key:sColumnKey,el:elCell});return}}},unselectCell:function(cell){var elCell=this.getTdEl(cell);if(elCell){var oRecord=this.getRecord(elCell);var oColumn=this.getColumn(this.getCellIndex(elCell));var sColumnKey=oColumn.getKey();if(oRecord&&sColumnKey){var tracker=this._aSelections||[];var id=oRecord.getId();for(var j=tracker.length-1;j>-1;j--){if(tracker[j].recordId===id&&tracker[j].columnKey===sColumnKey){tracker.splice(j,1);this._aSelections=tracker;Dom.removeClass(elCell,DT.CLASS_SELECTED);this.fireEvent("cellUnselectEvent",{record:oRecord,column:oColumn,key:sColumnKey,el:elCell});return}}}}},unselectAllCells:function(){var tracker=this._aSelections||[];for(var j=tracker.length-1;j>-1;j--){if(lang.isObject(tracker[j])){tracker.splice(j,1)}}this._aSelections=tracker;this._unselectAllTdEls();this.fireEvent("unselectAllCellsEvent")},isSelected:function(o){if(o&&o.ownerDocument==document){return Dom.hasClass(this.getTdEl(o),DT.CLASS_SELECTED)||Dom.hasClass(this.getTrEl(o),DT.CLASS_SELECTED)}else{var oRecord,sRecordId,j;var tracker=this._aSelections;if(tracker&&tracker.length>0){if(o instanceof YAHOO.widget.Record){oRecord=o}else if(lang.isNumber(o)){oRecord=this.getRecord(o)}if(oRecord){sRecordId=oRecord.getId();if(tracker.indexOf){if(tracker.indexOf(sRecordId)>-1){return true}}else{for(j=tracker.length-1;j>-1;j--){if(tracker[j]===sRecordId){return true}}}}else if(o.record&&o.column){sRecordId=o.record.getId();var sColumnKey=o.column.getKey();for(j=tracker.length-1;j>-1;j--){if(tracker[j].recordId===sRecordId&&tracker[j].columnKey===sColumnKey){return true}}}}}return false},getSelectedRows:function(){var aSelectedRows=[];var tracker=this._aSelections||[];for(var j=0;j<tracker.length;j++){if(lang.isString(tracker[j])){aSelectedRows.push(tracker[j])}}return aSelectedRows},getSelectedCells:function(){var aSelectedCells=[];var tracker=this._aSelections||[];for(var j=0;j<tracker.length;j++){if(tracker[j]&&lang.isObject(tracker[j])){aSelectedCells.push(tracker[j])}}return aSelectedCells},getLastSelectedRecord:function(){var tracker=this._aSelections;if(tracker&&tracker.length>0){for(var i=tracker.length-1;i>-1;i--){if(lang.isString(tracker[i])){return tracker[i]}}}},getLastSelectedCell:function(){var tracker=this._aSelections;if(tracker&&tracker.length>0){for(var i=tracker.length-1;i>-1;i--){if(tracker[i].recordId&&tracker[i].columnKey){return tracker[i]}}}},highlightRow:function(row){var elRow=this.getTrEl(row);if(elRow){var oRecord=this.getRecord(elRow);Dom.addClass(elRow,DT.CLASS_HIGHLIGHTED);this.fireEvent("rowHighlightEvent",{record:oRecord,el:elRow});return}},unhighlightRow:function(row){var elRow=this.getTrEl(row);if(elRow){var oRecord=this.getRecord(elRow);Dom.removeClass(elRow,DT.CLASS_HIGHLIGHTED);this.fireEvent("rowUnhighlightEvent",{record:oRecord,el:elRow});return}},highlightCell:function(cell){var elCell=this.getTdEl(cell);if(elCell){if(this._elLastHighlightedTd){this.unhighlightCell(this._elLastHighlightedTd)}var oRecord=this.getRecord(elCell);var oColumn=this.getColumn(this.getCellIndex(elCell));var sColumnKey=oColumn.getKey();Dom.addClass(elCell,DT.CLASS_HIGHLIGHTED);this._elLastHighlightedTd=elCell;this.fireEvent("cellHighlightEvent",{record:oRecord,column:oColumn,key:sColumnKey,el:elCell});return}},unhighlightCell:function(cell){var elCell=this.getTdEl(cell);if(elCell){var oRecord=this.getRecord(elCell);Dom.removeClass(elCell,DT.CLASS_HIGHLIGHTED);this._elLastHighlightedTd=null;this.fireEvent("cellUnhighlightEvent",{record:oRecord,column:this.getColumn(this.getCellIndex(elCell)),key:this.getColumn(this.getCellIndex(elCell)).getKey(),el:elCell});return}},addCellEditor:function(oColumn,oEditor){oColumn.editor=oEditor;oColumn.editor.subscribe("showEvent",this._onEditorShowEvent,this,true);oColumn.editor.subscribe("keydownEvent",this._onEditorKeydownEvent,this,true);oColumn.editor.subscribe("revertEvent",this._onEditorRevertEvent,this,true);oColumn.editor.subscribe("saveEvent",this._onEditorSaveEvent,this,true);oColumn.editor.subscribe("cancelEvent",this._onEditorCancelEvent,this,true);oColumn.editor.subscribe("blurEvent",this._onEditorBlurEvent,this,true);oColumn.editor.subscribe("blockEvent",this._onEditorBlockEvent,this,true);oColumn.editor.subscribe("unblockEvent",this._onEditorUnblockEvent,this,true)},getCellEditor:function(){return this._oCellEditor},showCellEditor:function(elCell,oRecord,oColumn){elCell=this.getTdEl(elCell);if(elCell){oColumn=this.getColumn(elCell);if(oColumn&&oColumn.editor){var oCellEditor=this._oCellEditor;if(oCellEditor){if(this._oCellEditor.cancel){this._oCellEditor.cancel()}else if(oCellEditor.isActive){this.cancelCellEditor()}}if(oColumn.editor instanceof YAHOO.widget.BaseCellEditor){oCellEditor=oColumn.editor;var ok=oCellEditor.attach(this,elCell);if(ok){oCellEditor.render();oCellEditor.move();ok=this.doBeforeShowCellEditor(oCellEditor);if(ok){oCellEditor.show();this._oCellEditor=oCellEditor}}}else{if(!oRecord||!(oRecord instanceof YAHOO.widget.Record)){oRecord=this.getRecord(elCell)}if(!oColumn||!(oColumn instanceof YAHOO.widget.Column)){oColumn=this.getColumn(elCell)}if(oRecord&&oColumn){if(!this._oCellEditor||this._oCellEditor.container){this._initCellEditorEl()}oCellEditor=this._oCellEditor;oCellEditor.cell=elCell;oCellEditor.record=oRecord;oCellEditor.column=oColumn;oCellEditor.validator=oColumn.editorOptions&&lang.isFunction(oColumn.editorOptions.validator)?oColumn.editorOptions.validator:null;oCellEditor.value=oRecord.getData(oColumn.key);oCellEditor.defaultValue=null;var elContainer=oCellEditor.container;var x=Dom.getX(elCell);var y=Dom.getY(elCell);if(isNaN(x)||isNaN(y)){x=elCell.offsetLeft+Dom.getX(this._elTbody.parentNode)-this._elTbody.scrollLeft;y=elCell.offsetTop+Dom.getY(this._elTbody.parentNode)-this._elTbody.scrollTop+this._elThead.offsetHeight}elContainer.style.left=x+"px";elContainer.style.top=y+"px";this.doBeforeShowCellEditor(this._oCellEditor);elContainer.style.display="";Ev.addListener(elContainer,"keydown",(function(e,oSelf){if(e.keyCode==27){oSelf.cancelCellEditor();oSelf.focusTbodyEl()}else{oSelf.fireEvent("editorKeydownEvent",{editor:oSelf._oCellEditor,event:e})}}),this);var fnEditor;if(lang.isString(oColumn.editor)){switch(oColumn.editor){case"checkbox":fnEditor=DT.editCheckbox;break;case"date":fnEditor=DT.editDate;break;case"dropdown":fnEditor=DT.editDropdown;break;case"radio":fnEditor=DT.editRadio;break;case"textarea":fnEditor=DT.editTextarea;break;case"textbox":fnEditor=DT.editTextbox;break;default:fnEditor=null}}else if(lang.isFunction(oColumn.editor)){fnEditor=oColumn.editor}if(fnEditor){fnEditor(this._oCellEditor,this);if(!oColumn.editorOptions||!oColumn.editorOptions.disableBtns){this.showCellEditorBtns(elContainer)}oCellEditor.isActive=true;this.fireEvent("editorShowEvent",{editor:oCellEditor});return}}}}}},_initCellEditorEl:function(){var elCellEditor=document.createElement("div");elCellEditor.id=this._sId+"-celleditor";elCellEditor.style.display="none";elCellEditor.tabIndex=0;Dom.addClass(elCellEditor,DT.CLASS_EDITOR);var elFirstChild=Dom.getFirstChild(document.body);if(elFirstChild){elCellEditor=Dom.insertBefore(elCellEditor,elFirstChild)}else{elCellEditor=document.body.appendChild(elCellEditor)}var oCellEditor={};oCellEditor.container=elCellEditor;oCellEditor.value=null;oCellEditor.isActive=false;this._oCellEditor=oCellEditor},doBeforeShowCellEditor:function(oCellEditor){return true},saveCellEditor:function(){if(this._oCellEditor){if(this._oCellEditor.save){this._oCellEditor.save()}else if(this._oCellEditor.isActive){var newData=this._oCellEditor.value;var oldData=this._oCellEditor.record.getData(this._oCellEditor.column.key);if(this._oCellEditor.validator){newData=this._oCellEditor.value=this._oCellEditor.validator.call(this,newData,oldData,this._oCellEditor);if(newData===null){this.resetCellEditor();this.fireEvent("editorRevertEvent",{editor:this._oCellEditor,oldData:oldData,newData:newData});return}}this._oRecordSet.updateRecordValue(this._oCellEditor.record,this._oCellEditor.column.key,this._oCellEditor.value);this.formatCell(this._oCellEditor.cell.firstChild,this._oCellEditor.record,this._oCellEditor.column);this._oChainRender.add({method:function(){this.validateColumnWidths()},scope:this});this._oChainRender.run();this.resetCellEditor();this.fireEvent("editorSaveEvent",{editor:this._oCellEditor,oldData:oldData,newData:newData})}}},cancelCellEditor:function(){if(this._oCellEditor){if(this._oCellEditor.cancel){this._oCellEditor.cancel()}else if(this._oCellEditor.isActive){this.resetCellEditor();this.fireEvent("editorCancelEvent",{editor:this._oCellEditor})}}},destroyCellEditor:function(){if(this._oCellEditor){this._oCellEditor.destroy();this._oCellEditor=null}},_onEditorShowEvent:function(oArgs){this.fireEvent("editorShowEvent",oArgs)},_onEditorKeydownEvent:function(oArgs){this.fireEvent("editorKeydownEvent",oArgs)},_onEditorRevertEvent:function(oArgs){this.fireEvent("editorRevertEvent",oArgs)},_onEditorSaveEvent:function(oArgs){this.fireEvent("editorSaveEvent",oArgs)},_onEditorCancelEvent:function(oArgs){this.fireEvent("editorCancelEvent",oArgs)},_onEditorBlurEvent:function(oArgs){this.fireEvent("editorBlurEvent",oArgs)},_onEditorBlockEvent:function(oArgs){this.fireEvent("editorBlockEvent",oArgs)},_onEditorUnblockEvent:function(oArgs){this.fireEvent("editorUnblockEvent",oArgs)},onEditorBlurEvent:function(oArgs){if(oArgs.editor.disableBtns){if(oArgs.editor.save){oArgs.editor.save()}}else if(oArgs.editor.cancel){oArgs.editor.cancel()}},onEditorBlockEvent:function(oArgs){this.disable()},onEditorUnblockEvent:function(oArgs){this.undisable()},doBeforeLoadData:function(sRequest,oResponse,oPayload){return true},onEventSortColumn:function(oArgs){var evt=oArgs.event;var target=oArgs.target;var el=this.getThEl(target)||this.getTdEl(target);if(el){var oColumn=this.getColumn(el);if(oColumn.sortable){Ev.stopEvent(evt);this.sortColumn(oColumn)}}else{}},onEventSelectColumn:function(oArgs){this.selectColumn(oArgs.target)},onEventHighlightColumn:function(oArgs){this.highlightColumn(oArgs.target)},onEventUnhighlightColumn:function(oArgs){this.unhighlightColumn(oArgs.target)},onEventSelectRow:function(oArgs){var sMode=this.get("selectionMode");if(sMode=="single"){this._handleSingleSelectionByMouse(oArgs)}else{this._handleStandardSelectionByMouse(oArgs)}},onEventSelectCell:function(oArgs){var sMode=this.get("selectionMode");if(sMode=="cellblock"){this._handleCellBlockSelectionByMouse(oArgs)}else if(sMode=="cellrange"){this._handleCellRangeSelectionByMouse(oArgs)}else{this._handleSingleCellSelectionByMouse(oArgs)}},onEventHighlightRow:function(oArgs){this.highlightRow(oArgs.target)},onEventUnhighlightRow:function(oArgs){this.unhighlightRow(oArgs.target)},onEventHighlightCell:function(oArgs){this.highlightCell(oArgs.target)},onEventUnhighlightCell:function(oArgs){this.unhighlightCell(oArgs.target)},onEventFormatCell:function(oArgs){var target=oArgs.target;var elCell=this.getTdEl(target);if(elCell){var oColumn=this.getColumn(this.getCellIndex(elCell));this.formatCell(elCell.firstChild,this.getRecord(elCell),oColumn)}else{}},onEventShowCellEditor:function(oArgs){if(!this.isDisabled()){this.showCellEditor(oArgs.target)}},onEventSaveCellEditor:function(oArgs){if(this._oCellEditor){if(this._oCellEditor.save){this._oCellEditor.save()}else{this.saveCellEditor()}}},onEventCancelCellEditor:function(oArgs){if(this._oCellEditor){if(this._oCellEditor.cancel){this._oCellEditor.cancel()}else{this.cancelCellEditor()}}},onDataReturnInitializeTable:function(sRequest,oResponse,oPayload){if(this instanceof DT&&this._sId){this.initializeTable();this.onDataReturnSetRows(sRequest,oResponse,oPayload)}},onDataReturnReplaceRows:function(oRequest,oResponse,oPayload){if(this instanceof DT&&this._sId){this.fireEvent("dataReturnEvent",{request:oRequest,response:oResponse,payload:oPayload});var ok=this.doBeforeLoadData(oRequest,oResponse,oPayload),pag=this.get("paginator"),index=0;if(ok&&oResponse&&!oResponse.error&&lang.isArray(oResponse.results)){this._oRecordSet.reset();if(this.get("dynamicData")){if(oPayload&&oPayload.pagination&&lang.isNumber(oPayload.pagination.recordOffset)){index=oPayload.pagination.recordOffset}else if(pag){index=pag.getStartIndex()}}this._oRecordSet.setRecords(oResponse.results,index|0);this._handleDataReturnPayload(oRequest,oResponse,oPayload);this.render()}else if(ok&&oResponse.error){this.showTableMessage(this.get("MSG_ERROR"),DT.CLASS_ERROR)}}},onDataReturnAppendRows:function(sRequest,oResponse,oPayload){if(this instanceof DT&&this._sId){this.fireEvent("dataReturnEvent",{request:sRequest,response:oResponse,payload:oPayload});var ok=this.doBeforeLoadData(sRequest,oResponse,oPayload);if(ok&&oResponse&&!oResponse.error&&lang.isArray(oResponse.results)){this.addRows(oResponse.results);this._handleDataReturnPayload(sRequest,oResponse,oPayload)}else if(ok&&oResponse.error){this.showTableMessage(this.get("MSG_ERROR"),DT.CLASS_ERROR)}}},onDataReturnInsertRows:function(sRequest,oResponse,oPayload){if(this instanceof DT&&this._sId){this.fireEvent("dataReturnEvent",{request:sRequest,response:oResponse,payload:oPayload});var ok=this.doBeforeLoadData(sRequest,oResponse,oPayload);if(ok&&oResponse&&!oResponse.error&&lang.isArray(oResponse.results)){this.addRows(oResponse.results,oPayload?oPayload.insertIndex:0);this._handleDataReturnPayload(sRequest,oResponse,oPayload)}else if(ok&&oResponse.error){this.showTableMessage(this.get("MSG_ERROR"),DT.CLASS_ERROR)}}},onDataReturnUpdateRows:function(sRequest,oResponse,oPayload){if(this instanceof DT&&this._sId){this.fireEvent("dataReturnEvent",{request:sRequest,response:oResponse,payload:oPayload});var ok=this.doBeforeLoadData(sRequest,oResponse,oPayload);if(ok&&oResponse&&!oResponse.error&&lang.isArray(oResponse.results)){this.updateRows(oPayload?oPayload.updateIndex:0,oResponse.results);this._handleDataReturnPayload(sRequest,oResponse,oPayload)}else if(ok&&oResponse.error){this.showTableMessage(this.get("MSG_ERROR"),DT.CLASS_ERROR)}}},onDataReturnSetRows:function(oRequest,oResponse,oPayload){if(this instanceof DT&&this._sId){this.fireEvent("dataReturnEvent",{request:oRequest,response:oResponse,payload:oPayload});var ok=this.doBeforeLoadData(oRequest,oResponse,oPayload),pag=this.get("paginator"),index=0;if(ok&&oResponse&&!oResponse.error&&lang.isArray(oResponse.results)){if(this.get("dynamicData")){if(oPayload&&oPayload.pagination&&lang.isNumber(oPayload.pagination.recordOffset)){index=oPayload.pagination.recordOffset}else if(pag){index=pag.getStartIndex()}this._oRecordSet.reset()}this._oRecordSet.setRecords(oResponse.results,index|0);this._handleDataReturnPayload(oRequest,oResponse,oPayload);this.render()}else if(ok&&oResponse.error){this.showTableMessage(this.get("MSG_ERROR"),DT.CLASS_ERROR)}}else{}},handleDataReturnPayload:function(oRequest,oResponse,oPayload){return oPayload||{}},_handleDataReturnPayload:function(oRequest,oResponse,oPayload){oPayload=this.handleDataReturnPayload(oRequest,oResponse,oPayload);if(oPayload){var oPaginator=this.get("paginator");if(oPaginator){if(this.get("dynamicData")){if(widget.Paginator.isNumeric(oPayload.totalRecords)){oPaginator.set("totalRecords",oPayload.totalRecords)}}else{oPaginator.set("totalRecords",this._oRecordSet.getLength())}if(lang.isObject(oPayload.pagination)){oPaginator.set("rowsPerPage",oPayload.pagination.rowsPerPage);oPaginator.set("recordOffset",oPayload.pagination.recordOffset)}}if(oPayload.sortedBy){this.set("sortedBy",oPayload.sortedBy)}else if(oPayload.sorting){this.set("sortedBy",oPayload.sorting)}}},showCellEditorBtns:function(elContainer){var elBtnsDiv=elContainer.appendChild(document.createElement("div"));Dom.addClass(elBtnsDiv,DT.CLASS_BUTTON);var elSaveBtn=elBtnsDiv.appendChild(document.createElement("button"));Dom.addClass(elSaveBtn,DT.CLASS_DEFAULT);elSaveBtn.innerHTML="OK";Ev.addListener(elSaveBtn,"click",(function(oArgs,oSelf){oSelf.onEventSaveCellEditor(oArgs,oSelf);oSelf.focusTbodyEl()}),this,true);var elCancelBtn=elBtnsDiv.appendChild(document.createElement("button"));elCancelBtn.innerHTML="Cancel";Ev.addListener(elCancelBtn,"click",(function(oArgs,oSelf){oSelf.onEventCancelCellEditor(oArgs,oSelf);oSelf.focusTbodyEl()}),this,true)},resetCellEditor:function(){var elContainer=this._oCellEditor.container;elContainer.style.display="none";Ev.purgeElement(elContainer,true);elContainer.innerHTML="";this._oCellEditor.value=null;this._oCellEditor.isActive=false},getBody:function(){return this.getTbodyEl()},getCell:function(index){return this.getTdEl(index)},getRow:function(index){return this.getTrEl(index)},refreshView:function(){this.render()},select:function(els){if(!lang.isArray(els)){els=[els]}for(var i=0;i<els.length;i++){this.selectRow(els[i])}},onEventEditCell:function(oArgs){this.onEventShowCellEditor(oArgs)},_syncColWidths:function(){this.validateColumnWidths()}});DT.prototype.onDataReturnSetRecords=DT.prototype.onDataReturnSetRows;DT.prototype.onPaginatorChange=DT.prototype.onPaginatorChangeRequest;DT.editCheckbox=function(){};DT.editDate=function(){};DT.editDropdown=function(){};DT.editRadio=function(){};DT.editTextarea=function(){};DT.editTextbox=function(){}})();(function(){var lang=YAHOO.lang,util=YAHOO.util,widget=YAHOO.widget,ua=YAHOO.env.ua,Dom=util.Dom,Ev=util.Event,DS=util.DataSourceBase,DT=widget.DataTable,Pag=widget.Paginator;widget.ScrollingDataTable=function(elContainer,aColumnDefs,oDataSource,oConfigs){oConfigs=oConfigs||{};if(oConfigs.scrollable){oConfigs.scrollable=false}this._init();widget.ScrollingDataTable.superclass.constructor.call(this,elContainer,aColumnDefs,oDataSource,oConfigs);this.subscribe("columnShowEvent",this._onColumnChange)};var SDT=widget.ScrollingDataTable;lang.augmentObject(SDT,{CLASS_HEADER:"yui-dt-hd",CLASS_BODY:"yui-dt-bd"});lang.extend(SDT,DT,{_elHdContainer:null,_elHdTable:null,_elBdContainer:null,_elBdThead:null,_elTmpContainer:null,_elTmpTable:null,_bScrollbarX:null,initAttributes:function(oConfigs){oConfigs=oConfigs||{};SDT.superclass.initAttributes.call(this,oConfigs);this.setAttributeConfig("width",{value:null,validator:lang.isString,method:function(oParam){if(this._elHdContainer&&this._elBdContainer){this._elHdContainer.style.width=oParam;this._elBdContainer.style.width=oParam;this._syncScrollX();this._syncScrollOverhang()}}});this.setAttributeConfig("height",{value:null,validator:lang.isString,method:function(oParam){if(this._elHdContainer&&this._elBdContainer){this._elBdContainer.style.height=oParam;this._syncScrollX();this._syncScrollY();this._syncScrollOverhang()}}});this.setAttributeConfig("COLOR_COLUMNFILLER",{value:"#F2F2F2",validator:lang.isString,method:function(oParam){if(this._elHdContainer){this._elHdContainer.style.backgroundColor=oParam}}})},_init:function(){this._elHdContainer=null;this._elHdTable=null;this._elBdContainer=null;this._elBdThead=null;this._elTmpContainer=null;this._elTmpTable=null},_initDomElements:function(elContainer){this._initContainerEl(elContainer);if(this._elContainer&&this._elHdContainer&&this._elBdContainer){this._initTableEl();if(this._elHdTable&&this._elTable){this._initColgroupEl(this._elHdTable);this._initTheadEl(this._elHdTable,this._elTable);this._initTbodyEl(this._elTable);this._initMsgTbodyEl(this._elTable)}}if(!this._elContainer||!this._elTable||!this._elColgroup||!this._elThead||!this._elTbody||!this._elMsgTbody||!this._elHdTable||!this._elBdThead){return false}else{return true}},_destroyContainerEl:function(elContainer){Dom.removeClass(elContainer,DT.CLASS_SCROLLABLE);SDT.superclass._destroyContainerEl.call(this,elContainer);this._elHdContainer=null;this._elBdContainer=null},_initContainerEl:function(elContainer){SDT.superclass._initContainerEl.call(this,elContainer);if(this._elContainer){elContainer=this._elContainer;Dom.addClass(elContainer,DT.CLASS_SCROLLABLE);var elHdContainer=document.createElement("div");elHdContainer.style.width=this.get("width")||"";elHdContainer.style.backgroundColor=this.get("COLOR_COLUMNFILLER");Dom.addClass(elHdContainer,SDT.CLASS_HEADER);this._elHdContainer=elHdContainer;elContainer.appendChild(elHdContainer);var elBdContainer=document.createElement("div");elBdContainer.style.width=this.get("width")||"";elBdContainer.style.height=this.get("height")||"";Dom.addClass(elBdContainer,SDT.CLASS_BODY);Ev.addListener(elBdContainer,"scroll",this._onScroll,this);this._elBdContainer=elBdContainer;elContainer.appendChild(elBdContainer)}},_initCaptionEl:function(sCaption){},_destroyHdTableEl:function(){var elTable=this._elHdTable;if(elTable){Ev.purgeElement(elTable,true);elTable.parentNode.removeChild(elTable);this._elBdThead=null}},_initTableEl:function(){if(this._elHdContainer){this._destroyHdTableEl();this._elHdTable=this._elHdContainer.appendChild(document.createElement("table"));Ev.delegate(this._elHdTable,"mouseenter",this._onTableMouseover,"thead ."+DT.CLASS_LABEL,this);Ev.delegate(this._elHdTable,"mouseleave",this._onTableMouseout,"thead ."+DT.CLASS_LABEL,this)}SDT.superclass._initTableEl.call(this,this._elBdContainer)},_initTheadEl:function(elHdTable,elTable){elHdTable=elHdTable||this._elHdTable;elTable=elTable||this._elTable;this._initBdTheadEl(elTable);SDT.superclass._initTheadEl.call(this,elHdTable)},_initThEl:function(elTh,oColumn){SDT.superclass._initThEl.call(this,elTh,oColumn);elTh.id=this.getId()+"-fixedth-"+oColumn.getSanitizedKey()},_destroyBdTheadEl:function(){var elBdThead=this._elBdThead;if(elBdThead){var elTable=elBdThead.parentNode;Ev.purgeElement(elBdThead,true);elTable.removeChild(elBdThead);this._elBdThead=null;this._destroyColumnHelpers()}},_initBdTheadEl:function(elTable){if(elTable){this._destroyBdTheadEl();var elThead=elTable.insertBefore(document.createElement("thead"),elTable.firstChild);var oColumnSet=this._oColumnSet,colTree=oColumnSet.tree,elTh,elTheadTr,oColumn,i,j,k,len;for(i=0,k=colTree.length;i<k;i++){elTheadTr=elThead.appendChild(document.createElement("tr"));for(j=0,len=colTree[i].length;j<len;j++){oColumn=colTree[i][j];elTh=elTheadTr.appendChild(document.createElement("th"));this._initBdThEl(elTh,oColumn,i,j)}}this._elBdThead=elThead}},_initBdThEl:function(elTh,oColumn){elTh.id=this.getId()+"-th-"+oColumn.getSanitizedKey();elTh.rowSpan=oColumn.getRowspan();elTh.colSpan=oColumn.getColspan();if(oColumn.abbr){elTh.abbr=oColumn.abbr}var sKey=oColumn.getKey();var sLabel=lang.isValue(oColumn.label)?oColumn.label:sKey;elTh.innerHTML=sLabel},_initTbodyEl:function(elTable){SDT.superclass._initTbodyEl.call(this,elTable);elTable.style.marginTop=this._elTbody.offsetTop>0?"-"+this._elTbody.offsetTop+"px":0},_focusEl:function(el){el=el||this._elTbody;var oSelf=this;this._storeScrollPositions();setTimeout((function(){setTimeout((function(){try{el.focus();oSelf._restoreScrollPositions()}catch(e){}}),0)}),0)},_runRenderChain:function(){this._storeScrollPositions();this._oChainRender.run()},_storeScrollPositions:function(){this._nScrollTop=this._elBdContainer.scrollTop;this._nScrollLeft=this._elBdContainer.scrollLeft},clearScrollPositions:function(){this._nScrollTop=0;this._nScrollLeft=0},_restoreScrollPositions:function(){if(this._nScrollTop){this._elBdContainer.scrollTop=this._nScrollTop;this._nScrollTop=null}if(this._nScrollLeft){this._elBdContainer.scrollLeft=this._nScrollLeft;this._elHdContainer.scrollLeft=this._nScrollLeft;this._nScrollLeft=null}},_validateColumnWidth:function(oColumn,elTd){if(!oColumn.width&&!oColumn.hidden){var elTh=oColumn.getThEl();if(oColumn._calculatedWidth){this._setColumnWidth(oColumn,"auto","visible")}if(elTh.offsetWidth!==elTd.offsetWidth){var elWider=elTh.offsetWidth>elTd.offsetWidth?oColumn.getThLinerEl():elTd.firstChild;var newWidth=Math.max(0,elWider.offsetWidth-(parseInt(Dom.getStyle(elWider,"paddingLeft"),10)|0)-(parseInt(Dom.getStyle(elWider,"paddingRight"),10)|0),oColumn.minWidth);var sOverflow="visible";if(oColumn.maxAutoWidth>0&&newWidth>oColumn.maxAutoWidth){newWidth=oColumn.maxAutoWidth;sOverflow="hidden"}this._elTbody.style.display="none";this._setColumnWidth(oColumn,newWidth+"px",sOverflow);oColumn._calculatedWidth=newWidth;this._elTbody.style.display=""}}},validateColumnWidths:function(oColumn){var allKeys=this._oColumnSet.keys,allKeysLength=allKeys.length,elRow=this.getFirstTrEl();if(ua.ie){this._setOverhangValue(1)}if(allKeys&&elRow&&elRow.childNodes.length===allKeysLength){var sWidth=this.get("width");if(sWidth){this._elHdContainer.style.width="";this._elBdContainer.style.width=""}this._elContainer.style.width="";if(oColumn&&lang.isNumber(oColumn.getKeyIndex())){this._validateColumnWidth(oColumn,elRow.childNodes[oColumn.getKeyIndex()])}else{var elTd,todos=[],thisTodo,i,len;for(i=0;i<allKeysLength;i++){oColumn=allKeys[i];if(!oColumn.width&&!oColumn.hidden&&oColumn._calculatedWidth){todos[todos.length]=oColumn}}this._elTbody.style.display="none";for(i=0,len=todos.length;i<len;i++){this._setColumnWidth(todos[i],"auto","visible")}this._elTbody.style.display="";todos=[];for(i=0;i<allKeysLength;i++){oColumn=allKeys[i];elTd=elRow.childNodes[i];if(!oColumn.width&&!oColumn.hidden){var elTh=oColumn.getThEl();if(elTh.offsetWidth!==elTd.offsetWidth){var elWider=elTh.offsetWidth>elTd.offsetWidth?oColumn.getThLinerEl():elTd.firstChild;var newWidth=Math.max(0,elWider.offsetWidth-(parseInt(Dom.getStyle(elWider,"paddingLeft"),10)|0)-(parseInt(Dom.getStyle(elWider,"paddingRight"),10)|0),oColumn.minWidth);var sOverflow="visible";if(oColumn.maxAutoWidth>0&&newWidth>oColumn.maxAutoWidth){newWidth=oColumn.maxAutoWidth;sOverflow="hidden"}todos[todos.length]=[oColumn,newWidth,sOverflow]}}}this._elTbody.style.display="none";for(i=0,len=todos.length;i<len;i++){thisTodo=todos[i];this._setColumnWidth(thisTodo[0],thisTodo[1]+"px",thisTodo[2]);thisTodo[0]._calculatedWidth=thisTodo[1]}this._elTbody.style.display=""}if(sWidth){this._elHdContainer.style.width=sWidth;this._elBdContainer.style.width=sWidth}}this._syncScroll();this._restoreScrollPositions()},_syncScroll:function(){this._syncScrollX();this._syncScrollY();this._syncScrollOverhang();if(ua.opera){this._elHdContainer.scrollLeft=this._elBdContainer.scrollLeft;if(!this.get("width")){document.body.style+=""}}},_syncScrollY:function(){var elTbody=this._elTbody,elBdContainer=this._elBdContainer;if(!this.get("width")){this._elContainer.style.width=elBdContainer.scrollHeight>elBdContainer.clientHeight?elTbody.parentNode.clientWidth+19+"px":elTbody.parentNode.clientWidth+2+"px"}},_syncScrollX:function(){var elTbody=this._elTbody,elBdContainer=this._elBdContainer;if(!this.get("height")&&ua.ie){elBdContainer.style.height=elBdContainer.scrollWidth>elBdContainer.offsetWidth?elTbody.parentNode.offsetHeight+18+"px":elTbody.parentNode.offsetHeight+"px"}if(this._elTbody.rows.length===0){this._elMsgTbody.parentNode.style.width=this.getTheadEl().parentNode.offsetWidth+"px"}else{this._elMsgTbody.parentNode.style.width=""}},_syncScrollOverhang:function(){var elBdContainer=this._elBdContainer,nPadding=1;if(elBdContainer.scrollHeight>elBdContainer.clientHeight&&elBdContainer.scrollWidth>elBdContainer.clientWidth){nPadding=18}this._setOverhangValue(nPadding)},_setOverhangValue:function(nBorderWidth){var aLastHeaders=this._oColumnSet.headers[this._oColumnSet.headers.length-1]||[],len=aLastHeaders.length,sPrefix=this._sId+"-fixedth-",sValue=nBorderWidth+"px solid "+this.get("COLOR_COLUMNFILLER");this._elThead.style.display="none";for(var i=0;i<len;i++){Dom.get(sPrefix+aLastHeaders[i]).style.borderRight=sValue}this._elThead.style.display=""},getHdContainerEl:function(){return this._elHdContainer},getBdContainerEl:function(){return this._elBdContainer},getHdTableEl:function(){return this._elHdTable},getBdTableEl:function(){return this._elTable},disable:function(){var elMask=this._elMask;elMask.style.width=this._elBdContainer.offsetWidth+"px";elMask.style.height=this._elHdContainer.offsetHeight+this._elBdContainer.offsetHeight+"px";elMask.style.display="";this.fireEvent("disableEvent")},removeColumn:function(oColumn){var hdPos=this._elHdContainer.scrollLeft;var bdPos=this._elBdContainer.scrollLeft;oColumn=SDT.superclass.removeColumn.call(this,oColumn);this._elHdContainer.scrollLeft=hdPos;this._elBdContainer.scrollLeft=bdPos;return oColumn},insertColumn:function(oColumn,index){var hdPos=this._elHdContainer.scrollLeft;var bdPos=this._elBdContainer.scrollLeft;var oNewColumn=SDT.superclass.insertColumn.call(this,oColumn,index);this._elHdContainer.scrollLeft=hdPos;this._elBdContainer.scrollLeft=bdPos;return oNewColumn},reorderColumn:function(oColumn,index){var hdPos=this._elHdContainer.scrollLeft;var bdPos=this._elBdContainer.scrollLeft;var oNewColumn=SDT.superclass.reorderColumn.call(this,oColumn,index);this._elHdContainer.scrollLeft=hdPos;this._elBdContainer.scrollLeft=bdPos;return oNewColumn},setColumnWidth:function(oColumn,nWidth){oColumn=this.getColumn(oColumn);if(oColumn){this._storeScrollPositions();if(lang.isNumber(nWidth)){nWidth=nWidth>oColumn.minWidth?nWidth:oColumn.minWidth;oColumn.width=nWidth;this._setColumnWidth(oColumn,nWidth+"px");this._syncScroll();this.fireEvent("columnSetWidthEvent",{column:oColumn,width:nWidth})}else if(nWidth===null){oColumn.width=nWidth;this._setColumnWidth(oColumn,"auto");this.validateColumnWidths(oColumn);this.fireEvent("columnUnsetWidthEvent",{column:oColumn})}this._clearTrTemplateEl()}else{}},scrollTo:function(to){var td=this.getTdEl(to);if(td){this.clearScrollPositions();this.getBdContainerEl().scrollLeft=td.offsetLeft;this.getBdContainerEl().scrollTop=td.parentNode.offsetTop}else{var tr=this.getTrEl(to);if(tr){this.clearScrollPositions();this.getBdContainerEl().scrollTop=tr.offsetTop}}},showTableMessage:function(sHTML,sClassName){var elCell=this._elMsgTd;if(lang.isString(sHTML)){elCell.firstChild.innerHTML=sHTML}if(lang.isString(sClassName)){Dom.addClass(elCell.firstChild,sClassName)}var elThead=this.getTheadEl();var elTable=elThead.parentNode;var newWidth=elTable.offsetWidth;this._elMsgTbody.parentNode.style.width=this.getTheadEl().parentNode.offsetWidth+"px";this._elMsgTbody.style.display="";this.fireEvent("tableMsgShowEvent",{html:sHTML,className:sClassName})},_onColumnChange:function(oArg){var oColumn=oArg.column?oArg.column:oArg.editor?oArg.editor.column:null;this._storeScrollPositions();this.validateColumnWidths(oColumn)},_onScroll:function(e,oSelf){oSelf._elHdContainer.scrollLeft=oSelf._elBdContainer.scrollLeft;if(oSelf._oCellEditor&&oSelf._oCellEditor.isActive){oSelf.fireEvent("editorBlurEvent",{editor:oSelf._oCellEditor});oSelf.cancelCellEditor()}var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName.toLowerCase();oSelf.fireEvent("tableScrollEvent",{event:e,target:elTarget})},_onTheadKeydown:function(e,oSelf){if(Ev.getCharCode(e)===9){setTimeout((function(){if(oSelf instanceof SDT&&oSelf._sId){oSelf._elBdContainer.scrollLeft=oSelf._elHdContainer.scrollLeft}}),0)}var elTarget=Ev.getTarget(e);var elTag=elTarget.nodeName.toLowerCase();var bKeepBubbling=true;while(elTarget&&elTag!="table"){switch(elTag){case"body":return;case"input":case"textarea":break;case"thead":bKeepBubbling=oSelf.fireEvent("theadKeyEvent",{target:elTarget,event:e});break;default:break}if(bKeepBubbling===false){return}else{elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.nodeName.toLowerCase()}}}oSelf.fireEvent("tableKeyEvent",{target:elTarget||oSelf._elContainer,event:e})}})})();(function(){var lang=YAHOO.lang,util=YAHOO.util,widget=YAHOO.widget,ua=YAHOO.env.ua,Dom=util.Dom,Ev=util.Event,DT=widget.DataTable;widget.BaseCellEditor=function(sType,oConfigs){this._sId=this._sId||Dom.generateId(null,"yui-ceditor");YAHOO.widget.BaseCellEditor._nCount++;this._sType=sType;this._initConfigs(oConfigs);this._initEvents();this._needsRender=true};var BCE=widget.BaseCellEditor;lang.augmentObject(BCE,{_nCount:0,CLASS_CELLEDITOR:"yui-ceditor"});BCE.prototype={_sId:null,_sType:null,_oDataTable:null,_oColumn:null,_oRecord:null,_elTd:null,_elContainer:null,_elCancelBtn:null,_elSaveBtn:null,_initConfigs:function(oConfigs){if(oConfigs&&YAHOO.lang.isObject(oConfigs)){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig]}}}},_initEvents:function(){this.createEvent("showEvent");this.createEvent("keydownEvent");this.createEvent("invalidDataEvent");this.createEvent("revertEvent");this.createEvent("saveEvent");this.createEvent("cancelEvent");this.createEvent("blurEvent");this.createEvent("blockEvent");this.createEvent("unblockEvent")},_initContainerEl:function(){if(this._elContainer){YAHOO.util.Event.purgeElement(this._elContainer,true);this._elContainer.innerHTML=""}var elContainer=document.createElement("div");elContainer.id=this.getId()+"-container";elContainer.style.display="none";elContainer.tabIndex=0;this.className=lang.isArray(this.className)?this.className:this.className?[this.className]:[];this.className[this.className.length]=DT.CLASS_EDITOR;elContainer.className=this.className.join(" ");document.body.insertBefore(elContainer,document.body.firstChild);this._elContainer=elContainer},_initShimEl:function(){if(this.useIFrame){if(!this._elIFrame){var elIFrame=document.createElement("iframe");elIFrame.src="javascript:false";elIFrame.frameBorder=0;elIFrame.scrolling="no";elIFrame.style.display="none";elIFrame.className=DT.CLASS_EDITOR_SHIM;elIFrame.tabIndex=-1;elIFrame.role="presentation";elIFrame.title="Presentational iframe shim";document.body.insertBefore(elIFrame,document.body.firstChild);this._elIFrame=elIFrame}}},_hide:function(){this.getContainerEl().style.display="none";if(this._elIFrame){this._elIFrame.style.display="none"}this.isActive=false;this.getDataTable()._oCellEditor=null},asyncSubmitter:null,value:null,defaultValue:null,validator:null,resetInvalidData:true,isActive:false,LABEL_SAVE:"Save",LABEL_CANCEL:"Cancel",disableBtns:false,useIFrame:false,className:null,toString:function(){return"CellEditor instance "+this._sId},getId:function(){return this._sId},getDataTable:function(){return this._oDataTable},getColumn:function(){return this._oColumn},getRecord:function(){return this._oRecord},getTdEl:function(){return this._elTd},getContainerEl:function(){return this._elContainer},destroy:function(){this.unsubscribeAll();var oColumn=this.getColumn();if(oColumn){oColumn.editor=null}var elContainer=this.getContainerEl();if(elContainer){Ev.purgeElement(elContainer,true);elContainer.parentNode.removeChild(elContainer)}},render:function(){if(!this._needsRender){return}this._initContainerEl();this._initShimEl();Ev.addListener(this.getContainerEl(),"keydown",(function(e,oSelf){if(e.keyCode==27){var target=Ev.getTarget(e);if(target.nodeName&&target.nodeName.toLowerCase()==="select"){target.blur()}oSelf.cancel()}oSelf.fireEvent("keydownEvent",{editor:oSelf,event:e})}),this);this.renderForm();if(!this.disableBtns){this.renderBtns()}this.doAfterRender();this._needsRender=false},renderBtns:function(){var elBtnsDiv=this.getContainerEl().appendChild(document.createElement("div"));elBtnsDiv.className=DT.CLASS_BUTTON;var elSaveBtn=elBtnsDiv.appendChild(document.createElement("button"));elSaveBtn.className=DT.CLASS_DEFAULT;elSaveBtn.innerHTML=this.LABEL_SAVE;Ev.addListener(elSaveBtn,"click",(function(oArgs){this.save()}),this,true);this._elSaveBtn=elSaveBtn;var elCancelBtn=elBtnsDiv.appendChild(document.createElement("button"));elCancelBtn.innerHTML=this.LABEL_CANCEL;Ev.addListener(elCancelBtn,"click",(function(oArgs){this.cancel()}),this,true);this._elCancelBtn=elCancelBtn},attach:function(oDataTable,elCell){if(oDataTable instanceof YAHOO.widget.DataTable){this._oDataTable=oDataTable;elCell=oDataTable.getTdEl(elCell);if(elCell){this._elTd=elCell;var oColumn=oDataTable.getColumn(elCell);if(oColumn){this._oColumn=oColumn;var oRecord=oDataTable.getRecord(elCell);if(oRecord){this._oRecord=oRecord;var value=oRecord.getData(this.getColumn().getField());this.value=value!==undefined?value:this.defaultValue;return true}}}}return false},move:function(){var elContainer=this.getContainerEl(),elTd=this.getTdEl(),x=Dom.getX(elTd),y=Dom.getY(elTd);if(isNaN(x)||isNaN(y)){var elTbody=this.getDataTable().getTbodyEl();x=elTd.offsetLeft+Dom.getX(elTbody.parentNode)-elTbody.scrollLeft;y=elTd.offsetTop+Dom.getY(elTbody.parentNode)-elTbody.scrollTop+this.getDataTable().getTheadEl().offsetHeight}elContainer.style.left=x+"px";elContainer.style.top=y+"px";if(this._elIFrame){this._elIFrame.style.left=x+"px";this._elIFrame.style.top=y+"px"}},show:function(){var elContainer=this.getContainerEl(),elIFrame=this._elIFrame;this.resetForm();this.isActive=true;elContainer.style.display="";if(elIFrame){elIFrame.style.width=elContainer.offsetWidth+"px";elIFrame.style.height=elContainer.offsetHeight+"px";elIFrame.style.display=""}this.focus();this.fireEvent("showEvent",{editor:this})},block:function(){this.fireEvent("blockEvent",{editor:this})},unblock:function(){this.fireEvent("unblockEvent",{editor:this})},save:function(){var inputValue=this.getInputValue();var validValue=inputValue;if(this.validator){validValue=this.validator.call(this.getDataTable(),inputValue,this.value,this);if(validValue===undefined){if(this.resetInvalidData){this.resetForm()}this.fireEvent("invalidDataEvent",{editor:this,oldData:this.value,newData:inputValue});return}}var oSelf=this;var finishSave=function(bSuccess,oNewValue){var oOrigValue=oSelf.value;if(bSuccess){oSelf.value=oNewValue;oSelf.getDataTable().updateCell(oSelf.getRecord(),oSelf.getColumn(),oNewValue);oSelf._hide();oSelf.fireEvent("saveEvent",{editor:oSelf,oldData:oOrigValue,newData:oSelf.value})}else{oSelf.resetForm();oSelf.fireEvent("revertEvent",{editor:oSelf,oldData:oOrigValue,newData:oNewValue})}oSelf.unblock()};this.block();if(lang.isFunction(this.asyncSubmitter)){this.asyncSubmitter.call(this,finishSave,validValue)}else{finishSave(true,validValue)}},cancel:function(){if(this.isActive){this._hide();this.fireEvent("cancelEvent",{editor:this})}else{}},renderForm:function(){},doAfterRender:function(){},handleDisabledBtns:function(){},resetForm:function(){},focus:function(){},getInputValue:function(){}};lang.augmentProto(BCE,util.EventProvider);widget.CheckboxCellEditor=function(oConfigs){oConfigs=oConfigs||{};this._sId=this._sId||Dom.generateId(null,"yui-checkboxceditor");YAHOO.widget.BaseCellEditor._nCount++;widget.CheckboxCellEditor.superclass.constructor.call(this,oConfigs.type||"checkbox",oConfigs)};lang.extend(widget.CheckboxCellEditor,BCE,{checkboxOptions:null,checkboxes:null,value:null,renderForm:function(){if(lang.isArray(this.checkboxOptions)){var checkboxOption,checkboxValue,checkboxId,elLabel,j,len;for(j=0,len=this.checkboxOptions.length;j<len;j++){checkboxOption=this.checkboxOptions[j];checkboxValue=lang.isValue(checkboxOption.value)?checkboxOption.value:checkboxOption;checkboxId=this.getId()+"-chk"+j;this.getContainerEl().innerHTML+='<input type="checkbox"'+' id="'+checkboxId+'"'+' value="'+checkboxValue+'" />';elLabel=this.getContainerEl().appendChild(document.createElement("label"));elLabel.htmlFor=checkboxId;elLabel.innerHTML=lang.isValue(checkboxOption.label)?checkboxOption.label:checkboxOption}var allCheckboxes=[];for(j=0;j<len;j++){allCheckboxes[allCheckboxes.length]=this.getContainerEl().childNodes[j*2]}this.checkboxes=allCheckboxes;if(this.disableBtns){this.handleDisabledBtns()}}else{}},handleDisabledBtns:function(){Ev.addListener(this.getContainerEl(),"click",(function(v){if(Ev.getTarget(v).tagName.toLowerCase()==="input"){this.save()}}),this,true)},resetForm:function(){var originalValues=lang.isArray(this.value)?this.value:[this.value];for(var i=0,j=this.checkboxes.length;i<j;i++){this.checkboxes[i].checked=false;for(var k=0,len=originalValues.length;k<len;k++){if(this.checkboxes[i].value==originalValues[k]){this.checkboxes[i].checked=true}}}},focus:function(){this.checkboxes[0].focus()},getInputValue:function(){var checkedValues=[];for(var i=0,j=this.checkboxes.length;i<j;i++){if(this.checkboxes[i].checked){checkedValues[checkedValues.length]=this.checkboxes[i].value}}return checkedValues}});lang.augmentObject(widget.CheckboxCellEditor,BCE);widget.DateCellEditor=function(oConfigs){oConfigs=oConfigs||{};this._sId=this._sId||Dom.generateId(null,"yui-dateceditor");YAHOO.widget.BaseCellEditor._nCount++;widget.DateCellEditor.superclass.constructor.call(this,oConfigs.type||"date",oConfigs)};lang.extend(widget.DateCellEditor,BCE,{calendar:null,calendarOptions:null,defaultValue:new Date,renderForm:function(){if(YAHOO.widget.Calendar){var calContainer=this.getContainerEl().appendChild(document.createElement("div"));calContainer.id=this.getId()+"-dateContainer";var calendar=new YAHOO.widget.Calendar(this.getId()+"-date",calContainer.id,this.calendarOptions);calendar.render();calContainer.style.cssFloat="none";calendar.hideEvent.subscribe((function(){this.cancel()}),this,true);if(ua.ie){var calFloatClearer=this.getContainerEl().appendChild(document.createElement("div"));calFloatClearer.style.clear="both"}this.calendar=calendar;if(this.disableBtns){this.handleDisabledBtns()}}else{}},handleDisabledBtns:function(){this.calendar.selectEvent.subscribe((function(v){this.save()}),this,true)},resetForm:function(){var value=this.value||new Date;this.calendar.select(value);this.calendar.cfg.setProperty("pagedate",value,false);this.calendar.render();this.calendar.show()},focus:function(){},getInputValue:function(){return this.calendar.getSelectedDates()[0]}});lang.augmentObject(widget.DateCellEditor,BCE);widget.DropdownCellEditor=function(oConfigs){oConfigs=oConfigs||{};this._sId=this._sId||Dom.generateId(null,"yui-dropdownceditor");YAHOO.widget.BaseCellEditor._nCount++;widget.DropdownCellEditor.superclass.constructor.call(this,oConfigs.type||"dropdown",oConfigs)};lang.extend(widget.DropdownCellEditor,BCE,{dropdownOptions:null,dropdown:null,multiple:false,size:null,renderForm:function(){var elDropdown=this.getContainerEl().appendChild(document.createElement("select"));elDropdown.style.zoom=1;if(this.multiple){elDropdown.multiple="multiple"}if(lang.isNumber(this.size)){elDropdown.size=this.size}this.dropdown=elDropdown;if(lang.isArray(this.dropdownOptions)){var dropdownOption,elOption;for(var i=0,j=this.dropdownOptions.length;i<j;i++){dropdownOption=this.dropdownOptions[i];elOption=document.createElement("option");elOption.value=lang.isValue(dropdownOption.value)?dropdownOption.value:dropdownOption;elOption.innerHTML=lang.isValue(dropdownOption.label)?dropdownOption.label:dropdownOption;elOption=elDropdown.appendChild(elOption)}if(this.disableBtns){this.handleDisabledBtns()}}},handleDisabledBtns:function(){if(this.multiple){Ev.addListener(this.dropdown,"blur",(function(v){this.save()}),this,true)}else{if(!ua.ie){Ev.addListener(this.dropdown,"change",(function(v){this.save()}),this,true)}else{Ev.addListener(this.dropdown,"blur",(function(v){this.save()}),this,true);Ev.addListener(this.dropdown,"click",(function(v){this.save()}),this,true)}}},resetForm:function(){var allOptions=this.dropdown.options,i=0,j=allOptions.length;if(lang.isArray(this.value)){var allValues=this.value,m=0,n=allValues.length,hash={};for(;i<j;i++){allOptions[i].selected=false;hash[allOptions[i].value]=allOptions[i]}for(;m<n;m++){if(hash[allValues[m]]){hash[allValues[m]].selected=true}}}else{for(;i<j;i++){if(this.value==allOptions[i].value){allOptions[i].selected=true}}}},focus:function(){this.getDataTable()._focusEl(this.dropdown)},getInputValue:function(){var allOptions=this.dropdown.options;if(this.multiple){var values=[],i=0,j=allOptions.length;for(;i<j;i++){if(allOptions[i].selected){values.push(allOptions[i].value)}}return values}else{return allOptions[allOptions.selectedIndex].value}}});lang.augmentObject(widget.DropdownCellEditor,BCE);widget.RadioCellEditor=function(oConfigs){oConfigs=oConfigs||{};this._sId=this._sId||Dom.generateId(null,"yui-radioceditor");YAHOO.widget.BaseCellEditor._nCount++;widget.RadioCellEditor.superclass.constructor.call(this,oConfigs.type||"radio",oConfigs)};lang.extend(widget.RadioCellEditor,BCE,{radios:null,radioOptions:null,renderForm:function(){if(lang.isArray(this.radioOptions)){var radioOption,radioValue,radioId,elLabel;for(var i=0,len=this.radioOptions.length;i<len;i++){radioOption=this.radioOptions[i];radioValue=lang.isValue(radioOption.value)?radioOption.value:radioOption;radioId=this.getId()+"-radio"+i;this.getContainerEl().innerHTML+='<input type="radio"'+' name="'+this.getId()+'"'+' value="'+radioValue+'"'+' id="'+radioId+'" />';elLabel=this.getContainerEl().appendChild(document.createElement("label"));elLabel.htmlFor=radioId;elLabel.innerHTML=lang.isValue(radioOption.label)?radioOption.label:radioOption}var allRadios=[],elRadio;for(var j=0;j<len;j++){elRadio=this.getContainerEl().childNodes[j*2];allRadios[allRadios.length]=elRadio}this.radios=allRadios;if(this.disableBtns){this.handleDisabledBtns()}}else{}},handleDisabledBtns:function(){Ev.addListener(this.getContainerEl(),"click",(function(v){if(Ev.getTarget(v).tagName.toLowerCase()==="input"){this.save()}}),this,true)},resetForm:function(){for(var i=0,j=this.radios.length;i<j;i++){var elRadio=this.radios[i];if(this.value==elRadio.value){elRadio.checked=true;return}}},focus:function(){for(var i=0,j=this.radios.length;i<j;i++){if(this.radios[i].checked){this.radios[i].focus();return}}},getInputValue:function(){for(var i=0,j=this.radios.length;i<j;i++){if(this.radios[i].checked){return this.radios[i].value}}}});lang.augmentObject(widget.RadioCellEditor,BCE);widget.TextareaCellEditor=function(oConfigs){oConfigs=oConfigs||{};this._sId=this._sId||Dom.generateId(null,"yui-textareaceditor");YAHOO.widget.BaseCellEditor._nCount++;widget.TextareaCellEditor.superclass.constructor.call(this,oConfigs.type||"textarea",oConfigs)};lang.extend(widget.TextareaCellEditor,BCE,{textarea:null,renderForm:function(){var elTextarea=this.getContainerEl().appendChild(document.createElement("textarea"));this.textarea=elTextarea;if(this.disableBtns){this.handleDisabledBtns()}},handleDisabledBtns:function(){Ev.addListener(this.textarea,"blur",(function(v){this.save()}),this,true)},move:function(){this.textarea.style.width=this.getTdEl().offsetWidth+"px";this.textarea.style.height="3em";YAHOO.widget.TextareaCellEditor.superclass.move.call(this)},resetForm:function(){this.textarea.value=this.value},focus:function(){this.getDataTable()._focusEl(this.textarea);this.textarea.select()},getInputValue:function(){return this.textarea.value}});lang.augmentObject(widget.TextareaCellEditor,BCE);widget.TextboxCellEditor=function(oConfigs){oConfigs=oConfigs||{};this._sId=this._sId||Dom.generateId(null,"yui-textboxceditor");YAHOO.widget.BaseCellEditor._nCount++;widget.TextboxCellEditor.superclass.constructor.call(this,oConfigs.type||"textbox",oConfigs)};lang.extend(widget.TextboxCellEditor,BCE,{textbox:null,renderForm:function(){var elTextbox;if(ua.webkit>420){elTextbox=this.getContainerEl().appendChild(document.createElement("form")).appendChild(document.createElement("input"))}else{elTextbox=this.getContainerEl().appendChild(document.createElement("input"))}elTextbox.type="text";this.textbox=elTextbox;Ev.addListener(elTextbox,"keypress",(function(v){if(v.keyCode===13){YAHOO.util.Event.preventDefault(v);this.save()}}),this,true);if(this.disableBtns){this.handleDisabledBtns()}},move:function(){this.textbox.style.width=this.getTdEl().offsetWidth+"px";widget.TextboxCellEditor.superclass.move.call(this)},resetForm:function(){this.textbox.value=lang.isValue(this.value)?this.value.toString():""},focus:function(){this.getDataTable()._focusEl(this.textbox);this.textbox.select()},getInputValue:function(){return this.textbox.value}});lang.augmentObject(widget.TextboxCellEditor,BCE);DT.Editors={checkbox:widget.CheckboxCellEditor,date:widget.DateCellEditor,dropdown:widget.DropdownCellEditor,radio:widget.RadioCellEditor,textarea:widget.TextareaCellEditor,textbox:widget.TextboxCellEditor};widget.CellEditor=function(sType,oConfigs){if(sType&&DT.Editors[sType]){lang.augmentObject(BCE,DT.Editors[sType]);return new DT.Editors[sType](oConfigs)}else{return new BCE(null,oConfigs)}};var CE=widget.CellEditor;lang.augmentObject(CE,BCE)})();YAHOO.register("datatable",YAHOO.widget.DataTable,{version:"2.9.0",build:"2800"});
Back to Directory File Manager