String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")};Array.prototype.get=function(obj,getIndex,all){var r=[];for(var i=0;i-1)this.splice(i,1)};Array.prototype.swap=function(i,j){if(i>-1&&j>-1&&i-1){var field="";for(var n=j+1;nr)r=arguments[i]}return r},sum:function(arr,name){var r=0;arr.forEach(function(d){r+=ke.getFloat(d[name],4)});return r},isString:function(arg){return $.type(arg)=="string"},isBool:function(arg){return $.type(arg)=="boolean"},getBool:function(v){return v==true},getFloat:function(v,d){if(!d)d=0;var f=parseFloat(v);if(isNaN(f)){return null}d=Math.pow(10,d);return Math.round(v*d)/d},getInt:function(v){var r=parseInt(v);return isNaN(r)?null:r},getDate:function(v){if(v){if($.isNumeric(v))return new Date((v-28800)*1e3);else if(v instanceof Date)return v;else{v=v.toString().trim().replace(/-/g,"/");if(v.match(/[\d]{4,4}[/]{1}[\d]{1,2}[/]{1}[\d]{1,2}/g))return new Date(v)}}return null},getTimeSpan:function(v){var r=ke.getDate(v);return r!=null?r.getTime()/1e3+28800:null},getYMD:function(v,type){if(!v)return[];var dt=v;if($.isNumeric(v))dt=new Date((v-28800)*1e3);else if(ke.isString(v)){if(v.match(/^[\+\-]?\d*?\.?\d{0,4}?$/))dt=new Date(parseInt(v)*1e3);else dt=this.getDate(v)}if(!type)return[dt.getFullYear(),dt.getMonth()+1,dt.getDate(),dt.getHours(),dt.getMinutes(),dt.getSeconds()];else if(type=="date")return[dt.getFullYear(),dt.getMonth()+1,dt.getDate()];else if(type=="time")return[dt.getHours(),dt.getMinutes(),dt.getSeconds()]},getDateTip:function(v,hm,sec){try{if(!v)return"";var dt=ke.getYMD(v);for(var i=1;i=1){for(var i=h;i=h&&fn(arr[j],field)>fn(arr[j-h],field);j-=h)arr.swap(j,j-h)}else{for(j=i;j>=h&&fn(arr[j],field)
'+(unIcon?"":"loading...")+"")}return $el},unMask:function(id,delay){id=(id||"ms_ajax")+"_mask";delay=delay||10;clearTimeout(window["hide_"+id]);if($("#"+id).length)window["hide_"+id]=setTimeout("$('#"+id+"').remove();",delay)},extend:function(superClass,sub){var F=function(){};F.prototype=superClass.prototype;sub.prototype=new F;sub.prototype.constructor=sub;sub.uber=superClass.prototype},hasClass:function(dom,cls){return(" "+dom.className+" ").indexOf(" "+cls+" ")>-1}};ke.dict=function(){this.keys=[];this.values=[];this.length=0;this.contain=function(k){for(var i=0;i-1)this.cols[i]=cl;else this.cols.push(cl);return cl};this.addRow=function(obj){this.datas.push(obj);var row=new ke.row(this).init(obj);row.id=this.maxRowId++;this.rows.push(row);this.length=this.rows.length;this.change();return this};this.deleteRow=function(rowIndex){if(rowIndex>-1){this.rows.splice(rowIndex,1);this.datas.splice(rowIndex,1);this.length=this.rows.length;this.change()}};this.deleteById=function(id){var index=this.rows.get({id:id},true);this.deleteRow(index)};this.getColumn=function(colName){return this.cols.get({name:colName})};this.getRows=function(val,colName){var r=[];for(var i=0;i'+this.content+""}return""}};ke.templateNode=function(node){if(node.nodeType==1){if(node.tagName=="SCRIPT")this.nodes=new ke.templateScript(node.innerHTML);else if(node.tagName=="STYLE")this.nodes=new ke.templateStyle(node.innerHTML);else{this.name=node.tagName;this.selfClose=ke.templateNode.selfCloseTags.indexOf(this.name)>-1;this.attributes=[];this.nodes=[];this.condition=null;this.foreach=null;if(node.attributes){for(var k=0;k";return htm}},this.render=function(t){var htm="";if(!this.condition||this.condition(t)){if(this.foreach){var items=this.foreach(t)||[];var preForData=t.forData;var preForIndex=t.forIndex;for(var i=0;i"){var e=htm.indexOf("<\/script>");this.nodes.push(new ke.templateScript(htm.substr(i+8,e-i-8)));i=e+9;continue}else if(htm.substr(i,7)=="");this.nodes.push(new ke.templateStyle(htm.substr(i+7,e-i-7)));i=e+8;continue}}r+=htm[i]}return $.parseHTML("
"+r+"
")};this.render=function(d,i){this.data=d;this.index=i;var htm="";for(var i=0;i