function DataGrid(){this._ops={id:"",obj:null,data:null,head:null,list:null,toolBar:null,popUpBar:null,tdStyles:null,paging:{num:10,page:1},edit:!0,labelName:null,operate:!1,click:null,fixed:!1,bdCollapse:!0,headpadding:"0px",checkIndex:0,max:1E4,cleanTip:"",pageTurnFunc:null,hasID:!1,hasHead:!0,hasSelBox:!0,spBlank:!1,spAutoEdit:!1,sortFunc:null,sortType:"down",sortName:"",niceScroll:null,IDWidth:null,editWidth:null,operateWidth:null,selWidth:null,classCol:{gridClassName:"dataGrid",gridPageListClassName:"pageListPo",
ListSpanClassName:"ListSpan",headClassName:"dataGrid_header_tr"}};this._table=null;this._list={id:"",obj:""};this._set={IDWidth:"60px",editWidth:"60px",selWidth:"60px",operateWidth:"100px"};this._event={editTr:-1,sortName:"",sortable:!1,state:"default"};this._state={isBlank:!1,colNum:0,headCells:[{width:0}],headWidth:0};this._types={str:"",ip:"0.0.0.0",mask:"0.0.0.0",dns:"0.0.0.0",gateway:"0.0.0.0",mac:"00-00-00-00-00-00"};this._pgList={id:"",obj:"",num:5,page:1,listMarginLeft:19,macAddrIdPre:"macAddr",
ipAddrIdPre:"ipAddr",selectPre:"selConGrid",listDivStr:"listDiv",listArrowLStr:"listArrowL",listArrowRStr:"listArrowR",listArrowLastStr:"listArrowLast",listArrowFirstStr:"listArrowFirst",ListSpanClassName:"ListSpan",ListSpanSClassName:"listSpanS",plcClassName:"pageListContent",listPageIndex:"PageIndex"};this._toolBar={delSelBtn:null,clrSelBtn:null,downloadBtn:null,stopDownloadBtn:null};"function"!=typeof DataGrid.prototype.init&&(DataGrid.prototype.init=function(a){this._optionsInit(a);this._create()},
DataGrid.prototype.getPageNum=function(){return this._pgList.page},DataGrid.prototype.getNumPerPage=function(){return this._ops.paging.num},DataGrid.prototype.getDataLen=function(){return this._getListLen()},DataGrid.prototype.refresh=function(a){void 0==a&&(a=1);this._refresh(a)},DataGrid.prototype.blankTable=function(){this._cleanAll()},DataGrid.prototype.refreshPage=function(a,b,d){void 0==b&&(b=0);void 0==d&&(d=1);if(a instanceof Array&&b>=a.length){for(var c=this._ops.list[this._ops.checkIndex].name,
e=Array(b),f=(d-1)*this._ops.paging.num,h=0;h<b;h++)h>=f&&h<f+a.length?e[h]=a[h-f]:(e[h]={},e[h][c]=" ");this.setDataSource(e)}this._refresh(d)},DataGrid.prototype.setDataSource=function(a){a instanceof Array&&(this._ops.data=a)},DataGrid.prototype.getActiveTr=function(){return this._getEditTr()},DataGrid.prototype.getActiveTrIndex=function(){return this._getTrIndex(this._getEditTr())},DataGrid.prototype._create=function(){this._getTableObj();null!=this._table&&(this._setToolBar(),this._tableSet(),
this._headCreate(),this._contentCreate(this._ops.paging.page),this._flushBtn())},DataGrid.prototype._eventStateSet=function(a,b){if(!0!=b&&"default"!=this._event.state)return!1;this._event.state=a;return!0},DataGrid.prototype._eventStateGet=function(){return this._event.state},DataGrid.prototype._getEditTr=function(){return this._event.editTr},DataGrid.prototype._setEditTr=function(a){this._event.editTr=a},DataGrid.prototype._getBlankDataObj=function(a){var b=this._ops.list,d;for(d in b)a[b[d].name]=
""},DataGrid.prototype._fillEditRow_IP=function(a,b,d,c,e){var f=el("input");f.className="ipInput text";f.id=this._pgList.ipAddrIdPre+b+this._ops.id+d;f.style.textAlign="center";void 0!=c&&0!=c.length&&(f.value=c);f.maxLength=e.maxLength?e.maxLength:15;void 0!=e.size&&(f.size=e.size);a.appendChild(f)},DataGrid.prototype._fillEditRow_IPs=function(a,b,d,c,e){e=e.name.split(" ");var f;f=createAddrDiv(this._pgList.ipAddrIdPre+"Div"+b+this._ops.id+d+e[0]);a.appendChild(f);genAddrInput(f.id,this._pgList.ipAddrIdPre+
b+this._ops.id+d+e[0],ipStr,c[e[0]],smallAddrInputClassType);f=el("label");f.innerHTML="-";a.appendChild(f);setStyle(f,{cssFloat:"left",width:"5px",lineHeight:"18px",height:"10px",margin:"0px 0px 0px 1px"});f=createAddrDiv(this._pgList.ipAddrIdPre+"Div"+b+this._ops.id+d+e[1]);a.appendChild(f);genAddrInput(f.id,this._pgList.ipAddrIdPre+b+this._ops.id+d+e[1],ipStr,c[e[1]],smallAddrInputClassType)},DataGrid.prototype._fillEditRow_MAC=function(a,b,d,c,e){var f=el("input");f.className="ipMac text";f.id=
this._pgList.macAddrIdPre+b+this._ops.id+d;f.style.textAlign="center";void 0!=c&&0!=c.length&&(f.value=c.toUpperCase());f.maxLength=e.maxLength?e.maxLength:17;void 0!=e.size&&(f.size=e.size);a.appendChild(f)},DataGrid.prototype._fillEditRow_Select=function(a,b,d,c,e,f){var h=el("div"),g=el("span"),l=el("span"),k=el("i");b=this._pgList.selectPre+b+this._ops.id+d;h.className="gridSelectCon "+e.className;a.appendChild(h);g.id=b;g.className="select";h.appendChild(g);l.className="value hsGridValue";g.appendChild(l);
k.className="arrow";g.appendChild(k);a=h.offsetWidth-k.offsetWidth-13-parseInt(getNodeDefaultView(g,"marginLeft"));l.style.width=a+"px";if(void 0==c||0==c.length)c=void 0==e.defaultValue?0:e.defaultValue;f?selectInitExtern(b,e.options,c,e.func,e.maxSelSize):selectInit(b,e.options,c,e.func,e.maxSelSize)},DataGrid.prototype._fillEditRow_Checkbox=function(a,b,d,c,e){b=el("input");b.type="checkbox";b.className="";a.appendChild(b);void 0!=c&&0!=c.length&&(b.checked=!0==c)},DataGrid.prototype._fillEditRow_Radio=
function(a,b,d,c,e){b=el("input");b.type="radio";b.className="";a.appendChild(b);void 0!=c&&0!=c.length&&(b.checked=!0==c)},DataGrid.prototype._fillEdit_Ports=function(a,b,d,c,e){var f,h=e.name.split(" "),g=c[h[0]];"undefined"!=typeof g&&(f=c[h[1]]!=g?g+"-"+c[h[1]]:g);this._fillEditRow_Str(a,b,d,f,e)},DataGrid.prototype._fillEditRow_Input=function(a,b,d,c){var e=el("input");e.className="text";e.style.textAlign="center";e.style.width=void 0==c?"":c+"px";a.appendChild(e);void 0!=b&&0!=b.length&&(e.value=
b);void 0!=d.maxLength&&(e.maxLength=d.maxLength);void 0!=d.size&&(e.size=d.size);return e},DataGrid.prototype._fillEditRow_Str=function(a,b,d,c,e){b=parseInt(getNodeDefaultView(a,"paddingLeft"))+parseInt(getNodeDefaultView(a,"paddingRight"));this._fillEditRow_Input(a,c,e,a.offsetWidth-b-40)},DataGrid.prototype._fillEditRow_Speed=function(a,b,d,c,e){b=el("label");var f=parseInt(getNodeDefaultView(a,"paddingLeft"))+parseInt(getNodeDefaultView(a,"paddingRight"));b.innerHTML=void 0==e.unit?" KB/s":" "+
e.unit;b.style.fontSize="10px";d=a.offsetWidth;c=this._fillEditRow_Input(a,c,e);a.appendChild(b);c.style.width=d-f-40-b.offsetWidth+"px"},DataGrid.prototype._fillEditRow_PopVig=function(a,b,d,c,e){var f,h=e.popObj,g;if(0==c.length)c=el("input"),c.className="popVigBtn",c.value=btn.config,c.type="button",c.onclick=function(){e.click(b)},a.appendChild(c);else{if(!/^\d+$/.test(c))for(f in h.subList)if(h.subList[f][".name"]==c){c=f;break}f=el("span");f.className="dataGridPopVigDes";g=h.subList[c][h.name];
f.title=g;d=this._calcShowSize(d,e);g=getStrInMax(g,d);f.innerHTML=htmlEscape(g);f.onclick=function(){e.click(b)};a.appendChild(f);a.setAttribute(h.indexDes,c)}},DataGrid.prototype._fillEditRow_Path=function(a,b,d,c,e){var f;b=this._getEditTr();f=this._getTrIndexInDataObj(b);0==c.length?(c=el("input"),c.className="popVigBtn",c.value=btn.config,c.type="button",c.onclick=function(){e.click(f)},a.appendChild(c)):(b=el("span"),b.className="dataGridPopVigDes",b.title=c,b.innerHTML=htmlEscape(getStrInMax(c,
32)),b.onclick=function(){e.click(f)},a.appendChild(b))},DataGrid.prototype._fillEditRow_EditBtns=function(a,b,d){a=document.createElement("input");d=document.createElement("input");var c=this._ops.toolBar;a.className="edit editL";a.type="button";a.value=btn.gridSave;this._toolSaveHandle(a,c.save,c.asyn);d.className="edit";d.type="button";d.value=btn.gridCancel;this._toolCancelHandle(d);b.appendChild(a);b.appendChild(d)},DataGrid.prototype._fillEditRow=function(a,b,d){var c=this._ops.list,e,f,h,g,
l=this;this._setEditTr(a);!0==this._ops.hasSelBox&&(g=a.insertCell(-1),e=document.createElement("i"),e.className=chObj,e.onclick=function(){l._singelSelHandle(this,l)},changeCheckInput(e,!1),g.appendChild(e),!1==this._ops.hasHead&&setStyle(g,{width:parseInt(this._set.selWidth,10)+"px"}));!0==this._ops.hasID&&(g=a.insertCell(-1),g.innerHTML=this._getListLen()-b);for(var k in c)if(g=a.insertCell(-1),e=c[k],h=e.type,f=d[e.name],!1==e.edit)g.innerHTML=f?f:"";else switch(h){case "btn":break;case "mask":case "dns":case "gateway":case "ip":this._fillEditRow_IP(g,
b,k,f,e);break;case "mac":this._fillEditRow_MAC(g,b,k,f,e);break;case "select":this._fillEditRow_Select(g,b,k,f,e);break;case "selectApp":this._fillEditRow_Select(g,b,k,f,e,!0);break;case "checkbox":this._fillEditRow_Checkbox(g,b,k,f,e);break;case "radio":this._fillEditRow_Radio(g,b,k,f,e);break;case "ports":this._fillEdit_Ports(g,b,k,d,e);break;case "ips":this._fillEditRow_IPs(g,b,k,d,e);break;case "speed":this._fillEditRow_Speed(g,b,k,f,e);break;case "popVig":this._fillEditRow_PopVig(g,b,k,f,e);
break;case "path":this._fillEditRow_Path(g,b,k,f,e);break;default:this._fillEditRow_Str(g,b,k,f,e)}!0==this._ops.edit&&(g=a.insertCell(-1),this._fillEditRow_EditBtns(d,g,b),!1==this._ops.hasHead&&setStyle(g,{width:parseInt(this._set.editWidth)+"px"}));!0==this._ops.operate&&(g=a.insertCell(-1),this._fillEditRow_EditBtns(d,g,b),!1==this._ops.hasHead&&setStyle(g,{width:parseInt(this._set.operateWidth)+"px"}))},DataGrid.prototype._getTrIndexInDataObj=function(a){a=this._getTrIndex(a);return-1==a?a:a=
!0==this._ops.hasHead?a-1:a},DataGrid.prototype._resetID=function(){var a=this._table.rows,b=a.length,d=0,c=0,e=this._eventStateGet();if(!1!=this._ops.hasID){d=!0==this._ops.hasSelBox?1:0;!0==this._ops.hasHead&&(c++,b--);"add"==e&&(c++,b--);for(var f=0;f<b;f++)e=a[f+c].cells[d],void 0!=e&&(e.innerHTML=f+1)}},DataGrid.prototype._getDRL=function(){return!0==this._ops.hasHead?this._table.rows.length-1:this._table.rows.length},DataGrid.prototype._flushBtn=function(){var a=this._getDRL(),b;b=this._toolBar.addBtn;
null!=b&&(b.className=this._ops.max==a?"addUn":"add");b=this._toolBar.delAllBtn;null!=b&&(b.className=0<a?"delAll":"delAllUn")},DataGrid.prototype._blankData=function(a){a=this._ops.data[a];var b,d;for(d in a)b=a[d],b instanceof Array?a[d].splice(0,b.length):a[d]=""},DataGrid.prototype._toolAddHandle=function(a,b,d){var c=this;a.onclick=function(){function a(b){!1!=b&&(!0==c._ops.hasSelBox&&(g.cells[0].innerHTML=""),!0==c._ops.hasID&&(g.cells[1].innerHTML=""),c._disableEditBtns(),c._flushBtn(),c._pageList(h,
1))}var f=c._table,h,g,l={},k=0;!0==c._eventStateSet("add")&&(c._ops.max==c._getDRL()?c._event.state="default":(c._content_delete_blank(),!0==c._ops.hasHead&&(k=1),g=f.insertRow(k),f=c._getDRL()-1,h=f+1,g.id="dataGridAdd",g.setAttribute("dataGridLastIndex",f),c._getBlankDataObj(l),c._fillEditRow(g,k,l),void 0!=b?!0==d?b(a):a(b()):a(!0)))}},DataGrid.prototype._getDomChildNode=function(a,b,d){a=a.childNodes;var c=[],e=0,f;f=b.split(" ");b=f[0];for(var h=f[1],g=0,l=a.length;g<l;g++)f=a[g],f.tagName.toLowerCase()==
b&&(void 0!=h&&f.type==h?(c[e]=f,e++):void 0==h&&(c[e]=f,e++));return void 0!=d?c[d]:c[0]},DataGrid.prototype._popUpcreateFuncSaveHandle=function(a,b,d,c){function e(c,e){var d,k,m=f._ops.popUpBar,p=f._ops.paging.num,s=f._pgList.page;if(!1!==c){for(d in e)h[d]=e[d];"add"==a?(d=f._table,k=d.rows.length,d=d.insertRow(k),b+1>s*p&&(d.style.display="none",f._pageList(k,s))):d=f._getEditTr();f._toolSaveHandle_stateChange(d,b);f._enableEditBtns();f._setEditTr(null);f._event.state="default";f._flushBtn();
"add"==a&&(f._state.isBlank=!1,f._resetID());$("#"+m.id)[0].style.top="-9999px"}else{m=!0;for(k in l)m=!1,g[b][k]=l[k];!0==m&&"add"==a&&g.splice(b,1)}}var f=this,h,g=this._ops.data,l={},k=this._ops.list,m;switch(f._eventStateGet()){case "default":return;case "edit":h=g[b];for(var p in k)m=k[p].name,void 0!=h[m]&&(l[m]=h[m]);break;case "add":h=g[b]={},f._getBlankDataObj(h)}"function"==typeof d?!0==c?d(a,b,e):e(d(a,b)):e(!0)},DataGrid.prototype._popUpcreateFunc=function(a,b){var d,c,e=this._ops.popUpBar,
f=this._ops.toolBar.asyn,h=$("#"+e.id+" div.tablePopUpToolBar")[0],g=e.save,l=e.cancel,k=$("#"+e.id+" div.tablePopUpToolBar input.btnA"),m=this;0==k.length?(d=k=document.createElement("input"),k.value=btn.gridCancel,k.type="button",k.className="btnA subBtnB",k.onclick=function(){function c(){$("#"+e.id)[0].style.top="-9999px";"add"==d&&(h=g.rows.length,h=!0==m._ops.hasHead?h-1:h,0==h&&(m._state.isBlank=!0,m._content_blank()));m._enableEditBtns();m._setEditTr(null);m._event.state="default";m._flushBtn()}
var d=m._eventStateGet(),g=m._table,h;"function"==typeof l?!0==f?l(a,b,c):(l(a,b),c()):c()},h.appendChild(k),$(d).parent().parent().find("#closeTip").bind("click",function(){$(d).trigger("click")}),c=k=document.createElement("input"),k.value=btn.save,k.type="button",k.className="btnA subBtn",h.appendChild(k),$.setTimeout(function(){$("#"+e.id).append("<iframe frameborder='0' class='bgIfm'></iframe>")},0)):c=k[1];c.onclick=function(){m._popUpcreateFuncSaveHandle(a,b,g,f)}},DataGrid.prototype._toolAddPopUpHandle=
function(a,b,d){var c=this;a.onclick=function(){var a;!0==c._eventStateSet("add")&&(c._ops.max==c._getDRL()?c._event.state="default":(c._content_delete_blank(),a=c._getDRL(),b("add",a),c._popUpcreateFunc("add",a),c._disableEditBtns(),c._flushBtn()))}},DataGrid.prototype._toolSaveHandle_Edit=function(a,b,d,c){return this._toolSaveHandle_SaveData(a,b,d,c)},DataGrid.prototype._toolSaveHandle_SaveData=function(a,b,d,c){var e=this._ops.list,f,h,g,l,k,m,p,n=0,q=!1,r,u;for(u in e)if(f=e[u],h=f.type,l=f.name,
k=this._pgList.ipAddrIdPre+d+this._ops.id+u,!0==this._ops.hasID&&n++,!0==this._ops.hasSelBox&&n++,!1!=f.edit){switch(h){case "ip":p=id(k);g=$.trim(p.value);if(ENONE!=(f=checkIp(g)))return{result:f,target:p};break;case "ips":m=l.split(" ");p=id(k+m[0]);if(ENONE!=(f=checkIp(p.value)))return{result:f,target:p};p=id(k+m[1]);if(ENONE!=(f=checkIp(p.value)))return{result:f,target:p};break;case "mask":p=id(k);g=$.trim(p.value);if(ENONE!=(f=checkMask(g)))return{result:f,target:p};break;case "dns":p=id(k);
g=$.trim(p.value);if(ENONE!=(f=checkIp(g)))return{result:f,target:p};break;case "gateway":p=id(k);g=$.trim(p.value);if(ENONE!=(f=checkIp(g)))return{result:f,target:p};break;case "mac":k=this._pgList.macAddrIdPre+d+this._ops.id+u;p=id(k);g=p.value;if(ENONE!=(f=checkMac(g)))return{result:f,target:p};break;case "popVig":g=a.cells[n];r=this._getDomChildNode(g,"span");g=null==r?"":parseInt(g.getAttribute(f.popObj.indexDes));break;case "path":g=a.cells[n];r=this._getDomChildNode(g,"span");g=null==r?"":
r.title;if(ENONE!=(f=checkPath(g)))return{result:f,target:r};break;case "select":case "selectApp":p=this._getDomChildNode(a.cells[n],"div");p=g=this._getDomChildNode(p,"span");g=g.value;break;case "checkbox":p=g=this._getDomChildNode(a.cells[n],"input checkbox");g=!0==g.checked?1:0;break;case "radio":p=g=this._getDomChildNode(a.cells[n],"input radio");g=!0==g.checked?1:0;break;case "ports":p=g=this._getDomChildNode(a.cells[n],"input");g=$.trim(g.value);break;default:p=g=this._getDomChildNode(a.cells[n],
"input"),g=g.value}if("ports"==h)if(m=l.split(" "),void 0!=b[m[0]]&&(c[m[0]]=b[m[0]],c[m[1]]=b[m[1]]),k=g.split("-"),2==k.length){k[0]!=k[0]&&(k[0]="");k[1]!=k[1]&&(k[1]="");if(0==k[0].length||0==k[1].length)return{result:EINVPORTFMT,target:p};0!=k[0].length&&!1==/\D/g.test(k[0])&&(k[0]=parseInt(k[0]));0!=k[1].length&&!1==/\D/g.test(k[1])&&(k[1]=parseInt(k[1]));if(k[0]!=b[m[0]]||k[1]!=b[m[1]])q=!0;b[m[0]]=k[0]>k[1]?k[1]:k[0];b[m[1]]=k[0]>k[1]?k[0]:k[1]}else if(1==k.length){k=k[0];k!=k&&(k="");0!=
k.length&&!1==/\D/g.test(k)&&(k=parseInt(k));if(k!=b[m[0]]||k!=b[m[1]])q=!0;b[m[1]]=b[m[0]]=k}else return{result:EINVPORTFMT,target:p};else"ips"==h?(h=id(k+m[0]).value,k=id(k+m[1]).value,void 0!=b[m[0]]&&(c[m[0]]=b[m[0]],c[m[1]]=b[m[1]]),b[m[0]]=h>k?k:h,b[m[1]]=h>k?h:k):(void 0!=b[l]&&(c[l]=b[l]),g!=b[l]&&(q=!0),b[l]=g)}return{result:ENONE,isChanged:q,target:p}},DataGrid.prototype._toolSaveHandle_Add=function(a,b,d){if(void 0!=a){var c=this._getTrIndex(a);this._state.isBlank=!1;return this._toolSaveHandle_SaveData(a,
b,c,d)}},DataGrid.prototype._toolSaveHandle_stateChange=function(a,b){var d,c;c=!0==this._ops.hasSelBox&&0<a.cells.length&&0!=a.cells[0].innerHTML.length;!0==c&&(d=a.cells[0].childNodes[0].getAttribute("checked"));this._trCleanCell(a);this._contentFill(a,this._ops.list,!0,b,this._ops.data[b],this._getDRL());!0==c&&changeCheckInput(a.cells[0].childNodes[0],d)},DataGrid.prototype._toolSaveHandle=function(a,b,d){var c=this,e,f,h,g,l,k=this._ops.data,m={};a.onclick=function(){function a(){var c=!0,b;
for(b in m)c=!1,k[h][b]=m[b];!0==c&&"add"==f&&k.splice(h,1)}function n(b){!1==b?a():(c._enableEditBtns(),c._setEditTr(null),c._toolSaveHandle_stateChange(g,h),c._event.state="default",g.id="","add"==f&&(c._resetID(),g.removeAttribute("dataGridLastIndex")))}e=c._eventStateGet();switch(e){case "default":return;case "edit":f="edit";g=c._getEditTr();h=c._getTrIndexInDataObj(g);m={};l=c._toolSaveHandle_Edit(g,k[h],c._getTrIndex(g),m);break;case "add":f="add",h=c._getDRL()-1,g=c._getEditTr(),k[h]=void 0==
k[h]?{}:k[h],m={},l=c._toolSaveHandle_Add(g,k[h],m)}if(l.result!=ENONE){switch(l.result){case EINVNET:showAlert(errStr.ipAddrNetErr,l.target);break;case EINVIP:showAlert(errStr.ipAddrErr,l.target);break;case EINVIPFMT:showAlert(errStr.ipAddrFmtErr,l.target);break;case EINVGROUPIP:showAlert(errStr.ipAddrGroupErr,l.target);break;case EINVLOOPIP:showAlert(errStr.ipAddrLoopErr,l.target);break;case EINVMACFMT:showAlert(errStr.macFmtErr,l.target);break;case EINVMACZERO:showAlert(errStr.macZeroErr,l.target);
break;case EINVMACBROAD:showAlert(errStr.macBroadErr,l.target);break;case EINVMACGROUP:showAlert(errStr.macGroupErr,l.target);break;case EINVMASK:showAlert(errStr.maskErr,l.target);break;case EINVPORTFMT:showAlert(errStr.portIllegalFmtErr,l.target);break;case EINVPATHNULL:showAlert(errStr.pathIsNull);break;case EINVPATH:showAlert(errStr.invalidPath)}a()}else"edit"==f&&!0!=l.isChanged?(c._toolSaveHandle_stateChange(g,h),c._event.state="default",g.id="",c._enableEditBtns(),c._setEditTr(null)):void 0!=
b?!0==d?b(f,h,n):n(b(f,h)):n(!0)}},DataGrid.prototype._toolSaveAllHandle=function(a,b,d){a.onclick=function(){void 0!=b&&b()}},DataGrid.prototype._toolDelHandle=function(a,b,d){var c=this;a.onclick=function(){function a(){function e(a){if(!1!=a){q=l.split("-");a=0;for(var b=r.length;a<b;a++)u=r[a],u-=a,f.deleteRow(u);for(a=q.length-1;0<=a;a--)s.splice(q[a],1);v=!0==c._ops.hasHead?h.length-1:h.length;c._state.isBlank=0<v?!1:!0;v="add"==c._eventStateGet()?v-1:v;a=c._ops.paging.num;z=c._pgList.page;
x=parseInt(v/a)+(0<v%a?1:0);y=z>x?x:z;c._pageList(v,y);!0==w&&(c._eventStateSet("default",!0),c._setEditTr(null));!0==c._ops.hasID&&c._resetID();c._flushBtn();c._IESixResize()}}void 0==b?e(!0):!0==d?b(l,e):e(b(l))}var f=c._table,h=c._table.rows,g,l="",k,m,p,n=h.length,q,r=[],u,y=0,x,s=c._ops.data,t=c._getTrIndex(c._getEditTr()),w=!1,v=0;p="";var z;if("delSelUn"!=this.className){k=!0==c._ops.hasHead?1:0;p=!0==c._ops.hasHead?-1:0;m=h.length-k;g="add"==c._eventStateGet()?-1:0;for(m+=g;k<n;k++)tr=h[k],
1!=h[k].cells.length&&(g=h[k].cells[0].childNodes[0],null!=g&&"true"==g.getAttribute("checked")&&(l+=k+p+"-",r.push(k),t==k&&(w=!0)));v=l.length;0!=v&&(l=l.substring(0,v-1),p=c._ops.cleanTip,0!=p.length&&void 0!=p&&m==l.split("-").length?showConfirm(p,function(c){!0==c&&a()}):a())}}},DataGrid.prototype._toolDownloadHandle=function(a,b,d){var c=this;a.onclick=function(){var a=c._table.rows,d,h="",g,l,k=a.length,m=[];c._getTrIndex(c._getEditTr());l=0;if("downloadUn"!=this.className){g=!0==c._ops.hasHead?
1:0;l=!0==c._ops.hasHead?-1:0;for(c._eventStateGet();g<k;g++)tr=a[g],1!=a[g].cells.length&&(d=a[g].cells[0].childNodes[0],null!=d&&"true"==d.getAttribute("checked")&&(h+=g+l+"-",m.push(g)));l=h.length;if(0!=l){a=c._toolBar.downloadBtn;null!=a&&(a.className="downloadUn");a=c._toolBar.stopDownloadBtn;null!=a&&(a.className="stopDownload");a=$.find("i.chObj");for(g=0;g<a.length;++g)a[g].onclick=function(){},a[g].style.cursor="default";h=h.substring(0,l-1);b(h)}}}},DataGrid.prototype._toolStopDownloadHandle=
function(a,b,d){var c=this;a.onclick=function(){var a;if("stopDownloadUn"!=this.className){a=c._toolBar.downloadBtn;null!=a&&(a.className="download");a=c._toolBar.stopDownloadBtn;null!=a&&(a.className="stopDownloadUn");a=$.find("i.chObj");a[0].onclick=function(){var a=this.getAttribute("disabled");!1!=c._checkSelectAllClickable()&&(null==a||"true"!=a.toString()&&"disabled"!=a.toString())&&("true"==this.getAttribute("checked").toString()?(this.className="chObj",this.setAttribute("checked",!1)):(this.className+=
" chObjCheck",this.setAttribute("checked",!0)),c._selectAll())};for(var d=1;d<a.length;++d)a[d].onclick=function(){c._singelSelHandle(this,c)},a[d].style.cursor="pointer";b()}}},DataGrid.prototype._toolCancelHandle=function(a,b){var d=this,c,e;a.onclick=function(){c=d._eventStateGet();table=d._table;switch(c){case "edit":tr=d._getEditTr();index=d._getTrIndexInDataObj(tr);d._toolSaveHandle_stateChange(tr,index);break;case "add":e=table.rows.length-1;table.deleteRow(!0==d._ops.hasHead?1:0);e=!0==d._ops.hasHead?
e-1:e;if(0==e){d._state.isBlank=!0;d._content_blank();break}d._pageList(e,1)}d._enableEditBtns();d._setEditTr(null);d._event.state="default";d._flushBtn()}},DataGrid.prototype._toolAbleHandle=function(a,b,d,c){var e=this;a.onclick=function(){function a(c){if(!1!=c){for(var b in g)if(k=g[b],"checkbox"==k.type&&!1==k.edit){m=k.name;n=b;break}if(void 0!=m){p=e._getListLen();for(c=0;c<p;c++)h[c][m]="enable"==d?1:0;p=l.length;!0==e._ops.hasID&&n++;for(b=!0==e._ops.hasHead?1:0;b<p;b++)q=e._getDomChildNode(l[b].cells[n],
"input checkbox"),q.checked="enable"==d?!0:!1}}}var h=e._ops.data,g=e._ops.list,l=e._table.rows,k,m,p=0,n,q;!0!=e._state.isBlank&&(void 0==b?a(!0):!0==c?b(d,a):a(b(d)))}},DataGrid.prototype._toolEnableHandle=function(a,b,d){this._toolAbleHandle(a,b,"enable",d)},DataGrid.prototype._toolDisableHandle=function(a,b,d){this._toolAbleHandle(a,b,"disable",d)},DataGrid.prototype._cleanAll=function(){var a=this._ops.data;this._blankData(0);a.splice(1,a.length-1);!0==this._state.isBlank;this._refresh(1);this._setEditTr(null);
this._event.state="default";this._flushBtn();this._pageList(0,1)},DataGrid.prototype._toolCleanHandle=function(a,b,d){var c=this;a.onclick=function(){function a(b){!0==b&&c._cleanAll()}var f,h;if(!0!=c._state.isBlank||"default"!=c._event.state)f=label.delAllConfirm,h=c._ops.cleanTip,void 0!=h&&0!=h.length&&(f=h),showConfirm(f,function(f){!1==c._state.isBlank||"add"!=c._event.state?!1!=f&&(void 0==b?a(!0):!0==d?b(a):a(b())):a(!0)})}},DataGrid.prototype._toolRefreshHandle=function(a,b,d){var c=this;
a.onclick=function(){function a(b){!0==b&&(c._cleanList(c._ops.id+"pagIngList"),c._refresh(1),c._setEditTr(null),c._event.state="default",c._flushBtn())}void 0!=b&&(!0==d?b(a):a(b()))}},DataGrid.prototype._toolEmailHandle=function(a,b,d){a.onclick=function(){void 0!=b&&b()}},DataGrid.prototype._toolClearAllHandle=function(a,b,d){var c=this;a.onclick=function(){function a(b){!1!=b&&(c._cleanList(c._ops.id+"pagIngList"),c._refresh(1),c._setEditTr(null),c._event.state="default",c._flushBtn())}void 0==
b&&a(!0);!0==d?b(a):a(b())}},DataGrid.prototype._toolClearSelHandle=function(a,b,d){var c=this;a.onclick=function(){function a(b){if(!1!=b){!0==c._ops.hasHead&&changeCheckInput(f[0].cells[0].childNodes[0].childNodes[0],!1);k=r.length;for(b=0;b<k;b++)s=r[b],!0==s.clear&&(x[s.name]={clear:!0,clearValue:s.clearValue});p=g.split("-");k=p.length;for(b=0;b<k;b++){t=q[b];for(var d in t)s=x[d],void 0!=s&&!0==s.clear&&(t[d]=s.clearValue)}k=n.length;l=1;l+=c._ops.hasID?1:0;for(b=0;b<k;b++)for(t=n[b],y=f[t].cells.length,
d=l;d<y;d++)s=x[r[d-l].name],void 0!=s&&!0==s.clear&&(u==t?f[t].cells[d].value=s.clearValue:f[t].cells[d].innerHTML=s.clearValue,changeCheckInput(f[t].cells[0].childNodes[0],!1));c._selectAll();c._flushBtn()}}var f=c._table.rows,h,g="",l,k,m=f.length,p,n=[],q=c._ops.data,r=c._ops.list,u=c._getTrIndex(c._getEditTr()),y=0,x={},s,t;if("clrUn"!=this.className){l=!0==c._ops.hasHead?1:0;k=f.length-l;h="add"==c._eventStateGet()?-1:0;k+=h;for(var w=l;w<m;w++)tr=f[w],1!=f[w].cells.length&&(t=f[w].cells[0].childNodes[0],
null!=t&&"true"==t.getAttribute("checked").toString()&&(g+=k-w-h+"-",n.push(w)));0!=g.length&&(g=g.substring(0,g.length-1),void 0==b?a(!0):!0==d?b(g,a):a(b(g)))}}},DataGrid.prototype._setToolBar=function(){var a=this._ops.toolBar,b,d,c,e,f,h;if(null!=a){b=$("#"+a.id+" li");for(var g=0,l=b.length;g<l;g++){c=b[g];f=c.innerHTML;d=c.getAttribute("gridType");e=a[d];h=a.asyn;switch(d){case "add":c.className="add";this._toolBar.addBtn=c;this._toolAddHandle(c,e,h);break;case "popUp":c.className="popUp";this._toolBar.addBtn=
c;this._toolAddPopUpHandle(c,e,h);break;case "save":this._toolSaveHandle(c,e,h);break;case "saveAll":c.className="add";this._toolSaveAllHandle(c,e,h);break;case "delAll":c.className="delAll";this._toolBar.delAllBtn=c;this._toolCleanHandle(c,e,h);break;case "delSel":c.className="delSelUn";this._toolBar.delSelBtn=c;this._toolDelHandle(c,e,h);break;case "cancel":this._toolCancelHandle(c,e);break;case "enable":this._toolEnableHandle(c,e,h);break;case "disable":this._toolDisableHandle(c,e,h);break;case "refresh":c.className=
"refresh";this._toolRefreshHandle(c,e,h);break;case "email":c.className="email";this._toolEmailHandle(c,e,h);break;case "clrSel":c.className="clrUn";this._toolBar.clrSelBtn=c;this._toolClearSelHandle(c,e,h);break;case "clrAll":c.className="clrEn";this._toolClearAllHandle(c,e,h);break;case "download":c.className="downloadUn";this._toolBar.downloadBtn=c;this._toolDownloadHandle(c,e,h);break;case "stopDownload":c.className="stopDownloadUn",this._toolBar.stopDownloadBtn=c,this._toolStopDownloadHandle(c,
e,h)}c.innerHTML="";d=el("input");d.value=f;d.type="button";c.appendChild(d)}}},DataGrid.prototype._getListLen=function(){var a=this._ops.list,b=this._ops.data,d=0,c,e=a[this._ops.checkIndex].name,a=this._types[a[this._ops.checkIndex].type],f;for(f in b){c=b[f][e];if(c===a||void 0===c||0==c.toString().length)break;d++}return d},DataGrid.prototype._content_delete_blank=function(){var a;!1!=this._ops.spBlank&&!0==this._state.isBlank&&(this._state.isBlank=!1,a=!0==this._ops.hasHead?1:0,this._table.deleteRow(a))},
DataGrid.prototype._content_blank=function(){var a,b=this._table;!1!=this._ops.spBlank&&(a=b.insertRow(-1),a=a.insertCell(-1),a.colSpan=this._state.colNum,!1==this._ops.hasHead&&setStyle(a,{width:b.offsetWidth+"px"}),a.style.textAlign="center",a.innerHTML=label.blankTable)},DataGrid.prototype._editable=function(){var a=this._ops.list,b;if(!1==this._ops.edit&&!1==this._ops.operate)return!1;if(!0==this._ops.edit)for(var d in a)if(b=a[d].edit,!0==b)return!0;if(!0==this._ops.operate)for(d in a)if(b=a[d].edit,
!0==b)return!0;return!1},DataGrid.prototype._timeHandle=function(a,b){if(4294967295==a)b.innerHTML=label.forever;else{var d=new Date;d.setHours(parseInt(a/3600),parseInt(a%3600/60),parseInt(a%3600%60),0);b.innerHTML=d.toTimeString().substring(0,8)}},DataGrid.prototype._timePHandle=function(a,b){if(4294967295==a)b.innerHTML=label.forever;else{var d,c,e;d=parseInt(a/3600);c=parseInt(a%3600/60);e=parseInt(a%3600%60);10>d&&(d="0"+d);10>c&&(c="0"+c);10>e&&(e="0"+e);b.innerHTML=d+":"+c+":"+e}},DataGrid.prototype._selectHandle=
function(a,b,d){var c=a.options;b=b[a.name];a=a.blankStr;if(void 0!=c[0].value)for(var e=0,f=c.length;e<f;e++){if(c[e].value==b){c=c[e].str;d.innerHTML=c==a?"":htmlEscape(c);break}}else c=c[b].str,d.innerHTML=c==a?"":htmlEscape(c)},DataGrid.prototype._strSelectHandle=function(a,b,d){var c=a.options;b=parseInt(b[a.name]);var e="",f;for(f in c)if(a=c[f],void 0!=a.value){if(b==parseInt(a.value)){e=a.str;break}}else if(b==f){e=a.str;break}d.innerHTML=htmlEscape(e)},DataGrid.prototype._checkBoxHandle=
function(a,b,d,c){var e=el("input"),f=b[a.name],h=b[a.checkDis];e.type="checkbox";e.checked=!0==f;void 0!=h&&(e.disabled=h);void 0!=a.func&&(e.onclick=function(d){d=d||window.event;var e=b[a.name];b[a.name]=!0==this.checked?1:0;!1==a.func(c,{obj:this})&&(b[a.name]=e,this.checked=1==e?!0:!1);stopProp(d)});d.appendChild(e)},DataGrid.prototype._radioHandle=function(a,b,d,c){var e=el("input"),f=b[a.name];e.type="radio";e.checked=!0==f;void 0!=a.func&&(e.onclick=function(d){d=b[a.name];b[a.name]=!0==this.checked?
1:0;!1==a.func(c,{obj:this})&&(b[a.name]=d,this.checked=1==d?!0:!1)});d.appendChild(e)},DataGrid.prototype._btnHandle=function(a,b,d,c){var e=a.subType,f=el("input"),h=this;f.type="button";f.value=a.value?a.value:"";if(void 0!=e)switch(e){case "bind":b=b[a.name];!0==b?(f.className=a.classNameUn,f.disabled=!0):f.className=a.className;f.onclick=function(){a.click(c,{obj:this})};break;case "radio":b=b[a.name];f.className=!0==b?a.className:a.classNameUn;f.onclick=function(){$("#"+h._ops.id+" input."+
a.className).attr("class",a.classNameUn);this.className=a.className;a.click(c,{obj:this})};f.onfocus=function(){this.blur()};break;case "switch":b=b[a.name],void 0==a.onStr&&void 0==a.offStr&&(a.onStr=label.SmbShareOpen,a.offStr=label.SmbShareClose),void 0==a.classNameUn&&(a.classNameUn=a.className),!0==b?(f.className=a.className,f.value=a.onStr):(f.className=a.classNameUn,f.value=a.offStr),f.onclick=function(){!0==a.click(c,{obj:this})&&(this.value==a.onStr?(this.className=a.classNameUn,this.value=
a.offStr):(this.className=a.className,this.value=a.onStr))}}else f.className=a.className,f.onclick=function(){a.click(c,{obj:this})};d.appendChild(f)},DataGrid.prototype._portsHandle=function(a,b,d){a=a.name.split(" ");d.innerHTML=b[a[1]]!=b[a[0]]?b[a[0]]+(0==b[a[1]].length?"":" - "+b[a[1]]):b[a[0]]},DataGrid.prototype._fileHandle=function(a,b,d,c){b=el("input");var e=el("span");b.type="file";setStyle(b,{width:"100%",height:"100%",position:"absolute",top:"0px",left:"0px",zIndex:"1",opacity:"0"});
b.onchange=function(){a.click(c,{obj:this})};e.innerHTML=a.value?a.value:"";e.className=a.className;d.style.position="relative";d.appendChild(b);d.appendChild(e)},DataGrid.prototype._ipsHandle=function(a,b,d){a=a.name.split(" ");d.innerHTML=b[a[1]]!=b[a[0]]?b[a[0]]+(0==b[a[1]].length?"":" - "+b[a[1]]):b[a[0]]},DataGrid.prototype._popVigHandle=function(a,b,d,c){b=b[a.name];var e=a.popObj,f;if(!/^\d+$/.test(b))for(f in e.subList)if(e.subList[f][".name"]==b){b=f;break}f=e.subList[b][e.name];a=this._calcShowSize(c,
a);f=void 0==f?"":f.toString();d.title=f;d.innerHTML=htmlEscape(getStrInMax(f,a))},DataGrid.prototype._pathHandle=function(a,b,d){a=b[a.name];d.innerHTML=htmlEscape(getStrInMax(a,32));d.title=a},DataGrid.prototype._signalHandle=function(a,b,d){var c=el("i"),e=el("i");a=parseInt(b[a.name]);c.className="signalCon";e.className="signal";a=!0==isNaN(a)?0:a;e.style.width=3*a+2*(a-1)+"px";c.appendChild(e);d.appendChild(c)},DataGrid.prototype._speedHandle=function(a,b,d){a=b[a.name];d.innerHTML=0==parseInt(a)?
label.disLimit:a+"KB/s"},DataGrid.prototype._trCleanCell=function(a){var b=a.cells.length;try{a.innerHTML=""}catch(d){for(;0<b;)a.deleteCell(0),b=a.cells.length}},DataGrid.prototype._trEdit=function(a){var b=this._ops.data,d=!1,c=-1;!0==this._ops.hasSelBox&&(d=a.cells[0].childNodes[0].getAttribute("checked"));this._trCleanCell(a);c=this._getTrIndexInDataObj(a);this._fillEditRow(a,this._getTrIndex(a),b[c]);!0==this._ops.hasSelBox&&changeCheckInput(a.cells[0].childNodes[0],d)},DataGrid.prototype._getTrIndex=
function(a){var b=this._table.rows,d=-1;if(null==a)return d;for(var c=!0==this._ops.hasHed?1:0,e=b.length;c<e;c++)if(a===b[c]){d=c;break}return d},DataGrid.prototype._disableEditBtns=function(){$("table.dataGrid i.edit").toggleClass("edit").toggleClass("unedit")},DataGrid.prototype._enableEditBtns=function(){$("table.dataGrid i.unedit").toggleClass("unedit").toggleClass("edit")},DataGrid.prototype._editBtnClick=function(a,b){var d=this;a.onclick=function(){var a,e,f,h=d._eventStateGet(),g=d._ops.toolBar.popUp;
switch(h){case "edit":if(!1==d._ops.spAutoEdit)return;break;case "default":break;default:return}e=this.parentNode;!0==b?(d._eventStateSet("edit"),!0==d._ops.spAutoEdit?(f=d._getEditTr(),a=d._getTrIndexInDataObj(f),-1!=a&&"default"!=h&&(d._trCleanCell(f),f.id="",d._contentFill(f,d._ops.list,!0,a,d._ops.data[a],d._getDRL()))):d._disableEditBtns(),"function"==typeof g?(a=d._getTrIndexInDataObj(e),d._setEditTr(e),g("edit",a,d._ops.data[a]),d._popUpcreateFunc("edit",a),!0==d._ops.operate&&(g("operate",
a,d._ops.data[a]),d._popUpcreateFunc("operate",a))):d._trEdit(e)):null!=d._ops.click&&d._ops.click(d._getTrIndexInDataObj(e))}},DataGrid.prototype._editBtnHandle=function(a,b,d){!0==this._ops.edit?a.innerHTML=null==this._ops.labelName?btn.edit:btn.details:!0==this._ops.operate&&(a.innerHTML=btn.viewVideo);this._editBtnClick(a,b);a.style.cursor="pointer"},DataGrid.prototype._singelSelHandle=function(a,b){var d,c,e,f,h,g=!0,l=!1;e=a.getAttribute("checked");if(!1!=b._ops.hasSelBox&&(d=a.getAttribute("disabled"),
null==d||"true"!=d.toString()&&"disabled"!=d.toString())){d=b._table.rows;c=d[0].cells[0].childNodes[0].childNodes[0];f=(b._pgList.page-1)*b._ops.paging.num+1;h=b._pgList.page*b._ops.paging.num+1>d.length?d.length:b._pgList.page*b._ops.paging.num+1;e="undefined"==typeof e?!0:"true"==e?!1:!0;changeCheckInput(a,e);for(!1==e&&(g=!1);f<h;f++)if(e=d[f],0!=e.cells[0].innerHTML.length){if(1==e.cells.length){changeCheckInput(c,!0);return}a=e.cells[0].childNodes[0];"none"!=e.style.display&&("false"==a.getAttribute("checked").toString()?
g=!1:l=!0)}changeCheckInput(c,g);this._toolSelBtnState(l)}},DataGrid.prototype._calcShowSize=function(a,b){var d;d=parseInt($(this._table).css("fontSize"));d=parseInt(this._state.headCells[a].width/(0.65*d));return d=void 0!=b.maxSize?b.maxSize:d},DataGrid.prototype._contentFill=function(a,b,d,c,e,f){var h,g;f=this._ops.head;var l=this,k,m;!0==this._ops.hasSelBox&&(h=a.insertCell(-1),g=document.createElement("i"),g.className="chObj",g.onclick=function(){l._singelSelHandle(this,l)},changeCheckInput(g,
!1),h.appendChild(g),setStyle(h,{textAlign:"center"}),h.style.textIndent="0",!1==this._ops.hasHead&&setStyle(h,{width:parseInt(this._set.selWidth,10)+"px"}));!0==this._ops.hasID&&(h=a.insertCell(-1),h.innerHTML=c+1,setStyle(h,{textAlign:"center"}),h.style.textIndent="0",!1==this._ops.hasHead&&setStyle(h,{width:parseInt(this._set.IDWidth.width,10)+"px"}));for(var p in b){var n=b[p];g=n.type;h=a.insertCell(-1);!1==this._ops.hasHead&&setStyle(h,{width:f[p].width+"px"});null!=n.tdStyles&&setStyle(h,n.tdStyles);
switch(g){case "file":this._fileHandle(n,e,h,c);break;case "btn":this._btnHandle(n,e,h,c);break;case "time":this._timeHandle(e[n.name],h);break;case "timeP":this._timePHandle(e[n.name],h);break;case "selectApp":case "select":this._selectHandle(n,e,h);break;case "checkbox":!1==n.edit&&this._checkBoxHandle(n,e,h,c);break;case "radio":!1==n.edit&&this._radioHandle(n,e,h,c);break;case "strSelect":this._strSelectHandle(n,e,h);break;case "ports":this._portsHandle(n,e,h);break;case "ips":this._ipsHandle(n,
e,h);break;case "speed":this._speedHandle(n,e,h);break;case "popVig":this._popVigHandle(n,e,h,p);break;case "path":this._pathHandle(n,e,h);break;case "signal":this._signalHandle(n,e,h);break;case "htmlStr":m=e[n.name];h.innerHTML=m;void 0!=e[n.name+"Title"]&&(h.title=e[n.name+"Title"]);void 0!=n.className&&(h.className=n.className);break;case "extern":if("function"==typeof n.romace){n.romace(h,c,e,n);break}case "strWrap":m=e[n.name];m=void 0==m?"":m.toString();"mac"==g?(h.innerHTML=k.toUpperCase(),
h.title=m.toUpperCase()):(h.innerHTML=m,h.title=m);void 0!=n.className&&(h.className=n.className);break;case "video":k=this._calcShowSize(p,n);m=e[n.name];m=void 0==m?"":m.toString();k=!0==n.igHTMLEscape?getStrInMax(m,k):htmlEscape(getStrInMax(m,k));h.innerHTML=k;h.title=m;h.className="video";void 0!=n.className&&(h.className=h.className+" "+n.className);if("function"==typeof n.click){var q=n.click;h.onclick=function(){q(c,{obj:this})}}break;default:k=this._calcShowSize(p,n),m=e[n.name],m=void 0==
m?"":m.toString(),k=!0==n.igHTMLEscape?getStrInMax(m,k):htmlEscape(getStrInMax(m,k)),"mac"==g?(h.innerHTML=k.toUpperCase(),h.title=m.toUpperCase()):(h.innerHTML=k,h.title=m),void 0!=n.className&&(h.className=n.className),"function"==typeof n.click&&(h.onclick=function(){n.click(c,{obj:this})})}}!0==this._ops.edit&&(h=a.insertCell(-1),setStyle(h,{textAlign:"center"}),h.style.textIndent="0",h.style.color=diffCss.dataGridEditableText,h.onmousedown=function(){h.style.color=diffCss.dataGridEditableTextMouseDown},
h.onmouseup=function(){h.style.color=diffCss.dataGridEditableText},this._editBtnHandle(h,d,c),!1==this._ops.hasHead&&setStyle(h,{width:parseInt(this._set.editWidth)+"px"}));!0==this._ops.operate&&(h=a.insertCell(-1),setStyle(h,{textAlign:"center"}),h.style.textIndent="0",h.style.color="#325FE0",this._editBtnHandle(h,d,c),!1==this._ops.hasHead&&setStyle(h,{width:parseInt(this._set.operateWidth)+"px"}))},DataGrid.prototype._refresh=function(a){for(var b=this._table,d=!0==this._ops.hasHead?1:0,c=d,e=
b.rows.length;c<e;c++)null!=b.rows[d]&&b.deleteRow(d);this._event.state="default";this._setEditTr(null);this._contentCreate(a);this._IESixResize()},DataGrid.prototype._contentCreate=function(a){var b=this._ops.list,d=this._ops.data,c,e=this._table,f=0,h=!1;c=this._ops.paging.num;var g,l=(a-1)*c,k;if(null!=b&&(!1!=this._ops.hasHead||null!=this._ops.head))if(f=this._getListLen(),0==f)this._state.isBlank=!0,this._content_blank(),this._cleanList(this._ops.id+"pagIngList");else{this._state.isBlank=!1;
h=this._editable();f=f>this._ops.max?this._ops.max:f;l=f-1-l;k=l-c+1||0;for(var m=0;m<f;m++)m>l||m<k?(c=e.insertRow(-1),c.insertCell(-1),c.style.display="none"):(g=d[m],c=e.insertRow(-1),this._contentFill(c,b,h,m,g,f));this._flushBtn();this._pageList(f,a)}},DataGrid.prototype._toolSelBtnState=function(a){var b;null!=this._ops.toolBar&&(b=this._toolBar.delSelBtn,null!=b&&(b.className=!0==a?"delSel":"delSelUn"),b=this._toolBar.clrSelBtn,null!=b&&(b.className=!0==a?"clrEn":"clrUn"),b=this._toolBar.downloadBtn,
null!=b&&(b.className=!0==a?"download":"downloadUn",b.id="download"))},DataGrid.prototype._selectAll=function(){var a=this._table.rows,b=a.length,d=a[0].cells[0].childNodes[0].childNodes[0].getAttribute("checked"),c,e,d=!0==this._ops.hasHead?d:!1;"string"==typeof d&&(d="true"==d?!0:!1);for(var f=!0==this._ops.hasHead?1:0;f<b;f++)e=a[f],1!=e.cells.length&&0!=e.cells.length&&(c=e.cells[0].childNodes[0],null!=c&&("none"!=e.style.display?changeCheckInput(c,d):changeCheckInput(c,!1)));a=0<this._getDRL()?
d:!1;this._toolSelBtnState(a)},DataGrid.prototype._checkSelectAllClickable=function(){var a=this._table.rows,b=0,d=!1;if(!0==this._ops.hasSelBox&&!1==this._state.isBlank){!0==this._ops.hasHead&&(b=1);for(var c=b,e=a.length;c<e;c++)if(b=a[c],"none"!=b.style.display&&void 0!=$(b.cells[0]).find("i.chObj")[0]){d=!0;break}}return d},DataGrid.prototype._selectAllCreate=function(a,b){var d=document.createElement("i"),c=this;d.type="checkbox";d.className="chObj";d.onclick=function(){var a=this.getAttribute("disabled");
!1!=c._checkSelectAllClickable()&&(null==a||"true"!=a.toString()&&"disabled"!=a.toString())&&("true"==this.getAttribute("checked").toString()?(this.className="chObj",this.setAttribute("checked",!1)):(this.className+=" chObjCheck",this.setAttribute("checked",!0)),c._selectAll())};changeCheckInput(d,!1);return d},DataGrid.prototype._headCreate=function(){var a=this._ops.head,b=this,d,c;c=this._table;var e,f=this._ops.list,h,g,l,k,m=this._state.headCells;h=0;var p=this._state.headWidth;if(!1!=this._ops.hasHead)if(null==
a)void 0!=c.rows[0]&&(this._state.colNum=c.rows[0].cells.length);else{d=c.insertRow(-1);d.className=this._ops.classCol.headClassName;this._state.colNum=this._ops.list.length;this._event.sortName=this._ops.sortName;e=parseInt(c.offsetWidth);!0==this._ops.hasSelBox&&(c=d.insertCell(-1),g=el("span"),g.className="tableHeadConSp",g.appendChild(this._selectAllCreate()),c.appendChild(g),setStyle(c,{width:parseInt(this._set.selWidth,10)+"px",textAlign:"center"}),g.style.textIndent="0",e-=parseInt(this._set.selWidth)+
1,this._state.colNum++);!0==this._ops.hasID&&(c=d.insertCell(-1),g=el("span"),g.className="tableHeadConSp",g.innerHTML=label.orderNumber,c.appendChild(g),setStyle(c,{width:parseInt(this._set.IDWidth,10)+"px",textAlign:"center"}),g.style.textIndent="0",e-=parseInt(this._set.IDWidth)+1,this._state.colNum++);!0==this._ops.edit&&(e-=parseInt(this._set.editWidth)+1);!0==this._ops.operate&&(e-=parseInt(this._set.operateWidth)+1);e-=a.length;for(var n in a)if("undefined"!=typeof a[n].sort){this._event.sortable=
!0;break}for(n in a){var q=a[n];l=f[n].name;c=d.insertCell(-1);setStyle(c,{padding:parseFloat(this._ops.headpadding)+"px"});"undefined"!=typeof q.width&&(h=parseInt(q.width/p*e),m[n]=void 0==m[n]?{}:m[n],m[n].width=h,setStyle(c,{width:h+"px"}));"string"==(typeof q.className).toLowerCase()&&(c.className=q.className);void 0==k&&(k=c.offsetHeight);!0==this._event.sortable?(h=el("div"),h.className="dataGridSortDiv",g=el("span"),g.className="tableHeadConSp",g.appendChild(h),c.appendChild(g),g=el("label"),
g.className=this._ops.sortName==l?"dataGridSortLbl dataGridSortLblHv":"dataGridSortLbl dataGridSortLblDe",g.style.lineHeight=k+"px",g.innerHTML=q.field,h.appendChild(g),g=el("i"),g.className=this._ops.sortName==l&&"up"==this._ops.sortType?"dataGridSortArrow dataGridSortUp":"dataGridSortArrow dataGridSortDown",g.style.display=this._ops.sortName==l?"inline-block":"none",g.sortType=this._ops.sortName==l?this._ops.sortType:"null",h.appendChild(g),g=el("p"),g.className=this._ops.sortName==l?"dataGridSortP dataGridSortPHv":
"dataGridSortP dataGridSortPDe",g.innerHTML="&nbsp;",h.appendChild(g)):(h=c,g=el("span"),g.className="tableHeadConSp",void 0!=q.fieldClass&&(g.className=g.className+" "+q.fieldClass),g.innerHTML=q.field,c.appendChild(g));"undefined"!=typeof q.sort&&(c.style.cursor="pointer",c.onclick=function(a){return function(){b._sort(this,a)}}(l),c.onmouseover=function(a){return function(){b._event.sortName!=a&&(this.id="DataGridSortHeadCellId",$("#DataGridSortHeadCellId p.dataGridSortP").css("backgroundColor",
"#86B157"),this.id="")}}(l),c.onmouseout=function(a){return function(){b._event.sortName!=a&&(this.id="DataGridSortHeadCellId",$("#DataGridSortHeadCellId p.dataGridSortP").css("backgroundColor","#E6E6E6"),this.id="")}}(l))}!0==this._ops.edit&&(c=d.insertCell(-1),g=el("span"),g.className="tableHeadConSp",c.appendChild(g),setStyle(c,{width:parseInt(this._set.editWidth)+"px",textAlign:"center"}),this._state.colNum++);!0==this._ops.operate&&(c=d.insertCell(-1),g=el("span"),g.className="tableHeadConSp",
c.appendChild(g),setStyle(c,{width:parseInt(this._set.operateWidth)+"px",textAlign:"center"}),this._state.colNum++)}},DataGrid.prototype._sort=function(a,b){var d=this._table,c=$("#"+d.id+" i.dataGridSortArrow"),e,f,h;a.id="DataGridSortHeadCellId";e=$("#DataGridSortHeadCellId i.dataGridSortArrow")[0];"null"==e.sortType||"up"==e.sortType?(f="down",h="dataGridSortArrow dataGridSortDown"):(f="up",h="dataGridSortArrow dataGridSortUp");if(null!=this._ops.sortFunc&&!1!=this._ops.sortFunc(b,f)){this._event.sortName=
b;$("#"+d.id+" p.dataGridSortP").css("backgroundColor","#E6E6E6");$("#"+d.id+" label.dataGridSortLbl").css("color","#737373");c.css("display","none");for(var g in c)c[g].sortType="null";$("#DataGridSortHeadCellId p.dataGridSortP").css("backgroundColor","#86B157");$("#DataGridSortHeadCellId label.dataGridSortLbl").css("color","#86B157");e.style.display="inline-block";e.sortType=f;e.className=h;a.id="";this._refresh(this._pgList.page)}},DataGrid.prototype._fillDefault=function(){var a=this._ops.list,
b,d;for(d in a)b=a[d],void 0==b.type&&(b.type="str"),void 0==b.edit&&(b.edit=!0),void 0==b.clear&&(b.clear=!1)},DataGrid.prototype._headWidthCol=function(){var a=this._ops.head,b=0,d;if(!1!=this._ops.hashead){for(var c in a)d=a[c].width,void 0!=d&&(b+=d);this._state.headWidth=b}},DataGrid.prototype._optionsInit=function(a){var b,d,c=this._set,e;for(e in a)if(b=a[e],d=this._ops[e],"undefined"!=typeof d)if("object"!=typeof b||b instanceof Array||null==d)this._ops[e]=b;else for(var f in b)d[f]=b[f];
for(e in c)d=a[e],"undefined"!=typeof d&&(c[e]=d);this._fillDefault();this._headWidthCol()},DataGrid.prototype._getTableObj=function(){this._table=this._ops.obj;null==this._table&&(this._table=id(this._ops.id));return this._table},DataGrid.prototype._tableSet=function(){var a=this._ops.classCol;0!=a.gridClassName.length&&(this._table.className=a.gridClassName);0!=a.ListSpanClassName.length&&(this._pgList.ListSpanClassName=a.ListSpanClassName);!0==this._ops.fixed&&setStyle(this._table,{tableLayout:"fixed"})},
DataGrid.prototype._IESixResize=function(){!0==isIESix&&"undefined"!=typeof highSetAutoFit&&highSetAutoFit()},DataGrid.prototype._pageList=function(a,b){var d=el("div"),c=this._ops.paging,e=this._ops.id+"pagIngList";b=void 0==b?1:b;b=1>b?1:b;0==this._pgList.id.length&&(this._pgList.id=d.id=e,d.className=this._ops.classCol.gridPageListClassName,$("div.tableBorderCon:has(#"+this._ops.id+")").after(d),this._pgList.obj=d,d.style.overflow="hidden");this._cleanList(e);this._fillList(e,b,c.num,this._ops.id,
a)},DataGrid.prototype._pageListGetNiceScrollTop=function(a){var b=getChildNode(this._ops.niceScroll.ta,"div",0);return getoffset(id(a),b).top},DataGrid.prototype._pageListNiceScrollTo=function(a){a=this._ops.niceScroll;var b;null!=a&&(b=parseInt(a.st.style.top),a._reset(),a.scrollTo(b*a.scH/a.sbcH+1))},DataGrid.prototype._changeTable=function(a,b){var d=this._table.rows,c=d.length,e=!0==this._ops.hasHead?a+1:a,f=!0==this._ops.hasHead?a:a-1,h=0,g=!1,l=this._ops.list,k=this._ops.data,g=this._editable(),
m=0,h=0,p,n;b=parseInt(b);this._pgList.page=parseInt(e/b)+1;m=!0==this._ops.hasHead?c-1:c;h="add"==this._eventStateGet()?-1:0;m+=h;p=!0==isIE?!0==isIENormal?"table-row":"block":"table-row";n=!0==this._ops.hasHead?-1:0;for(var q=!0==this._ops.hasHead?1:0;q<c;q++){var r=d[q];q<e||q>f+b?r.style.display="none":(1==r.cells.length&&(r.deleteCell(0),h=q+n,this._contentFill(r,l,g,h,k[h],m)),r.style.display=p)}!0==this._ops.hasSelBox&&(!0==this._ops.hasHead&&changeCheckInput(d[0].cells[0].childNodes[0].childNodes[0],
!1),this._selectAll());this._IESixResize()},DataGrid.prototype._changeListDiv=function(a,b){var d=19*id(a).childNodes.length,c=0;if(!0==isIESix){var e=$("#"+this._ops.id+"pagIngList div."+this._pgList.plcClassName)[0],c=d-(0<b?b:-1*b);e.style.width=96>c?c+"px":"96px"}},DataGrid.prototype._listNodeClick=function(a,b,d,c,e){d=b+this._pgList.listArrowRStr;var f=b+this._pgList.listArrowLStr,h=b+this._pgList.listArrowLastStr,g=b+this._pgList.listArrowFirstStr;b=id(b+this._pgList.listPageIndex);var l=b.innerHTML.split("/"),
k=l[0],m=parseInt(a)+1,l=l[1];if(a+1!=k||!0==e){for(e=0;e<l&&e+1!=k;e++);0==a?(id(f).disabled=!0,id(f).className="pageDisArrow pageArrowDisL",id(g).className="pageDisArrow pageArrowDisFi",id(d).disabled=!1,id(d).className="pageArrow pageArrowR",id(h).className="pageArrow pageArrowLa"):a==l-1?(id(f).disabled=!1,id(f).className="pageArrow pageArrowL",id(g).className="pageArrow pageArrowFi",id(d).disabled=!0,id(d).className="pageDisArrow pageArrowDisR",id(h).className="pageDisArrow pageArrowDisLa"):
(id(f).disabled=!1,id(f).className="pageArrow pageArrowL",id(g).className="pageArrow pageArrowFi",id(d).disabled=!1,id(d).className="pageArrow pageArrowR",id(h).className="pageArrow pageArrowLa");b.innerHTML=m+"/"+l;gotoPageIndexInput.value=m;this._changeTable(a*c,c)}},DataGrid.prototype._listMove=function(a,b,d,c){var e=a+this._pgList.listArrowRStr,f=a+this._pgList.listArrowLStr,h=a+this._pgList.listArrowLastStr,g=a+this._pgList.listArrowFirstStr;a=id(a+this._pgList.listPageIndex);var l=a.innerHTML.split("/");
d=l[0];var l=l[1],k=!0==b?1:-1,k=parseInt(d)+k,e=id(e),f=id(f),h=id(h),g=id(g);if(!(!0==b&&!0==e.disabled||!1==b&&!0==f.disabled)){for(var m=0;m<l;m++)if(m+1==d)return m==l-2&&b?(e.disabled=b,e.className="pageDisArrow pageArrowDisR",h.className="pageDisArrow pageArrowDisLa",f.disabled=!b,f.className="pageArrow pageArrowL",g.className="pageArrow pageArrowFi"):1!=m||b?(f.disabled=!1,f.className="pageArrow pageArrowL",g.className="pageArrow pageArrowFi",e.disabled=!1,e.className="pageArrow pageArrowR",
h.className="pageArrow pageArrowLa"):(e.disabled=b,e.className="pageArrow pageArrowR",h.className="pageArrow pageArrowLa",f.disabled=!b,f.className="pageDisArrow pageArrowDisL",g.className="pageDisArrow pageArrowDisFi"),a.innerHTML=k+"/"+l,gotoPageIndexInput.value=k,this._changeTable((k-1)*c,c),!0;clearSelection()}},DataGrid.prototype._fillList=function(a,b,d,c,e){var f=id(a),h=parseInt(e/d)+(0==e||0<e%d?1:0),g=id(c),l=this,k=0;if(e<=d){g=g.rows;id(a).style.display="none";f=!0==isIE?!0==isIENormal?
"table-row":"block":"table-row";e=0;for(k=g.length;e<k;e++)g[e].style.display=f;this._changeTable(0,d)}else{g=3;3<(parseInt(e/d)+1).toString().length&&(g=(parseInt(e/d)+1).toString().length);k=document.createElement("div");k.className="gotoPageBlock";var m=document.createElement("label");m.innerHTML=label.pagePrefix;m.className="gotoDesLbl";k.appendChild(m);var p=document.createElement("input");p.className="pageIndexInput";p.maxLength=g;p.id="gotoPageIndexInput";p.value=b;k.appendChild(p);m=document.createElement("label");
m.innerHTML=label.pagePostfix;m.className="pageDesLbl";k.appendChild(m);g=document.createElement("input");g.className="gotoPageBtn";g.value=btn.gotoPage;g.type="button";g.maxPageIndex=h;g.onclick=function(){var b=p.value,e=parseInt(b,10),f=this.maxPageIndex;0==b.length||!1==checkNum(b)||1>e?e=1:e>f&&(e=f);p.value=e;null!=l._ops.pageTurnFunc?l._ops.pageTurnFunc(e):l._listNodeClick(e-1,a,c,d)};k.appendChild(g);f.appendChild(k);id(a).style.display="block";k=document.createElement("span");k.className=
"pageArrow pageArrowLa";k.id=a+this._pgList.listArrowLastStr;k.onclick=function(){null!=l._ops.pageTurnFunc?b!=parseInt(h)&&l._ops.pageTurnFunc(parseInt(h)):l._listNodeClick(parseInt(h-1),a,c,d);l._pageListNiceScrollTo(a)};b==parseInt(h)&&(k.className="pageDisArrow pageArrowDisLa");f.appendChild(k);k=document.createElement("span");k.className="pageArrow pageArrowR";k.id=a+this._pgList.listArrowRStr;k.onclick=function(){if(null!=l._ops.pageTurnFunc){var b=l._pgList.page,b=b+(b==parseInt(h)?0:1);l._ops.pageTurnFunc(b)}else l._listMove(a,
!0,c,d);l._pageListNiceScrollTo(a)};b==parseInt(h)&&(k.className="pageDisArrow pageArrowDisR");f.appendChild(k);k=document.createElement("span");k.id=a+this._pgList.listPageIndex;k.className="pageIndex";k.innerHTML=b+"/"+h;f.appendChild(k);k=document.createElement("span");k.className="pageArrow pageArrowL";k.id=a+this._pgList.listArrowLStr;k.onclick=function(){if(null!=l._ops.pageTurnFunc){var b=l._pgList.page;l._ops.pageTurnFunc(b+(1==b?0:-1))}else l._listMove(a,!1,c,d)};1==b&&(k.className="pageDisArrow pageArrowDisL");
f.appendChild(k);k=document.createElement("span");k.className="pageArrow pageArrowFi";k.id=a+this._pgList.listArrowFirstStr;k.onclick=function(){null!=l._ops.pageTurnFunc?1!=b&&l._ops.pageTurnFunc(1):l._listNodeClick(0,a,c,d)};1==b&&(k.className="pageDisArrow pageArrowDisFi");f.appendChild(k);k=document.createElement("span");k.className="pageTotalNum";k.innerHTML=label.total+e+label.listNum;f.appendChild(k);this._listNodeClick(b-1,a,c,d,!0)}clearSelection()},DataGrid.prototype._cleanList=function(a){a=
id(a);null!=a&&(a.innerHTML="")})};
