/* 
* jqGrid  4.7.1  
* Copyright (c) 2008, Tony Tomov, tony@trirand.com 
*  License: http://guriddo.net/?page_id=103334 
*/
/*
 Guriddo jqGrid JS 4.7.0 (2014-12-08)
 Copyright (c) 2008, Tony Tomov, tony@trirand.com

 License: http://guriddo.net/?page_id=103334
*/
(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{version:"4.7.0",htmlDecode:function(b){return b&&("&nbsp;"===b||"&#160;"===b||1===b.length&&160===b.charCodeAt(0))?"":b?String(b).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&"):b},htmlEncode:function(b){return b?String(b).replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):b},format:function(g){var f=b.makeArray(arguments).slice(1);null==g&&(g="");return g.replace(/\{(\d+)\}/g,
function(b,d){return f[d]})},msie:"Microsoft Internet Explorer"===navigator.appName,msiever:function(){var b=-1;null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(b=parseFloat(RegExp.$1));return b},getCellIndex:function(g){g=b(g);if(g.is("tr"))return-1;g=(g.is("td")||g.is("th")?g:g.closest("td,th"))[0];return b.jgrid.msie?b.inArray(g,g.parentNode.cells):g.cellIndex},stripHtml:function(b){b=String(b);var f=/<("[^"]*"|'[^']*'|[^'">])*>/gi;return b?(b=b.replace(f,""))&&"&nbsp;"!==b&&"&#160;"!==
b?b.replace(/\"/g,"'"):"":b},stripPref:function(g,f){var e=b.type(g);if("string"===e||"number"===e)g=String(g),f=""!==g?String(f).replace(String(g),""):f;return f},parse:function(g){"while(1);"===g.substr(0,9)&&(g=g.substr(9));"/*"===g.substr(0,2)&&(g=g.substr(2,g.length-4));g||(g="{}");return!0===b.jgrid.useJSON&&"object"===typeof JSON&&"function"===typeof JSON.parse?JSON.parse(g):eval("("+g+")")},parseDate:function(g,f,e,d){var k=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,a="string"===
typeof f?f.match(k):null,k=function(a,b){a=String(a);for(b=parseInt(b,10)||2;a.length<b;)a="0"+a;return a},c={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},h=0,l,n,h=function(a,b){0===a?12===b&&(b=0):12!==b&&(b+=12);return b},m=0;void 0===d&&(d=b.jgrid.formatter.date);void 0===d.parseRe&&(d.parseRe=/[#%\\\/:_;.,\t\s-]/);d.masks.hasOwnProperty(g)&&(g=d.masks[g]);if(f&&null!=f)if(isNaN(f-0)||"u"!==String(g).toLowerCase())if(f.constructor===Date)h=f;else if(null!==a)h=new Date(parseInt(a[1],10)),a[3]&&(m=60*Number(a[5])+
Number(a[6]),m*="-"===a[4]?1:-1,m-=h.getTimezoneOffset(),h.setTime(Number(Number(h)+6E4*m)));else{"ISO8601Long"===d.srcformat&&"Z"===f.charAt(f.length-1)&&(m-=(new Date).getTimezoneOffset());f=String(f).replace(/\T/g,"#").replace(/\t/,"%").split(d.parseRe);g=g.replace(/\T/g,"#").replace(/\t/,"%").split(d.parseRe);l=0;for(n=g.length;l<n;l++)"M"===g[l]&&(a=b.inArray(f[l],d.monthNames),-1!==a&&12>a&&(f[l]=a+1,c.m=f[l])),"F"===g[l]&&(a=b.inArray(f[l],d.monthNames,12),-1!==a&&11<a&&(f[l]=a+1-12,c.m=f[l])),
"a"===g[l]&&(a=b.inArray(f[l],d.AmPm),-1!==a&&2>a&&f[l]===d.AmPm[a]&&(f[l]=a,c.h=h(f[l],c.h))),"A"===g[l]&&(a=b.inArray(f[l],d.AmPm),-1!==a&&1<a&&f[l]===d.AmPm[a]&&(f[l]=a-2,c.h=h(f[l],c.h))),"g"===g[l]&&(c.h=parseInt(f[l],10)),void 0!==f[l]&&(c[g[l].toLowerCase()]=parseInt(f[l],10));c.f&&(c.m=c.f);if(0===c.m&&0===c.y&&0===c.d)return"&#160;";c.m=parseInt(c.m,10)-1;h=c.y;70<=h&&99>=h?c.y=1900+c.y:0<=h&&69>=h&&(c.y=2E3+c.y);h=new Date(c.y,c.m,c.d,c.h,c.i,c.s,c.u);0<m&&h.setTime(Number(Number(h)+6E4*
m))}else h=new Date(1E3*parseFloat(f));else h=new Date(c.y,c.m,c.d,c.h,c.i,c.s,c.u);d.userLocalTime&&0===m&&(m-=(new Date).getTimezoneOffset(),0<m&&h.setTime(Number(Number(h)+6E4*m)));if(void 0===e)return h;d.masks.hasOwnProperty(e)?e=d.masks[e]:e||(e="Y-m-d");g=h.getHours();f=h.getMinutes();c=h.getDate();m=h.getMonth()+1;a=h.getTimezoneOffset();l=h.getSeconds();n=h.getMilliseconds();var q=h.getDay(),p=h.getFullYear(),r=(q+6)%7+1,B=(new Date(p,m-1,c)-new Date(p,0,1))/864E5,F={d:k(c),D:d.dayNames[q],
j:c,l:d.dayNames[q+7],N:r,S:d.S(c),w:q,z:B,W:5>r?Math.floor((B+r-1)/7)+1:Math.floor((B+r-1)/7)||(4>((new Date(p-1,0,1)).getDay()+6)%7?53:52),F:d.monthNames[m-1+12],m:k(m),M:d.monthNames[m-1],n:m,t:"?",L:"?",o:"?",Y:p,y:String(p).substring(2),a:12>g?d.AmPm[0]:d.AmPm[1],A:12>g?d.AmPm[2]:d.AmPm[3],B:"?",g:g%12||12,G:g,h:k(g%12||12),H:k(g),i:k(f),s:k(l),u:n,e:"?",I:"?",O:(0<a?"-":"+")+k(100*Math.floor(Math.abs(a)/60)+Math.abs(a)%60,4),P:"?",T:(String(h).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(h/1E3)};return e.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(a){return F.hasOwnProperty(a)?F[a]:a.substring(1)})},jqID:function(b){return String(b).replace(/[!"#$%&'()*+,.\/:; <=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(g){return(g||b.jgrid.uidPref)+b.jgrid.guid++},getAccessor:function(b,f){var e,d,k=[],a;if("function"===typeof f)return f(b);e=b[f];if(void 0===e)try{if("string"===typeof f&&
(k=f.split(".")),a=k.length)for(e=b;e&&a--;)d=k.shift(),e=e[d]}catch(c){}return e},getXmlData:function(g,f,e){var d="string"===typeof f?f.match(/^(.*)\[(\w+)\]$/):null;if("function"===typeof f)return f(g);if(d&&d[2])return d[1]?b(d[1],g).attr(d[2]):b(g).attr(d[2]);g=b(f,g);return e?g:0<g.length?b(g).text():void 0},cellWidth:function(){var g=b("<div class='ui-jqgrid' style='left:10000px'><table class='ui-jqgrid-btable' style='width:5px;'><tr class='jqgrow'><td style='width:5px;display:block;'></td></tr></table></div>"),
f=g.appendTo("body").find("td").width();g.remove();return.1<Math.abs(f-5)},cell_width:!0,ajaxOptions:{},from:function(g){return new function(g,e){"string"===typeof g&&(g=b.data(g));var d=this,k=g,a=!0,c=!1,h=e,l=/[\$,%]/g,n=null,m=null,q=0,p=!1,r="",B=[],F=!0;if("object"===typeof g&&g.push)0<g.length&&(F="object"!==typeof g[0]?!1:!0);else throw"data provides is not an array";this._hasData=function(){return null===k?!1:0===k.length?!1:!0};this._getStr=function(b){var d=[];c&&d.push("jQuery.trim(");
d.push("String("+b+")");c&&d.push(")");a||d.push(".toLowerCase()");return d.join("")};this._strComp=function(a){return"string"===typeof a?".toString()":""};this._group=function(a,b){return{field:a.toString(),unique:b,items:[]}};this._toStr=function(d){c&&(d=b.trim(d));d=d.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"');return a?d:d.toLowerCase()};this._funcLoop=function(a){var d=[];b.each(k,function(b,c){d.push(a(c))});return d};this._append=function(a){var b;h=null===h?"":h+(""===r?" && ":
r);for(b=0;b<q;b++)h+="(";p&&(h+="!");h+="("+a+")";p=!1;r="";q=0};this._setCommand=function(a,b){n=a;m=b};this._resetNegate=function(){p=!1};this._repeatCommand=function(a,b){return null===n?d:null!==a&&null!==b?n(a,b):null!==m&&F?n(m,a):n(a)};this._equals=function(a,b){return 0===d._compare(a,b,1)};this._compare=function(b,d,c){var g=Object.prototype.toString;void 0===c&&(c=1);void 0===b&&(b=null);void 0===d&&(d=null);if(null===b&&null===d)return 0;if(null===b&&null!==d)return 1;if(null!==b&&null===
d)return-1;if("[object Date]"===g.call(b)&&"[object Date]"===g.call(d))return b<d?-c:b>d?c:0;a||"number"===typeof b||"number"===typeof d||(b=String(b),d=String(d));return b<d?-c:b>d?c:0};this._performSort=function(){0!==B.length&&(k=d._doSort(k,0))};this._doSort=function(a,b){var c=B[b].by,g=B[b].dir,e=B[b].type,f=B[b].datefmt,h=B[b].sfunc;if(b===B.length-1)return d._getOrder(a,c,g,e,f,h);b++;c=d._getGroup(a,c,g,e,f);g=[];for(e=0;e<c.length;e++)for(h=d._doSort(c[e].items,b),f=0;f<h.length;f++)g.push(h[f]);
return g};this._getOrder=function(c,g,e,f,h,k){var m=[],n=[],q="a"===e?1:-1,p,B;void 0===f&&(f="text");B="float"===f||"number"===f||"currency"===f||"numeric"===f?function(a){a=parseFloat(String(a).replace(l,""));return isNaN(a)?Number.NEGATIVE_INFINITY:a}:"int"===f||"integer"===f?function(a){return a?parseFloat(String(a).replace(l,"")):Number.NEGATIVE_INFINITY}:"date"===f||"datetime"===f?function(a){return b.jgrid.parseDate(h,a).getTime()}:b.isFunction(f)?f:function(d){d=d?b.trim(String(d)):"";return a?
d:d.toLowerCase()};b.each(c,function(a,d){p=""!==g?b.jgrid.getAccessor(d,g):d;void 0===p&&(p="");p=B(p,d);n.push({vSort:p,index:a})});b.isFunction(k)?n.sort(function(a,b){a=a.vSort;b=b.vSort;return k.call(this,a,b,q)}):n.sort(function(a,b){a=a.vSort;b=b.vSort;return d._compare(a,b,q)});f=0;for(var r=c.length;f<r;)e=n[f].index,m.push(c[e]),f++;return m};this._getGroup=function(a,c,g,f,e){var h=[],k=null,l=null,m;b.each(d._getOrder(a,c,g,f,e),function(a,g){m=b.jgrid.getAccessor(g,c);null==m&&(m="");
d._equals(l,m)||(l=m,null!==k&&h.push(k),k=d._group(c,m));k.items.push(g)});null!==k&&h.push(k);return h};this.ignoreCase=function(){a=!1;return d};this.useCase=function(){a=!0;return d};this.trim=function(){c=!0;return d};this.noTrim=function(){c=!1;return d};this.execute=function(){var a=h,c=[];if(null===a)return d;b.each(k,function(){eval(a)&&c.push(this)});k=c;return d};this.data=function(){return k};this.select=function(a){d._performSort();if(!d._hasData())return[];d.execute();if(b.isFunction(a)){var c=
[];b.each(k,function(b,d){c.push(a(d))});return c}return k};this.hasMatch=function(){if(!d._hasData())return!1;d.execute();return 0<k.length};this.andNot=function(a,b,c){p=!p;return d.and(a,b,c)};this.orNot=function(a,b,c){p=!p;return d.or(a,b,c)};this.not=function(a,b,c){return d.andNot(a,b,c)};this.and=function(a,b,c){r=" && ";return void 0===a?d:d._repeatCommand(a,b,c)};this.or=function(a,b,c){r=" || ";return void 0===a?d:d._repeatCommand(a,b,c)};this.orBegin=function(){q++;return d};this.orEnd=
function(){null!==h&&(h+=")");return d};this.isNot=function(a){p=!p;return d.is(a)};this.is=function(a){d._append("this."+a);d._resetNegate();return d};this._compareValues=function(a,c,g,f,e){var h;h=F?"jQuery.jgrid.getAccessor(this,'"+c+"')":"this";void 0===g&&(g=null);var k=g,m=void 0===e.stype?"text":e.stype;if(null!==g)switch(m){case "int":case "integer":k=isNaN(Number(k))||""===k?"0":k;h="parseInt("+h+",10)";k="parseInt("+k+",10)";break;case "float":case "number":case "numeric":k=String(k).replace(l,
"");k=isNaN(Number(k))||""===k?"0":k;h="parseFloat("+h+")";k="parseFloat("+k+")";break;case "date":case "datetime":k=String(b.jgrid.parseDate(e.newfmt||"Y-m-d",k).getTime());h='jQuery.jgrid.parseDate("'+e.srcfmt+'",'+h+").getTime()";break;default:h=d._getStr(h),k=d._getStr('"'+d._toStr(k)+'"')}d._append(h+" "+f+" "+k);d._setCommand(a,c);d._resetNegate();return d};this.equals=function(a,b,c){return d._compareValues(d.equals,a,b,"==",c)};this.notEquals=function(a,b,c){return d._compareValues(d.equals,
a,b,"!==",c)};this.isNull=function(a,b,c){return d._compareValues(d.equals,a,null,"===",c)};this.greater=function(a,b,c){return d._compareValues(d.greater,a,b,">",c)};this.less=function(a,b,c){return d._compareValues(d.less,a,b,"<",c)};this.greaterOrEquals=function(a,b,c){return d._compareValues(d.greaterOrEquals,a,b,">=",c)};this.lessOrEquals=function(a,b,c){return d._compareValues(d.lessOrEquals,a,b,"<=",c)};this.startsWith=function(a,g){var e=null==g?a:g,e=c?b.trim(e.toString()).length:e.toString().length;
F?d._append(d._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+".substr(0,"+e+") == "+d._getStr('"'+d._toStr(g)+'"')):(null!=g&&(e=c?b.trim(g.toString()).length:g.toString().length),d._append(d._getStr("this")+".substr(0,"+e+") == "+d._getStr('"'+d._toStr(a)+'"')));d._setCommand(d.startsWith,a);d._resetNegate();return d};this.endsWith=function(a,g){var e=null==g?a:g,e=c?b.trim(e.toString()).length:e.toString().length;F?d._append(d._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+".substr("+d._getStr("jQuery.jgrid.getAccessor(this,'"+
a+"')")+".length-"+e+","+e+') == "'+d._toStr(g)+'"'):d._append(d._getStr("this")+".substr("+d._getStr("this")+'.length-"'+d._toStr(a)+'".length,"'+d._toStr(a)+'".length) == "'+d._toStr(a)+'"');d._setCommand(d.endsWith,a);d._resetNegate();return d};this.contains=function(a,b){F?d._append(d._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+'.indexOf("'+d._toStr(b)+'",0) > -1'):d._append(d._getStr("this")+'.indexOf("'+d._toStr(a)+'",0) > -1');d._setCommand(d.contains,a);d._resetNegate();return d};this.groupBy=
function(a,b,c,g){return d._hasData()?d._getGroup(k,a,b,c,g):null};this.orderBy=function(a,c,g,e,f){c=null==c?"a":b.trim(c.toString().toLowerCase());null==g&&(g="text");null==e&&(e="Y-m-d");null==f&&(f=!1);if("desc"===c||"descending"===c)c="d";if("asc"===c||"ascending"===c)c="a";B.push({by:a,dir:c,type:g,datefmt:e,sfunc:f});return d};return d}(g,null)},getMethod:function(g){return this.getAccessor(b.fn.jqGrid,g)},extend:function(g){b.extend(b.fn.jqGrid,g);this.no_legacy_api||b.fn.extend(g)}});b.fn.jqGrid=
function(g){if("string"===typeof g){var f=b.jgrid.getMethod(g);if(!f)throw"jqGrid - No such method: "+g;var e=b.makeArray(arguments).slice(1);return f.apply(this,e)}return this.each(function(){if(!this.grid){var d;null!=g&&void 0!==g.data&&(d=g.data,g.data=[]);var e=b.extend(!0,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:!0,pginput:!0,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:!1,selarrrow:[],savedRow:[],shrinkToFit:!0,
xmlReader:{},jsonReader:{},subGrid:!1,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,onInitGrid:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,beforeProcessing:null,onHeaderClick:null,viewrecords:!1,loadonce:!1,multiselect:!1,multikey:!1,editurl:null,search:!1,caption:"",hidegrid:!0,hiddengrid:!1,
postData:{},userData:{},treeGrid:!1,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:!1,gridstate:"visible",cellEdit:!1,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[!1,""],scroll:!1,multiboxonly:!1,deselectAfterSort:!0,scrollrows:!1,autowidth:!1,scrollOffset:18,
cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:!1,rownumWidth:25,rownumbers:!1,pagerpos:"center",recordpos:"right",footerrow:!1,userDataOnFooter:!1,hoverrows:!0,altclass:"ui-priority-secondary",viewsortcols:[!1,"vertical",!0],resizeclass:"",autoencode:!1,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:!1,headertitles:!1,scrollTimeout:40,data:[],_index:{},grouping:!1,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:!1,
sortitems:[],sortnames:[],summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus",displayField:[],groupSummaryPos:[],formatDisplayField:[],_locgr:!1},ignoreCase:!1,cmTemplate:{},idPrefix:"",multiSort:!1,minColWidth:33},b.jgrid.defaults,g||{});void 0!==d&&(e.data=d,g.data=d);var a=this,c={headers:[],cols:[],footers:[],dragStart:function(c,d,f){var g=b(this.bDiv).offset().left;this.resizing={idx:c,startX:d.pageX,sOL:d.pageX-g};this.hDiv.style.cursor="col-resize";
this.curGbox=b("#rs_m"+b.jgrid.jqID(e.id),"#gbox_"+b.jgrid.jqID(e.id));this.curGbox.css({display:"block",left:d.pageX-g,top:f[1],height:f[2]});b(a).triggerHandler("jqGridResizeStart",[d,c]);b.isFunction(e.resizeStart)&&e.resizeStart.call(a,d,c);document.onselectstart=function(){return!1}},dragMove:function(a){if(this.resizing){var b=a.pageX-this.resizing.startX;a=this.headers[this.resizing.idx];var c="ltr"===e.direction?a.width+b:a.width-b,d;33<c&&(this.curGbox.css({left:this.resizing.sOL+b}),!0===
e.forceFit?(d=this.headers[this.resizing.idx+e.nv],b="ltr"===e.direction?d.width-b:d.width+b,b>e.minColWidth&&(a.newWidth=c,d.newWidth=b)):(this.newWidth="ltr"===e.direction?e.tblwidth+b:e.tblwidth-b,a.newWidth=c))}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var c=this.resizing.idx,d=this.headers[c].newWidth||this.headers[c].width,d=parseInt(d,10);this.resizing=!1;b("#rs_m"+b.jgrid.jqID(e.id)).css("display","none");e.colModel[c].width=d;this.headers[c].width=d;this.headers[c].el.style.width=
d+"px";this.cols[c].style.width=d+"px";0<this.footers.length&&(this.footers[c].style.width=d+"px");!0===e.forceFit?(d=this.headers[c+e.nv].newWidth||this.headers[c+e.nv].width,this.headers[c+e.nv].width=d,this.headers[c+e.nv].el.style.width=d+"px",this.cols[c+e.nv].style.width=d+"px",0<this.footers.length&&(this.footers[c+e.nv].style.width=d+"px"),e.colModel[c+e.nv].width=d):(e.tblwidth=this.newWidth||e.tblwidth,b("table:first",this.bDiv).css("width",e.tblwidth+"px"),b("table:first",this.hDiv).css("width",
e.tblwidth+"px"),this.hDiv.scrollLeft=this.bDiv.scrollLeft,e.footerrow&&(b("table:first",this.sDiv).css("width",e.tblwidth+"px"),this.sDiv.scrollLeft=this.bDiv.scrollLeft));b(a).triggerHandler("jqGridResizeStop",[d,c]);b.isFunction(e.resizeStop)&&e.resizeStop.call(a,d,c)}this.curGbox=null;document.onselectstart=function(){return!0}},populateVisible:function(){c.timer&&clearTimeout(c.timer);c.timer=null;var a=b(c.bDiv).height();if(a){var d=b("table:first",c.bDiv),f,g;if(d[0].rows.length)try{g=(f=d[0].rows[1])?
b(f).outerHeight()||c.prevRowHeight:c.prevRowHeight}catch(na){g=c.prevRowHeight}if(g){c.prevRowHeight=g;var h=e.rowNum;f=c.scrollTop=c.bDiv.scrollTop;var l=Math.round(d.position().top)-f,m=l+d.height();g*=h;var W,n,D;m<a&&0>=l&&(void 0===e.lastpage||(parseInt((m+f+g-1)/g,10)||0)<=e.lastpage)&&(n=parseInt((a-m+g-1)/g,10)||1,0<=m||2>n||!0===e.scroll?(W=(Math.round((m+f)/g)||0)+1,l=-1):l=1);0<l&&(W=(parseInt(f/g,10)||0)+1,n=(parseInt((f+a)/g,10)||0)+2-W,D=!0);!n||e.lastpage&&(W>e.lastpage||1===e.lastpage||
W===e.page&&W===e.lastpage)||(c.hDiv.loading?c.timer=setTimeout(c.populateVisible,e.scrollTimeout):(e.page=W,D&&(c.selectionPreserver(d[0]),c.emptyRows.call(d[0],!1,!1)),c.populate(n)))}}},scrollGrid:function(a){if(e.scroll){var b=c.bDiv.scrollTop;void 0===c.scrollTop&&(c.scrollTop=0);b!==c.scrollTop&&(c.scrollTop=b,c.timer&&clearTimeout(c.timer),c.timer=setTimeout(c.populateVisible,e.scrollTimeout))}c.hDiv.scrollLeft=c.bDiv.scrollLeft;e.footerrow&&(c.sDiv.scrollLeft=c.bDiv.scrollLeft);a&&a.stopPropagation()},
selectionPreserver:function(a){var c=a.p,d=c.selrow,f=c.selarrrow?b.makeArray(c.selarrrow):null,e=a.grid.bDiv.scrollLeft,g=function(){var h;c.selrow=null;c.selarrrow=[];if(c.multiselect&&f&&0<f.length)for(h=0;h<f.length;h++)f[h]!==d&&b(a).jqGrid("setSelection",f[h],!1,null);d&&b(a).jqGrid("setSelection",d,!1,null);a.grid.bDiv.scrollLeft=e;b(a).unbind(".selectionPreserver",g)};b(a).bind("jqGridGridComplete.selectionPreserver",g)}};if("TABLE"!==this.tagName.toUpperCase()||null==this.id)alert("Element is not a table or has no id!");
else if(void 0!==document.documentMode&&5>=document.documentMode)alert("Grid can not be used in this ('quirks') mode!");else{b(this).empty().attr("tabindex","0");this.p=e;this.p.useProp=!!b.fn.prop;var f,l;if(0===this.p.colNames.length)for(f=0;f<this.p.colModel.length;f++)this.p.colNames[f]=this.p.colModel[f].label||this.p.colModel[f].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);else{var n=b("<div class='ui-jqgrid-view' role='grid'></div>");d=b.jgrid.msie;a.p.direction=
b.trim(a.p.direction.toLowerCase());-1===b.inArray(a.p.direction,["ltr","rtl"])&&(a.p.direction="ltr");l=a.p.direction;b(n).insertBefore(this);b(this).removeClass("scroll").appendTo(n);var m=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(m).attr({id:"gbox_"+this.id,dir:l}).insertBefore(n);b(n).attr("id","gview_"+this.id).appendTo(m);b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").insertBefore(n);b("<div class='loading ui-state-default ui-state-active' id='load_"+
this.id+"'>"+this.p.loadtext+"</div>").insertBefore(n);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"presentation","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var q=function(a,b){a=parseInt(a,10);return isNaN(a)?b||0:a},p=function(d,f,e,g,na,h){var k=a.p.colModel[d],l=k.align,m='style="',n=k.classes,D=k.name,w=[];l&&(m+="text-align:"+l+";");!0===k.hidden&&(m+="display:none;");if(0===f)m+="width: "+c.headers[d].width+"px;";else if(b.isFunction(k.cellattr)||
"string"===typeof k.cellattr&&null!=b.jgrid.cellattr&&b.isFunction(b.jgrid.cellattr[k.cellattr]))if(d=b.isFunction(k.cellattr)?k.cellattr:b.jgrid.cellattr[k.cellattr],(g=d.call(a,na,e,g,k,h))&&"string"===typeof g)if(g=g.replace(/style/i,"style").replace(/title/i,"title"),-1<g.indexOf("title")&&(k.title=!1),-1<g.indexOf("class")&&(n=void 0),w=g.replace(/\-style/g,"-sti").split(/style/),2===w.length){w[1]=b.trim(w[1].replace(/\-sti/g,"-style").replace("=",""));if(0===w[1].indexOf("'")||0===w[1].indexOf('"'))w[1]=
w[1].substring(1);m+=w[1].replace(/'/gi,'"')}else m+='"';w.length||(w[0]="",m+='"');m+=(void 0!==n?' class="'+n+'"':"")+(k.title&&e?' title="'+b.jgrid.stripHtml(e)+'"':"");m+=' aria-describedby="'+a.p.id+"_"+D+'"';return m+w[0]},r=function(c){return null==c||""===c?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(c):String(c)},B=function(c,d,f,e,g){var h=a.p.colModel[f];void 0!==h.formatter?(c=""!==String(a.p.idPrefix)?b.jgrid.stripPref(a.p.idPrefix,c):c,c={rowId:c,colModel:h,gid:a.p.id,pos:f},d=b.isFunction(h.formatter)?
h.formatter.call(a,d,c,e,g):b.fmatter?b.fn.fmatter.call(a,h.formatter,d,c,e,g):r(d)):d=r(d);return d},F=function(a,b,c,d,f,e){b=B(a,b,c,f,"add");return'<td role="gridcell" '+p(c,d,b,f,a,e)+">"+b+"</td>"},T=function(b,c,d,f){f='<input role="checkbox" type="checkbox" id="jqg_'+a.p.id+"_"+b+'" class="cbox" name="jqg_'+a.p.id+"_"+b+'"'+(f?'checked="checked"':"")+"/>";return'<td role="gridcell" '+p(c,d,"",null,b,!0)+">"+f+"</td>"},K=function(a,b,c,d){c=(parseInt(c,10)-1)*parseInt(d,10)+1+b;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+
p(a,b,c,null,b,!0)+">"+c+"</td>"},Z=function(b){var c,d=[],f=0,e;for(e=0;e<a.p.colModel.length;e++)c=a.p.colModel[e],"cb"!==c.name&&"subgrid"!==c.name&&"rn"!==c.name&&(d[f]="local"===b?c.name:"xml"===b||"xmlstring"===b?c.xmlmap||c.name:c.jsonmap||c.name,!1!==a.p.keyName&&!0===c.key&&(a.p.keyName=d[f]),f++);return d},U=function(c){var d=a.p.remapColumns;d&&d.length||(d=b.map(a.p.colModel,function(a,b){return b}));c&&(d=b.map(d,function(a){return a<c?null:a-c}));return d},V=function(a,c){var d;this.p.deepempty?
b(this.rows).slice(1).remove():(d=0<this.rows.length?this.rows[0]:null,b(this.firstChild).empty().append(d));a&&this.p.scroll&&(b(this.grid.bDiv.firstChild).css({height:"auto"}),b(this.grid.bDiv.firstChild.firstChild).css({height:0,display:"none"}),0!==this.grid.bDiv.scrollTop&&(this.grid.bDiv.scrollTop=0));!0===c&&this.p.treeGrid&&(this.p.data=[],this.p._index={})},S=function(){var c=a.p,d=c.data,f=d.length,e,g,h,k,l,m=c.localReader,n=c.colModel,D=m.cell,w=(!0===c.multiselect?1:0)+(!0===c.subGrid?
1:0)+(!0===c.rownumbers?1:0),q=c.scroll?b.jgrid.randId():1,p,t,x;if("local"===c.datatype&&!0===m.repeatitems)for(p=U(w),t=Z("local"),h=!1===c.keyIndex?b.isFunction(m.id)?m.id.call(a,d):m.id:c.keyIndex,c=0;c<f;c++){g=d[c];e=b.jgrid.getAccessor(g,h);void 0===e&&("number"===typeof h&&null!=n[h+w]&&(e=b.jgrid.getAccessor(g,n[h+w].name)),void 0===e&&(e=q+c,D&&(k=b.jgrid.getAccessor(g,D)||g,e=null!=k&&void 0!==k[h]?k[h]:e)));k={};k[m.id]=e;D&&(g=b.jgrid.getAccessor(g,D)||g);x=b.isArray(g)?p:t;for(e=0;e<
x.length;e++)l=b.jgrid.getAccessor(g,x[e]),k[n[e+w].name]=l;b.extend(!0,d[c],k)}},O=function(){var c=a.p.data.length,d,e,f;d=!1===a.p.keyName||!0===a.p.loadonce?a.p.localReader.id:a.p.keyName;a.p._index=[];for(e=0;e<c;e++)f=b.jgrid.getAccessor(a.p.data[e],d),void 0===f&&(f=String(e+1)),a.p._index[f]=e},P=function(c,d,e,f,g,h){var k="-1",l="",m;d=d?"display:none;":"";e="ui-widget-content jqgrow ui-row-"+a.p.direction+(e?" "+e:"")+(h?" ui-state-highlight":"");h=b(a).triggerHandler("jqGridRowAttr",[f,
g,c]);"object"!==typeof h&&(h=b.isFunction(a.p.rowattr)?a.p.rowattr.call(a,f,g,c):"string"===typeof a.p.rowattr&&null!=b.jgrid.rowattr&&b.isFunction(b.jgrid.rowattr[a.p.rowattr])?b.jgrid.rowattr[a.p.rowattr].call(a,f,g,c):{});if(!b.isEmptyObject(h)){h.hasOwnProperty("id")&&(c=h.id,delete h.id);h.hasOwnProperty("tabindex")&&(k=h.tabindex,delete h.tabindex);h.hasOwnProperty("style")&&(d+=h.style,delete h.style);h.hasOwnProperty("class")&&(e+=" "+h["class"],delete h["class"]);try{delete h.role}catch(n){}for(m in h)h.hasOwnProperty(m)&&
(l+=" "+m+"="+h[m])}return'<tr role="row" id="'+c+'" tabindex="'+k+'" class="'+e+'"'+(""===d?"":' style="'+d+'"')+l+">"},aa=function(c,d,e,f,g){var h=new Date,k="local"!==a.p.datatype&&a.p.loadonce||"xmlstring"===a.p.datatype,l=a.p.xmlReader,m="local"===a.p.datatype?"local":"xml";k&&(a.p.data=[],a.p._index={},a.p.localReader.id="_id_");a.p.reccount=0;if(b.isXMLDoc(c)){-1!==a.p.treeANode||a.p.scroll?e=1<e?e:1:(V.call(a,!1,!0),e=1);var n=b(a),D,w,p=0,Q,t=!0===a.p.multiselect?1:0,x=0,B,r=!0===a.p.rownumbers?
1:0,u,E=[],y,v={},A,G,s=[],va=!0===a.p.altRows?a.p.altclass:"",fa;!0===a.p.subGrid&&(x=1,B=b.jgrid.getMethod("addSubGridCell"));l.repeatitems||(E=Z(m));u=!1===a.p.keyName?b.isFunction(l.id)?l.id.call(a,c):l.id:a.p.keyName;m=-1===String(u).indexOf("[")?E.length?function(a,c){return b(u,a).text()||c}:function(a,c){return b(l.cell,a).eq(u).text()||c}:function(a,b){return a.getAttribute(u.replace(/[\[\]]/g,""))||b};a.p.userData={};a.p.page=q(b.jgrid.getXmlData(c,l.page),a.p.page);a.p.lastpage=q(b.jgrid.getXmlData(c,
l.total),1);a.p.records=q(b.jgrid.getXmlData(c,l.records));b.isFunction(l.userdata)?a.p.userData=l.userdata.call(a,c)||{}:b.jgrid.getXmlData(c,l.userdata,!0).each(function(){a.p.userData[this.getAttribute("name")]=b(this).text()});c=b.jgrid.getXmlData(c,l.root,!0);(c=b.jgrid.getXmlData(c,l.row,!0))||(c=[]);var R=c.length,H=0,C=[],z=parseInt(a.p.rowNum,10),I=a.p.scroll?b.jgrid.randId():1;0<R&&0>=a.p.page&&(a.p.page=1);if(c&&R){g&&(z*=g+1);g=b.isFunction(a.p.afterInsertRow);var ga=!1,J;a.p.grouping&&
(ga=!0===a.p.groupingView.groupCollapse,J=b.jgrid.getMethod("groupingPrepare"));for(;H<R;){A=c[H];G=m(A,I+H);G=a.p.idPrefix+G;D=0===e?0:e+1;fa=1===(D+H)%2?va:"";var M=s.length;s.push("");r&&s.push(K(0,H,a.p.page,a.p.rowNum));t&&s.push(T(G,r,H,!1));x&&s.push(B.call(n,t+r,H+e));if(l.repeatitems){y||(y=U(t+x+r));var L=b.jgrid.getXmlData(A,l.cell,!0);b.each(y,function(b){var c=L[this];if(!c)return!1;Q=c.textContent||c.text;v[a.p.colModel[b+t+x+r].name]=Q;s.push(F(G,Q,b+t+x+r,H+e,A,v))})}else for(D=0;D<
E.length;D++)Q=b.jgrid.getXmlData(A,E[D]),v[a.p.colModel[D+t+x+r].name]=Q,s.push(F(G,Q,D+t+x+r,H+e,A,v));s[M]=P(G,ga,fa,v,A,!1);s.push("</tr>");a.p.grouping&&(C.push(s),a.p.groupingView._locgr||J.call(n,v,H),s=[]);if(k||!0===a.p.treeGrid)v._id_=b.jgrid.stripPref(a.p.idPrefix,G),a.p.data.push(v),a.p._index[v._id_]=a.p.data.length-1;!1===a.p.gridview&&(b("tbody:first",d).append(s.join("")),n.triggerHandler("jqGridAfterInsertRow",[G,v,A]),g&&a.p.afterInsertRow.call(a,G,v,A),s=[]);v={};p++;H++;if(p===
z)break}}!0===a.p.gridview&&(w=-1<a.p.treeANode?a.p.treeANode:0,a.p.grouping?k||(n.jqGrid("groupingRender",C,a.p.colModel.length,a.p.page,z),C=null):!0===a.p.treeGrid&&0<w?b(a.rows[w]).after(s.join("")):(a.firstElementChild.innerHTML+=s.join(""),a.grid.cols=a.rows[0].cells));if(!0===a.p.subGrid)try{n.jqGrid("addSubGrid",t+r)}catch(N){}a.p.totaltime=new Date-h;0<p&&0===a.p.records&&(a.p.records=R);s=null;if(!0===a.p.treeGrid)try{n.jqGrid("setTreeNode",w+1,p+w+1)}catch(S){}a.p.reccount=p;a.p.treeANode=
-1;a.p.userDataOnFooter&&n.jqGrid("footerData","set",a.p.userData,!0);k&&(a.p.records=R,a.p.lastpage=Math.ceil(R/z));f||a.updatepager(!1,!0);if(k){for(;p<R;){A=c[p];G=m(A,p+I);G=a.p.idPrefix+G;if(l.repeatitems){y||(y=U(t+x+r));var O=b.jgrid.getXmlData(A,l.cell,!0);b.each(y,function(b){var c=O[this];if(!c)return!1;Q=c.textContent||c.text;v[a.p.colModel[b+t+x+r].name]=Q})}else for(D=0;D<E.length;D++)Q=b.jgrid.getXmlData(A,E[D]),v[a.p.colModel[D+t+x+r].name]=Q;v._id_=b.jgrid.stripPref(a.p.idPrefix,G);
a.p.grouping&&J.call(n,v,p);a.p.data.push(v);a.p._index[v._id_]=a.p.data.length-1;v={};p++}a.p.grouping&&(a.p.groupingView._locgr=!0,n.jqGrid("groupingRender",C,a.p.colModel.length,a.p.page,z),C=null)}}},ba=function(c,d,e,f,g){var h=new Date;if(c){-1!==a.p.treeANode||a.p.scroll?e=1<e?e:1:(V.call(a,!1,!0),e=1);var k,l="local"!==a.p.datatype&&a.p.loadonce||"jsonstring"===a.p.datatype;l&&(a.p.data=[],a.p._index={},a.p.localReader.id="_id_");a.p.reccount=0;"local"===a.p.datatype?(d=a.p.localReader,k=
"local"):(d=a.p.jsonReader,k="json");var m=b(a),n=0,D,w,p,r=[],t=a.p.multiselect?1:0,x=!0===a.p.subGrid?1:0,B,u=!0===a.p.rownumbers?1:0,E=U(t+x+u);k=Z(k);var y,C,v,A={},G,s,z=[],fa=!0===a.p.altRows?a.p.altclass:"",R;a.p.page=q(b.jgrid.getAccessor(c,d.page),a.p.page);a.p.lastpage=q(b.jgrid.getAccessor(c,d.total),1);a.p.records=q(b.jgrid.getAccessor(c,d.records));a.p.userData=b.jgrid.getAccessor(c,d.userdata)||{};x&&(B=b.jgrid.getMethod("addSubGridCell"));v=!1===a.p.keyName?b.isFunction(d.id)?d.id.call(a,
c):d.id:a.p.keyName;C=b.jgrid.getAccessor(c,d.root);null==C&&b.isArray(c)&&(C=c);C||(C=[]);c=C.length;w=0;0<c&&0>=a.p.page&&(a.p.page=1);var H=parseInt(a.p.rowNum,10),I=a.p.scroll?b.jgrid.randId():1,J=!1,M;g&&(H*=g+1);"local"!==a.p.datatype||a.p.deselectAfterSort||(J=!0);var ga=b.isFunction(a.p.afterInsertRow),L=[],O=!1,N;a.p.grouping&&(O=!0===a.p.groupingView.groupCollapse,N=b.jgrid.getMethod("groupingPrepare"));for(;w<c;){g=C[w];s=b.jgrid.getAccessor(g,v);void 0===s&&("number"===typeof v&&null!=
a.p.colModel[v+t+x+u]&&(s=b.jgrid.getAccessor(g,a.p.colModel[v+t+x+u].name)),void 0===s&&(s=I+w,0===r.length&&d.cell&&(D=b.jgrid.getAccessor(g,d.cell)||g,s=null!=D&&void 0!==D[v]?D[v]:s)));s=a.p.idPrefix+s;D=1===e?0:e;R=1===(D+w)%2?fa:"";J&&(M=a.p.multiselect?-1!==b.inArray(s,a.p.selarrrow):s===a.p.selrow);var S=z.length;z.push("");u&&z.push(K(0,w,a.p.page,a.p.rowNum));t&&z.push(T(s,u,w,M));x&&z.push(B.call(m,t+u,w+e));y=k;d.repeatitems&&(d.cell&&(g=b.jgrid.getAccessor(g,d.cell)||g),b.isArray(g)&&
(y=E));for(p=0;p<y.length;p++)D=b.jgrid.getAccessor(g,y[p]),A[a.p.colModel[p+t+x+u].name]=D,z.push(F(s,D,p+t+x+u,w+e,g,A));z[S]=P(s,O,R,A,g,M);z.push("</tr>");a.p.grouping&&(L.push(z),a.p.groupingView._locgr||N.call(m,A,w),z=[]);if(l||!0===a.p.treeGrid)A._id_=b.jgrid.stripPref(a.p.idPrefix,s),a.p.data.push(A),a.p._index[A._id_]=a.p.data.length-1;!1===a.p.gridview&&(b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(z.join("")),m.triggerHandler("jqGridAfterInsertRow",[s,A,g]),ga&&a.p.afterInsertRow.call(a,
s,A,g),z=[]);A={};n++;w++;if(n===H)break}!0===a.p.gridview&&(G=-1<a.p.treeANode?a.p.treeANode:0,a.p.grouping?l||(m.jqGrid("groupingRender",L,a.p.colModel.length,a.p.page,H),L=null):!0===a.p.treeGrid&&0<G?b(a.rows[G]).after(z.join("")):(a.firstElementChild.innerHTML+=z.join(""),a.grid.cols=a.rows[0].cells));if(!0===a.p.subGrid)try{m.jqGrid("addSubGrid",t+u)}catch(X){}a.p.totaltime=new Date-h;0<n&&0===a.p.records&&(a.p.records=c);if(!0===a.p.treeGrid)try{m.jqGrid("setTreeNode",G+1,n+G+1)}catch(Y){}a.p.reccount=
n;a.p.treeANode=-1;a.p.userDataOnFooter&&m.jqGrid("footerData","set",a.p.userData,!0);l&&(a.p.records=c,a.p.lastpage=Math.ceil(c/H));f||a.updatepager(!1,!0);if(l){for(;n<c&&C[n];){g=C[n];s=b.jgrid.getAccessor(g,v);void 0===s&&("number"===typeof v&&null!=a.p.colModel[v+t+x+u]&&(s=b.jgrid.getAccessor(g,a.p.colModel[v+t+x+u].name)),void 0===s&&(s=I+n,0===r.length&&d.cell&&(e=b.jgrid.getAccessor(g,d.cell)||g,s=null!=e&&void 0!==e[v]?e[v]:s)));if(g){s=a.p.idPrefix+s;y=k;d.repeatitems&&(d.cell&&(g=b.jgrid.getAccessor(g,
d.cell)||g),b.isArray(g)&&(y=E));for(p=0;p<y.length;p++)A[a.p.colModel[p+t+x+u].name]=b.jgrid.getAccessor(g,y[p]);A._id_=b.jgrid.stripPref(a.p.idPrefix,s);a.p.grouping&&N.call(m,A,n);a.p.data.push(A);a.p._index[A._id_]=a.p.data.length-1;A={}}n++}a.p.grouping&&(a.p.groupingView._locgr=!0,m.jqGrid("groupingRender",L,a.p.colModel.length,a.p.page,H))}}},ua=function(){function c(a){var b=0,d,e,g,h,k;if(null!=a.groups){(e=a.groups.length&&"OR"===a.groupOp.toString().toUpperCase())&&t.orBegin();for(d=0;d<
a.groups.length;d++){0<b&&e&&t.or();try{c(a.groups[d])}catch(l){alert(l)}b++}e&&t.orEnd()}if(null!=a.rules)try{(g=a.rules.length&&"OR"===a.groupOp.toString().toUpperCase())&&t.orBegin();for(d=0;d<a.rules.length;d++)k=a.rules[d],h=a.groupOp.toString().toUpperCase(),r[k.op]&&k.field&&(0<b&&h&&"OR"===h&&(t=t.or()),t=r[k.op](t,h)(k.field,k.data,f[k.field])),b++;g&&t.orEnd()}catch(m){alert(m)}}var d=a.p.multiSort?[]:"",e=[],g=!1,f={},h=[],k=[],l,m,n;if(b.isArray(a.p.data)){var p=a.p.grouping?a.p.groupingView:
!1,w,q;b.each(a.p.colModel,function(){m=this.sorttype||"text";"date"===m||"datetime"===m?(this.formatter&&"string"===typeof this.formatter&&"date"===this.formatter?(l=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat,n=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat):l=n=this.datefmt||"Y-m-d",f[this.name]={stype:m,srcfmt:l,newfmt:n,sfunc:this.sortfunc||null}):f[this.name]={stype:m,
srcfmt:"",newfmt:"",sfunc:this.sortfunc||null};if(a.p.grouping)for(q=0,w=p.groupField.length;q<w;q++)if(this.name===p.groupField[q]){var c=this.name;this.index&&(c=this.index);h[q]=f[c];k[q]=c}a.p.multiSort?this.lso&&(d.push(this.name),c=this.lso.split("-"),e.push(c[c.length-1])):g||this.index!==a.p.sortname&&this.name!==a.p.sortname||(d=this.name,g=!0)});if(a.p.treeGrid)b(a).jqGrid("SortTree",d,a.p.sortorder,f[d].stype||"text",f[d].srcfmt||"");else{var r={eq:function(a){return a.equals},ne:function(a){return a.notEquals},
lt:function(a){return a.less},le:function(a){return a.lessOrEquals},gt:function(a){return a.greater},ge:function(a){return a.greaterOrEquals},cn:function(a){return a.contains},nc:function(a,b){return"OR"===b?a.orNot().contains:a.andNot().contains},bw:function(a){return a.startsWith},bn:function(a,b){return"OR"===b?a.orNot().startsWith:a.andNot().startsWith},en:function(a,b){return"OR"===b?a.orNot().endsWith:a.andNot().endsWith},ew:function(a){return a.endsWith},ni:function(a,b){return"OR"===b?a.orNot().equals:
a.andNot().equals},"in":function(a){return a.equals},nu:function(a){return a.isNull},nn:function(a,b){return"OR"===b?a.orNot().isNull:a.andNot().isNull}},t=b.jgrid.from(a.p.data);a.p.ignoreCase&&(t=t.ignoreCase());if(!0===a.p.search){var x=a.p.postData.filters;if(x)"string"===typeof x&&(x=b.jgrid.parse(x)),c(x);else try{t=r[a.p.postData.searchOper](t)(a.p.postData.searchField,a.p.postData.searchString,f[a.p.postData.searchField])}catch(u){}}if(a.p.grouping)for(q=0;q<w;q++)t.orderBy(k[q],p.groupOrder[q],
h[q].stype,h[q].srcfmt);a.p.multiSort?b.each(d,function(a){t.orderBy(this,e[a],f[this].stype,f[this].srcfmt,f[this].sfunc)}):d&&a.p.sortorder&&g&&("DESC"===a.p.sortorder.toUpperCase()?t.orderBy(a.p.sortname,"d",f[d].stype,f[d].srcfmt,f[d].sfunc):t.orderBy(a.p.sortname,"a",f[d].stype,f[d].srcfmt,f[d].sfunc));var x=t.select(),B=parseInt(a.p.rowNum,10),y=x.length,z=parseInt(a.p.page,10),C=Math.ceil(y/B),v={};if((a.p.search||a.p.resetsearch)&&a.p.grouping&&a.p.groupingView._locgr){a.p.groupingView.groups=
[];var A,E=b.jgrid.getMethod("groupingPrepare"),s,F;if(a.p.footerrow&&a.p.userDataOnFooter){for(s in a.p.userData)a.p.userData.hasOwnProperty(s)&&(a.p.userData[s]=0);F=!0}for(A=0;A<y;A++){if(F)for(s in a.p.userData)a.p.userData[s]+=parseFloat(x[A][s]||0);E.call(b(a),x[A],A,B)}}x=x.slice((z-1)*B,z*B);f=t=null;v[a.p.localReader.total]=C;v[a.p.localReader.page]=z;v[a.p.localReader.records]=y;v[a.p.localReader.root]=x;v[a.p.localReader.userdata]=a.p.userData;x=null;return v}}},ca=function(){a.grid.hDiv.loading=
!0;a.p.hiddengrid||b(a).jqGrid("progressBar",{method:"show",loadtype:a.p.loadui,htmlcontent:a.p.loadtext})},L=function(){a.grid.hDiv.loading=!1;b(a).jqGrid("progressBar",{method:"hide",loadtype:a.p.loadui})},M=function(c){if(!a.grid.hDiv.loading){var d=a.p.scroll&&!1===c,e={},g,f=a.p.prmNames;0>=a.p.page&&(a.p.page=Math.min(1,a.p.lastpage));null!==f.search&&(e[f.search]=a.p.search);null!==f.nd&&(e[f.nd]=(new Date).getTime());null!==f.rows&&(e[f.rows]=a.p.rowNum);null!==f.page&&(e[f.page]=a.p.page);
null!==f.sort&&(e[f.sort]=a.p.sortname);null!==f.order&&(e[f.order]=a.p.sortorder);null!==a.p.rowTotal&&null!==f.totalrows&&(e[f.totalrows]=a.p.rowTotal);var h=b.isFunction(a.p.loadComplete),k=h?a.p.loadComplete:null,l=0;c=c||1;1<c?null!==f.npage?(e[f.npage]=c,l=c-1,c=1):k=function(b){a.p.page++;a.grid.hDiv.loading=!1;h&&a.p.loadComplete.call(a,b);M(c-1)}:null!==f.npage&&delete a.p.postData[f.npage];if(a.p.grouping){b(a).jqGrid("groupingSetup");var m=a.p.groupingView,n,p="";for(n=0;n<m.groupField.length;n++){var q=
m.groupField[n];b.each(a.p.colModel,function(a,b){b.name===q&&b.index&&(q=b.index)});p+=q+" "+m.groupOrder[n]+", "}e[f.sort]=p+e[f.sort]}b.extend(a.p.postData,e);var r=a.p.scroll?a.rows.length-1:1,e=b(a).triggerHandler("jqGridBeforeRequest");if(!1!==e&&"stop"!==e)if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id,r,c,l);else{if(b.isFunction(a.p.beforeRequest)&&(e=a.p.beforeRequest.call(a),void 0===e&&(e=!0),!1===e))return;g=a.p.datatype.toLowerCase();switch(g){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,
type:a.p.mtype,dataType:g,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(e,f,h){if(b.isFunction(a.p.beforeProcessing)&&!1===a.p.beforeProcessing.call(a,e,f,h))L();else{"xml"===g?aa(e,a.grid.bDiv,r,1<c,l):ba(e,a.grid.bDiv,r,1<c,l);b(a).triggerHandler("jqGridLoadComplete",[e]);k&&k.call(a,e);b(a).triggerHandler("jqGridAfterLoadComplete",[e]);d&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";1===c&&L()}},
error:function(d,e,f){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,d,e,f);1===c&&L()},beforeSend:function(c,d){var e=!0;b.isFunction(a.p.loadBeforeSend)&&(e=a.p.loadBeforeSend.call(a,c,d));void 0===e&&(e=!0);if(!1===e)return!1;ca()}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":ca();e="string"!==typeof a.p.datastr?a.p.datastr:b.parseXML(a.p.datastr);aa(e,a.grid.bDiv);b(a).triggerHandler("jqGridLoadComplete",[e]);h&&a.p.loadComplete.call(a,e);b(a).triggerHandler("jqGridAfterLoadComplete",
[e]);a.p.datatype="local";a.p.datastr=null;L();break;case "jsonstring":ca();e="string"===typeof a.p.datastr?b.jgrid.parse(a.p.datastr):a.p.datastr;ba(e,a.grid.bDiv);b(a).triggerHandler("jqGridLoadComplete",[e]);h&&a.p.loadComplete.call(a,e);b(a).triggerHandler("jqGridAfterLoadComplete",[e]);a.p.datatype="local";a.p.datastr=null;L();break;case "local":case "clientside":ca(),a.p.datatype="local",e=ua(),ba(e,a.grid.bDiv,r,1<c,l),b(a).triggerHandler("jqGridLoadComplete",[e]),k&&k.call(a,e),b(a).triggerHandler("jqGridAfterLoadComplete",
[e]),d&&a.grid.populateVisible(),L()}}}},ha=function(c){b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",c);if(a.p.frozenColumns&&a.p.id+"_frozen")b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.fhDiv)[a.p.useProp?"prop":"attr"]("checked",c)},oa=function(c,d){var e="",f="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",g="",h,k,m,n,p=function(c){var d;b.isFunction(a.p.onPaging)&&(d=a.p.onPaging.call(a,c));if("stop"===
d)return!1;a.p.selrow=null;a.p.multiselect&&(a.p.selarrrow=[],ha(!1));a.p.savedRow=[];return!0};c=c.substr(1);d+="_"+c;h="pg_"+c;k=c+"_left";m=c+"_center";n=c+"_right";b("#"+b.jgrid.jqID(c)).append("<div id='"+h+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+k+"' align='left'></td><td id='"+m+"' align='center' style='white-space:pre;'></td><td id='"+n+
"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(0<a.p.rowList.length){g="<td dir='"+l+"'>";g+="<select class='ui-pg-selbox' role='listbox' "+(a.p.pgrecs?"title='"+a.p.pgrecs+"'":"")+">";for(k=0;k<a.p.rowList.length;k++)m=a.p.rowList[k].toString().split(":"),1===m.length&&(m[1]=m[0]),g+='<option role="option" value="'+m[0]+'"'+(q(a.p.rowNum,0)===q(m[0],0)?' selected="selected"':"")+">"+m[1]+"</option>";g+="</select></td>"}"rtl"===l&&(f+=g);!0===a.p.pginput&&(e="<td dir='"+
l+"'>"+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_"+b.jgrid.jqID(c)+"'></span>")+"</td>");!0===a.p.pgbuttons?(k=["first"+d,"prev"+d,"next"+d,"last"+d],"rtl"===l&&k.reverse(),f+="<td id='"+k[0]+"' class='ui-pg-button ui-corner-all' "+(a.p.pgfirst?"title='"+a.p.pgfirst+"'":"")+"><span class='ui-icon ui-icon-seek-first'></span></td>",f+="<td id='"+k[1]+"' class='ui-pg-button ui-corner-all' "+(a.p.pgprev?"title='"+
a.p.pgprev+"'":"")+"><span class='ui-icon ui-icon-seek-prev'></span></td>",f=f+(""!==e?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+e+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"")+("<td id='"+k[2]+"' class='ui-pg-button ui-corner-all' "+(a.p.pgnext?"title='"+a.p.pgnext+"'":"")+"><span class='ui-icon ui-icon-seek-next'></span></td>"),f+="<td id='"+k[3]+"' class='ui-pg-button ui-corner-all' "+
(a.p.pglast?"title='"+a.p.pglast+"'":"")+"><span class='ui-icon ui-icon-seek-end'></span></td>"):""!==e&&(f+=e);"ltr"===l&&(f+=g);f+="</tr></tbody></table>";!0===a.p.viewrecords&&b("td#"+c+"_"+a.p.recordpos,"#"+h).append("<div dir='"+l+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+c+"_"+a.p.pagerpos,"#"+h).append(f);g=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:"+
g+";visibility:hidden;' ></div>");f=b(f).clone().appendTo("#testpg").width();b("#testpg").remove();0<f&&(""!==e&&(f+=50),b("td#"+c+"_"+a.p.pagerpos,"#"+h).width(f));a.p._nvtd=[];a.p._nvtd[0]=f?Math.floor((a.p.width-f)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;f=null;b(".ui-pg-selbox","#"+h).bind("change",function(){if(!p("records"))return!1;a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-.5)+1;a.p.rowNum=this.value;a.p.pager&&b(".ui-pg-selbox",a.p.pager).val(this.value);a.p.toppager&&b(".ui-pg-selbox",
a.p.toppager).val(this.value);M();return!1});!0===a.p.pgbuttons&&(b(".ui-pg-button","#"+h).hover(function(){b(this).hasClass("ui-state-disabled")?this.style.cursor="default":(b(this).addClass("ui-state-hover"),this.style.cursor="pointer")},function(){b(this).hasClass("ui-state-disabled")||(b(this).removeClass("ui-state-hover"),this.style.cursor="default")}),b("#first"+b.jgrid.jqID(d)+", #prev"+b.jgrid.jqID(d)+", #next"+b.jgrid.jqID(d)+", #last"+b.jgrid.jqID(d)).click(function(){if(b(this).hasClass("ui-state-disabled"))return!1;
var c=q(a.p.page,1),e=q(a.p.lastpage,1),f=!1,g=!0,h=!0,k=!0,l=!0;0===e||1===e?l=k=h=g=!1:1<e&&1<=c?1===c?h=g=!1:c===e&&(l=k=!1):1<e&&0===c&&(l=k=!1,c=e-1);if(!p(this.id))return!1;this.id==="first"+d&&g&&(a.p.page=1,f=!0);this.id==="prev"+d&&h&&(a.p.page=c-1,f=!0);this.id==="next"+d&&k&&(a.p.page=c+1,f=!0);this.id==="last"+d&&l&&(a.p.page=e,f=!0);f&&M();return!1}));!0===a.p.pginput&&b("input.ui-pg-input","#"+h).keypress(function(c){if(13===(c.charCode||c.keyCode||0)){if(!p("user"))return!1;b(this).val(q(b(this).val(),
1));a.p.page=0<b(this).val()?b(this).val():a.p.page;M();return!1}return this})},wa=function(c,d){var e,f="",g=a.p.colModel,h=!1,k;k=a.p.frozenColumns?d:a.grid.headers[c].el;var l="";b("span.ui-grid-ico-sort",k).addClass("ui-state-disabled");b(k).attr("aria-selected","false");if(g[c].lso)if("asc"===g[c].lso)g[c].lso+="-desc",l="desc";else if("desc"===g[c].lso)g[c].lso+="-asc",l="asc";else{if("asc-desc"===g[c].lso||"desc-asc"===g[c].lso)g[c].lso=""}else g[c].lso=l=g[c].firstsortorder||"asc";l?(b("span.s-ico",
k).show(),b("span.ui-icon-"+l,k).removeClass("ui-state-disabled"),b(k).attr("aria-selected","true")):a.p.viewsortcols[0]||b("span.s-ico",k).hide();a.p.sortorder="";b.each(g,function(b){this.lso&&(0<b&&h&&(f+=", "),e=this.lso.split("-"),f+=g[b].index||g[b].name,f+=" "+e[e.length-1],h=!0,a.p.sortorder=e[e.length-1])});k=f.lastIndexOf(a.p.sortorder);f=f.substring(0,k);a.p.sortname=f},pa=function(c,d,e,f,g){if(a.p.colModel[d].sortable&&!(0<a.p.savedRow.length)){e||(a.p.lastsort===d&&""!==a.p.sortname?
"asc"===a.p.sortorder?a.p.sortorder="desc":"desc"===a.p.sortorder&&(a.p.sortorder="asc"):a.p.sortorder=a.p.colModel[d].firstsortorder||"asc",a.p.page=1);if(a.p.multiSort)wa(d,g);else{if(f){if(a.p.lastsort===d&&a.p.sortorder===f&&!e)return;a.p.sortorder=f}e=a.grid.headers[a.p.lastsort].el;g=a.p.frozenColumns?g:a.grid.headers[d].el;b("span.ui-grid-ico-sort",e).addClass("ui-state-disabled");b(e).attr("aria-selected","false");a.p.frozenColumns&&(a.grid.fhDiv.find("span.ui-grid-ico-sort").addClass("ui-state-disabled"),
a.grid.fhDiv.find("th").attr("aria-selected","false"));b("span.ui-icon-"+a.p.sortorder,g).removeClass("ui-state-disabled");b(g).attr("aria-selected","true");a.p.viewsortcols[0]||(a.p.lastsort!==d?(a.p.frozenColumns&&a.grid.fhDiv.find("span.s-ico").hide(),b("span.s-ico",e).hide(),b("span.s-ico",g).show()):""===a.p.sortname&&b("span.s-ico",g).show());c=c.substring(5+a.p.id.length+1);a.p.sortname=a.p.colModel[d].index||c}"stop"===b(a).triggerHandler("jqGridSortCol",[a.p.sortname,d,a.p.sortorder])?a.p.lastsort=
d:b.isFunction(a.p.onSortCol)&&"stop"===a.p.onSortCol.call(a,a.p.sortname,d,a.p.sortorder)?a.p.lastsort=d:("local"===a.p.datatype?a.p.deselectAfterSort&&b(a).jqGrid("resetSelection"):(a.p.selrow=null,a.p.multiselect&&ha(!1),a.p.selarrrow=[],a.p.savedRow=[]),a.p.scroll&&(g=a.grid.bDiv.scrollLeft,V.call(a,!0,!1),a.grid.hDiv.scrollLeft=g),a.p.subGrid&&"local"===a.p.datatype&&b("td.sgexpanded","#"+b.jgrid.jqID(a.p.id)).each(function(){b(this).trigger("click")}),M(),a.p.lastsort=d,a.p.sortname!==c&&d&&
(a.p.lastsort=d))}},xa=function(c){c=b(a.grid.headers[c].el);c=[c.position().left+c.outerWidth()];"rtl"===a.p.direction&&(c[0]=a.p.width-c[0]);c[0]-=a.grid.bDiv.scrollLeft;c.push(b(a.grid.hDiv).position().top);c.push(b(a.grid.bDiv).offset().top-b(a.grid.hDiv).offset().top+b(a.grid.bDiv).height());return c},qa=function(c){var d,e=a.grid.headers,f=b.jgrid.getCellIndex(c);for(d=0;d<e.length;d++)if(c===e[d].el){f=d;break}return f},y;this.p.id=this.id;-1===b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])&&
(a.p.multikey=!1);a.p.keyName=!1;for(f=0;f<a.p.colModel.length;f++)y="string"===typeof a.p.colModel[f].template?null!=b.jgrid.cmTemplate&&"object"===typeof b.jgrid.cmTemplate[a.p.colModel[f].template]?b.jgrid.cmTemplate[a.p.colModel[f].template]:{}:a.p.colModel[f].template,a.p.colModel[f]=b.extend(!0,{},a.p.cmTemplate,y||{},a.p.colModel[f]),!1===a.p.keyName&&!0===a.p.colModel[f].key&&(a.p.keyName=a.p.colModel[f].name);a.p.sortorder=a.p.sortorder.toLowerCase();b.jgrid.cell_width=b.jgrid.cellWidth();
!0===a.p.grouping&&(a.p.scroll=!1,a.p.rownumbers=!1,a.p.treeGrid=!1,a.p.gridview=!0);if(!0===this.p.treeGrid){try{b(this).jqGrid("setTreeGrid")}catch(za){}"local"!==a.p.datatype&&(a.p.localReader={id:"_id_"})}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(Aa){}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:b.jgrid.cell_width?a.p.multiselectWidth+a.p.cellLayout:a.p.multiselectWidth,
sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));this.p.rownumbers&&(this.p.colNames.unshift(""),this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));a.p.xmlReader=b.extend(!0,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:!0,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:!0,cell:"cell"}},a.p.xmlReader);a.p.jsonReader=
b.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!0,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},a.p.jsonReader);a.p.localReader=b.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!1,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},a.p.localReader);a.p.scroll&&(a.p.pgbuttons=!1,a.p.pginput=!1,a.p.rowList=[]);a.p.data.length&&(S(),O());y="<thead><tr class='ui-jqgrid-labels' role='row'>";
var ra,z,ia,da,ja,E,u,X,sa=X="",ea=[],ta=[];z=[];if(!0===a.p.shrinkToFit&&!0===a.p.forceFit)for(f=a.p.colModel.length-1;0<=f;f--)if(!a.p.colModel[f].hidden){a.p.colModel[f].resizable=!1;break}"horizontal"===a.p.viewsortcols[1]&&(X=" ui-i-asc",sa=" ui-i-desc");ra=d?"class='ui-th-div-ie'":"";X="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+X+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+l+"'></span>"+("<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+
sa+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+l+"'></span></span>");if(a.p.multiSort)for(ea=a.p.sortname.split(","),f=0;f<ea.length;f++)z=b.trim(ea[f]).split(" "),ea[f]=b.trim(z[0]),ta[f]=z[1]?b.trim(z[1]):a.p.sortorder||"asc";for(f=0;f<this.p.colNames.length;f++)z=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[f])+'"':"",y+="<th id='"+a.p.id+"_"+a.p.colModel[f].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+l+"'"+z+">",z=a.p.colModel[f].index||
a.p.colModel[f].name,y+="<div id='jqgh_"+a.p.id+"_"+a.p.colModel[f].name+"' "+ra+">"+a.p.colNames[f],a.p.colModel[f].width=a.p.colModel[f].width?parseInt(a.p.colModel[f].width,10):150,"boolean"!==typeof a.p.colModel[f].title&&(a.p.colModel[f].title=!0),a.p.colModel[f].lso="",z===a.p.sortname&&(a.p.lastsort=f),a.p.multiSort&&(z=b.inArray(z,ea),-1!==z&&(a.p.colModel[f].lso=ta[z])),y+=X+"</div></th>";y+="</tr></thead>";X=null;b(this).append(y);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 ka=[],Y;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){a.p.selarrrow=[];var c=!0===a.p.frozenColumns?a.p.id+"_frozen":"";this.checked?(b(a.rows).each(function(d){0<d&&!(b(this).hasClass("ui-subgrid")||b(this).hasClass("jqgroup")||b(this).hasClass("ui-state-disabled")||b(this).hasClass("jqfoot"))&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":"attr"]("checked",!0),b(this).addClass("ui-state-highlight").attr("aria-selected",
"true"),a.p.selarrrow.push(this.id),a.p.selrow=this.id,c&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id),a.grid.fbDiv)[a.p.useProp?"prop":"attr"]("checked",!0),b("#"+b.jgrid.jqID(this.id),a.grid.fbDiv).addClass("ui-state-highlight")))}),Y=!0,ka=[]):(b(a.rows).each(function(d){0<d&&!(b(this).hasClass("ui-subgrid")||b(this).hasClass("jqgroup")||b(this).hasClass("ui-state-disabled")||b(this).hasClass("jqfoot"))&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":
"attr"]("checked",!1),b(this).removeClass("ui-state-highlight").attr("aria-selected","false"),ka.push(this.id),c&&(b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id),a.grid.fbDiv)[a.p.useProp?"prop":"attr"]("checked",!1),b("#"+b.jgrid.jqID(this.id),a.grid.fbDiv).removeClass("ui-state-highlight")))}),a.p.selrow=null,Y=!1);b(a).triggerHandler("jqGridSelectAll",[Y?a.p.selarrrow:ka,Y]);b.isFunction(a.p.onSelectAll)&&a.p.onSelectAll.call(a,Y?a.p.selarrrow:ka,Y)})}!0===a.p.autowidth&&(y=b(m).innerWidth(),
a.p.width=0<y?y:"nw");(function(){var d=0,e=b.jgrid.cell_width?0:q(a.p.cellLayout,0),f=0,g,h=q(a.p.scrollOffset,0),k,l=!1,m,n=0,p;b.each(a.p.colModel,function(){void 0===this.hidden&&(this.hidden=!1);if(a.p.grouping&&a.p.autowidth){var c=b.inArray(this.name,a.p.groupingView.groupField);0<=c&&a.p.groupingView.groupColumnShow.length>c&&(this.hidden=!a.p.groupingView.groupColumnShow[c])}this.widthOrg=k=q(this.width,0);!1===this.hidden&&(d+=k+e,this.fixed?n+=k+e:f++)});isNaN(a.p.width)&&(a.p.width=d+
(!1!==a.p.shrinkToFit||isNaN(a.p.height)?0:h));c.width=a.p.width;a.p.tblwidth=d;!1===a.p.shrinkToFit&&!0===a.p.forceFit&&(a.p.forceFit=!1);!0===a.p.shrinkToFit&&0<f&&(m=c.width-e*f-n,isNaN(a.p.height)||(m-=h,l=!0),d=0,b.each(a.p.colModel,function(b){!1!==this.hidden||this.fixed||(this.width=k=Math.round(m*this.width/(a.p.tblwidth-e*f-n)),d+=k,g=b)}),p=0,l?c.width-n-(d+e*f)!==h&&(p=c.width-n-(d+e*f)-h):l||1===Math.abs(c.width-n-(d+e*f))||(p=c.width-n-(d+e*f)),a.p.colModel[g].width+=p,a.p.tblwidth=
d+p+e*f+n,a.p.tblwidth>a.p.width&&(a.p.colModel[g].width-=a.p.tblwidth-parseInt(a.p.width,10),a.p.tblwidth=a.p.width))})();b(m).css("width",c.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(n).css("width",c.width+"px");y=b("thead:first",a).get(0);var N="";a.p.footerrow&&(N+="<table role='presentation' 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-"+
l+"'>");var n=b("tr:first",y),$="<tr class='jqgfirstrow' role='row' style='height:auto'>";a.p.disableClick=!1;b("th",n).each(function(d){ia=a.p.colModel[d].width;void 0===a.p.colModel[d].resizable&&(a.p.colModel[d].resizable=!0);a.p.colModel[d].resizable?(da=document.createElement("span"),b(da).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+l).css("cursor","col-resize"),b(this).addClass(a.p.resizeclass)):da="";b(this).css("width",ia+"px").prepend(da);da=null;var e="";a.p.colModel[d].hidden&&
(b(this).css("display","none"),e="display:none;");$+="<td role='gridcell' style='height:0px;width:"+ia+"px;"+e+"'></td>";c.headers[d]={width:ia,el:this};ja=a.p.colModel[d].sortable;"boolean"!==typeof ja&&(ja=a.p.colModel[d].sortable=!0);e=a.p.colModel[d].name;"cb"!==e&&"subgrid"!==e&&"rn"!==e&&a.p.viewsortcols[2]&&b(">div",this).addClass("ui-jqgrid-sortable");ja&&(a.p.multiSort?a.p.viewsortcols[0]?(b("div span.s-ico",this).show(),a.p.colModel[d].lso&&b("div span.ui-icon-"+a.p.colModel[d].lso,this).removeClass("ui-state-disabled")):
a.p.colModel[d].lso&&(b("div span.s-ico",this).show(),b("div span.ui-icon-"+a.p.colModel[d].lso,this).removeClass("ui-state-disabled")):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")):d===a.p.lastsort&&""!==a.p.sortname&&(b("div span.s-ico",this).show(),b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")));a.p.footerrow&&(N+="<td role='gridcell' "+p(d,0,"",null,"",!1)+">&#160;</td>")}).mousedown(function(d){if(1===
b(d.target).closest("th>span.ui-jqgrid-resize").length){var e=qa(this);if(!0===a.p.forceFit){var f=a.p,g=e,h;for(h=e+1;h<a.p.colModel.length;h++)if(!0!==a.p.colModel[h].hidden){g=h;break}f.nv=g-e}c.dragStart(e,d,xa(e));return!1}}).click(function(c){if(a.p.disableClick)return a.p.disableClick=!1;var d="th>div.ui-jqgrid-sortable",e,f;a.p.viewsortcols[2]||(d="th>div>span>span.ui-grid-ico-sort");c=b(c.target).closest(d);if(1===c.length){var g;if(a.p.frozenColumns){var h=b(this)[0].id.substring(a.p.id.length+
1);b(a.p.colModel).each(function(a){if(this.name===h)return g=a,!1})}else g=qa(this);a.p.viewsortcols[2]||(e=!0,f=c.attr("sort"));null!=g&&pa(b("div",this)[0].id,g,e,f,this);return!1}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",n)}catch(Ba){}a.p.footerrow&&(N+="</tr></tbody></table>");$+="</tr>";n=document.createElement("tbody");this.appendChild(n);b(this).addClass("ui-jqgrid-btable").append($);var $=null,n=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='presentation' aria-labelledby='gbox_"+
this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(y),I=a.p.caption&&!0===a.p.hiddengrid?!0:!1;f=b("<div class='ui-jqgrid-hbox"+("rtl"===l?"-rtl":"")+"'></div>");y=null;c.hDiv=document.createElement("div");b(c.hDiv).css({width:c.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(f);b(f).append(n);n=null;I&&b(c.hDiv).hide();a.p.pager&&("string"===typeof a.p.pager?"#"!==a.p.pager.substr(0,1)&&(a.p.pager="#"+a.p.pager):a.p.pager="#"+b(a.p.pager).attr("id"),b(a.p.pager).css({width:c.width+
"px"}).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom").appendTo(m),I&&b(a.p.pager).hide(),oa(a.p.pager,""));!1===a.p.cellEdit&&!0===a.p.hoverrows&&b(a).bind("mouseover",function(a){u=b(a.target).closest("tr.jqgrow");"ui-subgrid"!==b(u).attr("class")&&b(u).addClass("ui-state-hover")}).bind("mouseout",function(a){u=b(a.target).closest("tr.jqgrow");b(u).removeClass("ui-state-hover")});var C,J,la;b(a).before(c.hDiv).click(function(c){E=c.target;u=b(E,a.rows).closest("tr.jqgrow");if(0===
b(u).length||-1<u[0].className.indexOf("ui-state-disabled")||(b(E,a).closest("table.ui-jqgrid-btable").attr("id")||"").replace("_frozen","")!==a.id)return this;var d=b(E).hasClass("cbox"),e=b(a).triggerHandler("jqGridBeforeSelectRow",[u[0].id,c]),e=!1===e||"stop"===e?!1:!0;if(b.isFunction(a.p.beforeSelectRow)){var f=a.p.beforeSelectRow.call(a,u[0].id,c);if(!1===f||"stop"===f)e=!1}if("A"!==E.tagName&&("INPUT"!==E.tagName&&"TEXTAREA"!==E.tagName&&"OPTION"!==E.tagName&&"SELECT"!==E.tagName||d)){C=u[0].id;
E=b(E).closest("tr.jqgrow>td");0<E.length&&(J=b.jgrid.getCellIndex(E),la=b(E).closest("td,th").html(),b(a).triggerHandler("jqGridCellSelect",[C,J,la,c]),b.isFunction(a.p.onCellSelect)&&a.p.onCellSelect.call(a,C,J,la,c));if(!0===a.p.cellEdit)if(a.p.multiselect&&d&&e)b(a).jqGrid("setSelection",C,!0,c);else if(0<E.length){C=u[0].rowIndex;try{b(a).jqGrid("editCell",C,J,!0)}catch(g){}}if(e)if(a.p.multikey)c[a.p.multikey]?b(a).jqGrid("setSelection",C,!0,c):a.p.multiselect&&d&&(d=b("#jqg_"+b.jgrid.jqID(a.p.id)+
"_"+C).is(":checked"),b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+C)[a.p.useProp?"prop":"attr"]("checked",d));else{if(a.p.multiselect&&a.p.multiboxonly&&!d){var h=a.p.frozenColumns?a.p.id+"_frozen":"";b(a.p.selarrrow).each(function(c,d){var e=b(a).jqGrid("getGridRowById",d);e&&b(e).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(d))[a.p.useProp?"prop":"attr"]("checked",!1);h&&(b("#"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(h)).removeClass("ui-state-highlight"),b("#jqg_"+b.jgrid.jqID(a.p.id)+
"_"+b.jgrid.jqID(d),"#"+b.jgrid.jqID(h))[a.p.useProp?"prop":"attr"]("checked",!1))});a.p.selarrrow=[]}b(a).jqGrid("setSelection",C,!0,c)}}}).bind("reloadGrid",function(c,d){!0===a.p.treeGrid&&(a.p.datatype=a.p.treedatatype);d&&d.current&&a.grid.selectionPreserver(a);"local"===a.p.datatype?(b(a).jqGrid("resetSelection"),a.p.data.length&&(S(),O())):a.p.treeGrid||(a.p.selrow=null,a.p.multiselect&&(a.p.selarrrow=[],ha(!1)),a.p.savedRow=[]);a.p.scroll&&V.call(a,!0,!1);if(d&&d.page){var e=d.page;e>a.p.lastpage&&
(e=a.p.lastpage);1>e&&(e=1);a.p.page=e;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(e-1)*a.grid.prevRowHeight*a.p.rowNum:0}a.grid.prevRowHeight&&a.p.scroll?(delete a.p.lastpage,a.grid.populateVisible()):a.grid.populate();!0===a.p._inlinenav&&b(a).jqGrid("showAddEditButtons");return!1}).dblclick(function(c){E=c.target;u=b(E,a.rows).closest("tr.jqgrow");if(0!==b(u).length){C=u[0].rowIndex;J=b.jgrid.getCellIndex(E);var d=b(a).triggerHandler("jqGridDblClickRow",[b(u).attr("id"),C,J,c]);if(null!=d||b.isFunction(a.p.ondblClickRow)&&
(d=a.p.ondblClickRow.call(a,b(u).attr("id"),C,J,c),null!=d))return d}}).bind("contextmenu",function(c){E=c.target;u=b(E,a.rows).closest("tr.jqgrow");if(0!==b(u).length){a.p.multiselect||b(a).jqGrid("setSelection",u[0].id,!0,c);C=u[0].rowIndex;J=b.jgrid.getCellIndex(E);var d=b(a).triggerHandler("jqGridRightClickRow",[b(u).attr("id"),C,J,c]);if(null!=d||b.isFunction(a.p.onRightClickRow)&&(d=a.p.onRightClickRow.call(a,b(u).attr("id"),C,J,c),null!=d))return d}});c.bDiv=document.createElement("div");d&&
"auto"===String(a.p.height).toLowerCase()&&(a.p.height="100%");b(c.bDiv).append(b('<div style="position:relative;'+(d&&8>b.jgrid.msiever()?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?"":"px"),width:c.width+"px"}).scroll(c.scrollGrid);b("table:first",c.bDiv).css({width:a.p.tblwidth+"px"});b.support.tbody||2===b("tbody",this).length&&b("tbody:gt(0)",this).remove();a.p.multikey&&(b.jgrid.msie?b(c.bDiv).bind("selectstart",
function(){return!1}):b(c.bDiv).bind("mousedown",function(){return!1}));I&&b(c.bDiv).hide();c.cDiv=document.createElement("div");var ma=!0===a.p.hidegrid?b("<a role='link' class='ui-jqgrid-titlebar-close ui-corner-all HeaderButton' "+(a.p.showhide?"title='"+a.p.showhide+"'":"")+" />").hover(function(){ma.addClass("ui-state-hover")},function(){ma.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl"===l?"left":"right","0px"):"";b(c.cDiv).append(ma).append("<span class='ui-jqgrid-title'>"+
a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-jqgrid-caption"+("rtl"===l?"-rtl":"")+" ui-widget-header ui-corner-top ui-helper-clearfix");b(c.cDiv).insertBefore(c.hDiv);a.p.toolbar[0]&&(c.uDiv=document.createElement("div"),"top"===a.p.toolbar[1]?b(c.uDiv).insertBefore(c.hDiv):"bottom"===a.p.toolbar[1]&&b(c.uDiv).insertAfter(c.hDiv),"both"===a.p.toolbar[1]?(c.ubDiv=document.createElement("div"),b(c.uDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id).insertBefore(c.hDiv),
b(c.ubDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id).insertAfter(c.hDiv),I&&b(c.ubDiv).hide()):b(c.uDiv).width(c.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),I&&b(c.uDiv).hide());a.p.toppager&&(a.p.toppager=b.jgrid.jqID(a.p.id)+"_toppager",c.topDiv=b("<div id='"+a.p.toppager+"'></div>")[0],a.p.toppager="#"+a.p.toppager,b(c.topDiv).addClass("ui-state-default ui-jqgrid-toppager").width(c.width).insertBefore(c.hDiv),oa(a.p.toppager,"_t"));a.p.footerrow&&
(c.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0],f=b("<div class='ui-jqgrid-hbox"+("rtl"===l?"-rtl":"")+"'></div>"),b(c.sDiv).append(f).width(c.width).insertAfter(c.hDiv),b(f).append(N),c.footers=b(".ui-jqgrid-ftable",c.sDiv)[0].rows[0].cells,a.p.rownumbers&&(c.footers[0].className="ui-state-default jqgrid-rownum"),I&&b(c.sDiv).hide());f=null;if(a.p.caption){var ya=a.p.datatype;!0===a.p.hidegrid&&(b(".ui-jqgrid-titlebar-close",c.cDiv).click(function(d){var e=b.isFunction(a.p.onHeaderClick),f=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
g,h=this;!0===a.p.toolbar[0]&&("both"===a.p.toolbar[1]&&(f+=", #"+b(c.ubDiv).attr("id")),f+=", #"+b(c.uDiv).attr("id"));g=b(f,"#gview_"+b.jgrid.jqID(a.p.id)).length;"visible"===a.p.gridstate?b(f,"#gbox_"+b.jgrid.jqID(a.p.id)).slideUp("fast",function(){g--;0===g&&(b("span",h).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),a.p.gridstate="hidden",b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).hide(),b(a).triggerHandler("jqGridHeaderClick",
[a.p.gridstate,d]),e&&(I||a.p.onHeaderClick.call(a,a.p.gridstate,d)))}):"hidden"===a.p.gridstate&&b(f,"#gbox_"+b.jgrid.jqID(a.p.id)).slideDown("fast",function(){g--;0===g&&(b("span",h).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),I&&(a.p.datatype=ya,M(),I=!1),a.p.gridstate="visible",b("#gbox_"+b.jgrid.jqID(a.p.id)).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+b.jgrid.jqID(a.p.id)).show(),b(a).triggerHandler("jqGridHeaderClick",[a.p.gridstate,d]),e&&
(I||a.p.onHeaderClick.call(a,a.p.gridstate,d)))});return!1}),I&&(a.p.datatype="local",b(".ui-jqgrid-titlebar-close",c.cDiv).trigger("click")))}else b(c.cDiv).hide(),a.p.toppager||b(c.hDiv).addClass("ui-corner-top");b(c.hDiv).after(c.bDiv).mousemove(function(a){if(c.resizing)return c.dragMove(a),!1});b(".ui-jqgrid-labels",c.hDiv).bind("selectstart",function(){return!1});b(document).bind("mouseup.jqGrid"+a.p.id,function(){return c.resizing?(c.dragEnd(),!1):!0});a.formatCol=p;a.sortData=pa;a.updatepager=
function(c,d){var e,f,g,h,k,l,m,n="",p=a.p.pager?"_"+b.jgrid.jqID(a.p.pager.substr(1)):"",r=a.p.toppager?"_"+a.p.toppager.substr(1):"";g=parseInt(a.p.page,10)-1;0>g&&(g=0);g*=parseInt(a.p.rowNum,10);k=g+a.p.reccount;if(a.p.scroll){e=b("tbody:first > tr:gt(0)",a.grid.bDiv);g=k-e.length;a.p.reccount=e.length;if(e=e.outerHeight()||a.grid.prevRowHeight)f=g*e,m=parseInt(a.p.records,10)*e,b(">div:first",a.grid.bDiv).css({height:m}).children("div:first").css({height:f,display:f?"":"none"}),0==a.grid.bDiv.scrollTop&&
1<a.p.page&&(a.grid.bDiv.scrollTop=a.p.rowNum*(a.p.page-1)*e);a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}n=a.p.pager||"";if(n+=a.p.toppager?n?","+a.p.toppager:a.p.toppager:"")m=b.jgrid.formatter.integer||{},e=q(a.p.page),f=q(a.p.lastpage),b(".selbox",n)[this.p.useProp?"prop":"attr"]("disabled",!1),!0===a.p.pginput&&(b(".ui-pg-input",n).val(a.p.page),h=a.p.toppager?"#sp_1"+p+",#sp_1"+r:"#sp_1"+p,b(h).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,m):a.p.lastpage)),a.p.viewrecords&&(0===
a.p.reccount?b(".ui-paging-info",n).html(a.p.emptyrecords):(h=g+1,l=a.p.records,b.fmatter&&(h=b.fmatter.util.NumberFormat(h,m),k=b.fmatter.util.NumberFormat(k,m),l=b.fmatter.util.NumberFormat(l,m)),b(".ui-paging-info",n).html(b.jgrid.format(a.p.recordtext,h,k,l)))),!0===a.p.pgbuttons&&(0>=e&&(e=f=0),1===e||0===e?(b("#first"+p+", #prev"+p).addClass("ui-state-disabled").removeClass("ui-state-hover"),a.p.toppager&&b("#first_t"+r+", #prev_t"+r).addClass("ui-state-disabled").removeClass("ui-state-hover")):
(b("#first"+p+", #prev"+p).removeClass("ui-state-disabled"),a.p.toppager&&b("#first_t"+r+", #prev_t"+r).removeClass("ui-state-disabled")),e===f||0===e?(b("#next"+p+", #last"+p).addClass("ui-state-disabled").removeClass("ui-state-hover"),a.p.toppager&&b("#next_t"+r+", #last_t"+r).addClass("ui-state-disabled").removeClass("ui-state-hover")):(b("#next"+p+", #last"+p).removeClass("ui-state-disabled"),a.p.toppager&&b("#next_t"+r+", #last_t"+r).removeClass("ui-state-disabled")));!0===c&&!0===a.p.rownumbers&&
b(">td.jqgrid-rownum",a.rows).each(function(a){b(this).html(g+1+a)});d&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b(a).triggerHandler("jqGridGridComplete");b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a);b(a).triggerHandler("jqGridAfterGridComplete")};a.refreshIndex=O;a.setHeadCheckBox=ha;a.constructTr=P;a.formatter=function(a,b,c,d,e){return B(a,b,c,d,e)};b.extend(c,{populate:M,emptyRows:V,beginReq:ca,endReq:L});this.grid=c;a.addXmlData=function(b){aa(b,a.grid.bDiv)};a.addJSONData=
function(b){ba(b,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;b(a).triggerHandler("jqGridInitGrid");b.isFunction(a.p.onInitGrid)&&a.p.onInitGrid.call(a);M();a.p.hiddengrid=!1}}}})};b.jgrid.extend({getGridParam:function(b){var f=this[0];if(f&&f.grid)return b?void 0!==f.p[b]?f.p[b]:null:f.p},setGridParam:function(g,f){return this.each(function(){null==f&&(f=!1);this.grid&&"object"===typeof g&&(!0===f?this.p=b.extend({},this.p,g):b.extend(!0,this.p,g))})},getGridRowById:function(g){var f;this.each(function(){try{for(var e=
this.rows.length;e--;)if(g.toString()===this.rows[e].id){f=this.rows[e];break}}catch(d){f=b(this.grid.bDiv).find("#"+b.jgrid.jqID(g))}});return f},getDataIDs:function(){var g=[],f=0,e,d=0;this.each(function(){if((e=this.rows.length)&&0<e)for(;f<e;)b(this.rows[f]).hasClass("jqgrow")&&(g[d]=this.rows[f].id,d++),f++});return g},setSelection:function(g,f,e){return this.each(function(){var d,k,a,c,h,l;void 0!==g&&(f=!1===f?!1:!0,!(k=b(this).jqGrid("getGridRowById",g))||!k.className||-1<k.className.indexOf("ui-state-disabled")||
(!0===this.p.scrollrows&&(a=b(this).jqGrid("getGridRowById",g).rowIndex,0<=a&&(d=b(this.grid.bDiv)[0].clientHeight,c=b(this.grid.bDiv)[0].scrollTop,h=b(this.rows[a]).position().top,a=this.rows[a].clientHeight,h+a>=d+c?b(this.grid.bDiv)[0].scrollTop=h-(d+c)+a+c:h<d+c&&h<c&&(b(this.grid.bDiv)[0].scrollTop=h))),!0===this.p.frozenColumns&&(l=this.p.id+"_frozen"),this.p.multiselect?(this.setHeadCheckBox(!1),this.p.selrow=k.id,c=b.inArray(this.p.selrow,this.p.selarrrow),-1===c?("ui-subgrid"!==k.className&&
b(k).addClass("ui-state-highlight").attr("aria-selected","true"),d=!0,this.p.selarrrow.push(this.p.selrow)):("ui-subgrid"!==k.className&&b(k).removeClass("ui-state-highlight").attr("aria-selected","false"),d=!1,this.p.selarrrow.splice(c,1),h=this.p.selarrrow[0],this.p.selrow=void 0===h?null:h),b("#jqg_"+b.jgrid.jqID(this.p.id)+"_"+b.jgrid.jqID(k.id))[this.p.useProp?"prop":"attr"]("checked",d),l&&(-1===c?b("#"+b.jgrid.jqID(g),"#"+b.jgrid.jqID(l)).addClass("ui-state-highlight"):b("#"+b.jgrid.jqID(g),
"#"+b.jgrid.jqID(l)).removeClass("ui-state-highlight"),b("#jqg_"+b.jgrid.jqID(this.p.id)+"_"+b.jgrid.jqID(g),"#"+b.jgrid.jqID(l))[this.p.useProp?"prop":"attr"]("checked",d)),f&&(b(this).triggerHandler("jqGridSelectRow",[k.id,d,e]),this.p.onSelectRow&&this.p.onSelectRow.call(this,k.id,d,e))):"ui-subgrid"!==k.className&&(this.p.selrow!==k.id?((d=b(this).jqGrid("getGridRowById",this.p.selrow))&&b(d).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"}),b(k).addClass("ui-state-highlight").attr({"aria-selected":"true",
tabindex:"0"}),l&&(b("#"+b.jgrid.jqID(this.p.selrow),"#"+b.jgrid.jqID(l)).removeClass("ui-state-highlight"),b("#"+b.jgrid.jqID(g),"#"+b.jgrid.jqID(l)).addClass("ui-state-highlight")),d=!0):d=!1,this.p.selrow=k.id,f&&(b(this).triggerHandler("jqGridSelectRow",[k.id,d,e]),this.p.onSelectRow&&this.p.onSelectRow.call(this,k.id,d,e)))))})},resetSelection:function(g){return this.each(function(){var f=this,e,d;!0===f.p.frozenColumns&&(d=f.p.id+"_frozen");if(void 0!==g){e=g===f.p.selrow?f.p.selrow:g;b("#"+
b.jgrid.jqID(f.p.id)+" tbody:first tr#"+b.jgrid.jqID(e)).removeClass("ui-state-highlight").attr("aria-selected","false");d&&b("#"+b.jgrid.jqID(e),"#"+b.jgrid.jqID(d)).removeClass("ui-state-highlight");if(f.p.multiselect){b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(e),"#"+b.jgrid.jqID(f.p.id))[f.p.useProp?"prop":"attr"]("checked",!1);if(d)b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(e),"#"+b.jgrid.jqID(d))[f.p.useProp?"prop":"attr"]("checked",!1);f.setHeadCheckBox(!1);e=b.inArray(b.jgrid.jqID(e),
f.p.selarrrow);-1!==e&&f.p.selarrrow.splice(e,1)}e=null}else f.p.multiselect?(b(f.p.selarrrow).each(function(e,a){b(b(f).jqGrid("getGridRowById",a)).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(a))[f.p.useProp?"prop":"attr"]("checked",!1);d&&(b("#"+b.jgrid.jqID(a),"#"+b.jgrid.jqID(d)).removeClass("ui-state-highlight"),b("#jqg_"+b.jgrid.jqID(f.p.id)+"_"+b.jgrid.jqID(a),"#"+b.jgrid.jqID(d))[f.p.useProp?"prop":"attr"]("checked",!1))}),
f.setHeadCheckBox(!1),f.p.selarrrow=[],f.p.selrow=null):f.p.selrow&&(b("#"+b.jgrid.jqID(f.p.id)+" tbody:first tr#"+b.jgrid.jqID(f.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"),d&&b("#"+b.jgrid.jqID(f.p.selrow),"#"+b.jgrid.jqID(d)).removeClass("ui-state-highlight"),f.p.selrow=null);!0===f.p.cellEdit&&0<=parseInt(f.p.iCol,10)&&0<=parseInt(f.p.iRow,10)&&(b("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),b(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));
f.p.savedRow=[]})},getRowData:function(g){var f={},e,d=!1,k,a=0;this.each(function(){var c=this,h,l;if(void 0===g)d=!0,e=[],k=c.rows.length;else{l=b(c).jqGrid("getGridRowById",g);if(!l)return f;k=2}for(;a<k;)d&&(l=c.rows[a]),b(l).hasClass("jqgrow")&&(b('td[role="gridcell"]',l).each(function(a){h=c.p.colModel[a].name;if("cb"!==h&&"subgrid"!==h&&"rn"!==h)if(!0===c.p.treeGrid&&h===c.p.ExpandColumn)f[h]=b.jgrid.htmlDecode(b("span:first",this).html());else try{f[h]=b.unformat.call(c,this,{rowId:l.id,colModel:c.p.colModel[a]},
a)}catch(d){f[h]=b.jgrid.htmlDecode(b(this).html())}}),d&&(e.push(f),f={})),a++});return e||f},delRowData:function(g){var f=!1,e,d,k;this.each(function(){e=b(this).jqGrid("getGridRowById",g);if(!e)return!1;this.p.subGrid&&(k=b(e).next(),k.hasClass("ui-subgrid")&&k.remove());b(e).remove();this.p.records--;this.p.reccount--;this.updatepager(!0,!1);f=!0;this.p.multiselect&&(d=b.inArray(g,this.p.selarrrow),-1!==d&&this.p.selarrrow.splice(d,1));this.p.selrow=this.p.multiselect&&0<this.p.selarrrow.length?
this.p.selarrrow[this.p.selarrrow.length-1]:null;if("local"===this.p.datatype){var a=b.jgrid.stripPref(this.p.idPrefix,g),a=this.p._index[a];void 0!==a&&(this.p.data.splice(a,1),this.refreshIndex())}if(!0===this.p.altRows&&f){var c=this.p.altclass;b(this.rows).each(function(a){1===a%2?b(this).addClass(c):b(this).removeClass(c)})}});return f},setRowData:function(g,f,e){var d,k=!0,a;this.each(function(){if(!this.grid)return!1;var c=this,h,l,n=typeof e,m={};l=b(this).jqGrid("getGridRowById",g);if(!l)return!1;
if(f)try{if(b(this.p.colModel).each(function(e){d=this.name;var k=b.jgrid.getAccessor(f,d);void 0!==k&&(m[d]=this.formatter&&"string"===typeof this.formatter&&"date"===this.formatter?b.unformat.date.call(c,k,this):k,h=c.formatter(g,m[d],e,f,"edit"),a=this.title?{title:b.jgrid.stripHtml(h)}:{},!0===c.p.treeGrid&&d===c.p.ExpandColumn?b("td[role='gridcell']:eq("+e+") > span:first",l).html(h).attr(a):b("td[role='gridcell']:eq("+e+")",l).html(h).attr(a))}),"local"===c.p.datatype){var q=b.jgrid.stripPref(c.p.idPrefix,
g),p=c.p._index[q],r;if(c.p.treeGrid)for(r in c.p.treeReader)c.p.treeReader.hasOwnProperty(r)&&delete m[c.p.treeReader[r]];void 0!==p&&(c.p.data[p]=b.extend(!0,c.p.data[p],m));m=null}}catch(B){k=!1}k&&("string"===n?b(l).addClass(e):null!==e&&"object"===n&&b(l).css(e),b(c).triggerHandler("jqGridAfterGridComplete"))});return k},addRowData:function(g,f,e,d){-1==["first","last","before","after"].indexOf(e)&&(e="last");var k=!1,a,c,h,l,n,m,q,p,r="",B,F,T,K,Z,U;f&&(b.isArray(f)?(B=!0,F=g):(f=[f],B=!1),
this.each(function(){var V=f.length;n=!0===this.p.rownumbers?1:0;h=!0===this.p.multiselect?1:0;l=!0===this.p.subGrid?1:0;B||(void 0!==g?g=String(g):(g=b.jgrid.randId(),!1!==this.p.keyName&&(F=this.p.keyName,void 0!==f[0][F]&&(g=f[0][F]))));T=this.p.altclass;for(var S=0,O="",P={},aa=b.isFunction(this.p.afterInsertRow)?!0:!1;S<V;){K=f[S];c=[];if(B){try{g=K[F],void 0===g&&(g=b.jgrid.randId())}catch(ba){g=b.jgrid.randId()}O=!0===this.p.altRows?0===(this.rows.length-1)%2?T:"":""}U=g;g=this.p.idPrefix+
g;n&&(r=this.formatCol(0,1,"",null,g,!0),c[c.length]='<td role="gridcell" class="ui-state-default jqgrid-rownum" '+r+">0</td>");h&&(p='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+g+'" class="cbox"/>',r=this.formatCol(n,1,"",null,g,!0),c[c.length]='<td role="gridcell" '+r+">"+p+"</td>");l&&(c[c.length]=b(this).jqGrid("addSubGridCell",h+n,1));for(q=h+l+n;q<this.p.colModel.length;q++)Z=this.p.colModel[q],a=Z.name,P[a]=K[a],p=this.formatter(g,b.jgrid.getAccessor(K,a),q,K),r=this.formatCol(q,
1,p,K,g,P),c[c.length]='<td role="gridcell" '+r+">"+p+"</td>";c.unshift(this.constructTr(g,!1,O,P,K,!1));c[c.length]="</tr>";if(0===this.rows.length)b("table:first",this.grid.bDiv).append(c.join(""));else switch(e){case "last":b(this.rows[this.rows.length-1]).after(c.join(""));m=this.rows.length-1;break;case "first":b(this.rows[0]).after(c.join(""));m=1;break;case "after":if(m=b(this).jqGrid("getGridRowById",d))b(this.rows[m.rowIndex+1]).hasClass("ui-subgrid")?b(this.rows[m.rowIndex+1]).after(c):
b(m).after(c.join("")),m=m.rowIndex+1;break;case "before":if(m=b(this).jqGrid("getGridRowById",d))b(m).before(c.join("")),m=m.rowIndex-1}!0===this.p.subGrid&&b(this).jqGrid("addSubGrid",h+n,m);this.p.records++;this.p.reccount++;b(this).triggerHandler("jqGridAfterInsertRow",[g,K,K]);aa&&this.p.afterInsertRow.call(this,g,K,K);S++;"local"===this.p.datatype&&(P[this.p.localReader.id]=U,this.p._index[U]=this.p.data.length,this.p.data.push(P),P={})}!0!==this.p.altRows||B||("last"===e?1===(this.rows.length-
1)%2&&b(this.rows[this.rows.length-1]).addClass(T):b(this.rows).each(function(a){1===a%2?b(this).addClass(T):b(this).removeClass(T)}));this.updatepager(!0,!0);k=!0}));return k},footerData:function(g,f,e){function d(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var k,a=!1,c={},h;void 0==g&&(g="get");"boolean"!==typeof e&&(e=!0);g=g.toLowerCase();this.each(function(){var l=this,n;if(!l.grid||!l.p.footerrow||"set"===g&&d(f))return!1;a=!0;b(this.p.colModel).each(function(d){k=this.name;"set"===
g?void 0!==f[k]&&(n=e?l.formatter("",f[k],d,f,"edit"):f[k],h=this.title?{title:b.jgrid.stripHtml(n)}:{},b("tr.footrow td:eq("+d+")",l.grid.sDiv).html(n).attr(h),a=!0):"get"===g&&(c[k]=b("tr.footrow td:eq("+d+")",l.grid.sDiv).html())})});return"get"===g?c:a},showHideCol:function(g,f){return this.each(function(){var e=this,d=!1,k=b.jgrid.cell_width?0:e.p.cellLayout,a;if(e.grid){"string"===typeof g&&(g=[g]);f="none"!==f?"":"none";var c=""===f?!0:!1,h=e.p.groupHeader&&("object"===typeof e.p.groupHeader||
b.isFunction(e.p.groupHeader));h&&b(e).jqGrid("destroyGroupHeader",!1);b(this.p.colModel).each(function(h){if(-1!==b.inArray(this.name,g)&&this.hidden===c){if(!0===e.p.frozenColumns&&!0===this.frozen)return!0;b("tr[role=row]",e.grid.hDiv).each(function(){b(this.cells[h]).css("display",f)});b(e.rows).each(function(){b(this).hasClass("jqgroup")||b(this.cells[h]).css("display",f)});e.p.footerrow&&b("tr.footrow td:eq("+h+")",e.grid.sDiv).css("display",f);a=parseInt(this.width,10);e.p.tblwidth="none"===
f?e.p.tblwidth-(a+k):e.p.tblwidth+(a+k);this.hidden=!c;d=!0;b(e).triggerHandler("jqGridShowHideCol",[c,this.name,h])}});!0===d&&(!0!==e.p.shrinkToFit||isNaN(e.p.height)||(e.p.tblwidth+=parseInt(e.p.scrollOffset,10)),b(e).jqGrid("setGridWidth",!0===e.p.shrinkToFit?e.p.tblwidth:e.p.width));h&&b(e).jqGrid("setGroupHeaders",e.p.groupHeader)}})},hideCol:function(g){return this.each(function(){b(this).jqGrid("showHideCol",g,"none")})},showCol:function(g){return this.each(function(){b(this).jqGrid("showHideCol",
g,"")})},remapColumns:function(g,f,e){function d(a){var d;d=a.length?b.makeArray(a):b.extend({},a);b.each(g,function(b){a[b]=d[this]})}function k(a,d){b(">tr"+(d||""),a).each(function(){var a=this,c=b.makeArray(a.cells);b.each(g,function(){var b=c[this];b&&a.appendChild(b)})})}var a=this.get(0);d(a.p.colModel);d(a.p.colNames);d(a.grid.headers);k(b("thead:first",a.grid.hDiv),e&&":not(.ui-jqgrid-labels)");f&&k(b("#"+b.jgrid.jqID(a.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");a.p.footerrow&&
k(b("tbody:first",a.grid.sDiv));a.p.remapColumns&&(a.p.remapColumns.length?d(a.p.remapColumns):a.p.remapColumns=b.makeArray(g));a.p.lastsort=b.inArray(a.p.lastsort,g);a.p.treeGrid&&(a.p.expColInd=b.inArray(a.p.expColInd,g));b(a).triggerHandler("jqGridRemapColumns",[g,f,e])},setGridWidth:function(g,f){return this.each(function(){if(this.grid){var e=this,d,k=0,a=b.jgrid.cell_width?0:e.p.cellLayout,c,h=0,l=!1,n=e.p.scrollOffset,m,q=0,p;"boolean"!==typeof f&&(f=e.p.shrinkToFit);if(!isNaN(g)){g=parseInt(g,
10);e.grid.width=e.p.width=g;b("#gbox_"+b.jgrid.jqID(e.p.id)).css("width",g+"px");b("#gview_"+b.jgrid.jqID(e.p.id)).css("width",g+"px");b(e.grid.bDiv).css("width",g+"px");b(e.grid.hDiv).css("width",g+"px");e.p.pager&&b(e.p.pager).css("width",g+"px");e.p.toppager&&b(e.p.toppager).css("width",g+"px");!0===e.p.toolbar[0]&&(b(e.grid.uDiv).css("width",g+"px"),"both"===e.p.toolbar[1]&&b(e.grid.ubDiv).css("width",g+"px"));e.p.footerrow&&b(e.grid.sDiv).css("width",g+"px");!1===f&&!0===e.p.forceFit&&(e.p.forceFit=
!1);if(!0===f){b.each(e.p.colModel,function(){!1===this.hidden&&(d=this.widthOrg,k+=d+a,this.fixed?q+=d+a:h++)});if(0===h)return;e.p.tblwidth=k;m=g-a*h-q;!isNaN(e.p.height)&&(b(e.grid.bDiv)[0].clientHeight<b(e.grid.bDiv)[0].scrollHeight||1===e.rows.length)&&(l=!0,m-=n);var k=0,r=0<e.grid.cols.length;b.each(e.p.colModel,function(b){!1!==this.hidden||this.fixed||(d=this.widthOrg,d=Math.round(m*d/(e.p.tblwidth-a*h-q)),0>d||(this.width=d,k+=d,e.grid.headers[b].width=d,e.grid.headers[b].el.style.width=
d+"px",e.p.footerrow&&(e.grid.footers[b].style.width=d+"px"),r&&(e.grid.cols[b].style.width=d+"px"),c=b))});if(!c)return;p=0;l?g-q-(k+a*h)!==n&&(p=g-q-(k+a*h)-n):1!==Math.abs(g-q-(k+a*h))&&(p=g-q-(k+a*h));e.p.colModel[c].width+=p;e.p.tblwidth=k+p+a*h+q;e.p.tblwidth>g?(l=e.p.tblwidth-parseInt(g,10),e.p.tblwidth=g,d=e.p.colModel[c].width-=l):d=e.p.colModel[c].width;e.grid.headers[c].width=d;e.grid.headers[c].el.style.width=d+"px";r&&(e.grid.cols[c].style.width=d+"px");e.p.footerrow&&(e.grid.footers[c].style.width=
d+"px")}e.p.tblwidth&&(b("table:first",e.grid.bDiv).css("width",e.p.tblwidth+"px"),b("table:first",e.grid.hDiv).css("width",e.p.tblwidth+"px"),e.grid.hDiv.scrollLeft=e.grid.bDiv.scrollLeft,e.p.footerrow&&b("table:first",e.grid.sDiv).css("width",e.p.tblwidth+"px"))}}})},setGridHeight:function(g){return this.each(function(){if(this.grid){var f=b(this.grid.bDiv);f.css({height:g+(isNaN(g)?"":"px")});!0===this.p.frozenColumns&&b("#"+b.jgrid.jqID(this.p.id)+"_frozen").parent().height(f.height()-16);this.p.height=
g;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(g){return this.each(function(){this.p.caption=g;b("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl",this.grid.cDiv).html(g);b(this.grid.cDiv).show();b(this.grid.hDiv).removeClass("ui-corner-top")})},setLabel:function(g,f,e,d){return this.each(function(){var k=-1;if(this.grid&&void 0!==g&&(b(this.p.colModel).each(function(a){if(this.name===g)return k=a,!1}),0<=k)){var a=b("tr.ui-jqgrid-labels th:eq("+k+")",this.grid.hDiv);if(f){var c=
b(".s-ico",a);b("[id^=jqgh_]",a).empty().html(f).append(c);this.p.colNames[k]=f}e&&("string"===typeof e?b(a).addClass(e):b(a).css(e));"object"===typeof d&&b(a).attr(d)}})},setCell:function(g,f,e,d,k,a){return this.each(function(){var c=-1,h,l;if(this.grid&&(isNaN(f)?b(this.p.colModel).each(function(a){if(this.name===f)return c=a,!1}):c=parseInt(f,10),0<=c&&(h=b(this).jqGrid("getGridRowById",g)))){var n=b("td:eq("+c+")",h);l=0;var m=[];if(""!==e||!0===a){for(;l<h.cells.length;)m.push(h.cells[l].innerHTML),
l++;h=this.formatter(g,e,c,m,"edit");l=this.p.colModel[c].title?{title:b.jgrid.stripHtml(h)}:{};this.p.treeGrid&&0<b(".tree-wrap",b(n)).length?b("span",b(n)).html(h).attr(l):b(n).html(h).attr(l);"local"===this.p.datatype&&(h=this.p.colModel[c],e=h.formatter&&"string"===typeof h.formatter&&"date"===h.formatter?b.unformat.date.call(this,e,h):e,l=this.p._index[b.jgrid.stripPref(this.p.idPrefix,g)],void 0!==l&&(this.p.data[l][h.name]=e))}"string"===typeof d?b(n).addClass(d):d&&b(n).css(d);"object"===
typeof k&&b(n).attr(k)}})},getCell:function(g,f){var e=!1;this.each(function(){var d=-1;if(this.grid&&(isNaN(f)?b(this.p.colModel).each(function(a){if(this.name===f)return d=a,!1}):d=parseInt(f,10),0<=d)){var k=b(this).jqGrid("getGridRowById",g);if(k)try{e=b.unformat.call(this,b("td:eq("+d+")",k),{rowId:k.id,colModel:this.p.colModel[d]},d)}catch(a){e=b.jgrid.htmlDecode(b("td:eq("+d+")",k).html())}}});return e},getCol:function(g,f,e){var d=[],k,a=0,c,h,l;f="boolean"!==typeof f?!1:f;void 0===e&&(e=
!1);this.each(function(){var n=-1;if(this.grid&&(isNaN(g)?b(this.p.colModel).each(function(a){if(this.name===g)return n=a,!1}):n=parseInt(g,10),0<=n)){var m=this.rows.length,q=0,p=0;if(m&&0<m){for(;q<m;){if(b(this.rows[q]).hasClass("jqgrow")){try{k=b.unformat.call(this,b(this.rows[q].cells[n]),{rowId:this.rows[q].id,colModel:this.p.colModel[n]},n)}catch(r){k=b.jgrid.htmlDecode(this.rows[q].cells[n].innerHTML)}e?(l=parseFloat(k),isNaN(l)||(a+=l,void 0===h&&(h=c=l),c=Math.min(c,l),h=Math.max(h,l),p++)):
f?d.push({id:this.rows[q].id,value:k}):d.push(k)}q++}if(e)switch(e.toLowerCase()){case "sum":d=a;break;case "avg":d=a/p;break;case "count":d=m-1;break;case "min":d=c;break;case "max":d=h}}}});return d},clearGridData:function(g){return this.each(function(){if(this.grid){"boolean"!==typeof g&&(g=!1);if(this.p.deepempty)b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var f=b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(this.p.id)+" tbody:first").empty().append(f)}this.p.footerrow&&
g&&b(".ui-jqgrid-ftable td",this.grid.sDiv).html("&#160;");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p._index={};this.updatepager(!0,!1)}})},getInd:function(g,f){var e=!1,d;this.each(function(){(d=b(this).jqGrid("getGridRowById",g))&&(e=!0===f?d:d.rowIndex)});return e},bindKeys:function(g){var f=b.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:!0},g||{});return this.each(function(){var e=
this;b("body").is("[role]")||b("body").attr("role","application");e.p.scrollrows=f.scrollingRows;b(e).keydown(function(d){var g=b(e).find("tr[tabindex=0]")[0],a,c,h,l=e.p.treeReader.expanded_field;if(g)if(h=e.p._index[b.jgrid.stripPref(e.p.idPrefix,g.id)],37===d.keyCode||38===d.keyCode||39===d.keyCode||40===d.keyCode){if(38===d.keyCode){c=g.previousSibling;a="";if(c)if(b(c).is(":hidden"))for(;c;){if(c=c.previousSibling,!b(c).is(":hidden")&&b(c).hasClass("jqgrow")){a=c.id;break}}else a=c.id;b(e).jqGrid("setSelection",
a,!0,d);d.preventDefault()}if(40===d.keyCode){c=g.nextSibling;a="";if(c)if(b(c).is(":hidden"))for(;c;){if(c=c.nextSibling,!b(c).is(":hidden")&&b(c).hasClass("jqgrow")){a=c.id;break}}else a=c.id;b(e).jqGrid("setSelection",a,!0,d);d.preventDefault()}37===d.keyCode&&(e.p.treeGrid&&e.p.data[h][l]&&b(g).find("div.treeclick").trigger("click"),b(e).triggerHandler("jqGridKeyLeft",[e.p.selrow]),b.isFunction(f.onLeftKey)&&f.onLeftKey.call(e,e.p.selrow));39===d.keyCode&&(e.p.treeGrid&&!e.p.data[h][l]&&b(g).find("div.treeclick").trigger("click"),
b(e).triggerHandler("jqGridKeyRight",[e.p.selrow]),b.isFunction(f.onRightKey)&&f.onRightKey.call(e,e.p.selrow))}else 13===d.keyCode?(b(e).triggerHandler("jqGridKeyEnter",[e.p.selrow]),b.isFunction(f.onEnter)&&f.onEnter.call(e,e.p.selrow)):32===d.keyCode&&(b(e).triggerHandler("jqGridKeySpace",[e.p.selrow]),b.isFunction(f.onSpace)&&f.onSpace.call(e,e.p.selrow))})})},unbindKeys:function(){return this.each(function(){b(this).unbind("keydown")})},getLocalRow:function(g){var f=!1,e;this.each(function(){void 0!==
g&&(e=this.p._index[b.jgrid.stripPref(this.p.idPrefix,g)],0<=e&&(f=this.p.data[e]))});return f},progressBar:function(g){g=b.extend({htmlcontent:"",method:"hide",loadtype:"disable"},g||{});return this.each(function(){var f="show"===g.method?!0:!1;""!==g.htmlcontent&&b("#load_"+b.jgrid.jqID(this.p.id)).html(g.htmlcontent);switch(g.loadtype){case "enable":b("#load_"+b.jgrid.jqID(this.p.id)).toggle(f);break;case "block":b("#lui_"+b.jgrid.jqID(this.p.id)).toggle(f),b("#load_"+b.jgrid.jqID(this.p.id)).toggle(f)}})}})})(jQuery);
(function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(a){return"boolean"===typeof a},isObject:function(c){return c&&("object"===typeof c||a.isFunction(c))||!1},isString:function(a){return"string"===typeof a},isNumber:function(a){return"number"===typeof a&&isFinite(a)},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(c){if(!this.isString(c)&&this.isValue(c))return!1;if(!this.isValue(c))return!0;c=a.trim(c).replace(/\&nbsp\;/ig,
"").replace(/\&#160\;/ig,"");return""===c}});a.fn.fmatter=function(c,b,d,e,f){var g=b;d=a.extend({},a.jgrid.formatter,d);try{g=a.fn.fmatter[c].call(this,b,d,e,f)}catch(h){}return g};a.fmatter.util={NumberFormat:function(c,b){a.fmatter.isNumber(c)||(c*=1);if(a.fmatter.isNumber(c)){var d=0>c,e=String(c),f=b.decimalSeparator||".",g;if(a.fmatter.isNumber(b.decimalPlaces)){var h=b.decimalPlaces,e=Math.pow(10,h),e=String(Math.round(c*e)/e);g=e.lastIndexOf(".");if(0<h)for(0>g?(e+=f,g=e.length-1):"."!==f&&
(e=e.replace(".",f));e.length-1-g<h;)e+="0"}if(b.thousandsSeparator){h=b.thousandsSeparator;g=e.lastIndexOf(f);g=-1<g?g:e.length;var f=e.substring(g),l=-1,k;for(k=g;0<k;k--)l++,0===l%3&&k!==g&&(!d||1<k)&&(f=h+f),f=e.charAt(k-1)+f;e=f}e=b.prefix?b.prefix+e:e;return e=b.suffix?e+b.suffix:e}return c}};a.fn.fmatter.defaultFormat=function(c,b){return a.fmatter.isValue(c)&&""!==c?c:b.defaultValue||"&#160;"};a.fn.fmatter.email=function(c,b){return a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):'<a href="mailto:'+
c+'">'+c+"</a>"};a.fn.fmatter.checkbox=function(c,b){var d=a.extend({},b.checkbox),e;void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));e=!0===d.disabled?'disabled="disabled"':"";if(a.fmatter.isEmpty(c)||void 0===c)c=a.fn.fmatter.defaultFormat(c,d);c=String(c);c=(c+"").toLowerCase();return'<input type="checkbox" '+(0>c.search(/(false|f|0|no|n|off|undefined)/i)?" checked='checked' ":"")+' value="'+c+'" offval="no" '+e+"/>"};a.fn.fmatter.link=function(c,
b){var d={target:b.target},e="";void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));d.target&&(e="target="+d.target);return a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):"<a "+e+' href="'+c+'">'+c+"</a>"};a.fn.fmatter.showlink=function(c,b){var d={baseLinkUrl:b.baseLinkUrl,showAction:b.showAction,addParam:b.addParam||"",target:b.target,idName:b.idName},e="";void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));
d.target&&(e="target="+d.target);d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+b.rowId+d.addParam;return a.fmatter.isString(c)||a.fmatter.isNumber(c)?"<a "+e+' href="'+d+'">'+c+"</a>":a.fn.fmatter.defaultFormat(c,b)};a.fn.fmatter.integer=function(c,b){var d=a.extend({},b.integer);void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return a.fmatter.isEmpty(c)?d.defaultValue:a.fmatter.util.NumberFormat(c,d)};a.fn.fmatter.number=function(c,b){var d=a.extend({},
b.number);void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return a.fmatter.isEmpty(c)?d.defaultValue:a.fmatter.util.NumberFormat(c,d)};a.fn.fmatter.currency=function(c,b){var d=a.extend({},b.currency);void 0!==b.colModel&&void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return a.fmatter.isEmpty(c)?d.defaultValue:a.fmatter.util.NumberFormat(c,d)};a.fn.fmatter.date=function(c,b,d,e){d=a.extend({},b.date);void 0!==b.colModel&&
void 0!==b.colModel.formatoptions&&(d=a.extend({},d,b.colModel.formatoptions));return d.reformatAfterEdit||"edit"!==e?a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):a.jgrid.parseDate(d.srcformat,c,d.newformat,d):a.fn.fmatter.defaultFormat(c,b)};a.fn.fmatter.select=function(c,b){c=String(c);var d=!1,e=[],f,g;void 0!==b.colModel.formatoptions?(d=b.colModel.formatoptions.value,f=void 0===b.colModel.formatoptions.separator?":":b.colModel.formatoptions.separator,g=void 0===b.colModel.formatoptions.delimiter?
";":b.colModel.formatoptions.delimiter):void 0!==b.colModel.editoptions&&(d=b.colModel.editoptions.value,f=void 0===b.colModel.editoptions.separator?":":b.colModel.editoptions.separator,g=void 0===b.colModel.editoptions.delimiter?";":b.colModel.editoptions.delimiter);if(d){var h=!0===(null!=b.colModel.editoptions&&!0===b.colModel.editoptions.multiple)?!0:!1,l=[];h&&(l=c.split(","),l=a.map(l,function(b){return a.trim(b)}));if(a.fmatter.isString(d)){var k=d.split(g),m=0,n;for(n=0;n<k.length;n++)if(g=
k[n].split(f),2<g.length&&(g[1]=a.map(g,function(a,b){if(0<b)return a}).join(f)),h)-1<a.inArray(g[0],l)&&(e[m]=g[1],m++);else if(a.trim(g[0])===a.trim(c)){e[0]=g[1];break}}else a.fmatter.isObject(d)&&(h?e=a.map(l,function(a){return d[a]}):e[0]=d[c]||"")}c=e.join(", ");return""===c?a.fn.fmatter.defaultFormat(c,b):c};a.fn.fmatter.rowactions=function(c){var b=a(this).closest("tr.jqgrow"),d=b.attr("id"),e=a(this).closest("table.ui-jqgrid-btable").attr("id").replace(/_frozen([^_]*)$/,"$1"),e=a("#"+e),
f=e[0],g=f.p,h=g.colModel[a.jgrid.getCellIndex(this)],l=h.frozen?a("tr#"+d+" td:eq("+a.jgrid.getCellIndex(this)+") > div",e):a(this).parent(),k={extraparam:{}},m=function(b){a.isFunction(k.afterRestore)&&k.afterRestore.call(f,b);l.find("div.ui-inline-edit,div.ui-inline-del").show();l.find("div.ui-inline-save,div.ui-inline-cancel").hide()};void 0!==h.formatoptions&&(k=a.extend(k,h.formatoptions));void 0!==g.editOptions&&(k.editOptions=g.editOptions);void 0!==g.delOptions&&(k.delOptions=g.delOptions);
b.hasClass("jqgrid-new-row")&&(k.extraparam[g.prmNames.oper]=g.prmNames.addoper);b={keys:k.keys,oneditfunc:k.onEdit,successfunc:k.onSuccess,url:k.url,extraparam:k.extraparam,aftersavefunc:function(b,c){a.isFunction(k.afterSave)&&k.afterSave.call(f,b,c);l.find("div.ui-inline-edit,div.ui-inline-del").show();l.find("div.ui-inline-save,div.ui-inline-cancel").hide()},errorfunc:k.onError,afterrestorefunc:m,restoreAfterError:k.restoreAfterError,mtype:k.mtype};switch(c){case "edit":e.jqGrid("editRow",d,b);
l.find("div.ui-inline-edit,div.ui-inline-del").hide();l.find("div.ui-inline-save,div.ui-inline-cancel").show();e.triggerHandler("jqGridAfterGridComplete");break;case "save":e.jqGrid("saveRow",d,b)&&(l.find("div.ui-inline-edit,div.ui-inline-del").show(),l.find("div.ui-inline-save,div.ui-inline-cancel").hide(),e.triggerHandler("jqGridAfterGridComplete"));break;case "cancel":e.jqGrid("restoreRow",d,m);l.find("div.ui-inline-edit,div.ui-inline-del").show();l.find("div.ui-inline-save,div.ui-inline-cancel").hide();
e.triggerHandler("jqGridAfterGridComplete");break;case "del":e.jqGrid("delGridRow",d,k.delOptions);break;case "formedit":e.jqGrid("setSelection",d),e.jqGrid("editGridRow",d,k.editOptions)}};a.fn.fmatter.actions=function(c,b){var d={keys:!1,editbutton:!0,delbutton:!0,editformbutton:!1},e=b.rowId,f="";void 0!==b.colModel.formatoptions&&(d=a.extend(d,b.colModel.formatoptions));if(void 0===e||a.fmatter.isEmpty(e))return"";d.editformbutton?f+="<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+
("id='jEditButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'formedit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-pencil'></span></div>":d.editbutton&&(f+="<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+("id='jEditButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'edit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ")+
"><span class='ui-icon ui-icon-pencil'></span></div>");d.delbutton&&(f+="<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+("id='jDeleteButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'del'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-trash'></span></div>");f+="<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+
("id='jSaveButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'save'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-disk'></span></div>";f+="<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+("id='jCancelButton_"+e+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'cancel'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+
"><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+f+"</div>"};a.unformat=function(c,b,d,e){var f,g=b.colModel.formatter,h=b.colModel.formatoptions||{},l=/([\.\*\_\'\(\)\{\}\+\?\\])/g,k=b.colModel.unformat||a.fn.fmatter[g]&&a.fn.fmatter[g].unformat;if(void 0!==k&&a.isFunction(k))f=k.call(this,a(c).text(),b,c);else if(void 0!==g&&a.fmatter.isString(g))switch(f=a.jgrid.formatter||{},g){case "integer":h=a.extend({},f.integer,h);b=h.thousandsSeparator.replace(l,
"\\$1");b=RegExp(b,"g");f=a(c).text().replace(b,"");break;case "number":h=a.extend({},f.number,h);b=h.thousandsSeparator.replace(l,"\\$1");b=RegExp(b,"g");f=a(c).text().replace(b,"").replace(h.decimalSeparator,".");break;case "currency":h=a.extend({},f.currency,h);b=h.thousandsSeparator.replace(l,"\\$1");b=RegExp(b,"g");f=a(c).text();h.prefix&&h.prefix.length&&(f=f.substr(h.prefix.length));h.suffix&&h.suffix.length&&(f=f.substr(0,f.length-h.suffix.length));f=f.replace(b,"").replace(h.decimalSeparator,
".");break;case "checkbox":h=b.colModel.editoptions?b.colModel.editoptions.value.split(":"):["Yes","No"];f=a("input",c).is(":checked")?h[0]:h[1];break;case "select":f=a.unformat.select(c,b,d,e);break;case "actions":return"";default:f=a(c).text()}return void 0!==f?f:!0===e?a(c).text():a.jgrid.htmlDecode(a(c).html())};a.unformat.select=function(c,b,d,e){d=[];c=a(c).text();if(!0===e)return c;e=a.extend({},void 0!==b.colModel.formatoptions?b.colModel.formatoptions:b.colModel.editoptions);b=void 0===e.separator?
":":e.separator;var f=void 0===e.delimiter?";":e.delimiter;if(e.value){var g=e.value;e=!0===e.multiple?!0:!1;var h=[];e&&(h=c.split(","),h=a.map(h,function(b){return a.trim(b)}));if(a.fmatter.isString(g)){var l=g.split(f),k=0,m;for(m=0;m<l.length;m++)if(f=l[m].split(b),2<f.length&&(f[1]=a.map(f,function(a,b){if(0<b)return a}).join(b)),e)-1<a.inArray(f[1],h)&&(d[k]=f[0],k++);else if(a.trim(f[1])===a.trim(c)){d[0]=f[0];break}}else if(a.fmatter.isObject(g)||a.isArray(g))e||(h[0]=c),d=a.map(h,function(b){var c;
a.each(g,function(a,d){if(d===b)return c=a,!1});if(void 0!==c)return c});return d.join(", ")}return c||""};a.unformat.date=function(c,b){var d=a.jgrid.formatter.date||{};void 0!==b.formatoptions&&(d=a.extend({},d,b.formatoptions));return a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,b):a.jgrid.parseDate(d.newformat,c,d.srcformat,d)}})(jQuery);
(function(a){a.jgrid.extend({getColProp:function(a){var c={},e=this[0];if(!e.grid)return!1;var e=e.p.colModel,k;for(k=0;k<e.length;k++)if(e[k].name===a){c=e[k];break}return c},setColProp:function(b,c){return this.each(function(){if(this.grid&&c){var e=this.p.colModel,k;for(k=0;k<e.length;k++)if(e[k].name===b){a.extend(!0,this.p.colModel[k],c);break}}})},sortGrid:function(a,c,e){return this.each(function(){var k=-1,d,h=!1;if(this.grid){a||(a=this.p.sortname);for(d=0;d<this.p.colModel.length;d++)if(this.p.colModel[d].index===
a||this.p.colModel[d].name===a){k=d;!0===this.p.frozenColumns&&!0===this.p.colModel[d].frozen&&(h=this.grid.fhDiv.find("#"+this.p.id+"_"+a));break}-1!==k&&(d=this.p.colModel[k].sortable,h||(h=this.grid.headers[k].el),"boolean"!==typeof d&&(d=!0),"boolean"!==typeof c&&(c=!1),d&&this.sortData("jqgh_"+this.p.id+"_"+a,k,c,e,h))}})},clearBeforeUnload:function(){return this.each(function(){var b=this.grid;a.isFunction(b.emptyRows)&&b.emptyRows.call(this,!0,!0);a(document).unbind("mouseup.jqGrid"+this.p.id);
a(b.hDiv).unbind("mousemove");a(this).unbind();b.dragEnd=null;b.dragMove=null;b.dragStart=null;b.emptyRows=null;b.populate=null;b.populateVisible=null;b.scrollGrid=null;b.selectionPreserver=null;b.bDiv=null;b.cDiv=null;b.hDiv=null;b.cols=null;var c,e=b.headers.length;for(c=0;c<e;c++)b.headers[c].el=null;this.grid=this.addJSONData=this.addXmlData=this.formatter=this.constructTr=this.setHeadCheckBox=this.refreshIndex=this.updatepager=this.sortData=this.formatCol=null})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&
a(this.p.pager).remove();try{a(this).jqGrid("clearBeforeUnload"),a("#gbox_"+a.jgrid.jqID(this.id)).remove(),a("#alertmod_"+a.jgrid.jqID(this.id)).remove()}catch(b){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var b=a(this).attr("id"),c=a(this).attr("class");this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");var e=document.createElement("table");a(e).attr({id:b});e.className=c;b=a.jgrid.jqID(this.id);a(e).removeClass("ui-jqgrid-btable");
1===a(this.p.pager).parents("#gbox_"+b).length?(a(e).insertBefore("#gbox_"+b).show(),a(this.p.pager).insertBefore("#gbox_"+b)):a(e).insertBefore("#gbox_"+b).show();a(this).jqGrid("clearBeforeUnload");a("#gbox_"+b).remove()}})},setGridState:function(b){return this.each(function(){this.grid&&("hidden"===b?(a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+a.jgrid.jqID(this.p.id)).slideUp("fast"),this.p.pager&&a(this.p.pager).slideUp("fast"),this.p.toppager&&a(this.p.toppager).slideUp("fast"),!0===this.p.toolbar[0]&&
("both"===this.p.toolbar[1]&&a(this.grid.ubDiv).slideUp("fast"),a(this.grid.uDiv).slideUp("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+a.jgrid.jqID(this.p.id)).slideUp("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),this.p.gridstate="hidden"):"visible"===b&&(a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+a.jgrid.jqID(this.p.id)).slideDown("fast"),this.p.pager&&a(this.p.pager).slideDown("fast"),this.p.toppager&&
a(this.p.toppager).slideDown("fast"),!0===this.p.toolbar[0]&&("both"===this.p.toolbar[1]&&a(this.grid.ubDiv).slideDown("fast"),a(this.grid.uDiv).slideDown("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+a.jgrid.jqID(this.p.id)).slideDown("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),this.p.gridstate="visible"))})},filterToolbar:function(b){b=a.extend({autosearch:!0,autosearchDelay:500,searchOnEnter:!0,
beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw",searchOperators:!1,resetIcon:"x",operands:{eq:"==",ne:"!",lt:"<",le:"<=",gt:">",ge:">=",bw:"^",bn:"!^","in":"=",ni:"!=",ew:"|",en:"!@",cn:"~",nc:"!~",nu:"#",nn:"!#"}},a.jgrid.search,b||{});return this.each(function(){var c=this;if(!this.ftoolbar){var e=function(){var e={},f=0,g,m,k={},q;a.each(c.p.colModel,function(){var d=a("#gs_"+a.jgrid.jqID(this.name),!0===this.frozen&&
!0===c.p.frozenColumns?c.grid.fhDiv:c.grid.hDiv);m=this.index||this.name;q=b.searchOperators?d.parent().prev().children("a").attr("soper")||b.defaultSearch:this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"select"===this.stype?"eq":b.defaultSearch;if((g="custom"===this.stype&&a.isFunction(this.searchoptions.custom_value)&&0<d.length&&"SPAN"===d[0].nodeName.toUpperCase()?this.searchoptions.custom_value.call(c,d.children(".customelement:first"),"get"):d.val())||"nu"===q||"nn"===
q)e[m]=g,k[m]=q,f++;else try{delete c.p.postData[m]}catch(h){}});var h=0<f?!0:!1;if(!0===b.stringResult||"local"===c.p.datatype||!0===b.searchOperators){var l='{"groupOp":"'+b.groupOp+'","rules":[',d=0;a.each(e,function(a,b){0<d&&(l+=",");l+='{"field":"'+a+'",';l+='"op":"'+k[a]+'",';l+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';d++});l+="]}";a.extend(c.p.postData,{filters:l});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,
e);var r;c.p.searchurl&&(r=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl}));var v="stop"===a(c).triggerHandler("jqGridToolbarBeforeSearch")?!0:!1;!v&&a.isFunction(b.beforeSearch)&&(v=b.beforeSearch.call(c));v||a(c).jqGrid("setGridParam",{search:h}).trigger("reloadGrid",[{page:1}]);r&&a(c).jqGrid("setGridParam",{url:r});a(c).triggerHandler("jqGridToolbarAfterSearch");a.isFunction(b.afterSearch)&&b.afterSearch.call(c)},k=function(d,f,g){a("#sopt_menu").remove();f=parseInt(f,10);g=parseInt(g,
10)+18;f='<ul id="sopt_menu" class="ui-search-menu" role="menu" tabindex="0" style="font-size:'+(a(".ui-jqgrid-view").css("font-size")||"11px")+";left:"+f+"px;top:"+g+'px;">';g=a(d).attr("soper");var k,h=[],q,n=0,l=a(d).attr("colname");for(k=c.p.colModel.length;n<k&&c.p.colModel[n].name!==l;)n++;n=c.p.colModel[n];l=a.extend({},n.searchoptions);l.sopt||(l.sopt=[],l.sopt[0]="select"===n.stype?"eq":b.defaultSearch);a.each(b.odata,function(){h.push(this.oper)});for(n=0;n<l.sopt.length;n++)q=a.inArray(l.sopt[n],
h),-1!==q&&(k=g===b.odata[q].oper?"ui-state-highlight":"",f+='<li class="ui-menu-item '+k+'" role="presentation"><a class="ui-corner-all g-menu-item" tabindex="0" role="menuitem" value="'+b.odata[q].oper+'" oper="'+b.operands[b.odata[q].oper]+'"><table cellspacing="0" cellpadding="0" border="0"><tr><td width="25px">'+b.operands[b.odata[q].oper]+"</td><td>"+b.odata[q].text+"</td></tr></table></a></li>");f+="</ul>";a("body").append(f);a("#sopt_menu").addClass("ui-menu ui-widget ui-widget-content ui-corner-all");
a("#sopt_menu > li > a").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).click(function(f){f=a(this).attr("value");var g=a(this).attr("oper");a(c).triggerHandler("jqGridToolbarSelectOper",[f,g,d]);a("#sopt_menu").hide();a(d).text(g).attr("soper",f);!0===b.autosearch&&(g=a(d).parent().next().children()[0],(a(g).val()||"nu"===f||"nn"===f)&&e())})},d=a("<tr class='ui-search-toolbar' role='row'></tr>"),h;a.each(c.p.colModel,function(k){var f=this,
g,m;m="";var x="=",q,n=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+c.p.direction+"'></th>"),l=a("<div style='position:relative;height:auto;padding-right:0.3em;padding-left:0.3em;'></div>"),p=a("<table class='ui-search-table' cellspacing='0'><tr><td class='ui-search-oper'></td><td class='ui-search-input'></td><td class='ui-search-clear'></td></tr></table>");!0===this.hidden&&a(n).css("display","none");this.search=!1===this.search?!1:!0;void 0===this.stype&&(this.stype="text");
g=a.extend({},this.searchoptions||{});if(this.search){if(b.searchOperators){m=g.sopt?g.sopt[0]:"select"===f.stype?"eq":b.defaultSearch;for(q=0;q<b.odata.length;q++)if(b.odata[q].oper===m){x=b.operands[m]||"";break}m="<a title='"+(null!=g.searchtitle?g.searchtitle:b.operandTitle)+"' style='padding-right: 0.5em;' soper='"+m+"' class='soptclass' colname='"+this.name+"'>"+x+"</a>"}a("td:eq(0)",p).attr("colindex",k).append(m);void 0===g.clearSearch&&(g.clearSearch=!0);g.clearSearch?(m=b.resetTitle||"Clear Search Value",
a("td:eq(2)",p).append("<a title='"+m+"' style='padding-right: 0.3em;padding-left: 0.3em;' class='clearsearchclass'>"+b.resetIcon+"</a>")):a("td:eq(2)",p).hide();switch(this.stype){case "select":if(m=this.surl||g.dataUrl)a(l).append(p),a.ajax(a.extend({url:m,dataType:"html",success:function(d){void 0!==g.buildSelect?(d=g.buildSelect(d))&&a("td:eq(1)",p).append(d):a("td:eq(1)",p).append(d);void 0!==g.defaultValue&&a("select",l).val(g.defaultValue);a("select",l).attr({name:f.index||f.name,id:"gs_"+
f.name});g.attr&&a("select",l).attr(g.attr);a("select",l).css({width:"100%"});a.jgrid.bindEv.call(c,a("select",l)[0],g);!0===b.autosearch&&a("select",l).change(function(){e();return!1});d=null}},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));else{var r,v,u;f.searchoptions?(r=void 0===f.searchoptions.value?"":f.searchoptions.value,v=void 0===f.searchoptions.separator?":":f.searchoptions.separator,u=void 0===f.searchoptions.delimiter?";":f.searchoptions.delimiter):f.editoptions&&(r=void 0===f.editoptions.value?
"":f.editoptions.value,v=void 0===f.editoptions.separator?":":f.editoptions.separator,u=void 0===f.editoptions.delimiter?";":f.editoptions.delimiter);if(r){var t=document.createElement("select");t.style.width="100%";a(t).attr({name:f.index||f.name,id:"gs_"+f.name});var w;if("string"===typeof r)for(m=r.split(u),w=0;w<m.length;w++)r=m[w].split(v),u=document.createElement("option"),u.value=r[0],u.innerHTML=r[1],t.appendChild(u);else if("object"===typeof r)for(w in r)r.hasOwnProperty(w)&&(u=document.createElement("option"),
u.value=w,u.innerHTML=r[w],t.appendChild(u));void 0!==g.defaultValue&&a(t).val(g.defaultValue);g.attr&&a(t).attr(g.attr);a(l).append(p);a.jgrid.bindEv.call(c,t,g);a("td:eq(1)",p).append(t);!0===b.autosearch&&a(t).change(function(){e();return!1})}}break;case "text":v=void 0!==g.defaultValue?g.defaultValue:"";a("td:eq(1)",p).append("<input type='text' style='width:100%;padding:0px;' name='"+(f.index||f.name)+"' id='gs_"+f.name+"' value='"+v+"'/>");a(l).append(p);g.attr&&a("input",l).attr(g.attr);a.jgrid.bindEv.call(c,
a("input",l)[0],g);!0===b.autosearch&&(b.searchOnEnter?a("input",l).keypress(function(a){return 13===(a.charCode||a.keyCode||0)?(e(),!1):this}):a("input",l).keydown(function(a){switch(a.which){case 13:return!1;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:h&&clearTimeout(h),h=setTimeout(function(){e()},b.autosearchDelay)}}));break;case "custom":a("td:eq(1)",p).append("<span style='width:95%;padding:0px;' name='"+(f.index||f.name)+"' id='gs_"+f.name+"'/>");a(l).append(p);try{if(a.isFunction(g.custom_element))if(t=
g.custom_element.call(c,void 0!==g.defaultValue?g.defaultValue:"",g))t=a(t).addClass("customelement"),a(l).find("span[name='"+(f.index||f.name)+"']").append(t);else throw"e2";else throw"e1";}catch(y){"e1"===y&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===y?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,"string"===
typeof y?y:y.message,a.jgrid.edit.bClose)}}}a(n).append(l);a(d).append(n);b.searchOperators||a("td:eq(0)",p).hide()});a("table thead",c.grid.hDiv).append(d);b.searchOperators&&(a(".soptclass",d).click(function(b){var c=a(this).offset();k(this,c.left,c.top);b.stopPropagation()}),a("body").on("click",function(b){"soptclass"!==b.target.className&&a("#sopt_menu").hide()}));a(".clearsearchclass",d).click(function(d){d=a(this).parents("tr:first");var f=parseInt(a("td.ui-search-oper",d).attr("colindex"),
10),g=a.extend({},c.p.colModel[f].searchoptions||{}),g=g.defaultValue?g.defaultValue:"";"select"===c.p.colModel[f].stype?g?a("td.ui-search-input select",d).val(g):a("td.ui-search-input select",d)[0].selectedIndex=0:a("td.ui-search-input input",d).val(g);!0===b.autosearch&&e()});this.ftoolbar=!0;this.triggerToolbar=e;this.clearToolbar=function(d){var f={},g=0,e;d="boolean"!==typeof d?!0:d;a.each(c.p.colModel,function(){var b,d=a("#gs_"+a.jgrid.jqID(this.name),!0===this.frozen&&!0===c.p.frozenColumns?
c.grid.fhDiv:c.grid.hDiv);this.searchoptions&&void 0!==this.searchoptions.defaultValue&&(b=this.searchoptions.defaultValue);e=this.index||this.name;switch(this.stype){case "select":d.find("option").each(function(c){0===c&&(this.selected=!0);if(a(this).val()===b)return this.selected=!0,!1});if(void 0!==b)f[e]=b,g++;else try{delete c.p.postData[e]}catch(h){}break;case "text":d.val(b||"");if(void 0!==b)f[e]=b,g++;else try{delete c.p.postData[e]}catch(k){}break;case "custom":a.isFunction(this.searchoptions.custom_value)&&
0<d.length&&"SPAN"===d[0].nodeName.toUpperCase()&&this.searchoptions.custom_value.call(c,d.children(".customelement:first"),"set",b||"")}});var k=0<g?!0:!1;c.p.resetsearch=!0;if(!0===b.stringResult||"local"===c.p.datatype){var h='{"groupOp":"'+b.groupOp+'","rules":[',n=0;a.each(f,function(a,b){0<n&&(h+=",");h+='{"field":"'+a+'",';h+='"op":"eq",';h+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';n++});h+="]}";a.extend(c.p.postData,{filters:h});a.each(["searchField","searchString",
"searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,f);var l;c.p.searchurl&&(l=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl}));var p="stop"===a(c).triggerHandler("jqGridToolbarBeforeClear")?!0:!1;!p&&a.isFunction(b.beforeClear)&&(p=b.beforeClear.call(c));p||d&&a(c).jqGrid("setGridParam",{search:k}).trigger("reloadGrid",[{page:1}]);l&&a(c).jqGrid("setGridParam",{url:l});a(c).triggerHandler("jqGridToolbarAfterClear");a.isFunction(b.afterClear)&&
b.afterClear()};this.toggleToolbar=function(){var b=a("tr.ui-search-toolbar",c.grid.hDiv),d=!0===c.p.frozenColumns?a("tr.ui-search-toolbar",c.grid.fhDiv):!1;"none"===b.css("display")?(b.show(),d&&d.show()):(b.hide(),d&&d.hide())}}})},destroyFilterToolbar:function(){return this.each(function(){this.ftoolbar&&(this.toggleToolbar=this.clearToolbar=this.triggerToolbar=null,this.ftoolbar=!1,a(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove())})},destroyGroupHeader:function(b){void 0===
b&&(b=!0);return this.each(function(){var c,e,k,d,h,s;e=this.grid;var f=a("table.ui-jqgrid-htable thead",e.hDiv),g=this.p.colModel;if(e){a(this).unbind(".setGroupHeaders");c=a("<tr>",{role:"row"}).addClass("ui-jqgrid-labels");d=e.headers;e=0;for(k=d.length;e<k;e++){h=g[e].hidden?"none":"";h=a(d[e].el).width(d[e].width).css("display",h);try{h.removeAttr("rowSpan")}catch(m){h.attr("rowSpan",1)}c.append(h);s=h.children("span.ui-jqgrid-resize");0<s.length&&(s[0].style.height="");h.children("div")[0].style.top=
""}a(f).children("tr.ui-jqgrid-labels").remove();a(f).prepend(c);!0===b&&a(this).jqGrid("setGridParam",{groupHeader:null})}})},setGroupHeaders:function(b){b=a.extend({useColSpanStyle:!1,groupHeaders:[]},b||{});return this.each(function(){this.p.groupHeader=b;var c,e,k=0,d,h,s,f,g,m=this.p.colModel,x=m.length,q=this.grid.headers,n=a("table.ui-jqgrid-htable",this.grid.hDiv),l=n.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");d=n.children("thead");var p=n.find(".jqg-first-row-header");
void 0===p[0]?p=a("<tr>",{role:"row","aria-hidden":"true"}).addClass("jqg-first-row-header").css("height","auto"):p.empty();var r,v=function(a,b){var c=b.length,d;for(d=0;d<c;d++)if(b[d].startColumnName===a)return d;return-1};a(this).prepend(d);d=a("<tr>",{role:"row"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(c=0;c<x;c++)if(s=q[c].el,f=a(s),e=m[c],h={height:"0px",width:q[c].width+"px",display:e.hidden?"none":""},a("<th>",{role:"gridcell"}).css(h).addClass("ui-first-th-"+this.p.direction).appendTo(p),
s.style.width="",h=v(e.name,b.groupHeaders),0<=h){h=b.groupHeaders[h];k=h.numberOfColumns;g=h.titleText;for(h=e=0;h<k&&c+h<x;h++)m[c+h].hidden||e++;h=a("<th>").attr({role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+this.p.direction).css({height:"22px","border-top":"0 none"}).html(g);0<e&&h.attr("colspan",String(e));this.p.headertitles&&h.attr("title",h.text());0===e&&h.hide();f.before(h);d.append(s);k-=1}else 0===k?b.useColSpanStyle?f.attr("rowspan","2"):(a("<th>",{role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+
this.p.direction).css({display:e.hidden?"none":"","border-top":"0 none"}).insertBefore(f),d.append(s)):(d.append(s),k--);m=a(this).children("thead");m.prepend(p);d.insertAfter(l);n.append(m);b.useColSpanStyle&&(n.find("span.ui-jqgrid-resize").each(function(){var b=a(this).parent();b.is(":visible")&&(this.style.cssText="height: "+b.height()+"px !important; cursor: col-resize;")}),n.find("div.ui-jqgrid-sortable").each(function(){var b=a(this),c=b.parent();c.is(":visible")&&c.is(":has(span.ui-jqgrid-resize)")&&
b.css("top",(c.height()-b.outerHeight())/2+"px")}));r=m.find("tr.jqg-first-row-header");a(this).bind("jqGridResizeStop.setGroupHeaders",function(a,b,c){r.find("th").eq(c).width(b)})})},setFrozenColumns:function(){return this.each(function(){if(this.grid){var b=this,c=b.p.colModel,e=0,k=c.length,d=-1,h=!1;if(!0!==b.p.subGrid&&!0!==b.p.treeGrid&&!0!==b.p.cellEdit&&!b.p.sortable&&!b.p.scroll){b.p.rownumbers&&e++;for(b.p.multiselect&&e++;e<k;){if(!0===c[e].frozen)h=!0,d=e;else break;e++}if(0<=d&&h){c=
b.p.caption?a(b.grid.cDiv).outerHeight():0;e=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).height();b.p.toppager&&(c+=a(b.grid.topDiv).outerHeight());!0===b.p.toolbar[0]&&"bottom"!==b.p.toolbar[1]&&(c+=a(b.grid.uDiv).outerHeight());b.grid.fhDiv=a('<div style="position:absolute;left:0px;top:'+c+"px;height:"+e+'px;" class="frozen-div ui-state-default ui-jqgrid-hdiv"></div>');b.grid.fbDiv=a('<div style="position:absolute;left:0px;top:'+(parseInt(c,10)+parseInt(e,10)+1)+'px;overflow-y:hidden" class="frozen-bdiv ui-jqgrid-bdiv"></div>');
a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);k=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).clone(!0);if(b.p.groupHeader){a("tr.jqg-first-row-header, tr.jqg-third-row-header",k).each(function(){a("th:gt("+d+")",this).remove()});var s=-1,f=-1,g,m;a("tr.jqg-second-row-header th",k).each(function(){g=parseInt(a(this).attr("colspan"),10);if(m=parseInt(a(this).attr("rowspan"),10))s++,f++;g&&(s+=g,f++);if(s===d)return!1});s!==d&&(f=d);a("tr.jqg-second-row-header",k).each(function(){a("th:gt("+
f+")",this).remove()})}else a("tr",k).each(function(){a("th:gt("+d+")",this).remove()});a(k).width(1);a(b.grid.fhDiv).append(k).mousemove(function(a){if(b.grid.resizing)return b.grid.dragMove(a),!1});b.p.footerrow&&(k=a(".ui-jqgrid-bdiv","#gview_"+a.jgrid.jqID(b.p.id)).height(),b.grid.fsDiv=a('<div style="position:absolute;left:0px;top:'+(parseInt(c,10)+parseInt(e,10)+parseInt(k,10)+1)+'px;" class="frozen-sdiv ui-jqgrid-sdiv"></div>'),a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fsDiv),c=a(".ui-jqgrid-ftable",
"#gview_"+a.jgrid.jqID(b.p.id)).clone(!0),a("tr",c).each(function(){a("td:gt("+d+")",this).remove()}),a(c).width(1),a(b.grid.fsDiv).append(c));a(b).bind("jqGridResizeStop.setFrozenColumns",function(c,d,e){c=a(".ui-jqgrid-htable",b.grid.fhDiv);a("th:eq("+e+")",c).width(d);c=a(".ui-jqgrid-btable",b.grid.fbDiv);a("tr:first td:eq("+e+")",c).width(d);b.p.footerrow&&(c=a(".ui-jqgrid-ftable",b.grid.fsDiv),a("tr:first td:eq("+e+")",c).width(d))});a(b).bind("jqGridSortCol.setFrozenColumns",function(c,d,e){c=
a("tr.ui-jqgrid-labels:last th:eq("+b.p.lastsort+")",b.grid.fhDiv);d=a("tr.ui-jqgrid-labels:last th:eq("+e+")",b.grid.fhDiv);a("span.ui-grid-ico-sort",c).addClass("ui-state-disabled");a(c).attr("aria-selected","false");a("span.ui-icon-"+b.p.sortorder,d).removeClass("ui-state-disabled");a(d).attr("aria-selected","true");b.p.viewsortcols[0]||b.p.lastsort===e||(a("span.s-ico",c).hide(),a("span.s-ico",d).show())});a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);a(b.grid.bDiv).scroll(function(){a(b.grid.fbDiv).scrollTop(a(this).scrollTop())});
!0===b.p.hoverrows&&a("#"+a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout");a(b).bind("jqGridAfterGridComplete.setFrozenColumns",function(){a("#"+a.jgrid.jqID(b.p.id)+"_frozen").remove();a(b.grid.fbDiv).height(a(b.grid.bDiv).height()-16);var c=a("#"+a.jgrid.jqID(b.p.id)).clone(!0);a("tr[role=row]",c).each(function(){a("td[role=gridcell]:gt("+d+")",this).remove()});a(c).width(1).attr("id",b.p.id+"_frozen");a(b.grid.fbDiv).append(c);!0===b.p.hoverrows&&(a("tr.jqgrow",c).hover(function(){a(this).addClass("ui-state-hover");
a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)).removeClass("ui-state-hover")}),a("tr.jqgrow","#"+a.jgrid.jqID(b.p.id)).hover(function(){a(this).addClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)+"_frozen").addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)+
"_frozen").removeClass("ui-state-hover")}));c=null});b.grid.hDiv.loading||a(b).triggerHandler("jqGridAfterGridComplete");b.p.frozenColumns=!0}}}})},destroyFrozenColumns:function(){return this.each(function(){if(this.grid&&!0===this.p.frozenColumns){a(this.grid.fhDiv).remove();a(this.grid.fbDiv).remove();this.grid.fhDiv=null;this.grid.fbDiv=null;this.p.footerrow&&(a(this.grid.fsDiv).remove(),this.grid.fsDiv=null);a(this).unbind(".setFrozenColumns");if(!0===this.p.hoverrows){var b;a("#"+a.jgrid.jqID(this.p.id)).bind("mouseover",
function(c){b=a(c.target).closest("tr.jqgrow");"ui-subgrid"!==a(b).attr("class")&&a(b).addClass("ui-state-hover")}).bind("mouseout",function(c){b=a(c.target).closest("tr.jqgrow");a(b).removeClass("ui-state-hover")})}this.p.frozenColumns=!1}})}})})(jQuery);
(function(a){a.extend(a.jgrid,{showModal:function(a){a.w.show()},closeModal:function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal:function(d,b){b=a.extend({jqm:!0,gb:"",removemodal:!1,formprop:!1,form:""},b||{});var c=b.gb&&"string"===typeof b.gb&&"#gbox_"===b.gb.substr(0,6)?a("#"+b.gb.substr(6))[0]:!1;if(b.onClose){var g=c?b.onClose.call(c,d):b.onClose(d);if("boolean"===typeof g&&!g)return}if(b.formprop&&c&&b.form){g=a(d)[0].style.height;-1<g.indexOf("px")&&(g=parseFloat(g));
var e,h;"edit"===b.form?(e="#"+a.jgrid.jqID("FrmGrid_"+b.gb.substr(6)),h="formProp"):"view"===b.form&&(e="#"+a.jgrid.jqID("ViewGrid_"+b.gb.substr(6)),h="viewProp");a(c).data(h,{top:parseFloat(a(d).css("top")),left:parseFloat(a(d).css("left")),width:a(d).width(),height:g,dataheight:a(e).height(),datawidth:a(e).width()})}if(a.fn.jqm&&!0===b.jqm)a(d).attr("aria-hidden","true").jqmHide();else{if(""!==b.gb)try{a(".jqgrid-overlay:first",b.gb).hide()}catch(f){}a(d).hide().attr("aria-hidden","true")}b.removemodal&&
a(d).remove()},findPos:function(a){var b=0,c=0;if(a.offsetParent){do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent)}return[b,c]},createModal:function(d,b,c,g,e,h,f){c=a.extend(!0,{},a.jgrid.jqModal||{},c);var k=document.createElement("div"),m,s=this;f=a.extend({},f||{});m="rtl"===a(c.gbox).attr("dir")?!0:!1;k.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";k.id=d.themodal;var l=document.createElement("div");l.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
l.id=d.modalhead;a(l).append("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var q=a("<a class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){q.addClass("ui-state-hover")},function(){q.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(l).append(q);m?(k.dir="rtl",a(".ui-jqdialog-title",l).css("float","right"),a(".ui-jqdialog-titlebar-close",l).css("left","0.3em")):(k.dir="ltr",a(".ui-jqdialog-title",l).css("float","left"),a(".ui-jqdialog-titlebar-close",
l).css("right","0.3em"));var n=document.createElement("div");a(n).addClass("ui-jqdialog-content ui-widget-content").attr("id",d.modalcontent);a(n).append(b);k.appendChild(n);a(k).prepend(l);!0===h?a("body").append(k):"string"===typeof h?a(h).append(k):a(k).insertBefore(g);a(k).css(f);void 0===c.jqModal&&(c.jqModal=!0);b={};if(a.fn.jqm&&!0===c.jqModal)0===c.left&&0===c.top&&c.overlay&&(f=[],f=a.jgrid.findPos(e),c.left=f[0]+4,c.top=f[1]+4),b.top=c.top+"px",b.left=c.left;else if(0!==c.left||0!==c.top)b.left=
c.left,b.top=c.top+"px";a("a.ui-jqdialog-titlebar-close",l).click(function(){var b=a("#"+a.jgrid.jqID(d.themodal)).data("onClose")||c.onClose,e=a("#"+a.jgrid.jqID(d.themodal)).data("gbox")||c.gbox;s.hideModal("#"+a.jgrid.jqID(d.themodal),{gb:e,jqm:c.jqModal,onClose:b,removemodal:c.removemodal||!1,formprop:!c.recreateForm||!1,form:c.form||""});return!1});0!==c.width&&c.width||(c.width=300);0!==c.height&&c.height||(c.height=200);c.zIndex||(g=a(g).parents("*[role=dialog]").filter(":first").css("z-index"),
c.zIndex=g?parseInt(g,10)+2:950);g=0;m&&b.left&&!h&&(g=a(c.gbox).width()-(isNaN(c.width)?0:parseInt(c.width,10))-8,b.left=parseInt(b.left,10)+parseInt(g,10));b.left&&(b.left+="px");a(k).css(a.extend({width:isNaN(c.width)?"auto":c.width+"px",height:isNaN(c.height)?"auto":c.height+"px",zIndex:c.zIndex,overflow:"hidden"},b)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":d.modalhead,"aria-hidden":"true"});void 0===c.drag&&(c.drag=!0);void 0===c.resize&&(c.resize=!0);if(c.drag)if(a(l).css("cursor",
"move"),a.fn.jqDrag)a(k).jqDrag(l);else try{a(k).draggable({handle:a("#"+a.jgrid.jqID(l.id))})}catch(p){}if(c.resize)if(a.fn.jqResize)a(k).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se'></div>"),a("#"+a.jgrid.jqID(d.themodal)).jqResize(".jqResize",d.scrollelm?"#"+a.jgrid.jqID(d.scrollelm):!1);else try{a(k).resizable({handles:"se, sw",alsoResize:d.scrollelm?"#"+a.jgrid.jqID(d.scrollelm):!1})}catch(r){}!0===c.closeOnEscape&&a(k).keydown(function(b){27===
b.which&&(b=a("#"+a.jgrid.jqID(d.themodal)).data("onClose")||c.onClose,s.hideModal("#"+a.jgrid.jqID(d.themodal),{gb:c.gbox,jqm:c.jqModal,onClose:b,removemodal:c.removemodal||!1,formprop:!c.recreateForm||!1,form:c.form||""}))})},viewModal:function(d,b){b=a.extend({toTop:!0,overlay:10,modal:!1,overlayClass:"ui-widget-overlay",onShow:a.jgrid.showModal,onHide:a.jgrid.closeModal,gbox:"",jqm:!0,jqM:!0},b||{});if(a.fn.jqm&&!0===b.jqm)b.jqM?a(d).attr("aria-hidden","false").jqm(b).jqmShow():a(d).attr("aria-hidden",
"false").jqmShow();else{""!==b.gbox&&(a(".jqgrid-overlay:first",b.gbox).show(),a(d).data("gbox",b.gbox));a(d).show().attr("aria-hidden","false");try{a(":input:visible",d)[0].focus()}catch(c){}}},info_dialog:function(d,b,c,g){var e={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",buttons:[]};a.extend(!0,e,a.jgrid.jqModal||{},{caption:"<b>"+d+"</b>"},g||{});var h=e.jqModal,f=this;a.fn.jqm&&
!h&&(h=!1);d="";if(0<e.buttons.length)for(g=0;g<e.buttons.length;g++)void 0===e.buttons[g].id&&(e.buttons[g].id="info_button_"+g),d+="<a id='"+e.buttons[g].id+"' class='fm-button ui-state-default ui-corner-all'>"+e.buttons[g].text+"</a>";g=isNaN(e.dataheight)?e.dataheight:e.dataheight+"px";b="<div id='info_id'>"+("<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+g+";"+("text-align:"+e.align+";")+"'>"+b+"</div>");b+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+
e.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c+"</a>"+d+"</div>":""!==d?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+e.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+d+"</div>":"";b+="</div>";try{"false"===a("#info_dialog").attr("aria-hidden")&&a.jgrid.hideModal("#info_dialog",{jqm:h}),a("#info_dialog").remove()}catch(k){}a.jgrid.createModal({themodal:"info_dialog",
modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},b,e,"","",!0);d&&a.each(e.buttons,function(b){a("#"+a.jgrid.jqID(this.id),"#info_id").bind("click",function(){e.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){f.hideModal("#info_dialog",{jqm:h,onClose:a("#info_dialog").data("onClose")||e.onClose,gb:a("#info_dialog").data("gbox")||e.gbox});return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},
function(){a(this).removeClass("ui-state-hover")});a.isFunction(e.beforeOpen)&&e.beforeOpen();a.jgrid.viewModal("#info_dialog",{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:e.modal,jqm:h});a.isFunction(e.afterOpen)&&e.afterOpen();try{a("#info_dialog").focus()}catch(m){}},bindEv:function(d,b){a.isFunction(b.dataInit)&&b.dataInit.call(this,d,b);b.dataEvents&&a.each(b.dataEvents,function(){void 0!==this.data?a(d).bind(this.type,this.data,this.fn):a(d).bind(this.type,this.fn)})},createEl:function(d,
b,c,g,e){function h(b,d,c){var e="dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr custom_element custom_value".split(" ");void 0!==c&&a.isArray(c)&&a.merge(e,c);a.each(d,function(d,c){-1===a.inArray(d,e)&&a(b).attr(d,c)});d.hasOwnProperty("id")||a(b).attr("id",a.jgrid.randId())}var f="",k=this;switch(d){case "textarea":f=document.createElement("textarea");g?b.cols||a(f).css({width:"98%"}):b.cols||(b.cols=20);b.rows||(b.rows=2);if("&nbsp;"===c||"&#160;"===c||1===c.length&&
160===c.charCodeAt(0))c="";f.value=c;h(f,b);a(f).attr({role:"textbox",multiline:"true"});break;case "checkbox":f=document.createElement("input");f.type="checkbox";b.value?(d=b.value.split(":"),c===d[0]&&(f.checked=!0,f.defaultChecked=!0),f.value=d[0],a(f).attr("offval",d[1])):(d=(c+"").toLowerCase(),0>d.search(/(false|f|0|no|n|off|undefined)/i)&&""!==d?(f.checked=!0,f.defaultChecked=!0,f.value=c):f.value="on",a(f).attr("offval","off"));h(f,b,["value"]);a(f).attr("role","checkbox");break;case "select":f=
document.createElement("select");f.setAttribute("role","select");g=[];!0===b.multiple?(d=!0,f.multiple="multiple",a(f).attr("aria-multiselectable","true")):d=!1;if(void 0!==b.dataUrl){d=null;var m=b.postData||e.postData;try{d=b.rowId}catch(s){}k.p&&k.p.idPrefix&&(d=a.jgrid.stripPref(k.p.idPrefix,d));a.ajax(a.extend({url:a.isFunction(b.dataUrl)?b.dataUrl.call(k,d,c,String(b.name)):b.dataUrl,type:"GET",dataType:"html",data:a.isFunction(m)?m.call(k,d,c,String(b.name)):m,context:{elem:f,options:b,vl:c},
success:function(d){var b=[],c=this.elem,e=this.vl,f=a.extend({},this.options),g=!0===f.multiple;d=a.isFunction(f.buildSelect)?f.buildSelect.call(k,d):d;"string"===typeof d&&(d=a(a.trim(d)).html());d&&(a(c).append(d),h(c,f,m?["postData"]:void 0),void 0===f.size&&(f.size=g?3:1),g?(b=e.split(","),b=a.map(b,function(d){return a.trim(d)})):b[0]=a.trim(e),setTimeout(function(){a("option",c).each(function(d){0===d&&c.multiple&&(this.selected=!1);a(this).attr("role","option");if(-1<a.inArray(a.trim(a(this).text()),
b)||-1<a.inArray(a.trim(a(this).val()),b))this.selected="selected"})},0))}},e||{}))}else if(b.value){var l;void 0===b.size&&(b.size=d?3:1);d&&(g=c.split(","),g=a.map(g,function(d){return a.trim(d)}));"function"===typeof b.value&&(b.value=b.value());var q,n,p=void 0===b.separator?":":b.separator;e=void 0===b.delimiter?";":b.delimiter;if("string"===typeof b.value)for(q=b.value.split(e),l=0;l<q.length;l++)n=q[l].split(p),2<n.length&&(n[1]=a.map(n,function(a,d){if(0<d)return a}).join(p)),e=document.createElement("option"),
e.setAttribute("role","option"),e.value=n[0],e.innerHTML=n[1],f.appendChild(e),d||a.trim(n[0])!==a.trim(c)&&a.trim(n[1])!==a.trim(c)||(e.selected="selected"),d&&(-1<a.inArray(a.trim(n[1]),g)||-1<a.inArray(a.trim(n[0]),g))&&(e.selected="selected");else if("object"===typeof b.value)for(l in p=b.value,p)p.hasOwnProperty(l)&&(e=document.createElement("option"),e.setAttribute("role","option"),e.value=l,e.innerHTML=p[l],f.appendChild(e),d||a.trim(l)!==a.trim(c)&&a.trim(p[l])!==a.trim(c)||(e.selected="selected"),
d&&(-1<a.inArray(a.trim(p[l]),g)||-1<a.inArray(a.trim(l),g))&&(e.selected="selected"));h(f,b,["value"])}break;case "text":case "password":case "button":l="button"===d?"button":"textbox";f=document.createElement("input");f.type=d;f.value=c;h(f,b);"button"!==d&&(g?b.size||a(f).css({width:"98%"}):b.size||(b.size=20));a(f).attr("role",l);break;case "image":case "file":f=document.createElement("input");f.type=d;h(f,b);break;case "custom":f=document.createElement("span");try{if(a.isFunction(b.custom_element))if(p=
b.custom_element.call(k,c,b))p=a(p).addClass("customelement").attr({id:b.id,name:b.name}),a(f).empty().append(p);else throw"e2";else throw"e1";}catch(r){"e1"===r&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===r?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,"string"===typeof r?r:r.message,a.jgrid.edit.bClose)}}return f},
checkDate:function(a,b){var c={},g;a=a.toLowerCase();g=-1!==a.indexOf("/")?"/":-1!==a.indexOf("-")?"-":-1!==a.indexOf(".")?".":"/";a=a.split(g);b=b.split(g);if(3!==b.length)return!1;var e=-1,h,f=g=-1,k;for(k=0;k<a.length;k++)h=isNaN(b[k])?0:parseInt(b[k],10),c[a[k]]=h,h=a[k],-1!==h.indexOf("y")&&(e=k),-1!==h.indexOf("m")&&(f=k),-1!==h.indexOf("d")&&(g=k);h="y"===a[e]||"yyyy"===a[e]?4:"yy"===a[e]?2:-1;k=[0,31,29,31,30,31,30,31,31,30,31,30,31];var m;if(-1===e)return!1;m=c[a[e]].toString();2===h&&1===
m.length&&(h=1);if(m.length!==h||0===c[a[e]]&&"00"!==b[e]||-1===f)return!1;m=c[a[f]].toString();if(1>m.length||1>c[a[f]]||12<c[a[f]]||-1===g)return!1;m=c[a[g]].toString();!(h=1>m.length||1>c[a[g]]||31<c[a[g]])&&(h=2===c[a[f]])&&(e=c[a[e]],h=c[a[g]]>(0!==e%4||0===e%100&&0!==e%400?28:29));return h||c[a[g]]>k[c[a[f]]]?!1:!0},isEmpty:function(a){return a.match(/^\s+$/)||""===a?!0:!1},checkTime:function(d){var b=/^(\d{1,2}):(\d{2})([apAP][Mm])?$/;if(!a.jgrid.isEmpty(d))if(d=d.match(b)){if(d[3]){if(1>d[1]||
12<d[1])return!1}else if(23<d[1])return!1;if(59<d[2])return!1}else return!1;return!0},checkValues:function(d,b,c,g){var e,h,f;f=this.p.colModel;if(void 0===c)if("string"===typeof b)for(c=0,g=f.length;c<g;c++){if(f[c].name===b){e=f[c].editrules;b=c;null!=f[c].formoptions&&(h=f[c].formoptions.label);break}}else 0<=b&&(e=f[b].editrules);else e=c,h=void 0===g?"_":g;if(e){h||(h=null!=this.p.colNames?this.p.colNames[b]:f[b].label);if(!0===e.required&&a.jgrid.isEmpty(d))return[!1,h+": "+a.jgrid.edit.msg.required,
""];c=!1===e.required?!1:!0;if(!0===e.number&&(!1!==c||!a.jgrid.isEmpty(d))&&isNaN(d))return[!1,h+": "+a.jgrid.edit.msg.number,""];if(void 0!==e.minValue&&!isNaN(e.minValue)&&parseFloat(d)<parseFloat(e.minValue))return[!1,h+": "+a.jgrid.edit.msg.minValue+" "+e.minValue,""];if(void 0!==e.maxValue&&!isNaN(e.maxValue)&&parseFloat(d)>parseFloat(e.maxValue))return[!1,h+": "+a.jgrid.edit.msg.maxValue+" "+e.maxValue,""];if(!(!0!==e.email||!1===c&&a.jgrid.isEmpty(d)||(g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
g.test(d))))return[!1,h+": "+a.jgrid.edit.msg.email,""];if(!(!0!==e.integer||!1===c&&a.jgrid.isEmpty(d)||!isNaN(d)&&0===d%1&&-1===d.indexOf(".")))return[!1,h+": "+a.jgrid.edit.msg.integer,""];if(!(!0!==e.date||!1===c&&a.jgrid.isEmpty(d)||(f[b].formatoptions&&f[b].formatoptions.newformat?(f=f[b].formatoptions.newformat,a.jgrid.formatter.date.masks.hasOwnProperty(f)&&(f=a.jgrid.formatter.date.masks[f])):f=f[b].datefmt||"Y-m-d",a.jgrid.checkDate(f,d))))return[!1,h+": "+a.jgrid.edit.msg.date+" - "+f,
""];if(!0===e.time&&!(!1===c&&a.jgrid.isEmpty(d)||a.jgrid.checkTime(d)))return[!1,h+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(!(!0!==e.url||!1===c&&a.jgrid.isEmpty(d)||(g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,g.test(d))))return[!1,h+": "+a.jgrid.edit.msg.url,""];if(!0===e.custom&&(!1!==c||!a.jgrid.isEmpty(d)))return a.isFunction(e.custom_func)?(d=e.custom_func.call(this,d,h,b),a.isArray(d)?d:[!1,a.jgrid.edit.msg.customarray,
""]):[!1,a.jgrid.edit.msg.customfcheck,""]}return[!0,"",""]}})})(jQuery);
(function(a){var b={};a.jgrid.extend({searchGrid:function(b){b=a.extend(!0,{recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,afterChange:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,searchOnEnter:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!0,width:450,height:"auto",dataheight:"auto",showQuery:!1,
errorcheck:!0,sopt:null,stringResult:void 0,onClose:null,onSearch:null,onReset:null,toTop:!0,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null,operands:{eq:"=",ne:"<>",lt:"<",le:"<=",gt:">",ge:">=",bw:"LIKE",bn:"NOT LIKE","in":"IN",ni:"NOT IN",ew:"LIKE",en:"NOT LIKE",cn:"LIKE",nc:"NOT LIKE",nu:"IS NULL",nn:"ISNOT NULL"}},a.jgrid.search,b||{});return this.each(function(){function d(c){w=a(e).triggerHandler("jqGridFilterBeforeShow",[c]);void 0===
w&&(w=!0);w&&a.isFunction(b.beforeShowSearch)&&(w=b.beforeShowSearch.call(e,c));w&&(a.jgrid.viewModal("#"+a.jgrid.jqID(t.themodal),{gbox:"#gbox_"+a.jgrid.jqID(k),jqm:b.jqModal,modal:b.modal,overlay:b.overlay,toTop:b.toTop}),a(e).triggerHandler("jqGridFilterAfterShow",[c]),a.isFunction(b.afterShowSearch)&&b.afterShowSearch.call(e,c))}var e=this;if(e.grid){var k="fbox_"+e.p.id,w=!0,p=!0,t={themodal:"searchmod"+k,modalhead:"searchhd"+k,modalcontent:"searchcnt"+k,scrollelm:k},m=e.p.postData[b.sFilter],
f;"string"===typeof m&&(m=a.jgrid.parse(m));!0===b.recreateFilter&&a("#"+a.jgrid.jqID(t.themodal)).remove();if(void 0!==a("#"+a.jgrid.jqID(t.themodal))[0])d(a("#fbox_"+a.jgrid.jqID(+e.p.id)));else{var g=a("<div><div id='"+k+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+a.jgrid.jqID(e.p.id)),q="left",x="";"rtl"===e.p.direction&&(q="right",x=" style='text-align:left'",g.attr("dir","rtl"));var c=a.extend([],e.p.colModel),v="<a id='"+k+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+
b.Find+"</a>",h="<a id='"+k+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+b.Reset+"</a>",r="",n="",u,y=!1,C=-1;b.showQuery&&(r="<a id='"+k+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>");b.columns.length?(c=b.columns,C=0,u=c[0].index||c[0].name):a.each(c,function(a,b){b.label||(b.label=e.p.colNames[a]);if(!y){var c=
void 0===b.search?!0:b.search,d=!0===b.hidden;if(b.searchoptions&&!0===b.searchoptions.searchhidden&&c||c&&!d)y=!0,u=b.index||b.name,C=a}});if(!m&&u||!1===b.multipleSearch){var A="eq";0<=C&&c[C].searchoptions&&c[C].searchoptions.sopt?A=c[C].searchoptions.sopt[0]:b.sopt&&b.sopt.length&&(A=b.sopt[0]);m={groupOp:"AND",rules:[{field:u,op:A,data:""}]}}y=!1;b.tmplNames&&b.tmplNames.length&&(y=!0,n=b.tmplLabel,n+="<select class='ui-template'>",n+="<option value='default'>Default</option>",a.each(b.tmplNames,
function(a,b){n+="<option value='"+a+"'>"+b+"</option>"}),n+="</select>");q="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+k+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:"+q+"'>"+h+n+"</td><td class='EditButton' "+x+">"+r+v+"</td></tr></tbody></table>";k=a.jgrid.jqID(k);a("#"+k).jqFilter({columns:c,filter:b.loadDefaults?m:null,showQuery:b.showQuery,errorcheck:b.errorcheck,sopt:b.sopt,
groupButton:b.multipleGroup,ruleButtons:b.multipleSearch,afterRedraw:b.afterRedraw,ops:b.odata,operands:b.operands,ajaxSelectOptions:e.p.ajaxSelectOptions,groupOps:b.groupOps,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString());a.isFunction(b.afterChange)&&b.afterChange.call(e,a("#"+k),b)},direction:e.p.direction,id:e.p.id});g.append(q);y&&b.tmplFilters&&b.tmplFilters.length&&a(".ui-template",g).bind("change",function(){var c=a(this).val();"default"===c?a("#"+k).jqFilter("addFilter",
m):a("#"+k).jqFilter("addFilter",b.tmplFilters[parseInt(c,10)]);return!1});!0===b.multipleGroup&&(b.multipleSearch=!0);a(e).triggerHandler("jqGridFilterInitialize",[a("#"+k)]);a.isFunction(b.onInitializeSearch)&&b.onInitializeSearch.call(e,a("#"+k));b.gbox="#gbox_"+k;b.layer?a.jgrid.createModal(t,g,b,"#gview_"+a.jgrid.jqID(e.p.id),a("#gbox_"+a.jgrid.jqID(e.p.id))[0],"#"+a.jgrid.jqID(b.layer),{position:"relative"}):a.jgrid.createModal(t,g,b,"#gview_"+a.jgrid.jqID(e.p.id),a("#gbox_"+a.jgrid.jqID(e.p.id))[0]);
(b.searchOnEnter||b.closeOnEscape)&&a("#"+a.jgrid.jqID(t.themodal)).keydown(function(c){var d=a(c.target);if(!(!b.searchOnEnter||13!==c.which||d.hasClass("add-group")||d.hasClass("add-rule")||d.hasClass("delete-group")||d.hasClass("delete-rule")||d.hasClass("fm-button")&&d.is("[id$=_query]")))return a("#"+k+"_search").click(),!1;if(b.closeOnEscape&&27===c.which)return a("#"+a.jgrid.jqID(t.modalhead)).find(".ui-jqdialog-titlebar-close").click(),!1});r&&a("#"+k+"_query").bind("click",function(){a(".queryresult",
g).toggle();return!1});void 0===b.stringResult&&(b.stringResult=b.multipleSearch);a("#"+k+"_search").bind("click",function(){var c={},d,h;f=a("#"+k);f.find(".input-elm:focus").change();h=f.jqFilter("filterData");if(b.errorcheck&&(f[0].hideError(),b.showQuery||f.jqFilter("toSQLString"),f[0].p.error))return f[0].showError(),!1;if(b.stringResult){try{d=xmlJsonClass.toJson(h,"","",!1)}catch(g){try{d=JSON.stringify(h)}catch(l){}}"string"===typeof d&&(c[b.sFilter]=d,a.each([b.sField,b.sValue,b.sOper],function(){c[this]=
""}))}else b.multipleSearch?(c[b.sFilter]=h,a.each([b.sField,b.sValue,b.sOper],function(){c[this]=""})):(c[b.sField]=h.rules[0].field,c[b.sValue]=h.rules[0].data,c[b.sOper]=h.rules[0].op,c[b.sFilter]="");e.p.search=!0;a.extend(e.p.postData,c);p=a(e).triggerHandler("jqGridFilterSearch");void 0===p&&(p=!0);p&&a.isFunction(b.onSearch)&&(p=b.onSearch.call(e,e.p.filters));!1!==p&&a(e).trigger("reloadGrid",[{page:1}]);b.closeAfterSearch&&a.jgrid.hideModal("#"+a.jgrid.jqID(t.themodal),{gb:"#gbox_"+a.jgrid.jqID(e.p.id),
jqm:b.jqModal,onClose:b.onClose});return!1});a("#"+k+"_reset").bind("click",function(){var c={},d=a("#"+k);e.p.search=!1;e.p.resetsearch=!0;!1===b.multipleSearch?c[b.sField]=c[b.sValue]=c[b.sOper]="":c[b.sFilter]="";d[0].resetFilter();y&&a(".ui-template",g).val("default");a.extend(e.p.postData,c);p=a(e).triggerHandler("jqGridFilterReset");void 0===p&&(p=!0);p&&a.isFunction(b.onReset)&&(p=b.onReset.call(e));!1!==p&&a(e).trigger("reloadGrid",[{page:1}]);b.closeAfterReset&&a.jgrid.hideModal("#"+a.jgrid.jqID(t.themodal),
{gb:"#gbox_"+a.jgrid.jqID(e.p.id),jqm:b.jqModal,onClose:b.onClose});return!1});d(a("#"+k));a(".fm-button:not(.ui-state-disabled)",g).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(z,d){d=a.extend(!0,{top:0,left:0,width:300,datawidth:"auto",height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,url:null,mtype:"POST",clearAfterAdd:!0,closeAfterEdit:!1,reloadAfterSubmit:!0,onInitializeForm:null,beforeInitData:null,
beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:!1,jqModal:!0,closeOnEscape:!1,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[!1,13],navkeys:[!1,38,40],checkOnSubmit:!1,checkOnUpdate:!1,_savedData:{},processing:!1,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:!0,overlayClass:"ui-widget-overlay",removemodal:!0,
form:"edit"},a.jgrid.edit,d||{});b[a(this)[0].p.id]=d;return this.each(function(){function e(){a(n+" > tbody > tr > td .FormElement").each(function(){var b=a(".customelement",this);if(b.length){var d=a(b[0]).attr("name");a.each(c.p.colModel,function(){if(this.name===d&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(l[d]=this.editoptions.custom_value.call(c,a("#"+a.jgrid.jqID(d),n),"get"),void 0===l[d])throw"e1";}catch(b){"e1"===b?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+
a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,b.message,a.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).is(":checked")?l[this.name]=a(this).val():(b=a(this).attr("offval"),l[this.name]=b);break;case "select-one":l[this.name]=a("option:selected",this).val();break;case "select-multiple":l[this.name]=a(this).val();l[this.name]=l[this.name]?l[this.name].join(","):"";a("option:selected",this).each(function(b,c){a(c).text()});
break;case "password":case "text":case "textarea":case "button":l[this.name]=a(this).val()}c.p.autoencode&&(l[this.name]=a.jgrid.htmlEncode(l[this.name]))}});return!0}function k(d,e,s,g){var l,f,n,k=0,m,u,q,r=[],D=!1,z="",p;for(p=1;p<=g;p++)z+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";"_empty"!==d&&(D=a(e).jqGrid("getInd",d));a(e.p.colModel).each(function(p){l=this.name;u=(f=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";
if("cb"!==l&&"subgrid"!==l&&!0===this.editable&&"rn"!==l){if(!1===D)m="";else if(l===e.p.ExpandColumn&&!0===e.p.treeGrid)m=a("td[role='gridcell']:eq("+p+")",e.rows[D]).text();else{try{m=a.unformat.call(e,a("td[role='gridcell']:eq("+p+")",e.rows[D]),{rowId:d,colModel:this},p)}catch(w){m=this.edittype&&"textarea"===this.edittype?a("td[role='gridcell']:eq("+p+")",e.rows[D]).text():a("td[role='gridcell']:eq("+p+")",e.rows[D]).html()}if(!m||"&nbsp;"===m||"&#160;"===m||1===m.length&&160===m.charCodeAt(0))m=
""}var t=a.extend({},this.editoptions||{},{id:l,name:l,rowId:d}),v=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),y=parseInt(v.rowpos,10)||k+1,A=parseInt(2*(parseInt(v.colpos,10)||1),10);"_empty"===d&&t.defaultValue&&(m=a.isFunction(t.defaultValue)?t.defaultValue.call(c):t.defaultValue);this.edittype||(this.edittype="text");c.p.autoencode&&(m=a.jgrid.htmlDecode(m));q=a.jgrid.createEl.call(c,this.edittype,t,m,!1,a.extend({},a.jgrid.ajaxOptions,e.p.ajaxSelectOptions||
{}));if(b[c.p.id].checkOnSubmit||b[c.p.id].checkOnUpdate)b[c.p.id]._savedData[l]=m;a(q).addClass("FormElement");-1<a.inArray(this.edittype,["text","textarea","password","select"])&&a(q).addClass("ui-widget-content ui-corner-all");n=a(s).find("tr[rowpos="+y+"]");if(v.rowabove){var C=a("<tr><td class='contentinfo' colspan='"+2*g+"'>"+v.rowcontent+"</td></tr>");a(s).append(C);C[0].rp=y}0===n.length&&(n=a("<tr "+u+" rowpos='"+y+"'></tr>").addClass("FormData").attr("id","tr_"+l),a(n).append(z),a(s).append(n),
n[0].rp=y);a("td:eq("+(A-2)+")",n[0]).html(void 0===v.label?e.p.colNames[p]:v.label);a("td:eq("+(A-1)+")",n[0]).append(v.elmprefix).append(q).append(v.elmsuffix);"custom"===this.edittype&&a.isFunction(t.custom_value)&&t.custom_value.call(c,a("#"+l,"#"+h),"set",m);a.jgrid.bindEv.call(c,q,t);r[k]=p;k++}});0<k&&(p=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*g-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+e.p.id+"_id' value='"+
d+"'/></td></tr>"),p[0].rp=k+999,a(s).append(p),b[c.p.id].checkOnSubmit||b[c.p.id].checkOnUpdate)&&(b[c.p.id]._savedData[e.p.id+"_id"]=d);return r}function w(d,e,s){var l,h=0,g,f,m,k,u;if(b[c.p.id].checkOnSubmit||b[c.p.id].checkOnUpdate)b[c.p.id]._savedData={},b[c.p.id]._savedData[e.p.id+"_id"]=d;var p=e.p.colModel;if("_empty"===d)a(p).each(function(){l=this.name;m=a.extend({},this.editoptions||{});(f=a("#"+a.jgrid.jqID(l),"#"+s))&&f.length&&null!==f[0]&&(k="","custom"===this.edittype&&a.isFunction(m.custom_value)?
m.custom_value.call(c,a("#"+l,"#"+s),"set",k):m.defaultValue?(k=a.isFunction(m.defaultValue)?m.defaultValue.call(c):m.defaultValue,"checkbox"===f[0].type?(u=k.toLowerCase(),0>u.search(/(false|f|0|no|n|off|undefined)/i)&&""!==u?(f[0].checked=!0,f[0].defaultChecked=!0,f[0].value=k):(f[0].checked=!1,f[0].defaultChecked=!1)):f.val(k)):"checkbox"===f[0].type?(f[0].checked=!1,f[0].defaultChecked=!1,k=a(f).attr("offval")):f[0].type&&"select"===f[0].type.substr(0,6)?f[0].selectedIndex=0:f.val(k),!0===b[c.p.id].checkOnSubmit||
b[c.p.id].checkOnUpdate)&&(b[c.p.id]._savedData[l]=k)}),a("#id_g","#"+s).val(d);else{var q=a(e).jqGrid("getInd",d,!0);q&&(a('td[role="gridcell"]',q).each(function(f){l=p[f].name;if("cb"!==l&&"subgrid"!==l&&"rn"!==l&&!0===p[f].editable){if(l===e.p.ExpandColumn&&!0===e.p.treeGrid)g=a(this).text();else try{g=a.unformat.call(e,a(this),{rowId:d,colModel:p[f]},f)}catch(m){g="textarea"===p[f].edittype?a(this).text():a(this).html()}c.p.autoencode&&(g=a.jgrid.htmlDecode(g));if(!0===b[c.p.id].checkOnSubmit||
b[c.p.id].checkOnUpdate)b[c.p.id]._savedData[l]=g;l=a.jgrid.jqID(l);switch(p[f].edittype){case "password":case "text":case "button":case "image":case "textarea":if("&nbsp;"===g||"&#160;"===g||1===g.length&&160===g.charCodeAt(0))g="";a("#"+l,"#"+s).val(g);break;case "select":var k=g.split(","),k=a.map(k,function(b){return a.trim(b)});a("#"+l+" option","#"+s).each(function(){p[f].editoptions.multiple||a.trim(g)!==a.trim(a(this).text())&&k[0]!==a.trim(a(this).text())&&k[0]!==a.trim(a(this).val())?p[f].editoptions.multiple?
-1<a.inArray(a.trim(a(this).text()),k)||-1<a.inArray(a.trim(a(this).val()),k)?this.selected=!0:this.selected=!1:this.selected=!1:this.selected=!0});break;case "checkbox":g=String(g);if(p[f].editoptions&&p[f].editoptions.value)if(p[f].editoptions.value.split(":")[0]===g)a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]({checked:!0,defaultChecked:!0});else a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]({checked:!1,defaultChecked:!1});else g=g.toLowerCase(),0>g.search(/(false|f|0|no|n|off|undefined)/i)&&""!==g?(a("#"+
l,"#"+s)[c.p.useProp?"prop":"attr"]("checked",!0),a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]("defaultChecked",!0)):(a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]("checked",!1),a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]("defaultChecked",!1));break;case "custom":try{if(p[f].editoptions&&a.isFunction(p[f].editoptions.custom_value))p[f].editoptions.custom_value.call(c,a("#"+l,"#"+s),"set",g);else throw"e1";}catch(n){"e1"===n?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,
a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,n.message,a.jgrid.edit.bClose)}}h++}}),0<h&&a("#id_g",n).val(d))}}function p(){a.each(c.p.colModel,function(a,b){b.editoptions&&!0===b.editoptions.NullIfEmpty&&l.hasOwnProperty(b.name)&&""===l[b.name]&&(l[b.name]="null")})}function t(){var e,f=[!0,"",""],s={},g=c.p.prmNames,m,k,q,D,r,t=a(c).triggerHandler("jqGridAddEditBeforeCheckValues",[a("#"+h),B]);t&&"object"===typeof t&&(l=t);a.isFunction(b[c.p.id].beforeCheckValues)&&(t=b[c.p.id].beforeCheckValues.call(c,
l,a("#"+h),B))&&"object"===typeof t&&(l=t);for(q in l)if(l.hasOwnProperty(q)&&(f=a.jgrid.checkValues.call(c,l[q],q),!1===f[0]))break;p();f[0]&&(s=a(c).triggerHandler("jqGridAddEditClickSubmit",[b[c.p.id],l,B]),void 0===s&&a.isFunction(b[c.p.id].onclickSubmit)&&(s=b[c.p.id].onclickSubmit.call(c,b[c.p.id],l,B)||{}),f=a(c).triggerHandler("jqGridAddEditBeforeSubmit",[l,a("#"+h),B]),void 0===f&&(f=[!0,"",""]),f[0]&&a.isFunction(b[c.p.id].beforeSubmit)&&(f=b[c.p.id].beforeSubmit.call(c,l,a("#"+h),B)));
if(f[0]&&!b[c.p.id].processing){b[c.p.id].processing=!0;a("#sData",n+"_2").addClass("ui-state-active");q=b[c.p.id].url||a(c).jqGrid("getGridParam","editurl");k=g.oper;m="clientArray"===q?c.p.keyName:g.id;l[k]="_empty"===a.trim(l[c.p.id+"_id"])?g.addoper:g.editoper;l[k]!==g.addoper?l[m]=l[c.p.id+"_id"]:void 0===l[m]&&(l[m]=l[c.p.id+"_id"]);delete l[c.p.id+"_id"];l=a.extend(l,b[c.p.id].editData,s);if(!0===c.p.treeGrid)for(r in l[k]===g.addoper&&(D=a(c).jqGrid("getGridParam","selrow"),l["adjacency"===
c.p.treeGridModel?c.p.treeReader.parent_id_field:"parent_id"]=D),c.p.treeReader)c.p.treeReader.hasOwnProperty(r)&&(s=c.p.treeReader[r],!l.hasOwnProperty(s)||l[k]===g.addoper&&"parent_id_field"===r||delete l[s]);l[m]=a.jgrid.stripPref(c.p.idPrefix,l[m]);r=a.extend({url:q,type:b[c.p.id].mtype,data:a.isFunction(b[c.p.id].serializeEditData)?b[c.p.id].serializeEditData.call(c,l):l,complete:function(s,p){var q;a("#sData",n+"_2").removeClass("ui-state-active");l[m]=c.p.idPrefix+l[m];300<=s.status&&304!==
s.status?(f[0]=!1,f[1]=a(c).triggerHandler("jqGridAddEditErrorTextFormat",[s,B]),a.isFunction(b[c.p.id].errorTextFormat)?f[1]=b[c.p.id].errorTextFormat.call(c,s,B):f[1]=p+" Status: '"+s.statusText+"'. Error code: "+s.status):(f=a(c).triggerHandler("jqGridAddEditAfterSubmit",[s,l,B]),void 0===f&&(f=[!0,"",""]),f[0]&&a.isFunction(b[c.p.id].afterSubmit)&&(f=b[c.p.id].afterSubmit.call(c,s,l,B)));if(!1===f[0])a("#FormError>td",n).html(f[1]),a("#FormError",n).show();else if(c.p.autoencode&&a.each(l,function(b,
c){l[b]=a.jgrid.htmlDecode(c)}),l[k]===g.addoper?(f[2]||(f[2]=a.jgrid.randId()),null==l[m]||"_empty"===l[m]?l[m]=f[2]:f[2]=l[m],b[c.p.id].reloadAfterSubmit?a(c).trigger("reloadGrid"):!0===c.p.treeGrid?a(c).jqGrid("addChildNode",f[2],D,l):a(c).jqGrid("addRowData",f[2],l,d.addedrow),b[c.p.id].closeAfterAdd?(!0!==c.p.treeGrid&&a(c).jqGrid("setSelection",f[2]),a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,
formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form})):b[c.p.id].clearAfterAdd&&w("_empty",c,h)):(b[c.p.id].reloadAfterSubmit?(a(c).trigger("reloadGrid"),b[c.p.id].closeAfterEdit||setTimeout(function(){a(c).jqGrid("setSelection",l[m])},1E3)):!0===c.p.treeGrid?a(c).jqGrid("setTreeRow",l[m],l):a(c).jqGrid("setRowData",l[m],l),b[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,
formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form})),a.isFunction(b[c.p.id].afterComplete)&&(e=s,setTimeout(function(){a(c).triggerHandler("jqGridAddEditAfterComplete",[e,l,a("#"+h),B]);b[c.p.id].afterComplete.call(c,e,l,a("#"+h),B);e=null},500)),b[c.p.id].checkOnSubmit||b[c.p.id].checkOnUpdate)if(a("#"+h).data("disabled",!1),"_empty"!==b[c.p.id]._savedData[c.p.id+"_id"])for(q in b[c.p.id]._savedData)b[c.p.id]._savedData.hasOwnProperty(q)&&l[q]&&(b[c.p.id]._savedData[q]=l[q]);b[c.p.id].processing=
!1;try{a(":input:visible","#"+h)[0].focus()}catch(r){}}},a.jgrid.ajaxOptions,b[c.p.id].ajaxEditOptions);r.url||b[c.p.id].useDataProxy||(a.isFunction(c.p.dataProxy)?b[c.p.id].useDataProxy=!0:(f[0]=!1,f[1]+=" "+a.jgrid.errors.nourl));f[0]&&(b[c.p.id].useDataProxy?(s=c.p.dataProxy.call(c,r,"set_"+c.p.id),void 0===s&&(s=[!0,""]),!1===s[0]?(f[0]=!1,f[1]=s[1]||"Error deleting the selected row!"):(r.data.oper===g.addoper&&b[c.p.id].closeAfterAdd&&a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+
a.jgrid.jqID(v),jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form}),r.data.oper===g.editoper&&b[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form}))):"clientArray"===r.url?(b[c.p.id].reloadAfterSubmit=!1,l=r.data,r.complete({status:200,statusText:""},
"")):a.ajax(r))}!1===f[0]&&(a("#FormError>td",n).html(f[1]),a("#FormError",n).show())}function m(a,b){var c=!1,d;for(d in a)if(a.hasOwnProperty(d)&&a[d]!=b[d]){c=!0;break}return c}function f(){var d=!0;a("#FormError",n).hide();b[c.p.id].checkOnUpdate&&(l={},e(),M=m(l,b[c.p.id]._savedData))&&(a("#"+h).data("disabled",!0),a(".confirm","#"+u.themodal).show(),d=!1);return d}function g(){var b;if("_empty"!==z&&void 0!==c.p.savedRow&&0<c.p.savedRow.length&&a.isFunction(a.fn.jqGrid.restoreRow))for(b=0;b<
c.p.savedRow.length;b++)if(c.p.savedRow[b].id==z){a(c).jqGrid("restoreRow",z);break}}function q(b,c){var d=c[1].length-1;0===b?a("#pData",n+"_2").addClass("ui-state-disabled"):void 0!==c[1][b-1]&&a("#"+a.jgrid.jqID(c[1][b-1])).hasClass("ui-state-disabled")?a("#pData",n+"_2").addClass("ui-state-disabled"):a("#pData",n+"_2").removeClass("ui-state-disabled");b===d?a("#nData",n+"_2").addClass("ui-state-disabled"):void 0!==c[1][b+1]&&a("#"+a.jgrid.jqID(c[1][b+1])).hasClass("ui-state-disabled")?a("#nData",
n+"_2").addClass("ui-state-disabled"):a("#nData",n+"_2").removeClass("ui-state-disabled")}function x(){var b=a(c).jqGrid("getDataIDs"),d=a("#id_g",n).val();return[a.inArray(d,b),b]}var c=this;if(c.grid&&z){var v=c.p.id,h="FrmGrid_"+v,r="TblGrid_"+v,n="#"+a.jgrid.jqID(r),u={themodal:"editmod"+v,modalhead:"edithd"+v,modalcontent:"editcnt"+v,scrollelm:h},y=a.isFunction(b[c.p.id].beforeShowForm)?b[c.p.id].beforeShowForm:!1,C=a.isFunction(b[c.p.id].afterShowForm)?b[c.p.id].afterShowForm:!1,A=a.isFunction(b[c.p.id].beforeInitData)?
b[c.p.id].beforeInitData:!1,E=a.isFunction(b[c.p.id].onInitializeForm)?b[c.p.id].onInitializeForm:!1,s=!0,D=1,I=0,l,M,B,h=a.jgrid.jqID(h);"new"===z?(z="_empty",B="add",d.caption=b[c.p.id].addCaption):(d.caption=b[c.p.id].editCaption,B="edit");d.recreateForm||a(c).data("formProp")&&a.extend(b[a(this)[0].p.id],a(c).data("formProp"));var N=!0;d.checkOnUpdate&&d.jqModal&&!d.modal&&(N=!1);var F=isNaN(b[a(this)[0].p.id].dataheight)?b[a(this)[0].p.id].dataheight:b[a(this)[0].p.id].dataheight+"px",s=isNaN(b[a(this)[0].p.id].datawidth)?
b[a(this)[0].p.id].datawidth:b[a(this)[0].p.id].datawidth+"px",F=a("<form name='FormPost' id='"+h+"' class='FormGrid' onSubmit='return false;' style='width:"+s+";overflow:auto;position:relative;height:"+F+";'></form>").data("disabled",!1),G=a("<table id='"+r+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");a(c.p.colModel).each(function(){var a=this.formoptions;D=Math.max(D,a?a.colpos||0:0);I=Math.max(I,a?a.rowpos||0:0)});a(F).append(G);s=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+
2*D+"'></td></tr>");s[0].rp=0;a(G).append(s);s=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+2*D+"'>"+b[c.p.id].topinfo+"</td></tr>");s[0].rp=0;a(G).append(s);s=a(c).triggerHandler("jqGridAddEditBeforeInitData",[F,B]);void 0===s&&(s=!0);s&&A&&(s=A.call(c,F,B));if(!1!==s){g();var s=(A="rtl"===c.p.direction?!0:!1)?"nData":"pData",H=A?"pData":"nData";k(z,c,G,D);var s="<a id='"+s+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
H="<a id='"+H+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",J="<a id='sData' class='fm-button ui-state-default ui-corner-all'>"+d.bSubmit+"</a>",K="<a id='cData' class='fm-button ui-state-default ui-corner-all'>"+d.bCancel+"</a>",r="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+r+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+
(A?H+s:s+H)+"</td><td class='EditButton'>"+J+K+"</td></tr>"+("<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+b[c.p.id].bottominfo+"</td></tr>"),r=r+"</tbody></table>";if(0<I){var L=[];a.each(a(G)[0].rows,function(a,b){L[a]=b});L.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(L,function(b,c){a("tbody",G).append(c)})}d.gbox="#gbox_"+a.jgrid.jqID(v);var O=!1;!0===d.closeOnEscape&&(d.closeOnEscape=!1,O=!0);r=a("<div></div>").append(F).append(r);a.jgrid.createModal(u,
r,b[a(this)[0].p.id],"#gview_"+a.jgrid.jqID(c.p.id),a("#gbox_"+a.jgrid.jqID(c.p.id))[0]);A&&(a("#pData, #nData",n+"_2").css("float","right"),a(".EditButton",n+"_2").css("text-align","left"));b[c.p.id].topinfo&&a(".tinfo",n).show();b[c.p.id].bottominfo&&a(".binfo",n+"_2").show();r=r=null;a("#"+a.jgrid.jqID(u.themodal)).keydown(function(e){var s=e.target;if(!0===a("#"+h).data("disabled"))return!1;if(!0===b[c.p.id].savekey[0]&&e.which===b[c.p.id].savekey[1]&&"TEXTAREA"!==s.tagName)return a("#sData",
n+"_2").trigger("click"),!1;if(27===e.which){if(!f())return!1;O&&a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:d.gbox,jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form});return!1}if(!0===b[c.p.id].navkeys[0]){if("_empty"===a("#id_g",n).val())return!0;if(e.which===b[c.p.id].navkeys[1])return a("#pData",n+"_2").trigger("click"),!1;if(e.which===b[c.p.id].navkeys[2])return a("#nData",n+"_2").trigger("click"),!1}});d.checkOnUpdate&&
(a("a.ui-jqdialog-titlebar-close span","#"+a.jgrid.jqID(u.themodal)).removeClass("jqmClose"),a("a.ui-jqdialog-titlebar-close","#"+a.jgrid.jqID(u.themodal)).unbind("click").click(function(){if(!f())return!1;a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form});return!1}));d.saveicon=a.extend([!0,"left","ui-icon-disk"],d.saveicon);d.closeicon=a.extend([!0,
"left","ui-icon-close"],d.closeicon);!0===d.saveicon[0]&&a("#sData",n+"_2").addClass("right"===d.saveicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.saveicon[2]+"'></span>");!0===d.closeicon[0]&&a("#cData",n+"_2").addClass("right"===d.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.closeicon[2]+"'></span>");if(b[c.p.id].checkOnSubmit||b[c.p.id].checkOnUpdate)J="<a id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
d.bYes+"</a>",H="<a id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bNo+"</a>",K="<a id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bExit+"</a>",r=d.zIndex||999,r++,a("<div class='"+d.overlayClass+" jqgrid-overlay confirm' style='z-index:"+r+";display:none;'>&#160;</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(r+1)+"'>"+d.saveData+"<br/><br/>"+J+H+K+"</div>").insertAfter("#"+h),a("#sNew","#"+a.jgrid.jqID(u.themodal)).click(function(){t();
a("#"+h).data("disabled",!1);a(".confirm","#"+a.jgrid.jqID(u.themodal)).hide();return!1}),a("#nNew","#"+a.jgrid.jqID(u.themodal)).click(function(){a(".confirm","#"+a.jgrid.jqID(u.themodal)).hide();a("#"+h).data("disabled",!1);setTimeout(function(){a(":input:visible","#"+h)[0].focus()},0);return!1}),a("#cNew","#"+a.jgrid.jqID(u.themodal)).click(function(){a(".confirm","#"+a.jgrid.jqID(u.themodal)).hide();a("#"+h).data("disabled",!1);a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),
jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form});return!1});a(c).triggerHandler("jqGridAddEditInitializeForm",[a("#"+h),B]);E&&E.call(c,a("#"+h),B);"_empty"!==z&&b[c.p.id].viewPagerButtons?a("#pData,#nData",n+"_2").show():a("#pData,#nData",n+"_2").hide();a(c).triggerHandler("jqGridAddEditBeforeShowForm",[a("#"+h),B]);y&&y.call(c,a("#"+h),B);a("#"+a.jgrid.jqID(u.themodal)).data("onClose",b[c.p.id].onClose);a.jgrid.viewModal("#"+
a.jgrid.jqID(u.themodal),{gbox:"#gbox_"+a.jgrid.jqID(v),jqm:d.jqModal,overlay:d.overlay,modal:d.modal,overlayClass:d.overlayClass,onHide:function(b){var d=a("#editmod"+v)[0].style.height;-1<d.indexOf("px")&&(d=parseFloat(d));a(c).data("formProp",{top:parseFloat(a(b.w).css("top")),left:parseFloat(a(b.w).css("left")),width:a(b.w).width(),height:d,dataheight:a("#"+h).height(),datawidth:a("#"+h).width()});b.w.remove();b.o&&b.o.remove()}});N||a("."+a.jgrid.jqID(d.overlayClass)).click(function(){if(!f())return!1;
a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form});return!1});a(".fm-button","#"+a.jgrid.jqID(u.themodal)).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData",n+"_2").click(function(){l={};a("#FormError",n).hide();e();"_empty"===l[c.p.id+"_id"]?t():!0===d.checkOnSubmit?(M=m(l,b[c.p.id]._savedData))?
(a("#"+h).data("disabled",!0),a(".confirm","#"+a.jgrid.jqID(u.themodal)).show()):t():t();return!1});a("#cData",n+"_2").click(function(){if(!f())return!1;a.jgrid.hideModal("#"+a.jgrid.jqID(u.themodal),{gb:"#gbox_"+a.jgrid.jqID(v),jqm:d.jqModal,onClose:b[c.p.id].onClose,removemodal:b[c.p.id].removemodal,formprop:!b[c.p.id].recreateForm,form:b[c.p.id].form});return!1});a("#nData",n+"_2").click(function(){if(!f())return!1;a("#FormError",n).hide();var b=x();b[0]=parseInt(b[0],10);if(-1!==b[0]&&b[1][b[0]+
1]){a(c).triggerHandler("jqGridAddEditClickPgButtons",["next",a("#"+h),b[1][b[0]]]);var e;if(a.isFunction(d.onclickPgButtons)&&(e=d.onclickPgButtons.call(c,"next",a("#"+h),b[1][b[0]]),void 0!==e&&!1===e)||a("#"+a.jgrid.jqID(b[1][b[0]+1])).hasClass("ui-state-disabled"))return!1;w(b[1][b[0]+1],c,h);a(c).jqGrid("setSelection",b[1][b[0]+1]);a(c).triggerHandler("jqGridAddEditAfterClickPgButtons",["next",a("#"+h),b[1][b[0]]]);a.isFunction(d.afterclickPgButtons)&&d.afterclickPgButtons.call(c,"next",a("#"+
h),b[1][b[0]+1]);q(b[0]+1,b)}return!1});a("#pData",n+"_2").click(function(){if(!f())return!1;a("#FormError",n).hide();var b=x();if(-1!==b[0]&&b[1][b[0]-1]){a(c).triggerHandler("jqGridAddEditClickPgButtons",["prev",a("#"+h),b[1][b[0]]]);var e;if(a.isFunction(d.onclickPgButtons)&&(e=d.onclickPgButtons.call(c,"prev",a("#"+h),b[1][b[0]]),void 0!==e&&!1===e)||a("#"+a.jgrid.jqID(b[1][b[0]-1])).hasClass("ui-state-disabled"))return!1;w(b[1][b[0]-1],c,h);a(c).jqGrid("setSelection",b[1][b[0]-1]);a(c).triggerHandler("jqGridAddEditAfterClickPgButtons",
["prev",a("#"+h),b[1][b[0]]]);a.isFunction(d.afterclickPgButtons)&&d.afterclickPgButtons.call(c,"prev",a("#"+h),b[1][b[0]-1]);q(b[0]-1,b)}return!1});a(c).triggerHandler("jqGridAddEditAfterShowForm",[a("#"+h),B]);C&&C.call(c,a("#"+h),B);y=x();q(y[0],y)}}})},viewGridRow:function(z,d){d=a.extend(!0,{top:0,left:0,width:0,datawidth:"auto",height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,jqModal:!0,closeOnEscape:!1,labelswidth:"30%",closeicon:[],navkeys:[!1,38,40],onClose:null,beforeShowForm:null,
beforeInitData:null,viewPagerButtons:!0,recreateForm:!1,removemodal:!0,form:"view"},a.jgrid.view,d||{});b[a(this)[0].p.id]=d;return this.each(function(){function e(){!0!==b[m.p.id].closeOnEscape&&!0!==b[m.p.id].navkeys[0]||setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+a.jgrid.jqID(v.modalhead)).attr("tabindex","-1").focus()},0)}function k(b,c,e,f){var g,m,h,k=0,n,p,q=[],r=!1,u,t="<td class='CaptionTD form-view-label ui-widget-content' width='"+d.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",
v="",z=["integer","number","currency"],y=0,w=0,A,C,x;for(u=1;u<=f;u++)v+=1===u?t:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(c.p.colModel).each(function(){(m=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)||"right"!==this.align||(this.formatter&&-1!==a.inArray(this.formatter,z)?y=Math.max(y,parseInt(this.width,10)):w=Math.max(w,parseInt(this.width,10)))});A=0!==y?y:0!==w?w:0;r=a(c).jqGrid("getInd",
b);a(c.p.colModel).each(function(b){g=this.name;C=!1;p=(m=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";x="boolean"!==typeof this.viewable?!0:this.viewable;if("cb"!==g&&"subgrid"!==g&&"rn"!==g&&x){n=!1===r?"":g===c.p.ExpandColumn&&!0===c.p.treeGrid?a("td:eq("+b+")",c.rows[r]).text():a("td:eq("+b+")",c.rows[r]).html();C="right"===this.align&&0!==A?!0:!1;var d=a.extend({},{rowabove:!1,rowcontent:""},this.formoptions||{}),s=parseInt(d.rowpos,10)||
k+1,u=parseInt(2*(parseInt(d.colpos,10)||1),10);if(d.rowabove){var t=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+d.rowcontent+"</td></tr>");a(e).append(t);t[0].rp=s}h=a(e).find("tr[rowpos="+s+"]");0===h.length&&(h=a("<tr "+p+" rowpos='"+s+"'></tr>").addClass("FormData").attr("id","trv_"+g),a(h).append(v),a(e).append(h),h[0].rp=s);a("td:eq("+(u-2)+")",h[0]).html("<b>"+(void 0===d.label?c.p.colNames[b]:d.label)+"</b>");a("td:eq("+(u-1)+")",h[0]).append("<span>"+n+"</span>").attr("id","v_"+g);
C&&a("td:eq("+(u-1)+") span",h[0]).css({"text-align":"right",width:A+"px"});q[k]=b;k++}});0<k&&(b=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*f-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+b+"'/></td></tr>"),b[0].rp=k+99,a(e).append(b));return q}function w(b,c){var d,e,f=0,g,h;if(h=a(c).jqGrid("getInd",b,!0))a("td",h).each(function(b){d=c.p.colModel[b].name;e=c.p.colModel[b].editrules&&!0===c.p.colModel[b].editrules.edithidden?
!1:!0===c.p.colModel[b].hidden?!0:!1;"cb"!==d&&"subgrid"!==d&&"rn"!==d&&(g=d===c.p.ExpandColumn&&!0===c.p.treeGrid?a(this).text():a(this).html(),d=a.jgrid.jqID("v_"+d),a("#"+d+" span","#"+q).html(g),e&&a("#"+d,"#"+q).parents("tr:first").hide(),f++)}),0<f&&a("#id_g","#"+q).val(b)}function p(b,c){var d=c[1].length-1;0===b?a("#pData","#"+q+"_2").addClass("ui-state-disabled"):void 0!==c[1][b-1]&&a("#"+a.jgrid.jqID(c[1][b-1])).hasClass("ui-state-disabled")?a("#pData",q+"_2").addClass("ui-state-disabled"):
a("#pData","#"+q+"_2").removeClass("ui-state-disabled");b===d?a("#nData","#"+q+"_2").addClass("ui-state-disabled"):void 0!==c[1][b+1]&&a("#"+a.jgrid.jqID(c[1][b+1])).hasClass("ui-state-disabled")?a("#nData",q+"_2").addClass("ui-state-disabled"):a("#nData","#"+q+"_2").removeClass("ui-state-disabled")}function t(){var b=a(m).jqGrid("getDataIDs"),c=a("#id_g","#"+q).val();return[a.inArray(c,b),b]}var m=this;if(m.grid&&z){var f=m.p.id,g="ViewGrid_"+a.jgrid.jqID(f),q="ViewTbl_"+a.jgrid.jqID(f),x="ViewGrid_"+
f,c="ViewTbl_"+f,v={themodal:"viewmod"+f,modalhead:"viewhd"+f,modalcontent:"viewcnt"+f,scrollelm:g},h=a.isFunction(b[m.p.id].beforeInitData)?b[m.p.id].beforeInitData:!1,r=!0,n=1,u=0;d.recreateForm||a(m).data("viewProp")&&a.extend(b[a(this)[0].p.id],a(m).data("viewProp"));var y=isNaN(b[a(this)[0].p.id].dataheight)?b[a(this)[0].p.id].dataheight:b[a(this)[0].p.id].dataheight+"px",C=isNaN(b[a(this)[0].p.id].datawidth)?b[a(this)[0].p.id].datawidth:b[a(this)[0].p.id].datawidth+"px",x=a("<form name='FormPost' id='"+
x+"' class='FormGrid' style='width:"+C+";overflow:auto;position:relative;height:"+y+";'></form>"),A=a("<table id='"+c+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");a(m.p.colModel).each(function(){var a=this.formoptions;n=Math.max(n,a?a.colpos||0:0);u=Math.max(u,a?a.rowpos||0:0)});a(x).append(A);h&&(r=h.call(m,x),void 0===r&&(r=!0));if(!1!==r){k(z,m,A,n);c="rtl"===m.p.direction?!0:!1;h="<a id='"+(c?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";
r="<a id='"+(c?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";y="<a id='cData' class='fm-button ui-state-default ui-corner-all'>"+d.bClose+"</a>";if(0<u){var E=[];a.each(a(A)[0].rows,function(a,b){E[a]=b});E.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(E,function(b,c){a("tbody",A).append(c)})}d.gbox="#gbox_"+a.jgrid.jqID(f);x=a("<div></div>").append(x).append("<table border='0' class='EditTable' id='"+
q+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+d.labelswidth+"'>"+(c?r+h:h+r)+"</td><td class='EditButton'>"+y+"</td></tr></tbody></table>");a.jgrid.createModal(v,x,d,"#gview_"+a.jgrid.jqID(m.p.id),a("#gview_"+a.jgrid.jqID(m.p.id))[0]);c&&(a("#pData, #nData","#"+q+"_2").css("float","right"),a(".EditButton","#"+q+"_2").css("text-align","left"));d.viewPagerButtons||a("#pData, #nData","#"+q+"_2").hide();x=null;a("#"+v.themodal).keydown(function(c){if(27===c.which)return b[m.p.id].closeOnEscape&&
a.jgrid.hideModal("#"+a.jgrid.jqID(v.themodal),{gb:d.gbox,jqm:d.jqModal,onClose:d.onClose,removemodal:b[m.p.id].removemodal,formprop:!b[m.p.id].recreateForm,form:b[m.p.id].form}),!1;if(!0===d.navkeys[0]){if(c.which===d.navkeys[1])return a("#pData","#"+q+"_2").trigger("click"),!1;if(c.which===d.navkeys[2])return a("#nData","#"+q+"_2").trigger("click"),!1}});d.closeicon=a.extend([!0,"left","ui-icon-close"],d.closeicon);!0===d.closeicon[0]&&a("#cData","#"+q+"_2").addClass("right"===d.closeicon[1]?"fm-button-icon-right":
"fm-button-icon-left").append("<span class='ui-icon "+d.closeicon[2]+"'></span>");a.isFunction(d.beforeShowForm)&&d.beforeShowForm.call(m,a("#"+g));a.jgrid.viewModal("#"+a.jgrid.jqID(v.themodal),{gbox:"#gbox_"+a.jgrid.jqID(f),jqm:d.jqModal,overlay:d.overlay,modal:d.modal,onHide:function(b){a(m).data("viewProp",{top:parseFloat(a(b.w).css("top")),left:parseFloat(a(b.w).css("left")),width:a(b.w).width(),height:a(b.w).height(),dataheight:a("#"+g).height(),datawidth:a("#"+g).width()});b.w.remove();b.o&&
b.o.remove()}});a(".fm-button:not(.ui-state-disabled)","#"+q+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});e();a("#cData","#"+q+"_2").click(function(){a.jgrid.hideModal("#"+a.jgrid.jqID(v.themodal),{gb:"#gbox_"+a.jgrid.jqID(f),jqm:d.jqModal,onClose:d.onClose,removemodal:b[m.p.id].removemodal,formprop:!b[m.p.id].recreateForm,form:b[m.p.id].form});return!1});a("#nData","#"+q+"_2").click(function(){a("#FormError","#"+q).hide();var b=t();
b[0]=parseInt(b[0],10);-1!==b[0]&&b[1][b[0]+1]&&(a.isFunction(d.onclickPgButtons)&&d.onclickPgButtons.call(m,"next",a("#"+g),b[1][b[0]]),w(b[1][b[0]+1],m),a(m).jqGrid("setSelection",b[1][b[0]+1]),a.isFunction(d.afterclickPgButtons)&&d.afterclickPgButtons.call(m,"next",a("#"+g),b[1][b[0]+1]),p(b[0]+1,b));e();return!1});a("#pData","#"+q+"_2").click(function(){a("#FormError","#"+q).hide();var b=t();-1!==b[0]&&b[1][b[0]-1]&&(a.isFunction(d.onclickPgButtons)&&d.onclickPgButtons.call(m,"prev",a("#"+g),
b[1][b[0]]),w(b[1][b[0]-1],m),a(m).jqGrid("setSelection",b[1][b[0]-1]),a.isFunction(d.afterclickPgButtons)&&d.afterclickPgButtons.call(m,"prev",a("#"+g),b[1][b[0]-1]),p(b[0]-1,b));e();return!1});x=t();p(x[0],x)}}})},delGridRow:function(z,d){d=a.extend(!0,{top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,url:"",mtype:"POST",reloadAfterSubmit:!0,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,
jqModal:!0,closeOnEscape:!1,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:!1,serializeDelData:null,useDataProxy:!1},a.jgrid.del,d||{});b[a(this)[0].p.id]=d;return this.each(function(){var e=this;if(e.grid&&z){var k=a.isFunction(b[e.p.id].beforeShowForm),w=a.isFunction(b[e.p.id].afterShowForm),p=a.isFunction(b[e.p.id].beforeInitData)?b[e.p.id].beforeInitData:!1,t=e.p.id,m={},f=!0,g="DelTbl_"+a.jgrid.jqID(t),q,x,c,v,h="DelTbl_"+t,r={themodal:"delmod"+t,modalhead:"delhd"+
t,modalcontent:"delcnt"+t,scrollelm:g};a.isArray(z)&&(z=z.join());if(void 0!==a("#"+a.jgrid.jqID(r.themodal))[0]){p&&(f=p.call(e,a("#"+g)),void 0===f&&(f=!0));if(!1===f)return;a("#DelData>td","#"+g).text(z);a("#DelError","#"+g).hide();!0===b[e.p.id].processing&&(b[e.p.id].processing=!1,a("#dData","#"+g).removeClass("ui-state-active"));k&&b[e.p.id].beforeShowForm.call(e,a("#"+g));a.jgrid.viewModal("#"+a.jgrid.jqID(r.themodal),{gbox:"#gbox_"+a.jgrid.jqID(t),jqm:b[e.p.id].jqModal,jqM:!1,overlay:b[e.p.id].overlay,
modal:b[e.p.id].modal})}else{var n=isNaN(b[e.p.id].dataheight)?b[e.p.id].dataheight:b[e.p.id].dataheight+"px",u=isNaN(d.datawidth)?d.datawidth:d.datawidth+"px",h="<div id='"+h+"' class='formdata' style='width:"+u+";overflow:auto;position:relative;height:"+n+";'><table class='DelTable'><tbody>",h=h+"<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>",h=h+("<tr id='DelData' style='display:none'><td >"+z+"</td></tr>"),h=h+('<tr><td class="delmsg" style="white-space:pre;">'+
b[e.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>"),h=h+"</tbody></table></div>",h=h+("<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+g+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+("<a id='dData' class='fm-button ui-state-default ui-corner-all'>"+d.bSubmit+"</a>")+"&#160;"+("<a id='eData' class='fm-button ui-state-default ui-corner-all'>"+d.bCancel+"</a>")+"</td></tr></tbody></table>");d.gbox="#gbox_"+
a.jgrid.jqID(t);a.jgrid.createModal(r,h,d,"#gview_"+a.jgrid.jqID(e.p.id),a("#gview_"+a.jgrid.jqID(e.p.id))[0]);p&&(f=p.call(e,a(h)),void 0===f&&(f=!0));if(!1===f)return;a(".fm-button","#"+g+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});d.delicon=a.extend([!0,"left","ui-icon-scissors"],b[e.p.id].delicon);d.cancelicon=a.extend([!0,"left","ui-icon-cancel"],b[e.p.id].cancelicon);!0===d.delicon[0]&&a("#dData","#"+g+"_2").addClass("right"===
d.delicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.delicon[2]+"'></span>");!0===d.cancelicon[0]&&a("#eData","#"+g+"_2").addClass("right"===d.cancelicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.cancelicon[2]+"'></span>");a("#dData","#"+g+"_2").click(function(){var f=[!0,""],h,k=a("#DelData>td","#"+g).text();m={};a.isFunction(b[e.p.id].onclickSubmit)&&(m=b[e.p.id].onclickSubmit.call(e,b[e.p.id],k)||{});a.isFunction(b[e.p.id].beforeSubmit)&&
(f=b[e.p.id].beforeSubmit.call(e,k));if(f[0]&&!b[e.p.id].processing){b[e.p.id].processing=!0;c=e.p.prmNames;q=a.extend({},b[e.p.id].delData,m);v=c.oper;q[v]=c.deloper;x=c.id;k=String(k).split(",");if(!k.length)return!1;for(h in k)k.hasOwnProperty(h)&&(k[h]=a.jgrid.stripPref(e.p.idPrefix,k[h]));q[x]=k.join();a(this).addClass("ui-state-active");h=a.extend({url:b[e.p.id].url||a(e).jqGrid("getGridParam","editurl"),type:b[e.p.id].mtype,data:a.isFunction(b[e.p.id].serializeDelData)?b[e.p.id].serializeDelData.call(e,
q):q,complete:function(c,h){var m;a("#dData","#"+g+"_2").removeClass("ui-state-active");300<=c.status&&304!==c.status?(f[0]=!1,a.isFunction(b[e.p.id].errorTextFormat)?f[1]=b[e.p.id].errorTextFormat.call(e,c):f[1]=h+" Status: '"+c.statusText+"'. Error code: "+c.status):a.isFunction(b[e.p.id].afterSubmit)&&(f=b[e.p.id].afterSubmit.call(e,c,q));if(!1===f[0])a("#DelError>td","#"+g).html(f[1]),a("#DelError","#"+g).show();else{if(b[e.p.id].reloadAfterSubmit&&"local"!==e.p.datatype)a(e).trigger("reloadGrid");
else{if(!0===e.p.treeGrid)try{a(e).jqGrid("delTreeNode",e.p.idPrefix+k[0])}catch(n){}else for(m=0;m<k.length;m++)a(e).jqGrid("delRowData",e.p.idPrefix+k[m]);e.p.selrow=null;e.p.selarrrow=[]}a.isFunction(b[e.p.id].afterComplete)&&setTimeout(function(){b[e.p.id].afterComplete.call(e,c,k)},500)}b[e.p.id].processing=!1;f[0]&&a.jgrid.hideModal("#"+a.jgrid.jqID(r.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:d.jqModal,onClose:b[e.p.id].onClose})}},a.jgrid.ajaxOptions,b[e.p.id].ajaxDelOptions);h.url||b[e.p.id].useDataProxy||
(a.isFunction(e.p.dataProxy)?b[e.p.id].useDataProxy=!0:(f[0]=!1,f[1]+=" "+a.jgrid.errors.nourl));f[0]&&(b[e.p.id].useDataProxy?(h=e.p.dataProxy.call(e,h,"del_"+e.p.id),void 0===h&&(h=[!0,""]),!1===h[0]?(f[0]=!1,f[1]=h[1]||"Error deleting the selected row!"):a.jgrid.hideModal("#"+a.jgrid.jqID(r.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:d.jqModal,onClose:b[e.p.id].onClose})):"clientArray"===h.url?(q=h.data,h.complete({status:200,statusText:""},"")):a.ajax(h))}!1===f[0]&&(a("#DelError>td","#"+g).html(f[1]),
a("#DelError","#"+g).show());return!1});a("#eData","#"+g+"_2").click(function(){a.jgrid.hideModal("#"+a.jgrid.jqID(r.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:b[e.p.id].jqModal,onClose:b[e.p.id].onClose});return!1});k&&b[e.p.id].beforeShowForm.call(e,a("#"+g));a.jgrid.viewModal("#"+a.jgrid.jqID(r.themodal),{gbox:"#gbox_"+a.jgrid.jqID(t),jqm:b[e.p.id].jqModal,overlay:b[e.p.id].overlay,modal:b[e.p.id].modal})}w&&b[e.p.id].afterShowForm.call(e,a("#"+g));!0===b[e.p.id].closeOnEscape&&setTimeout(function(){a(".ui-jqdialog-titlebar-close",
"#"+a.jgrid.jqID(r.modalhead)).attr("tabindex","-1").focus()},0)}})},navGrid:function(b,d,e,k,w,p,t){d=a.extend({edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",del:!0,delicon:"ui-icon-trash",search:!0,searchicon:"ui-icon-search",refresh:!0,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:!1,viewicon:"ui-icon-document",position:"left",closeOnEscape:!0,beforeRefresh:null,afterRefresh:null,cloneToTop:!1,alertwidth:200,alertheight:"auto",alerttop:null,alertleft:null,alertzIndex:null},
a.jgrid.nav,d||{});return this.each(function(){if(!this.nav){var m={themodal:"alertmod_"+this.p.id,modalhead:"alerthd_"+this.p.id,modalcontent:"alertcnt_"+this.p.id},f=this,g;if(f.grid&&"string"===typeof b){void 0===a("#"+m.themodal)[0]&&(d.alerttop||d.alertleft||(void 0!==window.innerWidth?(d.alertleft=window.innerWidth,d.alerttop=window.innerHeight):void 0!==document.documentElement&&void 0!==document.documentElement.clientWidth&&0!==document.documentElement.clientWidth?(d.alertleft=document.documentElement.clientWidth,
d.alerttop=document.documentElement.clientHeight):(d.alertleft=1024,d.alerttop=768),d.alertleft=d.alertleft/2-parseInt(d.alertwidth,10)/2,d.alerttop=d.alerttop/2-25),a.jgrid.createModal(m,"<div>"+d.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+a.jgrid.jqID(f.p.id),jqModal:!0,drag:!0,resize:!0,caption:d.alertcap,top:d.alerttop,left:d.alertleft,width:d.alertwidth,height:d.alertheight,closeOnEscape:d.closeOnEscape,zIndex:d.alertzIndex},"#gview_"+
a.jgrid.jqID(f.p.id),a("#gbox_"+a.jgrid.jqID(f.p.id))[0],!0));var q=1,x,c=function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},v=function(){a(this).removeClass("ui-state-hover")};d.cloneToTop&&f.p.toppager&&(q=2);for(x=0;x<q;x++){var h=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),r,n;0===x?(r=b,n=f.p.id,r===f.p.toppager&&(n+="_top",q=1)):(r=f.p.toppager,n=
f.p.id+"_top");"rtl"===f.p.direction&&a(h).attr("dir","rtl").css("float","right");d.add&&(k=k||{},g=a("<td class='ui-pg-button ui-corner-all'></td>"),a(g).append("<div class='ui-pg-div'><span class='ui-icon "+d.addicon+"'></span>"+d.addtext+"</div>"),a("tr",h).append(g),a(g,h).attr({title:d.addtitle||"",id:k.id||"add_"+n}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(d.addfunc)?d.addfunc.call(f):a(f).jqGrid("editGridRow","new",k));return!1}).hover(c,v),g=null);d.edit&&(g=
a("<td class='ui-pg-button ui-corner-all'></td>"),e=e||{},a(g).append("<div class='ui-pg-div'><span class='ui-icon "+d.editicon+"'></span>"+d.edittext+"</div>"),a("tr",h).append(g),a(g,h).attr({title:d.edittitle||"",id:e.id||"edit_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=f.p.selrow;b?a.isFunction(d.editfunc)?d.editfunc.call(f,b):a(f).jqGrid("editGridRow",b,e):(a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+a.jgrid.jqID(f.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(c,
v),g=null);d.view&&(g=a("<td class='ui-pg-button ui-corner-all'></td>"),t=t||{},a(g).append("<div class='ui-pg-div'><span class='ui-icon "+d.viewicon+"'></span>"+d.viewtext+"</div>"),a("tr",h).append(g),a(g,h).attr({title:d.viewtitle||"",id:t.id||"view_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=f.p.selrow;b?a.isFunction(d.viewfunc)?d.viewfunc.call(f,b):a(f).jqGrid("viewGridRow",b,t):(a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+a.jgrid.jqID(f.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(c,
v),g=null);d.del&&(g=a("<td class='ui-pg-button ui-corner-all'></td>"),w=w||{},a(g).append("<div class='ui-pg-div'><span class='ui-icon "+d.delicon+"'></span>"+d.deltext+"</div>"),a("tr",h).append(g),a(g,h).attr({title:d.deltitle||"",id:w.id||"del_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b;f.p.multiselect?(b=f.p.selarrrow,0===b.length&&(b=null)):b=f.p.selrow;b?a.isFunction(d.delfunc)?d.delfunc.call(f,b):a(f).jqGrid("delGridRow",b,w):(a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+
a.jgrid.jqID(f.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(c,v),g=null);(d.add||d.edit||d.del||d.view)&&a("tr",h).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");d.search&&(g=a("<td class='ui-pg-button ui-corner-all'></td>"),p=p||{},a(g).append("<div class='ui-pg-div'><span class='ui-icon "+d.searchicon+"'></span>"+d.searchtext+"</div>"),a("tr",h).append(g),a(g,h).attr({title:d.searchtitle||"",id:p.id||"search_"+n}).click(function(){a(this).hasClass("ui-state-disabled")||
(a.isFunction(d.searchfunc)?d.searchfunc.call(f,p):a(f).jqGrid("searchGrid",p));return!1}).hover(c,v),p.showOnLoad&&!0===p.showOnLoad&&a(g,h).click(),g=null);d.refresh&&(g=a("<td class='ui-pg-button ui-corner-all'></td>"),a(g).append("<div class='ui-pg-div'><span class='ui-icon "+d.refreshicon+"'></span>"+d.refreshtext+"</div>"),a("tr",h).append(g),a(g,h).attr({title:d.refreshtitle||"",id:"refresh_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(d.beforeRefresh)&&d.beforeRefresh.call(f);
f.p.search=!1;f.p.resetsearch=!0;try{if("currentfilter"!==d.refreshstate){var b=f.p.id;f.p.postData.filters="";try{a("#fbox_"+a.jgrid.jqID(b)).jqFilter("resetFilter")}catch(c){}a.isFunction(f.clearToolbar)&&f.clearToolbar.call(f,!1)}}catch(e){}switch(d.refreshstate){case "firstpage":a(f).trigger("reloadGrid",[{page:1}]);break;case "current":case "currentfilter":a(f).trigger("reloadGrid",[{current:!0}])}a.isFunction(d.afterRefresh)&&d.afterRefresh.call(f)}return!1}).hover(c,v),g=null);g=a(".ui-jqgrid").css("font-size")||
"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+g+";visibility:hidden;' ></div>");g=a(h).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(r+"_"+d.position,r).append(h);f.p._nvtd&&(g>f.p._nvtd[0]&&(a(r+"_"+d.position,r).width(g),f.p._nvtd[0]=g),f.p._nvtd[1]=g);h=g=g=null;this.nav=!0}}}})},navButtonAdd:function(b,d){d=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},
d||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(b));var e=a(".navtable",b)[0],k=this;if(e&&(!d.id||void 0===a("#"+a.jgrid.jqID(d.id),e)[0])){var w=a("<td></td>");"NONE"===d.buttonicon.toString().toUpperCase()?a(w).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+d.caption+"</div>"):a(w).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+d.buttonicon+"'></span>"+d.caption+
"</div>");d.id&&a(w).attr("id",d.id);"first"===d.position?0===e.rows[0].cells.length?a("tr",e).append(w):a("tr td:eq(0)",e).before(w):a("tr",e).append(w);a(w,e).attr("title",d.title||"").click(function(b){a(this).hasClass("ui-state-disabled")||a.isFunction(d.onClickButton)&&d.onClickButton.call(k,b);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(b,d){d=a.extend({sepclass:"ui-separator",
sepcontent:"",position:"last"},d||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(b));var e=a(".navtable",b)[0];if(e){var k="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+d.sepclass+"'></span>"+d.sepcontent+"</td>";"first"===d.position?0===e.rows[0].cells.length?a("tr",e).append(k):a("tr td:eq(0)",e).before(k):a("tr",e).append(k)}}})},GridToForm:function(b,d){return this.each(function(){var e=this,k;if(e.grid){var w=
a(e).jqGrid("getRowData",b);if(w)for(k in w)w.hasOwnProperty(k)&&(a("[name="+a.jgrid.jqID(k)+"]",d).is("input:radio")||a("[name="+a.jgrid.jqID(k)+"]",d).is("input:checkbox")?a("[name="+a.jgrid.jqID(k)+"]",d).each(function(){if(a(this).val()==w[k])a(this)[e.p.useProp?"prop":"attr"]("checked",!0);else a(this)[e.p.useProp?"prop":"attr"]("checked",!1)}):a("[name="+a.jgrid.jqID(k)+"]",d).val(w[k]))}})},FormToGrid:function(b,d,e,k){return this.each(function(){if(this.grid){e||(e="set");k||(k="first");var w=
a(d).serializeArray(),p={};a.each(w,function(a,b){p[b.name]=b.value});"add"===e?a(this).jqGrid("addRowData",b,p,k):"set"===e&&a(this).jqGrid("setRowData",b,p)}})}})})(jQuery);
(function(a){a.fn.jqFilter=function(d){if("string"===typeof d){var q=a.fn.jqFilter[d];if(!q)throw"jqFilter - No such method: "+d;var x=a.makeArray(arguments).slice(1);return q.apply(this,x)}var n=a.extend(!0,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:!1,errmsg:"",errorcheck:!0,showQuery:!0,sopt:null,ops:[],operands:null,numopts:"eq ne lt le gt ge nu nn in ni".split(" "),stropts:"eq ne bw bn ew en cn nc nu nn in ni".split(" "),strarr:["text","string","blob"],groupOps:[{op:"AND",
text:"AND"},{op:"OR",text:"OR"}],groupButton:!0,ruleButtons:!0,direction:"ltr"},a.jgrid.filter,d||{});return this.each(function(){if(!this.filter){this.p=n;if(null===this.p.filter||void 0===this.p.filter)this.p.filter={groupOp:this.p.groupOps[0].op,rules:[],groups:[]};var d,q=this.p.columns.length,f,w=/msie/i.test(navigator.userAgent)&&!window.opera;this.p.initFilter=a.extend(!0,{},this.p.filter);if(q){for(d=0;d<q;d++)f=this.p.columns[d],f.stype?f.inputtype=f.stype:f.inputtype||(f.inputtype="text"),
f.sorttype?f.searchtype=f.sorttype:f.searchtype||(f.searchtype="string"),void 0===f.hidden&&(f.hidden=!1),f.label||(f.label=f.name),f.index&&(f.name=f.index),f.hasOwnProperty("searchoptions")||(f.searchoptions={}),f.hasOwnProperty("searchrules")||(f.searchrules={});this.p.showQuery&&a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='"+this.p.direction+"'><tbody><tr><td class='query'></td></tr></tbody></table>");var u=
function(g,l){var b=[!0,""],c=a("#"+a.jgrid.jqID(n.id))[0]||null;if(a.isFunction(l.searchrules))b=l.searchrules.call(c,g,l);else if(a.jgrid&&a.jgrid.checkValues)try{b=a.jgrid.checkValues.call(c,g,-1,l.searchrules,l.label)}catch(m){}b&&b.length&&!1===b[0]&&(n.error=!b[0],n.errmsg=b[1])};this.onchange=function(){this.p.error=!1;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):!1};this.reDraw=function(){a("table.group:first",this).remove();var g=this.createTableForGroup(n.filter,
null);a(this).append(g);a.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this,this.p)};this.createTableForGroup=function(g,l){var b=this,c,m=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),e="left";"rtl"===this.p.direction&&(e="right",m.attr("dir","rtl"));null===l&&m.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+e+"'></th></tr>");var h=a("<tr></tr>");m.append(h);e=a("<th colspan='5' align='"+
e+"'></th>");h.append(e);if(!0===this.p.ruleButtons){var d=a("<select class='opsel'></select>");e.append(d);var h="",k;for(c=0;c<n.groupOps.length;c++)k=g.groupOp===b.p.groupOps[c].op?" selected='selected'":"",h+="<option value='"+b.p.groupOps[c].op+"'"+k+">"+b.p.groupOps[c].text+"</option>";d.append(h).bind("change",function(){g.groupOp=a(d).val();b.onchange()})}h="<span></span>";this.p.groupButton&&(h=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),h.bind("click",
function(){void 0===g.groups&&(g.groups=[]);g.groups.push({groupOp:n.groupOps[0].op,rules:[],groups:[]});b.reDraw();b.onchange();return!1}));e.append(h);if(!0===this.p.ruleButtons){var h=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),f;h.bind("click",function(){void 0===g.rules&&(g.rules=[]);for(c=0;c<b.p.columns.length;c++){var e=void 0===b.p.columns[c].search?!0:b.p.columns[c].search,l=!0===b.p.columns[c].hidden;if(!0===b.p.columns[c].searchoptions.searchhidden&&
e||e&&!l){f=b.p.columns[c];break}}e=f.searchoptions.sopt?f.searchoptions.sopt:b.p.sopt?b.p.sopt:-1!==a.inArray(f.searchtype,b.p.strarr)?b.p.stropts:b.p.numopts;g.rules.push({field:f.name,op:e[0],data:""});b.reDraw();return!1});e.append(h)}null!==l&&(h=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),e.append(h),h.bind("click",function(){for(c=0;c<l.groups.length;c++)if(l.groups[c]===g){l.groups.splice(c,1);break}b.reDraw();b.onchange();return!1}));if(void 0!==g.groups)for(c=
0;c<g.groups.length;c++)e=a("<tr></tr>"),m.append(e),h=a("<td class='first'></td>"),e.append(h),h=a("<td colspan='4'></td>"),h.append(this.createTableForGroup(g.groups[c],g)),e.append(h);void 0===g.groupOp&&(g.groupOp=b.p.groupOps[0].op);if(void 0!==g.rules)for(c=0;c<g.rules.length;c++)m.append(this.createTableRowForRule(g.rules[c],g));return m};this.createTableRowForRule=function(g,l){var b=this,c=a("#"+a.jgrid.jqID(n.id))[0]||null,m=a("<tr></tr>"),e,h,f,k,d="",s;m.append("<td class='first'></td>");
var p=a("<td class='columns'></td>");m.append(p);var q=a("<select></select>"),r,t=[];p.append(q);q.bind("change",function(){g.field=a(q).val();f=a(this).parents("tr:first");for(e=0;e<b.p.columns.length;e++)if(b.p.columns[e].name===g.field){k=b.p.columns[e];break}if(k){k.searchoptions.id=a.jgrid.randId();w&&"text"===k.inputtype&&!k.searchoptions.size&&(k.searchoptions.size=10);var d=a.jgrid.createEl.call(c,k.inputtype,k.searchoptions,"",!0,b.p.ajaxSelectOptions||{},!0);a(d).addClass("input-elm");h=
k.searchoptions.sopt?k.searchoptions.sopt:b.p.sopt?b.p.sopt:-1!==a.inArray(k.searchtype,b.p.strarr)?b.p.stropts:b.p.numopts;var l="",m=0;t=[];a.each(b.p.ops,function(){t.push(this.oper)});for(e=0;e<h.length;e++)r=a.inArray(h[e],t),-1!==r&&(0===m&&(g.op=b.p.ops[r].oper),l+="<option value='"+b.p.ops[r].oper+"'>"+b.p.ops[r].text+"</option>",m++);a(".selectopts",f).empty().append(l);a(".selectopts",f)[0].selectedIndex=0;a.jgrid.msie&&9>a.jgrid.msiever()&&(l=parseInt(a("select.selectopts",f)[0].offsetWidth,
10)+1,a(".selectopts",f).width(l),a(".selectopts",f).css("width","auto"));a(".data",f).empty().append(d);a.jgrid.bindEv.call(c,d,k.searchoptions);a(".input-elm",f).bind("change",function(e){e=e.target;g.data="SPAN"===e.nodeName.toUpperCase()&&k.searchoptions&&a.isFunction(k.searchoptions.custom_value)?k.searchoptions.custom_value.call(c,a(e).children(".customelement:first"),"get"):e.value;b.onchange()});setTimeout(function(){g.data=a(d).val();b.onchange()},0)}});for(e=p=0;e<b.p.columns.length;e++){s=
void 0===b.p.columns[e].search?!0:b.p.columns[e].search;var u=!0===b.p.columns[e].hidden;if(!0===b.p.columns[e].searchoptions.searchhidden&&s||s&&!u)s="",g.field===b.p.columns[e].name&&(s=" selected='selected'",p=e),d+="<option value='"+b.p.columns[e].name+"'"+s+">"+b.p.columns[e].label+"</option>"}q.append(d);d=a("<td class='operators'></td>");m.append(d);k=n.columns[p];k.searchoptions.id=a.jgrid.randId();w&&"text"===k.inputtype&&!k.searchoptions.size&&(k.searchoptions.size=10);p=a.jgrid.createEl.call(c,
k.inputtype,k.searchoptions,g.data,!0,b.p.ajaxSelectOptions||{},!0);if("nu"===g.op||"nn"===g.op)a(p).attr("readonly","true"),a(p).attr("disabled","true");var v=a("<select class='selectopts'></select>");d.append(v);v.bind("change",function(){g.op=a(v).val();f=a(this).parents("tr:first");var c=a(".input-elm",f)[0];"nu"===g.op||"nn"===g.op?(g.data="","SELECT"!==c.tagName.toUpperCase()&&(c.value=""),c.setAttribute("readonly","true"),c.setAttribute("disabled","true")):("SELECT"===c.tagName.toUpperCase()&&
(g.data=c.value),c.removeAttribute("readonly"),c.removeAttribute("disabled"));b.onchange()});h=k.searchoptions.sopt?k.searchoptions.sopt:b.p.sopt?b.p.sopt:-1!==a.inArray(k.searchtype,b.p.strarr)?b.p.stropts:b.p.numopts;d="";a.each(b.p.ops,function(){t.push(this.oper)});for(e=0;e<h.length;e++)r=a.inArray(h[e],t),-1!==r&&(s=g.op===b.p.ops[r].oper?" selected='selected'":"",d+="<option value='"+b.p.ops[r].oper+"'"+s+">"+b.p.ops[r].text+"</option>");v.append(d);d=a("<td class='data'></td>");m.append(d);
d.append(p);a.jgrid.bindEv.call(c,p,k.searchoptions);a(p).addClass("input-elm").bind("change",function(){g.data="custom"===k.inputtype?k.searchoptions.custom_value.call(c,a(this).children(".customelement:first"),"get"):a(this).val();b.onchange()});d=a("<td></td>");m.append(d);!0===this.p.ruleButtons&&(p=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"),d.append(p),p.bind("click",function(){for(e=0;e<l.rules.length;e++)if(l.rules[e]===g){l.rules.splice(e,1);break}b.reDraw();
b.onchange();return!1}));return m};this.getStringForGroup=function(a){var d="(",b;if(void 0!==a.groups)for(b=0;b<a.groups.length;b++){1<d.length&&(d+=" "+a.groupOp+" ");try{d+=this.getStringForGroup(a.groups[b])}catch(c){alert(c)}}if(void 0!==a.rules)try{for(b=0;b<a.rules.length;b++)1<d.length&&(d+=" "+a.groupOp+" "),d+=this.getStringForRule(a.rules[b])}catch(f){alert(f)}d+=")";return"()"===d?"":d};this.getStringForRule=function(d){var f="",b="",c,m;for(c=0;c<this.p.ops.length;c++)if(this.p.ops[c].oper===
d.op){f=this.p.operands.hasOwnProperty(d.op)?this.p.operands[d.op]:"";b=this.p.ops[c].oper;break}for(c=0;c<this.p.columns.length;c++)if(this.p.columns[c].name===d.field){m=this.p.columns[c];break}if(void 0==m)return"";c=d.data;if("bw"===b||"bn"===b)c+="%";if("ew"===b||"en"===b)c="%"+c;if("cn"===b||"nc"===b)c="%"+c+"%";if("in"===b||"ni"===b)c=" ("+c+")";n.errorcheck&&u(d.data,m);return-1!==a.inArray(m.searchtype,["int","integer","float","number","currency"])||"nn"===b||"nu"===b?d.field+" "+f+" "+c:
d.field+" "+f+' "'+c+'"'};this.resetFilter=function(){this.p.filter=a.extend(!0,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){a("th.ui-state-error",this).html("");a("tr.error",this).hide()};this.showError=function(){a("th.ui-state-error",this).html(this.p.errmsg);a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(n.filter)};this.toString=function(){function a(b){var c="(",f;if(void 0!==b.groups)for(f=0;f<b.groups.length;f++)1<
c.length&&(c="OR"===b.groupOp?c+" || ":c+" && "),c+=a(b.groups[f]);if(void 0!==b.rules)for(f=0;f<b.rules.length;f++){1<c.length&&(c="OR"===b.groupOp?c+" || ":c+" && ");var e=b.rules[f];if(d.p.errorcheck){for(var h=void 0,n=void 0,h=0;h<d.p.columns.length;h++)if(d.p.columns[h].name===e.field){n=d.p.columns[h];break}n&&u(e.data,n)}c+=e.op+"(item."+e.field+",'"+e.data+"')"}c+=")";return"()"===c?"":c}var d=this;return a(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=!0}}})};
a.extend(a.fn.jqFilter,{toSQLString:function(){var a="";this.each(function(){a=this.toUserFriendlyString()});return a},filterData:function(){var a;this.each(function(){a=this.p.filter});return a},getParameter:function(a){return void 0!==a&&this.p.hasOwnProperty(a)?this.p[a]:this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(d){"string"===typeof d&&(d=a.jgrid.parse(d));this.each(function(){this.p.filter=d;this.reDraw();this.onchange()})}})})(jQuery);
(function(a){a.jgrid.inlineEdit=a.jgrid.inlineEdit||{};a.jgrid.extend({editRow:function(c,e,b,m,l,n,q,g,d){var h={},f=a.makeArray(arguments).slice(1);"object"===a.type(f[0])?h=f[0]:(void 0!==e&&(h.keys=e),a.isFunction(b)&&(h.oneditfunc=b),a.isFunction(m)&&(h.successfunc=m),void 0!==l&&(h.url=l),void 0!==n&&(h.extraparam=n),a.isFunction(q)&&(h.aftersavefunc=q),a.isFunction(g)&&(h.errorfunc=g),a.isFunction(d)&&(h.afterrestorefunc=d));h=a.extend(!0,{keys:!1,oneditfunc:null,successfunc:null,url:null,
extraparam:{},aftersavefunc:null,errorfunc:null,afterrestorefunc:null,restoreAfterError:!0,mtype:"POST",focusField:!0},a.jgrid.inlineEdit,h);return this.each(function(){var d=this,f,e,b,g=0,l=null,n={},m,p;d.grid&&(m=a(d).jqGrid("getInd",c,!0),!1!==m&&(b=a.isFunction(h.beforeEditRow)?h.beforeEditRow.call(d,h,c):void 0,void 0===b&&(b=!0),b&&(b=a(m).attr("editable")||"0","0"!==b||a(m).hasClass("not-editable-row")||(p=d.p.colModel,a('td[role="gridcell"]',m).each(function(b){f=p[b].name;var h=!0===d.p.treeGrid&&
f===d.p.ExpandColumn;if(h)e=a("span:first",this).html();else try{e=a.unformat.call(d,this,{rowId:c,colModel:p[b]},b)}catch(m){e=p[b].edittype&&"textarea"===p[b].edittype?a(this).text():a(this).html()}if("cb"!==f&&"subgrid"!==f&&"rn"!==f&&(d.p.autoencode&&(e=a.jgrid.htmlDecode(e)),n[f]=e,!0===p[b].editable)){null===l&&(l=b);h?a("span:first",this).html(""):a(this).html("");var q=a.extend({},p[b].editoptions||{},{id:c+"_"+f,name:f,rowId:c});p[b].edittype||(p[b].edittype="text");if("&nbsp;"===e||"&#160;"===
e||1===e.length&&160===e.charCodeAt(0))e="";var x=a.jgrid.createEl.call(d,p[b].edittype,q,e,!0,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));a(x).addClass("editable");h?a("span:first",this).append(x):a(this).append(x);a.jgrid.bindEv.call(d,x,q);"select"===p[b].edittype&&void 0!==p[b].editoptions&&!0===p[b].editoptions.multiple&&void 0===p[b].editoptions.dataUrl&&a.jgrid.msie&&a(x).width(a(x).width());g++}}),0<g&&(n.id=c,d.p.savedRow.push(n),a(m).attr("editable","1"),h.focusField&&("number"===
typeof h.focusField&&parseInt(h.focusField,10)<=p.length&&(l=h.focusField),setTimeout(function(){var d=a("td:eq("+l+") :input:visible",m).not(":disabled");0<d.length&&d.focus()},0)),!0===h.keys&&a(m).bind("keydown",function(b){if(27===b.keyCode){a(d).jqGrid("restoreRow",c,h.afterrestorefunc);if(d.p._inlinenav)try{a(d).jqGrid("showAddEditButtons")}catch(f){}return!1}if(13===b.keyCode){if("TEXTAREA"===b.target.tagName)return!0;if(a(d).jqGrid("saveRow",c,h)&&d.p._inlinenav)try{a(d).jqGrid("showAddEditButtons")}catch(e){}return!1}}),
a(d).triggerHandler("jqGridInlineEditRow",[c,h]),a.isFunction(h.oneditfunc)&&h.oneditfunc.call(d,c))))))})},saveRow:function(c,e,b,m,l,n,q){var g=a.makeArray(arguments).slice(1),d={};"object"===a.type(g[0])?d=g[0]:(a.isFunction(e)&&(d.successfunc=e),void 0!==b&&(d.url=b),void 0!==m&&(d.extraparam=m),a.isFunction(l)&&(d.aftersavefunc=l),a.isFunction(n)&&(d.errorfunc=n),a.isFunction(q)&&(d.afterrestorefunc=q));var d=a.extend(!0,{successfunc:null,url:null,extraparam:{},aftersavefunc:null,errorfunc:null,
afterrestorefunc:null,restoreAfterError:!0,mtype:"POST",saveui:"enable",savetext:a.jgrid.defaults.savetext||"Saving..."},a.jgrid.inlineEdit,d),h=!1,f=this[0],r,k={},y={},v={},w,z,u;if(!f.grid)return h;u=a(f).jqGrid("getInd",c,!0);if(!1===u)return h;g=a.isFunction(d.beforeSaveRow)?d.beforeSaveRow.call(f,d,c):void 0;void 0===g&&(g=!0);if(g){g=a(u).attr("editable");d.url=d.url||f.p.editurl;if("1"===g){var t;a('td[role="gridcell"]',u).each(function(c){t=f.p.colModel[c];r=t.name;if("cb"!==r&&"subgrid"!==
r&&!0===t.editable&&"rn"!==r&&!a(this).hasClass("not-editable-cell")){switch(t.edittype){case "checkbox":var b=["Yes","No"];t.editoptions&&(b=t.editoptions.value.split(":"));k[r]=a("input",this).is(":checked")?b[0]:b[1];break;case "text":case "password":case "textarea":case "button":k[r]=a("input, textarea",this).val();break;case "select":if(t.editoptions.multiple){var b=a("select",this),e=[];k[r]=a(b).val();k[r]=k[r]?k[r].join(","):"";a("select option:selected",this).each(function(d,c){e[d]=a(c).text()});
y[r]=e.join(",")}else k[r]=a("select option:selected",this).val(),y[r]=a("select option:selected",this).text();t.formatter&&"select"===t.formatter&&(y={});break;case "custom":try{if(t.editoptions&&a.isFunction(t.editoptions.custom_value)){if(k[r]=t.editoptions.custom_value.call(f,a(".customelement",this),"get"),void 0===k[r])throw"e2";}else throw"e1";}catch(g){"e1"===g&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===g?a.jgrid.info_dialog(a.jgrid.errors.errcap,
"function 'custom_value' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,g.message,a.jgrid.edit.bClose)}}z=a.jgrid.checkValues.call(f,k[r],c);if(!1===z[0])return!1;f.p.autoencode&&(k[r]=a.jgrid.htmlEncode(k[r]));"clientArray"!==d.url&&t.editoptions&&!0===t.editoptions.NullIfEmpty&&""===k[r]&&(v[r]="null")}});if(!1===z[0]){try{var p=a(f).jqGrid("getGridRowById",c),s=a.jgrid.findPos(p);a.jgrid.info_dialog(a.jgrid.errors.errcap,z[1],a.jgrid.edit.bClose,{left:s[0],
top:s[1]+a(p).outerHeight()})}catch(A){alert(z[1])}return h}g=f.p.prmNames;p=c;s=!1===f.p.keyName?g.id:f.p.keyName;k&&(k[g.oper]=g.editoper,void 0===k[s]||""===k[s]?k[s]=c:u.id!==f.p.idPrefix+k[s]&&(g=a.jgrid.stripPref(f.p.idPrefix,c),void 0!==f.p._index[g]&&(f.p._index[k[s]]=f.p._index[g],delete f.p._index[g]),c=f.p.idPrefix+k[s],a(u).attr("id",c),f.p.selrow===p&&(f.p.selrow=c),a.isArray(f.p.selarrrow)&&(g=a.inArray(p,f.p.selarrrow),0<=g&&(f.p.selarrrow[g]=c)),f.p.multiselect&&(g="jqg_"+f.p.id+"_"+
c,a("input.cbox",u).attr("id",g).attr("name",g))),void 0===f.p.inlineData&&(f.p.inlineData={}),k=a.extend({},k,f.p.inlineData,d.extraparam));if("clientArray"===d.url){k=a.extend({},k,y);f.p.autoencode&&a.each(k,function(d,c){k[d]=a.jgrid.htmlDecode(c)});g=a(f).jqGrid("setRowData",c,k);a(u).attr("editable","0");for(s=0;s<f.p.savedRow.length;s++)if(String(f.p.savedRow[s].id)===String(p)){w=s;break}0<=w&&f.p.savedRow.splice(w,1);a(f).triggerHandler("jqGridInlineAfterSaveRow",[c,g,k,d]);a.isFunction(d.aftersavefunc)&&
d.aftersavefunc.call(f,c,g,k,d);h=!0;a(u).removeClass("jqgrid-new-row").unbind("keydown")}else a(f).jqGrid("progressBar",{method:"show",loadtype:d.saveui,htmlcontent:d.savetext}),v=a.extend({},k,v),v[s]=a.jgrid.stripPref(f.p.idPrefix,v[s]),a.ajax(a.extend({url:d.url,data:a.isFunction(f.p.serializeRowData)?f.p.serializeRowData.call(f,v):v,type:d.mtype,async:!1,complete:function(b,e){a(f).jqGrid("progressBar",{method:"hide",loadtype:d.saveui,htmlcontent:d.savetext});if("success"===e){var g=!0,l;l=a(f).triggerHandler("jqGridInlineSuccessSaveRow",
[b,c,d]);a.isArray(l)||(l=[!0,k]);l[0]&&a.isFunction(d.successfunc)&&(l=d.successfunc.call(f,b));a.isArray(l)?(g=l[0],k=l[1]||k):g=l;if(!0===g){f.p.autoencode&&a.each(k,function(d,b){k[d]=a.jgrid.htmlDecode(b)});k=a.extend({},k,y);a(f).jqGrid("setRowData",c,k);a(u).attr("editable","0");for(g=0;g<f.p.savedRow.length;g++)if(String(f.p.savedRow[g].id)===String(c)){w=g;break}0<=w&&f.p.savedRow.splice(w,1);a(f).triggerHandler("jqGridInlineAfterSaveRow",[c,b,k,d]);a.isFunction(d.aftersavefunc)&&d.aftersavefunc.call(f,
c,b,k,d);h=!0;a(u).removeClass("jqgrid-new-row").unbind("keydown")}else a(f).triggerHandler("jqGridInlineErrorSaveRow",[c,b,e,null,d]),a.isFunction(d.errorfunc)&&d.errorfunc.call(f,c,b,e,null),!0===d.restoreAfterError&&a(f).jqGrid("restoreRow",c,d.afterrestorefunc)}},error:function(b,e,g){a("#lui_"+a.jgrid.jqID(f.p.id)).hide();a(f).triggerHandler("jqGridInlineErrorSaveRow",[c,b,e,g,d]);if(a.isFunction(d.errorfunc))d.errorfunc.call(f,c,b,e,g);else{b=b.responseText||b.statusText;try{a.jgrid.info_dialog(a.jgrid.errors.errcap,
'<div class="ui-state-error">'+b+"</div>",a.jgrid.edit.bClose,{buttonalign:"right"})}catch(l){alert(b)}}!0===d.restoreAfterError&&a(f).jqGrid("restoreRow",c,d.afterrestorefunc)}},a.jgrid.ajaxOptions,f.p.ajaxRowOptions||{}))}return h}},restoreRow:function(c,e){var b=a.makeArray(arguments).slice(1),m={};"object"===a.type(b[0])?m=b[0]:a.isFunction(e)&&(m.afterrestorefunc=e);m=a.extend(!0,{},a.jgrid.inlineEdit,m);return this.each(function(){var b=this,e=-1,q,g={},d;if(b.grid&&(q=a(b).jqGrid("getInd",
c,!0),!1!==q&&(d=a.isFunction(m.beforeCancelRow)?m.beforeCancelRow.call(b,m,c):void 0,void 0===d&&(d=!0),d))){for(d=0;d<b.p.savedRow.length;d++)if(String(b.p.savedRow[d].id)===String(c)){e=d;break}if(0<=e){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(q.id)).datepicker("hide")}catch(h){}a.each(b.p.colModel,function(){!0===this.editable&&b.p.savedRow[e].hasOwnProperty(this.name)&&(g[this.name]=b.p.savedRow[e][this.name])});a(b).jqGrid("setRowData",c,g);a(q).attr("editable",
"0").unbind("keydown");b.p.savedRow.splice(e,1);a("#"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(b.p.id)).hasClass("jqgrid-new-row")&&setTimeout(function(){a(b).jqGrid("delRowData",c);a(b).jqGrid("showAddEditButtons")},0)}a(b).triggerHandler("jqGridInlineAfterRestoreRow",[c]);a.isFunction(m.afterrestorefunc)&&m.afterrestorefunc.call(b,c)}})},addRow:function(c){c=a.extend(!0,{rowID:null,initdata:{},position:"first",useDefValues:!0,useFormatter:!1,addRowParams:{extraparam:{}}},c||{});return this.each(function(){if(this.grid){var e=
this,b=a.isFunction(c.beforeAddRow)?c.beforeAddRow.call(e,c.addRowParams):void 0;void 0===b&&(b=!0);b&&(c.rowID=a.isFunction(c.rowID)?c.rowID.call(e,c):null!=c.rowID?c.rowID:a.jgrid.randId(),!0===c.useDefValues&&a(e.p.colModel).each(function(){if(this.editoptions&&this.editoptions.defaultValue){var b=this.editoptions.defaultValue,b=a.isFunction(b)?b.call(e):b;c.initdata[this.name]=b}}),a(e).jqGrid("addRowData",c.rowID,c.initdata,c.position),c.rowID=e.p.idPrefix+c.rowID,a("#"+a.jgrid.jqID(c.rowID),
"#"+a.jgrid.jqID(e.p.id)).addClass("jqgrid-new-row"),c.useFormatter?a("#"+a.jgrid.jqID(c.rowID)+" .ui-inline-edit","#"+a.jgrid.jqID(e.p.id)).click():(b=e.p.prmNames,c.addRowParams.extraparam[b.oper]=b.addoper,a(e).jqGrid("editRow",c.rowID,c.addRowParams),a(e).jqGrid("setSelection",c.rowID)))}})},inlineNav:function(c,e){e=a.extend(!0,{edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",save:!0,saveicon:"ui-icon-disk",cancel:!0,cancelicon:"ui-icon-cancel",addParams:{addRowParams:{extraparam:{}}},
editParams:{},restoreAfterSelect:!0},a.jgrid.nav,e||{});return this.each(function(){if(this.grid){var b=this,m,l=a.jgrid.jqID(b.p.id);b.p._inlinenav=!0;if(!0===e.addParams.useFormatter){var n=b.p.colModel,q;for(q=0;q<n.length;q++)if(n[q].formatter&&"actions"===n[q].formatter){n[q].formatoptions&&(n=a.extend({keys:!1,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{},url:null},n[q].formatoptions),e.addParams.addRowParams={keys:n.keys,oneditfunc:n.onEdit,successfunc:n.onSuccess,
url:n.url,extraparam:n.extraparam,aftersavefunc:n.afterSave,errorfunc:n.onError,afterrestorefunc:n.afterRestore});break}}e.add&&a(b).jqGrid("navButtonAdd",c,{caption:e.addtext,title:e.addtitle,buttonicon:e.addicon,id:b.p.id+"_iladd",onClickButton:function(){a(b).jqGrid("addRow",e.addParams);e.addParams.useFormatter||(a("#"+l+"_ilsave").removeClass("ui-state-disabled"),a("#"+l+"_ilcancel").removeClass("ui-state-disabled"),a("#"+l+"_iladd").addClass("ui-state-disabled"),a("#"+l+"_iledit").addClass("ui-state-disabled"))}});
e.edit&&a(b).jqGrid("navButtonAdd",c,{caption:e.edittext,title:e.edittitle,buttonicon:e.editicon,id:b.p.id+"_iledit",onClickButton:function(){var c=a(b).jqGrid("getGridParam","selrow");c?(a(b).jqGrid("editRow",c,e.editParams),a("#"+l+"_ilsave").removeClass("ui-state-disabled"),a("#"+l+"_ilcancel").removeClass("ui-state-disabled"),a("#"+l+"_iladd").addClass("ui-state-disabled"),a("#"+l+"_iledit").addClass("ui-state-disabled")):(a.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+l,jqm:!0}),a("#jqg_alrt").focus())}});
e.save&&(a(b).jqGrid("navButtonAdd",c,{caption:e.savetext||"",title:e.savetitle||"Save row",buttonicon:e.saveicon,id:b.p.id+"_ilsave",onClickButton:function(){var c=b.p.savedRow[0].id;if(c){var d=b.p.prmNames,h=d.oper,f=e.editParams;a("#"+a.jgrid.jqID(c),"#"+l).hasClass("jqgrid-new-row")?(e.addParams.addRowParams.extraparam[h]=d.addoper,f=e.addParams.addRowParams):(e.editParams.extraparam||(e.editParams.extraparam={}),e.editParams.extraparam[h]=d.editoper);a(b).jqGrid("saveRow",c,f)&&a(b).jqGrid("showAddEditButtons")}else a.jgrid.viewModal("#alertmod",
{gbox:"#gbox_"+l,jqm:!0}),a("#jqg_alrt").focus()}}),a("#"+l+"_ilsave").addClass("ui-state-disabled"));e.cancel&&(a(b).jqGrid("navButtonAdd",c,{caption:e.canceltext||"",title:e.canceltitle||"Cancel row editing",buttonicon:e.cancelicon,id:b.p.id+"_ilcancel",onClickButton:function(){var c=b.p.savedRow[0].id,d=e.editParams;c?(a("#"+a.jgrid.jqID(c),"#"+l).hasClass("jqgrid-new-row")&&(d=e.addParams.addRowParams),a(b).jqGrid("restoreRow",c,d),a(b).jqGrid("showAddEditButtons")):(a.jgrid.viewModal("#alertmod",
{gbox:"#gbox_"+l,jqm:!0}),a("#jqg_alrt").focus())}}),a("#"+l+"_ilcancel").addClass("ui-state-disabled"));!0===e.restoreAfterSelect&&(m=a.isFunction(b.p.beforeSelectRow)?b.p.beforeSelectRow:!1,b.p.beforeSelectRow=function(c,d){var h=!0;0<b.p.savedRow.length&&!0===b.p._inlinenav&&c!==b.p.selrow&&null!==b.p.selrow&&(b.p.selrow===e.addParams.rowID?a(b).jqGrid("delRowData",b.p.selrow):a(b).jqGrid("restoreRow",b.p.selrow,e.editParams),a(b).jqGrid("showAddEditButtons"));m&&(h=m.call(b,c,d));return h})}})},
showAddEditButtons:function(){return this.each(function(){if(this.grid){var c=a.jgrid.jqID(this.p.id);a("#"+c+"_ilsave").addClass("ui-state-disabled");a("#"+c+"_ilcancel").addClass("ui-state-disabled");a("#"+c+"_iladd").removeClass("ui-state-disabled");a("#"+c+"_iledit").removeClass("ui-state-disabled")}})}})})(jQuery);
(function(b){b.jgrid.extend({editCell:function(d,f,a){return this.each(function(){var c=this,g,e,h,k;if(c.grid&&!0===c.p.cellEdit){f=parseInt(f,10);c.p.selrow=c.rows[d].id;c.p.knv||b(c).jqGrid("GridNav");if(0<c.p.savedRow.length){if(!0===a&&d==c.p.iRow&&f==c.p.iCol)return;b(c).jqGrid("saveCell",c.p.savedRow[0].id,c.p.savedRow[0].ic)}else window.setTimeout(function(){b("#"+b.jgrid.jqID(c.p.knv)).attr("tabindex","-1").focus()},1);k=c.p.colModel[f];g=k.name;if("subgrid"!==g&&"cb"!==g&&"rn"!==g){h=b("td:eq("+
f+")",c.rows[d]);if(!0!==k.editable||!0!==a||h.hasClass("not-editable-cell"))0<=parseInt(c.p.iCol,10)&&0<=parseInt(c.p.iRow,10)&&(b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"),b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")),h.addClass("edit-cell ui-state-highlight"),b(c.rows[d]).addClass("selected-row ui-state-hover"),e=h.html().replace(/\&#160\;/ig,""),b(c).triggerHandler("jqGridSelectCell",[c.rows[d].id,g,e,d,f]),b.isFunction(c.p.onSelectCell)&&
c.p.onSelectCell.call(c,c.rows[d].id,g,e,d,f);else{0<=parseInt(c.p.iCol,10)&&0<=parseInt(c.p.iRow,10)&&(b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"),b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover"));b(h).addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");try{e=b.unformat.call(c,h,{rowId:c.rows[d].id,colModel:k},f)}catch(m){e=k.edittype&&"textarea"===k.edittype?b(h).text():b(h).html()}c.p.autoencode&&
(e=b.jgrid.htmlDecode(e));k.edittype||(k.edittype="text");c.p.savedRow.push({id:d,ic:f,name:g,v:e});if("&nbsp;"===e||"&#160;"===e||1===e.length&&160===e.charCodeAt(0))e="";if(b.isFunction(c.p.formatCell)){var l=c.p.formatCell.call(c,c.rows[d].id,g,e,d,f);void 0!==l&&(e=l)}b(c).triggerHandler("jqGridBeforeEditCell",[c.rows[d].id,g,e,d,f]);b.isFunction(c.p.beforeEditCell)&&c.p.beforeEditCell.call(c,c.rows[d].id,g,e,d,f);var l=b.extend({},k.editoptions||{},{id:d+"_"+g,name:g,rowId:c.rows[d].id}),q=b.jgrid.createEl.call(c,
k.edittype,l,e,!0,b.extend({},b.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));b(h).html("").append(q).attr("tabindex","0");b.jgrid.bindEv.call(c,q,l);window.setTimeout(function(){b(q).focus()},1);b("input, select, textarea",h).bind("keydown",function(a){27===a.keyCode&&(0<b("input.hasDatepicker",h).length?b(".ui-datepicker").is(":hidden")?b(c).jqGrid("restoreCell",d,f):b("input.hasDatepicker",h).datepicker("hide"):b(c).jqGrid("restoreCell",d,f));if(13===a.keyCode&&!a.shiftKey)return b(c).jqGrid("saveCell",
d,f),!1;if(9===a.keyCode){if(c.grid.hDiv.loading)return!1;a.shiftKey?b(c).jqGrid("prevCell",d,f):b(c).jqGrid("nextCell",d,f)}a.stopPropagation()});b(c).triggerHandler("jqGridAfterEditCell",[c.rows[d].id,g,e,d,f]);b.isFunction(c.p.afterEditCell)&&c.p.afterEditCell.call(c,c.rows[d].id,g,e,d,f)}c.p.iCol=f;c.p.iRow=d}}})},saveCell:function(d,f){return this.each(function(){var a=this,c;if(a.grid&&!0===a.p.cellEdit){c=1<=a.p.savedRow.length?0:null;if(null!==c){var g=b("td:eq("+f+")",a.rows[d]),e,h,k=a.p.colModel[f],
m=k.name,l=b.jgrid.jqID(m);switch(k.edittype){case "select":if(k.editoptions.multiple){var l=b("#"+d+"_"+l,a.rows[d]),q=[];(e=b(l).val())?e.join(","):e="";b("option:selected",l).each(function(a,c){q[a]=b(c).text()});h=q.join(",")}else e=b("#"+d+"_"+l+" option:selected",a.rows[d]).val(),h=b("#"+d+"_"+l+" option:selected",a.rows[d]).text();k.formatter&&(h=e);break;case "checkbox":var n=["Yes","No"];k.editoptions&&(n=k.editoptions.value.split(":"));h=e=b("#"+d+"_"+l,a.rows[d]).is(":checked")?n[0]:n[1];
break;case "password":case "text":case "textarea":case "button":h=e=b("#"+d+"_"+l,a.rows[d]).val();break;case "custom":try{if(k.editoptions&&b.isFunction(k.editoptions.custom_value)){e=k.editoptions.custom_value.call(a,b(".customelement",g),"get");if(void 0===e)throw"e2";h=e}else throw"e1";}catch(r){"e1"===r&&b.jgrid.info_dialog(b.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,b.jgrid.edit.bClose),"e2"===r?b.jgrid.info_dialog(b.jgrid.errors.errcap,"function 'custom_value' "+
b.jgrid.edit.msg.novalue,b.jgrid.edit.bClose):b.jgrid.info_dialog(b.jgrid.errors.errcap,r.message,b.jgrid.edit.bClose)}}if(h!==a.p.savedRow[c].v){if(c=b(a).triggerHandler("jqGridBeforeSaveCell",[a.rows[d].id,m,e,d,f]))h=e=c;b.isFunction(a.p.beforeSaveCell)&&(c=a.p.beforeSaveCell.call(a,a.rows[d].id,m,e,d,f))&&(h=e=c);var s=b.jgrid.checkValues.call(a,e,f);if(!0===s[0]){c=b(a).triggerHandler("jqGridBeforeSubmitCell",[a.rows[d].id,m,e,d,f])||{};b.isFunction(a.p.beforeSubmitCell)&&((c=a.p.beforeSubmitCell.call(a,
a.rows[d].id,m,e,d,f))||(c={}));0<b("input.hasDatepicker",g).length&&b("input.hasDatepicker",g).datepicker("hide");if("remote"===a.p.cellsubmit)if(a.p.cellurl){var p={};a.p.autoencode&&(e=b.jgrid.htmlEncode(e));p[m]=e;n=a.p.prmNames;k=n.id;l=n.oper;p[k]=b.jgrid.stripPref(a.p.idPrefix,a.rows[d].id);p[l]=n.editoper;p=b.extend(c,p);b(a).jqGrid("progressBar",{method:"show",loadtype:a.p.loadui,htmlcontent:b.jgrid.defaults.savetext||"Saving..."});a.grid.hDiv.loading=!0;b.ajax(b.extend({url:a.p.cellurl,
data:b.isFunction(a.p.serializeCellData)?a.p.serializeCellData.call(a,p):p,type:"POST",complete:function(c,k){b(a).jqGrid("progressBar",{method:"hide",loadtype:a.p.loadui});a.grid.hDiv.loading=!1;if("success"===k){var l=b(a).triggerHandler("jqGridAfterSubmitCell",[a,c,p.id,m,e,d,f])||[!0,""];!0===l[0]&&b.isFunction(a.p.afterSubmitCell)&&(l=a.p.afterSubmitCell.call(a,c,p.id,m,e,d,f));!0===l[0]?(b(g).empty(),b(a).jqGrid("setCell",a.rows[d].id,f,h,!1,!1,!0),b(g).addClass("dirty-cell"),b(a.rows[d]).addClass("edited"),
b(a).triggerHandler("jqGridAfterSaveCell",[a.rows[d].id,m,e,d,f]),b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,m,e,d,f),a.p.savedRow.splice(0,1)):(b.jgrid.info_dialog(b.jgrid.errors.errcap,l[1],b.jgrid.edit.bClose),b(a).jqGrid("restoreCell",d,f))}},error:function(c,e,h){b("#lui_"+b.jgrid.jqID(a.p.id)).hide();a.grid.hDiv.loading=!1;b(a).triggerHandler("jqGridErrorCell",[c,e,h]);b.isFunction(a.p.errorCell)?a.p.errorCell.call(a,c,e,h):b.jgrid.info_dialog(b.jgrid.errors.errcap,
c.status+" : "+c.statusText+"<br/>"+e,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}},b.jgrid.ajaxOptions,a.p.ajaxCellOptions||{}))}else try{b.jgrid.info_dialog(b.jgrid.errors.errcap,b.jgrid.errors.nourl,b.jgrid.edit.bClose),b(a).jqGrid("restoreCell",d,f)}catch(t){}"clientArray"===a.p.cellsubmit&&(b(g).empty(),b(a).jqGrid("setCell",a.rows[d].id,f,h,!1,!1,!0),b(g).addClass("dirty-cell"),b(a.rows[d]).addClass("edited"),b(a).triggerHandler("jqGridAfterSaveCell",[a.rows[d].id,m,e,d,f]),b.isFunction(a.p.afterSaveCell)&&
a.p.afterSaveCell.call(a,a.rows[d].id,m,e,d,f),a.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){b.jgrid.info_dialog(b.jgrid.errors.errcap,e+" "+s[1],b.jgrid.edit.bClose)},100),b(a).jqGrid("restoreCell",d,f)}catch(u){}}else b(a).jqGrid("restoreCell",d,f)}window.setTimeout(function(){b("#"+b.jgrid.jqID(a.p.knv)).attr("tabindex","-1").focus()},0)}})},restoreCell:function(d,f){return this.each(function(){var a=this,c;if(a.grid&&!0===a.p.cellEdit){c=1<=a.p.savedRow.length?0:null;if(null!==
c){var g=b("td:eq("+f+")",a.rows[d]);if(b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker",g).datepicker("hide")}catch(e){}b(g).empty().attr("tabindex","-1");b(a).jqGrid("setCell",a.rows[d].id,f,a.p.savedRow[c].v,!1,!1,!0);b(a).triggerHandler("jqGridAfterRestoreCell",[a.rows[d].id,a.p.savedRow[c].v,d,f]);b.isFunction(a.p.afterRestoreCell)&&a.p.afterRestoreCell.call(a,a.rows[d].id,a.p.savedRow[c].v,d,f);a.p.savedRow.splice(0,1)}window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},
0)}})},nextCell:function(d,f){return this.each(function(){var a=!1,c;if(this.grid&&!0===this.p.cellEdit){for(c=f+1;c<this.p.colModel.length;c++)if(!0===this.p.colModel[c].editable){a=c;break}!1!==a?b(this).jqGrid("editCell",d,a,!0):0<this.p.savedRow.length&&b(this).jqGrid("saveCell",d,f)}})},prevCell:function(d,f){return this.each(function(){var a=!1,c;if(this.grid&&!0===this.p.cellEdit){for(c=f-1;0<=c;c--)if(!0===this.p.colModel[c].editable){a=c;break}!1!==a?b(this).jqGrid("editCell",d,a,!0):0<this.p.savedRow.length&&
b(this).jqGrid("saveCell",d,f)}})},GridNav:function(){return this.each(function(){function d(c,d,e){if("v"===e.substr(0,1)){var f=b(a.grid.bDiv)[0].clientHeight,g=b(a.grid.bDiv)[0].scrollTop,n=a.rows[c].offsetTop+a.rows[c].clientHeight,r=a.rows[c].offsetTop;"vd"===e&&n>=f&&(b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop+a.rows[c].clientHeight);"vu"===e&&r<g&&(b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop-a.rows[c].clientHeight)}"h"===e&&(e=b(a.grid.bDiv)[0].clientWidth,f=b(a.grid.bDiv)[0].scrollLeft,
g=a.rows[c].cells[d].offsetLeft,a.rows[c].cells[d].offsetLeft+a.rows[c].cells[d].clientWidth>=e+parseInt(f,10)?b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft+a.rows[c].cells[d].clientWidth:g<f&&(b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft-a.rows[c].cells[d].clientWidth))}function f(b,c){var d,e;if("lft"===c)for(d=b+1,e=b;0<=e;e--)if(!0!==a.p.colModel[e].hidden){d=e;break}if("rgt"===c)for(d=b-1,e=b;e<a.p.colModel.length;e++)if(!0!==a.p.colModel[e].hidden){d=e;break}return d}
var a=this;if(a.grid&&!0===a.p.cellEdit){a.p.knv=a.p.id+"_kn";var c=b("<div style='position:fixed;top:0px;width:1px;height:1px;' tabindex='0'><div tabindex='-1' style='width:1px;height:1px;' id='"+a.p.knv+"'></div></div>"),g,e;b(c).insertBefore(a.grid.cDiv);b("#"+a.p.knv).focus().keydown(function(c){e=c.keyCode;"rtl"===a.p.direction&&(37===e?e=39:39===e&&(e=37));switch(e){case 38:0<a.p.iRow-1&&(d(a.p.iRow-1,a.p.iCol,"vu"),b(a).jqGrid("editCell",a.p.iRow-1,a.p.iCol,!1));break;case 40:a.p.iRow+1<=a.rows.length-
1&&(d(a.p.iRow+1,a.p.iCol,"vd"),b(a).jqGrid("editCell",a.p.iRow+1,a.p.iCol,!1));break;case 37:0<=a.p.iCol-1&&(g=f(a.p.iCol-1,"lft"),d(a.p.iRow,g,"h"),b(a).jqGrid("editCell",a.p.iRow,g,!1));break;case 39:a.p.iCol+1<=a.p.colModel.length-1&&(g=f(a.p.iCol+1,"rgt"),d(a.p.iRow,g,"h"),b(a).jqGrid("editCell",a.p.iRow,g,!1));break;case 13:0<=parseInt(a.p.iCol,10)&&0<=parseInt(a.p.iRow,10)&&b(a).jqGrid("editCell",a.p.iRow,a.p.iCol,!0);break;default:return!0}return!1})}})},getChangedCells:function(d){var f=
[];d||(d="all");this.each(function(){var a=this,c;a.grid&&!0===a.p.cellEdit&&b(a.rows).each(function(g){var e={};b(this).hasClass("edited")&&(b("td",this).each(function(f){c=a.p.colModel[f].name;if("cb"!==c&&"subgrid"!==c)if("dirty"===d){if(b(this).hasClass("dirty-cell"))try{e[c]=b.unformat.call(a,this,{rowId:a.rows[g].id,colModel:a.p.colModel[f]},f)}catch(k){e[c]=b.jgrid.htmlDecode(b(this).html())}}else try{e[c]=b.unformat.call(a,this,{rowId:a.rows[g].id,colModel:a.p.colModel[f]},f)}catch(m){e[c]=
b.jgrid.htmlDecode(b(this).html())}}),e.id=this.id,f.push(e))})});return f}})})(jQuery);
(function(c){c.fn.jqm=function(a){var k={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:d,ajaxText:"",target:d,modal:d,toTop:d,onShow:d,onHide:d,onLoad:d};return this.each(function(){if(this._jqm)return l[this._jqm].c=c.extend({},l[this._jqm].c,a);n++;this._jqm=n;l[n]={c:c.extend(k,c.jqm.params,a),a:d,w:c(this).addClass("jqmID"+n),s:n};k.trigger&&c(this).jqmAddTrigger(k.trigger)})};c.fn.jqmAddClose=function(a){return r(this,a,"jqmHide")};c.fn.jqmAddTrigger=
function(a){return r(this,a,"jqmShow")};c.fn.jqmShow=function(a){return this.each(function(){c.jqm.open(this._jqm,a)})};c.fn.jqmHide=function(a){return this.each(function(){c.jqm.close(this._jqm,a)})};c.jqm={hash:{},open:function(a,k){var b=l[a],e=b.c,h="."+e.closeClass,f=parseInt(b.w.css("z-index")),f=0<f?f:3E3,g=c("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":f-1,opacity:e.overlay/100});if(b.a)return d;b.t=k;b.a=!0;b.w.css("z-index",f);e.modal?(m[0]||setTimeout(function(){s("bind")},
1),m.push(a)):0<e.overlay?e.closeoverlay&&b.w.jqmAddClose(g):g=d;b.o=g?g.addClass(e.overlayClass).prependTo("body"):d;e.ajax?(f=e.target||b.w,g=e.ajax,f="string"==typeof f?c(f,b.w):c(f),g="@"==g.substr(0,1)?c(k).attr(g.substring(1)):g,f.html(e.ajaxText).load(g,function(){e.onLoad&&e.onLoad.call(this,b);h&&b.w.jqmAddClose(c(h,b.w));p(b)})):h&&b.w.jqmAddClose(c(h,b.w));e.toTop&&b.o&&b.w.before('<span id="jqmP'+b.w[0]._jqm+'"></span>').insertAfter(b.o);e.onShow?e.onShow(b):b.w.show();p(b);return d},
close:function(a){a=l[a];if(!a.a)return d;a.a=d;m[0]&&(m.pop(),m[0]||s("unbind"));a.c.toTop&&a.o&&c("#jqmP"+a.w[0]._jqm).after(a.w).remove();if(a.c.onHide)a.c.onHide(a);else a.w.hide(),a.o&&a.o.remove();return d},params:{}};var n=0,l=c.jqm.hash,m=[],d=!1,p=function(a){try{c(":input:visible",a.w)[0].focus()}catch(d){}},s=function(a){c(document)[a]("keypress",q)[a]("keydown",q)[a]("mousedown",q)},q=function(a){var d=l[m[m.length-1]],b=!c(a.target).parents(".jqmID"+d.s)[0];b&&(c(".jqmID"+d.s).each(function(){var d=
c(this),h=d.offset();if(h.top<=a.pageY&&a.pageY<=h.top+d.height()&&h.left<=a.pageX&&a.pageX<=h.left+d.width())return b=!1}),p(d));return!b},r=function(a,k,b){return a.each(function(){var a=this._jqm;c(k).each(function(){this[b]||(this[b]=[],c(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(l[this[a][b]])l[this[a][b]].w[a](this);return d}));this[b].push(a)})})}})(jQuery);
(function(b){b.fn.jqDrag=function(a){return h(this,a,"d")};b.fn.jqResize=function(a,b){return h(this,a,"r",b)};b.jqDnR={dnr:{},e:0,drag:function(a){"d"==d.k?e.css({left:d.X+a.pageX-d.pX,top:d.Y+a.pageY-d.pY}):(e.css({width:Math.max(a.pageX-d.pX+d.W,0),height:Math.max(a.pageY-d.pY+d.H,0)}),f&&g.css({width:Math.max(a.pageX-f.pX+f.W,0),height:Math.max(a.pageY-f.pY+f.H,0)}));return!1},stop:function(){b(document).unbind("mousemove",c.drag).unbind("mouseup",c.stop)}};var c=b.jqDnR,d=c.dnr,e=c.e,g,f,h=function(a,
c,h,n){return a.each(function(){c=c?b(c,a):a;c.bind("mousedown",{e:a,k:h},function(a){var c=a.data,k={};e=c.e;g=n?b(n):!1;if("relative"!=e.css("position"))try{e.position(k)}catch(h){}d={X:k.left||l("left")||0,Y:k.top||l("top")||0,W:l("width")||e[0].scrollWidth||0,H:l("height")||e[0].scrollHeight||0,pX:a.pageX,pY:a.pageY,k:c.k};f=g&&"d"!=c.k?{X:k.left||m("left")||0,Y:k.top||m("top")||0,W:g[0].offsetWidth||m("width")||0,H:g[0].offsetHeight||m("height")||0,pX:a.pageX,pY:a.pageY,k:c.k}:!1;if(b("input.hasDatepicker",
e[0])[0])try{b("input.hasDatepicker",e[0]).datepicker("hide")}catch(p){}b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);return!1})})},l=function(a){return parseInt(e.css(a),10)||!1},m=function(a){return parseInt(g.css(a),10)||!1}})(jQuery);
(function(b){b.jgrid.extend({setSubGrid:function(){return this.each(function(){var d,c;this.p.subGridOptions=b.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:!1,delayOnLoad:50,selectOnExpand:!1,selectOnCollapse:!1,reloadOnExpand:!0},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:b.jgrid.cell_width?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:!1,resizable:!1,hidedlg:!0,
search:!1,fixed:!0});d=this.p.subGridModel;if(d[0])for(d[0].align=b.extend([],d[0].align||[]),c=0;c<d[0].name.length;c++)d[0].align[c]=d[0].align[c]||"left"})},addSubGridCell:function(b,c){var a="",p,q;this.each(function(){a=this.formatCol(b,c);q=this.p.id;p=this.p.subGridOptions.plusicon});return'<td role="gridcell" aria-describedby="'+q+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+a+"><a style='cursor:pointer;'><span class='ui-icon "+p+"'></span></a></td>"},addSubGrid:function(d,c){return this.each(function(){var a=
this;if(a.grid){var p=function(c,d,h){d=b("<td align='"+a.p.subGridModel[0].align[h]+"'></td>").html(d);b(c).append(d)},q=function(c,d){var h,f,e,g=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),k=b("<tr></tr>");for(f=0;f<a.p.subGridModel[0].name.length;f++)h=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>"),b(h).html(a.p.subGridModel[0].name[f]),b(h).width(a.p.subGridModel[0].width[f]),b(k).append(h);b(g).append(k);c&&(e=a.p.xmlReader.subgrid,
b(e.root+" "+e.row,c).each(function(){k=b("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===e.repeatitems)b(e.cell,this).each(function(a){p(k,b(this).text()||"&#160;",a)});else{var c=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(c)for(f=0;f<c.length;f++)p(k,b(c[f],this).text()||"&#160;",f)}b(g).append(k)}));h=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+b.jgrid.jqID(h+d)).append(g);a.grid.hDiv.loading=!1;b("#load_"+b.jgrid.jqID(a.p.id)).hide();return!1},r=function(c,d){var h,
f,e,g,k,m=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),l=b("<tr></tr>");for(f=0;f<a.p.subGridModel[0].name.length;f++)h=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>"),b(h).html(a.p.subGridModel[0].name[f]),b(h).width(a.p.subGridModel[0].width[f]),b(l).append(h);b(m).append(l);if(c&&(g=a.p.jsonReader.subgrid,h=b.jgrid.getAccessor(c,g.root),void 0!==h))for(f=0;f<h.length;f++){e=h[f];l=b("<tr class='ui-widget-content ui-subtblcell'></tr>");
if(!0===g.repeatitems)for(g.cell&&(e=e[g.cell]),k=0;k<e.length;k++)p(l,e[k]||"&#160;",k);else{var n=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(n.length)for(k=0;k<n.length;k++)p(l,e[n[k]]||"&#160;",k)}b(m).append(l)}f=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+b.jgrid.jqID(f+d)).append(m);a.grid.hDiv.loading=!1;b("#load_"+b.jgrid.jqID(a.p.id)).hide();return!1},v=function(c){var e,d,f,g;e=b(c).attr("id");d={nd_:(new Date).getTime()};d[a.p.prmNames.subgridid]=e;if(!a.p.subGridModel[0])return!1;
if(a.p.subGridModel[0].params)for(g=0;g<a.p.subGridModel[0].params.length;g++)for(f=0;f<a.p.colModel.length;f++)a.p.colModel[f].name===a.p.subGridModel[0].params[g]&&(d[a.p.colModel[f].name]=b("td:eq("+f+")",c).text().replace(/\&#160\;/ig,""));if(!a.grid.hDiv.loading)switch(a.grid.hDiv.loading=!0,b("#load_"+b.jgrid.jqID(a.p.id)).show(),a.p.subgridtype||(a.p.subgridtype=a.p.datatype),b.isFunction(a.p.subgridtype)?a.p.subgridtype.call(a,d):a.p.subgridtype=a.p.subgridtype.toLowerCase(),a.p.subgridtype){case "xml":case "json":b.ajax(b.extend({type:a.p.mtype,
url:b.isFunction(a.p.subGridUrl)?a.p.subGridUrl.call(a,d):a.p.subGridUrl,dataType:a.p.subgridtype,data:b.isFunction(a.p.serializeSubGridData)?a.p.serializeSubGridData.call(a,d):d,complete:function(c){"xml"===a.p.subgridtype?q(c.responseXML,e):r(b.jgrid.parse(c.responseText),e)}},b.jgrid.ajaxOptions,a.p.ajaxSubgridOptions||{}))}return!1},e,m,s,t=0,g,l;b.each(a.p.colModel,function(){!0!==this.hidden&&"rn"!==this.name&&"cb"!==this.name||t++});var u=a.rows.length,n=1;void 0!==c&&0<c&&(n=c,u=c+1);for(;n<
u;)b(a.rows[n]).hasClass("jqgrow")&&(a.p.scroll&&b(a.rows[n].cells[d]).unbind("click"),b(a.rows[n].cells[d]).bind("click",function(){var c=b(this).parent("tr")[0];l=c.nextSibling;if(b(this).hasClass("sgcollapsed")){m=a.p.id;e=c.id;if(!0===a.p.subGridOptions.reloadOnExpand||!1===a.p.subGridOptions.reloadOnExpand&&!b(l).hasClass("ui-subgrid")){s=1<=d?"<td colspan='"+d+"'>&#160;</td>":"";g=b(a).triggerHandler("jqGridSubGridBeforeExpand",[m+"_"+e,e]);(g=!1===g||"stop"===g?!1:!0)&&b.isFunction(a.p.subGridBeforeExpand)&&
(g=a.p.subGridBeforeExpand.call(a,m+"_"+e,e));if(!1===g)return!1;b(c).after("<tr role='row' class='ui-subgrid'>"+s+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+a.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(a.p.colNames.length-1-t,10)+"' class='ui-widget-content subgrid-data'><div id="+m+"_"+e+" class='tablediv'></div></td></tr>");b(a).triggerHandler("jqGridSubGridRowExpanded",[m+"_"+e,e]);b.isFunction(a.p.subGridRowExpanded)?a.p.subGridRowExpanded.call(a,
m+"_"+e,e):v(c)}else b(l).show();b(this).html("<a style='cursor:pointer;'><span class='ui-icon "+a.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");a.p.subGridOptions.selectOnExpand&&b(a).jqGrid("setSelection",e)}else if(b(this).hasClass("sgexpanded")){g=b(a).triggerHandler("jqGridSubGridRowColapsed",[m+"_"+e,e]);g=!1===g||"stop"===g?!1:!0;e=c.id;g&&b.isFunction(a.p.subGridRowColapsed)&&(g=a.p.subGridRowColapsed.call(a,m+"_"+e,e));if(!1===g)return!1;!0===
a.p.subGridOptions.reloadOnExpand?b(l).remove(".ui-subgrid"):b(l).hasClass("ui-subgrid")&&b(l).hide();b(this).html("<a style='cursor:pointer;'><span class='ui-icon "+a.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");a.p.subGridOptions.selectOnCollapse&&b(a).jqGrid("setSelection",e)}return!1})),n++;!0===a.p.subGridOptions.expandOnLoad&&b(a.rows).filter(".jqgrow").each(function(a,c){b(c.cells[0]).click()});a.subGridXml=function(a,b){q(a,b)};a.subGridJson=
function(a,b){r(a,b)}}})},expandSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=b(this).jqGrid("getInd",d,!0);c&&(c=b("td.sgcollapsed",c)[0])&&b(c).trigger("click")}})},collapseSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=b(this).jqGrid("getInd",d,!0);c&&(c=b("td.sgexpanded",c)[0])&&b(c).trigger("click")}})},toggleSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=
b(this).jqGrid("getInd",d,!0);if(c){var a=b("td.sgcollapsed",c)[0];a?b(a).trigger("click"):(a=b("td.sgexpanded",c)[0])&&b(a).trigger("click")}}})}})})(jQuery);
(function(d){d.extend(d.jgrid,{template:function(b){var m=d.makeArray(arguments).slice(1),a,c=m.length;null==b&&(b="");return b.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,function(b,h){if(!isNaN(parseInt(h,10)))return m[parseInt(h,10)];for(a=0;a<c;a++)if(d.isArray(m[a]))for(var k=m[a],e=k.length;e--;)if(h===k[e].nm)return k[e].v})}});d.jgrid.extend({groupingSetup:function(){return this.each(function(){var b,m,a=this.p.colModel,c=this.p.groupingView;if(null===c||"object"!==typeof c&&!d.isFunction(c))this.p.grouping=
!1;else if(c.groupField.length){void 0===c.visibiltyOnNextGrouping&&(c.visibiltyOnNextGrouping=[]);c.lastvalues=[];c._locgr||(c.groups=[]);c.counters=[];for(b=0;b<c.groupField.length;b++)c.groupOrder[b]||(c.groupOrder[b]="asc"),c.groupText[b]||(c.groupText[b]="{0}"),"boolean"!==typeof c.groupColumnShow[b]&&(c.groupColumnShow[b]=!0),"boolean"!==typeof c.groupSummary[b]&&(c.groupSummary[b]=!1),c.groupSummaryPos[b]||(c.groupSummaryPos[b]="footer"),!0===c.groupColumnShow[b]?(c.visibiltyOnNextGrouping[b]=
!0,d(this).jqGrid("showCol",c.groupField[b])):(c.visibiltyOnNextGrouping[b]=d("#"+d.jgrid.jqID(this.p.id+"_"+c.groupField[b])).is(":visible"),d(this).jqGrid("hideCol",c.groupField[b]));c.summary=[];c.hideFirstGroupCol&&(c.formatDisplayField[0]=function(a){return a});b=0;for(m=a.length;b<m;b++)c.hideFirstGroupCol&&!a[b].hidden&&c.groupField[0]===a[b].name&&(a[b].formatter=function(){return""}),a[b].summaryType&&(a[b].summaryDivider?c.summary.push({nm:a[b].name,st:a[b].summaryType,v:"",sd:a[b].summaryDivider,
vd:"",sr:a[b].summaryRound,srt:a[b].summaryRoundType||"round"}):c.summary.push({nm:a[b].name,st:a[b].summaryType,v:"",sr:a[b].summaryRound,srt:a[b].summaryRoundType||"round"}))}else this.p.grouping=!1})},groupingPrepare:function(b,m){this.each(function(){var a=this.p.groupingView,c=this,g,h=a.groupField.length,k,e,f,p=0;for(g=0;g<h;g++)k=a.groupField[g],f=a.displayField[g],e=b[k],f=null==f?null:b[f],null==f&&(f=e),void 0!==e&&(0===m?(a.groups.push({idx:g,dataIndex:k,value:e,displayValue:f,startRow:m,
cnt:1,summary:[]}),a.lastvalues[g]=e,a.counters[g]={cnt:1,pos:a.groups.length-1,summary:d.extend(!0,[],a.summary)}):"object"===typeof e||(d.isArray(a.isInTheSameGroup)&&d.isFunction(a.isInTheSameGroup[g])?a.isInTheSameGroup[g].call(c,a.lastvalues[g],e,g,a):a.lastvalues[g]===e)?1===p?(a.groups.push({idx:g,dataIndex:k,value:e,displayValue:f,startRow:m,cnt:1,summary:[]}),a.lastvalues[g]=e,a.counters[g]={cnt:1,pos:a.groups.length-1,summary:d.extend(!0,[],a.summary)}):(a.counters[g].cnt+=1,a.groups[a.counters[g].pos].cnt=
a.counters[g].cnt):(a.groups.push({idx:g,dataIndex:k,value:e,displayValue:f,startRow:m,cnt:1,summary:[]}),a.lastvalues[g]=e,p=1,a.counters[g]={cnt:1,pos:a.groups.length-1,summary:d.extend(!0,[],a.summary)}),d.each(a.counters[g].summary,function(){d.isFunction(this.st)?this.v=this.st.call(c,this.v,this.nm,b):(this.v=d(c).jqGrid("groupingCalculations.handler",this.st,this.v,this.nm,this.sr,this.srt,b),"avg"===this.st.toLowerCase()&&this.sd&&(this.vd=d(c).jqGrid("groupingCalculations.handler",this.st,
this.vd,this.sd,this.sr,this.srt,b)))}),a.groups[a.counters[g].pos].summary=a.counters[g].summary)});return this},groupingToggle:function(b){this.each(function(){var m=this.p.groupingView,a=b.split("_"),c=parseInt(a[a.length-2],10);a.splice(a.length-2,2);var g=a.join("_"),a=m.minusicon,m=m.plusicon,h=d("#"+d.jgrid.jqID(b)),h=h.length?h[0].nextSibling:null,k=d("#"+d.jgrid.jqID(b)+" span.tree-wrap-"+this.p.direction),e=function(a){a=d.map(a.split(" "),function(a){if(a.substring(0,g.length+1)===g+"_")return parseInt(a.substring(g.length+
1),10)});return 0<a.length?a[0]:void 0},f,p,r=!1,q=this.p.frozenColumns?this.p.id+"_frozen":!1,n=(f=q?d("#"+d.jgrid.jqID(b),"#"+d.jgrid.jqID(q)):!1)&&f.length?f[0].nextSibling:null;if(k.hasClass(a)){if(h)for(;h;){f=e(h.className);if(void 0!==f&&f<=c)break;d(h).hide();h=h.nextSibling;q&&(d(n).hide(),n=n.nextSibling)}k.removeClass(a).addClass(m);r=!0}else{if(h)for(p=void 0;h;){f=e(h.className);void 0===p&&(p=void 0===f);if(void 0!==f){if(f<=c)break;f===c+1&&(d(h).show().find(">td>span.tree-wrap-"+this.p.direction).removeClass(a).addClass(m),
q&&d(n).show().find(">td>span.tree-wrap-"+this.p.direction).removeClass(a).addClass(m))}else p&&(d(h).show(),q&&d(n).show());h=h.nextSibling;q&&(n=n.nextSibling)}k.removeClass(m).addClass(a)}d(this).triggerHandler("jqGridGroupingClickGroup",[b,r]);d.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,b,r)});return!1},groupingRender:function(b,m,a,c){return this.each(function(){function g(a,b,c){var d=!1;if(0===b)d=c[a];else{var e=c[a].idx;if(0===e)d=c[a];else for(;0<=a;a--)if(c[a].idx===
e-b){d=c[a];break}}return d}function h(a,b,c,e){var f=g(a,b,c),h=k.p.colModel,p,q=f.cnt;a="";var n;for(n=e;n<m;n++){var r="<td "+k.formatCol(n,1,"")+">&#160;</td>",t="{0}";d.each(f.summary,function(){if(this.nm===h[n].name){h[n].summaryTpl&&(t=h[n].summaryTpl);"string"===typeof this.st&&"avg"===this.st.toLowerCase()&&(this.sd&&this.vd?this.v/=this.vd:this.v&&0<q&&(this.v/=q));try{this.groupCount=f.cnt,this.groupIndex=f.dataIndex,this.groupValue=f.value,p=k.formatter("",this.v,n,this)}catch(a){p=this.v}r=
"<td "+k.formatCol(n,1,"")+">"+d.jgrid.format(t,p)+"</td>";return!1}});a+=r}return a}var k=this,e=k.p.groupingView,f="",p="",r,q,n=e.groupCollapse?e.plusicon:e.minusicon,t,z=[],A=e.groupField.length,n=n+(" tree-wrap-"+k.p.direction);d.each(k.p.colModel,function(a,b){var c;for(c=0;c<A;c++)if(e.groupField[c]===b.name){z[c]=a;break}});var x=0,B=d.makeArray(e.groupSummary),y;B.reverse();y=k.p.multiselect?' colspan="2"':"";d.each(e.groups,function(g,l){if(e._locgr&&!(l.startRow+l.cnt>(a-1)*c&&l.startRow<
a*c))return!0;x++;q=k.p.id+"ghead_"+l.idx;r=q+"_"+g;p="<span style='cursor:pointer;' class='ui-icon "+n+"' onclick=\"jQuery('#"+d.jgrid.jqID(k.p.id)+"').jqGrid('groupingToggle','"+r+"');return false;\"></span>";try{d.isArray(e.formatDisplayField)&&d.isFunction(e.formatDisplayField[l.idx])?(l.displayValue=e.formatDisplayField[l.idx].call(k,l.displayValue,l.value,k.p.colModel[z[l.idx]],l.idx,e),t=l.displayValue):t=k.formatter(r,l.displayValue,z[l.idx],l.value)}catch(D){t=l.displayValue}"header"===e.groupSummaryPos[l.idx]?
(f+='<tr id="'+r+'"'+(e.groupCollapse&&0<l.idx?' style="display:none;" ':" ")+'role="row" class= "ui-widget-content jqgroup ui-row-'+k.p.direction+" "+q+'"><td style="padding-left:'+12*l.idx+'px;"'+y+">"+p+d.jgrid.template(e.groupText[l.idx],t,l.cnt,l.summary)+"</td>",f+=h(g,0,e.groups,!1===e.groupColumnShow[l.idx]?""===y?2:3:""===y?1:2),f+="</tr>"):f+='<tr id="'+r+'"'+(e.groupCollapse&&0<l.idx?' style="display:none;" ':" ")+'role="row" class= "ui-widget-content jqgroup ui-row-'+k.p.direction+" "+
q+'"><td style="padding-left:'+12*l.idx+'px;" colspan="'+(!1===e.groupColumnShow[l.idx]?m-1:m)+'">'+p+d.jgrid.template(e.groupText[l.idx],t,l.cnt,l.summary)+"</td></tr>";if(A-1===l.idx){var s=e.groups[g+1],v,u=0;v=l.startRow;var C=void 0!==s?s.startRow:e.groups[g].startRow+e.groups[g].cnt;e._locgr&&(u=(a-1)*c,u>l.startRow&&(v=u));for(;v<C&&b[v-u];v++)f+=b[v-u].join("");if("header"!==e.groupSummaryPos[l.idx]){var w;if(void 0!==s){for(w=0;w<e.groupField.length&&s.dataIndex!==e.groupField[w];w++);x=
e.groupField.length-w}for(s=0;s<x;s++)B[s]&&(u="",e.groupCollapse&&!e.showSummaryOnHide&&(u=' style="display:none;"'),f+="<tr"+u+' jqfootlevel="'+(l.idx-s)+'" role="row" class="ui-widget-content jqfoot ui-row-'+k.p.direction+'">',f+=h(g,s,e.groups,0),f+="</tr>");x=w}}});d("#"+d.jgrid.jqID(k.p.id)+" tbody:first").append(f);f=null})},groupingGroupBy:function(b,m){return this.each(function(){"string"===typeof b&&(b=[b]);var a=this.p.groupingView;this.p.grouping=!0;a._locgr=!1;void 0===a.visibiltyOnNextGrouping&&
(a.visibiltyOnNextGrouping=[]);var c;for(c=0;c<a.groupField.length;c++)!a.groupColumnShow[c]&&a.visibiltyOnNextGrouping[c]&&d(this).jqGrid("showCol",a.groupField[c]);for(c=0;c<b.length;c++)a.visibiltyOnNextGrouping[c]=d("#"+d.jgrid.jqID(this.p.id)+"_"+d.jgrid.jqID(b[c])).is(":visible");this.p.groupingView=d.extend(this.p.groupingView,m||{});a.groupField=b;d(this).trigger("reloadGrid")})},groupingRemove:function(b){return this.each(function(){void 0===b&&(b=!0);this.p.grouping=!1;if(!0===b){var m=
this.p.groupingView,a;for(a=0;a<m.groupField.length;a++)!m.groupColumnShow[a]&&m.visibiltyOnNextGrouping[a]&&d(this).jqGrid("showCol",m.groupField);d("tr.jqgroup, tr.jqfoot","#"+d.jgrid.jqID(this.p.id)+" tbody:first").remove();d("tr.jqgrow:hidden","#"+d.jgrid.jqID(this.p.id)+" tbody:first").show()}else d(this).trigger("reloadGrid")})},groupingCalculations:{handler:function(b,d,a,c,g,h){var k={sum:function(){return parseFloat(d||0)+parseFloat(h[a]||0)},min:function(){return""===d?parseFloat(h[a]||
0):Math.min(parseFloat(d),parseFloat(h[a]||0))},max:function(){return""===d?parseFloat(h[a]||0):Math.max(parseFloat(d),parseFloat(h[a]||0))},count:function(){""===d&&(d=0);return h.hasOwnProperty(a)?d+1:0},avg:function(){return k.sum()}};if(!k[b])throw"jqGrid Grouping No such method: "+b;b=k[b]();null!=c&&("fixed"===g?b=b.toFixed(c):(c=Math.pow(10,c),b=Math.round(b*c)/c));return b}}})})(jQuery);
(function(d){d.jgrid.extend({setTreeNode:function(b,c){return this.each(function(){var a=this;if(a.grid&&a.p.treeGrid)for(var h=a.p.expColInd,e=a.p.treeReader.expanded_field,l=a.p.treeReader.leaf_field,g=a.p.treeReader.level_field,f=a.p.treeReader.icon_field,n=a.p.treeReader.loaded,m,p,q,k;b<c;)k=d.jgrid.stripPref(a.p.idPrefix,a.rows[b].id),k=a.p.data[a.p._index[k]],"nested"!==a.p.treeGridModel||k[l]||(m=parseInt(k[a.p.treeReader.left_field],10),p=parseInt(k[a.p.treeReader.right_field],10),k[l]=p===
m+1?"true":"false",a.rows[b].cells[a.p._treeleafpos].innerHTML=k[l]),m=parseInt(k[g],10),0===a.p.tree_root_level?(q=m+1,p=m):(q=m,p=m-1),q="<div class='tree-wrap tree-wrap-"+a.p.direction+"' style='width:"+18*q+"px;'>",q+="<div style='"+("rtl"===a.p.direction?"right:":"left:")+18*p+"px;' class='ui-icon ",void 0!==k[n]&&(k[n]="true"===k[n]||!0===k[n]?!0:!1),"true"===k[l]||!0===k[l]?(q+=(void 0!==k[f]&&""!==k[f]?k[f]:a.p.treeIcons.leaf)+" tree-leaf treeclick",k[l]=!0,p="leaf"):(k[l]=!1,p=""),k[e]=("true"===
k[e]||!0===k[e]?!0:!1)&&(k[n]||void 0===k[n]),q=!1===k[e]?q+(!0===k[l]?"'":a.p.treeIcons.plus+" tree-plus treeclick'"):q+(!0===k[l]?"'":a.p.treeIcons.minus+" tree-minus treeclick'"),q+="></div></div>",d(a.rows[b].cells[h]).wrapInner("<span class='cell-wrapper"+p+"'></span>").prepend(q),m!==parseInt(a.p.tree_root_level,10)&&((k=(k=d(a).jqGrid("getNodeParent",k))&&k.hasOwnProperty(e)?k[e]:!0)||d(a.rows[b]).css("display","none")),d(a.rows[b].cells[h]).find("div.treeclick").bind("click",function(b){b=
d.jgrid.stripPref(a.p.idPrefix,d(b.target||b.srcElement,a.rows).closest("tr.jqgrow")[0].id);b=a.p._index[b];a.p.data[b][l]||(a.p.data[b][e]?(d(a).jqGrid("collapseRow",a.p.data[b]),d(a).jqGrid("collapseNode",a.p.data[b])):(d(a).jqGrid("expandRow",a.p.data[b]),d(a).jqGrid("expandNode",a.p.data[b])));return!1}),!0===a.p.ExpandColClick&&d(a.rows[b].cells[h]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(b){b=d.jgrid.stripPref(a.p.idPrefix,d(b.target||b.srcElement,a.rows).closest("tr.jqgrow")[0].id);
var c=a.p._index[b];a.p.data[c][l]||(a.p.data[c][e]?(d(a).jqGrid("collapseRow",a.p.data[c]),d(a).jqGrid("collapseNode",a.p.data[c])):(d(a).jqGrid("expandRow",a.p.data[c]),d(a).jqGrid("expandNode",a.p.data[c])));d(a).jqGrid("setSelection",b);return!1}),b++})},setTreeGrid:function(){return this.each(function(){var b=this,c=0,a,h=!1,e,l,g=[];if(b.p.treeGrid){b.p.treedatatype||d.extend(b.p,{treedatatype:b.p.datatype});b.p.subGrid=!1;b.p.altRows=!1;b.p.pgbuttons=!1;b.p.pginput=!1;b.p.gridview=!0;null===
b.p.rowTotal&&(b.p.rowNum=1E4);b.p.multiselect=!1;b.p.rowList=[];b.p.expColInd=0;a="ui-icon-triangle-1-"+("rtl"===b.p.direction?"w":"e");b.p.treeIcons=d.extend({plus:a,minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},b.p.treeIcons||{});"nested"===b.p.treeGridModel?b.p.treeReader=d.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader):"adjacency"===b.p.treeGridModel&&(b.p.treeReader=d.extend({level_field:"level",
parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader));for(e in b.p.colModel)if(b.p.colModel.hasOwnProperty(e))for(l in a=b.p.colModel[e].name,a!==b.p.ExpandColumn||h||(h=!0,b.p.expColInd=c),c++,b.p.treeReader)b.p.treeReader.hasOwnProperty(l)&&b.p.treeReader[l]===a&&g.push(a);d.each(b.p.treeReader,function(a,e){e&&-1===d.inArray(e,g)&&("leaf_field"===a&&(b.p._treeleafpos=c),c++,b.p.colNames.push(e),b.p.colModel.push({name:e,width:1,
hidden:!0,sortable:!1,resizable:!1,hidedlg:!0,editable:!0,search:!1}))})}})},expandRow:function(b){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var a=d(c).jqGrid("getNodeChildren",b),h=c.p.treeReader.expanded_field;d(a).each(function(){var a=c.p.idPrefix+d.jgrid.getAccessor(this,c.p.localReader.id);d(d(c).jqGrid("getGridRowById",a)).css("display","");this[h]&&d(c).jqGrid("expandRow",this)})}})},collapseRow:function(b){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var a=d(c).jqGrid("getNodeChildren",
b),h=c.p.treeReader.expanded_field;d(a).each(function(){var a=c.p.idPrefix+d.jgrid.getAccessor(this,c.p.localReader.id);d(d(c).jqGrid("getGridRowById",a)).css("display","none");this[h]&&d(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var b=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var a=c.p.treeReader.level_field;d(c.p.data).each(function(){parseInt(this[a],10)===parseInt(c.p.tree_root_level,10)&&b.push(this)});break;case "adjacency":var h=
c.p.treeReader.parent_id_field;d(c.p.data).each(function(){null!==this[h]&&"null"!==String(this[h]).toLowerCase()||b.push(this)})}});return b},getNodeDepth:function(b){var c=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":c=parseInt(b[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=d(this).jqGrid("getNodeAncestors",b).length}});return c},getNodeParent:function(b){var c=null;this.each(function(){if(this.grid&&
this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var a=this.p.treeReader.left_field,h=this.p.treeReader.right_field,e=this.p.treeReader.level_field,l=parseInt(b[a],10),g=parseInt(b[h],10),f=parseInt(b[e],10);d(this.p.data).each(function(){if(parseInt(this[e],10)===f-1&&parseInt(this[a],10)<l&&parseInt(this[h],10)>g)return c=this,!1});break;case "adjacency":for(var n=this.p.treeReader.parent_id_field,m=this.p.localReader.id,p=this.p._index[b[m]];p--;)if(this.p.data[p][m]===d.jgrid.stripPref(this.p.idPrefix,
b[n])){c=this.p.data[p];break}}});return c},getNodeChildren:function(b){var c=[];this.each(function(){var a=this;if(a.grid&&a.p.treeGrid)switch(a.p.treeGridModel){case "nested":var h=a.p.treeReader.left_field,e=a.p.treeReader.right_field,l=a.p.treeReader.level_field,g=parseInt(b[h],10),f=parseInt(b[e],10),n=parseInt(b[l],10);d(this.p.data).each(function(){parseInt(this[l],10)===n+1&&parseInt(this[h],10)>g&&parseInt(this[e],10)<f&&c.push(this)});break;case "adjacency":var m=a.p.treeReader.parent_id_field,
p=a.p.localReader.id;d(this.p.data).each(function(){this[m]==d.jgrid.stripPref(a.p.idPrefix,b[p])&&c.push(this)})}});return c},getFullTreeNode:function(b){var c=[];this.each(function(){var a=this,h;if(a.grid&&a.p.treeGrid)switch(a.p.treeGridModel){case "nested":var e=a.p.treeReader.left_field,l=a.p.treeReader.right_field,g=a.p.treeReader.level_field,f=parseInt(b[e],10),n=parseInt(b[l],10),m=parseInt(b[g],10);d(this.p.data).each(function(){parseInt(this[g],10)>=m&&parseInt(this[e],10)>=f&&parseInt(this[e],
10)<=n&&c.push(this)});break;case "adjacency":if(b){c.push(b);var p=a.p.treeReader.parent_id_field,q=a.p.localReader.id;d(this.p.data).each(function(b){h=c.length;for(b=0;b<h;b++)if(d.jgrid.stripPref(a.p.idPrefix,c[b][q])===this[p]){c.push(this);break}})}}});return c},getNodeAncestors:function(b){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var a=d(this).jqGrid("getNodeParent",b);a;)c.push(a),a=d(this).jqGrid("getNodeParent",a)});return c},isVisibleNode:function(b){var c=!0;this.each(function(){if(this.grid&&
this.p.treeGrid){var a=d(this).jqGrid("getNodeAncestors",b),h=this.p.treeReader.expanded_field;d(a).each(function(){c=c&&this[h];if(!c)return!1})}});return c},isNodeLoaded:function(b){var c;this.each(function(){if(this.grid&&this.p.treeGrid){var a=this.p.treeReader.leaf_field,h=this.p.treeReader.loaded;c=void 0!==b?void 0!==b[h]?b[h]:b[a]||0<d(this).jqGrid("getNodeChildren",b).length?!0:!1:!1}});return c},expandNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field,
a=this.p.treeReader.parent_id_field,h=this.p.treeReader.loaded,e=this.p.treeReader.level_field,l=this.p.treeReader.left_field,g=this.p.treeReader.right_field;if(!b[c]){var f=d.jgrid.getAccessor(b,this.p.localReader.id),n=d("#"+this.p.idPrefix+d.jgrid.jqID(f),this.grid.bDiv)[0],m=this.p._index[f];d(this).jqGrid("isNodeLoaded",this.p.data[m])?(b[c]=!0,d("div.treeclick",n).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):this.grid.hDiv.loading||(b[c]=!0,
d("div.treeclick",n).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"),this.p.treeANode=n.rowIndex,this.p.datatype=this.p.treedatatype,"nested"===this.p.treeGridModel?d(this).jqGrid("setGridParam",{postData:{nodeid:f,n_left:b[l],n_right:b[g],n_level:b[e]}}):d(this).jqGrid("setGridParam",{postData:{nodeid:f,parentid:b[a],n_level:b[e]}}),d(this).trigger("reloadGrid"),b[h]=!0,"nested"===this.p.treeGridModel?d(this).jqGrid("setGridParam",{postData:{nodeid:"",
n_left:"",n_right:"",n_level:""}}):d(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}}))}}})},collapseNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field;b[c]&&(b[c]=!1,c=d.jgrid.getAccessor(b,this.p.localReader.id),c=d("#"+this.p.idPrefix+d.jgrid.jqID(c),this.grid.bDiv)[0],d("div.treeclick",c).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus"))}})},SortTree:function(b,
c,a,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var e,l,g,f=[],n=this,m;e=d(this).jqGrid("getRootNodes");e=d.jgrid.from(e);e.orderBy(b,c,a,h);m=e.select();e=0;for(l=m.length;e<l;e++)g=m[e],f.push(g),d(this).jqGrid("collectChildrenSortTree",f,g,b,c,a,h);d.each(f,function(a){var b=d.jgrid.getAccessor(this,n.p.localReader.id);d("#"+d.jgrid.jqID(n.p.id)+" tbody tr:eq("+a+")").after(d("tr#"+d.jgrid.jqID(b),n.grid.bDiv))});f=m=e=null}})},collectChildrenSortTree:function(b,c,a,h,e,l){return this.each(function(){if(this.grid&&
this.p.treeGrid){var g,f,n,m;g=d(this).jqGrid("getNodeChildren",c);g=d.jgrid.from(g);g.orderBy(a,h,e,l);m=g.select();g=0;for(f=m.length;g<f;g++)n=m[g],b.push(n),d(this).jqGrid("collectChildrenSortTree",b,n,a,h,e,l)}})},setTreeRow:function(b,c){var a=!1;this.each(function(){this.grid&&this.p.treeGrid&&(a=d(this).jqGrid("setRowData",b,c))});return a},delTreeNode:function(b){return this.each(function(){var c=this.p.localReader.id,a,h=this.p.treeReader.left_field,e=this.p.treeReader.right_field,l,g,f;
if(this.grid&&this.p.treeGrid&&(a=this.p._index[b],void 0!==a)){l=parseInt(this.p.data[a][e],10);g=l-parseInt(this.p.data[a][h],10)+1;var n=d(this).jqGrid("getFullTreeNode",this.p.data[a]);if(0<n.length)for(a=0;a<n.length;a++)d(this).jqGrid("delRowData",n[a][c]);if("nested"===this.p.treeGridModel){c=d.jgrid.from(this.p.data).greater(h,l,{stype:"integer"}).select();if(c.length)for(f in c)c.hasOwnProperty(f)&&(c[f][h]=parseInt(c[f][h],10)-g);c=d.jgrid.from(this.p.data).greater(e,l,{stype:"integer"}).select();
if(c.length)for(f in c)c.hasOwnProperty(f)&&(c[f][e]=parseInt(c[f][e],10)-g)}}})},addChildNode:function(b,c,a,h){var e=this[0];if(a){var l=e.p.treeReader.expanded_field,g=e.p.treeReader.leaf_field,f=e.p.treeReader.level_field,n=e.p.treeReader.parent_id_field,m=e.p.treeReader.left_field,p=e.p.treeReader.right_field,q=e.p.treeReader.loaded,k,u,t,w,s;k=0;var v=c,x;void 0===h&&(h=!1);if(null==b){s=e.p.data.length-1;if(0<=s)for(;0<=s;)k=Math.max(k,parseInt(e.p.data[s][e.p.localReader.id],10)),s--;b=k+
1}var y=d(e).jqGrid("getInd",c);x=!1;void 0===c||null===c||""===c?(v=c=null,k="last",w=e.p.tree_root_level,s=e.p.data.length+1):(k="after",u=e.p._index[c],t=e.p.data[u],c=t[e.p.localReader.id],w=parseInt(t[f],10)+1,s=d(e).jqGrid("getFullTreeNode",t),s.length?(v=s=s[s.length-1][e.p.localReader.id],s=d(e).jqGrid("getInd",v)+1):s=d(e).jqGrid("getInd",c)+1,t[g]&&(x=!0,t[l]=!0,d(e.rows[y]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(e.p.treeIcons.leaf+
" tree-leaf").addClass(e.p.treeIcons.minus+" tree-minus"),e.p.data[u][g]=!1,t[q]=!0));u=s+1;void 0===a[l]&&(a[l]=!1);void 0===a[q]&&(a[q]=!1);a[f]=w;void 0===a[g]&&(a[g]=!0);"adjacency"===e.p.treeGridModel&&(a[n]=c);if("nested"===e.p.treeGridModel){var r;if(null!==c){g=parseInt(t[p],10);f=d.jgrid.from(e.p.data);f=f.greaterOrEquals(p,g,{stype:"integer"});f=f.select();if(f.length)for(r in f)f.hasOwnProperty(r)&&(f[r][m]=f[r][m]>g?parseInt(f[r][m],10)+2:f[r][m],f[r][p]=f[r][p]>=g?parseInt(f[r][p],10)+
2:f[r][p]);a[m]=g;a[p]=g+1}else{g=parseInt(d(e).jqGrid("getCol",p,!1,"max"),10);f=d.jgrid.from(e.p.data).greater(m,g,{stype:"integer"}).select();if(f.length)for(r in f)f.hasOwnProperty(r)&&(f[r][m]=parseInt(f[r][m],10)+2);f=d.jgrid.from(e.p.data).greater(p,g,{stype:"integer"}).select();if(f.length)for(r in f)f.hasOwnProperty(r)&&(f[r][p]=parseInt(f[r][p],10)+2);a[m]=g+1;a[p]=g+2}}if(null===c||d(e).jqGrid("isNodeLoaded",t)||x)d(e).jqGrid("addRowData",b,a,k,v),d(e).jqGrid("setTreeNode",s,u);t&&!t[l]&&
h&&d(e.rows[y]).find("div.treeclick").click()}}})})(jQuery);
(function(e){function K(e,m){var f,c,k=[],q;if(!this||"function"!==typeof e||e instanceof RegExp)throw new TypeError;q=this.length;for(f=0;f<q;f++)if(this.hasOwnProperty(f)&&(c=this[f],e.call(m,c,f,this))){k.push(c);break}return k}e.assocArraySize=function(e){var m=0,f;for(f in e)e.hasOwnProperty(f)&&m++;return m};e.jgrid.extend({pivotSetup:function(t,m){var f=[],c=[],k=[],q=[],H=[],g={grouping:!0,groupingView:{groupField:[],groupSummary:[],groupSummaryPos:[]}},n=[],b=e.extend({rowTotals:!1,rowTotalsText:"Total",
colTotals:!1,groupSummary:!0,groupSummaryPos:"header",frozenStaticCols:!1},m||{});this.each(function(){function m(A,b,a){A=K.call(A,b,a);return 0<A.length?A[0]:null}function L(A,b){var a=0,e=!0,f;for(f in A){if(A[f]!=this[a]){e=!1;break}a++;if(a>=this.length)break}e&&(E=b);return e}function F(b,a,f,g){var h=a.length,z,d,c,n,l="",m=[];e.isArray(f)?(n=f.length,m=f):(n=1,m[0]=f);q=[];H=[];for(c=q.root=0;c<n;c++){var p=[],k;for(z=0;z<h;z++){if(null==f)k=d=e.trim(a[z].member)+"_"+a[z].aggregator,m[0]=
k;else{k=f[c].replace(/\s+/g,"");try{d=1===h?l+k:l+k+"_"+a[z].aggregator+"_"+String(z)}catch(w){}}var u=d=isNaN(parseInt(d,10))?d:d+" ",x=p,y=d,v=g[d],r=a[z].member,s=b,t=void 0;switch(a[z].aggregator){case "sum":t=parseFloat(v||0)+parseFloat(s[r]||0);break;case "count":if(""===v||null==v)v=0;t=s.hasOwnProperty(r)?v+1:0;break;case "min":t=""===v||null==v?parseFloat(s[r]||0):Math.min(parseFloat(v),parseFloat(s[r]||0));break;case "max":t=""===v||null==v?parseFloat(s[r]||0):Math.max(parseFloat(v),parseFloat(s[r]||
0))}g[u]=x[y]=t;1>=c&&"_r_Totals"!==k&&""===l&&(l=k)}q[d]=p;H[d]=m[c]}return g}function J(a){var e,d,g,h,c;for(g in a)if(a.hasOwnProperty(g)){if("object"!==typeof a[g]){if("level"===g){void 0===G[a.level]&&(G[a.level]="",0<a.level&&"_r_Totals"!==a.text&&(n[a.level-1]={useColSpanStyle:!1,groupHeaders:[]}));if(G[a.level]!==a.text&&a.children.length&&"_r_Totals"!==a.text&&0<a.level){n[a.level-1].groupHeaders.push({titleText:a.label,numberOfColumns:0});d=n[a.level-1].groupHeaders.length-1;c=0===d?M:I+
C;if(a.level-1===(b.rowTotals?1:0)&&0<d){var k=n[a.level-1].groupHeaders[d-1].numberOfColumns;k&&(c=k+1+b.aggregates.length)}n[a.level-1].groupHeaders[d].startColumnName=f[c].name;n[a.level-1].groupHeaders[d].numberOfColumns=f.length-c;I=f.length}G[a.level]=a.text}if(a.level===l&&"level"===g&&0<l)if(1<C){d=1;for(e in a.fields)1===d&&n[l-1].groupHeaders.push({startColumnName:e,numberOfColumns:1,titleText:a.text}),d++;n[l-1].groupHeaders[n[l-1].groupHeaders.length-1].numberOfColumns=d-1}else n.splice(l-
1,1)}null!=a[g]&&"object"===typeof a[g]&&J(a[g]);if("level"===g&&0<a.level)for(e in d=0,a.fields)if(a.fields.hasOwnProperty(e)){c={};for(h in b.aggregates[d])if(b.aggregates[d].hasOwnProperty(h))switch(h){case "member":case "label":case "aggregator":break;default:c[h]=b.aggregates[d][h]}1<C?(c.name=e,c.label=b.aggregates[d].label||a.label):(c.name=a.text,c.label="_r_Totals"===a.text?b.rowTotalsText:a.label);f.push(c);d++}}}var p,E,a,r=t.length,B,l,C,d,s=0;b.rowTotals&&0<b.yDimension.length&&(b.yDimension.splice(0,
0,{dataName:b.yDimension[0].dataName}),b.yDimension[0].converter=function(){return"_r_Totals"});B=e.isArray(b.xDimension)?b.xDimension.length:0;l=b.yDimension.length;C=e.isArray(b.aggregates)?b.aggregates.length:0;if(0===B||0===C)throw"xDimension or aggregates optiona are not set!";var x;for(a=0;a<B;a++)x={name:b.xDimension[a].dataName,frozen:b.frozenStaticCols},null==b.xDimension[a].isGroupField&&(b.xDimension[a].isGroupField=!0),x=e.extend(!0,x,b.xDimension[a]),f.push(x);x=B-1;for(var D={};s<r;){p=
t[s];var w=[],u=[];d={};a=0;do w[a]=e.trim(p[b.xDimension[a].dataName]),d[b.xDimension[a].dataName]=w[a],a++;while(a<B);var h=0;E=-1;a=m(c,L,w);if(!a){h=0;if(1<=l){for(h=0;h<l;h++)u[h]=e.trim(p[b.yDimension[h].dataName]),b.yDimension[h].converter&&e.isFunction(b.yDimension[h].converter)&&(u[h]=b.yDimension[h].converter.call(this,u[h],w,u));d=F(p,b.aggregates,u,d)}else 0===l&&(d=F(p,b.aggregates,null,d));c.push(d)}else if(0<=E){h=0;if(1<=l){for(h=0;h<l;h++)u[h]=e.trim(p[b.yDimension[h].dataName]),
b.yDimension[h].converter&&e.isFunction(b.yDimension[h].converter)&&(u[h]=b.yDimension[h].converter.call(this,u[h],w,u));a=F(p,b.aggregates,u,a)}else 0===l&&(a=F(p,b.aggregates,null,a));c[E]=a}p=0;var w=d=null,y;for(y in q)if(q.hasOwnProperty(y)){if(0===p)D.children&&void 0!==D.children||(D={text:y,level:0,children:[],label:y}),d=D.children;else{w=null;for(a=0;a<d.length;a++)if(d[a].text===y){w=d[a];break}w?d=w.children:(d.push({children:[],text:y,level:p,fields:q[y],label:H[y]}),d=d[d.length-1].children)}p++}s++}var G=
[],I=f.length,M=I;0<l&&(n[l-1]={useColSpanStyle:!1,groupHeaders:[]});J(D);if(b.colTotals)for(s=c.length;s--;)for(a=B;a<f.length;a++)r=f[a].name,k[r]=k[r]?k[r]+parseFloat(c[s][r]||0):parseFloat(c[s][r]||0);if(0<x)for(a=0;a<x;a++)f[a].isGroupField&&(g.groupingView.groupField.push(f[a].name),g.groupingView.groupSummary.push(b.groupSummary),g.groupingView.groupSummaryPos.push(b.groupSummaryPos));else g.grouping=!1;g.sortname=f[x].name;g.groupingView.hideFirstGroupCol=!0});return{colModel:f,rows:c,groupOptions:g,
groupHeaders:n,summary:k}},jqPivot:function(t,m,f,c){return this.each(function(){function k(c){var g=jQuery(q).jqGrid("pivotSetup",c,m),k=0<e.assocArraySize(g.summary)?!0:!1,b=e.jgrid.from(g.rows);for(c=0;c<g.groupOptions.groupingView.groupField.length;c++)b.orderBy(g.groupOptions.groupingView.groupField[c],"a","text","");jQuery(q).jqGrid(e.extend(!0,{datastr:e.extend(b.select(),k?{userdata:g.summary}:{}),datatype:"jsonstring",footerrow:k,userDataOnFooter:k,colModel:g.colModel,viewrecords:!0,sortname:m.xDimension[0].dataName},
g.groupOptions,f||{}));g=g.groupHeaders;if(g.length)for(c=0;c<g.length;c++)g[c]&&g[c].groupHeaders.length&&jQuery(q).jqGrid("setGroupHeaders",g[c]);m.frozenStaticCols&&jQuery(q).jqGrid("setFrozenColumns")}var q=this;"string"===typeof t?e.ajax(e.extend({url:t,dataType:"json",success:function(f){k(e.jgrid.getAccessor(f,c&&c.reader?c.reader:"rows"))}},c||{})):k(t)})}})})(jQuery);
(function(c){c.jgrid.extend({jqGridImport:function(a){a=c.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},a||{});return this.each(function(){var d=this,f=function(a,b){var e=c(b.xmlGrid.config,a)[0],h=c(b.xmlGrid.data,a)[0],f,g;if(xmlJsonClass.xml2json&&c.jgrid.parse){e=xmlJsonClass.xml2json(e," ");e=c.jgrid.parse(e);for(g in e)e.hasOwnProperty(g)&&(f=e[g]);h?(h=e.grid.datatype,
e.grid.datatype="xmlstring",e.grid.datastr=a,c(d).jqGrid(f).jqGrid("setGridParam",{datatype:h})):c(d).jqGrid(f)}else alert("xml2json or parse are not present")},b=function(a,b){if(a&&"string"===typeof a){var e=!1;c.jgrid.useJSON&&(c.jgrid.useJSON=!1,e=!0);var f=c.jgrid.parse(a);e&&(c.jgrid.useJSON=!0);e=f[b.jsonGrid.config];if(f=f[b.jsonGrid.data]){var g=e.datatype;e.datatype="jsonstring";e.datastr=f;c(d).jqGrid(e).jqGrid("setGridParam",{datatype:g})}else c(d).jqGrid(e)}};switch(a.imptype){case "xml":c.ajax(c.extend({url:a.impurl,
type:a.mtype,data:a.impData,dataType:"xml",complete:function(b,g){"success"===g&&(f(b.responseXML,a),c(d).triggerHandler("jqGridImportComplete",[b,a]),c.isFunction(a.importComplete)&&a.importComplete(b))}},a.ajaxOptions));break;case "xmlstring":if(a.impstring&&"string"===typeof a.impstring){var g=c.parseXML(a.impstring);g&&(f(g,a),c(d).triggerHandler("jqGridImportComplete",[g,a]),c.isFunction(a.importComplete)&&a.importComplete(g),a.impstring=null);g=null}break;case "json":c.ajax(c.extend({url:a.impurl,
type:a.mtype,data:a.impData,dataType:"json",complete:function(f){try{b(f.responseText,a),c(d).triggerHandler("jqGridImportComplete",[f,a]),c.isFunction(a.importComplete)&&a.importComplete(f)}catch(g){}}},a.ajaxOptions));break;case "jsonstring":a.impstring&&"string"===typeof a.impstring&&(b(a.impstring,a),c(d).triggerHandler("jqGridImportComplete",[a.impstring,a]),c.isFunction(a.importComplete)&&a.importComplete(a.impstring),a.impstring=null)}})},jqGridExport:function(a){a=c.extend({exptype:"xmlstring",
root:"grid",ident:"\t"},a||{});var d=null;this.each(function(){if(this.grid){var f,b=c.extend(!0,{},c(this).jqGrid("getGridParam"));b.rownumbers&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.multiselect&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.subGrid&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.knv=null;if(b.treeGrid)for(f in b.treeReader)b.treeReader.hasOwnProperty(f)&&(b.colNames.splice(b.colNames.length-1),b.colModel.splice(b.colModel.length-1));switch(a.exptype){case "xmlstring":d=
"<"+a.root+">"+xmlJsonClass.json2xml(b,a.ident)+"</"+a.root+">";break;case "jsonstring":d="{"+xmlJsonClass.toJson(b,a.root,a.ident,!1)+"}",void 0!==b.postData.filters&&(d=d.replace(/filters":"/,'filters":'),d=d.replace(/}]}"/,"}]}"))}}});return d},excelExport:function(a){a=c.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},a||{});return this.each(function(){if(this.grid){var d;"remote"===a.exptype&&(d=c.extend({},this.p.postData),d[a.oper]=a.tag,d=jQuery.param(d),d=-1!==
a.url.indexOf("?")?a.url+"&"+d:a.url+"?"+d,window.location=d)}})}})})(jQuery);
var xmlJsonClass={xml2json:function(a,b){9===a.nodeType&&(a=a.documentElement);var g=this.removeWhite(a),g=this.toObj(g),g=this.toJson(g,a.nodeName,"\t");return"{\n"+b+(b?g.replace(/\t/g,b):g.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var g=function(a,b,e){var d="",f,k;if(a instanceof Array)if(0===a.length)d+=e+"<"+b+">__EMPTY_ARRAY_</"+b+">\n";else for(f=0,k=a.length;f<k;f+=1)var n=e+g(a[f],b,e+"\t")+"\n",d=d+n;else if("object"===typeof a){f=!1;d+=e+"<"+b;for(k in a)a.hasOwnProperty(k)&&
("@"===k.charAt(0)?d+=" "+k.substr(1)+'="'+a[k].toString()+'"':f=!0);d+=f?">":"/>";if(f){for(k in a)a.hasOwnProperty(k)&&("#text"===k?d+=a[k]:"#cdata"===k?d+="<![CDATA["+a[k]+"]]\x3e":"@"!==k.charAt(0)&&(d+=g(a[k],k,e+"\t")));d+=("\n"===d.charAt(d.length-1)?e:"")+"</"+b+">"}}else"function"===typeof a?d+=e+"<"+b+"><![CDATA["+a+"]]\x3e</"+b+">":(void 0===a&&(a=""),d='""'===a.toString()||0===a.toString().length?d+(e+"<"+b+">__EMPTY_STRING_</"+b+">"):d+(e+"<"+b+">"+a.toString()+"</"+b+">"));return d},
f="",e;for(e in a)a.hasOwnProperty(e)&&(f+=g(a[e],e,""));return b?f.replace(/\t/g,b):f.replace(/\t|\n/g,"")},toObj:function(a){var b={},g=/function/i;if(1===a.nodeType){if(a.attributes.length){var f;for(f=0;f<a.attributes.length;f+=1)b["@"+a.attributes[f].nodeName]=(a.attributes[f].nodeValue||"").toString()}if(a.firstChild){var e=f=0,h=!1,c;for(c=a.firstChild;c;c=c.nextSibling)1===c.nodeType?h=!0:3===c.nodeType&&c.nodeValue.match(/[^ \f\n\r\t\v]/)?f+=1:4===c.nodeType&&(e+=1);if(h)if(2>f&&2>e)for(this.removeWhite(a),
c=a.firstChild;c;c=c.nextSibling)3===c.nodeType?b["#text"]=this.escape(c.nodeValue):4===c.nodeType?g.test(c.nodeValue)?b[c.nodeName]=[b[c.nodeName],c.nodeValue]:b["#cdata"]=this.escape(c.nodeValue):b[c.nodeName]?b[c.nodeName]instanceof Array?b[c.nodeName][b[c.nodeName].length]=this.toObj(c):b[c.nodeName]=[b[c.nodeName],this.toObj(c)]:b[c.nodeName]=this.toObj(c);else a.attributes.length?b["#text"]=this.escape(this.innerXml(a)):b=this.escape(this.innerXml(a));else if(f)a.attributes.length?b["#text"]=
this.escape(this.innerXml(a)):(b=this.escape(this.innerXml(a)),"__EMPTY_ARRAY_"===b?b="[]":"__EMPTY_STRING_"===b&&(b=""));else if(e)if(1<e)b=this.escape(this.innerXml(a));else for(c=a.firstChild;c;c=c.nextSibling)if(g.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(c.nodeValue)}a.attributes.length||a.firstChild||(b=null)}else 9===a.nodeType?b=this.toObj(a.documentElement):alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,g,f){void 0===
f&&(f=!0);var e=b?'"'+b+'"':"",h="\t",c="\n";f||(c=h="");if("[]"===a)e+=b?":[]":"[]";else if(a instanceof Array){var l,d,m=[];d=0;for(l=a.length;d<l;d+=1)m[d]=this.toJson(a[d],"",g+h,f);e+=(b?":[":"[")+(1<m.length?c+g+h+m.join(","+c+g+h)+c+g:m.join(""))+"]"}else if(null===a)e+=(b&&":")+"null";else if("object"===typeof a){l=[];for(d in a)a.hasOwnProperty(d)&&(l[l.length]=this.toJson(a[d],d,g+h,f));e+=(b?":{":"{")+(1<l.length?c+g+h+l.join(","+c+g+h)+c+g:l.join(""))+"}"}else e="string"===typeof a?e+
((b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"'):e+((b&&":")+a.toString());return e},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var g=function(a){var b="",h;if(1===a.nodeType){b+="<"+a.nodeName;for(h=0;h<a.attributes.length;h+=1)b+=" "+a.attributes[h].nodeName+'="'+(a.attributes[h].nodeValue||"").toString()+'"';if(a.firstChild){b+=">";for(h=a.firstChild;h;h=h.nextSibling)b+=g(h);b+="</"+a.nodeName+">"}else b+="/>"}else 3===a.nodeType?b+=a.nodeValue:4===a.nodeType&&
(b+="<![CDATA["+a.nodeValue+"]]\x3e");return b};for(a=a.firstChild;a;a=a.nextSibling)b+=g(a)}return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var b;for(b=a.firstChild;b;)if(3===b.nodeType)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var g=b.nextSibling;a.removeChild(b);b=g}else 1===b.nodeType&&this.removeWhite(b),b=b.nextSibling;return a}};
function tableToGrid(l,m){jQuery(l).each(function(){if(!this.grid){jQuery(this).width("99%");var b=jQuery(this).width(),c=jQuery("tr td:first-child input[type=checkbox]:first",jQuery(this)),a=jQuery("tr td:first-child input[type=radio]:first",jQuery(this)),c=0<c.length,a=!c&&0<a.length,k=c||a,d=[],e=[];jQuery("th",jQuery(this)).each(function(){0===d.length&&k?(d.push({name:"__selection__",index:"__selection__",width:0,hidden:!0}),e.push("__selection__")):(d.push({name:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150}),e.push(jQuery(this).html()))});var f=[],g=[],h=[];jQuery("tbody > tr",jQuery(this)).each(function(){var b={},a=0;jQuery("td",jQuery(this)).each(function(){if(0===a&&k){var c=jQuery("input",jQuery(this)),e=c.attr("value");g.push(e||f.length);c.is(":checked")&&h.push(e);b[d[a].name]=c.attr("value")}else b[d[a].name]=jQuery(this).html();a++});0<a&&f.push(b)});
jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:b,colNames:e,colModel:d,multiselect:c},m||{}));for(b=0;b<f.length;b++)a=null,0<g.length&&(a=g[b])&&a.replace&&(a=encodeURIComponent(a).replace(/[.\-%]/g,"_")),null===a&&(a=b+1),jQuery(this).jqGrid("addRowData",a,f[b]);for(b=0;b<h.length;b++)jQuery(this).jqGrid("setSelection",h[b])}})};
(function(b){b.jgrid.msie&&8===b.jgrid.msiever()&&(b.expr[":"].hidden=function(b){return 0===b.offsetWidth||0===b.offsetHeight||"none"===b.style.display});b.jgrid._multiselect=!1;if(b.ui&&b.ui.multiselect){if(b.ui.multiselect.prototype._setSelected){var q=b.ui.multiselect.prototype._setSelected;b.ui.multiselect.prototype._setSelected=function(a,g){var c=q.call(this,a,g);if(g&&this.selectedList){var d=this.element;this.selectedList.find("li").each(function(){b(this).data("optionLink")&&b(this).data("optionLink").remove().appendTo(d)})}return c}}b.ui.multiselect.prototype.destroy&&
(b.ui.multiselect.prototype.destroy=function(){this.element.show();this.container.remove();void 0===b.Widget?b.widget.prototype.destroy.apply(this,arguments):b.Widget.prototype.destroy.apply(this,arguments)});b.jgrid._multiselect=!0}b.jgrid.extend({sortableColumns:function(a){return this.each(function(){function g(){c.p.disableClick=!0}var c=this,d=b.jgrid.jqID(c.p.id),d={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+d+"_cb,#jqgh_"+d+"_rn,#jqgh_"+d+"_subgrid),:hidden)",
placeholder:{element:function(a){return b(document.createElement(a[0].nodeName)).addClass(a[0].className+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(b,a){a.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));a.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}},update:function(a,
d){var e=b(d.item).parent(),e=b(">th",e),f={},g=c.p.id+"_";b.each(c.p.colModel,function(b){f[this.name]=b});var h=[];e.each(function(){var a=b(">div",this).get(0).id.replace(/^jqgh_/,"").replace(g,"");f.hasOwnProperty(a)&&h.push(f[a])});b(c).jqGrid("remapColumns",h,!0,!0);b.isFunction(c.p.sortable.update)&&c.p.sortable.update(h);setTimeout(function(){c.p.disableClick=!1},50)}};c.p.sortable.options?b.extend(d,c.p.sortable.options):b.isFunction(c.p.sortable)&&(c.p.sortable={update:c.p.sortable});if(d.start){var h=
d.start;d.start=function(b,a){g();h.call(this,b,a)}}else d.start=g;c.p.sortable.exclude&&(d.items+=":not("+c.p.sortable.exclude+")");d=a.sortable(d);d=d.data("sortable")||d.data("uiSortable");null!=d&&(d.data("sortable").floating=!0)})},columnChooser:function(a){function g(a,c){a&&("string"===typeof a?b.fn[a]&&b.fn[a].apply(c,b.makeArray(arguments).slice(2)):b.isFunction(a)&&a.apply(c,b.makeArray(arguments).slice(2)))}var c=this,d,h,m={},s=[],e,f,n=c.jqGrid("getGridParam","colModel"),t=c.jqGrid("getGridParam",
"colNames"),k=function(a){return b.ui.multiselect.prototype&&a.data(b.ui.multiselect.prototype.widgetFullName||b.ui.multiselect.prototype.widgetName)||a.data("ui-multiselect")||a.data("multiselect")};if(!b("#colchooser_"+b.jgrid.jqID(c[0].p.id)).length){d=b('<div id="colchooser_'+c[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');h=b("select",d);a=b.extend({width:400,height:240,classname:null,done:function(b){b&&c.jqGrid("remapColumns",
b,!0)},msel:"multiselect",dlog:"dialog",dialog_opts:{minWidth:470,dialogClass:"ui-jqdialog"},dlog_opts:function(a){var c={};c[a.bSubmit]=function(){a.apply_perm();a.cleanup(!1)};c[a.bCancel]=function(){a.cleanup(!0)};return b.extend(!0,{buttons:c,close:function(){a.cleanup(!0)},modal:a.modal||!1,resizable:a.resizable||!0,width:a.width+70,resize:function(){var b=k(h),a=b.container.closest(".ui-dialog-content");0<a.length&&"object"===typeof a[0].style?a[0].style.width="":a.css("width","");b.selectedList.height(Math.max(b.selectedContainer.height()-
b.selectedActions.outerHeight()-1,1));b.availableList.height(Math.max(b.availableContainer.height()-b.availableActions.outerHeight()-1,1))}},a.dialog_opts||{})},apply_perm:function(){var d=[];b("option",h).each(function(){b(this).is("[selected]")?c.jqGrid("showCol",n[this.value].name):c.jqGrid("hideCol",n[this.value].name)});b("option[selected]",h).each(function(){d.push(parseInt(this.value,10))});b.each(d,function(){delete m[n[parseInt(this,10)].name]});b.each(m,function(){var b=parseInt(this,10);
var a=d,c=b,e,f;0<=c?(e=a.slice(),f=e.splice(c,Math.max(a.length-c,c)),c>a.length&&(c=a.length),e[c]=b,d=e.concat(f)):d=a});a.done&&a.done.call(c,d);c.jqGrid("setGridWidth",c[0].p.tblwidth,c[0].p.shrinkToFit)},cleanup:function(b){g(a.dlog,d,"destroy");g(a.msel,h,"destroy");d.remove();b&&a.done&&a.done.call(c)},msel_opts:{}},b.jgrid.col,a||{});if(b.ui&&b.ui.multiselect&&b.ui.multiselect.defaults){if(!b.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
return}a.msel_opts=b.extend(b.ui.multiselect.defaults,a.msel_opts)}a.caption&&d.attr("title",a.caption);a.classname&&(d.addClass(a.classname),h.addClass(a.classname));a.width&&(b(">div",d).css({width:a.width,margin:"0 auto"}),h.css("width",a.width));a.height&&(b(">div",d).css("height",a.height),h.css("height",a.height-10));h.empty();b.each(n,function(a){m[this.name]=a;this.hidedlg?this.hidden||s.push(a):h.append("<option value='"+a+"' "+(this.hidden?"":"selected='selected'")+">"+b.jgrid.stripHtml(t[a])+
"</option>")});e=b.isFunction(a.dlog_opts)?a.dlog_opts.call(c,a):a.dlog_opts;g(a.dlog,d,e);e=b.isFunction(a.msel_opts)?a.msel_opts.call(c,a):a.msel_opts;g(a.msel,h,e);e=b("#colchooser_"+b.jgrid.jqID(c[0].p.id));e.css({margin:"auto"});e.find(">div").css({width:"100%",height:"100%",margin:"auto"});e=k(h);e.container.css({width:"100%",height:"100%",margin:"auto"});e.selectedContainer.css({width:100*e.options.dividerLocation+"%",height:"100%",margin:"auto",boxSizing:"border-box"});e.availableContainer.css({width:100-
100*e.options.dividerLocation+"%",height:"100%",margin:"auto",boxSizing:"border-box"});e.selectedList.css("height","auto");e.availableList.css("height","auto");f=Math.max(e.selectedList.height(),e.availableList.height());f=Math.min(f,b(window).height());e.selectedList.css("height",f);e.availableList.css("height",f)}},sortableRows:function(a){return this.each(function(){var g=this;g.grid&&!g.p.treeGrid&&b.fn.sortable&&(a=b.extend({cursor:"move",axis:"y",items:".jqgrow"},a||{}),a.start&&b.isFunction(a.start)?
(a._start_=a.start,delete a.start):a._start_=!1,a.update&&b.isFunction(a.update)?(a._update_=a.update,delete a.update):a._update_=!1,a.start=function(c,d){b(d.item).css("border-width","0");b("td",d.item).each(function(b){this.style.width=g.grid.cols[b].style.width});if(g.p.subGrid){var h=b(d.item).attr("id");try{b(g).jqGrid("collapseSubGridRow",h)}catch(m){}}a._start_&&a._start_.apply(this,[c,d])},a.update=function(c,d){b(d.item).css("border-width","");!0===g.p.rownumbers&&b("td.jqgrid-rownum",g.rows).each(function(a){b(this).html(a+
1+(parseInt(g.p.page,10)-1)*parseInt(g.p.rowNum,10))});a._update_&&a._update_.apply(this,[c,d])},b("tbody:first",g).sortable(a),b("tbody:first",g).disableSelection())})},gridDnD:function(a){return this.each(function(){function g(){var a=b.data(c,"dnd");b("tr.jqgrow:not(.ui-draggable)",c).draggable(b.isFunction(a.drag)?a.drag.call(b(c),a):a.drag)}var c=this,d,h;if(c.grid&&!c.p.treeGrid&&b.fn.draggable&&b.fn.droppable)if(void 0===b("#jqgrid_dnd")[0]&&b("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"),
"string"===typeof a&&"updateDnD"===a&&!0===c.p.jqgdnd)g();else if(a=b.extend({drag:function(a){return b.extend({start:function(d,e){var f;if(c.p.subGrid){f=b(e.helper).attr("id");try{b(c).jqGrid("collapseSubGridRow",f)}catch(g){}}for(f=0;f<b.data(c,"dnd").connectWith.length;f++)0===b(b.data(c,"dnd").connectWith[f]).jqGrid("getGridParam","reccount")&&b(b.data(c,"dnd").connectWith[f]).jqGrid("addRowData","jqg_empty_row",{});e.helper.addClass("ui-state-highlight");b("td",e.helper).each(function(b){this.style.width=
c.grid.headers[b].width+"px"});a.onstart&&b.isFunction(a.onstart)&&a.onstart.call(b(c),d,e)},stop:function(d,e){var f;e.helper.dropped&&!a.dragcopy&&(f=b(e.helper).attr("id"),void 0===f&&(f=b(this).attr("id")),b(c).jqGrid("delRowData",f));for(f=0;f<b.data(c,"dnd").connectWith.length;f++)b(b.data(c,"dnd").connectWith[f]).jqGrid("delRowData","jqg_empty_row");a.onstop&&b.isFunction(a.onstop)&&a.onstop.call(b(c),d,e)}},a.drag_opts||{})},drop:function(a){return b.extend({accept:function(a){if(!b(a).hasClass("jqgrow"))return a;
a=b(a).closest("table.ui-jqgrid-btable");return 0<a.length&&void 0!==b.data(a[0],"dnd")?(a=b.data(a[0],"dnd").connectWith,-1!==b.inArray("#"+b.jgrid.jqID(this.id),a)?!0:!1):!1},drop:function(d,e){if(b(e.draggable).hasClass("jqgrow")){var f=b(e.draggable).attr("id"),f=e.draggable.parent().parent().jqGrid("getRowData",f);if(!a.dropbyname){var g=0,h={},k,p,r=b("#"+b.jgrid.jqID(this.id)).jqGrid("getGridParam","colModel");try{for(p in f)f.hasOwnProperty(p)&&(k=r[g].name,"cb"!==k&&"rn"!==k&&"subgrid"!==
k&&f.hasOwnProperty(p)&&r[g]&&(h[k]=f[p]),g++);f=h}catch(q){}}e.helper.dropped=!0;a.beforedrop&&b.isFunction(a.beforedrop)&&(k=a.beforedrop.call(this,d,e,f,b("#"+b.jgrid.jqID(c.p.id)),b(this)),void 0!==k&&null!==k&&"object"===typeof k&&(f=k));if(e.helper.dropped){var l;a.autoid&&(b.isFunction(a.autoid)?l=a.autoid.call(this,f):(l=Math.ceil(1E3*Math.random()),l=a.autoidprefix+l));b("#"+b.jgrid.jqID(this.id)).jqGrid("addRowData",l,f,a.droppos)}a.ondrop&&b.isFunction(a.ondrop)&&a.ondrop.call(this,d,e,
f)}}},a.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},dragcopy:!1,dropbyname:!1,droppos:"first",autoid:!0,autoidprefix:"dnd_"},a||{}),a.connectWith)for(a.connectWith=a.connectWith.split(","),a.connectWith=b.map(a.connectWith,function(a){return b.trim(a)}),b.data(c,"dnd",a),0===c.p.reccount||c.p.jqgdnd||g(),c.p.jqgdnd=
!0,d=0;d<a.connectWith.length;d++)h=a.connectWith[d],b(h).droppable(b.isFunction(a.drop)?a.drop.call(b(c),a):a.drop)})},gridResize:function(a){return this.each(function(){var g=this,c=b.jgrid.jqID(g.p.id);g.grid&&b.fn.resizable&&(a=b.extend({},a||{}),a.alsoResize?(a._alsoResize_=a.alsoResize,delete a.alsoResize):a._alsoResize_=!1,a.stop&&b.isFunction(a.stop)?(a._stop_=a.stop,delete a.stop):a._stop_=!1,a.stop=function(d,h){b(g).jqGrid("setGridParam",{height:b("#gview_"+c+" .ui-jqgrid-bdiv").height()});
b(g).jqGrid("setGridWidth",h.size.width,a.shrinkToFit);a._stop_&&a._stop_.call(g,d,h)},a.alsoResize=a._alsoResize_?eval("("+("{'#gview_"+c+" .ui-jqgrid-bdiv':true,'"+a._alsoResize_+"':true}")+")"):b(".ui-jqgrid-bdiv","#gview_"+c),delete a._alsoResize_,b("#gbox_"+c).resizable(a))})}})})(jQuery);
