jqgrid-jquery-rails 4.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +52 -0
  6. data/Rakefile +1 -0
  7. data/jqgrid-jquery-rails.gemspec +27 -0
  8. data/lib/jqgrid-jquery-rails.rb +2 -0
  9. data/lib/jqgrid-jquery-rails/engine.rb +6 -0
  10. data/lib/jqgrid-jquery-rails/version.rb +12 -0
  11. data/vendor/assets/javascripts/i18n/grid.locale-ar.js +126 -0
  12. data/vendor/assets/javascripts/i18n/grid.locale-bg.js +132 -0
  13. data/vendor/assets/javascripts/i18n/grid.locale-bg1251.js +132 -0
  14. data/vendor/assets/javascripts/i18n/grid.locale-cat.js +128 -0
  15. data/vendor/assets/javascripts/i18n/grid.locale-cn.js +132 -0
  16. data/vendor/assets/javascripts/i18n/grid.locale-cs.js +128 -0
  17. data/vendor/assets/javascripts/i18n/grid.locale-da.js +128 -0
  18. data/vendor/assets/javascripts/i18n/grid.locale-de.js +133 -0
  19. data/vendor/assets/javascripts/i18n/grid.locale-el.js +126 -0
  20. data/vendor/assets/javascripts/i18n/grid.locale-en.js +128 -0
  21. data/vendor/assets/javascripts/i18n/grid.locale-es.js +128 -0
  22. data/vendor/assets/javascripts/i18n/grid.locale-fa.js +145 -0
  23. data/vendor/assets/javascripts/i18n/grid.locale-fi.js +129 -0
  24. data/vendor/assets/javascripts/i18n/grid.locale-fr.js +126 -0
  25. data/vendor/assets/javascripts/i18n/grid.locale-gl.js +126 -0
  26. data/vendor/assets/javascripts/i18n/grid.locale-he.js +127 -0
  27. data/vendor/assets/javascripts/i18n/grid.locale-hr.js +128 -0
  28. data/vendor/assets/javascripts/i18n/grid.locale-hr1250.js +128 -0
  29. data/vendor/assets/javascripts/i18n/grid.locale-hu.js +129 -0
  30. data/vendor/assets/javascripts/i18n/grid.locale-is.js +126 -0
  31. data/vendor/assets/javascripts/i18n/grid.locale-it.js +1 -0
  32. data/vendor/assets/javascripts/i18n/grid.locale-ja.js +155 -0
  33. data/vendor/assets/javascripts/i18n/grid.locale-lt.js +128 -0
  34. data/vendor/assets/javascripts/i18n/grid.locale-mne.js +128 -0
  35. data/vendor/assets/javascripts/i18n/grid.locale-nl.js +149 -0
  36. data/vendor/assets/javascripts/i18n/grid.locale-no.js +1 -0
  37. data/vendor/assets/javascripts/i18n/grid.locale-pl.js +127 -0
  38. data/vendor/assets/javascripts/i18n/grid.locale-pt-br.js +127 -0
  39. data/vendor/assets/javascripts/i18n/grid.locale-pt.js +125 -0
  40. data/vendor/assets/javascripts/i18n/grid.locale-ro.js +139 -0
  41. data/vendor/assets/javascripts/i18n/grid.locale-ru.js +127 -0
  42. data/vendor/assets/javascripts/i18n/grid.locale-sk.js +127 -0
  43. data/vendor/assets/javascripts/i18n/grid.locale-sr.js +128 -0
  44. data/vendor/assets/javascripts/i18n/grid.locale-sv.js +127 -0
  45. data/vendor/assets/javascripts/i18n/grid.locale-th.js +128 -0
  46. data/vendor/assets/javascripts/i18n/grid.locale-tr.js +126 -0
  47. data/vendor/assets/javascripts/i18n/grid.locale-ua.js +127 -0
  48. data/vendor/assets/javascripts/jqgrid-jquery-rails.js +5 -0
  49. data/vendor/assets/javascripts/jquery.jqGrid.min.js +487 -0
  50. data/vendor/assets/stylesheets/jqgrid-jquery-rails.css +6 -0
  51. data/vendor/assets/stylesheets/ui.jqgrid.css +136 -0
  52. metadata +165 -0
@@ -0,0 +1,5 @@
1
+ //= require jquery
2
+ //= require jquery.ui.all
3
+
4
+ //= require i18n/grid.locale-en
5
+ //= require jquery.jqGrid.min.js
@@ -0,0 +1,487 @@
1
+ /*
2
+ * jqGrid 4.2.0 - jQuery Grid
3
+ * Copyright (c) 2008, Tony Tomov, tony@trirand.com
4
+ * Dual licensed under the MIT and GPL licenses
5
+ * http://www.opensource.org/licenses/mit-license.php
6
+ * http://www.gnu.org/licenses/gpl-2.0.html
7
+ * Date:2011-10-11
8
+ * Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; grid.formedit.js; grid.filter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.grouping.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.tbltogrid.js; grid.jqueryui.js;
9
+ */
10
+ /*
11
+ jqGrid 4.2.0 - jQuery Grid
12
+ Copyright (c) 2008, Tony Tomov, tony@trirand.com
13
+ Dual licensed under the MIT and GPL licenses
14
+ http://www.opensource.org/licenses/mit-license.php
15
+ http://www.gnu.org/licenses/gpl-2.0.html
16
+ Date: 2011-10-11
17
+ */
18
+ (function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(f){if(f&&(f=="&nbsp;"||f=="&#160;"||f.length==1&&f.charCodeAt(0)==160))return"";return!f?f:String(f).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")},htmlEncode:function(f){return!f?f:String(f).replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},format:function(f){var i=b.makeArray(arguments).slice(1);if(f===undefined)f="";return f.replace(/\{(\d+)\}/g,
19
+ function(h,c){return i[c]})},getCellIndex:function(f){f=b(f);if(f.is("tr"))return-1;f=(!f.is("td")&&!f.is("th")?f.closest("td,th"):f)[0];if(b.browser.msie)return b.inArray(f,f.parentNode.cells);return f.cellIndex},stripHtml:function(f){f+="";var i=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(f)return(f=f.replace(i,""))&&f!=="&nbsp;"&&f!=="&#160;"?f.replace(/\"/g,"'"):"";else return f},stripPref:function(f,i){var h=Object.prototype.toString.call(f).slice(8,-1);if(h=="String"||h=="Number"){f=String(f);i=f!=""?
20
+ String(i).replace(String(f),""):i}return i},stringToDoc:function(f){var i;if(typeof f!=="string")return f;try{i=(new DOMParser).parseFromString(f,"text/xml")}catch(h){i=new ActiveXObject("Microsoft.XMLDOM");i.async=false;i.loadXML(f)}return i&&i.documentElement&&i.documentElement.tagName!="parsererror"?i:null},parse:function(f){if(f.substr(0,9)=="while(1);")f=f.substr(9);if(f.substr(0,2)=="/*")f=f.substr(2,f.length-4);f||(f="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse===
21
+ "function"?JSON.parse(f):eval("("+f+")")},parseDate:function(f,i){var h={m:1,d:1,y:1970,h:0,i:0,s:0},c,g,k;c=/[\\\/:_;.,\t\T\s-]/;if(i&&i!==null&&i!==undefined){i=b.trim(i);i=i.split(c);f=f.split(c);var l=b.jgrid.formatter.date.monthNames,a=b.jgrid.formatter.date.AmPm,r=function(x,y){if(x===0){if(y==12)y=0}else if(y!=12)y+=12;return y};c=0;for(g=f.length;c<g;c++){if(f[c]=="M"){k=b.inArray(i[c],l);if(k!==-1&&k<12)i[c]=k+1}if(f[c]=="F"){k=b.inArray(i[c],l);if(k!==-1&&k>11)i[c]=k+1-12}if(f[c]=="a"){k=
22
+ b.inArray(i[c],a);if(k!==-1&&k<2&&i[c]==a[k]){i[c]=k;h.h=r(i[c],h.h)}}if(f[c]=="A"){k=b.inArray(i[c],a);if(k!==-1&&k>1&&i[c]==a[k]){i[c]=k-2;h.h=r(i[c],h.h)}}if(i[c]!==undefined)h[f[c].toLowerCase()]=parseInt(i[c],10)}h.m=parseInt(h.m,10)-1;c=h.y;if(c>=70&&c<=99)h.y=1900+h.y;else if(c>=0&&c<=69)h.y=2E3+h.y}return new Date(h.y,h.m,h.d,h.h,h.i,h.s,0)},jqID:function(f){return String(f).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(f){return(f?f:b.jgrid.uidPref)+
23
+ b.jgrid.guid++},getAccessor:function(f,i){var h,c,g=[],k;if(typeof i==="function")return i(f);h=f[i];if(h===undefined)try{if(typeof i==="string")g=i.split(".");if(k=g.length)for(h=f;h&&k--;){c=g.shift();h=h[c]}}catch(l){}return h},ajaxOptions:{},from:function(f){return new function(i,h){if(typeof i=="string")i=b.data(i);var c=this,g=i,k=true,l=false,a=h,r=/[\$,%]/g,x=null,y=null,H=0,L=false,M="",P=[],U=true;if(typeof i=="object"&&i.push){if(i.length>0)U=typeof i[0]!="object"?false:true}else throw"data provides is not an array";
24
+ this._hasData=function(){return g===null?false:g.length===0?false:true};this._getStr=function(o){var n=[];l&&n.push("jQuery.trim(");n.push("String("+o+")");l&&n.push(")");k||n.push(".toLowerCase()");return n.join("")};this._strComp=function(o){return typeof o=="string"?".toString()":""};this._group=function(o,n){return{field:o.toString(),unique:n,items:[]}};this._toStr=function(o){if(l)o=b.trim(o);k||(o=o.toLowerCase());return o=o.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=
25
+ function(o){var n=[];b.each(g,function(s,D){n.push(o(D))});return n};this._append=function(o){var n;if(a===null)a="";else a+=M===""?" && ":M;for(n=0;n<H;n++)a+="(";if(L)a+="!";a+="("+o+")";L=false;M="";H=0};this._setCommand=function(o,n){x=o;y=n};this._resetNegate=function(){L=false};this._repeatCommand=function(o,n){if(x===null)return c;if(o!==null&&n!==null)return x(o,n);if(y===null)return x(o);if(!U)return x(o);return x(y,o)};this._equals=function(o,n){return c._compare(o,n,1)===0};this._compare=
26
+ function(o,n,s){if(s===undefined)s=1;if(o===undefined)o=null;if(n===undefined)n=null;if(o===null&&n===null)return 0;if(o===null&&n!==null)return 1;if(o!==null&&n===null)return-1;if(!k&&typeof o!=="number"&&typeof n!=="number"){o=String(o).toLowerCase();n=String(n).toLowerCase()}if(o<n)return-s;if(o>n)return s;return 0};this._performSort=function(){if(P.length!==0)g=c._doSort(g,0)};this._doSort=function(o,n){var s=P[n].by,D=P[n].dir,T=P[n].type,J=P[n].datefmt;if(n==P.length-1)return c._getOrder(o,
27
+ s,D,T,J);n++;s=c._getGroup(o,s,D,T,J);D=[];for(T=0;T<s.length;T++){J=c._doSort(s[T].items,n);for(var C=0;C<J.length;C++)D.push(J[C])}return D};this._getOrder=function(o,n,s,D,T){var J=[],C=[],ca=s=="a"?1:-1,V,fa;if(D===undefined)D="text";fa=D=="float"||D=="number"||D=="currency"||D=="numeric"?function(R){R=parseFloat(String(R).replace(r,""));return isNaN(R)?0:R}:D=="int"||D=="integer"?function(R){return R?parseFloat(String(R).replace(r,"")):0}:D=="date"||D=="datetime"?function(R){return b.jgrid.parseDate(T,
28
+ R).getTime()}:b.isFunction(D)?D:function(R){R||(R="");return b.trim(String(R).toUpperCase())};b.each(o,function(R,$){V=n!==""?b.jgrid.getAccessor($,n):$;if(V===undefined)V="";V=fa(V,$);C.push({vSort:V,index:R})});C.sort(function(R,$){R=R.vSort;$=$.vSort;return c._compare(R,$,ca)});D=0;for(var oa=o.length;D<oa;){s=C[D].index;J.push(o[s]);D++}return J};this._getGroup=function(o,n,s,D,T){var J=[],C=null,ca=null,V;b.each(c._getOrder(o,n,s,D,T),function(fa,oa){V=b.jgrid.getAccessor(oa,n);if(V===undefined)V=
29
+ "";if(!c._equals(ca,V)){ca=V;C!==null&&J.push(C);C=c._group(n,V)}C.items.push(oa)});C!==null&&J.push(C);return J};this.ignoreCase=function(){k=false;return c};this.useCase=function(){k=true;return c};this.trim=function(){l=true;return c};this.noTrim=function(){l=false;return c};this.execute=function(){var o=a,n=[];if(o===null)return c;b.each(g,function(){eval(o)&&n.push(this)});g=n;return c};this.data=function(){return g};this.select=function(o){c._performSort();if(!c._hasData())return[];c.execute();
30
+ if(b.isFunction(o)){var n=[];b.each(g,function(s,D){n.push(o(D))});return n}return g};this.hasMatch=function(){if(!c._hasData())return false;c.execute();return g.length>0};this.andNot=function(o,n,s){L=!L;return c.and(o,n,s)};this.orNot=function(o,n,s){L=!L;return c.or(o,n,s)};this.not=function(o,n,s){return c.andNot(o,n,s)};this.and=function(o,n,s){M=" && ";if(o===undefined)return c;return c._repeatCommand(o,n,s)};this.or=function(o,n,s){M=" || ";if(o===undefined)return c;return c._repeatCommand(o,
31
+ n,s)};this.orBegin=function(){H++;return c};this.orEnd=function(){if(a!==null)a+=")";return c};this.isNot=function(o){L=!L;return c.is(o)};this.is=function(o){c._append("this."+o);c._resetNegate();return c};this._compareValues=function(o,n,s,D,T){var J;J=U?"jQuery.jgrid.getAccessor(this,'"+n+"')":"this";if(s===undefined)s=null;var C=s,ca=T.stype===undefined?"text":T.stype;if(s!==null)switch(ca){case "int":case "integer":C=isNaN(Number(C))||C===""?"0":C;J="parseInt("+J+",10)";C="parseInt("+C+",10)";
32
+ break;case "float":case "number":case "numeric":C=String(C).replace(r,"");C=isNaN(Number(C))||C===""?"0":C;J="parseFloat("+J+")";C="parseFloat("+C+")";break;case "date":case "datetime":C=String(b.jgrid.parseDate(T.newfmt||"Y-m-d",C).getTime());J='jQuery.jgrid.parseDate("'+T.srcfmt+'",'+J+").getTime()";break;default:J=c._getStr(J);C=c._getStr('"'+c._toStr(C)+'"')}c._append(J+" "+D+" "+C);c._setCommand(o,n);c._resetNegate();return c};this.equals=function(o,n,s){return c._compareValues(c.equals,o,n,
33
+ "==",s)};this.notEquals=function(o,n,s){return c._compareValues(c.equals,o,n,"!==",s)};this.isNull=function(o,n,s){return c._compareValues(c.equals,o,null,"===",s)};this.greater=function(o,n,s){return c._compareValues(c.greater,o,n,">",s)};this.less=function(o,n,s){return c._compareValues(c.less,o,n,"<",s)};this.greaterOrEquals=function(o,n,s){return c._compareValues(c.greaterOrEquals,o,n,">=",s)};this.lessOrEquals=function(o,n,s){return c._compareValues(c.lessOrEquals,o,n,"<=",s)};this.startsWith=
34
+ function(o,n){var s=n===undefined||n===null?o:n;s=l?b.trim(s.toString()).length:s.toString().length;if(U)c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".substr(0,"+s+") == "+c._getStr('"'+c._toStr(n)+'"'));else{s=l?b.trim(n.toString()).length:n.toString().length;c._append(c._getStr("this")+".substr(0,"+s+") == "+c._getStr('"'+c._toStr(o)+'"'))}c._setCommand(c.startsWith,o);c._resetNegate();return c};this.endsWith=function(o,n){var s=n===undefined||n===null?o:n;s=l?b.trim(s.toString()).length:
35
+ s.toString().length;U?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".substr("+c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+".length-"+s+","+s+') == "'+c._toStr(n)+'"'):c._append(c._getStr("this")+".substr("+c._getStr("this")+'.length-"'+c._toStr(o)+'".length,"'+c._toStr(o)+'".length) == "'+c._toStr(o)+'"');c._setCommand(c.endsWith,o);c._resetNegate();return c};this.contains=function(o,n){U?c._append(c._getStr("jQuery.jgrid.getAccessor(this,'"+o+"')")+'.indexOf("'+c._toStr(n)+
36
+ '",0) > -1'):c._append(c._getStr("this")+'.indexOf("'+c._toStr(o)+'",0) > -1');c._setCommand(c.contains,o);c._resetNegate();return c};this.groupBy=function(o,n,s,D){if(!c._hasData())return null;return c._getGroup(g,o,n,s,D)};this.orderBy=function(o,n,s,D){n=n===undefined||n===null?"a":b.trim(n.toString().toLowerCase());if(s===null||s===undefined)s="text";if(D===null||D===undefined)D="Y-m-d";if(n=="desc"||n=="descending")n="d";if(n=="asc"||n=="ascending")n="a";P.push({by:o,dir:n,type:s,datefmt:D});
37
+ return c};return c}(f,null)},extend:function(f){b.extend(b.fn.jqGrid,f);this.no_legacy_api||b.fn.extend(f)}});b.fn.jqGrid=function(f){if(typeof f=="string"){var i=b.jgrid.getAccessor(b.fn.jqGrid,f);if(!i)throw"jqGrid - No such method: "+f;var h=b.makeArray(arguments).slice(1);return i.apply(this,h)}return this.each(function(){if(!this.grid){var c=b.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",
38
+ sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,beforeProcessing:null,onHeaderClick:null,viewrecords:false,loadonce:false,
39
+ multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",
40
+ toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,
41
+ data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,sortitems:[],sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{},idPrefix:""},b.jgrid.defaults,f||{}),g={headers:[],cols:[],footers:[],dragStart:function(d,e,j){this.resizing={idx:d,startX:e.clientX,sOL:j[0]};this.hDiv.style.cursor="col-resize";
42
+ this.curGbox=b("#rs_m"+b.jgrid.jqID(c.id),"#gbox_"+b.jgrid.jqID(c.id));this.curGbox.css({display:"block",left:j[0],top:j[1],height:j[2]});b.isFunction(c.resizeStart)&&c.resizeStart.call(this,e,d);document.onselectstart=function(){return false}},dragMove:function(d){if(this.resizing){var e=d.clientX-this.resizing.startX;d=this.headers[this.resizing.idx];var j=c.direction==="ltr"?d.width+e:d.width-e,m;if(j>33){this.curGbox.css({left:this.resizing.sOL+e});if(c.forceFit===true){m=this.headers[this.resizing.idx+
43
+ c.nv];e=c.direction==="ltr"?m.width-e:m.width+e;if(e>33){d.newWidth=j;m.newWidth=e}}else{this.newWidth=c.direction==="ltr"?c.tblwidth+e:c.tblwidth-e;d.newWidth=j}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var d=this.resizing.idx,e=this.headers[d].newWidth||this.headers[d].width;e=parseInt(e,10);this.resizing=false;b("#rs_m"+b.jgrid.jqID(c.id)).css("display","none");c.colModel[d].width=e;this.headers[d].width=e;this.headers[d].el.style.width=e+"px";this.cols[d].style.width=
44
+ e+"px";if(this.footers.length>0)this.footers[d].style.width=e+"px";if(c.forceFit===true){e=this.headers[d+c.nv].newWidth||this.headers[d+c.nv].width;this.headers[d+c.nv].width=e;this.headers[d+c.nv].el.style.width=e+"px";this.cols[d+c.nv].style.width=e+"px";if(this.footers.length>0)this.footers[d+c.nv].style.width=e+"px";c.colModel[d+c.nv].width=e}else{c.tblwidth=this.newWidth||c.tblwidth;b("table:first",this.bDiv).css("width",c.tblwidth+"px");b("table:first",this.hDiv).css("width",c.tblwidth+"px");
45
+ this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(c.footerrow){b("table:first",this.sDiv).css("width",c.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}b.isFunction(c.resizeStop)&&c.resizeStop.call(this,e,d)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var d=b(g.bDiv).height();if(d){var e=b("table:first",g.bDiv),j,m;if(e[0].rows.length)try{m=(j=e[0].rows[1])?b(j).outerHeight()||g.prevRowHeight:g.prevRowHeight}catch(p){m=
46
+ g.prevRowHeight}if(m){g.prevRowHeight=m;var B=c.rowNum;j=g.scrollTop=g.bDiv.scrollTop;var t=Math.round(e.position().top)-j,E=t+e.height();m*=B;var v,z,u;if(E<d&&t<=0&&(c.lastpage===undefined||parseInt((E+j+m-1)/m,10)<=c.lastpage)){z=parseInt((d-E+m-1)/m,10);if(E>=0||z<2||c.scroll===true){v=Math.round((E+j)/m)+1;t=-1}else t=1}if(t>0){v=parseInt(j/m,10)+1;z=parseInt((j+d)/m,10)+2-v;u=true}if(z)if(!(c.lastpage&&v>c.lastpage||c.lastpage==1||v===c.page&&v===c.lastpage))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,
47
+ c.scrollTimeout);else{c.page=v;if(u){g.selectionPreserver(e[0]);g.emptyRows(g.bDiv,false,false)}g.populate(z)}}}},scrollGrid:function(d){if(c.scroll){var e=g.bDiv.scrollTop;if(g.scrollTop===undefined)g.scrollTop=0;if(e!=g.scrollTop){g.scrollTop=e;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,c.scrollTimeout)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(c.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft;d&&d.stopPropagation()},selectionPreserver:function(d){var e=d.p,j=e.selrow,m=e.selarrrow?
48
+ b.makeArray(e.selarrrow):null,p=d.grid.bDiv.scrollLeft,B=e.gridComplete;e.gridComplete=function(){e.selrow=null;e.selarrrow=[];if(e.multiselect&&m&&m.length>0)for(var t=0;t<m.length;t++)m[t]!=j&&b(d).jqGrid("setSelection",m[t],false);j&&b(d).jqGrid("setSelection",j,false);d.grid.bDiv.scrollLeft=p;e.gridComplete=B;e.gridComplete&&B()}}};if(this.tagName.toUpperCase()!="TABLE")alert("Element is not a table");else{b(this).empty().attr("tabindex","1");this.p=c;this.p.useProp=!!b.fn.prop;var k,l,a;if(this.p.colNames.length===
49
+ 0)for(k=0;k<this.p.colModel.length;k++)this.p.colNames[k]=this.p.colModel[k].label||this.p.colModel[k].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);else{var r=b("<div class='ui-jqgrid-view'></div>"),x,y=b.browser.msie?true:false,H=b.browser.webkit||b.browser.safari?true:false;a=this;a.p.direction=b.trim(a.p.direction.toLowerCase());if(b.inArray(a.p.direction,["ltr","rtl"])==-1)a.p.direction="ltr";l=a.p.direction;b(r).insertBefore(this);b(this).appendTo(r).removeClass("scroll");
50
+ var L=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(L).insertBefore(r).attr({id:"gbox_"+this.id,dir:l});b(r).appendTo(L).attr("id","gview_"+this.id);x=y&&b.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(x).insertBefore(r);b("<div class='loading ui-state-default ui-state-active' id='load_"+
51
+ this.id+"'>"+this.p.loadtext+"</div>").insertBefore(r);b(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var M=function(d,e){d=parseInt(d,10);return isNaN(d)?e?e:0:d},P=function(d,e,j,m,p,B){var t=a.p.colModel[d],E=t.align,v='style="',z=t.classes,u=t.name,q=[];if(E)v+="text-align:"+E+";";if(t.hidden===true)v+="display:none;";if(e===0)v+="width: "+g.headers[d].width+"px;";else if(t.cellattr&&b.isFunction(t.cellattr))if((d=
52
+ t.cellattr.call(a,p,j,m,t,B))&&typeof d==="string"){d=d.replace(/style/i,"style").replace(/title/i,"title");if(d.indexOf("title")>-1)t.title=false;if(d.indexOf("class")>-1)z=undefined;q=d.split("style");if(q.length===2){q[1]=b.trim(q[1].replace("=",""));if(q[1].indexOf("'")===0||q[1].indexOf('"')===0)q[1]=q[1].substring(1);v+=q[1].replace(/'/gi,'"')}else v+='"'}if(!q.length){q[0]="";v+='"'}v+=(z!==undefined?' class="'+z+'"':"")+(t.title&&j?' title="'+b.jgrid.stripHtml(j)+'"':"");v+=' aria-describedby="'+
53
+ a.p.id+"_"+u+'"';return v+q[0]},U=function(d){return d===undefined||d===null||d===""?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(d):d+""},o=function(d,e,j,m,p){var B=a.p.colModel[j];if(typeof B.formatter!=="undefined"){d={rowId:d,colModel:B,gid:a.p.id,pos:j};e=b.isFunction(B.formatter)?B.formatter.call(a,e,d,m,p):b.fmatter?b.fn.fmatter(B.formatter,e,d,m,p):U(e)}else e=U(e);return e},n=function(d,e,j,m,p){e=o(d,e,j,p,"add");return'<td role="gridcell" '+P(j,m,e,p,d,true)+">"+e+"</td>"},s=function(d,
54
+ e,j){var m='<input role="checkbox" type="checkbox" id="jqg_'+a.p.id+"_"+d+'" class="cbox" name="jqg_'+a.p.id+"_"+d+'"/>';return'<td role="gridcell" '+P(e,j,"",null,d,true)+">"+m+"</td>"},D=function(d,e,j,m){j=(parseInt(j,10)-1)*parseInt(m,10)+1+e;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+P(d,e,j,null,e,true)+">"+j+"</td>"},T=function(d){var e,j=[],m=0,p;for(p=0;p<a.p.colModel.length;p++){e=a.p.colModel[p];if(e.name!=="cb"&&e.name!=="subgrid"&&e.name!=="rn"){j[m]=d=="local"?
55
+ e.name:d=="xml"?e.xmlmap||e.name:e.jsonmap||e.name;m++}}return j},J=function(d){var e=a.p.remapColumns;if(!e||!e.length)e=b.map(a.p.colModel,function(j,m){return m});if(d)e=b.map(e,function(j){return j<d?null:j-d});return e},C=function(d,e,j){if(a.p.deepempty)b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:gt(0)").remove();else{var m=b("#"+b.jgrid.jqID(a.p.id)+" tbody:first tr:first")[0];b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").empty().append(m)}if(e&&a.p.scroll){b(">div:first",d).css({height:"auto"}).children("div:first").css({height:0,
56
+ display:"none"});d.scrollTop=0}if(j===true)if(a.p.treeGrid===true){a.p.data=[];a.p._index={}}},ca=function(){var d=a.p.data.length,e,j,m;e=a.p.rownumbers===true?1:0;j=a.p.multiselect===true?1:0;m=a.p.subGrid===true?1:0;e=a.p.keyIndex===false||a.p.loadonce===true?a.p.localReader.id:a.p.colModel[a.p.keyIndex+j+m+e].name;for(j=0;j<d;j++){m=b.jgrid.getAccessor(a.p.data[j],e);a.p._index[m]=j}},V=function(d,e,j,m,p){var B=new Date,t=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="xmlstring",E=a.p.datatype==
57
+ "local"?"local":"xml";if(t){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(b.isXMLDoc(d)){if(a.p.treeANode===-1&&!a.p.scroll){C(e,false,true);j=1}else j=j>1?j:1;var v,z,u=0,q,F=0,S=0,N=0,K,O=[],Y,I={},w,A,G=[],ia=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(O=T(E));K=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;if(O.length>0&&!isNaN(K)){if(a.p.remapColumns&&a.p.remapColumns.length)K=b.inArray(K,a.p.remapColumns);K=O[K]}E=(K+"").indexOf("[")===-1?
58
+ O.length?function(ga,aa){return b(K,ga).text()||aa}:function(ga,aa){return b(a.p.xmlReader.cell,ga).eq(K).text()||aa}:function(ga,aa){return ga.getAttribute(K.replace(/[\[\]]/g,""))||aa};a.p.userData={};b(a.p.xmlReader.page,d).each(function(){a.p.page=this.textContent||this.text||0});b(a.p.xmlReader.total,d).each(function(){a.p.lastpage=this.textContent||this.text;if(a.p.lastpage===undefined)a.p.lastpage=1});b(a.p.xmlReader.records,d).each(function(){a.p.records=this.textContent||this.text||0});b(a.p.xmlReader.userdata,
59
+ d).each(function(){a.p.userData[this.getAttribute("name")]=b(this).text()});(d=b(a.p.xmlReader.root+" "+a.p.xmlReader.row,d))||(d=[]);var ba=d.length,W=0,Z={},ha;if(d&&ba){ha=parseInt(a.p.rowNum,10);var pa=a.p.scroll?b.jgrid.randId():1;if(p)ha*=p+1;p=b.isFunction(a.p.afterInsertRow);var qa="";if(a.p.grouping&&a.p.groupingView.groupCollapse===true)qa=' style="display:none;"';for(;W<ba;){w=d[W];A=E(w,pa+W);A=a.p.idPrefix+A;v=j===0?0:j+1;v=(v+W)%2==1?ia:"";G.push("<tr"+qa+' id="'+A+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+
60
+ a.p.direction+""+v+'">');if(a.p.rownumbers===true){G.push(D(0,W,a.p.page,a.p.rowNum));N=1}if(a.p.multiselect===true){G.push(s(A,N,W));F=1}if(a.p.subGrid===true){G.push(b(a).jqGrid("addSubGridCell",F+N,W+j));S=1}if(a.p.xmlReader.repeatitems){Y||(Y=J(F+S+N));var Ba=b(a.p.xmlReader.cell,w);b.each(Y,function(ga){var aa=Ba[this];if(!aa)return false;q=aa.textContent||aa.text;I[a.p.colModel[ga+F+S+N].name]=q;G.push(n(A,q,ga+F+S+N,W+j,w))})}else for(v=0;v<O.length;v++){q=b(O[v],w).text();I[a.p.colModel[v+
61
+ F+S+N].name]=q;G.push(n(A,q,v+F+S+N,W+j,w))}G.push("</tr>");if(a.p.grouping){v=a.p.groupingView.groupField.length;for(var xa=[],ya=0;ya<v;ya++)xa.push(I[a.p.groupingView.groupField[ya]]);Z=b(a).jqGrid("groupingPrepare",G,xa,Z,I);G=[]}if(t||a.p.treeGrid===true){I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1}if(a.p.gridview===false){b("tbody:first",e).append(G.join(""));p&&a.p.afterInsertRow.call(a,A,I,w);G=[]}I={};u++;W++;if(u==ha)break}}if(a.p.gridview===true){z=a.p.treeANode>-1?a.p.treeANode:
62
+ 0;if(a.p.grouping){b(a).jqGrid("groupingRender",Z,a.p.colModel.length);Z=null}else a.p.treeGrid===true&&z>0?b(a.rows[z]).after(G.join("")):b("tbody:first",e).append(G.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",F+N)}catch(Ia){}a.p.totaltime=new Date-B;if(u>0)if(a.p.records===0)a.p.records=ba;G=null;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",z+1,u+z+1)}catch(Ja){}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=u;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData",
63
+ "set",a.p.userData,true);if(t){a.p.records=ba;a.p.lastpage=Math.ceil(ba/ha)}m||a.updatepager(false,true);if(t)for(;u<ba;){w=d[u];A=E(w,u);A=a.p.idPrefix+A;if(a.p.xmlReader.repeatitems){Y||(Y=J(F+S+N));var Fa=b(a.p.xmlReader.cell,w);b.each(Y,function(ga){var aa=Fa[this];if(!aa)return false;q=aa.textContent||aa.text;I[a.p.colModel[ga+F+S+N].name]=q})}else for(v=0;v<O.length;v++){q=b(O[v],w).text();I[a.p.colModel[v+F+S+N].name]=q}I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1;I={};u++}}},
64
+ fa=function(d,e,j,m,p){var B=new Date;if(d){if(a.p.treeANode===-1&&!a.p.scroll){C(e,false,true);j=1}else j=j>1?j:1;var t,E=a.p.datatype!="local"&&a.p.loadonce||a.p.datatype=="jsonstring";if(E){a.p.data=[];a.p._index={};a.p.localReader.id="_id_"}a.p.reccount=0;if(a.p.datatype=="local"){e=a.p.localReader;t="local"}else{e=a.p.jsonReader;t="json"}var v=0,z,u,q=[],F,S=0,N=0,K=0,O,Y,I={},w,A,G=[],ia=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=b.jgrid.getAccessor(d,e.page)||0;O=b.jgrid.getAccessor(d,
65
+ e.total);a.p.lastpage=O===undefined?1:O;a.p.records=b.jgrid.getAccessor(d,e.records)||0;a.p.userData=b.jgrid.getAccessor(d,e.userdata)||{};e.repeatitems||(F=q=T(t));t=a.p.keyIndex===false?e.id:a.p.keyIndex;if(q.length>0&&!isNaN(t)){if(a.p.remapColumns&&a.p.remapColumns.length)t=b.inArray(t,a.p.remapColumns);t=q[t]}(Y=b.jgrid.getAccessor(d,e.root))||(Y=[]);O=Y.length;d=0;var ba=parseInt(a.p.rowNum,10),W=a.p.scroll?b.jgrid.randId():1;if(p)ba*=p+1;var Z=b.isFunction(a.p.afterInsertRow),ha={},pa="";if(a.p.grouping&&
66
+ a.p.groupingView.groupCollapse===true)pa=' style="display:none;"';for(;d<O;){p=Y[d];A=b.jgrid.getAccessor(p,t);if(A===undefined){A=W+d;if(q.length===0)if(e.cell)A=b.jgrid.getAccessor(p,e.cell)[t]||A}A=a.p.idPrefix+A;z=j===1?0:j;z=(z+d)%2==1?ia:"";G.push("<tr"+pa+' id="'+A+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+a.p.direction+""+z+'">');if(a.p.rownumbers===true){G.push(D(0,d,a.p.page,a.p.rowNum));K=1}if(a.p.multiselect){G.push(s(A,K,d));S=1}if(a.p.subGrid){G.push(b(a).jqGrid("addSubGridCell",
67
+ S+K,d+j));N=1}if(e.repeatitems){if(e.cell)p=b.jgrid.getAccessor(p,e.cell);F||(F=J(S+N+K))}for(u=0;u<F.length;u++){z=b.jgrid.getAccessor(p,F[u]);G.push(n(A,z,u+S+N+K,d+j,p));I[a.p.colModel[u+S+N+K].name]=z}G.push("</tr>");if(a.p.grouping){z=a.p.groupingView.groupField.length;u=[];for(var qa=0;qa<z;qa++)u.push(I[a.p.groupingView.groupField[qa]]);ha=b(a).jqGrid("groupingPrepare",G,u,ha,I);G=[]}if(E||a.p.treeGrid===true){I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1}if(a.p.gridview===false){b("#"+
68
+ b.jgrid.jqID(a.p.id)+" tbody:first").append(G.join(""));Z&&a.p.afterInsertRow.call(a,A,I,p);G=[]}I={};v++;d++;if(v==ba)break}if(a.p.gridview===true){w=a.p.treeANode>-1?a.p.treeANode:0;if(a.p.grouping)b(a).jqGrid("groupingRender",ha,a.p.colModel.length);else a.p.treeGrid===true&&w>0?b(a.rows[w]).after(G.join("")):b("#"+b.jgrid.jqID(a.p.id)+" tbody:first").append(G.join(""))}if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",S+K)}catch(Ba){}a.p.totaltime=new Date-B;if(v>0)if(a.p.records===0)a.p.records=
69
+ O;if(a.p.treeGrid===true)try{b(a).jqGrid("setTreeNode",w+1,v+w+1)}catch(xa){}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=v;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);if(E){a.p.records=O;a.p.lastpage=Math.ceil(O/ba)}m||a.updatepager(false,true);if(E)for(;v<O&&Y[v];){p=Y[v];A=b.jgrid.getAccessor(p,t);if(A===undefined){A=W+v;if(q.length===0)if(e.cell)A=b.jgrid.getAccessor(p,e.cell)[t]||A}if(p){A=a.p.idPrefix+A;if(e.repeatitems){if(e.cell)p=
70
+ b.jgrid.getAccessor(p,e.cell);F||(F=J(S+N+K))}for(u=0;u<F.length;u++){z=b.jgrid.getAccessor(p,F[u]);I[a.p.colModel[u+S+N+K].name]=z}I._id_=A;a.p.data.push(I);a.p._index[A]=a.p.data.length-1;I={}}v++}}},oa=function(){function d(w){var A=0,G,ia,ba,W,Z;if(w.groups!==undefined){(ia=w.groups.length&&w.groupOp.toString().toUpperCase()==="OR")&&q.orBegin();for(G=0;G<w.groups.length;G++){A>0&&ia&&q.or();try{d(w.groups[G])}catch(ha){alert(ha)}A++}ia&&q.orEnd()}if(w.rules!==undefined){if(A>0){ia=q.select();
71
+ q=b.jgrid.from(ia);if(a.p.ignoreCase)q=q.ignoreCase()}try{(ba=w.rules.length&&w.groupOp.toString().toUpperCase()==="OR")&&q.orBegin();for(G=0;G<w.rules.length;G++){Z=w.rules[G];W=w.groupOp.toString().toUpperCase();if(u[Z.op]&&Z.field){if(A>0&&W&&W==="OR")q=q.or();q=u[Z.op](q,W)(Z.field,Z.data,m[Z.field])}A++}ba&&q.orEnd()}catch(pa){alert(pa)}}}var e,j=false,m={},p=[],B=[],t,E,v;if(b.isArray(a.p.data)){var z=a.p.grouping?a.p.groupingView:false;b.each(a.p.colModel,function(){E=this.sorttype||"text";
72
+ if(E=="date"||E=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){t=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:b.jgrid.formatter.date.srcformat;v=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:b.jgrid.formatter.date.newformat}else t=v=this.datefmt||"Y-m-d";m[this.name]={stype:E,srcfmt:t,newfmt:v}}else m[this.name]={stype:E,srcfmt:"",newfmt:""};if(a.p.grouping&&this.name==z.groupField[0]){var w=
73
+ this.name;if(typeof this.index!="undefined")w=this.index;p[0]=m[w];B.push(w)}if(!j&&(this.index==a.p.sortname||this.name==a.p.sortname)){e=this.name;j=true}});if(a.p.treeGrid)b(a).jqGrid("SortTree",e,a.p.sortorder,m[e].stype,m[e].srcfmt);else{var u={eq:function(w){return w.equals},ne:function(w){return w.notEquals},lt:function(w){return w.less},le:function(w){return w.lessOrEquals},gt:function(w){return w.greater},ge:function(w){return w.greaterOrEquals},cn:function(w){return w.contains},nc:function(w,
74
+ A){return A==="OR"?w.orNot().contains:w.andNot().contains},bw:function(w){return w.startsWith},bn:function(w,A){return A==="OR"?w.orNot().startsWith:w.andNot().startsWith},en:function(w,A){return A==="OR"?w.orNot().endsWith:w.andNot().endsWith},ew:function(w){return w.endsWith},ni:function(w,A){return A==="OR"?w.orNot().equals:w.andNot().equals},"in":function(w){return w.equals},nu:function(w){return w.isNull},nn:function(w,A){return A==="OR"?w.orNot().isNull:w.andNot().isNull}},q=b.jgrid.from(a.p.data);
75
+ if(a.p.ignoreCase)q=q.ignoreCase();if(a.p.search===true){var F=a.p.postData.filters;if(F){if(typeof F=="string")F=b.jgrid.parse(F);d(F)}else try{q=u[a.p.postData.searchOper](q)(a.p.postData.searchField,a.p.postData.searchString,m[a.p.postData.searchField])}catch(S){}}if(a.p.grouping){q.orderBy(B,z.groupOrder[0],p[0].stype,p[0].srcfmt);z.groupDataSorted=true}if(e&&a.p.sortorder&&j)a.p.sortorder.toUpperCase()=="DESC"?q.orderBy(a.p.sortname,"d",m[e].stype,m[e].srcfmt):q.orderBy(a.p.sortname,"a",m[e].stype,
76
+ m[e].srcfmt);F=q.select();var N=parseInt(a.p.rowNum,10),K=F.length,O=parseInt(a.p.page,10),Y=Math.ceil(K/N),I={};F=F.slice((O-1)*N,O*N);m=q=null;I[a.p.localReader.total]=Y;I[a.p.localReader.page]=O;I[a.p.localReader.records]=K;I[a.p.localReader.root]=F;I[a.p.localReader.userdata]=a.p.userData;F=null;return I}}},R=function(){a.grid.hDiv.loading=true;if(!a.p.hiddengrid)switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).show();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).show();
77
+ b("#load_"+b.jgrid.jqID(a.p.id)).show()}},$=function(){a.grid.hDiv.loading=false;switch(a.p.loadui){case "enable":b("#load_"+b.jgrid.jqID(a.p.id)).hide();break;case "block":b("#lui_"+b.jgrid.jqID(a.p.id)).hide();b("#load_"+b.jgrid.jqID(a.p.id)).hide()}},ja=function(d){if(!a.grid.hDiv.loading){var e=a.p.scroll&&d===false,j={},m,p=a.p.prmNames;if(a.p.page<=0)a.p.page=1;if(p.search!==null)j[p.search]=a.p.search;if(p.nd!==null)j[p.nd]=(new Date).getTime();if(p.rows!==null)j[p.rows]=a.p.rowNum;if(p.page!==
78
+ null)j[p.page]=a.p.page;if(p.sort!==null)j[p.sort]=a.p.sortname;if(p.order!==null)j[p.order]=a.p.sortorder;if(a.p.rowTotal!==null&&p.totalrows!==null)j[p.totalrows]=a.p.rowTotal;var B=a.p.loadComplete,t=b.isFunction(B);t||(B=null);var E=0;d=d||1;if(d>1)if(p.npage!==null){j[p.npage]=d;E=d-1;d=1}else B=function(z){a.p.page++;a.grid.hDiv.loading=false;t&&a.p.loadComplete.call(a,z);ja(d-1)};else p.npage!==null&&delete a.p.postData[p.npage];if(a.p.grouping){b(a).jqGrid("groupingSetup");if(a.p.groupingView.groupDataSorted===
79
+ true)j[p.sort]=a.p.groupingView.groupField[0]+" "+a.p.groupingView.groupOrder[0]+", "+j[p.sort]}b.extend(a.p.postData,j);var v=!a.p.scroll?1:a.rows.length-1;if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id);else{if(b.isFunction(a.p.beforeRequest)){j=a.p.beforeRequest.call(a);if(j===undefined)j=true;if(j===false)return}m=a.p.datatype.toLowerCase();switch(m){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,dataType:m,data:b.isFunction(a.p.serializeGridData)?
80
+ a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(z,u,q){b.isFunction(a.p.beforeProcessing)&&a.p.beforeProcessing.call(a,z,u,q);m==="xml"?V(z,a.grid.bDiv,v,d>1,E):fa(z,a.grid.bDiv,v,d>1,E);B&&B.call(a,z);e&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";d===1&&$()},error:function(z,u,q){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,z,u,q);d===1&&$()},beforeSend:function(z,u){var q=true;if(b.isFunction(a.p.loadBeforeSend))q=a.p.loadBeforeSend.call(a,
81
+ z,u);if(q===undefined)q=true;if(q===false)return false;else R()}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));break;case "xmlstring":R();j=b.jgrid.stringToDoc(a.p.datastr);V(j,a.grid.bDiv);t&&a.p.loadComplete.call(a,j);a.p.datatype="local";a.p.datastr=null;$();break;case "jsonstring":R();j=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;fa(j,a.grid.bDiv);t&&a.p.loadComplete.call(a,j);a.p.datatype="local";a.p.datastr=null;$();break;case "local":case "clientside":R();a.p.datatype=
82
+ "local";j=oa();fa(j,a.grid.bDiv,v,d>1,E);B&&B.call(a,j);e&&a.grid.populateVisible();$()}}}};x=function(d,e){var j="",m="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",p="",B,t,E,v,z=function(u){var q;if(b.isFunction(a.p.onPaging))q=a.p.onPaging.call(a,u);a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false)}a.p.savedRow=[];if(q=="stop")return false;return true};
83
+ d=d.substr(1);e+="_"+d;B="pg_"+d;t=d+"_left";E=d+"_center";v=d+"_right";b("#"+b.jgrid.jqID(d)).append("<div id='"+B+"' 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='"+t+"' align='left'></td><td id='"+E+"' align='center' style='white-space:pre;'></td><td id='"+v+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(a.p.rowList.length>0){p=
84
+ "<td dir='"+l+"'>";p+="<select class='ui-pg-selbox' role='listbox'>";for(t=0;t<a.p.rowList.length;t++)p+='<option role="option" value="'+a.p.rowList[t]+'"'+(a.p.rowNum==a.p.rowList[t]?' selected="selected"':"")+">"+a.p.rowList[t]+"</option>";p+="</select></td>"}if(l=="rtl")m+=p;if(a.p.pginput===true)j="<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(d)+"'></span>")+"</td>";if(a.p.pgbuttons===
85
+ true){t=["first"+e,"prev"+e,"next"+e,"last"+e];l=="rtl"&&t.reverse();m+="<td id='"+t[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";m+="<td id='"+t[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";m+=j!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+j+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":
86
+ "";m+="<td id='"+t[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";m+="<td id='"+t[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(j!=="")m+=j;if(l=="ltr")m+=p;m+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+d+"_"+a.p.recordpos,"#"+B).append("<div dir='"+l+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+d+"_"+a.p.pagerpos,"#"+B).append(m);p=b(".ui-jqgrid").css("font-size")||
87
+ "11px";b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+p+";visibility:hidden;' ></div>");m=b(m).clone().appendTo("#testpg").width();b("#testpg").remove();if(m>0){if(j!=="")m+=50;b("td#"+d+"_"+a.p.pagerpos,"#"+B).width(m)}a.p._nvtd=[];a.p._nvtd[0]=m?Math.floor((a.p.width-m)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;m=null;b(".ui-pg-selbox","#"+B).bind("change",function(){a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-0.5)+1;a.p.rowNum=
88
+ this.value;if(e)b(".ui-pg-selbox",a.p.pager).val(this.value);else a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value);if(!z("records"))return false;ja();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+B).hover(function(){if(b(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{b(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover");this.style.cursor="default"}});
89
+ b("#first"+b.jgrid.jqID(e)+", #prev"+b.jgrid.jqID(e)+", #next"+b.jgrid.jqID(e)+", #last"+b.jgrid.jqID(e)).click(function(){var u=M(a.p.page,1),q=M(a.p.lastpage,1),F=false,S=true,N=true,K=true,O=true;if(q===0||q===1)O=K=N=S=false;else if(q>1&&u>=1)if(u===1)N=S=false;else{if(!(u>1&&u<q))if(u===q)O=K=false}else if(q>1&&u===0){O=K=false;u=q-1}if(this.id==="first"+e&&S){a.p.page=1;F=true}if(this.id==="prev"+e&&N){a.p.page=u-1;F=true}if(this.id==="next"+e&&K){a.p.page=u+1;F=true}if(this.id==="last"+e&&
90
+ O){a.p.page=q;F=true}if(F){if(!z(this.id))return false;ja()}return false})}a.p.pginput===true&&b("input.ui-pg-input","#"+B).keypress(function(u){if((u.charCode?u.charCode:u.keyCode?u.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!z("user"))return false;ja();return false}return this})};var Ca=function(d,e,j,m){if(a.p.colModel[e].sortable)if(!(a.p.savedRow.length>0)){if(!j){if(a.p.lastsort==e)if(a.p.sortorder=="asc")a.p.sortorder="desc";else{if(a.p.sortorder=="desc")a.p.sortorder=
91
+ "asc"}else a.p.sortorder=a.p.colModel[e].firstsortorder||"asc";a.p.page=1}if(m)if(a.p.lastsort==e&&a.p.sortorder==m&&!j)return;else a.p.sortorder=m;j=a.grid.headers[a.p.lastsort].el;m=a.grid.headers[e].el;b("span.ui-grid-ico-sort",j).addClass("ui-state-disabled");b(j).attr("aria-selected","false");b("span.ui-icon-"+a.p.sortorder,m).removeClass("ui-state-disabled");b(m).attr("aria-selected","true");if(!a.p.viewsortcols[0])if(a.p.lastsort!=e){b("span.s-ico",j).hide();b("span.s-ico",m).show()}d=d.substring(5+
92
+ a.p.id.length+1);a.p.sortname=a.p.colModel[e].index||d;j=a.p.sortorder;if(b.isFunction(a.p.onSortCol))if(a.p.onSortCol.call(a,d,e,j)=="stop"){a.p.lastsort=e;return}if(a.p.datatype=="local")a.p.deselectAfterSort&&b(a).jqGrid("resetSelection");else{a.p.selrow=null;if(a.p.multiselect)b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false);a.p.selarrrow=[];a.p.savedRow=[]}if(a.p.scroll){j=a.grid.bDiv.scrollLeft;C(a.grid.bDiv,true,false);a.grid.hDiv.scrollLeft=j}a.p.subGrid&&
93
+ a.p.datatype=="local"&&b("td.sgexpanded","#"+b.jgrid.jqID(a.p.id)).each(function(){b(this).trigger("click")});ja();a.p.lastsort=e;if(a.p.sortname!=d&&e)a.p.lastsort=e}},Ga=function(d){var e,j={},m=H?0:a.p.cellLayout;for(e=j[0]=j[1]=j[2]=0;e<=d;e++)if(a.p.colModel[e].hidden===false)j[0]+=a.p.colModel[e].width+m;if(a.p.direction=="rtl")j[0]=a.p.width-j[0];j[0]-=a.grid.bDiv.scrollLeft;if(b(a.grid.cDiv).is(":visible"))j[1]+=b(a.grid.cDiv).height()+parseInt(b(a.grid.cDiv).css("padding-top"),10)+parseInt(b(a.grid.cDiv).css("padding-bottom"),
94
+ 10);if(a.p.toolbar[0]===true&&(a.p.toolbar[1]=="top"||a.p.toolbar[1]=="both"))j[1]+=b(a.grid.uDiv).height()+parseInt(b(a.grid.uDiv).css("border-top-width"),10)+parseInt(b(a.grid.uDiv).css("border-bottom-width"),10);if(a.p.toppager)j[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10);j[2]+=b(a.grid.bDiv).height()+b(a.grid.hDiv).height();return j},Da=function(d){var e,j=a.grid.headers,m=b.jgrid.getCellIndex(d);for(e=0;e<j.length;e++)if(d===j[e].el){m=e;break}return m};
95
+ this.p.id=this.id;if(b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])==-1)a.p.multikey=false;a.p.keyIndex=false;for(k=0;k<a.p.colModel.length;k++){a.p.colModel[k]=b.extend(true,{},a.p.cmTemplate,a.p.colModel[k].template||{},a.p.colModel[k]);if(a.p.keyIndex===false&&a.p.colModel[k].key===true)a.p.keyIndex=k}a.p.sortorder=a.p.sortorder.toLowerCase();if(a.p.grouping===true){a.p.scroll=false;a.p.rownumbers=false;a.p.subGrid=false;a.p.treeGrid=false;a.p.gridview=true}if(this.p.treeGrid===true){try{b(this).jqGrid("setTreeGrid")}catch(Ka){}if(a.p.datatype!=
96
+ "local")a.p.localReader={id:"_id_"}}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(La){}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:H?a.p.multiselectWidth+a.p.cellLayout:a.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,
97
+ sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}a.p.xmlReader=b.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,
98
+ cell:"cell"}},a.p.jsonReader);a.p.localReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:false,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.localReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}a.p.data.length&&ca();var da="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",Ea,ma,sa,ra,ta,X,Q,na;ma=na="";if(a.p.shrinkToFit===true&&a.p.forceFit===true)for(k=a.p.colModel.length-
99
+ 1;k>=0;k--)if(!a.p.colModel[k].hidden){a.p.colModel[k].resizable=false;break}if(a.p.viewsortcols[1]=="horizontal"){na=" ui-i-asc";ma=" ui-i-desc"}Ea=y?"class='ui-th-div-ie'":"";na="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+na+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+l+"'></span>";na+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ma+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+l+"'></span></span>";for(k=
100
+ 0;k<this.p.colNames.length;k++){ma=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[k])+'"':"";da+="<th id='"+a.p.id+"_"+a.p.colModel[k].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+l+"'"+ma+">";ma=a.p.colModel[k].index||a.p.colModel[k].name;da+="<div id='jqgh_"+a.p.id+"_"+a.p.colModel[k].name+"' "+Ea+">"+a.p.colNames[k];a.p.colModel[k].width=a.p.colModel[k].width?parseInt(a.p.colModel[k].width,10):150;if(typeof a.p.colModel[k].title!=="boolean")a.p.colModel[k].title=
101
+ true;if(ma==a.p.sortname)a.p.lastsort=k;da+=na+"</div></th>"}da+="</tr></thead>";na=null;b(this).append(da);b("thead tr:first th",this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var za=[],ua;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){a.p.selarrrow=[];if(this.checked){b(a.rows).each(function(d){if(d>0)if(!b(this).hasClass("ui-subgrid")&&!b(this).hasClass("jqgroup")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+
102
+ b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":"attr"]("checked",true);b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow.push(this.id);a.p.selrow=this.id}});ua=true;za=[]}else{b(a.rows).each(function(d){if(d>0)if(!b(this).hasClass("ui-subgrid")&&!b(this).hasClass("ui-state-disabled")){b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(this.id))[a.p.useProp?"prop":"attr"]("checked",false);b(this).removeClass("ui-state-highlight").attr("aria-selected",
103
+ "false");za.push(this.id)}});a.p.selrow=null;ua=false}if(b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a,ua?a.p.selarrrow:za,ua)})}if(a.p.autowidth===true){da=b(L).innerWidth();a.p.width=da>0?da:"nw"}(function(){var d=0,e=H?0:a.p.cellLayout,j=0,m,p=a.p.scrollOffset,B,t=false,E,v=0,z=0,u;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;this.widthOrg=B=M(this.width,0);if(this.hidden===false){d+=B+e;if(this.fixed)v+=B+e;else j++;z++}});if(isNaN(a.p.width))a.p.width=
104
+ g.width=d;else g.width=a.p.width;a.p.tblwidth=d;if(a.p.shrinkToFit===false&&a.p.forceFit===true)a.p.forceFit=false;if(a.p.shrinkToFit===true&&j>0){E=g.width-e*j-v;if(!isNaN(a.p.height)){E-=p;t=true}d=0;b.each(a.p.colModel,function(q){if(this.hidden===false&&!this.fixed){this.width=B=Math.round(E*this.width/(a.p.tblwidth-e*j-v));d+=B;m=q}});u=0;if(t){if(g.width-v-(d+e*j)!==p)u=g.width-v-(d+e*j)-p}else if(!t&&Math.abs(g.width-v-(d+e*j))!==1)u=g.width-v-(d+e*j);a.p.colModel[m].width+=u;a.p.tblwidth=
105
+ d+u+e*j+v;if(a.p.tblwidth>a.p.width){a.p.colModel[m].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(L).css("width",g.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(r).css("width",g.width+"px");da=b("thead:first",a).get(0);var va="";if(a.p.footerrow)va+="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+
106
+ l+"'>";r=b("tr:first",da);var wa="<tr class='jqgfirstrow' role='row' style='height:auto'>";a.p.disableClick=false;b("th",r).each(function(d){sa=a.p.colModel[d].width;if(typeof a.p.colModel[d].resizable==="undefined")a.p.colModel[d].resizable=true;if(a.p.colModel[d].resizable){ra=document.createElement("span");b(ra).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+l);b.browser.opera||b(ra).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else ra="";b(this).css("width",sa+"px").prepend(ra);
107
+ var e="";if(a.p.colModel[d].hidden){b(this).css("display","none");e="display:none;"}wa+="<td role='gridcell' style='height:0px;width:"+sa+"px;"+e+"'></td>";g.headers[d]={width:sa,el:this};ta=a.p.colModel[d].sortable;if(typeof ta!=="boolean")ta=a.p.colModel[d].sortable=true;e=a.p.colModel[d].name;e=="cb"||e=="subgrid"||e=="rn"||a.p.viewsortcols[2]&&b("div",this).addClass("ui-jqgrid-sortable");if(ta)if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();d==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,
108
+ this).removeClass("ui-state-disabled")}else if(d==a.p.lastsort){b("div span.s-ico",this).show();b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}if(a.p.footerrow)va+="<td role='gridcell' "+P(d,0,"",null,"",false)+">&#160;</td>"}).mousedown(function(d){if(b(d.target).closest("th>span.ui-jqgrid-resize").length==1){var e=Da(this);if(a.p.forceFit===true){var j=a.p,m=e,p;for(p=e+1;p<a.p.colModel.length;p++)if(a.p.colModel[p].hidden!==true){m=p;break}j.nv=m-e}g.dragStart(e,d,Ga(e));
109
+ return false}}).click(function(d){if(a.p.disableClick)return a.p.disableClick=false;var e="th>div.ui-jqgrid-sortable",j,m;a.p.viewsortcols[2]||(e="th>div>span>span.ui-grid-ico-sort");d=b(d.target).closest(e);if(d.length==1){e=Da(this);if(!a.p.viewsortcols[2]){j=true;m=d.attr("sort")}Ca(b("div",this)[0].id,e,j,m);return false}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",r)}catch(Ma){}if(a.p.footerrow)va+="</tr></tbody></table>";wa+="</tr>";this.appendChild(document.createElement("tbody"));
110
+ b(this).addClass("ui-jqgrid-btable").append(wa);wa=null;r=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(da);var ea=a.p.caption&&a.p.hiddengrid===true?true:false;k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");da=null;g.hDiv=document.createElement("div");b(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(k);b(k).append(r);
111
+ r=null;ea&&b(g.hDiv).hide();if(a.p.pager){if(typeof a.p.pager=="string"){if(a.p.pager.substr(0,1)!="#")a.p.pager="#"+a.p.pager}else a.p.pager="#"+b(a.p.pager).attr("id");b(a.p.pager).css({width:g.width+"px"}).appendTo(L).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");ea&&b(a.p.pager).hide();x(a.p.pager,"")}a.p.cellEdit===false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(d){Q=b(d.target).closest("tr.jqgrow");b(Q).attr("class")!=="ui-subgrid"&&b(Q).addClass("ui-state-hover")}).bind("mouseout",
112
+ function(d){Q=b(d.target).closest("tr.jqgrow");b(Q).removeClass("ui-state-hover")});var ka,la;b(a).before(g.hDiv).click(function(d){X=d.target;Q=b(X,a.rows).closest("tr.jqgrow");if(b(Q).length===0||Q[0].className.indexOf("ui-state-disabled")>-1)return this;var e=b(X).hasClass("cbox"),j=true;if(b.isFunction(a.p.beforeSelectRow))j=a.p.beforeSelectRow.call(a,Q[0].id,d);if(X.tagName=="A"||(X.tagName=="INPUT"||X.tagName=="TEXTAREA"||X.tagName=="OPTION"||X.tagName=="SELECT")&&!e)return this;if(j===true){if(a.p.cellEdit===
113
+ true)if(a.p.multiselect&&e)b(a).jqGrid("setSelection",Q[0].id,true);else{ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);try{b(a).jqGrid("editCell",ka,la,true)}catch(m){}}else if(a.p.multikey)if(d[a.p.multikey])b(a).jqGrid("setSelection",Q[0].id,true);else{if(a.p.multiselect&&e){e=b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id).is(":checked");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+Q[0].id)[a.p.useProp?"prop":"attr"]("checked",e)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!e){b(a.p.selarrrow).each(function(p,
114
+ B){var t=a.rows.namedItem(B);b(t).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(a.p.id)+"_"+b.jgrid.jqID(B))[a.p.useProp?"prop":"attr"]("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false)}b(a).jqGrid("setSelection",Q[0].id,true)}if(b.isFunction(a.p.onCellSelect)){ka=Q[0].id;la=b.jgrid.getCellIndex(X);a.p.onCellSelect.call(a,ka,la,b(X).html(),d)}}return this}).bind("reloadGrid",function(d,e){if(a.p.treeGrid===true)a.p.datatype=
115
+ a.p.treedatatype;e&&e.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local"){b(a).jqGrid("resetSelection");a.p.data.length&&ca()}else if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv)[a.p.useProp?"prop":"attr"]("checked",false)}a.p.savedRow=[]}a.p.scroll&&C(a.grid.bDiv,true,false);if(e&&e.page){var j=e.page;if(j>a.p.lastpage)j=a.p.lastpage;if(j<1)j=1;a.p.page=j;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(j-1)*a.grid.prevRowHeight*
116
+ a.p.rowNum:0}if(a.grid.prevRowHeight&&a.p.scroll){delete a.p.lastpage;a.grid.populateVisible()}else a.grid.populate();return false});b.isFunction(this.p.ondblClickRow)&&b(this).dblclick(function(d){X=d.target;Q=b(X,a.rows).closest("tr.jqgrow");if(b(Q).length===0)return false;ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);a.p.ondblClickRow.call(a,b(Q).attr("id"),ka,la,d);return false});b.isFunction(this.p.onRightClickRow)&&b(this).bind("contextmenu",function(d){X=d.target;Q=b(X,a.rows).closest("tr.jqgrow");
117
+ if(b(Q).length===0)return false;a.p.multiselect||b(a).jqGrid("setSelection",Q[0].id,true);ka=Q[0].rowIndex;la=b.jgrid.getCellIndex(X);a.p.onRightClickRow.call(a,b(Q).attr("id"),ka,la,d);return false});g.bDiv=document.createElement("div");if(y)if(String(a.p.height).toLowerCase()==="auto")a.p.height="100%";b(g.bDiv).append(b('<div style="position:relative;'+(y&&b.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?
118
+ "":"px"),width:g.width+"px"}).scroll(g.scrollGrid);b("table:first",g.bDiv).css({width:a.p.tblwidth+"px"});if(y){b("tbody",this).size()==2&&b("tbody:gt(0)",this).remove();a.p.multikey&&b(g.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(g.bDiv).bind("mousedown",function(){return false});ea&&b(g.bDiv).hide();g.cDiv=document.createElement("div");var Aa=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Aa.addClass("ui-state-hover")},
119
+ function(){Aa.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(l=="rtl"?"left":"right","0px"):"";b(g.cDiv).append(Aa).append("<span class='ui-jqgrid-title"+(l=="rtl"?"-rtl":"")+"'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(g.cDiv).insertBefore(g.hDiv);if(a.p.toolbar[0]){g.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(g.uDiv).insertBefore(g.hDiv);else a.p.toolbar[1]==
120
+ "bottom"&&b(g.uDiv).insertAfter(g.hDiv);if(a.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");b(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);b(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ea&&b(g.ubDiv).hide()}else b(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);ea&&b(g.uDiv).hide()}if(a.p.toppager){a.p.toppager=b.jgrid.jqID(a.p.id)+"_toppager";g.topDiv=
121
+ b("<div id='"+a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);x(a.p.toppager,"_t")}if(a.p.footerrow){g.sDiv=b("<div class='ui-jqgrid-sdiv'></div>")[0];k=b("<div class='ui-jqgrid-hbox"+(l=="rtl"?"-rtl":"")+"'></div>");b(g.sDiv).append(k).insertAfter(g.hDiv).width(g.width);b(k).append(va);g.footers=b(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(a.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum";
122
+ ea&&b(g.sDiv).hide()}k=null;if(a.p.caption){var Ha=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",g.cDiv).click(function(d){var e=b.isFunction(a.p.onHeaderClick),j=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",m,p=this;if(a.p.toolbar[0]===true){if(a.p.toolbar[1]=="both")j+=", #"+b(g.ubDiv).attr("id");j+=", #"+b(g.uDiv).attr("id")}m=b(j,"#gview_"+b.jgrid.jqID(a.p.id)).length;if(a.p.gridstate=="visible")b(j,"#gbox_"+b.jgrid.jqID(a.p.id)).slideUp("fast",function(){m--;
123
+ if(m===0){b("span",p).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();if(e)ea||a.p.onHeaderClick.call(a,a.p.gridstate,d)}});else a.p.gridstate=="hidden"&&b(j,"#gbox_"+b.jgrid.jqID(a.p.id)).slideDown("fast",function(){m--;if(m===0){b("span",p).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ea){a.p.datatype=
124
+ Ha;ja();ea=false}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();if(e)ea||a.p.onHeaderClick.call(a,a.p.gridstate,d)}});return false});if(ea){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else b(g.cDiv).hide();b(g.hDiv).after(g.bDiv).mousemove(function(d){if(g.resizing){g.dragMove(d);return false}});b(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false});
125
+ b(document).mouseup(function(){if(g.resizing){g.dragEnd();return false}return true});a.formatCol=P;a.sortData=Ca;a.updatepager=function(d,e){var j,m,p,B,t,E,v,z="",u=a.p.pager?"_"+b.jgrid.jqID(a.p.pager.substr(1)):"",q=a.p.toppager?"_"+a.p.toppager.substr(1):"";p=parseInt(a.p.page,10)-1;if(p<0)p=0;p*=parseInt(a.p.rowNum,10);t=p+a.p.reccount;if(a.p.scroll){j=b("tbody:first > tr:gt(0)",a.grid.bDiv);p=t-j.length;a.p.reccount=j.length;if(m=j.outerHeight()||a.grid.prevRowHeight){j=p*m;m*=parseInt(a.p.records,
126
+ 10);b(">div:first",a.grid.bDiv).css({height:m}).children("div:first").css({height:j,display:j?"":"none"})}a.grid.bDiv.scrollLeft=a.grid.hDiv.scrollLeft}z=a.p.pager?a.p.pager:"";z+=a.p.toppager?z?","+a.p.toppager:a.p.toppager:"";if(z){v=b.jgrid.formatter.integer||{};j=M(a.p.page);m=M(a.p.lastpage);b(".selbox",z)[this.p.useProp?"prop":"attr"]("disabled",false);if(a.p.pginput===true){b(".ui-pg-input",z).val(a.p.page);B=a.p.toppager?"#sp_1"+u+",#sp_1"+q:"#sp_1"+u;b(B).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,
127
+ v):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",z).html(a.p.emptyrecords);else{B=p+1;E=a.p.records;if(b.fmatter){B=b.fmatter.util.NumberFormat(B,v);t=b.fmatter.util.NumberFormat(t,v);E=b.fmatter.util.NumberFormat(E,v)}b(".ui-paging-info",z).html(b.jgrid.format(a.p.recordtext,B,t,E))}if(a.p.pgbuttons===true){if(j<=0)j=m=0;if(j==1||j===0){b("#first"+u+", #prev"+u).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t"+q+", #prev_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first"+
128
+ u+", #prev"+u).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t"+q+", #prev_t"+q).removeClass("ui-state-disabled")}if(j==m||j===0){b("#next"+u+", #last"+u).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t"+q+", #last_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next"+u+", #last"+u).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t"+q+", #last_t"+q).removeClass("ui-state-disabled")}}}d===true&&a.p.rownumbers===true&&
129
+ b("td.jqgrid-rownum",a.rows).each(function(F){b(this).html(p+1+F)});e&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a)};a.refreshIndex=ca;a.formatter=function(d,e,j,m,p){return o(d,e,j,m,p)};b.extend(g,{populate:ja,emptyRows:C});this.grid=g;a.addXmlData=function(d){V(d,a.grid.bDiv)};a.addJSONData=function(d){fa(d,a.grid.bDiv)};this.grid.cols=this.rows[0].cells;ja();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}}})};b.jgrid.extend({getGridParam:function(f){var i=
130
+ this[0];if(i&&i.grid)return f?typeof i.p[f]!="undefined"?i.p[f]:null:i.p},setGridParam:function(f){return this.each(function(){this.grid&&typeof f==="object"&&b.extend(true,this.p,f)})},getDataIDs:function(){var f=[],i=0,h,c=0;this.each(function(){if((h=this.rows.length)&&h>0)for(;i<h;){if(b(this.rows[i]).hasClass("jqgrow")){f[c]=this.rows[i].id;c++}i++}});return f},setSelection:function(f,i){return this.each(function(){function h(a){var r=b(c.grid.bDiv)[0].clientHeight,x=b(c.grid.bDiv)[0].scrollTop,
131
+ y=c.rows[a].offsetTop;a=c.rows[a].clientHeight;if(y+a>=r+x)b(c.grid.bDiv)[0].scrollTop=y-(r+x)+a+x;else if(y<r+x)if(y<x)b(c.grid.bDiv)[0].scrollTop=y}var c=this,g,k,l;if(f!==undefined){i=i===false?false:true;k=c.rows.namedItem(f+"");if(!(!k||k.className.indexOf("ui-state-disabled")>-1)){if(c.p.scrollrows===true){g=c.rows.namedItem(f).rowIndex;g>=0&&h(g)}if(c.p.multiselect){b("#cb_"+b.jgrid.jqID(c.p.id),c.grid.hDiv)[c.p.useProp?"prop":"attr"]("checked",false);c.p.selrow=k.id;l=b.inArray(c.p.selrow,
132
+ c.p.selarrrow);if(l===-1){k.className!=="ui-subgrid"&&b(k).addClass("ui-state-highlight").attr("aria-selected","true");g=true;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow))[c.p.useProp?"prop":"attr"]("checked",g);c.p.selarrrow.push(c.p.selrow)}else{k.className!=="ui-subgrid"&&b(k).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;b("#jqg_"+b.jgrid.jqID(c.p.id)+"_"+b.jgrid.jqID(c.p.selrow))[c.p.useProp?"prop":"attr"]("checked",g);c.p.selarrrow.splice(l,1);l=c.p.selarrrow[0];
133
+ c.p.selrow=l===undefined?null:l}c.p.onSelectRow&&i&&c.p.onSelectRow.call(c,k.id,g)}else if(k.className!=="ui-subgrid"){if(c.p.selrow!=k.id){b(c.rows.namedItem(c.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"});b(k).addClass("ui-state-highlight").attr({"aria-selected":"true",tabindex:"0"});g=true}else g=false;c.p.selrow=k.id;c.p.onSelectRow&&i&&c.p.onSelectRow.call(c,k.id,g)}}}})},resetSelection:function(f){return this.each(function(){var i=this,h,c;if(typeof f!==
134
+ "undefined"){c=f===i.p.selrow?i.p.selrow:f;b("#"+b.jgrid.jqID(i.p.id)+" tbody:first tr#"+b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected","false");if(i.p.multiselect){b("#jqg_"+b.jgrid.jqID(i.p.id)+"_"+b.jgrid.jqID(c))[i.p.useProp?"prop":"attr"]("checked",false);b("#cb_"+b.jgrid.jqID(i.p.id))[i.p.useProp?"prop":"attr"]("checked",false)}c=null}else if(i.p.multiselect){b(i.p.selarrrow).each(function(g,k){h=i.rows.namedItem(k);b(h).removeClass("ui-state-highlight").attr("aria-selected",
135
+ "false");b("#jqg_"+b.jgrid.jqID(i.p.id)+"_"+b.jgrid.jqID(k))[i.p.useProp?"prop":"attr"]("checked",false)});b("#cb_"+b.jgrid.jqID(i.p.id))[i.p.useProp?"prop":"attr"]("checked",false);i.p.selarrrow=[]}else if(i.p.selrow){b("#"+b.jgrid.jqID(i.p.id)+" tbody:first tr#"+b.jgrid.jqID(i.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");i.p.selrow=null}if(i.p.cellEdit===true)if(parseInt(i.p.iCol,10)>=0&&parseInt(i.p.iRow,10)>=0){b("td:eq("+i.p.iCol+")",i.rows[i.p.iRow]).removeClass("edit-cell ui-state-highlight");
136
+ b(i.rows[i.p.iRow]).removeClass("selected-row ui-state-hover")}i.p.savedRow=[]})},getRowData:function(f){var i={},h,c=false,g,k=0;this.each(function(){var l=this,a,r;if(typeof f=="undefined"){c=true;h=[];g=l.rows.length}else{r=l.rows.namedItem(f);if(!r)return i;g=2}for(;k<g;){if(c)r=l.rows[k];if(b(r).hasClass("jqgrow")){b("td",r).each(function(x){a=l.p.colModel[x].name;if(a!=="cb"&&a!=="subgrid"&&a!=="rn")if(l.p.treeGrid===true&&a==l.p.ExpandColumn)i[a]=b.jgrid.htmlDecode(b("span:first",this).html());
137
+ else try{i[a]=b.unformat(this,{rowId:r.id,colModel:l.p.colModel[x]},x)}catch(y){i[a]=b.jgrid.htmlDecode(b(this).html())}});if(c){h.push(i);i={}}}k++}});return h?h:i},delRowData:function(f){var i=false,h,c;this.each(function(){if(h=this.rows.namedItem(f)){b(h).remove();this.p.records--;this.p.reccount--;this.updatepager(true,false);i=true;if(this.p.multiselect){c=b.inArray(f,this.p.selarrrow);c!=-1&&this.p.selarrrow.splice(c,1)}if(f==this.p.selrow)this.p.selrow=null}else return false;if(this.p.datatype==
138
+ "local"){var g=this.p._index[f];if(typeof g!="undefined"){this.p.data.splice(g,1);this.refreshIndex()}}if(this.p.altRows===true&&i){var k=this.p.altclass;b(this.rows).each(function(l){l%2==1?b(this).addClass(k):b(this).removeClass(k)})}});return i},setRowData:function(f,i,h){var c,g=true,k;this.each(function(){if(!this.grid)return false;var l=this,a,r,x=typeof h,y={};r=l.rows.namedItem(f);if(!r)return false;if(i)try{b(this.p.colModel).each(function(P){c=this.name;if(i[c]!==undefined){y[c]=this.formatter&&
139
+ typeof this.formatter==="string"&&this.formatter=="date"?b.unformat.date(i[c],this):i[c];a=l.formatter(f,i[c],P,i,"edit");k=this.title?{title:b.jgrid.stripHtml(a)}:{};l.p.treeGrid===true&&c==l.p.ExpandColumn?b("td:eq("+P+") > span:first",r).html(a).attr(k):b("td:eq("+P+")",r).html(a).attr(k)}});if(l.p.datatype=="local"){var H=l.p._index[f];if(l.p.treeGrid)for(var L in l.p.treeReader)y.hasOwnProperty(l.p.treeReader[L])&&delete y[l.p.treeReader[L]];if(typeof H!="undefined")l.p.data[H]=b.extend(true,
140
+ l.p.data[H],y);y=null}}catch(M){g=false}if(g)if(x==="string")b(r).addClass(h);else x==="object"&&b(r).css(h)});return g},addRowData:function(f,i,h,c){h||(h="last");var g=false,k,l,a,r,x,y,H,L,M="",P,U,o,n,s;if(i){if(b.isArray(i)){P=true;h="last";U=f}else{i=[i];P=false}this.each(function(){var D=i.length;x=this.p.rownumbers===true?1:0;a=this.p.multiselect===true?1:0;r=this.p.subGrid===true?1:0;if(!P)if(typeof f!="undefined")f+="";else{f=b.jgrid.randId();if(this.p.keyIndex!==false){U=this.p.colModel[this.p.keyIndex+
141
+ a+r+x].name;if(typeof i[0][U]!="undefined")f=i[0][U]}}o=this.p.altclass;for(var T=0,J="",C={},ca=b.isFunction(this.p.afterInsertRow)?true:false;T<D;){n=i[T];l="";if(P){try{f=n[U]}catch(V){f=b.jgrid.randId()}J=this.p.altRows===true?(this.rows.length-1)%2===0?o:"":""}f=this.p.idPrefix+f;if(x){M=this.formatCol(0,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+M+">0</td>"}if(a){L='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+
142
+ "_"+f+'" class="cbox"/>';M=this.formatCol(x,1,"",null,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+M+">"+L+"</td>"}if(r)l+=b(this).jqGrid("addSubGridCell",a+x,1);for(H=a+r+x;H<this.p.colModel.length;H++){s=this.p.colModel[H];k=s.name;C[k]=s.formatter&&typeof s.formatter==="string"&&s.formatter=="date"?b.unformat.date(n[k],s):n[k];L=this.formatter(f,b.jgrid.getAccessor(n,k),H,n,"edit");M=this.formatCol(H,1,L,n,f,true);l+='<td role="gridcell" aria-describedby="'+this.p.id+"_"+
143
+ k+'" '+M+">"+L+"</td>"}l='<tr id="'+f+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+J+'">'+l+"</tr>";if(this.rows.length===0)b("table:first",this.grid.bDiv).append(l);else switch(h){case "last":b(this.rows[this.rows.length-1]).after(l);y=this.rows.length-1;break;case "first":b(this.rows[0]).after(l);y=1;break;case "after":if(y=this.rows.namedItem(c))b(this.rows[y.rowIndex+1]).hasClass("ui-subgrid")?b(this.rows[y.rowIndex+1]).after(l):b(y).after(l);y++;break;
144
+ case "before":if(y=this.rows.namedItem(c)){b(y).before(l);y=y.rowIndex}y--}this.p.subGrid===true&&b(this).jqGrid("addSubGrid",a+x,y);this.p.records++;this.p.reccount++;ca&&this.p.afterInsertRow.call(this,f,n,n);T++;if(this.p.datatype=="local"){C[this.p.localReader.id]=f;this.p._index[f]=this.p.data.length;this.p.data.push(C);C={}}}if(this.p.altRows===true&&!P)if(h=="last")(this.rows.length-1)%2==1&&b(this.rows[this.rows.length-1]).addClass(o);else b(this.rows).each(function(fa){fa%2==1?b(this).addClass(o):
145
+ b(this).removeClass(o)});this.updatepager(true,true);g=true})}return g},footerData:function(f,i,h){function c(r){for(var x in r)if(r.hasOwnProperty(x))return false;return true}var g,k=false,l={},a;if(typeof f=="undefined")f="get";if(typeof h!="boolean")h=true;f=f.toLowerCase();this.each(function(){var r=this,x;if(!r.grid||!r.p.footerrow)return false;if(f=="set")if(c(i))return false;k=true;b(this.p.colModel).each(function(y){g=this.name;if(f=="set"){if(i[g]!==undefined){x=h?r.formatter("",i[g],y,i,
146
+ "edit"):i[g];a=this.title?{title:b.jgrid.stripHtml(x)}:{};b("tr.footrow td:eq("+y+")",r.grid.sDiv).html(x).attr(a);k=true}}else if(f=="get")l[g]=b("tr.footrow td:eq("+y+")",r.grid.sDiv).html()})});return f=="get"?l:k},showHideCol:function(f,i){return this.each(function(){var h=this,c=false,g=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,k;if(h.grid){if(typeof f==="string")f=[f];i=i!="none"?"":"none";var l=i===""?true:false,a=h.p.groupHeader&&(typeof h.p.groupHeader==="object"||b.isFunction(h.p.groupHeader));
147
+ a&&b(h).jqGrid("destroyGroupHeader",false);b(this.p.colModel).each(function(r){if(b.inArray(this.name,f)!==-1&&this.hidden===l){b("tr",h.grid.hDiv).each(function(){b(this.cells[r]).css("display",i)});b(h.rows).each(function(){b(this.cells[r]).css("display",i)});h.p.footerrow&&b("tr.footrow td:eq("+r+")",h.grid.sDiv).css("display",i);k=this.widthOrg?this.widthOrg:parseInt(this.width,10);if(i==="none")h.p.tblwidth-=k+g;else h.p.tblwidth+=k+g;this.hidden=!l;c=true}});if(c===true)b(h).jqGrid("setGridWidth",
148
+ h.p.shrinkToFit===true?h.p.tblwidth:h.p.width);a&&b(h).jqGrid("setGroupHeaders",h.p.groupHeader)}})},hideCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",f,"none")})},showCol:function(f){return this.each(function(){b(this).jqGrid("showHideCol",f,"")})},remapColumns:function(f,i,h){function c(l){var a;a=l.length?b.makeArray(l):b.extend({},l);b.each(f,function(r){l[r]=a[this]})}function g(l,a){b(">tr"+(a||""),l).each(function(){var r=this,x=b.makeArray(r.cells);b.each(f,function(){var y=
149
+ x[this];y&&r.appendChild(y)})})}var k=this.get(0);c(k.p.colModel);c(k.p.colNames);c(k.grid.headers);g(b("thead:first",k.grid.hDiv),h&&":not(.ui-jqgrid-labels)");i&&g(b("#"+b.jgrid.jqID(k.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");k.p.footerrow&&g(b("tbody:first",k.grid.sDiv));if(k.p.remapColumns)if(k.p.remapColumns.length)c(k.p.remapColumns);else k.p.remapColumns=b.makeArray(f);k.p.lastsort=b.inArray(k.p.lastsort,f);if(k.p.treeGrid)k.p.expColInd=b.inArray(k.p.expColInd,f)},setGridWidth:function(f,
150
+ i){return this.each(function(){if(this.grid){var h=this,c,g=0,k=b.browser.webkit||b.browser.safari?0:h.p.cellLayout,l,a=0,r=false,x=h.p.scrollOffset,y,H=0,L=0,M;if(typeof i!="boolean")i=h.p.shrinkToFit;if(!isNaN(f)){f=parseInt(f,10);h.grid.width=h.p.width=f;b("#gbox_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b("#gview_"+b.jgrid.jqID(h.p.id)).css("width",f+"px");b(h.grid.bDiv).css("width",f+"px");b(h.grid.hDiv).css("width",f+"px");h.p.pager&&b(h.p.pager).css("width",f+"px");h.p.toppager&&b(h.p.toppager).css("width",
151
+ f+"px");if(h.p.toolbar[0]===true){b(h.grid.uDiv).css("width",f+"px");h.p.toolbar[1]=="both"&&b(h.grid.ubDiv).css("width",f+"px")}h.p.footerrow&&b(h.grid.sDiv).css("width",f+"px");if(i===false&&h.p.forceFit===true)h.p.forceFit=false;if(i===true){b.each(h.p.colModel,function(){if(this.hidden===false){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);g+=c+k;if(this.fixed)H+=c+k;else a++;L++}});if(a===0)return;h.p.tblwidth=g;y=f-k*a-H;if(!isNaN(h.p.height))if(b(h.grid.bDiv)[0].clientHeight<b(h.grid.bDiv)[0].scrollHeight||
152
+ h.rows.length===1){r=true;y-=x}g=0;var P=h.grid.cols.length>0;b.each(h.p.colModel,function(U){if(this.hidden===false&&!this.fixed){c=this.widthOrg?this.widthOrg:parseInt(this.width,10);c=Math.round(y*c/(h.p.tblwidth-k*a-H));if(!(c<0)){this.width=c;g+=c;h.grid.headers[U].width=c;h.grid.headers[U].el.style.width=c+"px";if(h.p.footerrow)h.grid.footers[U].style.width=c+"px";if(P)h.grid.cols[U].style.width=c+"px";l=U}}});if(!l)return;M=0;if(r){if(f-H-(g+k*a)!==x)M=f-H-(g+k*a)-x}else if(Math.abs(f-H-(g+
153
+ k*a))!==1)M=f-H-(g+k*a);h.p.colModel[l].width+=M;h.p.tblwidth=g+M+k*a+H;if(h.p.tblwidth>f){r=h.p.tblwidth-parseInt(f,10);h.p.tblwidth=f;c=h.p.colModel[l].width-=r}else c=h.p.colModel[l].width;h.grid.headers[l].width=c;h.grid.headers[l].el.style.width=c+"px";if(P)h.grid.cols[l].style.width=c+"px";if(h.p.footerrow)h.grid.footers[l].style.width=c+"px"}if(h.p.tblwidth){b("table:first",h.grid.bDiv).css("width",h.p.tblwidth+"px");b("table:first",h.grid.hDiv).css("width",h.p.tblwidth+"px");h.grid.hDiv.scrollLeft=
154
+ h.grid.bDiv.scrollLeft;h.p.footerrow&&b("table:first",h.grid.sDiv).css("width",h.p.tblwidth+"px")}}}})},setGridHeight:function(f){return this.each(function(){if(this.grid){b(this.grid.bDiv).css({height:f+(isNaN(f)?"":"px")});this.p.height=f;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(f){return this.each(function(){this.p.caption=f;b("span.ui-jqgrid-title",this.grid.cDiv).html(f);b(this.grid.cDiv).show()})},setLabel:function(f,i,h,c){return this.each(function(){var g=-1;if(this.grid)if(typeof f!=
155
+ "undefined"){b(this.p.colModel).each(function(a){if(this.name==f){g=a;return false}});if(g>=0){var k=b("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(i){var l=b(".s-ico",k);b("[id^=jqgh_]",k).empty().html(i).append(l);this.p.colNames[g]=i}if(h)typeof h==="string"?b(k).addClass(h):b(k).css(h);typeof c==="object"&&b(k).attr(c)}}})},setCell:function(f,i,h,c,g,k){return this.each(function(){var l=-1,a,r;if(this.grid){if(isNaN(i))b(this.p.colModel).each(function(y){if(this.name==i){l=y;return false}});
156
+ else l=parseInt(i,10);if(l>=0)if(a=this.rows.namedItem(f)){var x=b("td:eq("+l+")",a);if(h!==""||k===true){a=this.formatter(f,h,l,a,"edit");r=this.p.colModel[l].title?{title:b.jgrid.stripHtml(a)}:{};this.p.treeGrid&&b(".tree-wrap",b(x)).length>0?b("span",b(x)).html(a).attr(r):b(x).html(a).attr(r);if(this.p.datatype=="local"){a=this.p.colModel[l];h=a.formatter&&typeof a.formatter==="string"&&a.formatter=="date"?b.unformat.date(h,a):h;r=this.p._index[f];if(typeof r!="undefined")this.p.data[r][a.name]=
157
+ h}}if(typeof c==="string")b(x).addClass(c);else c&&b(x).css(c);typeof g==="object"&&b(x).attr(g)}}})},getCell:function(f,i){var h=false;this.each(function(){var c=-1;if(this.grid){if(isNaN(i))b(this.p.colModel).each(function(l){if(this.name===i){c=l;return false}});else c=parseInt(i,10);if(c>=0){var g=this.rows.namedItem(f);if(g)try{h=b.unformat(b("td:eq("+c+")",g),{rowId:g.id,colModel:this.p.colModel[c]},c)}catch(k){h=b.jgrid.htmlDecode(b("td:eq("+c+")",g).html())}}}});return h},getCol:function(f,
158
+ i,h){var c=[],g,k=0,l=0,a=0,r;i=typeof i!="boolean"?false:i;if(typeof h=="undefined")h=false;this.each(function(){var x=-1;if(this.grid){if(isNaN(f))b(this.p.colModel).each(function(M){if(this.name===f){x=M;return false}});else x=parseInt(f,10);if(x>=0){var y=this.rows.length,H=0;if(y&&y>0){for(;H<y;){if(b(this.rows[H]).hasClass("jqgrow")){try{g=b.unformat(b(this.rows[H].cells[x]),{rowId:this.rows[H].id,colModel:this.p.colModel[x]},x)}catch(L){g=b.jgrid.htmlDecode(this.rows[H].cells[x].innerHTML)}if(h){r=
159
+ parseFloat(g);k+=r;l=Math.min(l,r);a=Math.max(a,r)}else i?c.push({id:this.rows[H].id,value:g}):c.push(g)}H++}if(h)switch(h.toLowerCase()){case "sum":c=k;break;case "avg":c=k/y;break;case "count":c=y;break;case "min":c=l;break;case "max":c=a}}}}});return c},clearGridData:function(f){return this.each(function(){if(this.grid){if(typeof f!="boolean")f=false;if(this.p.deepempty)b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var i=b("#"+b.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];
160
+ b("#"+b.jgrid.jqID(this.p.id)+" tbody:first").empty().append(i)}this.p.footerrow&&f&&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(true,false)}})},getInd:function(f,i){var h=false,c;this.each(function(){if(c=this.rows.namedItem(f))h=i===true?c:c.rowIndex});return h},bindKeys:function(f){var i=b.extend({onEnter:null,
161
+ onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:true},f||{});return this.each(function(){var h=this;b("body").is("[role]")||b("body").attr("role","application");h.p.scrollrows=i.scrollingRows;b(h).keydown(function(c){var g=b(h).find("tr[tabindex=0]")[0],k,l,a,r=h.p.treeReader.expanded_field;if(g){a=h.p._index[g.id];if(c.keyCode===37||c.keyCode===38||c.keyCode===39||c.keyCode===40){if(c.keyCode===38){l=g.previousSibling;k="";if(l)if(b(l).is(":hidden"))for(;l;){l=l.previousSibling;if(!b(l).is(":hidden")&&
162
+ b(l).hasClass("jqgrow")){k=l.id;break}}else k=l.id;b(h).jqGrid("setSelection",k)}if(c.keyCode===40){l=g.nextSibling;k="";if(l)if(b(l).is(":hidden"))for(;l;){l=l.nextSibling;if(!b(l).is(":hidden")&&b(l).hasClass("jqgrow")){k=l.id;break}}else k=l.id;b(h).jqGrid("setSelection",k)}if(c.keyCode===37){h.p.treeGrid&&h.p.data[a][r]&&b(g).find("div.treeclick").trigger("click");b.isFunction(i.onLeftKey)&&i.onLeftKey.call(h,h.p.selrow)}if(c.keyCode===39){h.p.treeGrid&&!h.p.data[a][r]&&b(g).find("div.treeclick").trigger("click");
163
+ b.isFunction(i.onRightKey)&&i.onRightKey.call(h,h.p.selrow)}}else if(c.keyCode===13)b.isFunction(i.onEnter)&&i.onEnter.call(h,h.p.selrow);else c.keyCode===32&&b.isFunction(i.onSpace)&&i.onSpace.call(h,h.p.selrow)}})})},unbindKeys:function(){return this.each(function(){b(this).unbind("keydown")})},getLocalRow:function(f){var i=false,h;this.each(function(){if(typeof f!=="undefined"){h=this.p._index[f];if(h>=0)i=this.p.data[h]}});return i}})})(jQuery);
164
+ (function(b){b.fmatter={};b.extend(b.fmatter,{isBoolean:function(a){return typeof a==="boolean"},isObject:function(a){return a&&(typeof a==="object"||b.isFunction(a))||false},isString:function(a){return typeof a==="string"},isNumber:function(a){return typeof a==="number"&&isFinite(a)},isNull:function(a){return a===null},isUndefined:function(a){return typeof a==="undefined"},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(a){if(!this.isString(a)&&
165
+ this.isValue(a))return false;else if(!this.isValue(a))return true;a=b.trim(a).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return a===""}});b.fn.fmatter=function(a,c,d,e,f){var g=c;d=b.extend({},b.jgrid.formatter,d);if(b.fn.fmatter[a])g=b.fn.fmatter[a](c,d,e,f);return g};b.fmatter.util={NumberFormat:function(a,c){b.fmatter.isNumber(a)||(a*=1);if(b.fmatter.isNumber(a)){var d=a<0,e=a+"",f=c.decimalSeparator?c.decimalSeparator:".",g;if(b.fmatter.isNumber(c.decimalPlaces)){var h=c.decimalPlaces;
166
+ e=Math.pow(10,h);e=Math.round(a*e)/e+"";g=e.lastIndexOf(".");if(h>0){if(g<0){e+=f;g=e.length-1}else if(f!==".")e=e.replace(".",f);for(;e.length-1-g<h;)e+="0"}}if(c.thousandsSeparator){h=c.thousandsSeparator;g=e.lastIndexOf(f);g=g>-1?g:e.length;f=e.substring(g);for(var i=-1,j=g;j>0;j--){i++;if(i%3===0&&j!==g&&(!d||j>1))f=h+f;f=e.charAt(j-1)+f}e=f}e=c.prefix?c.prefix+e:e;return e=c.suffix?e+c.suffix:e}else return a},DateFormat:function(a,c,d,e){var f=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,
167
+ g=typeof c==="string"?c.match(f):null;f=function(m,r){m=String(m);for(r=parseInt(r,10)||2;m.length<r;)m="0"+m;return m};var h={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},i=0,j,k=["i18n"];k.i18n={dayNames:e.dayNames,monthNames:e.monthNames};if(a in e.masks)a=e.masks[a];if(!isNaN(c-0)&&String(a).toLowerCase()=="u")i=new Date(parseFloat(c)*1E3);else if(c.constructor===Date)i=c;else if(g!==null){i=new Date(parseInt(g[1],10));if(g[3]){a=Number(g[5])*60+Number(g[6]);a*=g[4]=="-"?1:-1;a-=i.getTimezoneOffset();i.setTime(Number(Number(i)+
168
+ a*6E4))}}else{c=String(c).split(/[\\\/:_;.,\t\T\s-]/);a=a.split(/[\\\/:_;.,\t\T\s-]/);g=0;for(j=a.length;g<j;g++){if(a[g]=="M"){i=b.inArray(c[g],k.i18n.monthNames);if(i!==-1&&i<12)c[g]=i+1}if(a[g]=="F"){i=b.inArray(c[g],k.i18n.monthNames);if(i!==-1&&i>11)c[g]=i+1-12}if(c[g])h[a[g].toLowerCase()]=parseInt(c[g],10)}if(h.f)h.m=h.f;if(h.m===0&&h.y===0&&h.d===0)return"&#160;";h.m=parseInt(h.m,10)-1;i=h.y;if(i>=70&&i<=99)h.y=1900+h.y;else if(i>=0&&i<=69)h.y=2E3+h.y;i=new Date(h.y,h.m,h.d,h.h,h.i,h.s,h.u)}if(d in
169
+ e.masks)d=e.masks[d];else d||(d="Y-m-d");a=i.getHours();c=i.getMinutes();h=i.getDate();g=i.getMonth()+1;j=i.getTimezoneOffset();var l=i.getSeconds(),o=i.getMilliseconds(),n=i.getDay(),p=i.getFullYear(),q=(n+6)%7+1,s=(new Date(p,g-1,h)-new Date(p,0,1))/864E5,t={d:f(h),D:k.i18n.dayNames[n],j:h,l:k.i18n.dayNames[n+7],N:q,S:e.S(h),w:n,z:s,W:q<5?Math.floor((s+q-1)/7)+1:Math.floor((s+q-1)/7)||(((new Date(p-1,0,1)).getDay()+6)%7<4?53:52),F:k.i18n.monthNames[g-1+12],m:f(g),M:k.i18n.monthNames[g-1],n:g,t:"?",
170
+ L:"?",o:"?",Y:p,y:String(p).substring(2),a:a<12?e.AmPm[0]:e.AmPm[1],A:a<12?e.AmPm[2]:e.AmPm[3],B:"?",g:a%12||12,G:a,h:f(a%12||12),H:f(a),i:f(c),s:f(l),u:o,e:"?",I:"?",O:(j>0?"-":"+")+f(Math.floor(Math.abs(j)/60)*100+Math.abs(j)%60,4),P:"?",T:(String(i).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(i/1E3)};return d.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
171
+ function(m){return m in t?t[m]:m.substring(1)})}};b.fn.fmatter.defaultFormat=function(a,c){return b.fmatter.isValue(a)&&a!==""?a:c.defaultValue?c.defaultValue:"&#160;"};b.fn.fmatter.email=function(a,c){return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):'<a href="mailto:'+a+'">'+a+"</a>"};b.fn.fmatter.checkbox=function(a,c){var d=b.extend({},c.checkbox),e;b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));e=d.disabled===true?'disabled="disabled"':
172
+ "";if(b.fmatter.isEmpty(a)||b.fmatter.isUndefined(a))a=b.fn.fmatter.defaultFormat(a,d);a+="";a=a.toLowerCase();return'<input type="checkbox" '+(a.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+a+'" offval="no" '+e+"/>"};b.fn.fmatter.link=function(a,c){var d={target:c.target},e="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)e="target="+d.target;return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):"<a "+e+' href="'+
173
+ a+'">'+a+"</a>"};b.fn.fmatter.showlink=function(a,c){var d={baseLinkUrl:c.baseLinkUrl,showAction:c.showAction,addParam:c.addParam||"",target:c.target,idName:c.idName},e="";b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(d.target)e="target="+d.target;d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+c.rowId+d.addParam;return b.fmatter.isString(a)||b.fmatter.isNumber(a)?"<a "+e+' href="'+d+'">'+a+"</a>":b.fn.fmatter.defaultFormat(a,c)};b.fn.fmatter.integer=
174
+ function(a,c){var d=b.extend({},c.integer);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.number=function(a,c){var d=b.extend({},c.number);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.currency=function(a,c){var d=
175
+ b.extend({},c.currency);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));if(b.fmatter.isEmpty(a))return d.defaultValue;return b.fmatter.util.NumberFormat(a,d)};b.fn.fmatter.date=function(a,c,d,e){d=b.extend({},c.date);b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend({},d,c.colModel.formatoptions));return!d.reformatAfterEdit&&e=="edit"?b.fn.fmatter.defaultFormat(a,c):b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.srcformat,
176
+ a,d.newformat,d)};b.fn.fmatter.select=function(a,c){a+="";var d=false,e=[];if(b.fmatter.isUndefined(c.colModel.formatoptions)){if(!b.fmatter.isUndefined(c.colModel.editoptions))d=c.colModel.editoptions.value}else d=c.colModel.formatoptions.value;if(d){var f=c.colModel.editoptions.multiple===true?true:false,g=[],h;if(f){g=a.split(",");g=b.map(g,function(l){return b.trim(l)})}if(b.fmatter.isString(d))for(var i=d.split(";"),j=0,k=0;k<i.length;k++){h=i[k].split(":");if(h.length>2)h[1]=jQuery.map(h,function(l,
177
+ o){if(o>0)return l}).join(":");if(f){if(jQuery.inArray(h[0],g)>-1){e[j]=h[1];j++}}else if(b.trim(h[0])==b.trim(a)){e[0]=h[1];break}}else if(b.fmatter.isObject(d))if(f)e=jQuery.map(g,function(l){return d[l]});else e[0]=d[a]||""}a=e.join(", ");return a===""?b.fn.fmatter.defaultFormat(a,c):a};b.fn.fmatter.rowactions=function(a,c,d,e){var f={keys:false,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{},editOptions:{}};a=b.jgrid.jqID(a);
178
+ c=b.jgrid.jqID(c);e=b("#"+c)[0].p.colModel[e];b.fmatter.isUndefined(e.formatoptions)||(f=b.extend(f,e.formatoptions));if(!b.fmatter.isUndefined(b("#"+c)[0].p.editOptions))f.editOptions=b("#"+c)[0].p.editOptions;if(!b.fmatter.isUndefined(b("#"+c)[0].p.delOptions))f.delOptions=b("#"+c)[0].p.delOptions;e=function(h){f.afterSave&&f.afterSave(h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel",
179
+ "#"+c+".ui-jqgrid-btable:first").hide()};var g=function(h){f.afterRestore&&f.afterRestore(h);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()};switch(d){case "edit":b("#"+c).jqGrid("editRow",a,f.keys,f.onEdit,f.onSuccess,f.url,f.extraparam,e,f.onError,g);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").hide();
180
+ b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").show();break;case "save":if(b("#"+c).jqGrid("saveRow",a,f.onSuccess,f.url,f.extraparam,e,f.onError,g)){b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide()}break;case "cancel":b("#"+c).jqGrid("restoreRow",a,g);b("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del",
181
+ "#"+c+".ui-jqgrid-btable:first").show();b("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+c+".ui-jqgrid-btable:first").hide();break;case "del":b("#"+c).jqGrid("delGridRow",a,f.delOptions);break;case "formedit":b("#"+c).jqGrid("setSelection",a);b("#"+c).jqGrid("editGridRow",a,f.editOptions)}};b.fn.fmatter.actions=function(a,c){var d={keys:false,editbutton:true,delbutton:true,editformbutton:false};b.fmatter.isUndefined(c.colModel.formatoptions)||(d=b.extend(d,c.colModel.formatoptions));
182
+ var e=c.rowId,f="",g;if(typeof e=="undefined"||b.fmatter.isEmpty(e))return"";if(d.editformbutton){g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','formedit',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}else if(d.editbutton){g="onclick=jQuery.fn.fmatter.rowactions('"+
183
+ e+"','"+c.gid+"','edit',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";f=f+"<div title='"+b.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}if(d.delbutton){g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','del',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
184
+ f=f+"<div title='"+b.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+g+"><span class='ui-icon ui-icon-trash'></span></div>"}g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','save',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+g+"><span class='ui-icon ui-icon-disk'></span></div>";
185
+ g="onclick=jQuery.fn.fmatter.rowactions('"+e+"','"+c.gid+"','cancel',"+c.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";f=f+"<div title='"+b.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+g+"><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+f+"</div>"};b.unformat=function(a,c,d,e){var f,g=c.colModel.formatter,h=c.colModel.formatoptions||
186
+ {},i=/([\.\*\_\'\(\)\{\}\+\?\\])/g,j=c.colModel.unformat||b.fn.fmatter[g]&&b.fn.fmatter[g].unformat;if(typeof j!=="undefined"&&b.isFunction(j))f=j(b(a).text(),c,a);else if(!b.fmatter.isUndefined(g)&&b.fmatter.isString(g)){f=b.jgrid.formatter||{};switch(g){case "integer":h=b.extend({},f.integer,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),"");break;case "number":h=b.extend({},f.number,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),
187
+ "").replace(h.decimalSeparator,".");break;case "currency":h=b.extend({},f.currency,h);c=h.thousandsSeparator.replace(i,"\\$1");f=b(a).text().replace(RegExp(c,"g"),"").replace(h.decimalSeparator,".").replace(h.prefix,"").replace(h.suffix,"");break;case "checkbox":h=c.colModel.editoptions?c.colModel.editoptions.value.split(":"):["Yes","No"];f=b("input",a).is(":checked")?h[0]:h[1];break;case "select":f=b.unformat.select(a,c,d,e);break;case "actions":return"";default:f=b(a).text()}}return f!==undefined?
188
+ f:e===true?b(a).text():b.jgrid.htmlDecode(b(a).html())};b.unformat.select=function(a,c,d,e){d=[];a=b(a).text();if(e===true)return a;c=b.extend({},c.colModel.editoptions);if(c.value){var f=c.value;c=c.multiple===true?true:false;e=[];var g;if(c){e=a.split(",");e=b.map(e,function(k){return b.trim(k)})}if(b.fmatter.isString(f))for(var h=f.split(";"),i=0,j=0;j<h.length;j++){g=h[j].split(":");if(g.length>2)g[1]=jQuery.map(g,function(k,l){if(l>0)return k}).join(":");if(c){if(jQuery.inArray(g[1],e)>-1){d[i]=
189
+ g[0];i++}}else if(b.trim(g[1])==b.trim(a)){d[0]=g[0];break}}else if(b.fmatter.isObject(f)||b.isArray(f)){c||(e[0]=a);d=jQuery.map(e,function(k){var l;b.each(f,function(o,n){if(n==k){l=o;return false}});if(typeof l!="undefined")return l})}return d.join(", ")}else return a||""};b.unformat.date=function(a,c){var d=b.jgrid.formatter.date||{};b.fmatter.isUndefined(c.formatoptions)||(d=b.extend({},d,c.formatoptions));return b.fmatter.isEmpty(a)?b.fn.fmatter.defaultFormat(a,c):b.fmatter.util.DateFormat(d.newformat,
190
+ a,d.srcformat,d)}})(jQuery);
191
+ (function(a){a.jgrid.extend({getColProp:function(c){var g={},b=this[0];if(!b.grid)return false;b=b.p.colModel;for(var i=0;i<b.length;i++)if(b[i].name==c){g=b[i];break}return g},setColProp:function(c,g){return this.each(function(){if(this.grid)if(g)for(var b=this.p.colModel,i=0;i<b.length;i++)if(b[i].name==c){a.extend(this.p.colModel[i],g);break}})},sortGrid:function(c,g,b){return this.each(function(){var i=-1;if(this.grid){if(!c)c=this.p.sortname;for(var l=0;l<this.p.colModel.length;l++)if(this.p.colModel[l].index==
192
+ c||this.p.colModel[l].name==c){i=l;break}if(i!=-1){l=this.p.colModel[i].sortable;if(typeof l!=="boolean")l=true;if(typeof g!=="boolean")g=false;l&&this.sortData("jqgh_"+this.p.id+"_"+c,i,g,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var c=this.id;try{a("#gbox_"+c).remove()}catch(g){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var c={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
193
+ var g=document.createElement("table");a(g).attr({id:c.id});g.className=c.cl;c=this.id;a(g).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+c).length===1){a(g).insertBefore("#gbox_"+c).show();a(this.p.pager).insertBefore("#gbox_"+c)}else a(g).insertBefore("#gbox_"+c).show();a("#gbox_"+c).remove()}})},setGridState:function(c){return this.each(function(){if(this.grid)if(c=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast");this.p.pager&&a(this.p.pager).slideUp("fast");
194
+ this.p.toppager&&a(this.p.toppager).slideUp("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideUp("fast");a(this.grid.uDiv).slideUp("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+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"}else if(c=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast");
195
+ this.p.pager&&a(this.p.pager).slideDown("fast");this.p.toppager&&a(this.p.toppager).slideDown("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideDown("fast");a(this.grid.uDiv).slideDown("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+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(c){c=a.extend({autosearch:true,
196
+ searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND",defaultSearch:"bw"},c||{});return this.each(function(){function g(d,f){var j=a(d);j[0]&&jQuery.each(f,function(){this.data!==undefined?j.bind(this.type,this.data,this.fn):j.bind(this.type,this.fn)})}var b=this;if(!this.ftoolbar){var i=function(){var d={},f=0,j,e,h={},n;a.each(b.p.colModel,function(){e=this.index||this.name;switch(this.stype){case "select":n=this.searchoptions&&
197
+ this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(j=a("#gs_"+a.jgrid.jqID(this.name),b.grid.hDiv).val()){d[e]=j;h[e]=n;f++}else try{delete b.p.postData[e]}catch(r){}break;case "text":n=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:c.defaultSearch;if(j=a("#gs_"+a.jgrid.jqID(this.name),b.grid.hDiv).val()){d[e]=j;h[e]=n;f++}else try{delete b.p.postData[e]}catch(u){}}});var o=f>0?true:false;if(c.stringResult===true||b.p.datatype=="local"){var k='{"groupOp":"'+c.groupOp+
198
+ '","rules":[',t=0;a.each(d,function(r,u){if(t>0)k+=",";k+='{"field":"'+r+'",';k+='"op":"'+h[r]+'",';u+="";k+='"data":"'+u.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';t++});k+="]}";a.extend(b.p.postData,{filters:k});a.each(["searchField","searchString","searchOper"],function(r,u){b.p.postData.hasOwnProperty(u)&&delete b.p.postData[u]})}else a.extend(b.p.postData,d);var m;if(b.p.searchurl){m=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var q=false;if(a.isFunction(c.beforeSearch))q=c.beforeSearch.call(b);
199
+ q||a(b).jqGrid("setGridParam",{search:o}).trigger("reloadGrid",[{page:1}]);m&&a(b).jqGrid("setGridParam",{url:m});a.isFunction(c.afterSearch)&&c.afterSearch()},l=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),p;a.each(b.p.colModel,function(){var d=this,f,j,e,h;j=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");f=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===true&&a(j).css("display","none");
200
+ this.search=this.search===false?false:true;if(typeof this.stype=="undefined")this.stype="text";e=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(h=this.surl||e.dataUrl)a.ajax(a.extend({url:h,dataType:"html",success:function(m){if(e.buildSelect!==undefined)(m=e.buildSelect(m))&&a(f).append(m);else a(f).append(m);e.defaultValue&&a("select",f).val(e.defaultValue);a("select",f).attr({name:d.index||d.name,id:"gs_"+d.name});e.attr&&a("select",f).attr(e.attr);a("select",
201
+ f).css({width:"100%"});e.dataInit!==undefined&&e.dataInit(a("select",f)[0]);e.dataEvents!==undefined&&g(a("select",f)[0],e.dataEvents);c.autosearch===true&&a("select",f).change(function(){i();return false});m=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var n;if(d.searchoptions&&d.searchoptions.value)n=d.searchoptions.value;else if(d.editoptions&&d.editoptions.value)n=d.editoptions.value;if(n){h=document.createElement("select");h.style.width="100%";a(h).attr({name:d.index||d.name,id:"gs_"+
202
+ d.name});var o,k;if(typeof n==="string"){n=n.split(";");for(var t=0;t<n.length;t++){o=n[t].split(":");k=document.createElement("option");k.value=o[0];k.innerHTML=o[1];h.appendChild(k)}}else if(typeof n==="object")for(o in n)if(n.hasOwnProperty(o)){k=document.createElement("option");k.value=o;k.innerHTML=n[o];h.appendChild(k)}e.defaultValue&&a(h).val(e.defaultValue);e.attr&&a(h).attr(e.attr);e.dataInit!==undefined&&e.dataInit(h);e.dataEvents!==undefined&&g(h,e.dataEvents);a(f).append(h);c.autosearch===
203
+ true&&a(h).change(function(){i();return false})}}break;case "text":h=e.defaultValue?e.defaultValue:"";a(f).append("<input type='text' style='width:95%;padding:0px;' name='"+(d.index||d.name)+"' id='gs_"+d.name+"' value='"+h+"'/>");e.attr&&a("input",f).attr(e.attr);e.dataInit!==undefined&&e.dataInit(a("input",f)[0]);e.dataEvents!==undefined&&g(a("input",f)[0],e.dataEvents);if(c.autosearch===true)c.searchOnEnter?a("input",f).keypress(function(m){if((m.charCode?m.charCode:m.keyCode?m.keyCode:0)==13){i();
204
+ return false}return this}):a("input",f).keydown(function(m){switch(m.which){case 13:return false;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:p&&clearTimeout(p);p=setTimeout(function(){i()},500)}})}a(j).append(f);a(l).append(j)});a("table thead",b.grid.hDiv).append(l);this.ftoolbar=true;this.triggerToolbar=i;this.clearToolbar=function(d){var f={},j,e=0,h;d=typeof d!="boolean"?true:d;a.each(b.p.colModel,function(){j=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:
205
+ "";h=this.index||this.name;switch(this.stype){case "select":var q;a("#gs_"+a.jgrid.jqID(h)+" option",b.grid.hDiv).each(function(s){if(s===0)this.selected=true;if(a(this).text()==j){this.selected=true;q=a(this).val();return false}});if(q){f[h]=q;e++}else try{delete b.p.postData[h]}catch(r){}break;case "text":a("#gs_"+a.jgrid.jqID(h),b.grid.hDiv).val(j);if(j){f[h]=j;e++}else try{delete b.p.postData[h]}catch(u){}}});var n=e>0?true:false;if(c.stringResult===true||b.p.datatype=="local"){var o='{"groupOp":"'+
206
+ c.groupOp+'","rules":[',k=0;a.each(f,function(q,r){if(k>0)o+=",";o+='{"field":"'+q+'",';o+='"op":"eq",';r+="";o+='"data":"'+r.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';k++});o+="]}";a.extend(b.p.postData,{filters:o});a.each(["searchField","searchString","searchOper"],function(q,r){b.p.postData.hasOwnProperty(r)&&delete b.p.postData[r]})}else a.extend(b.p.postData,f);var t;if(b.p.searchurl){t=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var m=false;if(a.isFunction(c.beforeClear))m=
207
+ c.beforeClear.call(b);m||d&&a(b).jqGrid("setGridParam",{search:n}).trigger("reloadGrid",[{page:1}]);t&&a(b).jqGrid("setGridParam",{url:t});a.isFunction(c.afterClear)&&c.afterClear()};this.toggleToolbar=function(){var d=a("tr.ui-search-toolbar",b.grid.hDiv);d.css("display")=="none"?d.show():d.hide()}}})},destroyGroupHeader:function(c){if(typeof c=="undefined")c=true;return this.each(function(){var g,b,i,l,p,d;b=this.grid;var f=a("table.ui-jqgrid-htable thead",b.hDiv),j=this.p.colModel;if(b){g=a("<tr>",
208
+ {role:"rowheader"}).addClass("ui-jqgrid-labels");l=b.headers;b=0;for(i=l.length;b<i;b++){p=j[b].hidden?"none":"";p=a(l[b].el).width(l[b].width).removeAttr("rowSpan").css("display",p);g.append(p);d=p.children("span.ui-jqgrid-resize");if(d.length>0)d[0].style.height="";p.children("div")[0].style.top=""}a(f).children("tr.ui-jqgrid-labels").remove();a(f).prepend(g);c===true&&a(this).jqGrid("setGridParam",{groupHeader:null})}})},setGroupHeaders:function(c){c=a.extend({useColSpanStyle:false,groupHeaders:[]},
209
+ c||{});return this.each(function(){this.p.groupHeader=c;var g=this,b,i,l=0,p,d,f,j,e,h=g.p.colModel,n=h.length,o=g.grid.headers,k=a("table.ui-jqgrid-htable",g.grid.hDiv),t=k.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");p=k.children("thead");var m,q=k.find(".jqg-first-row-header");if(q.html()===null)q=a("<tr>",{role:"row","aria-hidden":"true"}).addClass("jqg-first-row-header").css("height","auto");else q.empty();var r,u=function(s,v){for(var w=0,x=v.length;w<
210
+ x;w++)if(v[w].startColumnName===s)return w;return-1};a(g).prepend(p);p=a("<tr>",{role:"rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(b=0;b<n;b++){f=o[b].el;j=a(f);i=h[b];d={height:"0px",width:o[b].width+"px",display:i.hidden?"none":""};a("<th>",{role:"gridcell"}).css(d).addClass("ui-first-th-"+g.p.direction).appendTo(q);f.style.width="";d=u(i.name,c.groupHeaders);if(d>=0){d=c.groupHeaders[d];l=d.numberOfColumns;e=d.titleText;for(d=i=0;d<l&&b+d<n;d++)h[b+d].hidden||i++;d=a("<th>",
211
+ {colspan:String(i),role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+g.p.direction).css({height:"22px","border-top":"0px none"}).html(e);g.p.headertitles&&d.attr("title",d.text());i===0&&d.hide();j.before(d);p.append(f);l-=1}else if(l===0)if(c.useColSpanStyle)j.attr("rowspan","2");else{a("<th>",{role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+g.p.direction).css({display:i.hidden?"none":"","border-top":"0px none"}).insertBefore(j);p.append(f)}else{p.append(f);
212
+ l--}}h=a(g).children("thead");h.prepend(q);p.insertAfter(t);k.append(h);if(c.useColSpanStyle){k.find("span.ui-jqgrid-resize").each(function(){var s=a(this).parent();if(s.is(":visible"))this.style.cssText="height: "+s.height()+"px !important; cursor: col-resize;"});k.find("div.ui-jqgrid-sortable").each(function(){var s=a(this),v=s.parent();v.is(":visible")&&s.css("top",(v.height()-s.outerHeight())/2+"px")})}if(a.isFunction(g.p.resizeStop))m=g.p.resizeStop;r=h.find("tr.jqg-first-row-header");g.p.resizeStop=
213
+ function(s,v){r.find("th").eq(v).width(s);a.isFunction(m)&&m.call(g,s,v)}})}})})(jQuery);
214
+ (function(a){a.extend(a.jgrid,{showModal:function(b){b.w.show()},closeModal:function(b){b.w.hide().attr("aria-hidden","true");b.o&&b.o.remove()},hideModal:function(b,c){c=a.extend({jqm:true,gb:""},c||{});if(c.onClose){var d=c.onClose(b);if(typeof d=="boolean"&&!d)return}if(a.fn.jqm&&c.jqm===true)a(b).attr("aria-hidden","true").jqmHide();else{if(c.gb!=="")try{a(".jqgrid-overlay:first",c.gb).hide()}catch(f){}a(b).hide().attr("aria-hidden","true")}},findPos:function(b){var c=0,d=0;if(b.offsetParent){do{c+=
215
+ b.offsetLeft;d+=b.offsetTop}while(b=b.offsetParent)}return[c,d]},createModal:function(b,c,d,f,g,h,j){var e=document.createElement("div"),k,m=this;j=a.extend({},j||{});k=a(d.gbox).attr("dir")=="rtl"?true:false;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=b.themodal;var i=document.createElement("div");i.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";i.id=b.modalhead;a(i).append("<span class='ui-jqdialog-title'>"+d.caption+"</span>");var q=
216
+ a("<a href='javascript:void(0)' 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(i).append(q);if(k){e.dir="rtl";a(".ui-jqdialog-title",i).css("float","right");a(".ui-jqdialog-titlebar-close",i).css("left","0.3em")}else{e.dir="ltr";a(".ui-jqdialog-title",i).css("float","left");a(".ui-jqdialog-titlebar-close",i).css("right","0.3em")}var l=document.createElement("div");
217
+ a(l).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(l).append(c);e.appendChild(l);a(e).prepend(i);if(h===true)a("body").append(e);else typeof h=="string"?a(h).append(e):a(e).insertBefore(f);a(e).css(j);if(typeof d.jqModal==="undefined")d.jqModal=true;c={};if(a.fn.jqm&&d.jqModal===true){if(d.left===0&&d.top===0&&d.overlay){j=[];j=this.findPos(g);d.left=j[0]+4;d.top=j[1]+4}c.top=d.top+"px";c.left=d.left}else if(d.left!==0||d.top!==0){c.left=d.left;c.top=d.top+"px"}a("a.ui-jqdialog-titlebar-close",
218
+ i).click(function(){var p=a("#"+b.themodal).data("onClose")||d.onClose,o=a("#"+b.themodal).data("gbox")||d.gbox;m.hideModal("#"+b.themodal,{gb:o,jqm:d.jqModal,onClose:p});return false});if(d.width===0||!d.width)d.width=300;if(d.height===0||!d.height)d.height=200;if(!d.zIndex){f=a(f).parents("*[role=dialog]").filter(":first").css("z-index");d.zIndex=f?parseInt(f,10)+1:950}f=0;if(k&&c.left&&!h){f=a(d.gbox).width()-(!isNaN(d.width)?parseInt(d.width,10):0)-8;c.left=parseInt(c.left,10)+parseInt(f,10)}if(c.left)c.left+=
219
+ "px";a(e).css(a.extend({width:isNaN(d.width)?"auto":d.width+"px",height:isNaN(d.height)?"auto":d.height+"px",zIndex:d.zIndex,overflow:"hidden"},c)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":b.modalhead,"aria-hidden":"true"});if(typeof d.drag=="undefined")d.drag=true;if(typeof d.resize=="undefined")d.resize=true;if(d.drag){a(i).css("cursor","move");if(a.fn.jqDrag)a(e).jqDrag(i);else try{a(e).draggable({handle:a("#"+i.id)})}catch(n){}}if(d.resize)if(a.fn.jqResize){a(e).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
220
+ a("#"+b.themodal).jqResize(".jqResize",b.scrollelm?"#"+b.scrollelm:false)}else try{a(e).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+b.scrollelm:false})}catch(r){}d.closeOnEscape===true&&a(e).keydown(function(p){if(p.which==27){p=a("#"+b.themodal).data("onClose")||d.onClose;m.hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:p})}})},viewModal:function(b,c){c=a.extend({toTop:true,overlay:10,modal:false,overlayClass:"ui-widget-overlay",onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:true,
221
+ jqM:true},c||{});if(a.fn.jqm&&c.jqm===true)c.jqM?a(b).attr("aria-hidden","false").jqm(c).jqmShow():a(b).attr("aria-hidden","false").jqmShow();else{if(c.gbox!==""){a(".jqgrid-overlay:first",c.gbox).show();a(b).data("gbox",c.gbox)}a(b).show().attr("aria-hidden","false");try{a(":input:visible",b)[0].focus()}catch(d){}}},info_dialog:function(b,c,d,f){var g={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:"<b>"+b+"</b>",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true,
222
+ align:"center",buttonalign:"center",buttons:[]};a.extend(g,f||{});var h=g.jqModal,j=this;if(a.fn.jqm&&!h)h=false;b="";if(g.buttons.length>0)for(f=0;f<g.buttons.length;f++){if(typeof g.buttons[f].id=="undefined")g.buttons[f].id="info_button_"+f;b+="<a href='javascript:void(0)' id='"+g.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+g.buttons[f].text+"</a>"}f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";var e="<div id='info_id'>";e+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+
223
+ f+";"+("text-align:"+g.align+";")+"'>"+c+"</div>";e+=d?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+d+"</a>"+b+"</div>":b!==""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+
224
+ b+"</div>":"";e+="</div>";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:h});a("#info_dialog").remove()}catch(k){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},e,g,"","",true);b&&a.each(g.buttons,function(i){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[i].onClick.call(a("#info_dialog"));return false})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:h});
225
+ return false});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();this.viewModal("#info_dialog",{onHide:function(i){i.w.hide().remove();i.o&&i.o.remove()},modal:g.modal,jqm:h});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(m){}},createEl:function(b,c,d,f,g){function h(l,n){a.isFunction(n.dataInit)&&n.dataInit(l);n.dataEvents&&a.each(n.dataEvents,
226
+ function(){this.data!==undefined?a(l).bind(this.type,this.data,this.fn):a(l).bind(this.type,this.fn)});return n}function j(l,n,r){var p=["dataInit","dataEvents","dataUrl","buildSelect","sopt","searchhidden","defaultValue","attr"];if(typeof r!="undefined"&&a.isArray(r))p=a.extend(p,r);a.each(n,function(o,s){a.inArray(o,p)===-1&&a(l).attr(o,s)});n.hasOwnProperty("id")||a(l).attr("id",a.jgrid.randId())}var e="";switch(b){case "textarea":e=document.createElement("textarea");if(f)c.cols||a(e).css({width:"98%"});
227
+ else if(!c.cols)c.cols=20;if(!c.rows)c.rows=2;if(d=="&nbsp;"||d=="&#160;"||d.length==1&&d.charCodeAt(0)==160)d="";e.value=d;j(e,c);c=h(e,c);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";if(c.value){b=c.value.split(":");if(d===b[0]){e.checked=true;e.defaultChecked=true}e.value=b[0];a(e).attr("offval",b[1])}else{b=d.toLowerCase();if(b.search(/(false|0|no|off|undefined)/i)<0&&b!==""){e.checked=true;e.defaultChecked=true;e.value=
228
+ d}else e.value="on";a(e).attr("offval","off")}j(e,c,["value"]);c=h(e,c);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];if(c.multiple===true){b=true;e.multiple="multiple";a(e).attr("aria-multiselectable","true")}else b=false;if(typeof c.dataUrl!="undefined")a.ajax(a.extend({url:c.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:c,vl:d},success:function(l){var n=[],r=this.elem,p=this.vl,o=a.extend({},this.options),s=
229
+ o.multiple===true;if(typeof o.buildSelect!="undefined")l=o.buildSelect(l);if(l=a(l).html()){a(r).append(l);j(r,o);o=h(r,o);if(typeof o.size==="undefined")o.size=s?3:1;if(s){n=p.split(",");n=a.map(n,function(t){return a.trim(t)})}else n[0]=a.trim(p);setTimeout(function(){a("option",r).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),n)>-1||a.inArray(a.trim(a(this).val()),n)>-1)this.selected="selected"})},0)}}},g||{}));else if(c.value){var k;if(typeof c.size==="undefined")c.size=
230
+ b?3:1;if(b){f=d.split(",");f=a.map(f,function(l){return a.trim(l)})}if(typeof c.value==="function")c.value=c.value();var m,i;if(typeof c.value==="string"){m=c.value.split(";");for(k=0;k<m.length;k++){i=m[k].split(":");if(i.length>2)i[1]=a.map(i,function(l,n){if(n>0)return l}).join(":");g=document.createElement("option");g.setAttribute("role","option");g.value=i[0];g.innerHTML=i[1];e.appendChild(g);if(!b&&(a.trim(i[0])==a.trim(d)||a.trim(i[1])==a.trim(d)))g.selected="selected";if(b&&(a.inArray(a.trim(i[1]),
231
+ f)>-1||a.inArray(a.trim(i[0]),f)>-1))g.selected="selected"}}else if(typeof c.value==="object"){m=c.value;for(k in m)if(m.hasOwnProperty(k)){g=document.createElement("option");g.setAttribute("role","option");g.value=k;g.innerHTML=m[k];e.appendChild(g);if(!b&&(a.trim(k)==a.trim(d)||a.trim(m[k])==a.trim(d)))g.selected="selected";if(b&&(a.inArray(a.trim(m[k]),f)>-1||a.inArray(a.trim(k),f)>-1))g.selected="selected"}}j(e,c,["value"]);c=h(e,c)}break;case "text":case "password":case "button":k=b=="button"?
232
+ "button":"textbox";e=document.createElement("input");e.type=b;e.value=d;j(e,c);c=h(e,c);if(b!="button")if(f)c.size||a(e).css({width:"98%"});else if(!c.size)c.size=20;a(e).attr("role",k);break;case "image":case "file":e=document.createElement("input");e.type=b;j(e,c);c=h(e,c);break;case "custom":e=document.createElement("span");try{if(a.isFunction(c.custom_element))if(m=c.custom_element.call(this,d,c)){m=a(m).addClass("customelement").attr({id:c.id,name:c.name});a(e).empty().append(m)}else throw"e2";
233
+ else throw"e1";}catch(q){q=="e1"&&this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose);q=="e2"?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,typeof q==="string"?q:q.message,a.jgrid.edit.bClose)}}return e},checkDate:function(b,c){var d={},f;b=b.toLowerCase();f=b.indexOf("/")!=-1?"/":b.indexOf("-")!=-1?"-":b.indexOf(".")!=-1?".":"/";
234
+ b=b.split(f);c=c.split(f);if(c.length!=3)return false;f=-1;for(var g,h=-1,j=-1,e=0;e<b.length;e++){g=isNaN(c[e])?0:parseInt(c[e],10);d[b[e]]=g;g=b[e];if(g.indexOf("y")!=-1)f=e;if(g.indexOf("m")!=-1)j=e;if(g.indexOf("d")!=-1)h=e}g=b[f]=="y"||b[f]=="yyyy"?4:b[f]=="yy"?2:-1;e=function(m){for(var i=1;i<=m;i++){this[i]=31;if(i==4||i==6||i==9||i==11)this[i]=30;if(i==2)this[i]=29}return this}(12);var k;if(f===-1)return false;else{k=d[b[f]].toString();if(g==2&&k.length==1)g=1;if(k.length!=g||d[b[f]]===0&&
235
+ c[f]!="00")return false}if(j===-1)return false;else{k=d[b[j]].toString();if(k.length<1||d[b[j]]<1||d[b[j]]>12)return false}if(h===-1)return false;else{k=d[b[h]].toString();if(k.length<1||d[b[h]]<1||d[b[h]]>31||d[b[j]]==2&&d[b[h]]>(d[b[f]]%4===0&&(d[b[f]]%100!==0||d[b[f]]%400===0)?29:28)||d[b[h]]>e[d[b[j]]])return false}return true},isEmpty:function(b){return b.match(/^\s+$/)||b===""?true:false},checkTime:function(b){var c=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(b))if(b=b.match(c)){if(b[3]){if(b[1]<
236
+ 1||b[1]>12)return false}else if(b[1]>23)return false;if(b[2]>59)return false}else return false;return true},checkValues:function(b,c,d,f,g){var h,j;if(typeof f==="undefined")if(typeof c=="string"){f=0;for(g=d.p.colModel.length;f<g;f++)if(d.p.colModel[f].name==c){h=d.p.colModel[f].editrules;c=f;try{j=d.p.colModel[f].formoptions.label}catch(e){}break}}else{if(c>=0)h=d.p.colModel[c].editrules}else{h=f;j=g===undefined?"_":g}if(h){j||(j=d.p.colNames[c]);if(h.required===true)if(this.isEmpty(b))return[false,
237
+ j+": "+a.jgrid.edit.msg.required,""];f=h.required===false?false:true;if(h.number===true)if(!(f===false&&this.isEmpty(b)))if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.number,""];if(typeof h.minValue!="undefined"&&!isNaN(h.minValue))if(parseFloat(b)<parseFloat(h.minValue))return[false,j+": "+a.jgrid.edit.msg.minValue+" "+h.minValue,""];if(typeof h.maxValue!="undefined"&&!isNaN(h.maxValue))if(parseFloat(b)>parseFloat(h.maxValue))return[false,j+": "+a.jgrid.edit.msg.maxValue+" "+h.maxValue,""];if(h.email===
238
+ true)if(!(f===false&&this.isEmpty(b))){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;
239
+ if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.email,""]}if(h.integer===true)if(!(f===false&&this.isEmpty(b))){if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.integer,""];if(b%1!==0||b.indexOf(".")!=-1)return[false,j+": "+a.jgrid.edit.msg.integer,""]}if(h.date===true)if(!(f===false&&this.isEmpty(b))){c=d.p.colModel[c].formatoptions&&d.p.colModel[c].formatoptions.newformat?d.p.colModel[c].formatoptions.newformat:d.p.colModel[c].datefmt||"Y-m-d";if(!this.checkDate(c,b))return[false,j+": "+a.jgrid.edit.msg.date+
240
+ " - "+c,""]}if(h.time===true)if(!(f===false&&this.isEmpty(b)))if(!this.checkTime(b))return[false,j+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(h.url===true)if(!(f===false&&this.isEmpty(b))){g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.url,""]}if(h.custom===true)if(!(f===false&&this.isEmpty(b)))if(a.isFunction(h.custom_func)){b=h.custom_func.call(d,b,j);return a.isArray(b)?
241
+ b:[false,a.jgrid.edit.msg.customarray,""]}else return[false,a.jgrid.edit.msg.customfcheck,""]}return[true,"",""]}})})(jQuery);
242
+ (function(a){var d={};a.jgrid.extend({searchGrid:function(f){f=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,multipleGroup:false,top:0,left:0,jqModal:true,modal:false,resize:true,width:450,height:"auto",dataheight:"auto",showQuery:false,errorcheck:true,
243
+ sopt:null,stringResult:undefined,onClose:null,onSearch:null,onReset:null,toTop:true,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:false,layer:null},a.jgrid.search,f||{});return this.each(function(){function b(){if(a.isFunction(f.beforeShowSearch)){x=f.beforeShowSearch(a("#"+r));if(typeof x==="undefined")x=true}if(x){a.jgrid.viewModal("#"+D.themodal,{gbox:"#gbox_"+r,jqm:f.jqModal,modal:f.modal,overlay:f.overlay,toTop:f.toTop});a.isFunction(f.afterShowSearch)&&
244
+ f.afterShowSearch(a("#"+r))}}var e=this;if(e.grid){var r="fbox_"+e.p.id,x=true,D={themodal:"searchmod"+r,modalhead:"searchhd"+r,modalcontent:"searchcnt"+r,scrollelm:r},F=e.p.postData[f.sFilter];if(typeof F==="string")F=a.jgrid.parse(F);f.recreateFilter===true&&a("#"+D.themodal).remove();if(a("#"+D.themodal).html()!==null)b();else{var y=a("<div><div id='"+r+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+e.p.id),o="left",k="";if(e.p.direction=="rtl"){o="right";k=
245
+ " style='text-align:left'";y.attr("dir","rtl")}if(a.isFunction(f.onInitializeSearch))f.onInitializeSearch(a("#"+r));var s=a.extend([],e.p.colModel),N="<a href='javascript:void(0)' id='"+r+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+f.Find+"</a>",c="<a href='javascript:void(0)' id='"+r+"_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>"+
246
+ f.Reset+"</a>",t="",p="",j,n=false,G=-1;if(f.showQuery)t="<a href='javascript:void(0)' id='"+r+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>";if(f.columns.length)s=f.columns;else a.each(s,function(u,E){if(!E.label)E.label=e.p.colNames[u];if(!n){var B=typeof E.search==="undefined"?true:E.search,m=E.hidden===true;if(E.searchoptions&&E.searchoptions.searchhidden===true&&B||B&&!m){n=true;j=E.index||E.name;G=u}}});if(!F&&
247
+ j||f.multipleSearch===false){var J="eq";if(G>=0&&s[G].searchoptions&&s[G].searchoptions.sopt)J=s[G].searchoptions.sopt[0];else if(f.sopt&&f.sopt.length)J=f.sopt[0];F={groupOp:"AND",rules:[{field:j,op:J,data:""}]}}n=false;if(f.tmplNames&&f.tmplNames.length){n=true;p=f.tmplLabel;p+="<select class='ui-template'>";p+="<option value='default'>Default</option>";a.each(f.tmplNames,function(u,E){p+="<option value='"+u+"'>"+E+"</option>"});p+="</select>"}o="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+
248
+ r+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:"+o+"'>"+c+p+"</td><td class='EditButton' "+k+">"+t+N+"</td></tr></tbody></table>";a("#"+r).jqFilter({columns:s,filter:f.loadDefaults?F:null,showQuery:f.showQuery,errorcheck:f.errorcheck,sopt:f.sopt,groupButton:f.multipleGroup,ruleButtons:f.multipleSearch,afterRedraw:f.afterRedraw,_gridsopt:a.jgrid.search.odata,onChange:function(){this.p.showQuery&&a(".query",
249
+ this).html(this.toUserFriendlyString())},direction:e.p.direction});y.append(o);n&&f.tmplFilters&&f.tmplFilters.length&&a(".ui-template",y).bind("change",function(){var u=a(this).val();u=="default"?a("#"+r).jqFilter("addFilter",F):a("#"+r).jqFilter("addFilter",f.tmplFilters[parseInt(u,10)]);return false});if(f.multipleGroup===true)f.multipleSearch=true;if(a.isFunction(f.onInitializeSearch))f.onInitializeSearch(a("#"+r));f.gbox="#gbox_"+r;f.layer?a.jgrid.createModal(D,y,f,"#gview_"+e.p.id,a("#gbox_"+
250
+ e.p.id)[0],"#"+f.layer,{position:"relative"}):a.jgrid.createModal(D,y,f,"#gview_"+e.p.id,a("#gbox_"+e.p.id)[0]);t&&a("#"+r+"_query").bind("click",function(){a(".queryresult",y).toggle();return false});if(f.stringResult===undefined)f.stringResult=f.multipleSearch;a("#"+r+"_search").bind("click",function(){var u=a("#"+r),E={},B,m=u.jqFilter("filterData");if(f.errorcheck){u[0].hideError();f.showQuery||u.jqFilter("toSQLString");if(u[0].p.error){u[0].showError();return false}}if(f.stringResult){try{B=
251
+ xmlJsonClass.toJson(m,"","",false)}catch(z){try{B=JSON.stringify(m)}catch(h){}}if(typeof B==="string"){E[f.sFilter]=B;a.each([f.sField,f.sValue,f.sOper],function(){E[this]=""})}}else if(f.multipleSearch){E[f.sFilter]=m;a.each([f.sField,f.sValue,f.sOper],function(){E[this]=""})}else{E[f.sField]=m.rules[0].field;E[f.sValue]=m.rules[0].data;E[f.sOper]=m.rules[0].op;E[f.sFilter]=""}e.p.search=true;a.extend(e.p.postData,E);if(a.isFunction(f.onSearch))f.onSearch();a(e).trigger("reloadGrid",[{page:1}]);
252
+ f.closeAfterSearch&&a.jgrid.hideModal("#"+D.themodal,{gb:"#gbox_"+e.p.id,jqm:f.jqModal,onClose:f.onClose});return false});a("#"+r+"_reset").bind("click",function(){var u={},E=a("#"+r);e.p.search=false;if(f.multipleSearch===false)u[f.sField]=u[f.sValue]=u[f.sOper]="";else u[f.sFilter]="";E[0].resetFilter();n&&a(".ui-template",y).val("default");a.extend(e.p.postData,u);if(a.isFunction(f.onReset))f.onReset();a(e).trigger("reloadGrid",[{page:1}]);return false});b();a(".fm-button:not(.ui-state-disabled)",
253
+ y).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(f,b){b=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:null,mtype:"POST",clearAfterAdd:true,closeAfterEdit:false,reloadAfterSubmit:true,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,
254
+ afterclickPgButtons:null,editData:{},recreateForm:false,jqModal:true,closeOnEscape:false,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[false,13],navkeys:[false,38,40],checkOnSubmit:false,checkOnUpdate:false,_savedData:{},processing:false,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:true},a.jgrid.edit,b||{});d[a(this)[0].p.id]=b;return this.each(function(){function e(){a("#"+j+" > tbody > tr > td > .FormElement").each(function(){var g=a(".customelement",
255
+ this);if(g.length){var l=a(g[0]).attr("name");a.each(c.p.colModel,function(){if(this.name===l&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{h[l]=this.editoptions.custom_value(a("#"+a.jgrid.jqID(l),"#"+j),"get");if(h[l]===undefined)throw"e1";}catch(q){q==="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).is(":checked"))h[this.name]=
256
+ a(this).val();else{g=a(this).attr("offval");h[this.name]=g}break;case "select-one":h[this.name]=a("option:selected",this).val();P[this.name]=a("option:selected",this).text();break;case "select-multiple":h[this.name]=a(this).val();h[this.name]=h[this.name]?h[this.name].join(","):"";var w=[];a("option:selected",this).each(function(q,H){w[q]=a(H).text()});P[this.name]=w.join(",");break;case "password":case "text":case "textarea":case "button":h[this.name]=a(this).val()}if(c.p.autoencode)h[this.name]=
257
+ a.jgrid.htmlEncode(h[this.name])}});return true}function r(g,l,w,q){var H,C,v,K=0,A,Q,I,U=[],M=false,aa="",S;for(S=1;S<=q;S++)aa+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";if(g!="_empty")M=a(l).jqGrid("getInd",g);a(l.p.colModel).each(function(T){H=this.name;Q=(C=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if(H!=="cb"&&H!=="subgrid"&&this.editable===true&&H!=="rn"){if(M===false)A="";else if(H==l.p.ExpandColumn&&
258
+ l.p.treeGrid===true)A=a("td:eq("+T+")",l.rows[M]).text();else{try{A=a.unformat(a("td:eq("+T+")",l.rows[M]),{rowId:g,colModel:this},T)}catch(ga){A=this.edittype&&this.edittype=="textarea"?a("td:eq("+T+")",l.rows[M]).text():a("td:eq("+T+")",l.rows[M]).html()}if(!A||A=="&nbsp;"||A=="&#160;"||A.length==1&&A.charCodeAt(0)==160)A=""}var Y=a.extend({},this.editoptions||{},{id:H,name:H}),Z=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),ea=parseInt(Z.rowpos,10)||
259
+ K+1,ha=parseInt((parseInt(Z.colpos,10)||1)*2,10);if(g=="_empty"&&Y.defaultValue)A=a.isFunction(Y.defaultValue)?Y.defaultValue():Y.defaultValue;if(!this.edittype)this.edittype="text";if(c.p.autoencode)A=a.jgrid.htmlDecode(A);I=a.jgrid.createEl(this.edittype,Y,A,false,a.extend({},a.jgrid.ajaxOptions,l.p.ajaxSelectOptions||{}));if(A===""&&this.edittype=="checkbox")A=a(I).attr("offval");if(A===""&&this.edittype=="select")A=a("option:eq(0)",I).text();if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[H]=
260
+ A;a(I).addClass("FormElement");if(this.edittype=="text"||this.edittype=="textarea")a(I).addClass("ui-widget-content ui-corner-all");v=a(w).find("tr[rowpos="+ea+"]");if(Z.rowabove){Y=a("<tr><td class='contentinfo' colspan='"+q*2+"'>"+Z.rowcontent+"</td></tr>");a(w).append(Y);Y[0].rp=ea}if(v.length===0){v=a("<tr "+Q+" rowpos='"+ea+"'></tr>").addClass("FormData").attr("id","tr_"+H);a(v).append(aa);a(w).append(v);v[0].rp=ea}a("td:eq("+(ha-2)+")",v[0]).html(typeof Z.label==="undefined"?l.p.colNames[T]:
261
+ Z.label);a("td:eq("+(ha-1)+")",v[0]).append(Z.elmprefix).append(I).append(Z.elmsuffix);U[K]=T;K++}});if(K>0){S=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(q*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+l.p.id+"_id' value='"+g+"'/></td></tr>");S[0].rp=K+999;a(w).append(S);if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[l.p.id+"_id"]=g}return U}function x(g,l,w){var q,H=0,C,v,K,A,Q;if(d[c.p.id].checkOnSubmit||
262
+ d[c.p.id].checkOnUpdate){d[c.p.id]._savedData={};d[c.p.id]._savedData[l.p.id+"_id"]=g}var I=l.p.colModel;if(g=="_empty"){a(I).each(function(){q=this.name;K=a.extend({},this.editoptions||{});if((v=a("#"+a.jgrid.jqID(q),"#"+w))&&v.length&&v[0]!==null){A="";if(K.defaultValue){A=a.isFunction(K.defaultValue)?K.defaultValue():K.defaultValue;if(v[0].type=="checkbox"){Q=A.toLowerCase();if(Q.search(/(false|0|no|off|undefined)/i)<0&&Q!==""){v[0].checked=true;v[0].defaultChecked=true;v[0].value=A}else{v[0].checked=
263
+ false;v[0].defaultChecked=false}}else v.val(A)}else if(v[0].type=="checkbox"){v[0].checked=false;v[0].defaultChecked=false;A=a(v).attr("offval")}else if(v[0].type&&v[0].type.substr(0,6)=="select")v[0].selectedIndex=0;else v.val(A);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[q]=A}});a("#id_g","#"+w).val(g)}else{var U=a(l).jqGrid("getInd",g,true);if(U){a("td",U).each(function(M){q=I[M].name;if(q!=="cb"&&q!=="subgrid"&&q!=="rn"&&I[M].editable===true){if(q==l.p.ExpandColumn&&
264
+ l.p.treeGrid===true)C=a(this).text();else try{C=a.unformat(a(this),{rowId:g,colModel:I[M]},M)}catch(aa){C=I[M].edittype=="textarea"?a(this).text():a(this).html()}if(c.p.autoencode)C=a.jgrid.htmlDecode(C);if(d[c.p.id].checkOnSubmit===true||d[c.p.id].checkOnUpdate)d[c.p.id]._savedData[q]=C;q=a.jgrid.jqID(q);switch(I[M].edittype){case "password":case "text":case "button":case "image":case "textarea":if(C=="&nbsp;"||C=="&#160;"||C.length==1&&C.charCodeAt(0)==160)C="";a("#"+q,"#"+w).val(C);break;case "select":var S=
265
+ C.split(",");S=a.map(S,function(ga){return a.trim(ga)});a("#"+q+" option","#"+w).each(function(){this.selected=!I[M].editoptions.multiple&&(a.trim(C)==a.trim(a(this).text())||S[0]==a.trim(a(this).text())||S[0]==a.trim(a(this).val()))?true:I[M].editoptions.multiple?a.inArray(a.trim(a(this).text()),S)>-1||a.inArray(a.trim(a(this).val()),S)>-1?true:false:false});break;case "checkbox":C+="";if(I[M].editoptions&&I[M].editoptions.value)if(I[M].editoptions.value.split(":")[0]==C){a("#"+q,"#"+w)[c.p.useProp?
266
+ "prop":"attr"]("checked",true);a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("checked",false);a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("defaultChecked",false)}else{C=C.toLowerCase();if(C.search(/(false|0|no|off|undefined)/i)<0&&C!==""){a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("checked",true);a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+q,"#"+w)[c.p.useProp?"prop":"attr"]("checked",false);a("#"+q,"#"+
267
+ w)[c.p.useProp?"prop":"attr"]("defaultChecked",false)}}break;case "custom":try{if(I[M].editoptions&&a.isFunction(I[M].editoptions.custom_value))I[M].editoptions.custom_value(a("#"+q,"#"+w),"set",C);else throw"e1";}catch(T){T=="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,T.message,jQuery.jgrid.edit.bClose)}}H++}});H>0&&a("#id_g","#"+j).val(g)}}}function D(){var g,l=
268
+ [true,"",""],w={},q=c.p.prmNames,H,C,v,K;if(a.isFunction(d[c.p.id].beforeCheckValues)){var A=d[c.p.id].beforeCheckValues(h,a("#"+p),h[c.p.id+"_id"]=="_empty"?q.addoper:q.editoper);if(A&&typeof A==="object")h=A}for(v in h)if(h.hasOwnProperty(v)){l=a.jgrid.checkValues(h[v],v,c);if(l[0]===false)break}y();if(l[0]){if(a.isFunction(d[c.p.id].onclickSubmit))w=d[c.p.id].onclickSubmit(d[c.p.id],h)||{};if(a.isFunction(d[c.p.id].beforeSubmit))l=d[c.p.id].beforeSubmit(h,a("#"+p))}if(l[0]&&!d[c.p.id].processing){d[c.p.id].processing=
269
+ true;a("#sData","#"+j+"_2").addClass("ui-state-active");C=q.oper;H=q.id;h[C]=a.trim(h[c.p.id+"_id"])=="_empty"?q.addoper:q.editoper;if(h[C]!=q.addoper)h[H]=h[c.p.id+"_id"];else if(h[H]===undefined)h[H]=h[c.p.id+"_id"];delete h[c.p.id+"_id"];h=a.extend(h,d[c.p.id].editData,w);if(c.p.treeGrid===true){if(h[C]==q.addoper){K=a(c).jqGrid("getGridParam","selrow");h[c.p.treeGridModel=="adjacency"?c.p.treeReader.parent_id_field:"parent_id"]=K}for(i in c.p.treeReader){w=c.p.treeReader[i];if(h.hasOwnProperty(w))h[C]==
270
+ q.addoper&&i==="parent_id_field"||delete h[w]}}h[H]=a.jgrid.stripPref(c.p.idPrefix,h[H]);w=a.extend({url:d[c.p.id].url?d[c.p.id].url:a(c).jqGrid("getGridParam","editurl"),type:d[c.p.id].mtype,data:a.isFunction(d[c.p.id].serializeEditData)?d[c.p.id].serializeEditData(h):h,complete:function(Q,I){h[H]=c.p.idPrefix+h[H];if(I!="success"){l[0]=false;l[1]=a.isFunction(d[c.p.id].errorTextFormat)?d[c.p.id].errorTextFormat(Q):I+" Status: '"+Q.statusText+"'. Error code: "+Q.status}else if(a.isFunction(d[c.p.id].afterSubmit))l=
271
+ d[c.p.id].afterSubmit(Q,h);if(l[0]===false){a("#FormError>td","#"+j).html(l[1]);a("#FormError","#"+j).show()}else{a.each(c.p.colModel,function(){if(P[this.name]&&this.formatter&&this.formatter=="select")try{delete P[this.name]}catch(aa){}});h=a.extend(h,P);c.p.autoencode&&a.each(h,function(aa,S){h[aa]=a.jgrid.htmlDecode(S)});if(h[C]==q.addoper){l[2]||(l[2]=a.jgrid.randId());h[H]=l[2];if(d[c.p.id].closeAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else if(c.p.treeGrid===true)a(c).jqGrid("addChildNode",
272
+ l[2],K,h);else{a(c).jqGrid("addRowData",l[2],h,b.addedrow);a(c).jqGrid("setSelection",l[2])}a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}else if(d[c.p.id].clearAfterAdd){if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else c.p.treeGrid===true?a(c).jqGrid("addChildNode",l[2],K,h):a(c).jqGrid("addRowData",l[2],h,b.addedrow);x("_empty",c,p)}else if(d[c.p.id].reloadAfterSubmit)a(c).trigger("reloadGrid");else c.p.treeGrid===true?a(c).jqGrid("addChildNode",
273
+ l[2],K,h):a(c).jqGrid("addRowData",l[2],h,b.addedrow)}else{if(d[c.p.id].reloadAfterSubmit){a(c).trigger("reloadGrid");d[c.p.id].closeAfterEdit||setTimeout(function(){a(c).jqGrid("setSelection",h[H])},1E3)}else c.p.treeGrid===true?a(c).jqGrid("setTreeRow",h[H],h):a(c).jqGrid("setRowData",h[H],h);d[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}if(a.isFunction(d[c.p.id].afterComplete)){g=Q;setTimeout(function(){d[c.p.id].afterComplete(g,
274
+ h,a("#"+p));g=null},500)}if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){a("#"+p).data("disabled",false);if(d[c.p.id]._savedData[c.p.id+"_id"]!="_empty")for(var U in d[c.p.id]._savedData)if(h[U])d[c.p.id]._savedData[U]=h[U]}}d[c.p.id].processing=false;a("#sData","#"+j+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+p)[0].focus()}catch(M){}}},a.jgrid.ajaxOptions,d[c.p.id].ajaxEditOptions);if(!w.url&&!d[c.p.id].useDataProxy)if(a.isFunction(c.p.dataProxy))d[c.p.id].useDataProxy=
275
+ true;else{l[0]=false;l[1]+=" "+a.jgrid.errors.nourl}if(l[0])if(d[c.p.id].useDataProxy){v=c.p.dataProxy.call(c,w,"set_"+c.p.id);if(typeof v=="undefined")v=[true,""];if(v[0]===false){l[0]=false;l[1]=v[1]||"Error deleting the selected row!"}else{w.data.oper==q.addoper&&d[c.p.id].closeAfterAdd&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});w.data.oper==q.editoper&&d[c.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose})}}else a.ajax(w)}if(l[0]===
276
+ false){a("#FormError>td","#"+j).html(l[1]);a("#FormError","#"+j).show()}}function F(g,l){var w=false,q;for(q in g)if(g[q]!=l[q]){w=true;break}return w}function y(){a.each(c.p.colModel,function(g,l){if(l.editoptions&&l.editoptions.NullIfEmpty===true)if(h.hasOwnProperty(l.name)&&h[l.name]=="")h[l.name]="null"})}function o(){var g=true;a("#FormError","#"+j).hide();if(d[c.p.id].checkOnUpdate){h={};P={};e();O=a.extend({},h,P);if(V=F(O,d[c.p.id]._savedData)){a("#"+p).data("disabled",true);a(".confirm",
277
+ "#"+n.themodal).show();g=false}}return g}function k(){if(f!=="_empty"&&typeof c.p.savedRow!=="undefined"&&c.p.savedRow.length>0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var g=0;g<c.p.savedRow.length;g++)if(c.p.savedRow[g].id==f){a(c).jqGrid("restoreRow",f);break}}function s(g,l){g===0?a("#pData","#"+j+"_2").addClass("ui-state-disabled"):a("#pData","#"+j+"_2").removeClass("ui-state-disabled");g==l?a("#nData","#"+j+"_2").addClass("ui-state-disabled"):a("#nData","#"+j+"_2").removeClass("ui-state-disabled")}
278
+ function N(){var g=a(c).jqGrid("getDataIDs"),l=a("#id_g","#"+j).val();return[a.inArray(l,g),g]}var c=this;if(c.grid&&f){var t=c.p.id,p="FrmGrid_"+t,j="TblGrid_"+t,n={themodal:"editmod"+t,modalhead:"edithd"+t,modalcontent:"editcnt"+t,scrollelm:p},G=a.isFunction(d[c.p.id].beforeShowForm)?d[c.p.id].beforeShowForm:false,J=a.isFunction(d[c.p.id].afterShowForm)?d[c.p.id].afterShowForm:false,u=a.isFunction(d[c.p.id].beforeInitData)?d[c.p.id].beforeInitData:false,E=a.isFunction(d[c.p.id].onInitializeForm)?
279
+ d[c.p.id].onInitializeForm:false,B=true,m=1,z=0,h,P,O,V;if(f==="new"){f="_empty";b.caption=d[c.p.id].addCaption}else b.caption=d[c.p.id].editCaption;b.recreateForm===true&&a("#"+n.themodal).html()!==null&&a("#"+n.themodal).remove();var R=true;if(b.checkOnUpdate&&b.jqModal&&!b.modal)R=false;if(a("#"+n.themodal).html()!==null){if(u){B=u(a("#"+p));if(typeof B=="undefined")B=true}if(B===false)return;k();a(".ui-jqdialog-title","#"+n.modalhead).html(b.caption);a("#FormError","#"+j).hide();if(d[c.p.id].topinfo){a(".topinfo",
280
+ "#"+j).html(d[c.p.id].topinfo);a(".tinfo","#"+j).show()}else a(".tinfo","#"+j).hide();if(d[c.p.id].bottominfo){a(".bottominfo","#"+j+"_2").html(d[c.p.id].bottominfo);a(".binfo","#"+j+"_2").show()}else a(".binfo","#"+j+"_2").hide();x(f,c,p);f=="_empty"||!d[c.p.id].viewPagerButtons?a("#pData, #nData","#"+j+"_2").hide():a("#pData, #nData","#"+j+"_2").show();if(d[c.p.id].processing===true){d[c.p.id].processing=false;a("#sData","#"+j+"_2").removeClass("ui-state-active")}if(a("#"+p).data("disabled")===
281
+ true){a(".confirm","#"+n.themodal).hide();a("#"+p).data("disabled",false)}G&&G(a("#"+p));a("#"+n.themodal).data("onClose",d[c.p.id].onClose);a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+t,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});R||a(".jqmOverlay").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false});J&&J(a("#"+p))}else{var L=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";L=a("<form name='FormPost' id='"+
282
+ p+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+L+";'></form>").data("disabled",false);var W=a("<table id='"+j+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");if(u){B=u(a("#"+p));if(typeof B=="undefined")B=true}if(B===false)return;k();a(c.p.colModel).each(function(){var g=this.formoptions;m=Math.max(m,g?g.colpos||0:0);z=Math.max(z,g?g.rowpos||0:0)});a(L).append(W);u=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+
283
+ m*2+"'></td></tr>");u[0].rp=0;a(W).append(u);u=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+m*2+"'>"+d[c.p.id].topinfo+"</td></tr>");u[0].rp=0;a(W).append(u);B=(u=c.p.direction=="rtl"?true:false)?"nData":"pData";var X=u?"pData":"nData";r(f,c,W,m);B="<a href='javascript:void(0)' id='"+B+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";X="<a href='javascript:void(0)' id='"+X+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";
284
+ var ba="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>",$="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>";B="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+j+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(u?X+B:B+X)+"</td><td class='EditButton'>"+ba+$+"</td></tr>";
285
+ B+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+d[c.p.id].bottominfo+"</td></tr>";B+="</tbody></table>";if(z>0){var ca=[],da={};a.each(a(W)[0].rows,function(g,l){ca[g]=l});ca.sort(function(g,l){if(g.rp>l.rp)return 1;if(g.rp<l.rp)return-1;return 0});a.each(ca,function(g,l){da.html+=l});a("tbody",W).append(da.html)}b.gbox="#gbox_"+t;var fa=false;if(b.closeOnEscape===true){b.closeOnEscape=false;fa=true}L=a("<span></span>").append(L).append(B);a.jgrid.createModal(n,L,b,
286
+ "#gview_"+c.p.id,a("#gbox_"+c.p.id)[0]);if(u){a("#pData, #nData","#"+j+"_2").css("float","right");a(".EditButton","#"+j+"_2").css("text-align","left")}d[c.p.id].topinfo&&a(".tinfo","#"+j).show();d[c.p.id].bottominfo&&a(".binfo","#"+j+"_2").show();B=L=null;a("#"+n.themodal).keydown(function(g){var l=g.target;if(a("#"+p).data("disabled")===true)return false;if(d[c.p.id].savekey[0]===true&&g.which==d[c.p.id].savekey[1])if(l.tagName!="TEXTAREA"){a("#sData","#"+j+"_2").trigger("click");return false}if(g.which===
287
+ 27){if(!o())return false;fa&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false}if(d[c.p.id].navkeys[0]===true){if(a("#id_g","#"+j).val()=="_empty")return true;if(g.which==d[c.p.id].navkeys[1]){a("#pData","#"+j+"_2").trigger("click");return false}if(g.which==d[c.p.id].navkeys[2]){a("#nData","#"+j+"_2").trigger("click");return false}}});if(b.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span","#"+n.themodal).removeClass("jqmClose");a("a.ui-jqdialog-titlebar-close",
288
+ "#"+n.themodal).unbind("click").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false})}b.saveicon=a.extend([true,"left","ui-icon-disk"],b.saveicon);b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.saveicon[0]===true)a("#sData","#"+j+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");if(b.closeicon[0]===
289
+ true)a("#cData","#"+j+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");if(d[c.p.id].checkOnSubmit||d[c.p.id].checkOnUpdate){ba="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bYes+"</a>";X="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bNo+"</a>";$="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
290
+ b.bExit+"</a>";L=b.zIndex||999;L++;a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+L+";display:none;'>&#160;"+(a.browser.msie&&a.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(L+1)+"'>"+b.saveData+"<br/><br/>"+ba+X+$+"</div>").insertAfter("#"+p);a("#sNew","#"+n.themodal).click(function(){D();a("#"+
291
+ p).data("disabled",false);a(".confirm","#"+n.themodal).hide();return false});a("#nNew","#"+n.themodal).click(function(){a(".confirm","#"+n.themodal).hide();a("#"+p).data("disabled",false);setTimeout(function(){a(":input","#"+p)[0].focus()},0);return false});a("#cNew","#"+n.themodal).click(function(){a(".confirm","#"+n.themodal).hide();a("#"+p).data("disabled",false);a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false})}E&&E(a("#"+p));f=="_empty"||
292
+ !d[c.p.id].viewPagerButtons?a("#pData,#nData","#"+j+"_2").hide():a("#pData,#nData","#"+j+"_2").show();G&&G(a("#"+p));a("#"+n.themodal).data("onClose",d[c.p.id].onClose);a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+t,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});R||a(".jqmOverlay").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});return false});J&&J(a("#"+p));a(".fm-button","#"+n.themodal).hover(function(){a(this).addClass("ui-state-hover")},
293
+ function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+j+"_2").click(function(){h={};P={};a("#FormError","#"+j).hide();e();if(h[c.p.id+"_id"]=="_empty")D();else if(b.checkOnSubmit===true){O=a.extend({},h,P);if(V=F(O,d[c.p.id]._savedData)){a("#"+p).data("disabled",true);a(".confirm","#"+n.themodal).show()}else D()}else D();return false});a("#cData","#"+j+"_2").click(function(){if(!o())return false;a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+t,jqm:b.jqModal,onClose:d[c.p.id].onClose});
294
+ return false});a("#nData","#"+j+"_2").click(function(){if(!o())return false;a("#FormError","#"+j).hide();var g=N();g[0]=parseInt(g[0],10);if(g[0]!=-1&&g[1][g[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+p),g[1][g[0]]);x(g[1][g[0]+1],c,p);a(c).jqGrid("setSelection",g[1][g[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+p),g[1][g[0]+1]);s(g[0]+1,g[1].length-1)}return false});a("#pData","#"+j+"_2").click(function(){if(!o())return false;a("#FormError",
295
+ "#"+j).hide();var g=N();if(g[0]!=-1&&g[1][g[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+p),g[1][g[0]]);x(g[1][g[0]-1],c,p);a(c).jqGrid("setSelection",g[1][g[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+p),g[1][g[0]-1]);s(g[0]-1,g[1].length-1)}return false})}G=N();s(G[0],G[1].length-1)}})},viewGridRow:function(f,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,jqModal:true,
296
+ closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:true},a.jgrid.view,b||{});return this.each(function(){function e(){if(b.closeOnEscape===true||b.navkeys[0]===true)setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+N.modalhead).focus()},0)}function r(m,z,h,P){for(var O,V,R,L=0,W,X,ba=[],$=false,ca="<td class='CaptionTD form-view-label ui-widget-content' width='"+b.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",
297
+ da="",fa=["integer","number","currency"],g=0,l=0,w,q,H,C=1;C<=P;C++)da+=C==1?ca:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(z.p.colModel).each(function(){V=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!V&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,fa)!==-1)g=Math.max(g,parseInt(this.width,10));else l=Math.max(l,parseInt(this.width,10))});w=g!==
298
+ 0?g:l!==0?l:0;$=a(z).jqGrid("getInd",m);a(z.p.colModel).each(function(v){O=this.name;q=false;X=(V=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";H=typeof this.viewable!="boolean"?true:this.viewable;if(O!=="cb"&&O!=="subgrid"&&O!=="rn"&&H){W=$===false?"":O==z.p.ExpandColumn&&z.p.treeGrid===true?a("td:eq("+v+")",z.rows[$]).text():a("td:eq("+v+")",z.rows[$]).html();q=this.align==="right"&&w!==0?true:false;a.extend({},this.editoptions||
299
+ {},{id:O,name:O});var K=a.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),A=parseInt(K.rowpos,10)||L+1,Q=parseInt((parseInt(K.colpos,10)||1)*2,10);if(K.rowabove){var I=a("<tr><td class='contentinfo' colspan='"+P*2+"'>"+K.rowcontent+"</td></tr>");a(h).append(I);I[0].rp=A}R=a(h).find("tr[rowpos="+A+"]");if(R.length===0){R=a("<tr "+X+" rowpos='"+A+"'></tr>").addClass("FormData").attr("id","trv_"+O);a(R).append(da);a(h).append(R);R[0].rp=A}a("td:eq("+(Q-2)+")",R[0]).html("<b>"+(typeof K.label===
300
+ "undefined"?z.p.colNames[v]:K.label)+"</b>");a("td:eq("+(Q-1)+")",R[0]).append("<span>"+W+"</span>").attr("id","v_"+O);q&&a("td:eq("+(Q-1)+") span",R[0]).css({"text-align":"right",width:w+"px"});ba[L]=v;L++}});if(L>0){m=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(P*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+m+"'/></td></tr>");m[0].rp=L+99;a(h).append(m)}return ba}function x(m,z){var h,P,O=0,V,R;if(R=a(z).jqGrid("getInd",
301
+ m,true)){a("td",R).each(function(L){h=z.p.colModel[L].name;P=z.p.colModel[L].editrules&&z.p.colModel[L].editrules.edithidden===true?false:z.p.colModel[L].hidden===true?true:false;if(h!=="cb"&&h!=="subgrid"&&h!=="rn"){V=h==z.p.ExpandColumn&&z.p.treeGrid===true?a(this).text():a(this).html();a.extend({},z.p.colModel[L].editoptions||{});h=a.jgrid.jqID("v_"+h);a("#"+h+" span","#"+s).html(V);P&&a("#"+h,"#"+s).parents("tr:first").hide();O++}});O>0&&a("#id_g","#"+s).val(m)}}function D(m,z){m===0?a("#pData",
302
+ "#"+s+"_2").addClass("ui-state-disabled"):a("#pData","#"+s+"_2").removeClass("ui-state-disabled");m==z?a("#nData","#"+s+"_2").addClass("ui-state-disabled"):a("#nData","#"+s+"_2").removeClass("ui-state-disabled")}function F(){var m=a(y).jqGrid("getDataIDs"),z=a("#id_g","#"+s).val();return[a.inArray(z,m),m]}var y=this;if(y.grid&&f){var o=y.p.id,k="ViewGrid_"+o,s="ViewTbl_"+o,N={themodal:"viewmod"+o,modalhead:"viewhd"+o,modalcontent:"viewcnt"+o,scrollelm:k},c=a.isFunction(b.beforeInitData)?b.beforeInitData:
303
+ false,t=true,p=1,j=0;if(a("#"+N.themodal).html()!==null){if(c){t=c(a("#"+k));if(typeof t=="undefined")t=true}if(t===false)return;a(".ui-jqdialog-title","#"+N.modalhead).html(b.caption);a("#FormError","#"+s).hide();x(f,y);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+N.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});e()}else{var n=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";n=a("<form name='FormPost' id='"+k+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+
304
+ n+";'></form>");var G=a("<table id='"+s+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");if(c){t=c(a("#"+k));if(typeof t=="undefined")t=true}if(t===false)return;a(y.p.colModel).each(function(){var m=this.formoptions;p=Math.max(p,m?m.colpos||0:0);j=Math.max(j,m?m.rowpos||0:0)});a(n).append(G);r(f,y,G,p);c=y.p.direction=="rtl"?true:false;t="<a href='javascript:void(0)' id='"+(c?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";
305
+ var J="<a href='javascript:void(0)' id='"+(c?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",u="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bClose+"</a>";if(j>0){var E=[];a.each(a(G)[0].rows,function(m,z){E[m]=z});E.sort(function(m,z){if(m.rp>z.rp)return 1;if(m.rp<z.rp)return-1;return 0});a.each(E,function(m,z){a("tbody",G).append(z)})}b.gbox="#gbox_"+o;var B=false;if(b.closeOnEscape===
306
+ true){b.closeOnEscape=false;B=true}n=a("<span></span>").append(n).append("<table border='0' class='EditTable' id='"+s+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+b.labelswidth+"'>"+(c?J+t:t+J)+"</td><td class='EditButton'>"+u+"</td></tr></tbody></table>");a.jgrid.createModal(N,n,b,"#gview_"+y.p.id,a("#gview_"+y.p.id)[0]);if(c){a("#pData, #nData","#"+s+"_2").css("float","right");a(".EditButton","#"+s+"_2").css("text-align","left")}b.viewPagerButtons||a("#pData, #nData","#"+s+"_2").hide();
307
+ n=null;a("#"+N.themodal).keydown(function(m){if(m.which===27){B&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(m.which===b.navkeys[1]){a("#pData","#"+s+"_2").trigger("click");return false}if(m.which===b.navkeys[2]){a("#nData","#"+s+"_2").trigger("click");return false}}});b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.closeicon[0]===true)a("#cData","#"+s+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":
308
+ "fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+N.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+s+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});e();a("#cData","#"+s+"_2").click(function(){a.jgrid.hideModal("#"+N.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:b.onClose});
309
+ return false});a("#nData","#"+s+"_2").click(function(){a("#FormError","#"+s).hide();var m=F();m[0]=parseInt(m[0],10);if(m[0]!=-1&&m[1][m[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+k),m[1][m[0]]);x(m[1][m[0]+1],y);a(y).jqGrid("setSelection",m[1][m[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+k),m[1][m[0]+1]);D(m[0]+1,m[1].length-1)}e();return false});a("#pData","#"+s+"_2").click(function(){a("#FormError","#"+s).hide();var m=F();if(m[0]!=
310
+ -1&&m[1][m[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+k),m[1][m[0]]);x(m[1][m[0]-1],y);a(y).jqGrid("setSelection",m[1][m[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+k),m[1][m[0]-1]);D(m[0]-1,m[1].length-1)}e();return false})}n=F();D(n[0],n[1].length-1)}})},delGridRow:function(f,b){b=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,
311
+ beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:true,closeOnEscape:false,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:false,serializeDelData:null,useDataProxy:false},a.jgrid.del,b||{});d[a(this)[0].p.id]=b;return this.each(function(){var e=this;if(e.grid)if(f){var r=a.isFunction(d[e.p.id].beforeShowForm),x=a.isFunction(d[e.p.id].afterShowForm),D=a.isFunction(d[e.p.id].beforeInitData)?d[e.p.id].beforeInitData:
312
+ false,F=e.p.id,y={},o=true,k="DelTbl_"+F,s,N,c,t,p={themodal:"delmod"+F,modalhead:"delhd"+F,modalcontent:"delcnt"+F,scrollelm:k};if(jQuery.isArray(f))f=f.join();if(a("#"+p.themodal).html()!==null){if(D){o=D(a("#"+k));if(typeof o=="undefined")o=true}if(o===false)return;a("#DelData>td","#"+k).text(f);a("#DelError","#"+k).hide();if(d[e.p.id].processing===true){d[e.p.id].processing=false;a("#dData","#"+k).removeClass("ui-state-active")}r&&d[e.p.id].beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+p.themodal,
313
+ {gbox:"#gbox_"+F,jqm:d[e.p.id].jqModal,jqM:false,overlay:d[e.p.id].overlay,modal:d[e.p.id].modal})}else{var j=isNaN(d[e.p.id].dataheight)?d[e.p.id].dataheight:d[e.p.id].dataheight+"px";j="<div id='"+k+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+j+";'>";j+="<table class='DelTable'><tbody>";j+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";j+="<tr id='DelData' style='display:none'><td >"+f+"</td></tr>";j+='<tr><td class="delmsg" style="white-space:pre;">'+
314
+ d[e.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>";j+="</tbody></table></div>";j+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+k+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+
315
+ "</a>")+"</td></tr></tbody></table>";b.gbox="#gbox_"+F;a.jgrid.createModal(p,j,b,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);if(D){o=D(a("#"+k));if(typeof o=="undefined")o=true}if(o===false)return;a(".fm-button","#"+k+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});b.delicon=a.extend([true,"left","ui-icon-scissors"],d[e.p.id].delicon);b.cancelicon=a.extend([true,"left","ui-icon-cancel"],d[e.p.id].cancelicon);if(b.delicon[0]===true)a("#dData",
316
+ "#"+k+"_2").addClass(b.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.delicon[2]+"'></span>");if(b.cancelicon[0]===true)a("#eData","#"+k+"_2").addClass(b.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.cancelicon[2]+"'></span>");a("#dData","#"+k+"_2").click(function(){var n=[true,""];y={};var G=a("#DelData>td","#"+k).text();if(a.isFunction(d[e.p.id].onclickSubmit))y=d[e.p.id].onclickSubmit(d[e.p.id],
317
+ G)||{};if(a.isFunction(d[e.p.id].beforeSubmit))n=d[e.p.id].beforeSubmit(G);if(n[0]&&!d[e.p.id].processing){d[e.p.id].processing=true;a(this).addClass("ui-state-active");c=e.p.prmNames;s=a.extend({},d[e.p.id].delData,y);t=c.oper;s[t]=c.deloper;N=c.id;G=G.split(",");for(var J in G)if(G.hasOwnProperty(J))G[J]=a.jgrid.stripPref(e.p.idPrefix,G[J]);s[N]=G.join();J=a.extend({url:d[e.p.id].url?d[e.p.id].url:a(e).jqGrid("getGridParam","editurl"),type:d[e.p.id].mtype,data:a.isFunction(d[e.p.id].serializeDelData)?
318
+ d[e.p.id].serializeDelData(s):s,complete:function(u,E){if(E!="success"){n[0]=false;n[1]=a.isFunction(d[e.p.id].errorTextFormat)?d[e.p.id].errorTextFormat(u):E+" Status: '"+u.statusText+"'. Error code: "+u.status}else if(a.isFunction(d[e.p.id].afterSubmit))n=d[e.p.id].afterSubmit(u,s);if(n[0]===false){a("#DelError>td","#"+k).html(n[1]);a("#DelError","#"+k).show()}else{if(d[e.p.id].reloadAfterSubmit&&e.p.datatype!="local")a(e).trigger("reloadGrid");else{var B=[];B=G.split(",");if(e.p.treeGrid===true)try{a(e).jqGrid("delTreeNode",
319
+ e.p.idPrefix+B[0])}catch(m){}else for(var z=0;z<B.length;z++)a(e).jqGrid("delRowData",e.p.idPrefix+B[z]);e.p.selrow=null;e.p.selarrrow=[]}a.isFunction(d[e.p.id].afterComplete)&&setTimeout(function(){d[e.p.id].afterComplete(u,G)},500)}d[e.p.id].processing=false;a("#dData","#"+k+"_2").removeClass("ui-state-active");n[0]&&a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+F,jqm:b.jqModal,onClose:d[e.p.id].onClose})}},a.jgrid.ajaxOptions,d[e.p.id].ajaxDelOptions);if(!J.url&&!d[e.p.id].useDataProxy)if(a.isFunction(e.p.dataProxy))d[e.p.id].useDataProxy=
320
+ true;else{n[0]=false;n[1]+=" "+a.jgrid.errors.nourl}if(n[0])if(d[e.p.id].useDataProxy){J=e.p.dataProxy.call(e,J,"del_"+e.p.id);if(typeof J=="undefined")J=[true,""];if(J[0]===false){n[0]=false;n[1]=J[1]||"Error deleting the selected row!"}else a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+F,jqm:b.jqModal,onClose:d[e.p.id].onClose})}else a.ajax(J)}if(n[0]===false){a("#DelError>td","#"+k).html(n[1]);a("#DelError","#"+k).show()}return false});a("#eData","#"+k+"_2").click(function(){a.jgrid.hideModal("#"+
321
+ p.themodal,{gb:"#gbox_"+F,jqm:d[e.p.id].jqModal,onClose:d[e.p.id].onClose});return false});r&&d[e.p.id].beforeShowForm(a("#"+k));a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+F,jqm:d[e.p.id].jqModal,overlay:d[e.p.id].overlay,modal:d[e.p.id].modal})}x&&d[e.p.id].afterShowForm(a("#"+k));d[e.p.id].closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+p.modalhead).focus()},0)}})},navGrid:function(f,b,e,r,x,D,F){b=a.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",
322
+ del:true,delicon:"ui-icon-trash",search:true,searchicon:"ui-icon-search",refresh:true,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:false,viewicon:"ui-icon-document",position:"left",closeOnEscape:true,beforeRefresh:null,afterRefresh:null,cloneToTop:false,alertwidth:200,alertheight:"auto",alerttop:null,alertleft:null,alertzIndex:null},a.jgrid.nav,b||{});return this.each(function(){if(!this.nav){var y={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},o=this,k;if(!(!o.grid||
323
+ typeof f!="string")){if(a("#"+y.themodal).html()===null){if(!b.alerttop&&!b.alertleft){if(typeof window.innerWidth!="undefined"){b.alertleft=window.innerWidth;b.alerttop=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==0){b.alertleft=document.documentElement.clientWidth;b.alerttop=document.documentElement.clientHeight}else{b.alertleft=1024;b.alerttop=768}b.alertleft=b.alertleft/
324
+ 2-parseInt(b.alertwidth,10)/2;b.alerttop=b.alerttop/2-25}a.jgrid.createModal(y,"<div>"+b.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+o.p.id,jqModal:true,drag:true,resize:true,caption:b.alertcap,top:b.alerttop,left:b.alertleft,width:b.alertwidth,height:b.alertheight,closeOnEscape:b.closeOnEscape,zIndex:b.alertzIndex},"","",true)}var s=1;if(b.cloneToTop&&o.p.toppager)s=2;for(var N=0;N<s;N++){var c=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
325
+ t,p;if(N===0){t=f;p=o.p.id;if(t==o.p.toppager){p+="_top";s=1}}else{t=o.p.toppager;p=o.p.id+"_top"}o.p.direction=="rtl"&&a(c).attr("dir","rtl").css("float","right");if(b.add){r=r||{};k=a("<td class='ui-pg-button ui-corner-all'></td>");a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.addicon+"'></span>"+b.addtext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.addtitle||"",id:r.id||"add_"+p}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(b.addfunc)?b.addfunc():
326
+ a(o).jqGrid("editGridRow","new",r));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.edit){k=a("<td class='ui-pg-button ui-corner-all'></td>");e=e||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.editicon+"'></span>"+b.edittext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.edittitle||"",id:e.id||"edit_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var j=
327
+ o.p.selrow;if(j)a.isFunction(b.editfunc)?b.editfunc(j):a(o).jqGrid("editGridRow",j,e);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.view){k=a("<td class='ui-pg-button ui-corner-all'></td>");F=F||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.viewicon+"'></span>"+b.viewtext+
328
+ "</div>");a("tr",c).append(k);a(k,c).attr({title:b.viewtitle||"",id:F.id||"view_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var j=o.p.selrow;if(j)a.isFunction(b.viewfunc)?b.viewfunc(j):a(o).jqGrid("viewGridRow",j,F);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.del){k=
329
+ a("<td class='ui-pg-button ui-corner-all'></td>");x=x||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.delicon+"'></span>"+b.deltext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.deltitle||"",id:x.id||"del_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var j;if(o.p.multiselect){j=o.p.selarrrow;if(j.length===0)j=null}else j=o.p.selrow;if(j)"function"==typeof b.delfunc?b.delfunc(j):a(o).jqGrid("delGridRow",j,x);else{a.jgrid.viewModal("#"+y.themodal,{gbox:"#gbox_"+
330
+ o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}if(b.add||b.edit||b.del||b.view)a("tr",c).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");if(b.search){k=a("<td class='ui-pg-button ui-corner-all'></td>");D=D||{};a(k).append("<div class='ui-pg-div'><span class='ui-icon "+b.searchicon+
331
+ "'></span>"+b.searchtext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.searchtitle||"",id:D.id||"search_"+p}).click(function(){a(this).hasClass("ui-state-disabled")||a(o).jqGrid("searchGrid",D);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});D.showOnLoad&&D.showOnLoad===true&&a(k,c).click();k=null}if(b.refresh){k=a("<td class='ui-pg-button ui-corner-all'></td>");a(k).append("<div class='ui-pg-div'><span class='ui-icon "+
332
+ b.refreshicon+"'></span>"+b.refreshtext+"</div>");a("tr",c).append(k);a(k,c).attr({title:b.refreshtitle||"",id:"refresh_"+p}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&b.beforeRefresh();o.p.search=false;try{var j=o.p.id;o.p.postData.filters="";a("#fbox_"+j).jqFilter("resetFilter");a.isFunction(o.clearToolbar)&&o.clearToolbar(false)}catch(n){}switch(b.refreshstate){case "firstpage":a(o).trigger("reloadGrid",[{page:1}]);break;case "current":a(o).trigger("reloadGrid",
333
+ [{current:true}])}a.isFunction(b.afterRefresh)&&b.afterRefresh()}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});k=null}k=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+k+";visibility:hidden;' ></div>");k=a(c).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(t+"_"+b.position,t).append(c);
334
+ if(o.p._nvtd){if(k>o.p._nvtd[0]){a(t+"_"+b.position,t).width(k);o.p._nvtd[0]=k}o.p._nvtd[1]=k}c=k=k=null;this.nav=true}}}})},navButtonAdd:function(f,b){b=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},b||{});return this.each(function(){if(this.grid){if(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0],r=this;if(e)if(!(b.id&&a("#"+b.id,e).html()!==null)){var x=a("<td></td>");b.buttonicon.toString().toUpperCase()=="NONE"?a(x).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+
335
+ b.caption+"</div>"):a(x).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+b.buttonicon+"'></span>"+b.caption+"</div>");b.id&&a(x).attr("id",b.id);if(b.position=="first")e.rows[0].cells.length===0?a("tr",e).append(x):a("tr td:eq(0)",e).before(x);else a("tr",e).append(x);a(x,e).attr("title",b.title||"").click(function(D){a(this).hasClass("ui-state-disabled")||a.isFunction(b.onClickButton)&&b.onClickButton.call(r,D);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||
336
+ a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(f,b){b=a.extend({sepclass:"ui-separator",sepcontent:""},b||{});return this.each(function(){if(this.grid){if(f.indexOf("#")!==0)f="#"+f;var e=a(".navtable",f)[0];if(e){var r="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+b.sepclass+"'></span>"+b.sepcontent+"</td>";a("tr",e).append(r)}}})},GridToForm:function(f,b){return this.each(function(){var e=this;
337
+ if(e.grid){var r=a(e).jqGrid("getRowData",f);if(r)for(var x in r)a("[name="+a.jgrid.jqID(x)+"]",b).is("input:radio")||a("[name="+a.jgrid.jqID(x)+"]",b).is("input:checkbox")?a("[name="+a.jgrid.jqID(x)+"]",b).each(function(){if(a(this).val()==r[x])a(this)[e.p.useProp?"prop":"attr"]("checked",true);else a(this)[e.p.useProp?"prop":"attr"]("checked",false)}):a("[name="+a.jgrid.jqID(x)+"]",b).val(r[x])}})},FormToGrid:function(f,b,e,r){return this.each(function(){if(this.grid){e||(e="set");r||(r="first");
338
+ var x=a(b).serializeArray(),D={};a.each(x,function(F,y){D[y.name]=y.value});if(e=="add")a(this).jqGrid("addRowData",f,D,r);else e=="set"&&a(this).jqGrid("setRowData",f,D)}})}})})(jQuery);
339
+ (function(c){c.fn.jqFilter=function(k){if(typeof k==="string"){var w=c.fn.jqFilter[k];if(!w)throw"jqFilter - No such method: "+k;var B=c.makeArray(arguments).slice(1);return w.apply(this,B)}var o=c.extend(true,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:false,errmsg:"",errorcheck:true,showQuery:true,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal",
340
+ operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc",
341
+ description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:["AND","OR"],groupButton:true,ruleButtons:true,direction:"ltr"},k||{});return this.each(function(){if(!this.filter){this.p=o;if(this.p.filter===null||this.p.filter===undefined)this.p.filter=
342
+ {groupOp:this.p.groupOps[0],rules:[],groups:[]};var q,x=this.p.columns.length,j,y=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(q=0;q<this.p._gridsopt.length;q++)this.p.ops[q].description=this.p._gridsopt[q];this.p.initFilter=c.extend(true,{},this.p.filter);if(x){for(q=0;q<x;q++){j=this.p.columns[q];if(j.stype)j.inputtype=j.stype;else if(!j.inputtype)j.inputtype="text";if(j.sorttype)j.searchtype=j.sorttype;else if(!j.searchtype)j.searchtype="string";if(j.hidden===
343
+ undefined)j.hidden=false;if(!j.label)j.label=j.name;if(j.index)j.name=j.index;if(!j.hasOwnProperty("searchoptions"))j.searchoptions={};if(!j.hasOwnProperty("searchrules"))j.searchrules={}}this.p.showQuery&&c(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 z=function(d,g){var a=[true,""];if(c.isFunction(g.searchrules))a=g.searchrules(d,
344
+ g);else if(c.jgrid&&c.jgrid.checkValues)try{a=c.jgrid.checkValues(d,-1,null,g.searchrules,g.label)}catch(b){}if(a&&a.length&&a[0]===false){o.error=!a[0];o.errmsg=a[1]}};this.onchange=function(){this.p.error=false;this.p.errmsg="";return c.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):false};this.reDraw=function(){c("table.group:first",this).remove();var d=this.createTableForGroup(o.filter,null);c(this).append(d);c.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this,this.p)};
345
+ this.createTableForGroup=function(d,g){var a=this,b,e=c("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),i="left";if(this.p.direction=="rtl"){i="right";e.attr("dir","rtl")}g===null&&e.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+i+"'></th></tr>");var f=c("<tr></tr>");e.append(f);i=c("<th colspan='5' align='"+i+"'></th>");f.append(i);if(this.p.ruleButtons===true){var h=c("<select class='opsel'></select>");
346
+ i.append(h);f="";var l;for(b=0;b<o.groupOps.length;b++){l=d.groupOp===a.p.groupOps[b]?" selected='selected'":"";f+="<option value='"+a.p.groupOps[b]+"'"+l+">"+a.p.groupOps[b]+"</option>"}h.append(f).bind("change",function(){d.groupOp=c(h).val();a.onchange()})}f="<span></span>";if(this.p.groupButton){f=c("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");f.bind("click",function(){if(d.groups===undefined)d.groups=[];d.groups.push({groupOp:o.groupOps[0],rules:[],groups:[]});
347
+ a.reDraw();a.onchange();return false})}i.append(f);if(this.p.ruleButtons===true){f=c("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>");var m;f.bind("click",function(){if(d.rules===undefined)d.rules=[];for(b=0;b<a.p.columns.length;b++){var n=typeof a.p.columns[b].search==="undefined"?true:a.p.columns[b].search,s=a.p.columns[b].hidden===true;if(a.p.columns[b].searchoptions.searchhidden===true&&n||n&&!s){m=a.p.columns[b];break}}d.rules.push({field:m.name,op:(m.searchoptions.sopt?
348
+ m.searchoptions.sopt:a.p.sopt?a.p.sopt:m.searchtype==="string"?a.p.stropts:a.p.numopts)[0],data:""});a.reDraw();return false});i.append(f)}if(g!==null){f=c("<input type='button' value='-' title='Delete group' class='delete-group'/>");i.append(f);f.bind("click",function(){for(b=0;b<g.groups.length;b++)if(g.groups[b]===d){g.groups.splice(b,1);break}a.reDraw();a.onchange();return false})}if(d.groups!==undefined)for(b=0;b<d.groups.length;b++){i=c("<tr></tr>");e.append(i);f=c("<td class='first'></td>");
349
+ i.append(f);f=c("<td colspan='4'></td>");f.append(this.createTableForGroup(d.groups[b],d));i.append(f)}if(d.groupOp===undefined)d.groupOp=a.p.groupOps[0];if(d.rules!==undefined)for(b=0;b<d.rules.length;b++)e.append(this.createTableRowForRule(d.rules[b],d));return e};this.createTableRowForRule=function(d,g){var a=this,b=c("<tr></tr>"),e,i,f,h,l="",m;b.append("<td class='first'></td>");var n=c("<td class='columns'></td>");b.append(n);var s=c("<select></select>"),p,t=[];n.append(s);s.bind("change",function(){d.field=
350
+ c(s).val();f=c(this).parents("tr:first");for(e=0;e<a.p.columns.length;e++)if(a.p.columns[e].name===d.field){h=a.p.columns[e];break}if(h){h.searchoptions.id=c.jgrid.randId();if(y&&h.inputtype==="text")if(!h.searchoptions.size)h.searchoptions.size=10;var r=c.jgrid.createEl(h.inputtype,h.searchoptions,"",true,a.p.ajaxSelectOptions,true);c(r).addClass("input-elm");i=h.searchoptions.sopt?h.searchoptions.sopt:a.p.sopt?a.p.sopt:h.searchtype==="string"?a.p.stropts:a.p.numopts;var u="",A=0;t=[];c.each(a.p.ops,
351
+ function(){t.push(this.name)});for(e=0;e<i.length;e++){p=c.inArray(i[e],t);if(p!==-1){if(A===0)d.op=a.p.ops[p].name;u+="<option value='"+a.p.ops[p].name+"'>"+a.p.ops[p].description+"</option>";A++}}c(".selectopts",f).empty().append(u);c(".selectopts",f)[0].selectedIndex=0;if(c.browser.msie&&c.browser.version<9){u=parseInt(c("select.selectopts",f)[0].offsetWidth)+1;c(".selectopts",f).width(u);c(".selectopts",f).css("width","auto")}c(".data",f).empty().append(r);c(".input-elm",f).bind("change",function(){d.data=
352
+ c(this).val();a.onchange()});setTimeout(function(){d.data=c(r).val();a.onchange()},0)}});for(e=n=0;e<a.p.columns.length;e++){m=typeof a.p.columns[e].search==="undefined"?true:a.p.columns[e].search;var C=a.p.columns[e].hidden===true;if(a.p.columns[e].searchoptions.searchhidden===true&&m||m&&!C){m="";if(d.field===a.p.columns[e].name){m=" selected='selected'";n=e}l+="<option value='"+a.p.columns[e].name+"'"+m+">"+a.p.columns[e].label+"</option>"}}s.append(l);l=c("<td class='operators'></td>");b.append(l);
353
+ h=o.columns[n];h.searchoptions.id=c.jgrid.randId();if(y&&h.inputtype==="text")if(!h.searchoptions.size)h.searchoptions.size=10;n=c.jgrid.createEl(h.inputtype,h.searchoptions,d.data,true,a.p.ajaxSelectOptions,true);var v=c("<select class='selectopts'></select>");l.append(v);v.bind("change",function(){d.op=c(v).val();f=c(this).parents("tr:first");var r=c(".input-elm",f)[0];if(d.op==="nu"||d.op==="nn"){d.data="";r.value="";r.setAttribute("readonly","true");r.setAttribute("disabled","true")}else{r.removeAttribute("readonly");
354
+ r.removeAttribute("disabled")}a.onchange()});i=h.searchoptions.sopt?h.searchoptions.sopt:a.p.sopt?a.p.sopt:h.searchtype==="string"?o.stropts:a.p.numopts;l="";c.each(a.p.ops,function(){t.push(this.name)});for(e=0;e<i.length;e++){p=c.inArray(i[e],t);if(p!==-1){m=d.op===a.p.ops[p].name?" selected='selected'":"";l+="<option value='"+a.p.ops[p].name+"'"+m+">"+a.p.ops[p].description+"</option>"}}v.append(l);l=c("<td class='data'></td>");b.append(l);l.append(n);c(n).addClass("input-elm").bind("change",function(){d.data=
355
+ c(this).val();a.onchange()});l=c("<td></td>");b.append(l);if(this.p.ruleButtons===true){n=c("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");l.append(n);n.bind("click",function(){for(e=0;e<g.rules.length;e++)if(g.rules[e]===d){g.rules.splice(e,1);break}a.reDraw();a.onchange();return false})}return b};this.getStringForGroup=function(d){var g="(",a;if(d.groups!==undefined)for(a=0;a<d.groups.length;a++){if(g.length>1)g+=" "+d.groupOp+" ";try{g+=this.getStringForGroup(d.groups[a])}catch(b){alert(b)}}if(d.rules!==
356
+ undefined)try{for(a=0;a<d.rules.length;a++){if(g.length>1)g+=" "+d.groupOp+" ";g+=this.getStringForRule(d.rules[a])}}catch(e){alert(e)}g+=")";return g==="()"?"":g};this.getStringForRule=function(d){var g="",a="",b,e;for(b=0;b<this.p.ops.length;b++)if(this.p.ops[b].name===d.op){g=this.p.ops[b].operator;a=this.p.ops[b].name;break}for(b=0;b<this.p.columns.length;b++)if(this.p.columns[b].name===d.field){e=this.p.columns[b];break}b=d.data;if(a==="bw"||a==="bn")b+="%";if(a==="ew"||a==="en")b="%"+b;if(a===
357
+ "cn"||a==="nc")b="%"+b+"%";if(a==="in"||a==="ni")b=" ("+b+")";o.errorcheck&&z(d.data,e);return c.inArray(e.searchtype,["int","integer","float","number","currency"])!==-1||a==="nn"||a==="nu"?d.field+" "+g+" "+b:d.field+" "+g+' "'+b+'"'};this.resetFilter=function(){this.p.filter=c.extend(true,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){c("th.ui-state-error",this).html("");c("tr.error",this).hide()};this.showError=function(){c("th.ui-state-error",this).html(this.p.errmsg);
358
+ c("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(o.filter)};this.toString=function(){function d(a){var b="(",e;if(a.groups!==undefined)for(e=0;e<a.groups.length;e++){if(b.length>1)b+=a.groupOp==="OR"?" || ":" && ";b+=d(a.groups[e])}if(a.rules!==undefined)for(e=0;e<a.rules.length;e++){if(b.length>1)b+=a.groupOp==="OR"?" || ":" && ";var i=a.rules[e];if(g.p.errorcheck){var f=void 0,h=void 0;for(f=0;f<g.p.columns.length;f++)if(g.p.columns[f].name===i.field){h=
359
+ g.p.columns[f];break}h&&z(i.data,h)}b+=i.op+"(item."+i.field+",'"+i.data+"')"}b+=")";return b==="()"?"":b}var g=this;return d(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=true}}})};c.extend(c.fn.jqFilter,{toSQLString:function(){var k="";this.each(function(){k=this.toUserFriendlyString()});return k},filterData:function(){var k;this.each(function(){k=this.p.filter});return k},getParameter:function(k){if(k!==undefined)if(this.p.hasOwnProperty(k))return this.p[k];return this.p},
360
+ resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(k){if(typeof k==="string")k=jQuery.jgrid.parse(k);this.each(function(){this.p.filter=k;this.reDraw();this.onchange()})}})})(jQuery);
361
+ (function(a){a.jgrid.extend({editRow:function(g,x,m,s,u,y,v,l,t){var h={keys:x||false,oneditfunc:m||null,successfunc:s||null,url:u||null,extraparam:y||{},aftersavefunc:v||null,errorfunc:l||null,afterrestorefunc:t||null,restoreAfterError:true,mtype:"POST"},o=a.makeArray(arguments).slice(1),b;b=o[0]&&typeof o[0]=="object"&&!a.isFunction(o[0])?a.extend(h,o[0]):h;return this.each(function(){var d=this,c,j,q=0,r=null,p={},k,e;if(d.grid){k=a(d).jqGrid("getInd",g,true);if(k!==false)if((a(k).attr("editable")||
362
+ "0")=="0"&&!a(k).hasClass("not-editable-row")){e=d.p.colModel;a("td",k).each(function(f){c=e[f].name;var A=d.p.treeGrid===true&&c==d.p.ExpandColumn;if(A)j=a("span:first",this).html();else try{j=a.unformat(this,{rowId:g,colModel:e[f]},f)}catch(n){j=e[f].edittype&&e[f].edittype=="textarea"?a(this).text():a(this).html()}if(c!="cb"&&c!="subgrid"&&c!="rn"){if(d.p.autoencode)j=a.jgrid.htmlDecode(j);p[c]=j;if(e[f].editable===true){if(r===null)r=f;A?a("span:first",this).html(""):a(this).html("");var i=a.extend({},
363
+ e[f].editoptions||{},{id:g+"_"+c,name:c});if(!e[f].edittype)e[f].edittype="text";if(j=="&nbsp;"||j=="&#160;"||j.length==1&&j.charCodeAt(0)==160)j="";i=a.jgrid.createEl(e[f].edittype,i,j,true,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));a(i).addClass("editable");A?a("span:first",this).append(i):a(this).append(i);e[f].edittype=="select"&&typeof e[f].editoptions!=="undefined"&&e[f].editoptions.multiple===true&&typeof e[f].editoptions.dataUrl==="undefined"&&a.browser.msie&&a(i).width(a(i).width());
364
+ q++}}});if(q>0){p.id=g;d.p.savedRow.push(p);a(k).attr("editable","1");a("td:eq("+r+") input",k).focus();b.keys===true&&a(k).bind("keydown",function(f){f.keyCode===27&&a(d).jqGrid("restoreRow",g,t);if(f.keyCode===13){if(f.target.tagName=="TEXTAREA")return true;a(d).jqGrid("saveRow",g,b);return false}f.stopPropagation()});a.isFunction(b.oneditfunc)&&b.oneditfunc.call(d,g)}}}})},saveRow:function(g,x,m,s,u,y,v){var l={successfunc:x||null,url:m||null,extraparam:s||{},aftersavefunc:u||null,errorfunc:y||
365
+ null,afterrestorefunc:v||null,restoreAfterError:true,mtype:"POST"},t=a.makeArray(arguments).slice(1),h;h=t[0]&&typeof t[0]=="object"&&!a.isFunction(t[0])?a.extend(l,t[0]):l;var o=false,b=this[0],d,c={},j={},q={},r,p,k;if(!b.grid)return o;k=a(b).jqGrid("getInd",g,true);if(k===false)return o;l=a(k).attr("editable");h.url=h.url?h.url:b.p.editurl;if(l==="1"){var e;a("td",k).each(function(n){e=b.p.colModel[n];d=e.name;if(d!="cb"&&d!="subgrid"&&e.editable===true&&d!="rn"&&!a(this).hasClass("not-editable-cell")){switch(e.edittype){case "checkbox":var i=
366
+ ["Yes","No"];if(e.editoptions)i=e.editoptions.value.split(":");c[d]=a("input",this).is(":checked")?i[0]:i[1];break;case "text":case "password":case "textarea":case "button":c[d]=a("input, textarea",this).val();break;case "select":if(e.editoptions.multiple){i=a("select",this);var w=[];c[d]=a(i).val();c[d]=c[d]?c[d].join(","):"";a("select option:selected",this).each(function(B,C){w[B]=a(C).text()});j[d]=w.join(",")}else{c[d]=a("select option:selected",this).val();j[d]=a("select option:selected",this).text()}if(e.formatter&&
367
+ e.formatter=="select")j={};break;case "custom":try{if(e.editoptions&&a.isFunction(e.editoptions.custom_value)){c[d]=e.editoptions.custom_value.call(b,a(".customelement",this),"get");if(c[d]===undefined)throw"e2";}else throw"e1";}catch(z){z=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);z=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):
368
+ a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,z.message,jQuery.jgrid.edit.bClose)}}p=a.jgrid.checkValues(c[d],n,b);if(p[0]===false){p[1]=c[d]+" "+p[1];return false}if(b.p.autoencode)c[d]=a.jgrid.htmlEncode(c[d]);if(h.url!=="clientArray"&&e.editoptions&&e.editoptions.NullIfEmpty===true)if(c[d]=="")q[d]="null"}});if(p[0]===false){try{var f=a.jgrid.findPos(a("#"+a.jgrid.jqID(g),b.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,p[1],a.jgrid.edit.bClose,{left:f[0],top:f[1]})}catch(A){alert(p[1])}return o}l=
369
+ b.p.prmNames;t=l.oper;f=l.id;if(c){c[t]=l.editoper;c[f]=g;if(typeof b.p.inlineData=="undefined")b.p.inlineData={};c=a.extend({},c,b.p.inlineData,h.extraparam)}if(h.url=="clientArray"){c=a.extend({},c,j);b.p.autoencode&&a.each(c,function(n,i){c[n]=a.jgrid.htmlDecode(i)});f=a(b).jqGrid("setRowData",g,c);a(k).attr("editable","0");for(l=0;l<b.p.savedRow.length;l++)if(b.p.savedRow[l].id==g){r=l;break}r>=0&&b.p.savedRow.splice(r,1);a.isFunction(h.aftersavefunc)&&h.aftersavefunc.call(b,g,f);o=true;a(k).unbind("keydown")}else{a("#lui_"+
370
+ b.p.id).show();q=a.extend({},c,q);q[f]=a.jgrid.stripPref(b.p.idPrefix,q[f]);a.ajax(a.extend({url:h.url,data:a.isFunction(b.p.serializeRowData)?b.p.serializeRowData.call(b,q):q,type:h.mtype,async:false,complete:function(n,i){a("#lui_"+b.p.id).hide();if(i==="success")if((a.isFunction(h.successfunc)?h.successfunc.call(b,n):true)===true){b.p.autoencode&&a.each(c,function(z,B){c[z]=a.jgrid.htmlDecode(B)});c=a.extend({},c,j);a(b).jqGrid("setRowData",g,c);a(k).attr("editable","0");for(var w=0;w<b.p.savedRow.length;w++)if(b.p.savedRow[w].id==
371
+ g){r=w;break}r>=0&&b.p.savedRow.splice(r,1);a.isFunction(h.aftersavefunc)&&h.aftersavefunc.call(b,g,n);o=true;a(k).unbind("keydown")}else{a.isFunction(h.errorfunc)&&h.errorfunc.call(b,g,n,i);h.restoreAfterError===true&&a(b).jqGrid("restoreRow",g,h.afterrestorefunc)}},error:function(n,i){a("#lui_"+b.p.id).hide();if(a.isFunction(h.errorfunc))h.errorfunc.call(b,g,n,i);else try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+n.responseText+"</div>",jQuery.jgrid.edit.bClose,
372
+ {buttonalign:"right"})}catch(w){alert(n.responseText)}h.restoreAfterError===true&&a(b).jqGrid("restoreRow",g,h.afterrestorefunc)}},a.jgrid.ajaxOptions,b.p.ajaxRowOptions||{}))}}return o},restoreRow:function(g,x){return this.each(function(){var m=this,s,u,y={};if(m.grid){u=a(m).jqGrid("getInd",g,true);if(u!==false){for(var v=0;v<m.p.savedRow.length;v++)if(m.p.savedRow[v].id==g){s=v;break}if(s>=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(u.id)).datepicker("hide")}catch(l){}a.each(m.p.colModel,
373
+ function(){if(this.editable===true&&this.name in m.p.savedRow[s]&&!a(this).hasClass("not-editable-cell"))y[this.name]=m.p.savedRow[s][this.name]});a(m).jqGrid("setRowData",g,y);a(u).attr("editable","0").unbind("keydown");m.p.savedRow.splice(s,1)}a.isFunction(x)&&x.call(m,g)}}})}})})(jQuery);
374
+ (function(b){b.jgrid.extend({editCell:function(d,f,a){return this.each(function(){var c=this,h,e,g,i;if(!(!c.grid||c.p.cellEdit!==true)){f=parseInt(f,10);c.p.selrow=c.rows[d].id;c.p.knv||b(c).jqGrid("GridNav");if(c.p.savedRow.length>0){if(a===true)if(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("#"+c.p.knv).attr("tabindex","-1").focus()},0);i=c.p.colModel[f];h=i.name;if(!(h=="subgrid"||h=="cb"||h=="rn")){g=b("td:eq("+
375
+ f+")",c.rows[d]);if(i.editable===true&&a===true&&!g.hasClass("not-editable-cell")){if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){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(g).addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");try{e=b.unformat(g,{rowId:c.rows[d].id,colModel:i},f)}catch(k){e=i.edittype&&i.edittype=="textarea"?b(g).text():b(g).html()}if(c.p.autoencode)e=
376
+ b.jgrid.htmlDecode(e);if(!i.edittype)i.edittype="text";c.p.savedRow.push({id:d,ic:f,name:h,v:e});if(e=="&nbsp;"||e=="&#160;"||e.length==1&&e.charCodeAt(0)==160)e="";if(b.isFunction(c.p.formatCell)){var j=c.p.formatCell.call(c,c.rows[d].id,h,e,d,f);if(j!==undefined)e=j}j=b.extend({},i.editoptions||{},{id:d+"_"+h,name:h});var m=b.jgrid.createEl(i.edittype,j,e,true,b.extend({},b.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));b.isFunction(c.p.beforeEditCell)&&c.p.beforeEditCell.call(c,c.rows[d].id,h,e,
377
+ d,f);b(g).html("").append(m).attr("tabindex","0");window.setTimeout(function(){b(m).focus()},0);b("input, select, textarea",g).bind("keydown",function(l){if(l.keyCode===27)if(b("input.hasDatepicker",g).length>0)b(".ui-datepicker").is(":hidden")?b(c).jqGrid("restoreCell",d,f):b("input.hasDatepicker",g).datepicker("hide");else b(c).jqGrid("restoreCell",d,f);l.keyCode===13&&b(c).jqGrid("saveCell",d,f);if(l.keyCode==9)if(c.grid.hDiv.loading)return false;else l.shiftKey?b(c).jqGrid("prevCell",d,f):b(c).jqGrid("nextCell",
378
+ d,f);l.stopPropagation()});b.isFunction(c.p.afterEditCell)&&c.p.afterEditCell.call(c,c.rows[d].id,h,e,d,f)}else{if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){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")}g.addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");if(b.isFunction(c.p.onSelectCell)){e=g.html().replace(/\&#160\;/ig,"");c.p.onSelectCell.call(c,
379
+ c.rows[d].id,h,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||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+f+")",a.rows[d]),e,g,i=a.p.colModel[f],k=i.name,j=b.jgrid.jqID(k);switch(i.edittype){case "select":if(i.editoptions.multiple){j=b("#"+d+"_"+j,a.rows[d]);var m=[];if(e=b(j).val())e.join(",");else e="";b("option:selected",j).each(function(o,p){m[o]=b(p).text()});g=m.join(",")}else{e=b("#"+d+
380
+ "_"+j+">option:selected",a.rows[d]).val();g=b("#"+d+"_"+j+">option:selected",a.rows[d]).text()}if(i.formatter)g=e;break;case "checkbox":var l=["Yes","No"];if(i.editoptions)l=i.editoptions.value.split(":");g=e=b("#"+d+"_"+j,a.rows[d]).is(":checked")?l[0]:l[1];break;case "password":case "text":case "textarea":case "button":g=e=b("#"+d+"_"+j,a.rows[d]).val();break;case "custom":try{if(i.editoptions&&b.isFunction(i.editoptions.custom_value)){e=i.editoptions.custom_value.call(a,b(".customelement",h),"get");
381
+ if(e===undefined)throw"e2";else g=e}else throw"e1";}catch(q){q=="e1"&&b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);q=="e2"?b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):b.jgrid.info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}}if(g!==a.p.savedRow[c].v){if(b.isFunction(a.p.beforeSaveCell))if(c=a.p.beforeSaveCell.call(a,
382
+ a.rows[d].id,k,e,d,f))g=e=c;var r=b.jgrid.checkValues(e,f,a);if(r[0]===true){c={};if(b.isFunction(a.p.beforeSubmitCell))(c=a.p.beforeSubmitCell.call(a,a.rows[d].id,k,e,d,f))||(c={});b("input.hasDatepicker",h).length>0&&b("input.hasDatepicker",h).datepicker("hide");if(a.p.cellsubmit=="remote")if(a.p.cellurl){var n={};if(a.p.autoencode)e=b.jgrid.htmlEncode(e);n[k]=e;l=a.p.prmNames;i=l.id;j=l.oper;n[i]=b.jgrid.stripPref(a.p.idPrefix,a.rows[d].id);n[j]=l.editoper;n=b.extend(c,n);b("#lui_"+a.p.id).show();
383
+ a.grid.hDiv.loading=true;b.ajax(b.extend({url:a.p.cellurl,data:b.isFunction(a.p.serializeCellData)?a.p.serializeCellData.call(a,n):n,type:"POST",complete:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;if(p=="success")if(b.isFunction(a.p.afterSubmitCell)){var s=a.p.afterSubmitCell.call(a,o,n.id,k,e,d,f);if(s[0]===true){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&
384
+ a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}else{b.jgrid.info_dialog(b.jgrid.errors.errcap,s[1],b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,f)}}else{b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}},error:function(o,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;b.isFunction(a.p.errorCell)?
385
+ a.p.errorCell.call(a,o,p):b.jgrid.info_dialog(b.jgrid.errors.errcap,o.status+" : "+o.statusText+"<br/>"+p,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){}if(a.p.cellsubmit=="clientArray"){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,f,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");
386
+ b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell.call(a,a.rows[d].id,k,e,d,f);a.p.savedRow.splice(0,1)}}else try{window.setTimeout(function(){b.jgrid.info_dialog(b.jgrid.errors.errcap,e+" "+r[1],b.jgrid.edit.bClose)},100);b(a).jqGrid("restoreCell",d,f)}catch(u){}}else b(a).jqGrid("restoreCell",d,f)}b.browser.opera?b("#"+a.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(d,f){return this.each(function(){var a=
387
+ this,c;if(!(!a.grid||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+f+")",a.rows[d]);if(b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker",h).datepicker("hide")}catch(e){}b(h).empty().attr("tabindex","-1");b(a).jqGrid("setCell",a.rows[d].id,f,a.p.savedRow[c].v,false,false,true);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",
388
+ "-1").focus()},0)}})},nextCell:function(d,f){return this.each(function(){var a=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f+1;c<this.p.colModel.length;c++)if(this.p.colModel[c].editable===true){a=c;break}if(a!==false)b(this).jqGrid("editCell",d,a,true);else this.p.savedRow.length>0&&b(this).jqGrid("saveCell",d,f)}})},prevCell:function(d,f){return this.each(function(){var a=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var c=f-1;c>=0;c--)if(this.p.colModel[c].editable===true){a=
389
+ c;break}if(a!==false)b(this).jqGrid("editCell",d,a,true);else this.p.savedRow.length>0&&b(this).jqGrid("saveCell",d,f)}})},GridNav:function(){return this.each(function(){function d(g,i,k){if(k.substr(0,1)=="v"){var j=b(a.grid.bDiv)[0].clientHeight,m=b(a.grid.bDiv)[0].scrollTop,l=a.rows[g].offsetTop+a.rows[g].clientHeight,q=a.rows[g].offsetTop;if(k=="vd")if(l>=j)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop+a.rows[g].clientHeight;if(k=="vu")if(q<m)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop-
390
+ a.rows[g].clientHeight}if(k=="h"){k=b(a.grid.bDiv)[0].clientWidth;j=b(a.grid.bDiv)[0].scrollLeft;m=a.rows[g].cells[i].offsetLeft;if(a.rows[g].cells[i].offsetLeft+a.rows[g].cells[i].clientWidth>=k+parseInt(j,10))b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft+a.rows[g].cells[i].clientWidth;else if(m<j)b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft-a.rows[g].cells[i].clientWidth}}function f(g,i){var k,j;if(i=="lft"){k=g+1;for(j=g;j>=0;j--)if(a.p.colModel[j].hidden!==true){k=j;break}}if(i==
391
+ "rgt"){k=g-1;for(j=g;j<a.p.colModel.length;j++)if(a.p.colModel[j].hidden!==true){k=j;break}}return k}var a=this;if(!(!a.grid||a.p.cellEdit!==true)){a.p.knv=a.p.id+"_kn";var c=b("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+a.p.knv+"'></span></span>"),h,e;b(c).insertBefore(a.grid.cDiv);b("#"+a.p.knv).focus().keydown(function(g){e=g.keyCode;if(a.p.direction=="rtl")if(e==37)e=39;else if(e==39)e=37;
392
+ switch(e){case 38:if(a.p.iRow-1>0){d(a.p.iRow-1,a.p.iCol,"vu");b(a).jqGrid("editCell",a.p.iRow-1,a.p.iCol,false)}break;case 40:if(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,false)}break;case 37:if(a.p.iCol-1>=0){h=f(a.p.iCol-1,"lft");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 39:if(a.p.iCol+1<=a.p.colModel.length-1){h=f(a.p.iCol+1,"rgt");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 13:parseInt(a.p.iCol,
393
+ 10)>=0&&parseInt(a.p.iRow,10)>=0&&b(a).jqGrid("editCell",a.p.iRow,a.p.iCol,true)}return false})}})},getChangedCells:function(d){var f=[];d||(d="all");this.each(function(){var a=this,c;!a.grid||a.p.cellEdit!==true||b(a.rows).each(function(h){var e={};if(b(this).hasClass("edited")){b("td",this).each(function(g){c=a.p.colModel[g].name;if(c!=="cb"&&c!=="subgrid")if(d=="dirty"){if(b(this).hasClass("dirty-cell"))try{e[c]=b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(i){e[c]=b.jgrid.htmlDecode(b(this).html())}}else try{e[c]=
394
+ b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(k){e[c]=b.jgrid.htmlDecode(b(this).html())}});e.id=this.id;f.push(e)}})});return f}})})(jQuery);
395
+ (function(b){b.fn.jqm=function(a){var f={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:e,ajaxText:"",target:e,modal:e,toTop:e,onShow:e,onHide:e,onLoad:e};return this.each(function(){if(this._jqm)return j[this._jqm].c=b.extend({},j[this._jqm].c,a);l++;this._jqm=l;j[l]={c:b.extend(f,b.jqm.params,a),a:e,w:b(this).addClass("jqmID"+l),s:l};f.trigger&&b(this).jqmAddTrigger(f.trigger)})};b.fn.jqmAddClose=function(a){return o(this,a,"jqmHide")};b.fn.jqmAddTrigger=
396
+ function(a){return o(this,a,"jqmShow")};b.fn.jqmShow=function(a){return this.each(function(){b.jqm.open(this._jqm,a)})};b.fn.jqmHide=function(a){return this.each(function(){b.jqm.close(this._jqm,a)})};b.jqm={hash:{},open:function(a,f){var c=j[a],d=c.c,i="."+d.closeClass,g=parseInt(c.w.css("z-index"));g=g>0?g:3E3;var h=b("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":g-1,opacity:d.overlay/100});if(c.a)return e;c.t=f;c.a=true;c.w.css("z-index",g);if(d.modal){k[0]||
397
+ setTimeout(function(){p("bind")},1);k.push(a)}else if(d.overlay>0)d.closeoverlay&&c.w.jqmAddClose(h);else h=e;c.o=h?h.addClass(d.overlayClass).prependTo("body"):e;if(q){b("html,body").css({height:"100%",width:"100%"});if(h){h=h.css({position:"absolute"})[0];for(var m in{Top:1,Left:1})h.style.setExpression(m.toLowerCase(),"(_=(document.documentElement.scroll"+m+" || document.body.scroll"+m+"))+'px'")}}if(d.ajax){g=d.target||c.w;h=d.ajax;g=typeof g=="string"?b(g,c.w):b(g);h=h.substr(0,1)=="@"?b(f).attr(h.substring(1)):
398
+ h;g.html(d.ajaxText).load(h,function(){d.onLoad&&d.onLoad.call(this,c);i&&c.w.jqmAddClose(b(i,c.w));r(c)})}else i&&c.w.jqmAddClose(b(i,c.w));d.toTop&&c.o&&c.w.before('<span id="jqmP'+c.w[0]._jqm+'"></span>').insertAfter(c.o);d.onShow?d.onShow(c):c.w.show();r(c);return e},close:function(a){a=j[a];if(!a.a)return e;a.a=e;if(k[0]){k.pop();k[0]||p("unbind")}a.c.toTop&&a.o&&b("#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 e},params:{}};var l=
399
+ 0,j=b.jqm.hash,k=[],q=b.browser.msie&&b.browser.version=="6.0",e=false,r=function(a){var f=b('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(q)if(a.o)a.o.html('<p style="width:100%;height:100%"/>').prepend(f);else b("iframe.jqm",a.w)[0]||a.w.prepend(f);s(a)},s=function(a){try{b(":input:visible",a.w)[0].focus()}catch(f){}},p=function(a){b(document)[a]("keypress",n)[a]("keydown",n)[a]("mousedown",n)},n=function(a){var f=j[k[k.length-1]];(a=!b(a.target).parents(".jqmID"+
400
+ f.s)[0])&&s(f);return!a},o=function(a,f,c){return a.each(function(){var d=this._jqm;b(f).each(function(){if(!this[c]){this[c]=[];b(this).click(function(){for(var i in{jqmShow:1,jqmHide:1})for(var g in this[i])if(j[this[i][g]])j[this[i][g]].w[i](this);return e})}this[c].push(d)})})}})(jQuery);
401
+ (function(b){b.fn.jqDrag=function(a){return l(this,a,"d")};b.fn.jqResize=function(a,e){return l(this,a,"r",e)};b.jqDnR={dnr:{},e:0,drag:function(a){if(c.k=="d")d.css({left:c.X+a.pageX-c.pX,top:c.Y+a.pageY-c.pY});else{d.css({width:Math.max(a.pageX-c.pX+c.W,0),height:Math.max(a.pageY-c.pY+c.H,0)});M1&&f.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)})}return false},stop:function(){b(document).unbind("mousemove",i.drag).unbind("mouseup",i.stop)}};var i=b.jqDnR,c=i.dnr,
402
+ d=i.e,f,l=function(a,e,n,m){return a.each(function(){e=e?b(e,a):a;e.bind("mousedown",{e:a,k:n},function(g){var j=g.data,h={};d=j.e;f=m?b(m):false;if(d.css("position")!="relative")try{d.position(h)}catch(o){}c={X:h.left||k("left")||0,Y:h.top||k("top")||0,W:k("width")||d[0].scrollWidth||0,H:k("height")||d[0].scrollHeight||0,pX:g.pageX,pY:g.pageY,k:j.k};M1=f&&j.k!="d"?{X:h.left||f1("left")||0,Y:h.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:g.pageX,pY:g.pageY,
403
+ k:j.k}:false;if(b("input.hasDatepicker",d[0])[0])try{b("input.hasDatepicker",d[0]).datepicker("hide")}catch(p){}b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);return false})})},k=function(a){return parseInt(d.css(a))||false};f1=function(a){return parseInt(f.css(a))||false}})(jQuery);
404
+ (function(b){b.jgrid.extend({setSubGrid:function(){return this.each(function(){var f;this.p.subGridOptions=b.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:false,delayOnLoad:50,selectOnExpand:false,reloadOnExpand:true},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:b.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false,
405
+ fixed:true});f=this.p.subGridModel;if(f[0]){f[0].align=b.extend([],f[0].align||[]);for(var d=0;d<f[0].name.length;d++)f[0].align[d]=f[0].align[d]||"left"}})},addSubGridCell:function(f,d){var a="",n,s;this.each(function(){a=this.formatCol(f,d);s=this.p.id;n=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+s+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+a+"><a href='javascript:void(0);'><span class='ui-icon "+n+"'></span></a></td>"},addSubGrid:function(f,d){return this.each(function(){var a=
406
+ this;if(a.grid){var n=function(g,j,e){j=b("<td align='"+a.p.subGridModel[0].align[e]+"'></td>").html(j);b(g).append(j)},s=function(g,j){var e,c,h,k=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),i=b("<tr></tr>");for(c=0;c<a.p.subGridModel[0].name.length;c++){e=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(i).append(e)}b(k).append(i);if(g){h=
407
+ a.p.xmlReader.subgrid;b(h.root+" "+h.row,g).each(function(){i=b("<tr class='ui-widget-content ui-subtblcell'></tr>");if(h.repeatitems===true)b(h.cell,this).each(function(m){n(i,b(this).text()||"&#160;",m)});else{var o=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(o)for(c=0;c<o.length;c++)n(i,b(o[c],this).text()||"&#160;",c)}b(k).append(i)})}e=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+e+j).append(k);a.grid.hDiv.loading=false;b("#load_"+a.p.id).hide();return false},v=function(g,j){var e,
408
+ c,h,k,i,o=b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),m=b("<tr></tr>");for(c=0;c<a.p.subGridModel[0].name.length;c++){e=b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+a.p.direction+"'></th>");b(e).html(a.p.subGridModel[0].name[c]);b(e).width(a.p.subGridModel[0].width[c]);b(m).append(e)}b(o).append(m);if(g){k=a.p.jsonReader.subgrid;e=g[k.root];if(typeof e!=="undefined")for(c=0;c<e.length;c++){h=e[c];m=b("<tr class='ui-widget-content ui-subtblcell'></tr>");
409
+ if(k.repeatitems===true){if(k.cell)h=h[k.cell];for(i=0;i<h.length;i++)n(m,h[i]||"&#160;",i)}else{var u=a.p.subGridModel[0].mapping||a.p.subGridModel[0].name;if(u.length)for(i=0;i<u.length;i++)n(m,h[u[i]]||"&#160;",i)}b(o).append(m)}}c=b("table:first",a.grid.bDiv).attr("id")+"_";b("#"+c+j).append(o);a.grid.hDiv.loading=false;b("#load_"+a.p.id).hide();return false},z=function(g){var j,e,c,h;j=b(g).attr("id");e={nd_:(new Date).getTime()};e[a.p.prmNames.subgridid]=j;if(!a.p.subGridModel[0])return false;
410
+ if(a.p.subGridModel[0].params)for(h=0;h<a.p.subGridModel[0].params.length;h++)for(c=0;c<a.p.colModel.length;c++)if(a.p.colModel[c].name==a.p.subGridModel[0].params[h])e[a.p.colModel[c].name]=b("td:eq("+c+")",g).text().replace(/\&#160\;/ig,"");if(!a.grid.hDiv.loading){a.grid.hDiv.loading=true;b("#load_"+a.p.id).show();if(!a.p.subgridtype)a.p.subgridtype=a.p.datatype;if(b.isFunction(a.p.subgridtype))a.p.subgridtype.call(a,e);else a.p.subgridtype=a.p.subgridtype.toLowerCase();switch(a.p.subgridtype){case "xml":case "json":b.ajax(b.extend({type:a.p.mtype,
411
+ url:a.p.subGridUrl,dataType:a.p.subgridtype,data:b.isFunction(a.p.serializeSubGridData)?a.p.serializeSubGridData.call(a,e):e,complete:function(k){a.p.subgridtype=="xml"?s(k.responseXML,j):v(b.jgrid.parse(k.responseText),j)}},b.jgrid.ajaxOptions,a.p.ajaxSubgridOptions||{}))}}return false},l,t,w,x=0,p,q;b.each(a.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name=="cb")x++});var y=a.rows.length,r=1;if(d!==undefined&&d>0){r=d;y=d+1}for(;r<y;){b(a.rows[r]).hasClass("jqgrow")&&b(a.rows[r].cells[f]).bind("click",
412
+ function(){var g=b(this).parent("tr")[0];q=g.nextSibling;if(b(this).hasClass("sgcollapsed")){t=a.p.id;l=g.id;if(a.p.subGridOptions.reloadOnExpand===true||a.p.subGridOptions.reloadOnExpand===false&&!b(q).hasClass("ui-subgrid")){w=f>=1?"<td colspan='"+f+"'>&#160;</td>":"";p=true;if(b.isFunction(a.p.subGridBeforeExpand))p=a.p.subGridBeforeExpand.call(a,t+"_"+l,l);if(p===false)return false;b(g).after("<tr role='row' class='ui-subgrid'>"+w+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+
413
+ a.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(a.p.colNames.length-1-x,10)+"' class='ui-widget-content subgrid-data'><div id="+t+"_"+l+" class='tablediv'></div></td></tr>");b.isFunction(a.p.subGridRowExpanded)?a.p.subGridRowExpanded.call(a,t+"_"+l,l):z(g)}else b(q).show();b(this).html("<a href='javascript:void(0);'><span class='ui-icon "+a.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");a.p.subGridOptions.selectOnExpand&&b(a).jqGrid("setSelection",
414
+ l)}else if(b(this).hasClass("sgexpanded")){p=true;if(b.isFunction(a.p.subGridRowColapsed)){l=g.id;p=a.p.subGridRowColapsed.call(a,t+"_"+l,l)}if(p===false)return false;if(a.p.subGridOptions.reloadOnExpand===true)b(q).remove(".ui-subgrid");else b(q).hasClass("ui-subgrid")&&b(q).hide();b(this).html("<a href='javascript:void(0);'><span class='ui-icon "+a.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return false});a.p.subGridOptions.expandOnLoad===true&&
415
+ b(a.rows[r].cells[f]).trigger("click");r++}a.subGridXml=function(g,j){s(g,j)};a.subGridJson=function(g,j){v(g,j)}}})},expandSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgcollapsed",d)[0])&&b(d).trigger("click")}})},collapseSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d)(d=b("td.sgexpanded",d)[0])&&b(d).trigger("click")}})},
416
+ toggleSubGridRow:function(f){return this.each(function(){if(this.grid||f)if(this.p.subGrid===true){var d=b(this).jqGrid("getInd",f,true);if(d){var a=b("td.sgcollapsed",d)[0];if(a)b(a).trigger("click");else(a=b("td.sgexpanded",d)[0])&&b(a).trigger("click")}}})}})})(jQuery);
417
+ (function(e){e.jgrid.extend({groupingSetup:function(){return this.each(function(){var a=this.p.groupingView;if(a!==null&&(typeof a==="object"||e.isFunction(a)))if(a.groupField.length){if(typeof a.visibiltyOnNextGrouping=="undefined")a.visibiltyOnNextGrouping=[];for(var c=0;c<a.groupField.length;c++){a.groupOrder[c]||(a.groupOrder[c]="asc");a.groupText[c]||(a.groupText[c]="{0}");if(typeof a.groupColumnShow[c]!="boolean")a.groupColumnShow[c]=true;if(typeof a.groupSummary[c]!="boolean")a.groupSummary[c]=
418
+ false;if(a.groupColumnShow[c]===true){a.visibiltyOnNextGrouping[c]=true;e(this).jqGrid("showCol",a.groupField[c])}else{a.visibiltyOnNextGrouping[c]=e("#"+this.p.id+"_"+a.groupField[c]).is(":visible");e(this).jqGrid("hideCol",a.groupField[c])}a.sortitems[c]=[];a.sortnames[c]=[];a.summaryval[c]=[];if(a.groupSummary[c]){a.summary[c]=[];for(var b=this.p.colModel,d=0,g=b.length;d<g;d++)b[d].summaryType&&a.summary[c].push({nm:b[d].name,st:b[d].summaryType,v:""})}}this.p.scroll=false;this.p.rownumbers=false;
419
+ this.p.subGrid=false;this.p.treeGrid=false;this.p.gridview=true}else this.p.grouping=false;else this.p.grouping=false})},groupingPrepare:function(a,c,b,d){this.each(function(){c[0]+="";var g=c[0].toString().split(" ").join(""),h=this.p.groupingView,f=this;if(b.hasOwnProperty(g))b[g].push(a);else{b[g]=[];b[g].push(a);h.sortitems[0].push(g);h.sortnames[0].push(e.trim(c[0].toString()));h.summaryval[0][g]=e.extend(true,[],h.summary[0])}h.groupSummary[0]&&e.each(h.summaryval[0][g],function(){this.v=e.isFunction(this.st)?
420
+ this.st.call(f,this.v,this.nm,d):e(f).jqGrid("groupingCalculations."+this.st,this.v,this.nm,d)})});return b},groupingToggle:function(a){this.each(function(){var c=this.p.groupingView,b=a.lastIndexOf("_"),d=a.substring(0,b+1);b=parseInt(a.substring(b+1),10)+1;var g=c.minusicon,h=c.plusicon,f=e("#"+a);f=f.length?f[0].nextSibling:null;var k=e("#"+a+" span.tree-wrap-"+this.p.direction),l=false;if(k.hasClass(g)){if(c.showSummaryOnHide&&c.groupSummary[0]){if(f)for(;f;){if(e(f).hasClass("jqfoot"))break;
421
+ e(f).hide();f=f.nextSibling}}else if(f)for(;f;){if(e(f).attr("id")==d+String(b))break;e(f).hide();f=f.nextSibling}k.removeClass(g).addClass(h);l=true}else{if(f)for(;f;){if(e(f).attr("id")==d+String(b))break;e(f).show();f=f.nextSibling}k.removeClass(h).addClass(g)}e.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,a,l)});return false},groupingRender:function(a,c){return this.each(function(){var b=this,d=b.p.groupingView,g="",h="",f,k=d.groupCollapse?d.plusicon:d.minusicon,l,r,m;if(!d.groupDataSorted){d.sortitems[0].sort();
422
+ d.sortnames[0].sort();if(d.groupOrder[0].toLowerCase()=="desc"){d.sortitems[0].reverse();d.sortnames[0].reverse()}}k+=" tree-wrap-"+b.p.direction;for(m=0;m<c;){if(b.p.colModel[m].name==d.groupField[0]){r=m;break}m++}e.each(d.sortitems[0],function(o,n){f=b.p.id+"ghead_"+o;h="<span style='cursor:pointer;' class='ui-icon "+k+"' onclick=\"jQuery('#"+b.p.id+"').jqGrid('groupingToggle','"+f+"');return false;\"></span>";try{l=b.formatter(f,d.sortnames[0][o],r,d.sortitems[0])}catch(v){l=d.sortnames[0][o]}g+=
423
+ '<tr id="'+f+'" role="row" class= "ui-widget-content jqgroup ui-row-'+b.p.direction+'"><td colspan="'+c+'">'+h+e.jgrid.format(d.groupText[0],l,a[n].length)+"</td></tr>";for(var i=0;i<a[n].length;i++)g+=a[n][i].join("");if(d.groupSummary[0]){i="";if(d.groupCollapse&&!d.showSummaryOnHide)i=' style="display:none;"';g+="<tr"+i+' role="row" class="ui-widget-content jqfoot ui-row-'+b.p.direction+'">';i=d.summaryval[0][n];for(var p=b.p.colModel,q,s=a[n].length,j=0;j<c;j++){var t="<td "+b.formatCol(j,1,"")+
424
+ ">&#160;</td>",u="{0}";e.each(i,function(){if(this.nm==p[j].name){if(p[j].summaryTpl)u=p[j].summaryTpl;if(this.st=="avg")if(this.v&&s>0)this.v/=s;try{q=b.formatter("",this.v,j,this)}catch(w){q=this.v}t="<td "+b.formatCol(j,1,"")+">"+e.jgrid.format(u,q)+"</td>";return false}});g+=t}g+="</tr>"}});e("#"+b.p.id+" tbody:first").append(g);g=null})},groupingGroupBy:function(a,c){return this.each(function(){if(typeof a=="string")a=[a];var b=this.p.groupingView;this.p.grouping=true;if(typeof b.visibiltyOnNextGrouping==
425
+ "undefined")b.visibiltyOnNextGrouping=[];var d;for(d=0;d<b.groupField.length;d++)!b.groupColumnShow[d]&&b.visibiltyOnNextGrouping[d]&&e(this).jqGrid("showCol",b.groupField[d]);for(d=0;d<a.length;d++)b.visibiltyOnNextGrouping[d]=e("#"+this.p.id+"_"+a[d]).is(":visible");this.p.groupingView=e.extend(this.p.groupingView,c||{});b.groupField=a;e(this).trigger("reloadGrid")})},groupingRemove:function(a){return this.each(function(){if(typeof a=="undefined")a=true;this.p.grouping=false;if(a===true){for(var c=
426
+ this.p.groupingView,b=0;b<c.groupField.length;b++)!c.groupColumnShow[b]&&c.visibiltyOnNextGrouping[b]&&e(this).jqGrid("showCol",c.groupField);e("tr.jqgroup, tr.jqfoot","#"+this.p.id+" tbody:first").remove();e("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else e(this).trigger("reloadGrid")})},groupingCalculations:{sum:function(a,c,b){return parseFloat(a||0)+parseFloat(b[c]||0)},min:function(a,c,b){if(a==="")return parseFloat(b[c]||0);return Math.min(parseFloat(a),parseFloat(b[c]||0))},max:function(a,
427
+ c,b){if(a==="")return parseFloat(b[c]||0);return Math.max(parseFloat(a),parseFloat(b[c]||0))},count:function(a,c,b){if(a==="")a=0;return b.hasOwnProperty(c)?a+1:0},avg:function(a,c,b){return parseFloat(a||0)+parseFloat(b[c]||0)}}})})(jQuery);
428
+ (function(d){d.jgrid.extend({setTreeNode:function(a,c){return this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)for(var e=b.p.expColInd,g=b.p.treeReader.expanded_field,h=b.p.treeReader.leaf_field,f=b.p.treeReader.level_field,l=b.p.treeReader.icon_field,i=b.p.treeReader.loaded,j,o,n,k;a<c;){k=b.p.data[b.p._index[b.rows[a].id]];if(b.p.treeGridModel=="nested")if(!k[h]){j=parseInt(k[b.p.treeReader.left_field],10);o=parseInt(k[b.p.treeReader.right_field],10);k[h]=o===j+1?"true":"false";b.rows[a].cells[b.p._treeleafpos].innerHTML=
429
+ k[h]}j=parseInt(k[f],10);if(b.p.tree_root_level===0){n=j+1;o=j}else{n=j;o=j-1}n="<div class='tree-wrap tree-wrap-"+b.p.direction+"' style='width:"+n*18+"px;'>";n+="<div style='"+(b.p.direction=="rtl"?"right:":"left:")+o*18+"px;' class='ui-icon ";if(k[i]!==undefined)k[i]=k[i]=="true"||k[i]===true?true:false;if(k[h]=="true"||k[h]===true){n+=(k[l]!==undefined&&k[l]!==""?k[l]:b.p.treeIcons.leaf)+" tree-leaf treeclick";k[h]=true;o="leaf"}else{k[h]=false;o=""}k[g]=(k[g]=="true"||k[g]===true?true:false)&&
430
+ k[i];n+=k[g]===false?k[h]===true?"'":b.p.treeIcons.plus+" tree-plus treeclick'":k[h]===true?"'":b.p.treeIcons.minus+" tree-minus treeclick'";n+="></div></div>";d(b.rows[a].cells[e]).wrapInner("<span class='cell-wrapper"+o+"'></span>").prepend(n);if(j!==parseInt(b.p.tree_root_level,10))(k=(k=d(b).jqGrid("getNodeParent",k))&&k.hasOwnProperty(g)?k[g]:true)||d(b.rows[a]).css("display","none");d(b.rows[a].cells[e]).find("div.treeclick").bind("click",function(m){m=d(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;
431
+ m=b.p._index[m];if(!b.p.data[m][h])if(b.p.data[m][g]){d(b).jqGrid("collapseRow",b.p.data[m]);d(b).jqGrid("collapseNode",b.p.data[m])}else{d(b).jqGrid("expandRow",b.p.data[m]);d(b).jqGrid("expandNode",b.p.data[m])}return false});b.p.ExpandColClick===true&&d(b.rows[a].cells[e]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(m){m=d(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;var r=b.p._index[m];if(!b.p.data[r][h])if(b.p.data[r][g]){d(b).jqGrid("collapseRow",b.p.data[r]);
432
+ d(b).jqGrid("collapseNode",b.p.data[r])}else{d(b).jqGrid("expandRow",b.p.data[r]);d(b).jqGrid("expandNode",b.p.data[r])}d(b).jqGrid("setSelection",m);return false});a++}})},setTreeGrid:function(){return this.each(function(){var a=this,c=0,b=false,e,g,h=[];if(a.p.treeGrid){a.p.treedatatype||d.extend(a.p,{treedatatype:a.p.datatype});a.p.subGrid=false;a.p.altRows=false;a.p.pgbuttons=false;a.p.pginput=false;a.p.gridview=true;if(a.p.rowTotal===null)a.p.rowNum=1E4;a.p.multiselect=false;a.p.rowList=[];a.p.expColInd=
433
+ 0;a.p.treeIcons=d.extend({plus:"ui-icon-triangle-1-"+(a.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},a.p.treeIcons||{});if(a.p.treeGridModel=="nested")a.p.treeReader=d.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},a.p.treeReader);else if(a.p.treeGridModel=="adjacency")a.p.treeReader=d.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",
434
+ loaded:"loaded",icon_field:"icon"},a.p.treeReader);for(g in a.p.colModel)if(a.p.colModel.hasOwnProperty(g)){e=a.p.colModel[g].name;if(e==a.p.ExpandColumn&&!b){b=true;a.p.expColInd=c}c++;for(var f in a.p.treeReader)a.p.treeReader[f]==e&&h.push(e)}d.each(a.p.treeReader,function(l,i){if(i&&d.inArray(i,h)===-1){if(l==="leaf_field")a.p._treeleafpos=c;c++;a.p.colNames.push(i);a.p.colModel.push({name:i,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(a){this.each(function(){var c=
435
+ this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getNodeChildren",a),e=c.p.treeReader.expanded_field;d(b).each(function(){var g=d.jgrid.getAccessor(this,c.p.localReader.id);d("#"+g,c.grid.bDiv).css("display","");this[e]&&d(c).jqGrid("expandRow",this)})}})},collapseRow:function(a){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getNodeChildren",a),e=c.p.treeReader.expanded_field;d(b).each(function(){var g=d.jgrid.getAccessor(this,c.p.localReader.id);d("#"+g,c.grid.bDiv).css("display",
436
+ "none");this[e]&&d(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var a=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var b=c.p.treeReader.level_field;d(c.p.data).each(function(){parseInt(this[b],10)===parseInt(c.p.tree_root_level,10)&&a.push(this)});break;case "adjacency":var e=c.p.treeReader.parent_id_field;d(c.p.data).each(function(){if(this[e]===null||String(this[e]).toLowerCase()=="null")a.push(this)})}});return a},getNodeDepth:function(a){var c=
437
+ null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":c=parseInt(a[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=d(this).jqGrid("getNodeAncestors",a).length}});return c},getNodeParent:function(a){var c=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,e=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(a[b],
438
+ 10),f=parseInt(a[e],10),l=parseInt(a[g],10);d(this.p.data).each(function(){if(parseInt(this[g],10)===l-1&&parseInt(this[b],10)<h&&parseInt(this[e],10)>f){c=this;return false}});break;case "adjacency":var i=this.p.treeReader.parent_id_field,j=this.p.localReader.id;d(this.p.data).each(function(){if(this[j]==a[i]){c=this;return false}})}});return c},getNodeChildren:function(a){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,
439
+ e=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(a[b],10),f=parseInt(a[e],10),l=parseInt(a[g],10);d(this.p.data).each(function(){parseInt(this[g],10)===l+1&&parseInt(this[b],10)>h&&parseInt(this[e],10)<f&&c.push(this)});break;case "adjacency":var i=this.p.treeReader.parent_id_field,j=this.p.localReader.id;d(this.p.data).each(function(){this[i]==a[j]&&c.push(this)})}});return c},getFullTreeNode:function(a){var c=[];this.each(function(){var b;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var e=
440
+ this.p.treeReader.left_field,g=this.p.treeReader.right_field,h=this.p.treeReader.level_field,f=parseInt(a[e],10),l=parseInt(a[g],10),i=parseInt(a[h],10);d(this.p.data).each(function(){parseInt(this[h],10)>=i&&parseInt(this[e],10)>=f&&parseInt(this[e],10)<=l&&c.push(this)});break;case "adjacency":if(a){c.push(a);var j=this.p.treeReader.parent_id_field,o=this.p.localReader.id;d(this.p.data).each(function(n){b=c.length;for(n=0;n<b;n++)if(c[n][o]==this[j]){c.push(this);break}})}}});return c},getNodeAncestors:function(a){var c=
441
+ [];this.each(function(){if(this.grid&&this.p.treeGrid)for(var b=d(this).jqGrid("getNodeParent",a);b;){c.push(b);b=d(this).jqGrid("getNodeParent",b)}});return c},isVisibleNode:function(a){var c=true;this.each(function(){if(this.grid&&this.p.treeGrid){var b=d(this).jqGrid("getNodeAncestors",a),e=this.p.treeReader.expanded_field;d(b).each(function(){c=c&&this[e];if(!c)return false})}});return c},isNodeLoaded:function(a){var c;this.each(function(){if(this.grid&&this.p.treeGrid){var b=this.p.treeReader.leaf_field;
442
+ c=a!==undefined?a.loaded!==undefined?a.loaded:a[b]||d(this).jqGrid("getNodeChildren",a).length>0?true:false:false}});return c},expandNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field,b=this.p.treeReader.parent_id_field,e=this.p.treeReader.loaded,g=this.p.treeReader.level_field,h=this.p.treeReader.left_field,f=this.p.treeReader.right_field;if(!a[c]){var l=d.jgrid.getAccessor(a,this.p.localReader.id),i=d("#"+l,this.grid.bDiv)[0],j=this.p._index[l];
443
+ if(d(this).jqGrid("isNodeLoaded",this.p.data[j])){a[c]=true;d("div.treeclick",i).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{a[c]=true;d("div.treeclick",i).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=i.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:l,n_left:a[h],n_right:a[f],n_level:a[g]}}):d(this).jqGrid("setGridParam",
444
+ {postData:{nodeid:l,parentid:a[b],n_level:a[g]}});d(this).trigger("reloadGrid");a[e]=true;this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):d(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid)if(a.expanded){a.expanded=false;var c=d.jgrid.getAccessor(a,this.p.localReader.id);c=d("#"+c,this.grid.bDiv)[0];d("div.treeclick",
445
+ c).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},SortTree:function(a,c,b,e){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,h,f,l=[],i=this,j;g=d(this).jqGrid("getRootNodes");g=d.jgrid.from(g);g.orderBy(a,c,b,e);j=g.select();g=0;for(h=j.length;g<h;g++){f=j[g];l.push(f);d(this).jqGrid("collectChildrenSortTree",l,f,a,c,b,e)}d.each(l,function(o){var n=d.jgrid.getAccessor(this,i.p.localReader.id);d("#"+i.p.id+" tbody tr:eq("+o+")").after(d("tr#"+
446
+ n,i.grid.bDiv))});l=j=g=null}})},collectChildrenSortTree:function(a,c,b,e,g,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var f,l,i,j;f=d(this).jqGrid("getNodeChildren",c);f=d.jgrid.from(f);f.orderBy(b,e,g,h);j=f.select();f=0;for(l=j.length;f<l;f++){i=j[f];a.push(i);d(this).jqGrid("collectChildrenSortTree",a,i,b,e,g,h)}}})},setTreeRow:function(a,c){var b=false;this.each(function(){if(this.grid&&this.p.treeGrid)b=d(this).jqGrid("setRowData",a,c)});return b},delTreeNode:function(a){return this.each(function(){var c=
447
+ this.p.localReader.id,b=this.p.treeReader.left_field,e=this.p.treeReader.right_field,g,h,f;if(this.grid&&this.p.treeGrid){var l=this.p._index[a];if(l!==undefined){g=parseInt(this.p.data[l][e],10);h=g-parseInt(this.p.data[l][b],10)+1;l=d(this).jqGrid("getFullTreeNode",this.p.data[l]);if(l.length>0)for(var i=0;i<l.length;i++)d(this).jqGrid("delRowData",l[i][c]);if(this.p.treeGridModel==="nested"){c=d.jgrid.from(this.p.data).greater(b,g,{stype:"integer"}).select();if(c.length)for(f in c)c[f][b]=parseInt(c[f][b],
448
+ 10)-h;c=d.jgrid.from(this.p.data).greater(e,g,{stype:"integer"}).select();if(c.length)for(f in c)c[f][e]=parseInt(c[f][e],10)-h}}}})},addChildNode:function(a,c,b){var e=this[0];if(b){var g=e.p.treeReader.expanded_field,h=e.p.treeReader.leaf_field,f=e.p.treeReader.level_field,l=e.p.treeReader.parent_id_field,i=e.p.treeReader.left_field,j=e.p.treeReader.right_field,o=e.p.treeReader.loaded,n,k,m,r,p;n=0;var s=c,t;if(!a){p=e.p.data.length-1;if(p>=0)for(;p>=0;){n=Math.max(n,parseInt(e.p.data[p][e.p.localReader.id],
449
+ 10));p--}a=n+1}var u=d(e).jqGrid("getInd",c);t=false;if(c===undefined||c===null||c===""){s=c=null;n="last";r=e.p.tree_root_level;p=e.p.data.length+1}else{n="after";k=e.p._index[c];m=e.p.data[k];c=m[e.p.localReader.id];r=parseInt(m[f],10)+1;p=d(e).jqGrid("getFullTreeNode",m);if(p.length){s=p=p[p.length-1][e.p.localReader.id];p=d(e).jqGrid("getInd",s)+1}else p=d(e).jqGrid("getInd",c)+1;if(m[h]){t=true;m[g]=true;d(e.rows[u]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(e.p.treeIcons.leaf+
450
+ " tree-leaf").addClass(e.p.treeIcons.minus+" tree-minus");e.p.data[k][h]=false;m[o]=true}}k=p+1;b[g]=false;b[o]=true;b[f]=r;b[h]=true;if(e.p.treeGridModel==="adjacency")b[l]=c;if(e.p.treeGridModel==="nested"){var q;if(c!==null){h=parseInt(m[j],10);f=d.jgrid.from(e.p.data);f=f.greaterOrEquals(j,h,{stype:"integer"});f=f.select();if(f.length)for(q in f){f[q][i]=f[q][i]>h?parseInt(f[q][i],10)+2:f[q][i];f[q][j]=f[q][j]>=h?parseInt(f[q][j],10)+2:f[q][j]}b[i]=h;b[j]=h+1}else{h=parseInt(d(e).jqGrid("getCol",
451
+ j,false,"max"),10);f=d.jgrid.from(e.p.data).greater(i,h,{stype:"integer"}).select();if(f.length)for(q in f)f[q][i]=parseInt(f[q][i],10)+2;f=d.jgrid.from(e.p.data).greater(j,h,{stype:"integer"}).select();if(f.length)for(q in f)f[q][j]=parseInt(f[q][j],10)+2;b[i]=h+1;b[j]=h+2}}if(c===null||d(e).jqGrid("isNodeLoaded",m)||t){d(e).jqGrid("addRowData",a,b,n,s);d(e).jqGrid("setTreeNode",p,k)}m&&!m[g]&&d(e.rows[u]).find("div.treeclick").click()}}})})(jQuery);
452
+ (function(b){b.jgrid.extend({jqGridImport:function(a){a=b.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,c=function(f,g){var e=b(g.xmlGrid.config,f)[0],h=b(g.xmlGrid.data,f)[0],i;if(xmlJsonClass.xml2json&&b.jgrid.parse){e=xmlJsonClass.xml2json(e," ");e=b.jgrid.parse(e);for(var l in e)if(e.hasOwnProperty(l))i=e[l];if(h){h=e.grid.datatype;
453
+ e.grid.datatype="xmlstring";e.grid.datastr=f;b(d).jqGrid(i).jqGrid("setGridParam",{datatype:h})}else b(d).jqGrid(i)}else alert("xml2json or parse are not present")},j=function(f,g){if(f&&typeof f=="string"){var e=b.jgrid.parse(f),h=e[g.jsonGrid.config];if(e=e[g.jsonGrid.data]){var i=h.datatype;h.datatype="jsonstring";h.datastr=e;b(d).jqGrid(h).jqGrid("setGridParam",{datatype:i})}else b(d).jqGrid(h)}};switch(a.imptype){case "xml":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"xml",
454
+ complete:function(f,g){if(g=="success"){c(f.responseXML,a);b.isFunction(a.importComplete)&&a.importComplete(f)}}},a.ajaxOptions));break;case "xmlstring":if(a.impstring&&typeof a.impstring=="string"){var k=b.jgrid.stringToDoc(a.impstring);if(k){c(k,a);b.isFunction(a.importComplete)&&a.importComplete(k);a.impstring=null}k=null}break;case "json":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"json",complete:function(f,g){if(g=="success"){j(f.responseText,a);b.isFunction(a.importComplete)&&
455
+ a.importComplete(f)}}},a.ajaxOptions));break;case "jsonstring":if(a.impstring&&typeof a.impstring=="string"){j(a.impstring,a);b.isFunction(a.importComplete)&&a.importComplete(a.impstring);a.impstring=null}}})},jqGridExport:function(a){a=b.extend({exptype:"xmlstring",root:"grid",ident:"\t"},a||{});var d=null;this.each(function(){if(this.grid){var c=b.extend({},b(this).jqGrid("getGridParam"));if(c.rownumbers){c.colNames.splice(0,1);c.colModel.splice(0,1)}if(c.multiselect){c.colNames.splice(0,1);c.colModel.splice(0,
456
+ 1)}if(c.subGrid){c.colNames.splice(0,1);c.colModel.splice(0,1)}c.knv=null;if(c.treeGrid)for(var j in c.treeReader)if(c.treeReader.hasOwnProperty(j)){c.colNames.splice(c.colNames.length-1);c.colModel.splice(c.colModel.length-1)}switch(a.exptype){case "xmlstring":d="<"+a.root+">"+xmlJsonClass.json2xml(c,a.ident)+"</"+a.root+">";break;case "jsonstring":d="{"+xmlJsonClass.toJson(c,a.root,a.ident,false)+"}";if(c.postData.filters!==undefined){d=d.replace(/filters":"/,'filters":');d=d.replace(/}]}"/,"}]}")}}}});
457
+ return d},excelExport:function(a){a=b.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},a||{});return this.each(function(){if(this.grid){var d;if(a.exptype=="remote"){d=b.extend({},this.p.postData);d[a.oper]=a.tag;d=jQuery.param(d);d=a.url.indexOf("?")!=-1?a.url+"&"+d:a.url+"?"+d;window.location=d}}})}})})(jQuery);
458
+ var xmlJsonClass={xml2json:function(a,b){if(a.nodeType===9)a=a.documentElement;var h=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+b+(b?h.replace(/\t/g,b):h.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var h=function(d,c,i){var g="",k,j;if(d instanceof Array)if(d.length===0)g+=i+"<"+c+">__EMPTY_ARRAY_</"+c+">\n";else{k=0;for(j=d.length;k<j;k+=1){var l=i+h(d[k],c,i+"\t")+"\n";g+=l}}else if(typeof d==="object"){k=false;g+=i+"<"+c;for(j in d)if(d.hasOwnProperty(j))if(j.charAt(0)===
459
+ "@")g+=" "+j.substr(1)+'="'+d[j].toString()+'"';else k=true;g+=k?">":"/>";if(k){for(j in d)if(d.hasOwnProperty(j))if(j==="#text")g+=d[j];else if(j==="#cdata")g+="<![CDATA["+d[j]+"]]\>";else if(j.charAt(0)!=="@")g+=h(d[j],j,i+"\t");g+=(g.charAt(g.length-1)==="\n"?i:"")+"</"+c+">"}}else if(typeof d==="function")g+=i+"<"+c+"><![CDATA["+d+"]]\></"+c+">";else{if(d===undefined)d="";g+=d.toString()==='""'||d.toString().length===0?i+"<"+c+">__EMPTY_STRING_</"+c+">":i+"<"+c+">"+d.toString()+"</"+c+">"}return g},
460
+ e="",f;for(f in a)if(a.hasOwnProperty(f))e+=h(a[f],f,"");return b?e.replace(/\t/g,b):e.replace(/\t|\n/g,"")},toObj:function(a){var b={},h=/function/i;if(a.nodeType===1){if(a.attributes.length){var e;for(e=0;e<a.attributes.length;e+=1)b["@"+a.attributes[e].nodeName]=(a.attributes[e].nodeValue||"").toString()}if(a.firstChild){var f=e=0,d=false,c;for(c=a.firstChild;c;c=c.nextSibling)if(c.nodeType===1)d=true;else if(c.nodeType===3&&c.nodeValue.match(/[^ \f\n\r\t\v]/))e+=1;else if(c.nodeType===4)f+=1;
461
+ if(d)if(e<2&&f<2){this.removeWhite(a);for(c=a.firstChild;c;c=c.nextSibling)if(c.nodeType===3)b["#text"]=this.escape(c.nodeValue);else if(c.nodeType===4)if(h.test(c.nodeValue))b[c.nodeName]=[b[c.nodeName],c.nodeValue];else b["#cdata"]=this.escape(c.nodeValue);else if(b[c.nodeName])if(b[c.nodeName]instanceof Array)b[c.nodeName][b[c.nodeName].length]=this.toObj(c);else b[c.nodeName]=[b[c.nodeName],this.toObj(c)];else b[c.nodeName]=this.toObj(c)}else if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));
462
+ else b=this.escape(this.innerXml(a));else if(e)if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));else{b=this.escape(this.innerXml(a));if(b==="__EMPTY_ARRAY_")b="[]";else if(b==="__EMPTY_STRING_")b=""}else if(f)if(f>1)b=this.escape(this.innerXml(a));else for(c=a.firstChild;c;c=c.nextSibling)if(h.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(c.nodeValue)}if(!a.attributes.length&&!a.firstChild)b=null}else if(a.nodeType===9)b=this.toObj(a.documentElement);
463
+ else alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,h,e){if(e===undefined)e=true;var f=b?'"'+b+'"':"",d="\t",c="\n";if(!e)c=d="";if(a==="[]")f+=b?":[]":"[]";else if(a instanceof Array){var i,g,k=[];g=0;for(i=a.length;g<i;g+=1)k[g]=this.toJson(a[g],"",h+d,e);f+=(b?":[":"[")+(k.length>1?c+h+d+k.join(","+c+h+d)+c+h:k.join(""))+"]"}else if(a===null)f+=(b&&":")+"null";else if(typeof a==="object"){i=[];for(g in a)if(a.hasOwnProperty(g))i[i.length]=this.toJson(a[g],g,h+d,e);f+=(b?
464
+ ":{":"{")+(i.length>1?c+h+d+i.join(","+c+h+d)+c+h:i.join(""))+"}"}else f+=typeof a==="string"?(b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(b&&":")+'"'+a.toString()+'"';return f},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var h=function(e){var f="",d;if(e.nodeType===1){f+="<"+e.nodeName;for(d=0;d<e.attributes.length;d+=1)f+=" "+e.attributes[d].nodeName+'="'+(e.attributes[d].nodeValue||"").toString()+'"';if(e.firstChild){f+=">";for(d=e.firstChild;d;d=d.nextSibling)f+=
465
+ h(d);f+="</"+e.nodeName+">"}else f+="/>"}else if(e.nodeType===3)f+=e.nodeValue;else if(e.nodeType===4)f+="<![CDATA["+e.nodeValue+"]]\>";return f};for(a=a.firstChild;a;a=a.nextSibling)b+=h(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(b.nodeType===3)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var h=b.nextSibling;a.removeChild(b);
466
+ b=h}else{b.nodeType===1&&this.removeWhite(b);b=b.nextSibling}return a}};
467
+ function tableToGrid(n,o){jQuery(n).each(function(){if(!this.grid){jQuery(this).width("99%");var a=jQuery(this).width(),d=jQuery("tr td:first-child input[type=checkbox]:first",jQuery(this)),b=jQuery("tr td:first-child input[type=radio]:first",jQuery(this));d=d.length>0;b=!d&&b.length>0;var l=d||b,c=[],g=[];jQuery("th",jQuery(this)).each(function(){if(c.length===0&&l){c.push({name:"__selection__",index:"__selection__",width:0,hidden:true});g.push("__selection__")}else{c.push({name:jQuery(this).attr("id")||
468
+ 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});g.push(jQuery(this).html())}});var f=[],h=[],i=[];jQuery("tbody > tr",jQuery(this)).each(function(){var j={},e=0;jQuery("td",jQuery(this)).each(function(){if(e===0&&l){var k=jQuery("input",jQuery(this)),m=k.attr("value");h.push(m||f.length);k.is(":checked")&&i.push(m);j[c[e].name]=
469
+ k.attr("value")}else j[c[e].name]=jQuery(this).html();e++});e>0&&f.push(j)});jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:a,colNames:g,colModel:c,multiselect:d},o||{}));for(a=0;a<f.length;a++){b=null;if(h.length>0)if((b=h[a])&&b.replace)b=encodeURIComponent(b).replace(/[.\-%]/g,"_");if(b===null)b=a+1;jQuery(this).jqGrid("addRowData",b,f[a])}for(a=0;a<i.length;a++)jQuery(this).jqGrid("setSelection",i[a])}})};
470
+ (function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(b){return b.offsetWidth===0||b.offsetHeight===0||b.style.display=="none"};a.jgrid._multiselect=false;if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var q=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(b,g){var c=q.call(this,b,g);if(g&&this.selectedList){var f=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(f)})}return c}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=
471
+ function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=true}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function g(){c.p.disableClick=true}var c=this,f=c.p.id;f={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+f+"_cb,#jqgh_"+f+"_rn,#jqgh_"+f+"_subgrid),:hidden)",placeholder:{element:function(h){return a(document.createElement(h[0].nodeName)).addClass(h[0].className+
472
+ " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(h,j){j.height(h.currentItem.innerHeight()-parseInt(h.currentItem.css("paddingTop")||0,10)-parseInt(h.currentItem.css("paddingBottom")||0,10));j.width(h.currentItem.innerWidth()-parseInt(h.currentItem.css("paddingLeft")||0,10)-parseInt(h.currentItem.css("paddingRight")||0,10))}},update:function(h,j){var i=a(j.item).parent();i=a(">th",i);var l={},m=c.p.id+"_";a.each(c.p.colModel,function(k){l[this.name]=
473
+ k});var d=[];i.each(function(){var k=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(m,"");k in l&&d.push(l[k])});a(c).jqGrid("remapColumns",d,true,true);a.isFunction(c.p.sortable.update)&&c.p.sortable.update(d);setTimeout(function(){c.p.disableClick=false},50)}};if(c.p.sortable.options)a.extend(f,c.p.sortable.options);else if(a.isFunction(c.p.sortable))c.p.sortable={update:c.p.sortable};if(f.start){var e=f.start;f.start=function(h,j){g();e.call(this,h,j)}}else f.start=g;if(c.p.sortable.exclude)f.items+=
474
+ ":not("+c.p.sortable.exclude+")";b.sortable(f).data("sortable").floating=true})},columnChooser:function(b){function g(d,k){if(d)if(typeof d=="string")a.fn[d]&&a.fn[d].apply(k,a.makeArray(arguments).slice(2));else a.isFunction(d)&&d.apply(k,a.makeArray(arguments).slice(2))}var c=this;if(!a("#colchooser_"+c[0].p.id).length){var f=a('<div id="colchooser_'+c[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),e=a("select",f);b=a.extend({width:420,
475
+ height:240,classname:null,done:function(d){d&&c.jqGrid("remapColumns",d,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(d){var k={};k[d.bSubmit]=function(){d.apply_perm();d.cleanup(false)};k[d.bCancel]=function(){d.cleanup(true)};return{buttons:k,close:function(){d.cleanup(true)},modal:d.modal?d.modal:false,resizable:d.resizable?d.resizable:true,width:d.width+20}},apply_perm:function(){a("option",e).each(function(){this.selected?c.jqGrid("showCol",h[this.value].name):c.jqGrid("hideCol",
476
+ h[this.value].name)});var d=[];a("option:selected",e).each(function(){d.push(parseInt(this.value,10))});a.each(d,function(){delete i[h[parseInt(this,10)].name]});a.each(i,function(){var k=parseInt(this,10);var p=d,o=k;if(o>=0){var n=p.slice(),r=n.splice(o,Math.max(p.length-o,o));if(o>p.length)o=p.length;n[o]=k;d=n.concat(r)}else d=void 0});b.done&&b.done.call(c,d)},cleanup:function(d){g(b.dlog,f,"destroy");g(b.msel,e,"destroy");f.remove();d&&b.done&&b.done.call(c)},msel_opts:{}},a.jgrid.col,b||{});
477
+ if(a.ui)if(a.ui.multiselect)if(b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}b.caption&&f.attr("title",b.caption);if(b.classname){f.addClass(b.classname);e.addClass(b.classname)}if(b.width){a(">div",f).css({width:b.width,margin:"0 auto"});e.css("width",b.width)}if(b.height){a(">div",f).css("height",b.height);e.css("height",b.height-10)}var h=
478
+ c.jqGrid("getGridParam","colModel"),j=c.jqGrid("getGridParam","colNames"),i={},l=[];e.empty();a.each(h,function(d){i[this.name]=d;if(this.hidedlg)this.hidden||l.push(d);else e.append("<option value='"+d+"' "+(this.hidden?"":"selected='selected'")+">"+j[d]+"</option>")});var m=a.isFunction(b.dlog_opts)?b.dlog_opts.call(c,b):b.dlog_opts;g(b.dlog,f,m);m=a.isFunction(b.msel_opts)?b.msel_opts.call(c,b):b.msel_opts;g(b.msel,e,m)}},sortableRows:function(b){return this.each(function(){var g=this;if(g.grid)if(!g.p.treeGrid)if(a.fn.sortable){b=
479
+ a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{});if(b.start&&a.isFunction(b.start)){b._start_=b.start;delete b.start}else b._start_=false;if(b.update&&a.isFunction(b.update)){b._update_=b.update;delete b.update}else b._update_=false;b.start=function(c,f){a(f.item).css("border-width","0px");a("td",f.item).each(function(j){this.style.width=g.grid.cols[j].style.width});if(g.p.subGrid){var e=a(f.item).attr("id");try{a(g).jqGrid("collapseSubGridRow",e)}catch(h){}}b._start_&&b._start_.apply(this,
480
+ [c,f])};b.update=function(c,f){a(f.item).css("border-width","");g.p.rownumbers===true&&a("td.jqgrid-rownum",g.rows).each(function(e){a(this).html(e+1+(parseInt(g.p.page,10)-1)*parseInt(g.p.rowNum,10))});b._update_&&b._update_.apply(this,[c,f])};a("tbody:first",g).sortable(b);a("tbody:first",g).disableSelection()}})},gridDnD:function(b){return this.each(function(){function g(){var e=a.data(c,"dnd");a("tr.jqgrow:not(.ui-draggable)",c).draggable(a.isFunction(e.drag)?e.drag.call(a(c),e):e.drag)}var c=
481
+ this;if(c.grid)if(!c.p.treeGrid)if(a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof b=="string"&&b=="updateDnD"&&c.p.jqgdnd===true)g();else{b=a.extend({drag:function(e){return a.extend({start:function(h,j){if(c.p.subGrid){var i=a(j.helper).attr("id");try{a(c).jqGrid("collapseSubGridRow",i)}catch(l){}}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("getGridParam",
482
+ "reccount")=="0"&&a(a.data(c,"dnd").connectWith[i]).jqGrid("addRowData","jqg_empty_row",{});j.helper.addClass("ui-state-highlight");a("td",j.helper).each(function(m){this.style.width=c.grid.headers[m].width+"px"});e.onstart&&a.isFunction(e.onstart)&&e.onstart.call(a(c),h,j)},stop:function(h,j){if(j.helper.dropped&&!e.dragcopy){var i=a(j.helper).attr("id");a(c).jqGrid("delRowData",i)}for(i=0;i<a.data(c,"dnd").connectWith.length;i++)a(a.data(c,"dnd").connectWith[i]).jqGrid("delRowData","jqg_empty_row");
483
+ e.onstop&&a.isFunction(e.onstop)&&e.onstop.call(a(c),h,j)}},e.drag_opts||{})},drop:function(e){return a.extend({accept:function(h){if(!a(h).hasClass("jqgrow"))return h;var j=a(h).closest("table.ui-jqgrid-btable");if(j.length>0&&a.data(j[0],"dnd")!==undefined){h=a.data(j[0],"dnd").connectWith;return a.inArray("#"+this.id,h)!=-1?true:false}return h},drop:function(h,j){if(a(j.draggable).hasClass("jqgrow")){var i=a(j.draggable).attr("id");i=j.draggable.parent().parent().jqGrid("getRowData",i);if(!e.dropbyname){var l=
484
+ 0,m={},d,k=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var p in i){if(i.hasOwnProperty(p)&&k[l]){d=k[l].name;m[d]=i[p]}l++}i=m}catch(o){}}j.helper.dropped=true;if(e.beforedrop&&a.isFunction(e.beforedrop)){d=e.beforedrop.call(this,h,j,i,a("#"+c.id),a(this));if(typeof d!="undefined"&&d!==null&&typeof d=="object")i=d}if(j.helper.dropped){var n;if(e.autoid)if(a.isFunction(e.autoid))n=e.autoid.call(this,i);else{n=Math.ceil(Math.random()*1E3);n=e.autoidprefix+n}a("#"+this.id).jqGrid("addRowData",
485
+ n,i,e.droppos)}e.ondrop&&a.isFunction(e.ondrop)&&e.ondrop.call(this,h,j,i)}}},e.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:false,dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},b||{});if(b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(e){return a.trim(e)});
486
+ a.data(c,"dnd",b);c.p.reccount!="0"&&!c.p.jqgdnd&&g();c.p.jqgdnd=true;for(var f=0;f<b.connectWith.length;f++)a(b.connectWith[f]).droppable(a.isFunction(b.drop)?b.drop.call(a(c),b):b.drop)}}}})},gridResize:function(b){return this.each(function(){var g=this;if(g.grid&&a.fn.resizable){b=a.extend({},b||{});if(b.alsoResize){b._alsoResize_=b.alsoResize;delete b.alsoResize}else b._alsoResize_=false;if(b.stop&&a.isFunction(b.stop)){b._stop_=b.stop;delete b.stop}else b._stop_=false;b.stop=function(c,f){a(g).jqGrid("setGridParam",
487
+ {height:a("#gview_"+g.p.id+" .ui-jqgrid-bdiv").height()});a(g).jqGrid("setGridWidth",f.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(g,c,f)};b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+g.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+g.p.id);delete b._alsoResize_;a("#gbox_"+g.p.id).resizable(b)}})}})})(jQuery);