/* 
* jqGrid  3.7.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-07-12 
* Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.jqueryui.js; 
*/
(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(e){if(e=="&nbsp;"||e=="&#160;"||e.length==1&&e.charCodeAt(0)==160)return"";return!e?e:String(e).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(e){return!e?e:String(e).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(e){var j=b.makeArray(arguments).slice(1);if(e===undefined)e="";return e.replace(/\{(\d+)\}/g,function(i,
c){return j[c]})},getCellIndex:function(e){e=b(e);if(e.is("tr"))return-1;e=(!e.is("td")&&!e.is("th")?e.closest("td,th"):e)[0];if(b.browser.msie)return b.inArray(e,e.parentNode.cells);return e.cellIndex},stripHtml:function(e){e+="";var j=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(e)return(e=e.replace(j,""))&&e!=="&nbsp;"&&e!=="&#160;"?e.replace(/\"/g,"'"):"";else return e},stringToDoc:function(e){var j;if(typeof e!=="string")return e;try{j=(new DOMParser).parseFromString(e,"text/xml")}catch(i){j=new ActiveXObject("Microsoft.XMLDOM");
j.async=false;j.loadXML(e)}return j&&j.documentElement&&j.documentElement.tagName!="parsererror"?j:null},parse:function(e){e=e;if(e.substr(0,9)=="while(1);")e=e.substr(9);if(e.substr(0,2)=="/*")e=e.substr(2,e.length-4);e||(e="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(e):eval("("+e+")")},parseDate:function(e,j){var i={m:1,d:1,y:1970,h:0,i:0,s:0},c,f,k;if(j&&j!==null&&j!==undefined){j=b.trim(j);j=j.split(/[\\\/:_;.\t\T\s-]/);e=e.split(/[\\\/:_;.\t\T\s-]/);
var n=b.jgrid.formatter.date.monthNames,a=b.jgrid.formatter.date.AmPm,r=function(v,y){if(v===0){if(y==12)y=0}else if(y!=12)y+=12;return y};c=0;for(f=e.length;c<f;c++){if(e[c]=="M"){k=b.inArray(j[c],n);if(k!==-1&&k<12)j[c]=k+1}if(e[c]=="F"){k=b.inArray(j[c],n);if(k!==-1&&k>11)j[c]=k+1-12}if(e[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(e[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[e[c].toLowerCase()]=
parseInt(j[c],10)}i.m=parseInt(i.m,10)-1;e=i.y;if(e>=70&&e<=99)i.y=1900+i.y;else if(e>=0&&e<=69)i.y=2E3+i.y}return new Date(i.y,i.m,i.d,i.h,i.i,i.s,0)},jqID:function(e){e+="";return e.replace(/([\.\:\[\]])/g,"\\$1")},getAccessor:function(e,j){var i,c,f,k;if(typeof j==="function")return j(e);i=e[j];if(i===undefined)try{if(typeof j==="string")f=j.split(".");if(k=f.length)for(i=e;i&&k--;){c=f.shift();i=i[c]}}catch(n){}return i},ajaxOptions:{},from:function(e){return new (function(j,i){if(typeof j=="string")j=
b.data(j);var c=this,f=j,k=true,n=false,a=i,r=/[\$,%]/g,v=null,y=null,E=false,O="",H=[],L=true;if(typeof j=="object"&&j.push){if(j.length>0)L=typeof j[0]!="object"?false:true}else throw"data provides is not an array";this._hasData=function(){return f===null?false:f.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(f,function(o,A){m.push(l(A))});return m};this._append=function(l){if(a===null)a="";else a+=O==""?" && ":O;if(E)a+="!";a+="("+l+")";E=false;O=""};this._setCommand=function(l,m){v=l;y=m};this._resetNegate=function(){E=false};this._repeatCommand=function(l,m){if(v===
null)return c;if(l!=null&&m!=null)return v(l,m);if(y===null)return v(l);if(!L)return v(l);return v(y,l)};this._equals=function(l,m){return c._compare(l,m,1)===0};this._compare=function(l,m,o){if(o===undefined)o=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){l=l.toLowerCase();m=m.toLowerCase()}if(l<m)return-o;if(l>m)return o;return 0};this._performSort=function(){if(H.length!==0)f=c._doSort(f,0)};
this._doSort=function(l,m){var o=H[m].by,A=H[m].dir,t=H[m].type,G=H[m].datefmt;if(m==H.length-1)return c._getOrder(l,o,A,t,G);m++;l=c._getGroup(l,o,A,t,G);o=[];for(A=0;A<l.length;A++){t=c._doSort(l[A].items,m);for(G=0;G<t.length;G++)o.push(t[G])}return o};this._getOrder=function(l,m,o,A,t){var G=[],S=[],ba=o=="a"?1:-1,Q,fa;if(A===undefined)A="text";fa=A=="float"||A=="number"||A=="currency"||A=="numeric"?function(J){J=parseFloat(String(J).replace(r,""));return isNaN(J)?0:J}:A=="int"||A=="integer"?
function(J){return J?parseFloat(String(J).replace(r,"")):0}:A=="date"||A=="datetime"?function(J){return b.jgrid.parseDate(t,J).getTime()}:function(J){J||(J="");return b.trim(J.toUpperCase())};b.each(l,function(J,Z){Q=b.jgrid.getAccessor(Z,m);if(Q===undefined)Q="";Q=fa(Q);S.push({vSort:Q,index:J})});S.sort(function(J,Z){J=J.vSort;Z=Z.vSort;return c._compare(J,Z,ba)});A=0;for(var ka=l.length;A<ka;){o=S[A].index;G.push(l[o]);A++}return G};this._getGroup=function(l,m,o,A,t){var G=[],S=null,ba=null,Q;
b.each(c._getOrder(l,m,o,A,t),function(fa,ka){Q=b.jgrid.getAccessor(ka,m);if(Q===undefined)Q="";if(!c._equals(ba,Q)){ba=Q;S!=null&&G.push(S);S=c._group(m,Q)}S.items.push(ka)});S!=null&&G.push(S);return G};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(f);k||m.ignoreCase();n&&m.trim();result=l(m).showQuery();c._append(result);return c};this.execute=
function(){var l=a,m=[];if(l===null)return c;b.each(f,function(){eval(l)&&m.push(this)});f=m;return c};this.data=function(){return f};this.select=function(l){c._performSort();if(!c._hasData())return[];c.execute();if(b.isFunction(l)){var m=[];b.each(f,function(o,A){m.push(l(A))});return m}return f};this.hasMatch=function(){if(!c._hasData())return false;c.execute();return f.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,o){E=!E;return c.and(l,m,o)};this.orNot=function(l,m,o){E=!E;return c.or(l,m,o)};this.not=function(l,m,o){return c.andNot(l,m,o)};this.and=function(l,m,o){O=" && ";if(l===undefined)return c;return c._repeatCommand(l,m,o)};this.or=function(l,m,o){O=" || ";if(l===undefined)return c;return c._repeatCommand(l,m,o)};this.isNot=function(l){E=!E;return c.is(l)};this.is=function(l){c._append("this."+l);c._resetNegate();return c};this._compareValues=function(l,m,o,A,t){var G;G=L?"this."+m:"this";
if(o===undefined)o=null;o=o===null?m:o;switch(t.stype===undefined?"text":t.stype){case "int":case "integer":o=isNaN(Number(o))?"0":o;G="parseInt("+G+",10)";o="parseInt("+o+",10)";break;case "float":case "number":case "numeric":o=String(o).replace(r,"");o=isNaN(Number(o))?"0":o;G="parseFloat("+G+")";o="parseFloat("+o+")";break;case "date":case "datetime":o=String(b.jgrid.parseDate(t.newfmt||"Y-m-d",o).getTime());G='jQuery.jgrid.parseDate("'+t.srcfmt+'",'+G+").getTime()";break;default:G=c._getStr(G);
o=c._getStr('"'+c._toStr(o)+'"')}c._append(G+" "+A+" "+o);c._setCommand(l,m);c._resetNegate();return c};this.equals=function(l,m,o){return c._compareValues(c.equals,l,m,"==",o)};this.greater=function(l,m,o){return c._compareValues(c.greater,l,m,">",o)};this.less=function(l,m,o){return c._compareValues(c.less,l,m,"<",o)};this.greaterOrEquals=function(l,m,o){return c._compareValues(c.greaterOrEquals,l,m,">=",o)};this.lessOrEquals=function(l,m,o){return c._compareValues(c.lessOrEquals,l,m,"<=",o)};this.startsWith=
function(l,m){var o=m===undefined||m===null?l:m;o=n?b.trim(o.toString()).length:o.toString().length;if(L)c._append(c._getStr("this."+l)+".substr(0,"+o+") == "+c._getStr('"'+c._toStr(m)+'"'));else{o=n?b.trim(m.toString()).length:m.toString().length;c._append(c._getStr("this")+".substr(0,"+o+") == "+c._getStr('"'+c._toStr(l)+'"'))}c._setCommand(c.startsWith,l);c._resetNegate();return c};this.endsWith=function(l,m){var o=m===undefined||m===null?l:m;o=n?b.trim(o.toString()).length:o.toString().length;
L?c._append(c._getStr("this."+l)+".substr("+c._getStr("this."+l)+".length-"+o+","+o+') == "'+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){L?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.where=function(l){if(b.isFunction(l)){c.execute();var m=[];b.each(f,function(o,A){l(A)&&m.push(A)});return b.from(m,c.showQuery())}c._append(l);c._setCommand(this.where,null);c._resetNegate();return c};this.groupBy=function(l,m,o,A){if(!c._hasData())return null;return c._getGroup(f,l,m,o,A)};this.distinct=function(l,m){l=c.groupBy(l,m);var o=[];b.each(l,function(A,t){o.push(t.unique)});return o};this.orderBy=function(l,m,o,A){m=m===undefined||m===null?"a":b.trim(m.toString().toLowerCase());
if(o===null||o===undefined)o="text";if(A===null||A===undefined)A="Y-m-d";if(m=="desc"||m=="descending")m="d";if(m=="asc"||m=="ascending")m="a";H.push({by:l,dir:m,type:o,datefmt:A});return c};return c})(e,null)},extend:function(e){b.extend(b.fn.jqGrid,e);this.no_legacy_api||b.fn.extend(e)}});b.fn.jqGrid=function(e){if(typeof e=="string"){var j=b.fn.jqGrid[e];if(!j)throw"jqGrid - No such method: "+e;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:200,data:[],_index:{}},b.jgrid.defaults,e||{}),f={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,q;if(h>33){this.curGbox.css({left:this.resizing.sOL+g});if(c.forceFit===true){q=this.headers[this.resizing.idx+c.nv];g=c.direction==="ltr"?q.width-g:q.width+g;if(g>33){d.newWidth=h;q.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";if(this.cols.length>0)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";if(this.cols.length>0)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(){f.timer&&clearTimeout(f.timer);f.timer=null;var d=b(f.bDiv).height();if(d){var g=b("table:first",f.bDiv),h=b("> tbody > tr:visible:first",g).outerHeight()||f.prevRowHeight;if(h){f.prevRowHeight=h;var q=c.rowNum,p=f.scrollTop=f.bDiv.scrollTop,w=Math.round(g.position().top)-p,s=w+g.height();h=h*q;var C,z,x;if(s<d&&w<=0&&(c.lastpage===undefined||parseInt((s+p+h-1)/h,10)<=c.lastpage)){z=
parseInt((d-s+h-1)/h,10);if(s>=0||z<2||c.scroll===true){C=Math.round((s+p)/h)+1;w=-1}else w=1}if(w>0){C=parseInt(p/h,10)+1;z=parseInt((p+d)/h,10)+2-C;x=true}if(z)if(!(c.lastpage&&C>c.lastpage||c.lastpage==1))if(f.hDiv.loading)f.timer=setTimeout(f.populateVisible,c.scrollTimeout);else{c.page=C;if(x){f.selectionPreserver(g[0]);f.emptyRows(f.bDiv,false)}f.populate(z)}}}},scrollGrid:function(){if(c.scroll){var d=f.bDiv.scrollTop;if(f.scrollTop===undefined)f.scrollTop=0;if(d!=f.scrollTop){f.scrollTop=
d;f.timer&&clearTimeout(f.timer);f.timer=setTimeout(f.populateVisible,c.scrollTimeout)}}f.hDiv.scrollLeft=f.bDiv.scrollLeft;if(c.footerrow)f.sDiv.scrollLeft=f.bDiv.scrollLeft},selectionPreserver:function(d){var g=d.p,h=g.selrow,q=g.selarrrow?b.makeArray(g.selarrrow):null,p=d.grid.bDiv.scrollLeft,w=g.gridComplete;g.gridComplete=function(){g.selrow=null;g.selarrrow=[];if(g.multiselect&&q&&q.length>0)for(var s=0;s<q.length;s++)q[s]!=h&&b(d).jqGrid("setSelection",q[s],false);h&&b(d).jqGrid("setSelection",
h,false);d.grid.bDiv.scrollLeft=p;g.gridComplete=w;g.gridComplete&&w()}}};this.p=c;var k,n,a;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 r=b("<div class='ui-jqgrid-view'></div>"),v,y=b.browser.msie?true:false,E=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(r).insertBefore(this);b(this).appendTo(r).removeClass("scroll");var O=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(O).insertBefore(r).attr({id:"gbox_"+this.id,dir:n});b(r).appendTo(O).attr("id","gview_"+this.id);v=y&&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(v).insertBefore(r);b("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(r);b(this).attr({cellSpacing:"0",cellPadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var H=function(d,g){d=parseInt(d,10);return isNaN(d)?g?g:0:d},L=function(d,g,h){var q=a.p.colModel[d],p=q.align,w='style="',s=q.classes,C=q.name;if(p)w+="text-align:"+p+";";if(q.hidden===
true)w+="display:none;";if(g===0)w+="width: "+f.headers[d].width+"px;";w+='"'+(s!==undefined?' class="'+s+'"':"")+(q.title&&h?' title="'+b.jgrid.stripHtml(h)+'"':"");w+=' aria-describedby="'+a.p.id+"_"+C+'"';return w},l=function(d){return d===undefined||d===null||d===""?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(d):d+""},m=function(d,g,h,q,p){h=a.p.colModel[h];if(typeof h.formatter!=="undefined"){d={rowId:d,colModel:h,gid:a.p.id};g=b.isFunction(h.formatter)?h.formatter.call(a,g,d,q,p):b.fmatter?b.fn.fmatter(h.formatter,
g,d,q,p):l(g)}else g=l(g);return g},o=function(d,g,h,q,p){d=m(d,g,h,p,"add");return'<td role="gridcell" '+L(h,q,d)+">"+d+"</td>"},A=function(d,g,h){d='<input role="checkbox" type="checkbox" id="jqg_'+d+'" class="cbox" name="jqg_'+d+'"/>';g=L(g,h,"");return'<td role="gridcell" aria-describedby="'+a.p.id+'_cb" '+g+">"+d+"</td>"},t=function(d,g,h,q){h=(parseInt(h,10)-1)*parseInt(q,10)+1+g;d=L(d,g,"");return'<td role="gridcell" aria-describedby="'+a.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+
d+">"+h+"</td>"},G=function(d){var g,h=[],q=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[q]=d=="xml"?g.xmlmap||g.name:g.jsonmap||g.name;q++}}return h},S=function(d){var g=a.p.remapColumns;if(!g||!g.length)g=b.map(a.p.colModel,function(h,q){return q});if(d)g=b.map(g,function(h){return h<d?null:h-d});return g},ba=function(d,g){a.p.deepempty?b("tbody:first tr",d).remove():b("tbody:first",d).empty();if(g&&a.p.scroll){b(">div:first",d).css({height:"auto"}).children("div:first").css({height:0,
display:"none"});d.scrollTop=0}},Q=function(d,g,h,q,p){var w=new Date,s=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="xmlstring",C;if(s){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){ba(g,false);h=0}else h=h>0?h:0;var z,x=0,u,D,F=0,B=0,I=0,M,X,T=[],ca,U={},Y=a.rows.length,P,R,$=[],K=0,wa=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(T=G("xml"));M=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;
if(T.length>0&&!isNaN(M)){if(a.p.remapColumns&&a.p.remapColumns.length)M=b.inArray(M,a.p.remapColumns);M=T[M]}X=(M+"").indexOf("[")===-1?T.length?function(ga,da){return b(M,ga).text()||da}:function(ga,da){return b(a.p.xmlReader.cell,ga).eq(M).text()||da}:function(ga,da){return ga.getAttribute(M.replace(/[\[\]]/g,""))||da};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);var ea=d.length,aa=0;if(d&&ea){var ma=parseInt(a.p.rowNum,10),Aa=a.p.scroll?(parseInt(a.p.page,10)-1)*ma+1:1;if(p)ma*=p+1;for(p=b.isFunction(a.p.afterInsertRow);aa<ea;){P=d[aa];R=X(P,Aa+aa);z=h===0?0:h+1;z=
(z+aa)%2==1?wa:"";$[K++]='<tr id="'+R+'" role="row" class ="ui-widget-content jqgrow ui-row-'+a.p.direction+""+z+'">';if(a.p.rownumbers===true){$[K++]=t(0,aa,a.p.page,a.p.rowNum);I=1}if(a.p.multiselect===true){$[K++]=A(R,I,aa);F=1}if(a.p.subGrid===true){$[K++]=b(a).jqGrid("addSubGridCell",F+I,aa+h);B=1}if(a.p.xmlReader.repeatitems){ca||(ca=S(F+B+I));var qa=b(a.p.xmlReader.cell,P);b.each(ca,function(ga){var da=qa[this];if(!da)return false;u=da.textContent||da.text;U[a.p.colModel[ga+F+B+I].name]=u;
$[K++]=o(R,u,ga+F+B+I,aa+h,P)})}else for(z=0;z<T.length;z++){u=b(T[z],P).text();U[a.p.colModel[z+F+B+I].name]=u;$[K++]=o(R,u,z+F+B+I,aa+h,P)}$[K++]="</tr>";if(s){U[C]=R;a.p.data.push(U)}if(a.p.gridview===false){if(a.p.treeGrid===true){z=a.p.treeANode>=-1?a.p.treeANode:0;D=b($.join(""))[0];Y===0?b("tbody:first",g).append(D):b(a.rows[aa+z+h]).after(D);try{b(a).jqGrid("setTreeNode",U,D)}catch(Ga){}}else b("tbody:first",g).append($.join(""));if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-
1],F+I)}catch(Ha){}p&&a.p.afterInsertRow.call(a,R,U,P);$=[];K=0}U={};x++;aa++;if(x==ma)break}}a.p.gridview===true&&b("tbody:first",g).append($.join(""));a.p.totaltime=new Date-w;if(x>0){a.grid.cols=a.rows[0].cells;if(a.p.records===0)a.p.records=ea}$=null;if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=x;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(s){a.p.records=ea;a.p.lastpage=Math.ceil(ea/ma)}q||J(false,true);if(s){for(;x<ea;){P=
d[x];R=X(P,x);if(a.p.xmlReader.repeatitems){ca||(ca=S(F+B+I));qa=b(a.p.xmlReader.cell,P);b.each(ca,function(ga){var da=qa[this];if(!da)return false;u=da.textContent||da.text;U[a.p.colModel[ga+F+B+I].name]=u})}else for(z=0;z<T.length;z++){u=b(T[z],P).text();U[a.p.colModel[z+F+B+I].name]=u}U[C]=R;a.p.data.push(U);U={};x++}ra()}}},fa=function(d,g,h,q,p){var w=new Date;if(d){if(a.p.treeANode===-1&&!a.p.scroll){ba(g,false);h=0}else h=h>0?h:0;var s=a.p.datatype=="local"?a.p.localReader:a.p.jsonReader,C,
z=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="jsonstring";if(z){a.p.data=[];a.p._index={};C=a.p.localReader.id="_id_"}var x=a.p.reccount=0,u,D,F,B=[],I,M=0,X=0,T=0,ca,U,Y,P={},R,$=a.rows.length,K;F=[];R=0;var wa=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=b.jgrid.getAccessor(d,s.page)||0;Y=b.jgrid.getAccessor(d,s.total);a.p.lastpage=Y===undefined?1:Y;a.p.records=b.jgrid.getAccessor(d,s.records)||0;a.p.userData=b.jgrid.getAccessor(d,s.userdata)||{};s.repeatitems||(I=B=G("json"));Y=a.p.keyIndex===
false?s.id:a.p.keyIndex;if(B.length>0&&!isNaN(Y)){if(a.p.remapColumns&&a.p.remapColumns.length)Y=b.inArray(Y,a.p.remapColumns);Y=B[Y]}if(U=b.jgrid.getAccessor(d,s.root)){ca=U.length;d=0;var ea=parseInt(a.p.rowNum,10),aa=a.p.scroll?(parseInt(a.p.page,10)-1)*ea+1:1;if(p)ea*=p+1;for(var ma=b.isFunction(a.p.afterInsertRow);d<ca;){p=U[d];K=b.jgrid.getAccessor(p,Y);if(K===undefined){K=aa+d;if(B.length===0)if(s.cell){u=p[s.cell];K=u[Y]||K}}u=h===0?0:h+1;u=(u+d)%2==1?wa:"";F[R++]='<tr id="'+K+'" role="row" class= "ui-widget-content jqgrow ui-row-'+
a.p.direction+""+u+'">';if(a.p.rownumbers===true){F[R++]=t(0,d,a.p.page,a.p.rowNum);T=1}if(a.p.multiselect){F[R++]=A(K,T,d);M=1}if(a.p.subGrid){F[R++]=b(a).jqGrid("addSubGridCell",M+T,d+h);X=1}if(s.repeatitems){if(s.cell)p=b.jgrid.getAccessor(p,s.cell);I||(I=S(M+X+T))}for(D=0;D<I.length;D++){u=b.jgrid.getAccessor(p,I[D]);F[R++]=o(K,u,D+M+X+T,d+h,p);P[a.p.colModel[D+M+X+T].name]=u}F[R++]="</tr>";if(z){P[C]=K;a.p.data.push(P)}if(a.p.gridview===false){if(a.p.treeGrid===true){R=a.p.treeANode>=-1?a.p.treeANode:
0;F=b(F.join(""))[0];$===0?b("tbody:first",g).append(F):b(a.rows[d+R+h]).after(F);try{b(a).jqGrid("setTreeNode",P,F)}catch(Aa){}}else b("tbody:first",g).append(F.join(""));if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-1],M+T)}catch(qa){}ma&&a.p.afterInsertRow.call(a,K,P,p);F=[];R=0}P={};x++;d++;if(x==ea)break}a.p.gridview===true&&b("tbody:first",g).append(F.join(""));a.p.totaltime=new Date-w;if(x>0){a.grid.cols=a.rows[0].cells;if(a.p.records===0)a.p.records=ca}}if(!a.p.treeGrid&&
!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=x;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(z){a.p.records=ca;a.p.lastpage=Math.ceil(ca/ea)}q||J(false,true);if(z){for(;x<ca;){p=U[x];K=b.jgrid.getAccessor(p,Y);if(K===undefined){K=aa+x;if(B.length===0)if(s.cell){u=p[s.cell];K=u[Y]||K}}if(p){if(s.repeatitems){if(s.cell)p=b.jgrid.getAccessor(p,s.cell);I||(I=S(M+X+T))}for(D=0;D<I.length;D++){u=b.jgrid.getAccessor(p,I[D]);P[a.p.colModel[D+M+X+T].name]=
u}P[C]=K;a.p.data.push(P);P={}}x++}ra()}}},ka=function(){var d,g=false,h=[],q,p;if(a.p.data.length){b.each(a.p.colModel,function(){sorttype=this.sorttype||"text";if(sorttype=="date"||sorttype=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){q=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat;p=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat}else q=
p=this.datefmt||"Y-m-d";h[this.name]={stype:sorttype,srcfmt:q,newfmt:p}}else h[this.name]={stype:sorttype,srcfmt:"",newfmt:""};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",a.p.sortname,a.p.sortorder,h[d].stype,h[d].srcfmt);else{var w={eq:function(B){return B.equals},ne:function(B){return B.not().equals},lt:function(B){return B.less},le:function(B){return B.lessOrEquals},gt:function(B){return B.greater},ge:function(B){return B.greaterOrEquals},
cn:function(B){return B.contains},nc:function(B){return B.not().contains},bw:function(B){return B.startsWith},bn:function(B){return B.not().startsWith},en:function(B){return B.not().endsWith},ew:function(B){return B.endsWith},ni:function(B){return B.not().equals},"in":function(B){return B.equals}},s=b.jgrid.from(a.p.data);if(a.p.search===true){var C=a.p.postData.filters;if(C){if(typeof C=="string")C=b.jgrid.parse(C);for(var z=0,x=C.rules.length,u;z<x;z++){u=C.rules[z];var D=C.groupOp;if(w[u.op]&&
u.field&&u.data&&D)s=D.toUpperCase()=="OR"?w[u.op](s)(u.field,u.data,h[u.field]).or():w[u.op](s)(u.field,u.data,h[u.field])}}else try{s=w[a.p.postData.searchOper](s)(a.p.postData.searchField,a.p.postData.searchString,h[a.p.postData.searchField])}catch(F){}}if(d&&a.p.sortorder)a.p.sortorder.toUpperCase()=="DESC"?s.orderBy(d,"d",h[d].stype,h[d].srcfmt):s.orderBy(d,"a",h[d].stype,h[d].srcfmt);w=s.select();s=parseInt(a.p.rowNum,10);C=w.length;z=parseInt(a.p.page,10);x=Math.ceil(C/s);u={};w=w.slice((z-
1)*s,z*s);h=s=null;u[a.p.localReader.total]=x;u[a.p.localReader.page]=z;u[a.p.localReader.records]=C;u[a.p.localReader.root]=w;w=null;return u}}},J=function(d,g){var h,q,p,w,s,C,z,x="";p=parseInt(a.p.page,10)-1;if(p<0)p=0;p*=parseInt(a.p.rowNum,10);s=p+a.p.reccount;if(a.p.scroll){h=b("tbody:first > tr",a.grid.bDiv);p=s-h.length;a.p.reccount=h.length;if(q=h.outerHeight()){h=p*q;q=parseInt(a.p.records,10)*q;b(">div:first",a.grid.bDiv).css({height:q}).children("div:first").css({height:h,display:h?"":
"none"})}a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}x=a.p.pager?a.p.pager:"";x+=a.p.toppager?x?","+a.p.toppager:a.p.toppager:"";if(x){z=b.jgrid.formatter.integer||{};h=H(a.p.page);q=H(a.p.lastpage);b(".selbox",x).attr("disabled",false);if(a.p.pginput===true){b(".ui-pg-input",x).val(a.p.page);b("#sp_1",x).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,z):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",x).html(a.p.emptyrecords);else{w=p+1;C=a.p.records;if(b.fmatter){w=
b.fmatter.util.NumberFormat(w,z);s=b.fmatter.util.NumberFormat(s,z);C=b.fmatter.util.NumberFormat(C,z)}b(".ui-paging-info",x).html(b.jgrid.format(a.p.recordtext,w,s,C))}if(a.p.pgbuttons===true){if(h<=0)h=q=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==q||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(u){b(this).html(p+
1+u)});g&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a)},Z=function(d){if(!a.grid.hDiv.loading){var g=a.p.scroll&&d===false,h={},q,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 w=a.p.loadComplete,s=b.isFunction(w);s||(w=null);var C=0;d=d||1;if(d>1)if(p.npage!==null){h[p.npage]=d;C=d-1;d=1}else w=function(x){a.p.page++;a.grid.hDiv.loading=false;s&&a.p.loadComplete.call(a,x);Z(d-1)};else p.npage!==null&&delete a.p.postData[p.npage];b.extend(a.p.postData,h);var z=!a.p.scroll?0: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);q=a.p.datatype.toLowerCase();
switch(q){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:q,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(x){q==="xml"?Q(x,a.grid.bDiv,z,d>1,C):fa(x,a.grid.bDiv,z,d>1,C);w&&w.call(a,x);g&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";oa()},error:function(x,u,D){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,x,u,D);oa()},beforeSend:function(x){sa();
b.isFunction(a.p.loadBeforeSend)&&a.p.loadBeforeSend.call(a,x)}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":sa();h=b.jgrid.stringToDoc(a.p.datastr);s&&a.p.loadComplete.call(a,h);Q(h,a.grid.bDiv);a.p.datatype="local";a.p.datastr=null;oa();break;case "jsonstring":sa();h=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;s&&a.p.loadComplete.call(a,h);fa(h,a.grid.bDiv);a.p.datatype="local";a.p.datastr=null;oa();break;case "local":case "clientside":sa();a.p.datatype=
"local";h=ka();fa(h,a.grid.bDiv,z,d>1,C);w&&w.call(a,h);g&&a.grid.populateVisible();oa();break}}}},ra=function(){var d=a.p.data.length,g,h,q;g=a.p.rownumbers===true?1:0;h=a.p.multiselect===true?1:0;q=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+q+g].name;for(h=0;h<d;h++){q=b.jgrid.getAccessor(a.p.data[h],g);a.p._index[q]=h}},sa=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}};v=function(d,g){var h="",q="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",p="",w,s,C,z,x=function(u){var D;if(b.isFunction(a.p.onPaging))D=a.p.onPaging.call(a,
u);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(D=="stop")return false;return true};d=d.substr(1);w="pg_"+d;s=d+"_left";C=d+"_center";z=d+"_right";b("#"+d).append("<div id='"+w+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;' role='row'><tbody><tr><td id='"+s+"' align='left'></td><td id='"+C+"' align='center' style='white-space:pre;'></td><td id='"+
z+"' 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(s=0;s<a.p.rowList.length;s++)p+="<option role='option' value='"+a.p.rowList[s]+"'"+(a.p.rowNum==a.p.rowList[s]?" selected":"")+">"+a.p.rowList[s]+"</option>";p+="</select></td>"}if(n=="rtl")q+=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){s=["first"+g,"prev"+g,"next"+g,"last"+g];n=="rtl"&&s.reverse();q+="<td id='"+s[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";q+="<td id='"+s[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";q+=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>":
"";q+="<td id='"+s[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";q+="<td id='"+s[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(h!="")q+=h;if(n=="ltr")q+=p;q+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+d+"_"+a.p.recordpos,"#"+w).append("<div dir='"+n+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+d+"_"+a.p.pagerpos,"#"+w).append(q);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>");q=b(q).clone().appendTo("#testpg").width();b("#testpg").remove();if(q>0){if(h!="")q+=50;b("td#"+d+"_"+a.p.pagerpos,"#"+w).width(q)}a.p._nvtd=[];a.p._nvtd[0]=q?Math.floor((a.p.width-q)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;q=null;b(".ui-pg-selbox","#"+w).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(!x("records"))return false;Z();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+w).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 u=H(a.p.page,1),D=H(a.p.lastpage,1),F=false,B=true,I=true,M=true,X=true;if(D===0||D===1)X=M=I=B=false;else if(D>1&&u>=1)if(u===1)I=B=false;else{if(!(u>1&&u<D))if(u===D)X=M=false}else if(D>1&&u===0){X=M=false;u=D-1}if(this.id==="first"+g&&B){a.p.page=1;F=true}if(this.id==="prev"+g&&I){a.p.page=u-1;F=true}if(this.id==="next"+g&&M){a.p.page=u+1;F=true}if(this.id==="last"+g&&X){a.p.page=D;F=true}if(F){if(!x(this.id))return false;
Z()}return false})}a.p.pginput===true&&b("input.ui-pg-input","#"+w).keypress(function(u){if((u.charCode?u.charCode:u.keyCode?u.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!x("user"))return false;Z();return false}return this})};var Ba=function(d,g,h,q){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(q)if(a.p.lastsort==g&&a.p.sortorder==q&&!h)return;else a.p.sortorder=q;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;ba(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")});Z();a.p.lastsort=g;if(a.p.sortname!=d&&g)a.p.lastsort=g}},Da=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},Ea=function(d){var g,h={},q=E?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+q;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++)if(a.p.colModel[k].key===true){a.p.keyIndex=k;break}a.p.sortorder=a.p.sortorder.toLowerCase();if(this.p.treeGrid===true){try{b(this).jqGrid("setTreeGrid")}catch(Ia){}if(a.p.datatype!="local")a.p.localReader={id:"_id_"}}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(Ja){}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:E?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&&ra();var V="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",Ca,la,xa,pa,ta,W,N,na;la=na="";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"){na=" ui-i-asc";la=" ui-i-desc"}Ca=y?"class='ui-th-div-ie'":"";
na="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+na+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+n+"'></span>";na+="<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])+'"':"";V+="<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;V+="<div id='jqgh_"+a.p.colModel[k].name+"' "+Ca+">"+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;V+=na+"</div></th>"}V+="</tr></thead>";b(this).append(V);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 ya=[],ua;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){if(this.checked){b("[id^=jqg_]",a.rows).attr("checked",true);b(a.rows).each(function(d){if(!b(this).hasClass("subgrid")){b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow[d]=a.p.selrow=this.id}});ua=true;ya=[]}else{b("[id^=jqg_]",a.rows).attr("checked",false);b(a.rows).each(function(d){if(!b(this).hasClass("subgrid")){b(this).removeClass("ui-state-highlight").attr("aria-selected",
"false");ya[d]=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:ya,ua)})}if(a.p.autowidth===true){V=b(O).innerWidth();a.p.width=V>0?V:"nw"}(function(){var d=0,g=a.p.cellLayout,h=0,q,p=a.p.scrollOffset,w,s=false,C,z=0,x=0,u=0,D;if(E)g=0;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;if(this.hidden===false){d+=H(this.width,0);if(this.fixed){z+=this.width;x+=this.width+g}else h++;u++}});
if(isNaN(a.p.width))a.p.width=f.width=d;else f.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=f.width-g*h-x;if(!isNaN(a.p.height)){C-=p;s=true}d=0;b.each(a.p.colModel,function(F){if(this.hidden===false&&!this.fixed){this.width=w=Math.round(C*this.width/(a.p.tblwidth-z));d+=w;q=F}});D=0;if(s){if(f.width-x-(d+g*h)!==p)D=f.width-x-(d+g*h)-p}else if(!s&&Math.abs(f.width-x-(d+g*h))!==1)D=f.width-x-(d+g*h);a.p.colModel[q].width+=
D;a.p.tblwidth=d+D+z+u*g;if(a.p.tblwidth>a.p.width){a.p.colModel[q].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(O).css("width",f.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(r).css("width",f.width+"px");V=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+"'>";r=b("tr:first",V);a.p.disableClick=false;b("th",r).each(function(d){xa=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("&#160;").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",xa+"px").prepend(pa);a.p.colModel[d].hidden&&b(this).css("display","none");
f.headers[d]={width:xa,el:this};ta=a.p.colModel[d].sortable;if(typeof ta!=="boolean")ta=a.p.colModel[d].sortable=true;var 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,"")+">&#160;</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=Da(g);f.dragStart(g,d,Ea(g));return false}}).click(function(d){if(a.p.disableClick)return a.p.disableClick=false;var g="th>div.ui-jqgrid-sortable",h,q;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;q=d.attr("sort")}Ba(b("div",this)[0].id,g,h,q);return false}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",r)}catch(Ka){}if(a.p.footerrow)va+="</tr></tbody></table>";this.appendChild(document.createElement("tbody"));b(this).addClass("ui-jqgrid-btable");r=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(V);var ha=a.p.caption&&a.p.hiddengrid===true?
true:false;V=b("<div class='ui-jqgrid-hbox"+(n=="rtl"?"-rtl":"")+"'></div>");f.hDiv=document.createElement("div");b(f.hDiv).css({width:f.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(V);b(V).append(r);ha&&b(f.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:f.width+"px"}).appendTo(O).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");ha&&b(a.p.pager).hide();
v(a.p.pager,"")}a.p.cellEdit===false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(d){N=b(d.target).closest("tr.jqgrow");b(N).attr("class")!=="subgrid"&&b(N).addClass("ui-state-hover");return false}).bind("mouseout",function(d){N=b(d.target).closest("tr.jqgrow");b(N).removeClass("ui-state-hover");return false});var ia,ja;b(a).before(f.hDiv).click(function(d){W=d.target;var g=b(W).hasClass("cbox");N=b(W,a.rows).closest("tr.jqgrow");if(b(N).length===0)return this;var h=true;if(b.isFunction(a.p.beforeSelectRow))h=
a.p.beforeSelectRow.call(a,N[0].id,d);if(W.tagName=="A"||(W.tagName=="INPUT"||W.tagName=="TEXTAREA"||W.tagName=="OPTION"||W.tagName=="SELECT")&&!g)return this;if(h===true){if(a.p.cellEdit===true)if(a.p.multiselect&&g)b(a).jqGrid("setSelection",N[0].id,true);else{ia=N[0].rowIndex;ja=b.jgrid.getCellIndex(W);try{b(a).jqGrid("editCell",ia,ja,true)}catch(q){}}else if(a.p.multikey)if(d[a.p.multikey])b(a).jqGrid("setSelection",N[0].id,true);else{if(a.p.multiselect&&g){g=b("[id^=jqg_]",N).attr("checked");
b("[id^=jqg_]",N).attr("checked",!g)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!g){b(a.p.selarrrow).each(function(p,w){p=a.rows.namedItem(w);b(p).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(w),p).attr("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}b(a).jqGrid("setSelection",N[0].id,true)}if(b.isFunction(a.p.onCellSelect)){ia=N[0].id;ja=b.jgrid.getCellIndex(W);a.p.onCellSelect.call(a,ia,ja,b(W).html(),d)}d.stopPropagation()}else return this}).bind("reloadGrid",
function(d,g){if(a.p.treeGrid===true){a.p.datatype=a.p.treedatatype;if(a.p.postData.hasOwnProperty("nodeid")&&a.p.postData.nodeid==""){a.p.data=[];_index={}}}g&&g.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local")b(a).jqGrid("resetSelection");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&&ba(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){W=d.target;N=b(W,a.rows).closest("tr.jqgrow");if(b(N).length===0)return false;ia=N[0].rowIndex;ja=b.jgrid.getCellIndex(W);a.p.ondblClickRow.call(a,b(N).attr("id"),ia,ja,d);return false});b.isFunction(this.p.onRightClickRow)&&
b(this).bind("contextmenu",function(d){W=d.target;N=b(W,a.rows).closest("tr.jqgrow");if(b(N).length===0)return false;a.p.multiselect||b(a).jqGrid("setSelection",N[0].id,true);ia=N[0].rowIndex;ja=b.jgrid.getCellIndex(W);a.p.onRightClickRow.call(a,b(N).attr("id"),ia,ja,d);return false});f.bDiv=document.createElement("div");b(f.bDiv).append(b('<div style="position:relative;'+(y&&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:f.width+"px"}).scroll(f.scrollGrid);b("table:first",f.bDiv).css({width:a.p.tblwidth+"px"});if(y){b("tbody",this).size()==2&&b("tbody:first",this).remove();a.p.multikey&&b(f.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(f.bDiv).bind("mousedown",function(){return false});ha&&b(f.bDiv).hide();f.cDiv=document.createElement("div");var za=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){za.addClass("ui-state-hover")},
function(){za.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(n=="rtl"?"left":"right","0px"):"";b(f.cDiv).append(za).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(f.cDiv).insertBefore(f.hDiv);if(a.p.toolbar[0]){f.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(f.uDiv).insertBefore(f.hDiv);else a.p.toolbar[1]==
"bottom"&&b(f.uDiv).insertAfter(f.hDiv);if(a.p.toolbar[1]=="both"){f.ubDiv=document.createElement("div");b(f.uDiv).insertBefore(f.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);b(f.ubDiv).insertAfter(f.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ha&&b(f.ubDiv).hide()}else b(f.uDiv).width(f.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);ha&&b(f.uDiv).hide()}if(a.p.toppager){a.p.toppager=a.p.id+"_toppager";f.topDiv=b("<div id='"+
a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(f.topDiv).insertBefore(f.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(f.width);v(a.p.toppager,"_t")}if(a.p.footerrow){f.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0];V=b("<div class='ui-jqgrid-hbox"+(n=="rtl"?"-rtl":"")+"'></div>");b(f.sDiv).append(V).insertAfter(f.hDiv).width(f.width);b(V).append(va);f.footers=b(".ui-jqgrid-ftable",f.sDiv)[0].rows[0].cells;if(a.p.rownumbers)f.footers[0].className="ui-state-default jqgrid-rownum";
ha&&b(f.sDiv).hide()}if(a.p.caption){var Fa=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",f.cDiv).click(function(d){var g=b.isFunction(a.p.onHeaderClick);if(a.p.gridstate=="visible"){b(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+a.p.id).slideUp("fast");a.p.pager&&b(a.p.pager).slideUp("fast");a.p.toppager&&b(a.p.toppager).slideUp("fast");if(a.p.toolbar[0]===true){a.p.toolbar[1]=="both"&&b(f.ubDiv).slideUp("fast");b(f.uDiv).slideUp("fast")}a.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+
a.p.id).slideUp("fast");b("span",this).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)ha||a.p.onHeaderClick.call(a,a.p.gridstate,d)}else if(a.p.gridstate=="hidden"){b(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+a.p.id).slideDown("fast");a.p.pager&&b(a.p.pager).slideDown("fast");a.p.toppager&&b(a.p.toppager).slideDown("fast");if(a.p.toolbar[0]===
true){a.p.toolbar[1]=="both"&&b(f.ubDiv).slideDown("fast");b(f.uDiv).slideDown("fast")}a.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+a.p.id).slideDown("fast");b("span",this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ha){a.p.datatype=Fa;Z();ha=false}a.p.gridstate="visible";b("#gbox_"+a.p.id).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+a.p.id).show();g&&a.p.onHeaderClick.call(a,a.p.gridstate,d)}return false});if(ha){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",
f.cDiv).trigger("click")}}}else b(f.cDiv).hide();b(f.hDiv).after(f.bDiv).mousemove(function(d){if(f.resizing){f.dragMove(d);return false}});b(".ui-jqgrid-labels",f.hDiv).bind("selectstart",function(){return false});b(document).mouseup(function(){if(f.resizing){f.dragEnd();return false}return true});this.updateColumns=function(){var d=this.rows[0],g=this;if(d){b("td",d).each(function(h){b(this).css("width",g.grid.headers[h].width+"px")});this.grid.cols=d.cells}return this};a.formatCol=L;a.sortData=
Ba;a.updatepager=J;a.refreshIndex=ra;a.formatter=function(d,g,h,q,p){return m(d,g,h,q,p)};b.extend(f,{populate:Z,emptyRows:ba});this.grid=f;a.addXmlData=function(d){Q(d,a.grid.bDiv)};a.addJSONData=function(d){fa(d,a.grid.bDiv)};Z();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}})};b.jgrid.extend({getGridParam:function(e){var j=this[0];if(j&&j.grid)return e?typeof j.p[e]!="undefined"?j.p[e]:null:j.p},setGridParam:function(e){return this.each(function(){this.grid&&typeof e==="object"&&
b.extend(true,this.p,e)})},getDataIDs:function(){var e=[],j=0,i;this.each(function(){if((i=this.rows.length)&&i>0)for(;j<i;){e[j]=this.rows[j].id;j++}});return e},setSelection:function(e,j){return this.each(function(){function i(a){var r=b(c.grid.bDiv)[0].clientHeight,v=b(c.grid.bDiv)[0].scrollTop,y=c.rows[a].offsetTop;a=c.rows[a].clientHeight;if(y+a>=r+v)b(c.grid.bDiv)[0].scrollTop=y-(r+v)+a+v;else if(y<r+v)if(y<v)b(c.grid.bDiv)[0].scrollTop=y}var c=this,f,k,n;if(e!==undefined){j=j===false?false:
true;if(k=c.rows.namedItem(e+"")){if(c.p.scrollrows===true){f=c.rows.namedItem(e).rowIndex;f>=0&&i(f)}if(c.p.multiselect){c.p.selrow=k.id;n=b.inArray(c.p.selrow,c.p.selarrrow);if(n===-1){k.className!=="ui-subgrid"&&b(k).addClass("ui-state-highlight").attr("aria-selected","true");f=true;b("#jqg_"+b.jgrid.jqID(c.p.selrow),c.rows[k.rowIndex]).attr("checked",f);c.p.selarrrow.push(c.p.selrow);c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,c.p.selrow,f)}else{k.className!=="ui-subgrid"&&b(k).removeClass("ui-state-highlight").attr("aria-selected",
"false");f=false;b("#jqg_"+b.jgrid.jqID(c.p.selrow),c.rows[k.rowIndex]).attr("checked",f);c.p.selarrrow.splice(n,1);c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,c.p.selrow,f);k=c.p.selarrrow[0];c.p.selrow=k===undefined?null:k}}else if(k.className!=="ui-subgrid"){c.p.selrow&&b(c.rows.namedItem(c.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");c.p.selrow=k.id;b(k).addClass("ui-state-highlight").attr("aria-selected","true");c.p.onSelectRow&&j&&c.p.onSelectRow.call(c,c.p.selrow,
true)}}}})},resetSelection:function(){return this.each(function(){var e=this,j;if(e.p.multiselect){b(e.p.selarrrow).each(function(i,c){j=e.rows.namedItem(c);b(j).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(c),j).attr("checked",false)});b("#cb_"+b.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",false);e.p.selarrrow=[]}else if(e.p.selrow){b("tr#"+b.jgrid.jqID(e.p.selrow),e.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");e.p.selrow=
null}e.p.savedRow=[]})},getRowData:function(e){var j={},i,c=false,f,k=0;this.each(function(){var n=this,a,r;if(typeof e=="undefined"){c=true;i=[];f=n.rows.length}else{r=n.rows.namedItem(e);if(!r)return j;f=1}for(;k<f;){if(c)r=n.rows[k];b("td",r).each(function(v){a=n.p.colModel[v].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[v]},v)}catch(y){j[a]=
b.jgrid.htmlDecode(b(this).html())}});k++;if(c){i.push(j);j={}}}});return i?i:j},delRowData:function(e){var j=false,i,c,f;this.each(function(){var k=this;if(i=k.rows.namedItem(e)){f=i.rowIndex;b(i).remove();k.p.records--;k.p.reccount--;k.updatepager(true,false);j=true;if(k.p.multiselect){c=b.inArray(e,k.p.selarrrow);c!=-1&&k.p.selarrrow.splice(c,1)}if(e==k.p.selrow)k.p.selrow=null}else return false;if(k.p.datatype=="local"){var n=null;n=k.p._index[e];if(n!==null){k.p.data.splice(n,1);k.refreshIndex()}}f===
0&&j&&k.updateColumns();if(k.p.altRows===true&&j){var a=k.p.altclass;b(k.rows).each(function(r){r%2==1?b(this).addClass(a):b(this).removeClass(a)})}});return j},setRowData:function(e,j,i){var c,f=true,k;this.each(function(){if(!this.grid)return false;var n=this,a,r,v=typeof i,y={};r=n.rows.namedItem(e);if(!r)return false;if(j)try{b(this.p.colModel).each(function(H){c=this.name;if(j[c]!==undefined){y[c]=this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?b.unformat.date(j[c],this):
j[c];a=n.formatter(e,j[c],H,j,"edit");k=this.title?{title:b.jgrid.stripHtml(a)}:{};n.p.treeGrid===true&&c==n.p.ExpandColumn?b("td:eq("+H+") > span:first",r).html(a).attr(k):b("td:eq("+H+")",r).html(a).attr(k)}});if(n.p.datatype=="local"){var E;E=n.p._index[e];if(typeof E!="undefined")n.p.data[E]=b.extend(true,n.p.data[E],y);y=null}}catch(O){f=false}if(f)if(v==="string")b(r).addClass(i);else v==="object"&&b(r).css(i)});return f},addRowData:function(e,j,i,c){i||(i="last");var f=false,k,n,a,r,v,y,E,
O,H="",L,l,m,o,A;if(j){if(b.isArray(j)){L=true;i="last";l=e}else{j=[j];L=false}this.each(function(){var t=this,G=j.length;v=t.p.rownumbers===true?1:0;a=t.p.multiselect===true?1:0;r=t.p.subGrid===true?1:0;if(!L)if(typeof e!="undefined")e+="";else{e=t.p.records+1+"";if(t.p.keyIndex!==false){l=t.p.colModel[t.p.keyIndex+a+r+v].name;if(typeof j[0][l]!="undefined")e=j[0][l]}}m=t.p.altclass;for(var S=0,ba="",Q={},fa=b.isFunction(t.p.afterInsertRow)?true:false;S<G;){o=j[S];n="";if(L){try{e=o[l]}catch(ka){e=
t.p.records+1+""}ba=t.p.altRows===true?(t.rows.length-1)%2===0?m:"":""}if(v){H=t.formatCol(0,1,"");n+='<td role="gridcell" aria-describedby="'+t.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+H+">0</td>"}if(a){O='<input role="checkbox" type="checkbox" id="jqg_'+e+'" class="cbox"/>';H=t.formatCol(v,1,"");n+='<td role="gridcell" aria-describedby="'+t.p.id+'_cb" '+H+">"+O+"</td>"}if(r)n+=b(t).jqGrid("addSubGridCell",a+v,1);for(E=a+r+v;E<t.p.colModel.length;E++){A=t.p.colModel[E];k=A.name;Q[k]=A.formatter&&
typeof A.formatter==="string"&&A.formatter=="date"?b.unformat.date(o[k],A):o[k];O=t.formatter(e,o[k],E,o,"edit");H=t.formatCol(E,1,O);n+='<td role="gridcell" aria-describedby="'+t.p.id+"_"+k+'" '+H+">"+O+"</td>"}n='<tr id="'+e+'" role="row" class="ui-widget-content jqgrow ui-row-'+t.p.direction+" "+ba+'">'+n+"</tr>";if(t.p.subGrid===true){n=b(n)[0];b(t).jqGrid("addSubGrid",n,a+v)}if(t.rows.length===0)b("table:first",t.grid.bDiv).append(n);else switch(i){case "last":b(t.rows[t.rows.length-1]).after(n);
break;case "first":b(t.rows[0]).before(n);break;case "after":if(y=t.rows.namedItem(c))b(t.rows[y.rowIndex+1]).hasClass("ui-subgrid")?b(t.rows[y.rowIndex+1]).after(n):b(y).after(n);break;case "before":if(y=t.rows.namedItem(c)){b(y).before(n);y=y.rowIndex}break}t.p.records++;t.p.reccount++;if(!t.grid.cols||!t.grid.cols.length)t.grid.cols=t.rows[0].cells;if(i==="first"||i==="before"&&y<=1||t.rows.length===1)t.updateColumns();fa&&t.p.afterInsertRow.call(t,e,o,o);S++;if(t.p.datatype=="local"){t.p._index[e]=
t.p.data.length;t.p.data.push(Q);Q={}}}if(t.p.altRows===true&&!L)if(i=="last")(t.rows.length-1)%2==1&&b(t.rows[t.rows.length-1]).addClass(m);else b(t.rows).each(function(J){J%2==1?b(this).addClass(m):b(this).removeClass(m)});t.updatepager(true,true);f=true})}return f},footerData:function(e,j,i){function c(r){for(var v in r)if(r.hasOwnProperty(v))return false;return true}var f,k=false,n={},a;if(typeof e=="undefined")e="get";if(typeof i!="boolean")i=true;e=e.toLowerCase();this.each(function(){var r=
this,v;if(!r.grid||!r.p.footerrow)return false;if(e=="set")if(c(j))return false;k=true;b(this.p.colModel).each(function(y){f=this.name;if(e=="set"){if(j[f]!==undefined){v=i?r.formatter("",j[f],y,j,"edit"):j[f];a=this.title?{title:b.jgrid.stripHtml(v)}:{};b("tr.footrow td:eq("+y+")",r.grid.sDiv).html(v).attr(a);k=true}}else if(e=="get")n[f]=b("tr.footrow td:eq("+y+")",r.grid.sDiv).html()})});return e=="get"?n:k},ShowHideCol:function(e,j){return this.each(function(){var i=this,c=false;if(i.grid){if(typeof e===
"string")e=[e];j=j!="none"?"":"none";var f=j==""?true:false;b(this.p.colModel).each(function(k){if(b.inArray(this.name,e)!==-1&&this.hidden===f){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;else i.p.tblwidth+=this.width;this.hidden=!f;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}}}})},hideCol:function(e){return this.each(function(){b(this).jqGrid("ShowHideCol",e,"none")})},showCol:function(e){return this.each(function(){b(this).jqGrid("ShowHideCol",e,"")})},remapColumns:function(e,j,i){function c(n){var a;a=n.length?b.makeArray(n):b.extend({},n);b.each(e,function(r){n[r]=
a[this]})}function f(n,a){b(">tr"+(a||""),n).each(function(){var r=this,v=b.makeArray(r.cells);b.each(e,function(){var y=v[this];y&&r.appendChild(y)})})}var k=this.get(0);c(k.p.colModel);c(k.p.colNames);c(k.grid.headers);f(b("thead:first",k.grid.hDiv),i&&":not(.ui-jqgrid-labels)");j&&f(b("tbody:first",k.grid.bDiv),".jqgrow");k.p.footerrow&&f(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(e);k.p.lastsort=b.inArray(k.p.lastsort,
e);if(k.p.treeGrid)k.p.expColInd=b.inArray(k.p.expColInd,e)},setGridWidth:function(e,j){return this.each(function(){if(this.grid){var i=this,c,f=0,k=i.p.cellLayout,n,a=0,r=false,v=i.p.scrollOffset,y,E=0,O=0,H=0,L;if(typeof j!="boolean")j=i.p.shrinkToFit;if(!isNaN(e)){e=parseInt(e,10);i.grid.width=i.p.width=e;b("#gbox_"+i.p.id).css("width",e+"px");b("#gview_"+i.p.id).css("width",e+"px");b(i.grid.bDiv).css("width",e+"px");b(i.grid.hDiv).css("width",e+"px");i.p.pager&&b(i.p.pager).css("width",e+"px");
i.p.toppager&&b(i.p.toppager).css("width",e+"px");if(i.p.toolbar[0]===true){b(i.grid.uDiv).css("width",e+"px");i.p.toolbar[1]=="both"&&b(i.grid.ubDiv).css("width",e+"px")}i.p.footerrow&&b(i.grid.sDiv).css("width",e+"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){f+=parseInt(this.width,10);if(this.fixed){O+=this.width;E+=this.width+k}else a++;H++}});if(a!==0){i.p.tblwidth=f;y=e-k*a-E;if(!isNaN(i.p.height))if(b(i.grid.bDiv)[0].clientHeight<
b(i.grid.bDiv)[0].scrollHeight){r=true;y-=v}f=0;var l=i.grid.cols.length>0;b.each(i.p.colModel,function(m){if(this.hidden===false&&!this.fixed){c=Math.round(y*this.width/(i.p.tblwidth-O));if(!(c<0)){this.width=c;f+=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}}});L=0;if(r){if(e-E-(f+k*a)!==v)L=e-E-(f+k*a)-v}else if(Math.abs(e-E-(f+k*a))!==1)L=e-E-(f+k*a);i.p.colModel[n].width+=L;
i.p.tblwidth=f+L+O+k*H;if(i.p.tblwidth>e){r=i.p.tblwidth-parseInt(e,10);i.p.tblwidth=e;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(e){return this.each(function(){var j=this;if(j.grid){b(j.grid.bDiv).css({height:e+(isNaN(e)?"":"px")});j.p.height=e;j.p.scroll&&j.grid.populateVisible()}})},setCaption:function(e){return this.each(function(){this.p.caption=e;b("span.ui-jqgrid-title",this.grid.cDiv).html(e);b(this.grid.cDiv).show()})},setLabel:function(e,j,i,c){return this.each(function(){var f=this,k=-1;if(f.grid){if(isNaN(e))b(f.p.colModel).each(function(r){if(this.name==e){k=r;return false}});
else k=parseInt(e,10);if(k>=0){var n=b("tr.ui-jqgrid-labels th:eq("+k+")",f.grid.hDiv);if(j){var a=b(".s-ico",n);b("[id^=jqgh_]",n).empty().html(j).append(a);f.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(e,j,i,c,f,k){return this.each(function(){var n=this,a=-1,r,v;if(n.grid){if(isNaN(j))b(n.p.colModel).each(function(E){if(this.name==j){a=E;return false}});else a=parseInt(j,10);if(a>=0)if(r=n.rows.namedItem(e)){var y=
b("td:eq("+a+")",r);if(i!==""||k===true){r=n.formatter(e,i,a,r,"edit");v=n.p.colModel[a].title?{title:b.jgrid.stripHtml(r)}:{};n.p.treeGrid&&b(".tree-wrap",b(y)).length>0?b("span",b(y)).html(r).attr(v):b(y).html(r).attr(v);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;v=n.p._index[e];if(parseInt(v,10)>=0)n.p.data[v][r.name]=i}}if(typeof c==="string")b(y).addClass(c);else c&&b(y).css(c);typeof f==="object"&&b(y).attr(f)}}})},
getCell:function(e,j){var i=false;this.each(function(){var c=this,f=-1;if(c.grid){if(isNaN(j))b(c.p.colModel).each(function(a){if(this.name===j){f=a;return false}});else f=parseInt(j,10);if(f>=0){var k=c.rows.namedItem(e);if(k)try{i=b.unformat(b("td:eq("+f+")",k),{rowId:k.id,colModel:c.p.colModel[f]},f)}catch(n){i=b.jgrid.htmlDecode(b("td:eq("+f+")",k).html())}}}});return i},getCol:function(e,j,i){var c=[],f,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(e))b(n.p.colModel).each(function(E){if(this.name===e){a=E;return false}});else a=parseInt(e,10);if(a>=0){var r=n.rows.length,v=0;if(r&&r>0){for(;v<r;){try{f=b.unformat(b(n.rows[v].cells[a]),{rowId:n.rows[v].id,colModel:n.p.colModel[a]},a)}catch(y){f=b.jgrid.htmlDecode(n.rows[v].cells[a].innerHTML)}if(i)k+=parseFloat(f);else if(j)c.push({id:n.rows[v].id,value:f});else c[v]=f;v++}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(e){return this.each(function(){var j=this;if(j.grid){if(typeof e!="boolean")e=false;b("tbody:first tr",j.grid.bDiv).remove();j.p.footerrow&&e&&b(".ui-jqgrid-ftable td",j.grid.sDiv).html("&#160;");j.p.selrow=null;j.p.selarrrow=[];j.p.savedRow=[];j.p.records=0;j.p.page="0";j.p.lastpage="0";j.p.reccount=0;j.p.data=[];j.p_index={};j.updatepager(true,false)}})},getInd:function(e,j){var i=false,c;this.each(function(){if(c=this.rows.namedItem(e))i=j===true?c:
c.rowIndex});return i}})})(jQuery);
(function(c){function u(a,b,d,e,g){var h=b;if(c.fn.fmatter[a])h=c.fn.fmatter[a](b,d,e,g);return h}c.fmatter={};c.fn.fmatter=function(a,b,d,e,g){d=c.extend({},c.jgrid.formatter,d);return u(a,b,d,e,g)};c.fmatter.util={NumberFormat:function(a,b){isNumber(a)||(a*=1);if(isNumber(a)){var d=a<0,e=a+"",g=b.decimalSeparator?b.decimalSeparator:".";if(isNumber(b.decimalPlaces)){var h=b.decimalPlaces;e=Math.pow(10,h);e=Math.round(a*e)/e+"";a=e.lastIndexOf(".");if(h>0){if(a<0){e+=g;a=e.length-1}else if(g!==".")e=
e.replace(".",g);for(;e.length-1-a<h;)e+="0"}}if(b.thousandsSeparator){h=b.thousandsSeparator;a=e.lastIndexOf(g);a=a>-1?a:e.length;g=e.substring(a);for(var f=-1,i=a;i>0;i--){f++;if(f%3===0&&i!==a&&(!d||i>1))g=h+g;g=e.charAt(i-1)+g}e=g}e=b.prefix?b.prefix+e:e;return e=b.suffix?e+b.suffix:e}else return a},DateFormat:function(a,b,d,e){var g=function(m,r){m=String(m);for(r=parseInt(r,10)||2;m.length<r;)m="0"+m;return m},h={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},f=0,i,k,j=["i18n"];j.i18n={dayNames:e.dayNames,
monthNames:e.monthNames};if(a in e.masks)a=e.masks[a];if(b.constructor===Date)f=b;else{b=b.split(/[\\\/:_;.\t\T\s-]/);a=a.split(/[\\\/:_;.\t\T\s-]/);i=0;for(k=a.length;i<k;i++){if(a[i]=="M"){f=c.inArray(b[i],j.i18n.monthNames);if(f!==-1&&f<12)b[i]=f+1}if(a[i]=="F"){f=c.inArray(b[i],j.i18n.monthNames);if(f!==-1&&f>11)b[i]=f+1-12}if(b[i])h[a[i].toLowerCase()]=parseInt(b[i],10)}h.m=parseInt(h.m,10)-1;f=h.y;if(f>=70&&f<=99)h.y=1900+h.y;else if(f>=0&&f<=69)h.y=2E3+h.y;f=new Date(h.y,h.m,h.d,h.h,h.i,h.s,
h.u)}if(d in e.masks)d=e.masks[d];else d||(d="Y-m-d");h=f.getHours();a=f.getMinutes();b=f.getDate();i=f.getMonth()+1;k=f.getTimezoneOffset();var l=f.getSeconds(),o=f.getMilliseconds(),n=f.getDay(),p=f.getFullYear(),q=(n+6)%7+1,s=(new Date(p,i-1,b)-new Date(p,0,1))/864E5,t={d:g(b),D:j.i18n.dayNames[n],j:b,l:j.i18n.dayNames[n+7],N:q,S:e.S(b),w:n,z:s,W:q<5?Math.floor((s+q-1)/7)+1:Math.floor((s+q-1)/7)||(((new Date(p-1,0,1)).getDay()+6)%7<4?53:52),F:j.i18n.monthNames[i-1+12],m:g(i),M:j.i18n.monthNames[i-
1],n:i,t:"?",L:"?",o:"?",Y:p,y:String(p).substring(2),a:h<12?e.AmPm[0]:e.AmPm[1],A:h<12?e.AmPm[2]:e.AmPm[3],B:"?",g:h%12||12,G:h,h:g(h%12||12),H:g(h),i:g(a),s:g(l),u:o,e:"?",I:"?",O:(k>0?"-":"+")+g(Math.floor(Math.abs(k)/60)*100+Math.abs(k)%60,4),P:"?",T:(String(f).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(f/1E3)};return d.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
function(m){return m in t?t[m]:m.substring(1)})}};c.fn.fmatter.defaultFormat=function(a,b){return isValue(a)&&a!==""?a:b.defaultValue?b.defaultValue:"&#160;"};c.fn.fmatter.email=function(a,b){return isEmpty(a)?c.fn.fmatter.defaultFormat(a,b):'<a href="mailto:'+a+'">'+a+"</a>"};c.fn.fmatter.checkbox=function(a,b){var d=c.extend({},b.checkbox);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));b=d.disabled===true?"disabled":"";if(isEmpty(a)||isUndefined(a))a=c.fn.fmatter.defaultFormat(a,
d);a+="";a=a.toLowerCase();return'<input type="checkbox" '+(a.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+a+'" offval="no" '+b+"/>"};c.fn.fmatter.link=function(a,b){var d={target:b.target},e="";isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(d.target)e="target="+d.target;return isEmpty(a)?c.fn.fmatter.defaultFormat(a,b):"<a "+e+' href="'+a+'">'+a+"</a>"};c.fn.fmatter.showlink=function(a,b){var d={baseLinkUrl:b.baseLinkUrl,showAction:b.showAction,
addParam:b.addParam||"",target:b.target,idName:b.idName},e="";isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(d.target)e="target="+d.target;d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+b.rowId+d.addParam;return isString(a)?"<a "+e+' href="'+d+'">'+a+"</a>":c.fn.fmatter.defaultFormat(a,b)};c.fn.fmatter.integer=function(a,b){var d=c.extend({},b.integer);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(isEmpty(a))return d.defaultValue;
return c.fmatter.util.NumberFormat(a,d)};c.fn.fmatter.number=function(a,b){var d=c.extend({},b.number);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(isEmpty(a))return d.defaultValue;return c.fmatter.util.NumberFormat(a,d)};c.fn.fmatter.currency=function(a,b){var d=c.extend({},b.currency);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(isEmpty(a))return d.defaultValue;return c.fmatter.util.NumberFormat(a,d)};c.fn.fmatter.date=
function(a,b,d,e){d=c.extend({},b.date);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));return!d.reformatAfterEdit&&e=="edit"?c.fn.fmatter.defaultFormat(a,b):isEmpty(a)?c.fn.fmatter.defaultFormat(a,b):c.fmatter.util.DateFormat(d.srcformat,a,d.newformat,d)};c.fn.fmatter.select=function(a,b){a+="";var d=false,e=[];if(!isUndefined(b.colModel.editoptions))d=b.colModel.editoptions.value;if(d){var g=b.colModel.editoptions.multiple===true?true:false,h=[],f;if(g){h=a.split(",");
h=c.map(h,function(l){return c.trim(l)})}if(isString(d))for(var i=d.split(";"),k=0,j=0;j<i.length;j++){f=i[j].split(":");if(f.length>2)f[1]=jQuery.map(f,function(l,o){if(o>0)return l}).join(":");if(g){if(jQuery.inArray(f[0],h)>-1){e[k]=f[1];k++}}else if(c.trim(f[0])==c.trim(a)){e[0]=f[1];break}}else if(isObject(d))if(g)e=jQuery.map(h,function(l){return d[l]});else e[0]=d[a]||""}a=e.join(", ");return a==""?c.fn.fmatter.defaultFormat(a,b):a};c.fn.fmatter.rowactions=function(a,b,d,e){switch(d){case "edit":d=
function(){c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+b).show();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).hide()};c("#"+b).jqGrid("editRow",a,e,null,null,null,{oper:"edit"},d,null,d);c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+b).hide();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).show();break;case "save":c("#"+b).jqGrid("saveRow",a,null,null);c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+
b).show();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).hide();break;case "cancel":c("#"+b).jqGrid("restoreRow",a);c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+b).show();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).hide();break}};c.fn.fmatter.actions=function(a,b){a={keys:false,editbutton:true,delbutton:true};isUndefined(b.colModel.formatoptions)||(a=c.extend(a,b.colModel.formatoptions));var d=b.rowId,e="",g;if(typeof d=="undefined"||
isEmpty(d))return"";if(a.editbutton){g="onclick=$.fn.fmatter.rowactions('"+d+"','"+b.gid+"','edit',"+a.keys+");";e=e+"<div style='margin-left:8px;'><div title='"+c.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}if(a.delbutton){g="onclick=jQuery('#"+b.gid+"').jqGrid('delGridRow','"+d+"');";e=e+"<div title='"+c.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+
g+"><span class='ui-icon ui-icon-trash'></span></div>"}g="onclick=$.fn.fmatter.rowactions('"+d+"','"+b.gid+"','save',false);";e=e+"<div title='"+c.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+g+"></span></div>";g="onclick=$.fn.fmatter.rowactions('"+d+"','"+b.gid+"','cancel',false);";return e=e+"<div title='"+c.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+
g+"></span></div></div>"};c.unformat=function(a,b,d,e){var g,h=b.colModel.formatter,f=b.colModel.formatoptions||{},i=/([\.\*\_\'\(\)\{\}\+\?\\])/g;unformatFunc=b.colModel.unformat||c.fn.fmatter[h]&&c.fn.fmatter[h].unformat;if(typeof unformatFunc!=="undefined"&&isFunction(unformatFunc))g=unformatFunc(c(a).text(),b,a);else if(typeof h!=="undefined"&&isString(h)){g=c.jgrid.formatter||{};switch(h){case "integer":f=c.extend({},g.integer,f);b=f.thousandsSeparator.replace(i,"\\$1");b=new RegExp(b,"g");g=
c(a).text().replace(b,"");break;case "number":f=c.extend({},g.number,f);b=f.thousandsSeparator.replace(i,"\\$1");b=new RegExp(b,"g");g=c(a).text().replace(b,"").replace(f.decimalSeparator,".");break;case "currency":f=c.extend({},g.currency,f);b=f.thousandsSeparator.replace(i,"\\$1");b=new RegExp(b,"g");g=c(a).text().replace(b,"").replace(f.decimalSeparator,".").replace(f.prefix,"").replace(f.suffix,"");break;case "checkbox":f=b.colModel.editoptions?b.colModel.editoptions.value.split(":"):["Yes","No"];
g=c("input",a).attr("checked")?f[0]:f[1];break;case "select":g=c.unformat.select(a,b,d,e);break;case "actions":return"";default:g=c(a).text()}}return g?g:e===true?c(a).text():c.jgrid.htmlDecode(c(a).html())};c.unformat.select=function(a,b,d,e){d=[];a=c(a).text();if(e===true)return a;b=c.extend({},b.colModel.editoptions);if(b.value){var g=b.value;b=b.multiple===true?true:false;e=[];var h;if(b){e=a.split(",");e=c.map(e,function(j){return c.trim(j)})}if(isString(g))for(var f=g.split(";"),i=0,k=0;k<f.length;k++){h=
f[k].split(":");if(h.length>2)h[1]=jQuery.map(h,function(j,l){if(l>0)return j}).join(":");if(b){if(jQuery.inArray(h[1],e)>-1){d[i]=h[0];i++}}else if(c.trim(h[1])==c.trim(a)){d[0]=h[0];break}}else if(isObject(g)){b||(e[0]=a);d=jQuery.map(e,function(j){var l;c.each(g,function(o,n){if(n==j){l=o;return false}});if(l)return l})}return d.join(", ")}else return a||""};c.unformat.date=function(a,b){var d=c.jgrid.formatter.date||{};isUndefined(b.formatoptions)||(d=c.extend({},d,b.formatoptions));return isEmpty(a)?
c.fn.fmatter.defaultFormat(a,b):c.fmatter.util.DateFormat(d.newformat,a,d.srcformat,d)};isValue=function(a){return isObject(a)||isString(a)||isNumber(a)||isBoolean(a)};isBoolean=function(a){return typeof a==="boolean"};isNull=function(a){return a===null};isNumber=function(a){return typeof a==="number"&&isFinite(a)};isString=function(a){return typeof a==="string"};isEmpty=function(a){if(!isString(a)&&isValue(a))return false;else if(!isValue(a))return true;a=c.trim(a).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,
"");return a===""};isUndefined=function(a){return typeof a==="undefined"};isObject=function(a){return a&&(typeof a==="object"||isFunction(a))||false};isFunction=function(a){return typeof a==="function"}})(jQuery);
(function(a){a.jgrid.extend({getColProp:function(g){var d={},b=this[0];if(b.grid){b=b.p.colModel;for(var n=0;n<b.length;n++)if(b[n].name==g){d=b[n];break}return d}},setColProp:function(g,d){return this.each(function(){if(this.grid)if(d)for(var b=this.p.colModel,n=0;n<b.length;n++)if(b[n].name==g){a.extend(this.p.colModel[n],d);break}})},sortGrid:function(g,d,b){return this.each(function(){var n=this,s=-1;if(n.grid){if(!g)g=n.p.sortname;for(var q=0;q<n.p.colModel.length;q++)if(n.p.colModel[q].index==
g||n.p.colModel[q].name==g){s=q;break}if(s!=-1){q=n.p.colModel[s].sortable;if(typeof q!=="boolean")q=true;if(typeof d!=="boolean")d=false;q&&n.sortData("jqgh_"+g,s,d,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var g=this.id;try{a("#gbox_"+g).remove()}catch(d){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var g={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:g.id});d.className=g.cl;g=this.id;a(d).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+g).length===1){a(d).insertBefore("#gbox_"+g).show();a(this.p.pager).insertBefore("#gbox_"+g)}else a(d).insertBefore("#gbox_"+g).show();a("#gbox_"+g).remove()}})},setGridState:function(g){return this.each(function(){if(this.grid){var d=this;if(g=="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(g=="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(g,d,b){var n,s=false,q;this.each(function(){var h=this,l,o,c,f;if(!h.grid)return false;
d||(d="id");g&&g.length>0&&a(g).each(function(){c=this;if(o=h.rows.namedItem(c[d])){f=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++){l=h.formatter(f,c[e],e,c,"edit");q=h.p.colModel[e].title?{title:a.jgrid.stripHtml(l)}:{};h.p.treeGrid===true&&n==h.p.ExpandColumn?a("td:eq("+e+") > span:first",o).html(l).attr(q):a("td:eq("+e+")",o).html(l).attr(q)}return s=true}a(h.p.colModel).each(function(m){n=b===true?this.jsonmap||
this.name:this.name;if(c[n]!==undefined){l=h.formatter(f,c[n],m,c,"edit");q=this.title?{title:a.jgrid.stripHtml(l)}:{};h.p.treeGrid===true&&n==h.p.ExpandColumn?a("td:eq("+m+") > span:first",o).html(l).attr(q):a("td:eq("+m+")",o).html(l).attr(q);s=true}})}})});return s},filterGrid:function(g,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(g){this.p.gridid=g.indexOf("#")!=-1?g:"#"+g;var n=a(this.p.gridid).jqGrid("getGridParam","colModel");if(n){if(this.p.gridModel===true){var s=a(this.p.gridid)[0],q;a.each(n,function(f){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?s.p.colNames[f]:"";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 f=0;f<n.length;f++)if(this.name==
n[f].name){this.index=n[f].index||this.name;break}if(!this.index)this.index=this.name});var h=function(){var f={},e=0,m,i=a(b.p.gridid)[0],k;i.p.searchdata={};a.isFunction(b.p.beforeSearch)&&b.p.beforeSearch();a.each(b.p.filterModel,function(){k=this.index;switch(this.stype){case "select":if(m=a("select[name="+k+"]",b).val()){f[k]=m;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(m=a("input[name="+k+"]",b).val()){f[k]=m;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(u){}}}});var p=e>0?true:false;a.extend(i.p.postData,f);var j;if(b.p.url){j=a(i).jqGrid("getGridParam","url");a(i).jqGrid("setGridParam",{url:b.p.url})}a(i).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);j&&a(i).jqGrid("setGridParam",
{url:j});a.isFunction(b.p.afterSearch)&&b.p.afterSearch()},l=function(){var f={},e,m=0,i=a(b.p.gridid)[0],k;a.isFunction(b.p.beforeClear)&&b.p.beforeClear();a.each(b.p.filterModel,function(){k=this.index;e=this.defval?this.defval:"";if(!this.stype)this.stype="text";switch(this.stype){case "select":var r;a("select[name="+k+"] 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){f[k]=r;b.p.marksearched&&a("#jqgh_"+this.name,
i.grid.hDiv).addClass("dirty-cell");m++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(u){}}break;case "text":a("input[name="+k+"]",b).val(e);if(e){f[k]=e;b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).addClass("dirty-cell");m++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(t){}}break}});var p=m>0?true:false;a.extend(i.p.postData,f);var j;
if(b.p.url){j=a(i).jqGrid("getGridParam","url");a(i).jqGrid("setGridParam",{url:b.p.url})}a(i).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);j&&a(i).jqGrid("setGridParam",{url:j});a.isFunction(b.p.afterClear)&&b.p.afterClear()},o=a("<form name='SearchForm' style=display:inline;' class='"+this.p.formclass+"'></form>"),c=a("<table class='"+this.p.tableclass+"' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");a(o).append(c);(function(){var f=document.createElement("tr"),
e,m,i,k;b.p.formtype=="horizontal"&&a(c).append(f);a.each(b.p.filterModel,function(p){i=document.createElement("td");a(i).append("<label for='"+this.name+"'>"+this.label+"</label>");k=document.createElement("td");var j=this;if(!this.stype)this.stype="text";switch(this.stype){case "select":if(this.surl)a(k).load(this.surl,function(){j.defval&&a("select",this).val(j.defval);a("select",this).attr({name:j.index||j.name,id:"sg_"+j.name});j.sopt&&a("select",this).attr(j.sopt);b.p.gridToolbar===true&&j.width&&
a("select",this).width(j.width);b.p.autosearch===true&&a("select",this).change(function(){h();return false})});else if(j.sopt.value){var r=j.sopt.value,u=document.createElement("select");a(u).attr({name:j.index||j.name,id:"sg_"+j.name}).attr(j.sopt);var t;if(typeof r==="string"){p=r.split(";");for(var v=0;v<p.length;v++){r=p[v].split(":");t=document.createElement("option");t.value=r[0];t.innerHTML=r[1];if(r[1]==j.defval)t.selected="selected";u.appendChild(t)}}else if(typeof r==="object")for(v in r)if(r.hasOwnProperty(v)){p++;
t=document.createElement("option");t.value=v;t.innerHTML=r[v];if(r[v]==j.defval)t.selected="selected";u.appendChild(t)}b.p.gridToolbar===true&&j.width&&a(u).width(j.width);a(k).append(u);b.p.autosearch===true&&a(u).change(function(){h();return false})}break;case "text":u=this.defval?this.defval:"";a(k).append("<input type='text' name='"+(this.index||this.name)+"' id='sg_"+this.name+"' value='"+u+"'/>");j.sopt&&a("input",k).attr(j.sopt);if(b.p.gridToolbar===true&&j.width)a.browser.msie?a("input",k).width(j.width-
4):a("input",k).width(j.width-2);b.p.autosearch===true&&a("input",k).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(f).append(k):a(f).append(i).append(k);a(f).append(k)}else{e=document.createElement("tr");a(e).append(i).append(k);a(c).append(e)}});k=document.createElement("td");if(b.p.enableSearch===true){m="<input type='button' id='sButton' class='"+b.p.buttonclass+
"' value='"+b.p.searchButton+"'/>";a(k).append(m);a("input#sButton",k).click(function(){h();return false})}if(b.p.enableClear===true){m="<input type='button' id='cButton' class='"+b.p.buttonclass+"' value='"+b.p.clearButton+"'/>";a(k).append(m);a("input#cButton",k).click(function(){l();return false})}if(b.p.enableClear===true||b.p.enableSearch===true)if(b.p.formtype=="horizontal")a(f).append(k);else{e=document.createElement("tr");a(e).append("<td>&#160;</td>").append(k);a(c).append(e)}})();a(this).append(o);
this.triggerSearch=h;this.clearSearch=l}else alert("Could not get grid colModel")}else alert("No target grid is set!")})},filterToolbar:function(g){g=a.extend({autosearch:true,searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND"},g||{});return this.each(function(){function d(h,l){var o=a(h);o[0]&&jQuery.each(l,function(){this.data!==undefined?o.bind(this.type,this.data,this.fn):o.bind(this.type,this.fn)})}var b=this,n=
function(){var h={},l=0,o,c,f={};a.each(b.p.colModel,function(){c=this.index||this.name;var j=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"bw";switch(this.stype){case "select":if(o=a("select[name="+c+"]",b.grid.hDiv).val()){h[c]=o;f[c]=j;l++}else try{delete b.p.postData[c]}catch(r){}break;case "text":if(o=a("input[name="+c+"]",b.grid.hDiv).val()){h[c]=o;f[c]=j;l++}else try{delete b.p.postData[c]}catch(u){}break}});var e=l>0?true:false;if(g.stringResult===true||b.p.datatype==
"local"){var m='{"groupOp":"'+g.groupOp+'","rules":[',i=0;a.each(h,function(j,r){if(i>0)m+=",";m+='{"field":"'+j+'",';m+='"op":"'+f[j]+'",';m+='"data":"'+r+'"}';i++});m+="]}";a.extend(b.p.postData,{filters:m})}else a.extend(b.p.postData,h);var k;if(b.p.searchurl){k=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var p=false;if(a.isFunction(g.beforeSearch))p=g.beforeSearch.call(b);p||a(b).jqGrid("setGridParam",{search:e}).trigger("reloadGrid",[{page:1}]);k&&a(b).jqGrid("setGridParam",{url:k});
a.isFunction(g.afterSearch)&&g.afterSearch()},s=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),q;a.each(b.p.colModel,function(){var h=this,l,o,c,f;o=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");l=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(f=this.surl||c.dataUrl)a.ajax(a.extend({url:f,dataType:"html",complete:function(p){if(c.buildSelect!==undefined)(p=c.buildSelect(p))&&a(l).append(p);else a(l).append(p.responseText);c.defaultValue&&a("select",l).val(c.defaultValue);a("select",l).attr({name:h.index||h.name,id:"gs_"+h.name});c.attr&&a("select",l).attr(c.attr);a("select",l).css({width:"100%"});c.dataInit!==undefined&&c.dataInit(a("select",l)[0]);c.dataEvents!==
undefined&&d(a("select",l)[0],c.dataEvents);g.autosearch===true&&a("select",l).change(function(){n();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){f=document.createElement("select");f.style.width="100%";a(f).attr({name:h.index||h.name,id:"gs_"+h.name});var m,i;if(typeof e==="string"){e=e.split(";");for(var k=0;k<e.length;k++){m=
e[k].split(":");i=document.createElement("option");i.value=m[0];i.innerHTML=m[1];f.appendChild(i)}}else if(typeof e==="object")for(m in e)if(e.hasOwnProperty(m)){i=document.createElement("option");i.value=m;i.innerHTML=e[m];f.appendChild(i)}c.defaultValue&&a(f).val(c.defaultValue);c.attr&&a(f).attr(c.attr);c.dataInit!==undefined&&c.dataInit(f);c.dataEvents!==undefined&&d(f,c.dataEvents);a(l).append(f);g.autosearch===true&&a(f).change(function(){n();return false})}}break;case "text":f=c.defaultValue?
c.defaultValue:"";a(l).append("<input type='text' style='width:95%;padding:0px;' name='"+(h.index||h.name)+"' id='gs_"+h.name+"' value='"+f+"'/>");c.attr&&a("input",l).attr(c.attr);c.dataInit!==undefined&&c.dataInit(a("input",l)[0]);c.dataEvents!==undefined&&d(a("input",l)[0],c.dataEvents);if(g.autosearch===true)g.searchOnEnter?a("input",l).keypress(function(p){if((p.charCode?p.charCode:p.keyCode?p.keyCode:0)==13){n();return false}return this}):a("input",l).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(){n()},500)}});break}a(o).append(l);a(s).append(o)});a("table thead",b.grid.hDiv).append(s);this.triggerToolbar=n;this.clearToolbar=function(h){var l={},o,c=0,f;h=typeof h!="boolean"?true:h;a.each(b.p.colModel,function(){o=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";f=this.index||this.name;switch(this.stype){case "select":var j;a("select[name="+f+
"] option",b.grid.hDiv).each(function(t){if(t===0)this.selected=true;if(a(this).text()==o){this.selected=true;j=a(this).val();return false}});if(j){l[f]=j;c++}else try{delete b.p.postData[f]}catch(r){}break;case "text":a("input[name="+f+"]",b.grid.hDiv).val(o);if(o){l[f]=o;c++}else try{delete b.p.postData[f]}catch(u){}break}});var e=c>0?true:false;if(g.stringResult===true||b.p.datatype=="local"){var m='{"groupOp":"'+g.groupOp+'","rules":[',i=0;a.each(l,function(j,r){if(i>0)m+=",";m+='{"field":"'+
j+'",';m+='"op":"eq",';m+='"data":"'+r+'"}';i++});m+="]}";a.extend(b.p.postData,{filters:m})}else a.extend(b.p.postData,l);var k;if(b.p.searchurl){k=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var p=false;if(a.isFunction(g.beforeClear))p=g.beforeClear.call(b);p||h&&a(b).jqGrid("setGridParam",{search:e}).trigger("reloadGrid",[{page:1}]);k&&a(b).jqGrid("setGridParam",{url:k});a.isFunction(g.afterClear)&&g.afterClear()};this.toggleToolbar=function(){var h=a("tr.ui-search-toolbar",b.grid.hDiv);
h.css("display")=="none"?h.show():h.hide()}})}})})(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,i){b=q.call(this,b,i);if(i&&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 i(){c.p.disableClick=true}var c=this,g={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,h){h.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10));h.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10))}},update:function(e,h){e=a(h.item).parent();e=a(">th",e);var j={};a.each(c.p.colModel,function(m){j[this.name]=m});var l=[];
e.each(function(){var m=a(">div",this).get(0).id.replace(/^jqgh_/,"");m in j&&l.push(j[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(g,c.p.sortable.options);else if(a.isFunction(c.p.sortable))c.p.sortable={update:c.p.sortable};if(g.start){var d=g.start;g.start=function(e,h){i();d.call(this,e,h)}}else g.start=i;if(c.p.sortable.exclude)g.items+=":not("+c.p.sortable.exclude+
")";b.sortable(g).data("sortable").floating=true})},columnChooser:function(b){function i(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 g=this;if(!a("#colchooser_"+g[0].p.id).length){var d=a('<div id="colchooser_'+g[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&&g.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?g.jqGrid("showCol",h[this.value].name):g.jqGrid("hideCol",
h[this.value].name)});var f=[];a("option[selected]",e).each(function(){f.push(parseInt(this.value,10))});a.each(f,function(){delete l[h[parseInt(this,10)].name]});a.each(l,function(){var k=parseInt(this,10);f=i(f,k,k)});b.done&&b.done.call(g,f)},cleanup:function(f){c(b.dlog,d,"destroy");c(b.msel,e,"destroy");d.remove();f&&b.done&&b.done.call(g)},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 h=g.jqGrid("getGridParam","colModel"),j=g.jqGrid("getGridParam","colNames"),l={},m=[];e.empty();a.each(h,function(f){l[this.name]=f;if(this.hidedlg)this.hidden||m.push(f);
else e.append("<option value='"+f+"' "+(this.hidden?"":"selected='selected'")+">"+j[f]+"</option>")});var n=a.isFunction(b.dlog_opts)?b.dlog_opts.call(g,b):b.dlog_opts;c(b.dlog,d,n);n=a.isFunction(b.msel_opts)?b.msel_opts.call(g,b):b.msel_opts;c(b.msel,e,n)}},sortableRows:function(b){return this.each(function(){var i=this;if(i.grid)if(!i.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,g){a(g.item).css("border-width","0px");a("td",g.item).each(function(h){this.style.width=i.grid.cols[h].style.width});if(i.p.subGrid){var d=a(g.item).attr("id");try{a(i).jqGrid("collapseSubGridRow",d)}catch(e){}}b._start_&&b._start_.apply(this,[c,g])};b.update=function(c,g){a(g.item).css("border-width","");i.updateColumns();i.p.rownumbers===true&&a("td.jqgrid-rownum",i.rows).each(function(d){a(this).html(d+
1)});b._update_&&b._update_.apply(this,[c,g])};a("tbody:first",i).sortable(b);a("tbody:first",i).disableSelection()}})},gridDnD:function(b){return this.each(function(){function i(){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)i();else{b=a.extend({drag:function(d){return a.extend({start:function(e,h){if(c.p.subGrid){var j=a(h.helper).attr("id");try{a(c).jqGrid("collapseSubGridRow",j)}catch(l){}}for(j=0;j<a.data(c,"dnd").connectWith.length;j++)a(a.data(c,"dnd").connectWith[j]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(c,"dnd").connectWith[j]).jqGrid("addRowData","jqg_empty_row",{});h.helper.addClass("ui-state-highlight");a("td",h.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,h)},stop:function(e,h){if(h.helper.dropped){var j=a(h.helper).attr("id");a(c).jqGrid("delRowData",j)}for(j=0;j<a.data(c,"dnd").connectWith.length;j++)a(a.data(c,"dnd").connectWith[j]).jqGrid("delRowData","jqg_empty_row");d.onstop&&a.isFunction(d.onstop)&&d.onstop.call(a(c),e,h)}},d.drag_opts||{})},drop:function(d){return a.extend({accept:function(e){var h=a(e).closest("table.ui-jqgrid-btable");if(a.data(h[0],"dnd")!==undefined){e=a.data(h[0],
"dnd").connectWith;return a.inArray("#"+this.id,e)!=-1?true:false}return e},drop:function(e,h){var j=a(h.draggable).attr("id");j=a("#"+c.id).jqGrid("getRowData",j);if(!d.dropbyname){var l=0,m={},n,f=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var k in j){if(j.hasOwnProperty(k)&&f[l]){n=f[l].name;m[n]=j[k]}l++}j=m}catch(p){}}h.helper.dropped=true;if(d.beforedrop&&a.isFunction(d.beforedrop)){n=d.beforedrop.call(this,e,h,j,a("#"+c.id),a(this));if(typeof n!="undefined"&&n!==null&&typeof n==
"object")j=n}if(h.helper.dropped){var o;if(d.autoid)if(a.isFunction(d.autoid))o=d.autoid.call(this,j);else{o=Math.ceil(Math.random()*1E3);o=d.autoidprefix+o}a("#"+this.id).jqGrid("addRowData",o,j,d.droppos)}d.ondrop&&a.isFunction(d.ondrop)&&d.ondrop.call(this,e,h,j)}},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&&i();c.p.jqgdnd=true;for(var g=0;g<b.connectWith.length;g++)a(b.connectWith[g]).droppable(a.isFunction(b.drop)?b.drop.call(a(c),b):b.drop)}}}})},gridResize:function(b){return this.each(function(){var i=this;if(i.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,g){a(i).jqGrid("setGridParam",{height:a("#gview_"+i.p.id+" .ui-jqgrid-bdiv").height()});a(i).jqGrid("setGridWidth",g.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(i,c,g)};b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+i.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+i.p.id);delete b._alsoResize_;
a("#gbox_"+i.p.id).resizable(b)}})}})})(jQuery);

