1
2
3
4
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
/*
* jqGrid 3.8.2 - jQuery Grid
* Copyright (c) 2008, Tony Tomov, tony@trirand.com
* Dual licensed under the MIT and GPL licenses
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
* Date:2010-12-14
* Modules: grid.base.js; grid.custom.js; grid.postext.js; grid.jqueryui.js;
*/
(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(f){if(f==" "||f==" "||f.length==1&&f.charCodeAt(0)==160)return"";return!f?f:String(f).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"')},htmlEncode:function(f){return!f?f:String(f).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\"/g,""")},format:function(f){var j=b.makeArray(arguments).slice(1);if(f===undefined)f="";return f.replace(/\{(\d+)\}/g,function(i,
c){return j[c]})},getCellIndex:function(f){f=b(f);if(f.is("tr"))return-1;f=(!f.is("td")&&!f.is("th")?f.closest("td,th"):f)[0];if(b.browser.msie)return b.inArray(f,f.parentNode.cells);return f.cellIndex},stripHtml:function(f){f+="";var j=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(f)return(f=f.replace(j,""))&&f!==" "&&f!==" "?f.replace(/\"/g,"'"):"";else return f},stringToDoc:function(f){var j;if(typeof f!=="string")return f;try{j=(new DOMParser).parseFromString(f,"text/xml")}catch(i){j=new ActiveXObject("Microsoft.XMLDOM");
j.async=false;j.loadXML(f)}return j&&j.documentElement&&j.documentElement.tagName!="parsererror"?j:null},parse:function(f){f=f;if(f.substr(0,9)=="while(1);")f=f.substr(9);if(f.substr(0,2)=="/*")f=f.substr(2,f.length-4);f||(f="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(f):eval("("+f+")")},parseDate:function(f,j){var i={m:1,d:1,y:1970,h:0,i:0,s:0},c,e,k;if(j&&j!==null&&j!==undefined){j=b.trim(j);j=j.split(/[\\\/:_;.\t\T\s-]/);f=f.split(/[\\\/:_;.\t\T\s-]/);
var n=b.jgrid.formatter.date.monthNames,a=b.jgrid.formatter.date.AmPm,r=function(t,B){if(t===0){if(B==12)B=0}else if(B!=12)B+=12;return B};c=0;for(e=f.length;c<e;c++){if(f[c]=="M"){k=b.inArray(j[c],n);if(k!==-1&&k<12)j[c]=k+1}if(f[c]=="F"){k=b.inArray(j[c],n);if(k!==-1&&k>11)j[c]=k+1-12}if(f[c]=="a"){k=b.inArray(j[c],a);if(k!==-1&&k<2&&j[c]==a[k]){j[c]=k;i.h=r(j[c],i.h)}}if(f[c]=="A"){k=b.inArray(j[c],a);if(k!==-1&&k>1&&j[c]==a[k]){j[c]=k-2;i.h=r(j[c],i.h)}}if(j[c]!==undefined)i[f[c].toLowerCase()]=
parseInt(j[c],10)}i.m=parseInt(i.m,10)-1;f=i.y;if(f>=70&&f<=99)i.y=1900+i.y;else if(f>=0&&f<=69)i.y=2E3+i.y}return new Date(i.y,i.m,i.d,i.h,i.i,i.s,0)},jqID:function(f){f+="";return f.replace(/([\.\:\[\]])/g,"\\$1")},getAccessor:function(f,j){var i,c,e,k;if(typeof j==="function")return j(f);i=f[j];if(i===undefined)try{if(typeof j==="string")e=j.split(".");if(k=e.length)for(i=f;i&&k--;){c=e.shift();i=i[c]}}catch(n){}return i},ajaxOptions:{},from:function(f){return new (function(j,i){if(typeof j=="string")j=
b.data(j);var c=this,e=j,k=true,n=false,a=i,r=/[\$,%]/g,t=null,B=null,F=false,S="",J=[],N=true;if(typeof j=="object"&&j.push){if(j.length>0)N=typeof j[0]!="object"?false:true}else throw"data provides is not an array";this._hasData=function(){return e===null?false:e.length===0?false:true};this._getStr=function(l){var m=[];n&&m.push("jQuery.trim(");m.push("String("+l+")");n&&m.push(")");k||m.push(".toLowerCase()");return m.join("")};this._strComp=function(l){return typeof l=="string"?".toString()":
""};this._group=function(l,m){return{field:l.toString(),unique:m,items:[]}};this._toStr=function(l){if(n)l=b.trim(l);k||(l=l.toLowerCase());return l=l.toString().replace(new RegExp('\\"',"g"),'\\"')};this._funcLoop=function(l){var m=[];b.each(e,function(q,A){m.push(l(A))});return m};this._append=function(l){if(a===null)a="";else a+=S===""?" && ":S;if(F)a+="!";a+="("+l+")";F=false;S=""};this._setCommand=function(l,m){t=l;B=m};this._resetNegate=function(){F=false};this._repeatCommand=function(l,m){if(t===
null)return c;if(l!=null&&m!=null)return t(l,m);if(B===null)return t(l);if(!N)return t(l);return t(B,l)};this._equals=function(l,m){return c._compare(l,m,1)===0};this._compare=function(l,m,q){if(q===undefined)q=1;if(l===undefined)l=null;if(m===undefined)m=null;if(l===null&&m===null)return 0;if(l===null&&m!==null)return 1;if(l!==null&&m===null)return-1;if(!k&&typeof l!=="number"&&typeof m!=="number"){l=String(l).toLowerCase();m=String(m).toLowerCase()}if(l<m)return-q;if(l>m)return q;return 0};this._performSort=
function(){if(J.length!==0)e=c._doSort(e,0)};this._doSort=function(l,m){var q=J[m].by,A=J[m].dir,u=J[m].type,I=J[m].datefmt;if(m==J.length-1)return c._getOrder(l,q,A,u,I);m++;l=c._getGroup(l,q,A,u,I);q=[];for(A=0;A<l.length;A++){u=c._doSort(l[A].items,m);for(I=0;I<u.length;I++)q.push(u[I])}return q};this._getOrder=function(l,m,q,A,u){var I=[],U=[],$=q=="a"?1:-1,P,aa;if(A===undefined)A="text";aa=A=="float"||A=="number"||A=="currency"||A=="numeric"?function(L){L=parseFloat(String(L).replace(r,""));
return isNaN(L)?0:L}:A=="int"||A=="integer"?function(L){return L?parseFloat(String(L).replace(r,"")):0}:A=="date"||A=="datetime"?function(L){return b.jgrid.parseDate(u,L).getTime()}:b.isFunction(A)?A:function(L){L||(L="");return b.trim(String(L).toUpperCase())};b.each(l,function(L,da){P=m!==""?b.jgrid.getAccessor(da,m):da;if(P===undefined)P="";P=aa(P,da);U.push({vSort:P,index:L})});U.sort(function(L,da){L=L.vSort;da=da.vSort;return c._compare(L,da,$)});A=0;for(var ea=l.length;A<ea;){q=U[A].index;
I.push(l[q]);A++}return I};this._getGroup=function(l,m,q,A,u){var I=[],U=null,$=null,P;b.each(c._getOrder(l,m,q,A,u),function(aa,ea){P=b.jgrid.getAccessor(ea,m);if(P===undefined)P="";if(!c._equals($,P)){$=P;U!=null&&I.push(U);U=c._group(m,P)}U.items.push(ea)});U!=null&&I.push(U);return I};this.ignoreCase=function(){k=false;return c};this.useCase=function(){k=true;return c};this.trim=function(){n=true;return c};this.noTrim=function(){n=false;return c};this.combine=function(l){var m=b.from(e);k||m.ignoreCase();
n&&m.trim();l=l(m).showQuery();c._append(l);return c};this.execute=function(){var l=a,m=[];if(l===null)return c;b.each(e,function(){eval(l)&&m.push(this)});e=m;return c};this.data=function(){return e};this.select=function(l){c._performSort();if(!c._hasData())return[];c.execute();if(b.isFunction(l)){var m=[];b.each(e,function(q,A){m.push(l(A))});return m}return e};this.hasMatch=function(){if(!c._hasData())return false;c.execute();return e.length>0};this.showQuery=function(l){var m=a;if(m===null)m=
"no query found";if(b.isFunction(l)){l(m);return c}return m};this.andNot=function(l,m,q){F=!F;return c.and(l,m,q)};this.orNot=function(l,m,q){F=!F;return c.or(l,m,q)};this.not=function(l,m,q){return c.andNot(l,m,q)};this.and=function(l,m,q){S=" && ";if(l===undefined)return c;return c._repeatCommand(l,m,q)};this.or=function(l,m,q){S=" || ";if(l===undefined)return c;return c._repeatCommand(l,m,q)};this.isNot=function(l){F=!F;return c.is(l)};this.is=function(l){c._append("this."+l);c._resetNegate();
return c};this._compareValues=function(l,m,q,A,u){var I;I=N?"this."+m:"this";if(q===undefined)q=null;q=q===null?m:q;switch(u.stype===undefined?"text":u.stype){case "int":case "integer":q=isNaN(Number(q))?"0":q;I="parseInt("+I+",10)";q="parseInt("+q+",10)";break;case "float":case "number":case "numeric":q=String(q).replace(r,"");q=isNaN(Number(q))?"0":q;I="parseFloat("+I+")";q="parseFloat("+q+")";break;case "date":case "datetime":q=String(b.jgrid.parseDate(u.newfmt||"Y-m-d",q).getTime());I='jQuery.jgrid.parseDate("'+
u.srcfmt+'",'+I+").getTime()";break;default:I=c._getStr(I);q=c._getStr('"'+c._toStr(q)+'"')}c._append(I+" "+A+" "+q);c._setCommand(l,m);c._resetNegate();return c};this.equals=function(l,m,q){return c._compareValues(c.equals,l,m,"==",q)};this.greater=function(l,m,q){return c._compareValues(c.greater,l,m,">",q)};this.less=function(l,m,q){return c._compareValues(c.less,l,m,"<",q)};this.greaterOrEquals=function(l,m,q){return c._compareValues(c.greaterOrEquals,l,m,">=",q)};this.lessOrEquals=function(l,
m,q){return c._compareValues(c.lessOrEquals,l,m,"<=",q)};this.startsWith=function(l,m){var q=m===undefined||m===null?l:m;q=n?b.trim(q.toString()).length:q.toString().length;if(N)c._append(c._getStr("this."+l)+".substr(0,"+q+") == "+c._getStr('"'+c._toStr(m)+'"'));else{q=n?b.trim(m.toString()).length:m.toString().length;c._append(c._getStr("this")+".substr(0,"+q+") == "+c._getStr('"'+c._toStr(l)+'"'))}c._setCommand(c.startsWith,l);c._resetNegate();return c};this.endsWith=function(l,m){var q=m===undefined||
m===null?l:m;q=n?b.trim(q.toString()).length:q.toString().length;N?c._append(c._getStr("this."+l)+".substr("+c._getStr("this."+l)+".length-"+q+","+q+') == "'+c._toStr(m)+'"'):c._append(c._getStr("this")+".substr("+c._getStr("this")+'.length-"'+c._toStr(l)+'".length,"'+c._toStr(l)+'".length) == "'+c._toStr(l)+'"');c._setCommand(c.endsWith,l);c._resetNegate();return c};this.contains=function(l,m){N?c._append(c._getStr("this."+l)+'.indexOf("'+c._toStr(m)+'",0) > -1'):c._append(c._getStr("this")+'.indexOf("'+
c._toStr(l)+'",0) > -1');c._setCommand(c.contains,l);c._resetNegate();return c};this.groupBy=function(l,m,q,A){if(!c._hasData())return null;return c._getGroup(e,l,m,q,A)};this.orderBy=function(l,m,q,A){m=m===undefined||m===null?"a":b.trim(m.toString().toLowerCase());if(q===null||q===undefined)q="text";if(A===null||A===undefined)A="Y-m-d";if(m=="desc"||m=="descending")m="d";if(m=="asc"||m=="ascending")m="a";J.push({by:l,dir:m,type:q,datefmt:A});return c};return c})(f,null)},extend:function(f){b.extend(b.fn.jqGrid,
f);this.no_legacy_api||b.fn.extend(f)}});b.fn.jqGrid=function(f){if(typeof f=="string"){var j=b.jgrid.getAccessor(b.fn.jqGrid,f);if(!j)throw"jqGrid - No such method: "+f;var i=b.makeArray(arguments).slice(1);return j.apply(this,i)}return this.each(function(){if(!this.grid){var c=b.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],
savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,
hiddengrid:false,postData:{},userData:{},treeGrid:false,treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,
scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],
groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,sortitems:[],sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{}},b.jgrid.defaults,f||{}),e={headers:[],cols:[],footers:[],dragStart:function(d,g,h){this.resizing={idx:d,startX:g.clientX,sOL:h[0]};this.hDiv.style.cursor="col-resize";this.curGbox=b("#rs_m"+c.id,"#gbox_"+c.id);this.curGbox.css({display:"block",left:h[0],
top:h[1],height:h[2]});b.isFunction(c.resizeStart)&&c.resizeStart.call(this,g,d);document.onselectstart=function(){return false}},dragMove:function(d){if(this.resizing){var g=d.clientX-this.resizing.startX;d=this.headers[this.resizing.idx];var h=c.direction==="ltr"?d.width+g:d.width-g,o;if(h>33){this.curGbox.css({left:this.resizing.sOL+g});if(c.forceFit===true){o=this.headers[this.resizing.idx+c.nv];g=c.direction==="ltr"?o.width-g:o.width+g;if(g>33){d.newWidth=h;o.newWidth=g}}else{this.newWidth=c.direction===
"ltr"?c.tblwidth+g:c.tblwidth-g;d.newWidth=h}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var d=this.resizing.idx,g=this.headers[d].newWidth||this.headers[d].width;g=parseInt(g,10);this.resizing=false;b("#rs_m"+c.id).css("display","none");c.colModel[d].width=g;this.headers[d].width=g;this.headers[d].el.style.width=g+"px";this.cols[d].style.width=g+"px";if(this.footers.length>0)this.footers[d].style.width=g+"px";if(c.forceFit===true){g=this.headers[d+c.nv].newWidth||this.headers[d+
c.nv].width;this.headers[d+c.nv].width=g;this.headers[d+c.nv].el.style.width=g+"px";this.cols[d+c.nv].style.width=g+"px";if(this.footers.length>0)this.footers[d+c.nv].style.width=g+"px";c.colModel[d+c.nv].width=g}else{c.tblwidth=this.newWidth||c.tblwidth;b("table:first",this.bDiv).css("width",c.tblwidth+"px");b("table:first",this.hDiv).css("width",c.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(c.footerrow){b("table:first",this.sDiv).css("width",c.tblwidth+"px");this.sDiv.scrollLeft=
this.bDiv.scrollLeft}}b.isFunction(c.resizeStop)&&c.resizeStop.call(this,g,d)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){e.timer&&clearTimeout(e.timer);e.timer=null;var d=b(e.bDiv).height();if(d){var g=b("table:first",e.bDiv),h=b("> tbody > tr:gt(0):visible:first",g).outerHeight()||e.prevRowHeight;if(h){e.prevRowHeight=h;var o=c.rowNum,p=e.scrollTop=e.bDiv.scrollTop,x=Math.round(g.position().top)-p,w=x+g.height();h=h*o;var C,G,s;if(w<d&&x<=0&&(c.lastpage===
undefined||parseInt((w+p+h-1)/h,10)<=c.lastpage)){G=parseInt((d-w+h-1)/h,10);if(w>=0||G<2||c.scroll===true){C=Math.round((w+p)/h)+1;x=-1}else x=1}if(x>0){C=parseInt(p/h,10)+1;G=parseInt((p+d)/h,10)+2-C;s=true}if(G)if(!(c.lastpage&&C>c.lastpage||c.lastpage==1))if(e.hDiv.loading)e.timer=setTimeout(e.populateVisible,c.scrollTimeout);else{c.page=C;if(s){e.selectionPreserver(g[0]);e.emptyRows(e.bDiv,false)}e.populate(G)}}}},scrollGrid:function(){if(c.scroll){var d=e.bDiv.scrollTop;if(e.scrollTop===undefined)e.scrollTop=
0;if(d!=e.scrollTop){e.scrollTop=d;e.timer&&clearTimeout(e.timer);e.timer=setTimeout(e.populateVisible,c.scrollTimeout)}}e.hDiv.scrollLeft=e.bDiv.scrollLeft;if(c.footerrow)e.sDiv.scrollLeft=e.bDiv.scrollLeft},selectionPreserver:function(d){var g=d.p,h=g.selrow,o=g.selarrrow?b.makeArray(g.selarrrow):null,p=d.grid.bDiv.scrollLeft,x=g.gridComplete;g.gridComplete=function(){g.selrow=null;g.selarrrow=[];if(g.multiselect&&o&&o.length>0)for(var w=0;w<o.length;w++)o[w]!=h&&b(d).jqGrid("setSelection",o[w],
false);h&&b(d).jqGrid("setSelection",h,false);d.grid.bDiv.scrollLeft=p;g.gridComplete=x;g.gridComplete&&x()}}};if(this.tagName!="TABLE")alert("Element is not a table");else{b(this).empty();this.p=c;var k,n,a,r;if(this.p.colNames.length===0)for(k=0;k<this.p.colModel.length;k++)this.p.colNames[k]=this.p.colModel[k].label||this.p.colModel[k].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);else{var t=b("<div class='ui-jqgrid-view'></div>"),B,F=b.browser.msie?true:false,
S=b.browser.safari?true:false;a=this;a.p.direction=b.trim(a.p.direction.toLowerCase());if(b.inArray(a.p.direction,["ltr","rtl"])==-1)a.p.direction="ltr";n=a.p.direction;b(t).insertBefore(this);b(this).appendTo(t).removeClass("scroll");var J=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(J).insertBefore(t).attr({id:"gbox_"+this.id,dir:n});b(t).appendTo(J).attr("id","gview_"+this.id);B=F&&b.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':
"";b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(B).insertBefore(t);b("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(t);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var N=function(d,g){d=parseInt(d,10);return isNaN(d)?g?g:0:d},l=function(d,g,h){var o=a.p.colModel[d],p=o.align,x='style="',
w=o.classes,C=o.name;if(p)x+="text-align:"+p+";";if(o.hidden===true)x+="display:none;";if(g===0)x+="width: "+e.headers[d].width+"px;";x+='"'+(w!==undefined?' class="'+w+'"':"")+(o.title&&h?' title="'+b.jgrid.stripHtml(h)+'"':"");x+=' aria-describedby="'+a.p.id+"_"+C+'"';return x},m=function(d){return d===undefined||d===null||d===""?" ":a.p.autoencode?b.jgrid.htmlEncode(d):d+""},q=function(d,g,h,o,p){var x=a.p.colModel[h];if(typeof x.formatter!=="undefined"){d={rowId:d,colModel:x,gid:a.p.id,pos:h};
g=b.isFunction(x.formatter)?x.formatter.call(a,g,d,o,p):b.fmatter?b.fn.fmatter(x.formatter,g,d,o,p):m(g)}else g=m(g);return g},A=function(d,g,h,o,p){d=q(d,g,h,p,"add");return'<td role="gridcell" '+l(h,o,d)+">"+d+"</td>"},u=function(d,g,h){d='<input role="checkbox" type="checkbox" id="jqg_'+a.p.id+"_"+d+'" class="cbox" name="jqg_'+a.p.id+"_"+d+'"/>';return'<td role="gridcell" '+l(g,h,"")+">"+d+"</td>"},I=function(d,g,h,o){h=(parseInt(h,10)-1)*parseInt(o,10)+1+g;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+
l(d,g,"")+">"+h+"</td>"},U=function(d){var g,h=[],o=0,p;for(p=0;p<a.p.colModel.length;p++){g=a.p.colModel[p];if(g.name!=="cb"&&g.name!=="subgrid"&&g.name!=="rn"){h[o]=d=="local"?g.name:d=="xml"?g.xmlmap||g.name:g.jsonmap||g.name;o++}}return h},$=function(d){var g=a.p.remapColumns;if(!g||!g.length)g=b.map(a.p.colModel,function(h,o){return o});if(d)g=b.map(g,function(h){return h<d?null:h-d});return g},P=function(d,g){if(a.p.deepempty)b("#"+a.p.id+" tbody:first tr:gt(0)").remove();else{var h=b("#"+a.p.id+
" tbody:first tr:first")[0];b("#"+a.p.id+" tbody:first").empty().append(h)}if(g&&a.p.scroll){b(">div:first",d).css({height:"auto"}).children("div:first").css({height:0,display:"none"});d.scrollTop=0}},aa=function(){var d=a.p.data.length,g,h,o;g=a.p.rownumbers===true?1:0;h=a.p.multiselect===true?1:0;o=a.p.subGrid===true?1:0;g=a.p.keyIndex===false||a.p.loadonce===true?a.p.localReader.id:a.p.colModel[a.p.keyIndex+h+o+g].name;for(h=0;h<d;h++){o=b.jgrid.getAccessor(a.p.data[h],g);a.p._index[o]=h}},ea=
function(d,g,h,o,p){var x=new Date,w=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="xmlstring",C,G=a.p.datatype=="local"?"local":"xml";if(w){a.p.data=[];a.p._index={};a.p.localReader.id=C="_id_"}a.p.reccount=0;if(b.isXMLDoc(d)){if(a.p.treeANode===-1&&!a.p.scroll){P(g,false);h=1}else h=h>1?h:1;var s,v=0,y,D,K=0,H=0,E=0,Q,z=[],W,T={},O,M,X=[],na=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(z=U(G));Q=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;if(z.length>0&&!isNaN(Q)){if(a.p.remapColumns&&
a.p.remapColumns.length)Q=b.inArray(Q,a.p.remapColumns);Q=z[Q]}G=(Q+"").indexOf("[")===-1?z.length?function(ca,Y){return b(Q,ca).text()||Y}:function(ca,Y){return b(a.p.xmlReader.cell,ca).eq(Q).text()||Y}:function(ca,Y){return ca.getAttribute(Q.replace(/[\[\]]/g,""))||Y};a.p.userData={};b(a.p.xmlReader.page,d).each(function(){a.p.page=this.textContent||this.text||0});b(a.p.xmlReader.total,d).each(function(){a.p.lastpage=this.textContent||this.text;if(a.p.lastpage===undefined)a.p.lastpage=1});b(a.p.xmlReader.records,
d).each(function(){a.p.records=this.textContent||this.text||0});b(a.p.xmlReader.userdata,d).each(function(){a.p.userData[this.getAttribute("name")]=this.textContent||this.text});(d=b(a.p.xmlReader.root+" "+a.p.xmlReader.row,d))||(d=[]);var fa=d.length,Z=0;if(d&&fa){var ga=parseInt(a.p.rowNum,10),qa=a.p.scroll?(parseInt(a.p.page,10)-1)*ga+1:1;if(p)ga*=p+1;p=b.isFunction(a.p.afterInsertRow);var ha={},xa="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true)xa=' style="display:none;"';for(;Z<fa;){O=
d[Z];M=G(O,qa+Z);s=h===0?0:h+1;s=(s+Z)%2==1?na:"";X.push("<tr"+xa+' id="'+M+'" role="row" class ="ui-widget-content jqgrow ui-row-'+a.p.direction+""+s+'">');if(a.p.rownumbers===true){X.push(I(0,Z,a.p.page,a.p.rowNum));E=1}if(a.p.multiselect===true){X.push(u(M,E,Z));K=1}if(a.p.subGrid===true){X.push(b(a).jqGrid("addSubGridCell",K+E,Z+h));H=1}if(a.p.xmlReader.repeatitems){W||(W=$(K+H+E));var Ba=b(a.p.xmlReader.cell,O);b.each(W,function(ca){var Y=Ba[this];if(!Y)return false;y=Y.textContent||Y.text;T[a.p.colModel[ca+
K+H+E].name]=y;X.push(A(M,y,ca+K+H+E,Z+h,O))})}else for(s=0;s<z.length;s++){y=b(z[s],O).text();T[a.p.colModel[s+K+H+E].name]=y;X.push(A(M,y,s+K+H+E,Z+h,O))}X.push("</tr>");if(a.p.grouping){s=a.p.groupingView.groupField.length;D=[];for(var ya=0;ya<s;ya++)D.push(T[a.p.groupingView.groupField[ya]]);ha=b(a).jqGrid("groupingPrepare",X,D,ha,T);X=[]}if(w){T[C]=M;a.p.data.push(T)}if(a.p.gridview===false){if(a.p.treeGrid===true){s=a.p.treeANode>-1?a.p.treeANode:0;D=b(X.join(""))[0];b(a.rows[Z+s]).after(D);
try{b(a).jqGrid("setTreeNode",T,D)}catch(Ia){}}else b("tbody:first",g).append(X.join(""));if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-1],K+E)}catch(Ja){}p&&a.p.afterInsertRow.call(a,M,T,O);X=[]}T={};v++;Z++;if(v==ga)break}}if(a.p.gridview===true)if(a.p.grouping){b(a).jqGrid("groupingRender",ha,a.p.colModel.length);ha=null}else b("tbody:first",g).append(X.join(""));a.p.totaltime=new Date-x;if(v>0)if(a.p.records===0)a.p.records=fa;X=null;if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=
0;a.p.reccount=v;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(w){a.p.records=fa;a.p.lastpage=Math.ceil(fa/ga)}o||a.updatepager(false,true);if(w){for(;v<fa;){O=d[v];M=G(O,v);if(a.p.xmlReader.repeatitems){W||(W=$(K+H+E));var Ea=b(a.p.xmlReader.cell,O);b.each(W,function(ca){var Y=Ea[this];if(!Y)return false;y=Y.textContent||Y.text;T[a.p.colModel[ca+K+H+E].name]=y})}else for(s=0;s<z.length;s++){y=b(z[s],O).text();T[a.p.colModel[s+K+H+E].name]=y}T[C]=M;a.p.data.push(T);
T={};v++}aa()}}},L=function(d,g,h,o,p){var x=new Date;if(d){if(a.p.treeANode===-1&&!a.p.scroll){P(g,false);h=1}else h=h>1?h:1;var w,C,G=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="jsonstring";if(G){a.p.data=[];a.p._index={};w=a.p.localReader.id="_id_"}a.p.reccount=0;if(a.p.datatype=="local"){g=a.p.localReader;C="local"}else{g=a.p.jsonReader;C="json"}var s=0,v,y,D,K=[],H,E=0,Q=0,z=0,W,T,O={},M;D=[];var X=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=b.jgrid.getAccessor(d,g.page)||0;W=b.jgrid.getAccessor(d,
g.total);a.p.lastpage=W===undefined?1:W;a.p.records=b.jgrid.getAccessor(d,g.records)||0;a.p.userData=b.jgrid.getAccessor(d,g.userdata)||{};g.repeatitems||(H=K=U(C));C=a.p.keyIndex===false?g.id:a.p.keyIndex;if(K.length>0&&!isNaN(C)){if(a.p.remapColumns&&a.p.remapColumns.length)C=b.inArray(C,a.p.remapColumns);C=K[C]}(T=b.jgrid.getAccessor(d,g.root))||(T=[]);W=T.length;d=0;var na=parseInt(a.p.rowNum,10),fa=a.p.scroll?(parseInt(a.p.page,10)-1)*na+1:1;if(p)na*=p+1;var Z=b.isFunction(a.p.afterInsertRow),
ga={},qa="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true)qa=' style="display:none;"';for(;d<W;){p=T[d];M=b.jgrid.getAccessor(p,C);if(M===undefined){M=fa+d;if(K.length===0)if(g.cell)M=p[g.cell][C]||M}v=h===1?0:h;v=(v+d)%2==1?X:"";D.push("<tr"+qa+' id="'+M+'" role="row" class= "ui-widget-content jqgrow ui-row-'+a.p.direction+""+v+'">');if(a.p.rownumbers===true){D.push(I(0,d,a.p.page,a.p.rowNum));z=1}if(a.p.multiselect){D.push(u(M,z,d));E=1}if(a.p.subGrid){D.push(b(a).jqGrid("addSubGridCell",
E+z,d+h));Q=1}if(g.repeatitems){if(g.cell)p=b.jgrid.getAccessor(p,g.cell);H||(H=$(E+Q+z))}for(y=0;y<H.length;y++){v=b.jgrid.getAccessor(p,H[y]);D.push(A(M,v,y+E+Q+z,d+h,p));O[a.p.colModel[y+E+Q+z].name]=v}D.push("</tr>");if(a.p.grouping){v=a.p.groupingView.groupField.length;y=[];for(var ha=0;ha<v;ha++)y.push(O[a.p.groupingView.groupField[ha]]);ga=b(a).jqGrid("groupingPrepare",D,y,ga,O);D=[]}if(G){O[w]=M;a.p.data.push(O)}if(a.p.gridview===false){if(a.p.treeGrid===true){v=a.p.treeANode>-1?a.p.treeANode:
0;D=b(D.join(""))[0];b(a.rows[d+v]).after(D);try{b(a).jqGrid("setTreeNode",O,D)}catch(xa){}}else b("#"+a.p.id+" tbody:first").append(D.join(""));if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-1],E+z)}catch(Ba){}Z&&a.p.afterInsertRow.call(a,M,O,p);D=[]}O={};s++;d++;if(s==na)break}if(a.p.gridview===true)a.p.grouping?b(a).jqGrid("groupingRender",ga,a.p.colModel.length):b("#"+a.p.id+" tbody:first").append(D.join(""));a.p.totaltime=new Date-x;if(s>0)if(a.p.records===0)a.p.records=
W;if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=s;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(G){a.p.records=W;a.p.lastpage=Math.ceil(W/na)}o||a.updatepager(false,true);if(G){for(;s<W;){p=T[s];M=b.jgrid.getAccessor(p,C);if(M===undefined){M=fa+s;if(K.length===0)if(g.cell)M=p[g.cell][C]||M}if(p){if(g.repeatitems){if(g.cell)p=b.jgrid.getAccessor(p,g.cell);H||(H=$(E+Q+z))}for(y=0;y<H.length;y++){v=b.jgrid.getAccessor(p,H[y]);O[a.p.colModel[y+
E+Q+z].name]=v}O[w]=M;a.p.data.push(O);O={}}s++}aa()}}},da=function(){var d,g=false,h=[],o=[],p=[],x,w,C;if(b.isArray(a.p.data)){var G=a.p.grouping?a.p.groupingView:false;b.each(a.p.colModel,function(){w=this.sorttype||"text";if(w=="date"||w=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){x=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat;C=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:
b.jgrid.formatter.date.newformat}else x=C=this.datefmt||"Y-m-d";h[this.name]={stype:w,srcfmt:x,newfmt:C}}else h[this.name]={stype:w,srcfmt:"",newfmt:""};if(a.p.grouping&&this.name==G.groupField[0]){var z=this.name;if(typeof this.index!="undefined")z=this.index;o[0]=h[z];p.push(z)}if(!g&&(this.index==a.p.sortname||this.name==a.p.sortname)){d=this.name;g=true}});if(a.p.treeGrid)b(a).jqGrid("SortTree",d,a.p.sortorder,h[d].stype,h[d].srcfmt);else{var s={eq:function(z){return z.equals},ne:function(z){return z.not().equals},
lt:function(z){return z.less},le:function(z){return z.lessOrEquals},gt:function(z){return z.greater},ge:function(z){return z.greaterOrEquals},cn:function(z){return z.contains},nc:function(z){return z.not().contains},bw:function(z){return z.startsWith},bn:function(z){return z.not().startsWith},en:function(z){return z.not().endsWith},ew:function(z){return z.endsWith},ni:function(z){return z.not().equals},"in":function(z){return z.equals}},v=b.jgrid.from(a.p.data);if(a.p.ignoreCase)v=v.ignoreCase();
if(a.p.search===true){var y=a.p.postData.filters,D;if(y){if(typeof y=="string")y=b.jgrid.parse(y);for(var K=0,H=y.rules.length,E;K<H;K++){E=y.rules[K];D=y.groupOp;if(s[E.op]&&E.field&&E.data&&D)v=D.toUpperCase()=="OR"?s[E.op](v)(E.field,E.data,h[E.field]).or():s[E.op](v)(E.field,E.data,h[E.field])}}else try{v=s[a.p.postData.searchOper](v)(a.p.postData.searchField,a.p.postData.searchString,h[a.p.postData.searchField])}catch(Q){}}if(a.p.grouping){v.orderBy(p,G.groupOrder[0],o[0].stype,o[0].srcfmt);
G.groupDataSorted=true}if(d&&a.p.sortorder&&g)a.p.sortorder.toUpperCase()=="DESC"?v.orderBy(a.p.sortname,"d",h[d].stype,h[d].srcfmt):v.orderBy(a.p.sortname,"a",h[d].stype,h[d].srcfmt);s=v.select();v=parseInt(a.p.rowNum,10);y=s.length;D=parseInt(a.p.page,10);K=Math.ceil(y/v);H={};s=s.slice((D-1)*v,D*v);h=v=null;H[a.p.localReader.total]=K;H[a.p.localReader.page]=D;H[a.p.localReader.records]=y;H[a.p.localReader.root]=s;s=null;return H}}},ra=function(){a.grid.hDiv.loading=true;if(!a.p.hiddengrid)switch(a.p.loadui){case "disable":break;
case "enable":b("#load_"+a.p.id).show();break;case "block":b("#lui_"+a.p.id).show();b("#load_"+a.p.id).show();break}},oa=function(){a.grid.hDiv.loading=false;switch(a.p.loadui){case "disable":break;case "enable":b("#load_"+a.p.id).hide();break;case "block":b("#lui_"+a.p.id).hide();b("#load_"+a.p.id).hide();break}},ia=function(d){if(!a.grid.hDiv.loading){var g=a.p.scroll&&d===false,h={},o,p=a.p.prmNames;if(a.p.page<=0)a.p.page=1;if(p.search!==null)h[p.search]=a.p.search;if(p.nd!==null)h[p.nd]=(new Date).getTime();
if(p.rows!==null)h[p.rows]=a.p.rowNum;if(p.page!==null)h[p.page]=a.p.page;if(p.sort!==null)h[p.sort]=a.p.sortname;if(p.order!==null)h[p.order]=a.p.sortorder;if(a.p.rowTotal!==null&&p.totalrows!==null)h[p.totalrows]=a.p.rowTotal;var x=a.p.loadComplete,w=b.isFunction(x);w||(x=null);var C=0;d=d||1;if(d>1)if(p.npage!==null){h[p.npage]=d;C=d-1;d=1}else x=function(s){a.p.page++;a.grid.hDiv.loading=false;w&&a.p.loadComplete.call(a,s);ia(d-1)};else p.npage!==null&&delete a.p.postData[p.npage];if(a.p.grouping){b(a).jqGrid("groupingSetup");
if(a.p.groupingView.groupDataSorted===true)h[p.sort]=a.p.groupingView.groupField[0]+" "+a.p.groupingView.groupOrder[0]+", "+h[p.sort]}b.extend(a.p.postData,h);var G=!a.p.scroll?1:a.rows.length-1;if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id);else{b.isFunction(a.p.beforeRequest)&&a.p.beforeRequest.call(a);o=a.p.datatype.toLowerCase();switch(o){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:o,data:b.isFunction(a.p.serializeGridData)?
a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(s){o==="xml"?ea(s,a.grid.bDiv,G,d>1,C):L(s,a.grid.bDiv,G,d>1,C);x&&x.call(a,s);g&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";oa()},error:function(s,v,y){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,s,v,y);oa()},beforeSend:function(s){ra();b.isFunction(a.p.loadBeforeSend)&&a.p.loadBeforeSend.call(a,s)}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":ra();h=b.jgrid.stringToDoc(a.p.datastr);
ea(h,a.grid.bDiv);w&&a.p.loadComplete.call(a,h);a.p.datatype="local";a.p.datastr=null;oa();break;case "jsonstring":ra();h=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;L(h,a.grid.bDiv);w&&a.p.loadComplete.call(a,h);a.p.datatype="local";a.p.datastr=null;oa();break;case "local":case "clientside":ra();a.p.datatype="local";h=da();L(h,a.grid.bDiv,G,d>1,C);x&&x.call(a,h);g&&a.grid.populateVisible();oa();break}}}};B=function(d,g){var h="",o="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
p="",x,w,C,G,s=function(v){var y;if(b.isFunction(a.p.onPaging))y=a.p.onPaging.call(a,v);a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[];if(y=="stop")return false;return true};d=d.substr(1);x="pg_"+d;w=d+"_left";C=d+"_center";G=d+"_right";b("#"+d).append("<div id='"+x+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+
w+"' align='left'></td><td id='"+C+"' align='center' style='white-space:pre;'></td><td id='"+G+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(a.p.rowList.length>0){p="<td dir='"+n+"'>";p+="<select class='ui-pg-selbox' role='listbox'>";for(w=0;w<a.p.rowList.length;w++)p+='<option role="option" value="'+a.p.rowList[w]+'"'+(a.p.rowNum==a.p.rowList[w]?' selected="selected"':"")+">"+a.p.rowList[w]+"</option>";p+="</select></td>"}if(n=="rtl")o+=p;if(a.p.pginput===true)h="<td dir='"+
n+"'>"+b.jgrid.format(a.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>";if(a.p.pgbuttons===true){w=["first"+g,"prev"+g,"next"+g,"last"+g];n=="rtl"&&w.reverse();o+="<td id='"+w[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";o+="<td id='"+w[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";o+=h!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+
h+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"";o+="<td id='"+w[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";o+="<td id='"+w[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(h!=="")o+=h;if(n=="ltr")o+=p;o+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+d+"_"+a.p.recordpos,"#"+x).append("<div dir='"+n+"' style='text-align:"+a.p.recordpos+
"' class='ui-paging-info'></div>");b("td#"+d+"_"+a.p.pagerpos,"#"+x).append(o);p=b(".ui-jqgrid").css("font-size")||"11px";b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+p+";visibility:hidden;' ></div>");o=b(o).clone().appendTo("#testpg").width();b("#testpg").remove();if(o>0){if(h!="")o+=50;b("td#"+d+"_"+a.p.pagerpos,"#"+x).width(o)}a.p._nvtd=[];a.p._nvtd[0]=o?Math.floor((a.p.width-o)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;o=null;b(".ui-pg-selbox",
"#"+x).bind("change",function(){a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-0.5)+1;a.p.rowNum=this.value;if(g)b(".ui-pg-selbox",a.p.pager).val(this.value);else a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value);if(!s("records"))return false;ia();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+x).hover(function(){if(b(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{b(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover");
this.style.cursor="default"}});b("#first"+g+", #prev"+g+", #next"+g+", #last"+g,"#"+d).click(function(){var v=N(a.p.page,1),y=N(a.p.lastpage,1),D=false,K=true,H=true,E=true,Q=true;if(y===0||y===1)Q=E=H=K=false;else if(y>1&&v>=1)if(v===1)H=K=false;else{if(!(v>1&&v<y))if(v===y)Q=E=false}else if(y>1&&v===0){Q=E=false;v=y-1}if(this.id==="first"+g&&K){a.p.page=1;D=true}if(this.id==="prev"+g&&H){a.p.page=v-1;D=true}if(this.id==="next"+g&&E){a.p.page=v+1;D=true}if(this.id==="last"+g&&Q){a.p.page=y;D=true}if(D){if(!s(this.id))return false;
ia()}return false})}a.p.pginput===true&&b("input.ui-pg-input","#"+x).keypress(function(v){if((v.charCode?v.charCode:v.keyCode?v.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!s("user"))return false;ia();return false}return this})};var Ca=function(d,g,h,o){if(a.p.colModel[g].sortable)if(!(a.p.savedRow.length>0)){if(!h){if(a.p.lastsort==g)if(a.p.sortorder=="asc")a.p.sortorder="desc";else{if(a.p.sortorder=="desc")a.p.sortorder="asc"}else a.p.sortorder=a.p.colModel[g].firstsortorder||
"asc";a.p.page=1}if(o)if(a.p.lastsort==g&&a.p.sortorder==o&&!h)return;else a.p.sortorder=o;h=b("thead:first",a.grid.hDiv).get(0);b("tr th:eq("+a.p.lastsort+") span.ui-grid-ico-sort",h).addClass("ui-state-disabled");b("tr th:eq("+a.p.lastsort+")",h).attr("aria-selected","false");b("tr th:eq("+g+") span.ui-icon-"+a.p.sortorder,h).removeClass("ui-state-disabled");b("tr th:eq("+g+")",h).attr("aria-selected","true");if(!a.p.viewsortcols[0])if(a.p.lastsort!=g){b("tr th:eq("+a.p.lastsort+") span.s-ico",
h).hide();b("tr th:eq("+g+") span.s-ico",h).show()}d=d.substring(5);a.p.sortname=a.p.colModel[g].index||d;h=a.p.sortorder;if(b.isFunction(a.p.onSortCol))if(a.p.onSortCol.call(a,d,g,h)=="stop"){a.p.lastsort=g;return}if(a.p.datatype=="local")a.p.deselectAfterSort&&b(a).jqGrid("resetSelection");else{a.p.selrow=null;a.p.multiselect&&b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false);a.p.selarrrow=[];a.p.savedRow=[]}if(a.p.scroll){h=a.grid.bDiv.scrollLeft;P(a.grid.bDiv,true);a.grid.hDiv.scrollLeft=
h}a.p.subGrid&&a.p.datatype=="local"&&b("td.sgexpanded","#"+a.p.id).each(function(){b(this).trigger("click")});ia();a.p.lastsort=g;if(a.p.sortname!=d&&g)a.p.lastsort=g}},Fa=function(d){var g=d,h;for(h=d+1;h<a.p.colModel.length;h++)if(a.p.colModel[h].hidden!==true){g=h;break}return g-d},Ga=function(d){var g,h={},o=S?0:a.p.cellLayout;for(g=h[0]=h[1]=h[2]=0;g<=d;g++)if(a.p.colModel[g].hidden===false)h[0]+=a.p.colModel[g].width+o;if(a.p.direction=="rtl")h[0]=a.p.width-h[0];h[0]-=a.grid.bDiv.scrollLeft;
if(b(a.grid.cDiv).is(":visible"))h[1]+=b(a.grid.cDiv).height()+parseInt(b(a.grid.cDiv).css("padding-top"),10)+parseInt(b(a.grid.cDiv).css("padding-bottom"),10);if(a.p.toolbar[0]===true&&(a.p.toolbar[1]=="top"||a.p.toolbar[1]=="both"))h[1]+=b(a.grid.uDiv).height()+parseInt(b(a.grid.uDiv).css("border-top-width"),10)+parseInt(b(a.grid.uDiv).css("border-bottom-width"),10);if(a.p.toppager)h[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10);h[2]+=b(a.grid.bDiv).height()+
b(a.grid.hDiv).height();return h};this.p.id=this.id;if(b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])==-1)a.p.multikey=false;a.p.keyIndex=false;for(k=0;k<a.p.colModel.length;k++){r=a.p.colModel[k];r=b.extend(r,a.p.cmTemplate,r.template||{});if(a.p.keyIndex===false&&a.p.colModel[k].key===true)a.p.keyIndex=k}a.p.sortorder=a.p.sortorder.toLowerCase();if(a.p.grouping===true){a.p.scroll=false;a.p.rownumbers=false;a.p.subGrid=false;a.p.treeGrid=false;a.p.gridview=true}if(this.p.treeGrid===true){try{b(this).jqGrid("setTreeGrid")}catch(Ka){}if(a.p.datatype!=
"local")a.p.localReader={id:"_id_"}}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(La){}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:S?a.p.multiselectWidth+a.p.cellLayout:a.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,
sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}a.p.xmlReader=b.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,
cell:"cell"}},a.p.jsonReader);a.p.localReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:false,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.localReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}a.p.data.length&&aa();r="<thead><tr class='ui-jqgrid-labels' role='rowheader'>";var Da,la,sa,pa,ta,V,R,ma;la=ma="";if(a.p.shrinkToFit===true&&a.p.forceFit===true)for(k=a.p.colModel.length-1;k>=
0;k--)if(!a.p.colModel[k].hidden){a.p.colModel[k].resizable=false;break}if(a.p.viewsortcols[1]=="horizontal"){ma=" ui-i-asc";la=" ui-i-desc"}Da=F?"class='ui-th-div-ie'":"";ma="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+ma+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+n+"'></span>";ma+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+la+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+n+"'></span></span>";for(k=0;k<
this.p.colNames.length;k++){la=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[k])+'"':"";r+="<th id='"+a.p.id+"_"+a.p.colModel[k].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+n+"'"+la+">";la=a.p.colModel[k].index||a.p.colModel[k].name;r+="<div id='jqgh_"+a.p.colModel[k].name+"' "+Da+">"+a.p.colNames[k];a.p.colModel[k].width=a.p.colModel[k].width?parseInt(a.p.colModel[k].width,10):150;if(typeof a.p.colModel[k].title!=="boolean")a.p.colModel[k].title=true;if(la==
a.p.sortname)a.p.lastsort=k;r+=ma+"</div></th>"}r+="</tr></thead>";ma=null;b(this).append(r);b("thead tr:first th",this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var za=[],ua;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){if(this.checked){b("[id^=jqg_"+a.p.id+"_]").attr("checked","checked");b(a.rows).each(function(d){if(d>0)if(!b(this).hasClass("subgrid")&&!b(this).hasClass("jqgroup")){b(this).addClass("ui-state-highlight").attr("aria-selected",
"true");a.p.selarrrow.push(this.id);a.p.selrow=this.id}});ua=true;za=[]}else{b("[id^=jqg_"+a.p.id+"_]").removeAttr("checked");b(a.rows).each(function(d){if(d>0)if(!b(this).hasClass("subgrid")){b(this).removeClass("ui-state-highlight").attr("aria-selected","false");za.push(this.id)}});a.p.selarrrow=[];a.p.selrow=null;ua=false}if(b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a,ua?a.p.selarrrow:za,ua)})}if(a.p.autowidth===true){r=b(J).innerWidth();a.p.width=r>0?r:"nw"}(function(){var d=0,g=a.p.cellLayout,
h=0,o,p=a.p.scrollOffset,x,w=false,C,G=0,s=0,v=0,y;if(S)g=0;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;if(this.hidden===false){d+=N(this.width,0);if(this.fixed){G+=this.width;s+=this.width+g}else h++;v++}});if(isNaN(a.p.width))a.p.width=e.width=d;else e.width=a.p.width;a.p.tblwidth=d;if(a.p.shrinkToFit===false&&a.p.forceFit===true)a.p.forceFit=false;if(a.p.shrinkToFit===true&&h>0){C=e.width-g*h-s;if(!isNaN(a.p.height)){C-=p;w=true}d=0;b.each(a.p.colModel,
function(D){if(this.hidden===false&&!this.fixed){this.width=x=Math.round(C*this.width/(a.p.tblwidth-G));d+=x;o=D}});y=0;if(w){if(e.width-s-(d+g*h)!==p)y=e.width-s-(d+g*h)-p}else if(!w&&Math.abs(e.width-s-(d+g*h))!==1)y=e.width-s-(d+g*h);a.p.colModel[o].width+=y;a.p.tblwidth=d+y+G+v*g;if(a.p.tblwidth>a.p.width){a.p.colModel[o].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(J).css("width",e.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'> </div>");
b(t).css("width",e.width+"px");r=b("thead:first",a).get(0);var va="";if(a.p.footerrow)va+="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+n+"'>";t=b("tr:first",r);var wa="<tr class='jqgfirstrow' role='row' style='height:auto'>";a.p.disableClick=false;b("th",t).each(function(d){sa=a.p.colModel[d].width;if(typeof a.p.colModel[d].resizable==="undefined")a.p.colModel[d].resizable=
true;if(a.p.colModel[d].resizable){pa=document.createElement("span");b(pa).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+n);b.browser.opera||b(pa).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else pa="";b(this).css("width",sa+"px").prepend(pa);var g="";if(a.p.colModel[d].hidden){b(this).css("display","none");g="display:none;"}wa+="<td role='gridcell' style='height:0px;width:"+sa+"px;"+g+"'></td>";e.headers[d]={width:sa,el:this};ta=a.p.colModel[d].sortable;if(typeof ta!==
"boolean")ta=a.p.colModel[d].sortable=true;g=a.p.colModel[d].name;g=="cb"||g=="subgrid"||g=="rn"||a.p.viewsortcols[2]&&b("div",this).addClass("ui-jqgrid-sortable");if(ta)if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();d==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}else if(d==a.p.lastsort){b("div span.s-ico",this).show();b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}if(a.p.footerrow)va+="<td role='gridcell' "+l(d,0,"")+
"> </td>"}).mousedown(function(d){if(b(d.target).closest("th>span.ui-jqgrid-resize").length==1){var g=b.jgrid.getCellIndex(this);if(a.p.forceFit===true)a.p.nv=Fa(g);e.dragStart(g,d,Ga(g));return false}}).click(function(d){if(a.p.disableClick)return a.p.disableClick=false;var g="th>div.ui-jqgrid-sortable",h,o;a.p.viewsortcols[2]||(g="th>div>span>span.ui-grid-ico-sort");d=b(d.target).closest(g);if(d.length==1){g=b.jgrid.getCellIndex(this);if(!a.p.viewsortcols[2]){h=true;o=d.attr("sort")}Ca(b("div",
this)[0].id,g,h,o);return false}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",t)}catch(Ma){}if(a.p.footerrow)va+="</tr></tbody></table>";wa+="</tr>";this.appendChild(document.createElement("tbody"));b(this).addClass("ui-jqgrid-btable").append(wa);wa=null;t=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(r);var ba=a.p.caption&&a.p.hiddengrid===true?true:
false;k=b("<div class='ui-jqgrid-hbox"+(n=="rtl"?"-rtl":"")+"'></div>");r=null;e.hDiv=document.createElement("div");b(e.hDiv).css({width:e.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(k);b(k).append(t);t=null;ba&&b(e.hDiv).hide();if(a.p.pager){if(typeof a.p.pager=="string"){if(a.p.pager.substr(0,1)!="#")a.p.pager="#"+a.p.pager}else a.p.pager="#"+b(a.p.pager).attr("id");b(a.p.pager).css({width:e.width+"px"}).appendTo(J).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");
ba&&b(a.p.pager).hide();B(a.p.pager,"")}a.p.cellEdit===false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(d){R=b(d.target).closest("tr.jqgrow");b(R).attr("class")!=="subgrid"&&b(R).addClass("ui-state-hover");return false}).bind("mouseout",function(d){R=b(d.target).closest("tr.jqgrow");b(R).removeClass("ui-state-hover");return false});var ja,ka;b(a).before(e.hDiv).click(function(d){V=d.target;var g=b(V).hasClass("cbox");R=b(V,a.rows).closest("tr.jqgrow");if(b(R).length===0)return this;var h=
true;if(b.isFunction(a.p.beforeSelectRow))h=a.p.beforeSelectRow.call(a,R[0].id,d);if(V.tagName=="A"||(V.tagName=="INPUT"||V.tagName=="TEXTAREA"||V.tagName=="OPTION"||V.tagName=="SELECT")&&!g)return this;if(h===true){if(a.p.cellEdit===true)if(a.p.multiselect&&g)b(a).jqGrid("setSelection",R[0].id,true);else{ja=R[0].rowIndex;ka=b.jgrid.getCellIndex(V);try{b(a).jqGrid("editCell",ja,ka,true)}catch(o){}}else if(a.p.multikey)if(d[a.p.multikey])b(a).jqGrid("setSelection",R[0].id,true);else{if(a.p.multiselect&&
g){g=b("[id^=jqg_"+a.p.id+"_]").attr("checked");b("[id^=jqg_"+a.p.id+"_]").attr("checked",!g)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!g){b(a.p.selarrrow).each(function(p,x){p=a.rows.namedItem(x);b(p).removeClass("ui-state-highlight");b("#jqg_"+a.p.id+"_"+b.jgrid.jqID(x)).attr("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}b(a).jqGrid("setSelection",R[0].id,true)}if(b.isFunction(a.p.onCellSelect)){ja=R[0].id;ka=b.jgrid.getCellIndex(V);a.p.onCellSelect.call(a,
ja,ka,b(V).html(),d)}d.stopPropagation()}else return this}).bind("reloadGrid",function(d,g){if(a.p.treeGrid===true)a.p.datatype=a.p.treedatatype;g&&g.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local"){b(a).jqGrid("resetSelection");a.p.data.length&&aa()}else if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[]}a.p.scroll&&P(a.grid.bDiv,true);if(g&&g.page){d=g.page;if(d>a.p.lastpage)d=a.p.lastpage;
if(d<1)d=1;a.p.page=d;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(d-1)*a.grid.prevRowHeight*a.p.rowNum:0}if(a.grid.prevRowHeight&&a.p.scroll){delete a.p.lastpage;a.grid.populateVisible()}else a.grid.populate();return false});b.isFunction(this.p.ondblClickRow)&&b(this).dblclick(function(d){V=d.target;R=b(V,a.rows).closest("tr.jqgrow");if(b(R).length===0)return false;ja=R[0].rowIndex;ka=b.jgrid.getCellIndex(V);a.p.ondblClickRow.call(a,b(R).attr("id"),ja,ka,d);return false});b.isFunction(this.p.onRightClickRow)&&
b(this).bind("contextmenu",function(d){V=d.target;R=b(V,a.rows).closest("tr.jqgrow");if(b(R).length===0)return false;a.p.multiselect||b(a).jqGrid("setSelection",R[0].id,true);ja=R[0].rowIndex;ka=b.jgrid.getCellIndex(V);a.p.onRightClickRow.call(a,b(R).attr("id"),ja,ka,d);return false});e.bDiv=document.createElement("div");b(e.bDiv).append(b('<div style="position:relative;'+(F&&b.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+
(isNaN(a.p.height)?"":"px"),width:e.width+"px"}).scroll(e.scrollGrid);b("table:first",e.bDiv).css({width:a.p.tblwidth+"px"});if(F){b("tbody",this).size()==2&&b("tbody:gt(0)",this).remove();a.p.multikey&&b(e.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(e.bDiv).bind("mousedown",function(){return false});ba&&b(e.bDiv).hide();e.cDiv=document.createElement("div");var Aa=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Aa.addClass("ui-state-hover")},
function(){Aa.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(n=="rtl"?"left":"right","0px"):"";b(e.cDiv).append(Aa).append("<span class='ui-jqgrid-title"+(n=="rtl"?"-rtl":"")+"'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(e.cDiv).insertBefore(e.hDiv);if(a.p.toolbar[0]){e.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(e.uDiv).insertBefore(e.hDiv);else a.p.toolbar[1]==
"bottom"&&b(e.uDiv).insertAfter(e.hDiv);if(a.p.toolbar[1]=="both"){e.ubDiv=document.createElement("div");b(e.uDiv).insertBefore(e.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);b(e.ubDiv).insertAfter(e.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ba&&b(e.ubDiv).hide()}else b(e.uDiv).width(e.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);ba&&b(e.uDiv).hide()}if(a.p.toppager){a.p.toppager=a.p.id+"_toppager";e.topDiv=b("<div id='"+
a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(e.topDiv).insertBefore(e.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(e.width);B(a.p.toppager,"_t")}if(a.p.footerrow){e.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0];k=b("<div class='ui-jqgrid-hbox"+(n=="rtl"?"-rtl":"")+"'></div>");b(e.sDiv).append(k).insertAfter(e.hDiv).width(e.width);b(k).append(va);e.footers=b(".ui-jqgrid-ftable",e.sDiv)[0].rows[0].cells;if(a.p.rownumbers)e.footers[0].className="ui-state-default jqgrid-rownum";
ba&&b(e.sDiv).hide()}k=null;if(a.p.caption){var Ha=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",e.cDiv).click(function(d){var g=b.isFunction(a.p.onHeaderClick),h=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",o,p=this;if(a.p.toolbar[0]===true){if(a.p.toolbar[1]=="both")h+=", #"+b(e.ubDiv).attr("id");h+=", #"+b(e.uDiv).attr("id")}o=b(h,"#gview_"+a.p.id).length;if(a.p.gridstate=="visible")b(h,"#gbox_"+a.p.id).slideUp("fast",function(){o--;if(o==0){b("span",
p).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");a.p.gridstate="hidden";b("#gbox_"+a.p.id).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+a.p.id).hide();if(g)ba||a.p.onHeaderClick.call(a,a.p.gridstate,d)}});else a.p.gridstate=="hidden"&&b(h,"#gbox_"+a.p.id).slideDown("fast",function(){o--;if(o==0){b("span",p).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ba){a.p.datatype=Ha;ia();ba=false}a.p.gridstate="visible";b("#gbox_"+
a.p.id).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+a.p.id).show();if(g)ba||a.p.onHeaderClick.call(a,a.p.gridstate,d)}});return false});if(ba){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",e.cDiv).trigger("click")}}}else b(e.cDiv).hide();b(e.hDiv).after(e.bDiv).mousemove(function(d){if(e.resizing){e.dragMove(d);return false}});b(".ui-jqgrid-labels",e.hDiv).bind("selectstart",function(){return false});b(document).mouseup(function(){if(e.resizing){e.dragEnd();return false}return true});
a.formatCol=l;a.sortData=Ca;a.updatepager=function(d,g){var h,o,p,x,w,C,G,s="";p=parseInt(a.p.page,10)-1;if(p<0)p=0;p*=parseInt(a.p.rowNum,10);w=p+a.p.reccount;if(a.p.scroll){h=b("tbody:first > tr:gt(0)",a.grid.bDiv);p=w-h.length;a.p.reccount=h.length;if(o=h.outerHeight()||a.grid.prevRowHeight){h=p*o;o=parseInt(a.p.records,10)*o;b(">div:first",a.grid.bDiv).css({height:o}).children("div:first").css({height:h,display:h?"":"none"})}a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}s=a.p.pager?a.p.pager:
"";s+=a.p.toppager?s?","+a.p.toppager:a.p.toppager:"";if(s){G=b.jgrid.formatter.integer||{};h=N(a.p.page);o=N(a.p.lastpage);b(".selbox",s).attr("disabled",false);if(a.p.pginput===true){b(".ui-pg-input",s).val(a.p.page);b("#sp_1",s).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,G):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",s).html(a.p.emptyrecords);else{x=p+1;C=a.p.records;if(b.fmatter){x=b.fmatter.util.NumberFormat(x,G);w=b.fmatter.util.NumberFormat(w,G);C=
b.fmatter.util.NumberFormat(C,G)}b(".ui-paging-info",s).html(b.jgrid.format(a.p.recordtext,x,w,C))}if(a.p.pgbuttons===true){if(h<=0)h=o=0;if(h==1||h===0){b("#first, #prev",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first, #prev",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).removeClass("ui-state-disabled")}if(h==
o||h===0){b("#next, #last",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next, #last",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).removeClass("ui-state-disabled")}}}d===true&&a.p.rownumbers===true&&b("td.jqgrid-rownum",a.rows).each(function(v){b(this).html(p+1+v)});g&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");
b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a)};a.refreshIndex=aa;a.formatter=function(d,g,h,o,p){return q(d,g,h,o,p)};b.extend(e,{populate:ia,emptyRows:P});this.grid=e;a.addXmlData=function(d){ea(d,a.grid.bDiv)};a.addJSONData=function(d){L(d,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;ia();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}}})};b.jgrid.extend({getGridParam:function(f){var j=this[0];if(j&&j.grid)return f?typeof j.p[f]!="undefined"?j.p[f]:null:j.p},setGridParam:function(f){return this.each(function(){this.grid&&
typeof f==="object"&&b.extend(true,this.p,f)})},getDataIDs:function(){var f=[],j=0,i,c=0;this.each(function(){if((i=this.rows.length)&&i>0)for(;j<i;){if(b(this.rows[j]).hasClass("jqgrow")){f[c]=this.rows[j].id;c++}j++}});return f},setSelection:function(f,j){return this.each(function(){function i(n){var a=b(c.grid.bDiv)[0].clientHeight,r=b(c.grid.bDiv)[0].scrollTop,t=c.rows[n].offsetTop;n=c.rows[n].clientHeight;if(t+n>=a+r)b(c.grid.bDiv)[0].scrollTop=t-(a+r)+n+r;else if(t<a+r)if(t<r)b(c.grid.bDiv)[0].scrollTop=
t}var c=this,e,k;if(f!==undefined){j=j===false?false:true;if(e=c.rows.namedItem(f+"")){if(c.p.scrollrows===true){k=c.rows.namedItem(f).rowIndex;k>=0&&i(k)}if(c.p.multiselect){c.p.selrow=e.id;k=b.inArray(c.p.selrow,c.p.selarrrow);if(k===-1){e.className!=="ui-subgrid"&&b(e).addClass("ui-state-highlight").attr("aria-selected","true");e=true;b("#jqg_"+c.p.id+"_"+b.jgrid.jqID(c.p.selrow)).attr("checked",e);c.p.selarrrow.push(c.p.selrow);c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,c.p.selrow,e)}else{e.className!==
"ui-subgrid"&&b(e).removeClass("ui-state-highlight").attr("aria-selected","false");e=false;b("#jqg_"+c.p.id+"_"+b.jgrid.jqID(c.p.selrow)).attr("checked",e);c.p.selarrrow.splice(k,1);c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,c.p.selrow,e);e=c.p.selarrrow[0];c.p.selrow=e===undefined?null:e}}else if(e.className!=="ui-subgrid"){c.p.selrow&&b(c.rows.namedItem(c.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");if(c.p.selrow!=e.id){c.p.selrow=e.id;b(e).addClass("ui-state-highlight").attr("aria-selected",
"true");c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,c.p.selrow,true)}else c.p.selrow=null}}}})},resetSelection:function(){return this.each(function(){var f=this,j;if(f.p.multiselect){b(f.p.selarrrow).each(function(i,c){j=f.rows.namedItem(c);b(j).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+f.p.id+"_"+b.jgrid.jqID(c)).attr("checked",false)});b("#cb_"+b.jgrid.jqID(f.p.id)).attr("checked",false);f.p.selarrrow=[]}else if(f.p.selrow){b("#"+f.p.id+" tbody:first tr#"+b.jgrid.jqID(f.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected",
"false");f.p.selrow=null}f.p.savedRow=[]})},getRowData:function(f){var j={},i,c=false,e,k=0;this.each(function(){var n=this,a,r;if(typeof f=="undefined"){c=true;i=[];e=n.rows.length}else{r=n.rows.namedItem(f);if(!r)return j;e=2}for(;k<e;){if(c)r=n.rows[k];if(b(r).hasClass("jqgrow")){b("td",r).each(function(t){a=n.p.colModel[t].name;if(a!=="cb"&&a!=="subgrid"&&a!=="rn")if(n.p.treeGrid===true&&a==n.p.ExpandColumn)j[a]=b.jgrid.htmlDecode(b("span:first",this).html());else try{j[a]=b.unformat(this,{rowId:r.id,
colModel:n.p.colModel[t]},t)}catch(B){j[a]=b.jgrid.htmlDecode(b(this).html())}});if(c){i.push(j);j={}}}k++}});return i?i:j},delRowData:function(f){var j=false,i,c;this.each(function(){var e=this;if(i=e.rows.namedItem(f)){b(i).remove();e.p.records--;e.p.reccount--;e.updatepager(true,false);j=true;if(e.p.multiselect){c=b.inArray(f,e.p.selarrrow);c!=-1&&e.p.selarrrow.splice(c,1)}if(f==e.p.selrow)e.p.selrow=null}else return false;if(e.p.datatype=="local"){var k=e.p._index[f];if(typeof k!="undefined"){e.p.data.splice(k,
1);e.refreshIndex()}}if(e.p.altRows===true&&j){var n=e.p.altclass;b(e.rows).each(function(a){a%2==1?b(this).addClass(n):b(this).removeClass(n)})}});return j},setRowData:function(f,j,i){var c,e=true,k;this.each(function(){if(!this.grid)return false;var n=this,a,r,t=typeof i,B={};r=n.rows.namedItem(f);if(!r)return false;if(j)try{b(this.p.colModel).each(function(J){c=this.name;if(j[c]!==undefined){B[c]=this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?b.unformat.date(j[c],this):
j[c];a=n.formatter(f,j[c],J,j,"edit");k=this.title?{title:b.jgrid.stripHtml(a)}:{};n.p.treeGrid===true&&c==n.p.ExpandColumn?b("td:eq("+J+") > span:first",r).html(a).attr(k):b("td:eq("+J+")",r).html(a).attr(k)}});if(n.p.datatype=="local"){var F=n.p._index[f];if(typeof F!="undefined")n.p.data[F]=b.extend(true,n.p.data[F],B);B=null}}catch(S){e=false}if(e)if(t==="string")b(r).addClass(i);else t==="object"&&b(r).css(i)});return e},addRowData:function(f,j,i,c){i||(i="last");var e=false,k,n,a,r,t,B,F,S,
J="",N,l,m,q,A;if(j){if(b.isArray(j)){N=true;i="last";l=f}else{j=[j];N=false}this.each(function(){var u=this,I=j.length;t=u.p.rownumbers===true?1:0;a=u.p.multiselect===true?1:0;r=u.p.subGrid===true?1:0;if(!N)if(typeof f!="undefined")f+="";else{f=u.p.records+1+"";if(u.p.keyIndex!==false){l=u.p.colModel[u.p.keyIndex+a+r+t].name;if(typeof j[0][l]!="undefined")f=j[0][l]}}m=u.p.altclass;for(var U=0,$="",P={},aa=b.isFunction(u.p.afterInsertRow)?true:false;U<I;){q=j[U];n="";if(N){try{f=q[l]}catch(ea){f=
u.p.records+1+""}$=u.p.altRows===true?(u.rows.length-1)%2===0?m:"":""}if(t){J=u.formatCol(0,1,"");n+='<td role="gridcell" aria-describedby="'+u.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+J+">0</td>"}if(a){S='<input role="checkbox" type="checkbox" id="jqg_'+u.p.id+"_"+f+'" class="cbox"/>';J=u.formatCol(t,1,"");n+='<td role="gridcell" aria-describedby="'+u.p.id+'_cb" '+J+">"+S+"</td>"}if(r)n+=b(u).jqGrid("addSubGridCell",a+t,1);for(F=a+r+t;F<u.p.colModel.length;F++){A=u.p.colModel[F];k=A.name;
P[k]=A.formatter&&typeof A.formatter==="string"&&A.formatter=="date"?b.unformat.date(q[k],A):q[k];S=u.formatter(f,b.jgrid.getAccessor(q,k),F,q,"edit");J=u.formatCol(F,1,S);n+='<td role="gridcell" aria-describedby="'+u.p.id+"_"+k+'" '+J+">"+S+"</td>"}n='<tr id="'+f+'" role="row" class="ui-widget-content jqgrow ui-row-'+u.p.direction+" "+$+'">'+n+"</tr>";if(u.p.subGrid===true){n=b(n)[0];b(u).jqGrid("addSubGrid",n,a+t)}if(u.rows.length===0)b("table:first",u.grid.bDiv).append(n);else switch(i){case "last":b(u.rows[u.rows.length-
1]).after(n);break;case "first":b(u.rows[0]).after(n);break;case "after":if(B=u.rows.namedItem(c))b(u.rows[B.rowIndex+1]).hasClass("ui-subgrid")?b(u.rows[B.rowIndex+1]).after(n):b(B).after(n);break;case "before":if(B=u.rows.namedItem(c)){b(B).before(n);B=B.rowIndex}break}u.p.records++;u.p.reccount++;aa&&u.p.afterInsertRow.call(u,f,q,q);U++;if(u.p.datatype=="local"){u.p._index[f]=u.p.data.length;u.p.data.push(P);P={}}}if(u.p.altRows===true&&!N)if(i=="last")(u.rows.length-1)%2==1&&b(u.rows[u.rows.length-
1]).addClass(m);else b(u.rows).each(function(L){L%2==1?b(this).addClass(m):b(this).removeClass(m)});u.updatepager(true,true);e=true})}return e},footerData:function(f,j,i){function c(r){for(var t in r)if(r.hasOwnProperty(t))return false;return true}var e,k=false,n={},a;if(typeof f=="undefined")f="get";if(typeof i!="boolean")i=true;f=f.toLowerCase();this.each(function(){var r=this,t;if(!r.grid||!r.p.footerrow)return false;if(f=="set")if(c(j))return false;k=true;b(this.p.colModel).each(function(B){e=
this.name;if(f=="set"){if(j[e]!==undefined){t=i?r.formatter("",j[e],B,j,"edit"):j[e];a=this.title?{title:b.jgrid.stripHtml(t)}:{};b("tr.footrow td:eq("+B+")",r.grid.sDiv).html(t).attr(a);k=true}}else if(f=="get")n[e]=b("tr.footrow td:eq("+B+")",r.grid.sDiv).html()})});return f=="get"?n:k},ShowHideCol:function(f,j){return this.each(function(){var i=this,c=false;if(i.grid){if(typeof f==="string")f=[f];j=j!="none"?"":"none";var e=j===""?true:false;b(this.p.colModel).each(function(k){if(b.inArray(this.name,
f)!==-1&&this.hidden===e){b("tr",i.grid.hDiv).each(function(){b("th:eq("+k+")",this).css("display",j)});b(i.rows).each(function(n){b("td:eq("+k+")",i.rows[n]).css("display",j)});i.p.footerrow&&b("td:eq("+k+")",i.grid.sDiv).css("display",j);if(j=="none")i.p.tblwidth-=this.width+i.p.cellLayout;else i.p.tblwidth+=this.width;this.hidden=!e;c=true}});if(c===true){b("table:first",i.grid.hDiv).width(i.p.tblwidth);b("table:first",i.grid.bDiv).width(i.p.tblwidth);i.grid.hDiv.scrollLeft=i.grid.bDiv.scrollLeft;
if(i.p.footerrow){b("table:first",i.grid.sDiv).width(i.p.tblwidth);i.grid.sDiv.scrollLeft=i.grid.bDiv.scrollLeft}i.p.shrinkToFit===true&&b(i).jqGrid("setGridWidth",i.grid.width-0.001,true)}}})},hideCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol",f,"none")})},showCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol",f,"")})},remapColumns:function(f,j,i){function c(n){var a;a=n.length?b.makeArray(n):b.extend({},n);b.each(f,function(r){n[r]=a[this]})}function e(n,
a){b(">tr"+(a||""),n).each(function(){var r=this,t=b.makeArray(r.cells);b.each(f,function(){var B=t[this];B&&r.appendChild(B)})})}var k=this.get(0);c(k.p.colModel);c(k.p.colNames);c(k.grid.headers);e(b("thead:first",k.grid.hDiv),i&&":not(.ui-jqgrid-labels)");j&&e(b("#"+k.p.id+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");k.p.footerrow&&e(b("tbody:first",k.grid.sDiv));if(k.p.remapColumns)if(k.p.remapColumns.length)c(k.p.remapColumns);else k.p.remapColumns=b.makeArray(f);k.p.lastsort=b.inArray(k.p.lastsort,
f);if(k.p.treeGrid)k.p.expColInd=b.inArray(k.p.expColInd,f)},setGridWidth:function(f,j){return this.each(function(){if(this.grid){var i=this,c,e=0,k=i.p.cellLayout,n,a=0,r=false,t=i.p.scrollOffset,B,F=0,S=0,J=0,N;if(typeof j!="boolean")j=i.p.shrinkToFit;if(!isNaN(f)){f=parseInt(f,10);i.grid.width=i.p.width=f;b("#gbox_"+i.p.id).css("width",f+"px");b("#gview_"+i.p.id).css("width",f+"px");b(i.grid.bDiv).css("width",f+"px");b(i.grid.hDiv).css("width",f+"px");i.p.pager&&b(i.p.pager).css("width",f+"px");
i.p.toppager&&b(i.p.toppager).css("width",f+"px");if(i.p.toolbar[0]===true){b(i.grid.uDiv).css("width",f+"px");i.p.toolbar[1]=="both"&&b(i.grid.ubDiv).css("width",f+"px")}i.p.footerrow&&b(i.grid.sDiv).css("width",f+"px");if(j===false&&i.p.forceFit===true)i.p.forceFit=false;if(j===true){if(b.browser.safari)k=0;b.each(i.p.colModel,function(){if(this.hidden===false){e+=parseInt(this.width,10);if(this.fixed){S+=this.width;F+=this.width+k}else a++;J++}});if(a!==0){i.p.tblwidth=e;B=f-k*a-F;if(!isNaN(i.p.height))if(b(i.grid.bDiv)[0].clientHeight<
b(i.grid.bDiv)[0].scrollHeight||i.rows.length===1){r=true;B-=t}e=0;var l=i.grid.cols.length>0;b.each(i.p.colModel,function(m){if(this.hidden===false&&!this.fixed){c=Math.round(B*this.width/(i.p.tblwidth-S));if(!(c<0)){this.width=c;e+=c;i.grid.headers[m].width=c;i.grid.headers[m].el.style.width=c+"px";if(i.p.footerrow)i.grid.footers[m].style.width=c+"px";if(l)i.grid.cols[m].style.width=c+"px";n=m}}});N=0;if(r){if(f-F-(e+k*a)!==t)N=f-F-(e+k*a)-t}else if(Math.abs(f-F-(e+k*a))!==1)N=f-F-(e+k*a);i.p.colModel[n].width+=
N;i.p.tblwidth=e+N+S+k*J;if(i.p.tblwidth>f){r=i.p.tblwidth-parseInt(f,10);i.p.tblwidth=f;c=i.p.colModel[n].width-=r}else c=i.p.colModel[n].width;i.grid.headers[n].width=c;i.grid.headers[n].el.style.width=c+"px";if(l)i.grid.cols[n].style.width=c+"px";b("table:first",i.grid.bDiv).css("width",i.p.tblwidth+"px");b("table:first",i.grid.hDiv).css("width",i.p.tblwidth+"px");i.grid.hDiv.scrollLeft=i.grid.bDiv.scrollLeft;if(i.p.footerrow){i.grid.footers[n].style.width=c+"px";b("table:first",i.grid.sDiv).css("width",
i.p.tblwidth+"px")}}}}}})},setGridHeight:function(f){return this.each(function(){var j=this;if(j.grid){b(j.grid.bDiv).css({height:f+(isNaN(f)?"":"px")});j.p.height=f;j.p.scroll&&j.grid.populateVisible()}})},setCaption:function(f){return this.each(function(){this.p.caption=f;b("span.ui-jqgrid-title",this.grid.cDiv).html(f);b(this.grid.cDiv).show()})},setLabel:function(f,j,i,c){return this.each(function(){var e=this,k=-1;if(e.grid){if(isNaN(f))b(e.p.colModel).each(function(r){if(this.name==f){k=r;return false}});
else k=parseInt(f,10);if(k>=0){var n=b("tr.ui-jqgrid-labels th:eq("+k+")",e.grid.hDiv);if(j){var a=b(".s-ico",n);b("[id^=jqgh_]",n).empty().html(j).append(a);e.p.colNames[k]=j}if(i)typeof i==="string"?b(n).addClass(i):b(n).css(i);typeof c==="object"&&b(n).attr(c)}}})},setCell:function(f,j,i,c,e,k){return this.each(function(){var n=this,a=-1,r,t;if(n.grid){if(isNaN(j))b(n.p.colModel).each(function(F){if(this.name==j){a=F;return false}});else a=parseInt(j,10);if(a>=0)if(r=n.rows.namedItem(f)){var B=
b("td:eq("+a+")",r);if(i!==""||k===true){r=n.formatter(f,i,a,r,"edit");t=n.p.colModel[a].title?{title:b.jgrid.stripHtml(r)}:{};n.p.treeGrid&&b(".tree-wrap",b(B)).length>0?b("span",b(B)).html(r).attr(t):b(B).html(r).attr(t);if(n.p.datatype=="local"){r=n.p.colModel[a];i=r.formatter&&typeof r.formatter==="string"&&r.formatter=="date"?b.unformat.date(i,r):i;t=n.p._index[f];if(typeof t!="undefined")n.p.data[t][r.name]=i}}if(typeof c==="string")b(B).addClass(c);else c&&b(B).css(c);typeof e==="object"&&
b(B).attr(e)}}})},getCell:function(f,j){var i=false;this.each(function(){var c=this,e=-1;if(c.grid){if(isNaN(j))b(c.p.colModel).each(function(a){if(this.name===j){e=a;return false}});else e=parseInt(j,10);if(e>=0){var k=c.rows.namedItem(f);if(k)try{i=b.unformat(b("td:eq("+e+")",k),{rowId:k.id,colModel:c.p.colModel[e]},e)}catch(n){i=b.jgrid.htmlDecode(b("td:eq("+e+")",k).html())}}}});return i},getCol:function(f,j,i){var c=[],e,k=0;j=typeof j!="boolean"?false:j;if(typeof i=="undefined")i=false;this.each(function(){var n=
this,a=-1;if(n.grid){if(isNaN(f))b(n.p.colModel).each(function(F){if(this.name===f){a=F;return false}});else a=parseInt(f,10);if(a>=0){var r=n.rows.length,t=0;if(r&&r>0){for(;t<r;){if(b(n.rows[t]).hasClass("jqgrow")){try{e=b.unformat(b(n.rows[t].cells[a]),{rowId:n.rows[t].id,colModel:n.p.colModel[a]},a)}catch(B){e=b.jgrid.htmlDecode(n.rows[t].cells[a].innerHTML)}if(i)k+=parseFloat(e);else if(j)c.push({id:n.rows[t].id,value:e});else c[t]=e}t++}if(i)switch(i.toLowerCase()){case "sum":c=k;break;case "avg":c=
k/r;break;case "count":c=r;break}}}}});return c},clearGridData:function(f){return this.each(function(){var j=this;if(j.grid){if(typeof f!="boolean")f=false;if(j.p.deepempty)b("#"+j.p.id+" tbody:first tr:gt(0)").remove();else{var i=b("#"+j.p.id+" tbody:first tr:first")[0];b("#"+j.p.id+" tbody:first").empty().append(i)}j.p.footerrow&&f&&b(".ui-jqgrid-ftable td",j.grid.sDiv).html(" ");j.p.selrow=null;j.p.selarrrow=[];j.p.savedRow=[];j.p.records=0;j.p.page=1;j.p.lastpage=0;j.p.reccount=0;j.p.data=
[];j.p_index={};j.updatepager(true,false)}})},getInd:function(f,j){var i=false,c;this.each(function(){if(c=this.rows.namedItem(f))i=j===true?c:c.rowIndex});return i}})})(jQuery);
(function(a){a.jgrid.extend({getColProp:function(f){var d={},b=this[0];if(!b.grid)return false;b=b.p.colModel;for(var m=0;m<b.length;m++)if(b[m].name==f){d=b[m];break}return d},setColProp:function(f,d){return this.each(function(){if(this.grid)if(d)for(var b=this.p.colModel,m=0;m<b.length;m++)if(b[m].name==f){a.extend(this.p.colModel[m],d);break}})},sortGrid:function(f,d,b){return this.each(function(){var m=this,t=-1;if(m.grid){if(!f)f=m.p.sortname;for(var q=0;q<m.p.colModel.length;q++)if(m.p.colModel[q].index==
f||m.p.colModel[q].name==f){t=q;break}if(t!=-1){q=m.p.colModel[t].sortable;if(typeof q!=="boolean")q=true;if(typeof d!=="boolean")d=false;q&&m.sortData("jqgh_"+f,t,d,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var f=this.id;try{a("#gbox_"+f).remove()}catch(d){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var f={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
var d=document.createElement("table");a(d).attr({id:f.id});d.className=f.cl;f=this.id;a(d).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+f).length===1){a(d).insertBefore("#gbox_"+f).show();a(this.p.pager).insertBefore("#gbox_"+f)}else a(d).insertBefore("#gbox_"+f).show();a("#gbox_"+f).remove()}})},setGridState:function(f){return this.each(function(){if(this.grid){var d=this;if(f=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+d.p.id).slideUp("fast");d.p.pager&&a(d.p.pager).slideUp("fast");
d.p.toppager&&a(d.p.toppager).slideUp("fast");if(d.p.toolbar[0]===true){d.p.toolbar[1]=="both"&&a(d.grid.ubDiv).slideUp("fast");a(d.grid.uDiv).slideUp("fast")}d.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+d.p.id).slideUp("fast");a(".ui-jqgrid-titlebar-close span",d.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");d.p.gridstate="hidden"}else if(f=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+d.p.id).slideDown("fast");d.p.pager&&a(d.p.pager).slideDown("fast");
d.p.toppager&&a(d.p.toppager).slideDown("fast");if(d.p.toolbar[0]===true){d.p.toolbar[1]=="both"&&a(d.grid.ubDiv).slideDown("fast");a(d.grid.uDiv).slideDown("fast")}d.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+d.p.id).slideDown("fast");a(".ui-jqgrid-titlebar-close span",d.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");d.p.gridstate="visible"}}})},updateGridRows:function(f,d,b){var m,t=false,q;this.each(function(){var h=this,k,o,c,g;if(!h.grid)return false;
d||(d="id");f&&f.length>0&&a(f).each(function(){c=this;if(o=h.rows.namedItem(c[d])){g=c[d];if(b===true)if(h.p.jsonReader.repeatitems===true){if(h.p.jsonReader.cell)c=c[h.p.jsonReader.cell];for(var e=0;e<c.length;e++){k=h.formatter(g,c[e],e,c,"edit");q=h.p.colModel[e].title?{title:a.jgrid.stripHtml(k)}:{};h.p.treeGrid===true&&m==h.p.ExpandColumn?a("td:eq("+e+") > span:first",o).html(k).attr(q):a("td:eq("+e+")",o).html(k).attr(q)}return t=true}a(h.p.colModel).each(function(n){m=b===true?this.jsonmap||
this.name:this.name;if(c[m]!==undefined){k=h.formatter(g,c[m],n,c,"edit");q=this.title?{title:a.jgrid.stripHtml(k)}:{};h.p.treeGrid===true&&m==h.p.ExpandColumn?a("td:eq("+n+") > span:first",o).html(k).attr(q):a("td:eq("+n+")",o).html(k).attr(q);t=true}})}})});return t},filterGrid:function(f,d){d=a.extend({gridModel:false,gridNames:false,gridToolbar:false,filterModel:[],formtype:"horizontal",autosearch:true,formclass:"filterform",tableclass:"filtertable",buttonclass:"filterbutton",searchButton:"Search",
clearButton:"Clear",enableSearch:false,enableClear:false,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,url:"",marksearched:true},d||{});return this.each(function(){var b=this;this.p=d;if(this.p.filterModel.length===0&&this.p.gridModel===false)alert("No filter is set");else if(f){this.p.gridid=f.indexOf("#")!=-1?f:"#"+f;var m=a(this.p.gridid).jqGrid("getGridParam","colModel");if(m){if(this.p.gridModel===true){var t=a(this.p.gridid)[0],q;a.each(m,function(g){var e=[];this.search=
this.search===false?false:true;q=this.editrules&&this.editrules.searchhidden===true?true:this.hidden===true?false:true;if(this.search===true&&q===true){e.label=b.p.gridNames===true?t.p.colNames[g]:"";e.name=this.name;e.index=this.index||this.name;e.stype=this.edittype||"text";if(e.stype!="select")e.stype="text";e.defval=this.defval||"";e.surl=this.surl||"";e.sopt=this.editoptions||{};e.width=this.width;b.p.filterModel.push(e)}})}else a.each(b.p.filterModel,function(){for(var g=0;g<m.length;g++)if(this.name==
m[g].name){this.index=m[g].index||this.name;break}if(!this.index)this.index=this.name});var h=function(){var g={},e=0,n,i=a(b.p.gridid)[0],j;i.p.searchdata={};a.isFunction(b.p.beforeSearch)&&b.p.beforeSearch();a.each(b.p.filterModel,function(){j=this.index;switch(this.stype){case "select":if(n=a("select[name="+j+"]",b).val()){g[j]=n;b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).addClass("dirty-cell");e++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(r){}}break;
default:if(n=a("input[name="+j+"]",b).val()){g[j]=n;b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).addClass("dirty-cell");e++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(s){}}}});var p=e>0?true:false;a.extend(i.p.postData,g);var l;if(b.p.url){l=a(i).jqGrid("getGridParam","url");a(i).jqGrid("setGridParam",{url:b.p.url})}a(i).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);l&&a(i).jqGrid("setGridParam",
{url:l});a.isFunction(b.p.afterSearch)&&b.p.afterSearch()},k=function(){var g={},e,n=0,i=a(b.p.gridid)[0],j;a.isFunction(b.p.beforeClear)&&b.p.beforeClear();a.each(b.p.filterModel,function(){j=this.index;e=this.defval?this.defval:"";if(!this.stype)this.stype="text";switch(this.stype){case "select":var r;a("select[name="+j+"] option",b).each(function(v){if(v===0)this.selected=true;if(a(this).text()==e){this.selected=true;r=a(this).val();return false}});if(r){g[j]=r;b.p.marksearched&&a("#jqgh_"+this.name,
i.grid.hDiv).addClass("dirty-cell");n++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(s){}}break;case "text":a("input[name="+j+"]",b).val(e);if(e){g[j]=e;b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).addClass("dirty-cell");n++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(u){}}break}});var p=n>0?true:false;a.extend(i.p.postData,g);var l;
if(b.p.url){l=a(i).jqGrid("getGridParam","url");a(i).jqGrid("setGridParam",{url:b.p.url})}a(i).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);l&&a(i).jqGrid("setGridParam",{url:l});a.isFunction(b.p.afterClear)&&b.p.afterClear()},o,c=a("<form name='SearchForm' style=display:inline;' class='"+this.p.formclass+"'></form>");o=a("<table class='"+this.p.tableclass+"' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");a(c).append(o);(function(){var g=document.createElement("tr"),
e,n,i,j;b.p.formtype=="horizontal"&&a(o).append(g);a.each(b.p.filterModel,function(p){i=document.createElement("td");a(i).append("<label for='"+this.name+"'>"+this.label+"</label>");j=document.createElement("td");var l=this;if(!this.stype)this.stype="text";switch(this.stype){case "select":if(this.surl)a(j).load(this.surl,function(){l.defval&&a("select",this).val(l.defval);a("select",this).attr({name:l.index||l.name,id:"sg_"+l.name});l.sopt&&a("select",this).attr(l.sopt);b.p.gridToolbar===true&&l.width&&
a("select",this).width(l.width);b.p.autosearch===true&&a("select",this).change(function(){h();return false})});else if(l.sopt.value){var r=l.sopt.value,s=document.createElement("select");a(s).attr({name:l.index||l.name,id:"sg_"+l.name}).attr(l.sopt);var u;if(typeof r==="string"){p=r.split(";");for(var v=0;v<p.length;v++){r=p[v].split(":");u=document.createElement("option");u.value=r[0];u.innerHTML=r[1];if(r[1]==l.defval)u.selected="selected";s.appendChild(u)}}else if(typeof r==="object")for(v in r)if(r.hasOwnProperty(v)){p++;
u=document.createElement("option");u.value=v;u.innerHTML=r[v];if(r[v]==l.defval)u.selected="selected";s.appendChild(u)}b.p.gridToolbar===true&&l.width&&a(s).width(l.width);a(j).append(s);b.p.autosearch===true&&a(s).change(function(){h();return false})}break;case "text":s=this.defval?this.defval:"";a(j).append("<input type='text' name='"+(this.index||this.name)+"' id='sg_"+this.name+"' value='"+s+"'/>");l.sopt&&a("input",j).attr(l.sopt);if(b.p.gridToolbar===true&&l.width)a.browser.msie?a("input",j).width(l.width-
4):a("input",j).width(l.width-2);b.p.autosearch===true&&a("input",j).keypress(function(w){if((w.charCode?w.charCode:w.keyCode?w.keyCode:0)==13){h();return false}return this});break}if(b.p.formtype=="horizontal"){b.p.gridToolbar===true&&b.p.gridNames===false?a(g).append(j):a(g).append(i).append(j);a(g).append(j)}else{e=document.createElement("tr");a(e).append(i).append(j);a(o).append(e)}});j=document.createElement("td");if(b.p.enableSearch===true){n="<input type='button' id='sButton' class='"+b.p.buttonclass+
"' value='"+b.p.searchButton+"'/>";a(j).append(n);a("input#sButton",j).click(function(){h();return false})}if(b.p.enableClear===true){n="<input type='button' id='cButton' class='"+b.p.buttonclass+"' value='"+b.p.clearButton+"'/>";a(j).append(n);a("input#cButton",j).click(function(){k();return false})}if(b.p.enableClear===true||b.p.enableSearch===true)if(b.p.formtype=="horizontal")a(g).append(j);else{e=document.createElement("tr");a(e).append("<td> </td>").append(j);a(o).append(e)}})();a(this).append(c);
this.triggerSearch=h;this.clearSearch=k}else alert("Could not get grid colModel")}else alert("No target grid is set!")})},filterToolbar:function(f){f=a.extend({autosearch:true,searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND",defaultSearch:"bw"},f||{});return this.each(function(){function d(h,k){var o=a(h);o[0]&&jQuery.each(k,function(){this.data!==undefined?o.bind(this.type,this.data,this.fn):o.bind(this.type,this.fn)})}
var b=this,m=function(){var h={},k=0,o,c,g={},e;a.each(b.p.colModel,function(){c=this.index||this.name;switch(this.stype){case "select":e=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(o=a("select[name="+c+"]",b.grid.hDiv).val()){h[c]=o;g[c]=e;k++}else try{delete b.p.postData[c]}catch(r){}break;case "text":e=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:f.defaultSearch;if(o=a("input[name="+c+"]",b.grid.hDiv).val()){h[c]=o;g[c]=e;k++}else try{delete b.p.postData[c]}catch(s){}break}});
var n=k>0?true:false;if(f.stringResult===true||b.p.datatype=="local"){var i='{"groupOp":"'+f.groupOp+'","rules":[',j=0;a.each(h,function(r,s){if(j>0)i+=",";i+='{"field":"'+r+'",';i+='"op":"'+g[r]+'",';i+='"data":"'+s+'"}';j++});i+="]}";a.extend(b.p.postData,{filters:i})}else a.extend(b.p.postData,h);var p;if(b.p.searchurl){p=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var l=false;if(a.isFunction(f.beforeSearch))l=f.beforeSearch.call(b);l||a(b).jqGrid("setGridParam",{search:n}).trigger("reloadGrid",
[{page:1}]);p&&a(b).jqGrid("setGridParam",{url:p});a.isFunction(f.afterSearch)&&f.afterSearch()},t=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),q;a.each(b.p.colModel,function(){var h=this,k,o,c,g;o=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");k=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===true&&a(o).css("display","none");this.search=this.search===false?false:true;if(typeof this.stype==
"undefined")this.stype="text";c=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(g=this.surl||c.dataUrl)a.ajax(a.extend({url:g,dataType:"html",complete:function(p){if(c.buildSelect!==undefined)(p=c.buildSelect(p))&&a(k).append(p);else a(k).append(p.responseText);c.defaultValue&&a("select",k).val(c.defaultValue);a("select",k).attr({name:h.index||h.name,id:"gs_"+h.name});c.attr&&a("select",k).attr(c.attr);a("select",k).css({width:"100%"});c.dataInit!==undefined&&
c.dataInit(a("select",k)[0]);c.dataEvents!==undefined&&d(a("select",k)[0],c.dataEvents);f.autosearch===true&&a("select",k).change(function(){m();return false});p=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var e;if(h.searchoptions&&h.searchoptions.value)e=h.searchoptions.value;else if(h.editoptions&&h.editoptions.value)e=h.editoptions.value;if(e){g=document.createElement("select");g.style.width="100%";a(g).attr({name:h.index||h.name,id:"gs_"+h.name});var n,i;if(typeof e==="string"){e=
e.split(";");for(var j=0;j<e.length;j++){n=e[j].split(":");i=document.createElement("option");i.value=n[0];i.innerHTML=n[1];g.appendChild(i)}}else if(typeof e==="object")for(n in e)if(e.hasOwnProperty(n)){i=document.createElement("option");i.value=n;i.innerHTML=e[n];g.appendChild(i)}c.defaultValue&&a(g).val(c.defaultValue);c.attr&&a(g).attr(c.attr);c.dataInit!==undefined&&c.dataInit(g);c.dataEvents!==undefined&&d(g,c.dataEvents);a(k).append(g);f.autosearch===true&&a(g).change(function(){m();return false})}}break;
case "text":g=c.defaultValue?c.defaultValue:"";a(k).append("<input type='text' style='width:95%;padding:0px;' name='"+(h.index||h.name)+"' id='gs_"+h.name+"' value='"+g+"'/>");c.attr&&a("input",k).attr(c.attr);c.dataInit!==undefined&&c.dataInit(a("input",k)[0]);c.dataEvents!==undefined&&d(a("input",k)[0],c.dataEvents);if(f.autosearch===true)f.searchOnEnter?a("input",k).keypress(function(p){if((p.charCode?p.charCode:p.keyCode?p.keyCode:0)==13){m();return false}return this}):a("input",k).keydown(function(p){switch(p.which){case 13:return false;
case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:q&&clearTimeout(q);q=setTimeout(function(){m()},500)}});break}a(o).append(k);a(t).append(o)});a("table thead",b.grid.hDiv).append(t);this.triggerToolbar=m;this.clearToolbar=function(h){var k={},o,c=0,g;h=typeof h!="boolean"?true:h;a.each(b.p.colModel,function(){o=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";g=this.index||this.name;switch(this.stype){case "select":var l;a("select[name="+g+
"] option",b.grid.hDiv).each(function(u){if(u===0)this.selected=true;if(a(this).text()==o){this.selected=true;l=a(this).val();return false}});if(l){k[g]=l;c++}else try{delete b.p.postData[g]}catch(r){}break;case "text":a("input[name="+g+"]",b.grid.hDiv).val(o);if(o){k[g]=o;c++}else try{delete b.p.postData[g]}catch(s){}break}});var e=c>0?true:false;if(f.stringResult===true||b.p.datatype=="local"){var n='{"groupOp":"'+f.groupOp+'","rules":[',i=0;a.each(k,function(l,r){if(i>0)n+=",";n+='{"field":"'+
l+'",';n+='"op":"eq",';n+='"data":"'+r+'"}';i++});n+="]}";a.extend(b.p.postData,{filters:n})}else a.extend(b.p.postData,k);var j;if(b.p.searchurl){j=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var p=false;if(a.isFunction(f.beforeClear))p=f.beforeClear.call(b);p||h&&a(b).jqGrid("setGridParam",{search:e}).trigger("reloadGrid",[{page:1}]);j&&a(b).jqGrid("setGridParam",{url:j});a.isFunction(f.afterClear)&&f.afterClear()};this.toggleToolbar=function(){var h=a("tr.ui-search-toolbar",b.grid.hDiv);
h.css("display")=="none"?h.show():h.hide()}})}})})(jQuery);
(function(c){c.jgrid.extend({getPostData:function(){var a=this[0];if(a.grid)return a.p.postData},setPostData:function(a){var b=this[0];if(b.grid)if(typeof a==="object")b.p.postData=a;else alert("Error: cannot add a non-object postData value. postData unchanged.")},appendPostData:function(a){var b=this[0];if(b.grid)typeof a==="object"?c.extend(b.p.postData,a):alert("Error: cannot append a non-object postData value. postData unchanged.")},setPostDataItem:function(a,b){var d=this[0];if(d.grid)d.p.postData[a]=
b},getPostDataItem:function(a){var b=this[0];if(b.grid)return b.p.postData[a]},removePostDataItem:function(a){var b=this[0];b.grid&&delete b.p.postData[a]},getUserData:function(){var a=this[0];if(a.grid)return a.p.userData},getUserDataItem:function(a){var b=this[0];if(b.grid)return b.p.userData[a]}})})(jQuery);
(function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(b){return b.offsetWidth===0||b.offsetHeight===0||b.style.display=="none"};a.jgrid._multiselect=false;if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var q=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(b,j){b=q.call(this,b,j);if(j&&this.selectedList){var c=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(c)})}return b}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=
function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=true}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function j(){c.p.disableClick=true}var c=this,h={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)",placeholder:{element:function(e){return a(document.createElement(e[0].nodeName)).addClass(e[0].className+
" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(e,g){g.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10));g.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10))}},update:function(e,g){e=a(g.item).parent();e=a(">th",e);var i={};a.each(c.p.colModel,function(m){i[this.name]=m});var l=[];
e.each(function(){var m=a(">div",this).get(0).id.replace(/^jqgh_/,"");m in i&&l.push(i[m])});a(c).jqGrid("remapColumns",l,true,true);a.isFunction(c.p.sortable.update)&&c.p.sortable.update(l);setTimeout(function(){c.p.disableClick=false},50)}};if(c.p.sortable.options)a.extend(h,c.p.sortable.options);else if(a.isFunction(c.p.sortable))c.p.sortable={update:c.p.sortable};if(h.start){var d=h.start;h.start=function(e,g){j();d.call(this,e,g)}}else h.start=j;if(c.p.sortable.exclude)h.items+=":not("+c.p.sortable.exclude+
")";b.sortable(h).data("sortable").floating=true})},columnChooser:function(b){function j(f,k,p){if(k>=0){var o=f.slice(),r=o.splice(k,Math.max(f.length-k,k));if(k>f.length)k=f.length;o[k]=p;return o.concat(r)}}function c(f,k){if(f)if(typeof f=="string")a.fn[f]&&a.fn[f].apply(k,a.makeArray(arguments).slice(2));else a.isFunction(f)&&f.apply(k,a.makeArray(arguments).slice(2))}var h=this;if(!a("#colchooser_"+h[0].p.id).length){var d=a('<div id="colchooser_'+h[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
e=a("select",d);b=a.extend({width:420,height:240,classname:null,done:function(f){f&&h.jqGrid("remapColumns",f,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(f){var k={};k[f.bSubmit]=function(){f.apply_perm();f.cleanup(false)};k[f.bCancel]=function(){f.cleanup(true)};return{buttons:k,close:function(){f.cleanup(true)},modal:false,resizable:false,width:f.width+20}},apply_perm:function(){a("option",e).each(function(){this.selected?h.jqGrid("showCol",g[this.value].name):h.jqGrid("hideCol",
g[this.value].name)});var f=[];a("option[selected]",e).each(function(){f.push(parseInt(this.value,10))});a.each(f,function(){delete l[g[parseInt(this,10)].name]});a.each(l,function(){var k=parseInt(this,10);f=j(f,k,k)});b.done&&b.done.call(h,f)},cleanup:function(f){c(b.dlog,d,"destroy");c(b.msel,e,"destroy");d.remove();f&&b.done&&b.done.call(h)},msel_opts:{}},a.jgrid.col,b||{});if(a.ui)if(a.ui.multiselect)if(b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}b.caption&&d.attr("title",b.caption);if(b.classname){d.addClass(b.classname);e.addClass(b.classname)}if(b.width){a(">div",d).css({width:b.width,margin:"0 auto"});e.css("width",b.width)}if(b.height){a(">div",d).css("height",b.height);e.css("height",b.height-10)}var g=h.jqGrid("getGridParam","colModel"),i=h.jqGrid("getGridParam","colNames"),l={},m=[];e.empty();a.each(g,function(f){l[this.name]=f;if(this.hidedlg)this.hidden||m.push(f);
else e.append("<option value='"+f+"' "+(this.hidden?"":"selected='selected'")+">"+i[f]+"</option>")});var n=a.isFunction(b.dlog_opts)?b.dlog_opts.call(h,b):b.dlog_opts;c(b.dlog,d,n);n=a.isFunction(b.msel_opts)?b.msel_opts.call(h,b):b.msel_opts;c(b.msel,e,n)}},sortableRows:function(b){return this.each(function(){var j=this;if(j.grid)if(!j.p.treeGrid)if(a.fn.sortable){b=a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{});if(b.start&&a.isFunction(b.start)){b._start_=b.start;delete b.start}else b._start_=
false;if(b.update&&a.isFunction(b.update)){b._update_=b.update;delete b.update}else b._update_=false;b.start=function(c,h){a(h.item).css("border-width","0px");a("td",h.item).each(function(g){this.style.width=j.grid.cols[g].style.width});if(j.p.subGrid){var d=a(h.item).attr("id");try{a(j).jqGrid("collapseSubGridRow",d)}catch(e){}}b._start_&&b._start_.apply(this,[c,h])};b.update=function(c,h){a(h.item).css("border-width","");j.p.rownumbers===true&&a("td.jqgrid-rownum",j.rows).each(function(d){a(this).html(d+
1)});b._update_&&b._update_.apply(this,[c,h])};a("tbody:first",j).sortable(b);a("tbody:first",j).disableSelection()}})},gridDnD:function(b){return this.each(function(){function j(){var d=a.data(c,"dnd");a("tr.jqgrow:not(.ui-draggable)",c).draggable(a.isFunction(d.drag)?d.drag.call(a(c),d):d.drag)}var c=this;if(c.grid)if(!c.p.treeGrid)if(a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof b=="string"&&b==
"updateDnD"&&c.p.jqgdnd===true)j();else{b=a.extend({drag:function(d){return a.extend({start:function(e,g){if(c.p.subGrid){var i=a(g.helper).attr("id");try{a(c).jqGrid("collapseSubGridRow",i)}catch(l){}}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(c,"dnd").connectWith[i]).jqGrid("addRowData","jqg_empty_row",{});g.helper.addClass("ui-state-highlight");a("td",g.helper).each(function(m){this.style.width=c.grid.headers[m].width+
"px"});d.onstart&&a.isFunction(d.onstart)&&d.onstart.call(a(c),e,g)},stop:function(e,g){if(g.helper.dropped){var i=a(g.helper).attr("id");a(c).jqGrid("delRowData",i)}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("delRowData","jqg_empty_row");d.onstop&&a.isFunction(d.onstop)&&d.onstop.call(a(c),e,g)}},d.drag_opts||{})},drop:function(d){return a.extend({accept:function(e){if(!a(e).hasClass("jqgrow"))return e;var g=a(e).closest("table.ui-jqgrid-btable");if(g.length>
0&&a.data(g[0],"dnd")!==undefined){e=a.data(g[0],"dnd").connectWith;return a.inArray("#"+this.id,e)!=-1?true:false}return e},drop:function(e,g){if(a(g.draggable).hasClass("jqgrow")){var i=a(g.draggable).attr("id");i=g.draggable.parent().parent().jqGrid("getRowData",i);if(!d.dropbyname){var l=0,m={},n,f=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var k in i){if(i.hasOwnProperty(k)&&f[l]){n=f[l].name;m[n]=i[k]}l++}i=m}catch(p){}}g.helper.dropped=true;if(d.beforedrop&&a.isFunction(d.beforedrop)){n=
d.beforedrop.call(this,e,g,i,a("#"+c.id),a(this));if(typeof n!="undefined"&&n!==null&&typeof n=="object")i=n}if(g.helper.dropped){var o;if(d.autoid)if(a.isFunction(d.autoid))o=d.autoid.call(this,i);else{o=Math.ceil(Math.random()*1E3);o=d.autoidprefix+o}a("#"+this.id).jqGrid("addRowData",o,i,d.droppos)}d.ondrop&&a.isFunction(d.ondrop)&&d.ondrop.call(this,e,g,i)}}},d.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},
drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},b||{});if(b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(d){return a.trim(d)});a.data(c,"dnd",b);c.p.reccount!="0"&&!c.p.jqgdnd&&j();c.p.jqgdnd=true;for(var h=0;h<b.connectWith.length;h++)a(b.connectWith[h]).droppable(a.isFunction(b.drop)?b.drop.call(a(c),b):b.drop)}}}})},gridResize:function(b){return this.each(function(){var j=
this;if(j.grid&&a.fn.resizable){b=a.extend({},b||{});if(b.alsoResize){b._alsoResize_=b.alsoResize;delete b.alsoResize}else b._alsoResize_=false;if(b.stop&&a.isFunction(b.stop)){b._stop_=b.stop;delete b.stop}else b._stop_=false;b.stop=function(c,h){a(j).jqGrid("setGridParam",{height:a("#gview_"+j.p.id+" .ui-jqgrid-bdiv").height()});a(j).jqGrid("setGridWidth",h.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(j,c,h)};b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+j.p.id+" .ui-jqgrid-bdiv':true,'"+
b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+j.p.id);delete b._alsoResize_;a("#gbox_"+j.p.id).resizable(b)}})}})})(jQuery);
|