jQuery.tableDnD={currentTable:null,dragObject:null,mouseOffset:null,oldY:0,build:function(a){this.each(function(){this.tableDnDConfig=jQuery.extend({onDragStyle:null,onDropStyle:null,onDragClass:"tDnD_whileDrag",onDrop:null,onDragStart:null,scrollAmount:5,serializeRegexp:/[^\-]*$/,serializeParamName:null,dragHandle:null},a||{});jQuery.tableDnD.makeDraggable(this)});jQuery(document).bind("mousemove",jQuery.tableDnD.mousemove).bind("mouseup",jQuery.tableDnD.mouseup);return this},makeDraggable:function(a){var c= a.tableDnDConfig;a.tableDnDConfig.dragHandle?jQuery("td."+a.tableDnDConfig.dragHandle,a).each(function(){jQuery(this).mousedown(function(e){jQuery.tableDnD.dragObject=this.parentNode;jQuery.tableDnD.currentTable=a;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,e);c.onDragStart&&c.onDragStart(a,this);return false})}):jQuery("tr",a).each(function(){var e=jQuery(this);e.hasClass("nodrag")||e.mousedown(function(b){if(b.target.tagName=="TD"){jQuery.tableDnD.dragObject=this;jQuery.tableDnD.currentTable= a;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,b);c.onDragStart&&c.onDragStart(a,this);return false}}).css("cursor","move")})},updateTables:function(){this.each(function(){this.tableDnDConfig&&jQuery.tableDnD.makeDraggable(this)})},mouseCoords:function(a){if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};return{x:a.clientX+document.body.scrollLeft-document.body.clientLeft,y:a.clientY+document.body.scrollTop-document.body.clientTop}},getMouseOffset:function(a,c){c=c||window.event; var e=this.getPosition(a),b=this.mouseCoords(c);return{x:b.x-e.x,y:b.y-e.y}},getPosition:function(a){var c=0,e=0;if(a.offsetHeight==0)a=a.firstChild;if(a&&a.offsetParent){for(;a.offsetParent;){c+=a.offsetLeft;e+=a.offsetTop;a=a.offsetParent}c+=a.offsetLeft;e+=a.offsetTop}return{x:c,y:e}},mousemove:function(a){if(jQuery.tableDnD.dragObject!=null){var c=jQuery(jQuery.tableDnD.dragObject),e=jQuery.tableDnD.currentTable.tableDnDConfig,b=jQuery.tableDnD.mouseCoords(a);a=b.y-jQuery.tableDnD.mouseOffset.y; var f=window.pageYOffset;if(document.all)if(typeof document.compatMode!="undefined"&&document.compatMode!="BackCompat")f=document.documentElement.scrollTop;else if(typeof document.body!="undefined")f=document.body.scrollTop;if(b.y-fjQuery.tableDnD.oldY;jQuery.tableDnD.oldY=a;e.onDragClass?c.addClass(e.onDragClass):c.css(e.onDragStyle);if(c=jQuery.tableDnD.findDropTargetRow(c,a))if(b&&jQuery.tableDnD.dragObject!=c)jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,c.nextSibling);else!b&&jQuery.tableDnD.dragObject!=c&&jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,c)}return false}},findDropTargetRow:function(a,c){for(var e=jQuery.tableDnD.currentTable.rows,b=0;bg-h&&c0)c+="&";var g=b[f].id; if(g&&g&&a.tableDnDConfig&&a.tableDnDConfig.serializeRegexp)g=g.match(a.tableDnDConfig.serializeRegexp)[0];c+=e+"[]="+g}return c},serializeTables:function(){var a="";this.each(function(){a+=jQuery.tableDnD.serializeTable(this)});return a}};jQuery.fn.extend({tableDnD:jQuery.tableDnD.build,tableDnDUpdate:jQuery.tableDnD.updateTables,tableDnDSerialize:jQuery.tableDnD.serializeTables}); (function(a){a.widget("ui.multiselect",{_init:function(){this.element.hide();this.id=this.element.attr("id");this.container=a('
').insertAfter(this.element);this.count=0;this.selectedContainer=a('
').appendTo(this.container);this.availableContainer=a('
').appendTo(this.container);this.selectedActions=a('
0 '+ a.ui.multiselect.locale.itemsCount+''+a.ui.multiselect.locale.removeAll+"
").appendTo(this.selectedContainer);this.availableActions=a('").appendTo(this.availableContainer);this.selectedList=a('
').bind("selectstart", function(){return false}).appendTo(this.selectedContainer);this.availableList=a('
').bind("selectstart",function(){return false}).appendTo(this.availableContainer);var c=this;this.container.width(this.element.width()+1);this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));this.selectedList.height(Math.max(this.element.height()- this.selectedActions.height(),1));this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));if(!this.options.animated){this.options.show="show";this.options.hide="hide"}this._populateLists(this.element.find("option"));this.options.sortable&&a("ul.selected").sortable({placeholder:"ui-state-highlight",axis:"y",update:function(){c.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(c.element)})},receive:function(e, b){b.item.data("optionLink").attr("selected",true);c.count+=1;c._updateCount();c.selectedList.children(".ui-draggable").each(function(){a(this).removeClass("ui-draggable");a(this).data("optionLink",b.item.data("optionLink"));a(this).data("idx",b.item.data("idx"));c._applyItemState(a(this),true)});setTimeout(function(){b.item.remove()},1)}});this.options.searchable?this._registerSearchEvents(this.availableContainer.find("input.search")):a(".search").hide();a(".remove-all").click(function(){c._populateLists(c.element.find("option").removeAttr("selected")); return false});a(".add-all").click(function(){c._populateLists(c.element.find("option").attr("selected","selected"));return false})},destroy:function(){this.element.show();this.container.remove();a.widget.prototype.destroy.apply(this,arguments)},_populateLists:function(c){this.selectedList.children(".ui-element").remove();this.availableList.children(".ui-element").remove();this.count=0;var e=this;a(c.map(function(b){var f=e._getOptionNode(this).appendTo(this.selected?e.selectedList:e.availableList).show(); if(this.selected)e.count+=1;e._applyItemState(f,this.selected);f.data("idx",b);return f[0]}));this._updateCount()},_updateCount:function(){this.selectedContainer.find("span.count").text(this.count+" "+a.ui.multiselect.locale.itemsCount)},_getOptionNode:function(c){c=a(c);var e=a('
  • '+c.text()+'
  • ').hide();e.data("optionLink",c);return e},_cloneWithData:function(c){var e= c.clone();e.data("optionLink",c.data("optionLink"));e.data("idx",c.data("idx"));return e},_setSelected:function(c,e){c.data("optionLink").attr("selected",e);if(e){var b=this._cloneWithData(c);c[this.options.hide](this.options.animated,function(){a(this).remove()});b.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);this._applyItemState(b,true);return b}else{var f=this.availableList.find("li"),g=this.options.nodeComparator;b=null;var h=c.data("idx"),j=g(c,a(f[h]));if(j)for(;h>= 0&&h0?h++:h--;if(j!=g(c,a(f[h]))){b=f[j>0?h:h+1];break}}else b=f[h];f=this._cloneWithData(c);b?f.insertBefore(a(b)):f.appendTo(this.availableList);c[this.options.hide](this.options.animated,function(){a(this).remove()});f.hide()[this.options.show](this.options.animated);this._applyItemState(f,false);return f}},_applyItemState:function(c,e){if(e){this.options.sortable?c.children("span").addClass("ui-icon-arrowthick-2-n-s").removeClass("ui-helper-hidden").addClass("ui-icon"):c.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"); c.find("a.action span").addClass("ui-icon-minus").removeClass("ui-icon-plus");this._registerRemoveEvents(c.find("a.action"))}else{c.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon");c.find("a.action span").addClass("ui-icon-plus").removeClass("ui-icon-minus");this._registerAddEvents(c.find("a.action"))}this._registerHoverEvents(c)},_filter:function(c){var e=a(this),b=c.children("li");c=b.map(function(){return a(this).text().toLowerCase()}); var f=a.trim(e.val().toLowerCase()),g=[];if(f){b.hide();c.each(function(h){this.indexOf(f)>-1&&g.push(h)});a.each(g,function(){a(b[this]).show()})}else b.show()},_registerHoverEvents:function(c){c.removeClass("ui-state-hover");c.mouseover(function(){a(this).addClass("ui-state-hover")});c.mouseout(function(){a(this).removeClass("ui-state-hover")})},_registerAddEvents:function(c){var e=this;c.click(function(){e._setSelected(a(this).parent(),true);e.count+=1;e._updateCount();return false}).each(function(){a(this).parent().draggable({connectToSortable:"ul.selected", helper:function(){var b=e._cloneWithData(a(this)).width(a(this).width()-50);b.width(a(this).width());return b},appendTo:".ui-multiselect",containment:".ui-multiselect",revert:"invalid"})})},_registerRemoveEvents:function(c){var e=this;c.click(function(){e._setSelected(a(this).parent(),false);e.count-=1;e._updateCount();return false})},_registerSearchEvents:function(c){var e=this;c.focus(function(){a(this).addClass("ui-state-active")}).blur(function(){a(this).removeClass("ui-state-active")}).keypress(function(b){if(b.keyCode== 13)return false}).keyup(function(){e._filter.apply(this,[e.availableList])})}});a.extend(a.ui.multiselect,{defaults:{sortable:true,searchable:true,animated:"fast",show:"slideDown",hide:"slideUp",dividerLocation:0.6,nodeComparator:function(c,e){var b=c.text(),f=e.text();return b==f?0:b").replace(/</g,"<").replace(/"/g,'"')},htmlEncode:function(c){return!c?c:String(c).replace(/&/g,"&").replace(/>/g,">").replace(/])*>/gi;if(c)return(c=c.replace(e,""))&&c!==" "&&c!==" "?c.replace(/\"/g,"'"):"";else return c},stringToDoc:function(c){var e;if(typeof c!=="string")return c;try{e=(new DOMParser).parseFromString(c,"text/xml")}catch(b){e=new ActiveXObject("Microsoft.XMLDOM"); e.async=false;e.loadXML(c)}return e&&e.documentElement&&e.documentElement.tagName!="parsererror"?e:null},parse:function(c){c=c;if(c.substr(0,9)=="while(1);")c=c.substr(9);if(c.substr(0,2)=="/*")c=c.substr(2,c.length-4);c||(c="{}");return a.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(c):eval("("+c+")")},parseDate:function(c,e){var b={m:1,d:1,y:1970,h:0,i:0,s:0},f,g,h;if(e&&e!==null&&e!==undefined){e=a.trim(e);e=e.split(/[\\\/:_;.,\t\T\s-]/);c=c.split(/[\\\/:_;.,\t\T\s-]/); var j=a.jgrid.formatter.date.monthNames,d=a.jgrid.formatter.date.AmPm,l=function(k,m){if(k===0){if(m==12)m=0}else if(m!=12)m+=12;return m};f=0;for(g=c.length;f11)e[f]=h+1-12}if(c[f]=="a"){h=a.inArray(e[f],d);if(h!==-1&&h<2&&e[f]==d[h]){e[f]=h;b.h=l(e[f],b.h)}}if(c[f]=="A"){h=a.inArray(e[f],d);if(h!==-1&&h>1&&e[f]==d[h]){e[f]=h-2;b.h=l(e[f],b.h)}}if(e[f]!==undefined)b[c[f].toLowerCase()]= parseInt(e[f],10)}b.m=parseInt(b.m,10)-1;f=b.y;if(f>=70&&f<=99)b.y=1900+b.y;else if(f>=0&&f<=69)b.y=2E3+b.y}return new Date(b.y,b.m,b.d,b.h,b.i,b.s,0)},jqID:function(c){c+="";return c.replace(/([\.\:\[\]])/g,"\\$1")},getAccessor:function(c,e){var b,f,g=[],h;if(typeof e==="function")return e(c);b=c[e];if(b===undefined)try{if(typeof e==="string")g=e.split(".");if(h=g.length)for(b=c;b&&h--;){f=g.shift();b=b[f]}}catch(j){}return b},ajaxOptions:{},from:function(c){return new function(e,b){if(typeof e== "string")e=a.data(e);var f=this,g=e,h=true,j=false,d=b,l=/[\$,%]/g,k=null,m=null,p=false,q="",v=[],r=true;if(typeof e=="object"&&e.push){if(e.length>0)r=typeof e[0]!="object"?false:true}else throw"data provides is not an array";this._hasData=function(){return g===null?false:g.length===0?false:true};this._getStr=function(n){var o=[];j&&o.push("jQuery.trim(");o.push("String("+n+")");j&&o.push(")");h||o.push(".toLowerCase()");return o.join("")};this._strComp=function(n){return typeof n=="string"?".toString()": ""};this._group=function(n,o){return{field:n.toString(),unique:o,items:[]}};this._toStr=function(n){if(j)n=a.trim(n);h||(n=n.toLowerCase());return n=n.toString().replace(RegExp('\\"',"g"),'\\"')};this._funcLoop=function(n){var o=[];a.each(g,function(s,A){o.push(n(A))});return o};this._append=function(n){if(d===null)d="";else d+=q===""?" && ":q;if(p)d+="!";d+="("+n+")";p=false;q=""};this._setCommand=function(n,o){k=n;m=o};this._resetNegate=function(){p=false};this._repeatCommand=function(n,o){if(k=== null)return f;if(n!=null&&o!=null)return k(n,o);if(m===null)return k(n);if(!r)return k(n);return k(m,n)};this._equals=function(n,o){return f._compare(n,o,1)===0};this._compare=function(n,o,s){if(s===undefined)s=1;if(n===undefined)n=null;if(o===undefined)o=null;if(n===null&&o===null)return 0;if(n===null&&o!==null)return 1;if(n!==null&&o===null)return-1;if(!h&&typeof n!=="number"&&typeof o!=="number"){n=String(n).toLowerCase();o=String(o).toLowerCase()}if(no)return s;return 0};this._performSort= function(){if(v.length!==0)g=f._doSort(g,0)};this._doSort=function(n,o){var s=v[o].by,A=v[o].dir,C=v[o].type,D=v[o].datefmt;if(o==v.length-1)return f._getOrder(n,s,A,C,D);o++;s=f._getGroup(n,s,A,C,D);A=[];for(C=0;C0};this.showQuery=function(n){var o=d;if(o===null)o="no query found"; if(a.isFunction(n)){n(o);return f}return o};this.andNot=function(n,o,s){p=!p;return f.and(n,o,s)};this.orNot=function(n,o,s){p=!p;return f.or(n,o,s)};this.not=function(n,o,s){return f.andNot(n,o,s)};this.and=function(n,o,s){q=" && ";if(n===undefined)return f;return f._repeatCommand(n,o,s)};this.or=function(n,o,s){q=" || ";if(n===undefined)return f;return f._repeatCommand(n,o,s)};this.isNot=function(n){p=!p;return f.is(n)};this.is=function(n){f._append("this."+n);f._resetNegate();return f};this._compareValues= function(n,o,s,A,C){var D;D=r?"this."+o:"this";if(s===undefined)s=null;s=s===null?o:s;switch(C.stype===undefined?"text":C.stype){case "int":case "integer":s=isNaN(Number(s))?"0":s;D="parseInt("+D+",10)";s="parseInt("+s+",10)";break;case "float":case "number":case "numeric":s=String(s).replace(l,"");s=isNaN(Number(s))?"0":s;D="parseFloat("+D+")";s="parseFloat("+s+")";break;case "date":case "datetime":s=String(a.jgrid.parseDate(C.newfmt||"Y-m-d",s).getTime());D='jQuery.jgrid.parseDate("'+C.srcfmt+'",'+ D+").getTime()";break;default:D=f._getStr(D);s=f._getStr('"'+f._toStr(s)+'"')}f._append(D+" "+A+" "+s);f._setCommand(n,o);f._resetNegate();return f};this.equals=function(n,o,s){return f._compareValues(f.equals,n,o,"==",s)};this.greater=function(n,o,s){return f._compareValues(f.greater,n,o,">",s)};this.less=function(n,o,s){return f._compareValues(f.less,n,o,"<",s)};this.greaterOrEquals=function(n,o,s){return f._compareValues(f.greaterOrEquals,n,o,">=",s)};this.lessOrEquals=function(n,o,s){return f._compareValues(f.lessOrEquals, n,o,"<=",s)};this.startsWith=function(n,o){var s=o===undefined||o===null?n:o;s=j?a.trim(s.toString()).length:s.toString().length;if(r)f._append(f._getStr("this."+n)+".substr(0,"+s+") == "+f._getStr('"'+f._toStr(o)+'"'));else{s=j?a.trim(o.toString()).length:o.toString().length;f._append(f._getStr("this")+".substr(0,"+s+") == "+f._getStr('"'+f._toStr(n)+'"'))}f._setCommand(f.startsWith,n);f._resetNegate();return f};this.endsWith=function(n,o){var s=o===undefined||o===null?n:o;s=j?a.trim(s.toString()).length: s.toString().length;r?f._append(f._getStr("this."+n)+".substr("+f._getStr("this."+n)+".length-"+s+","+s+') == "'+f._toStr(o)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(n)+'".length,"'+f._toStr(n)+'".length) == "'+f._toStr(n)+'"');f._setCommand(f.endsWith,n);f._resetNegate();return f};this.contains=function(n,o){r?f._append(f._getStr("this."+n)+'.indexOf("'+f._toStr(o)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(n)+'",0) > -1');f._setCommand(f.contains, n);f._resetNegate();return f};this.groupBy=function(n,o,s,A){if(!f._hasData())return null;return f._getGroup(g,n,o,s,A)};this.orderBy=function(n,o,s,A){o=o===undefined||o===null?"a":a.trim(o.toString().toLowerCase());if(s===null||s===undefined)s="text";if(A===null||A===undefined)A="Y-m-d";if(o=="desc"||o=="descending")o="d";if(o=="asc"||o=="ascending")o="a";v.push({by:n,dir:o,type:s,datefmt:A});return f};return f}(c,null)},extend:function(c){a.extend(a.fn.jqGrid,c);this.no_legacy_api||a.fn.extend(c)}}); a.fn.jqGrid=function(c){if(typeof c=="string"){var e=a.jgrid.getAccessor(a.fn.jqGrid,c);if(!e)throw"jqGrid - No such method: "+c;var b=a.makeArray(arguments).slice(1);return e.apply(this,b)}return this.each(function(){if(!this.grid){var f=a.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{}, jsonReader:{},subGrid:false,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false, treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5, subGridWidth:20,multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false, sortitems:[],sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{}},a.jgrid.defaults,c||{}),g={headers:[],cols:[],footers:[],dragStart:function(t,u,w){this.resizing={idx:t,startX:u.clientX,sOL:w[0]};this.hDiv.style.cursor="col-resize";this.curGbox=a("#rs_m"+a.jgrid.jqID(f.id),"#gbox_"+a.jgrid.jqID(f.id));this.curGbox.css({display:"block",left:w[0],top:w[1],height:w[2]});a.isFunction(f.resizeStart)&& f.resizeStart.call(this,u,t);document.onselectstart=function(){return false}},dragMove:function(t){if(this.resizing){var u=t.clientX-this.resizing.startX;t=this.headers[this.resizing.idx];var w=f.direction==="ltr"?t.width+u:t.width-u,E;if(w>33){this.curGbox.css({left:this.resizing.sOL+u});if(f.forceFit===true){E=this.headers[this.resizing.idx+f.nv];u=f.direction==="ltr"?E.width-u:E.width+u;if(u>33){t.newWidth=w;E.newWidth=u}}else{this.newWidth=f.direction==="ltr"?f.tblwidth+u:f.tblwidth-u;t.newWidth= w}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var t=this.resizing.idx,u=this.headers[t].newWidth||this.headers[t].width;u=parseInt(u,10);this.resizing=false;a("#rs_m"+a.jgrid.jqID(f.id)).css("display","none");f.colModel[t].width=u;this.headers[t].width=u;this.headers[t].el.style.width=u+"px";this.cols[t].style.width=u+"px";if(this.footers.length>0)this.footers[t].style.width=u+"px";if(f.forceFit===true){u=this.headers[t+f.nv].newWidth||this.headers[t+f.nv].width;this.headers[t+ f.nv].width=u;this.headers[t+f.nv].el.style.width=u+"px";this.cols[t+f.nv].style.width=u+"px";if(this.footers.length>0)this.footers[t+f.nv].style.width=u+"px";f.colModel[t+f.nv].width=u}else{f.tblwidth=this.newWidth||f.tblwidth;a("table:first",this.bDiv).css("width",f.tblwidth+"px");a("table:first",this.hDiv).css("width",f.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(f.footerrow){a("table:first",this.sDiv).css("width",f.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}a.isFunction(f.resizeStop)&& f.resizeStop.call(this,u,t)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var t=a(g.bDiv).height();if(t){var u=a("table:first",g.bDiv),w=a("> tbody > tr:gt(0):visible:first",u).outerHeight()||g.prevRowHeight;if(w){g.prevRowHeight=w;var E=f.rowNum,F=g.scrollTop=g.bDiv.scrollTop,N=Math.round(u.position().top)-F,M=N+u.height();w=w*E;var S,aa,H;if(M=0||aa<2||f.scroll===true){S=Math.round((M+F)/w)+1;N=-1}else N=1}if(N>0){S=parseInt(F/w,10)+1;aa=parseInt((F+t)/w,10)+2-S;H=true}if(aa)if(!(f.lastpage&&S>f.lastpage||f.lastpage==1))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,f.scrollTimeout);else{f.page=S;if(H){g.selectionPreserver(u[0]);g.emptyRows(g.bDiv,false)}g.populate(aa)}}}},scrollGrid:function(){if(f.scroll){var t=g.bDiv.scrollTop;if(g.scrollTop===undefined)g.scrollTop=0;if(t!=g.scrollTop){g.scrollTop= t;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,f.scrollTimeout)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(f.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft},selectionPreserver:function(t){var u=t.p,w=u.selrow,E=u.selarrrow?a.makeArray(u.selarrrow):null,F=t.grid.bDiv.scrollLeft,N=u.gridComplete;u.gridComplete=function(){u.selrow=null;u.selarrrow=[];if(u.multiselect&&E&&E.length>0)for(var M=0;M"),m,p=a.browser.msie?true:false,q=a.browser.safari?true:false;d= this;d.p.direction=a.trim(d.p.direction.toLowerCase());if(a.inArray(d.p.direction,["ltr","rtl"])==-1)d.p.direction="ltr";j=d.p.direction;a(k).insertBefore(this);a(this).appendTo(k).removeClass("scroll");var v=a("
    ");a(v).insertBefore(k).attr({id:"gbox_"+this.id,dir:j});a(k).appendTo(v).attr("id","gview_"+this.id);m=p&&a.browser.version<=6?'': "";a("
    ").append(m).insertBefore(k);a("
    "+this.p.loadtext+"
    ").insertBefore(k);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var r=function(t,u){t=parseInt(t,10);return isNaN(t)?u?u:0:t},n=function(t,u,w){var E=d.p.colModel[t],F=E.align,N='style="', M=E.classes,S=E.name;if(F)N+="text-align:"+F+";";if(E.hidden===true)N+="display:none;";if(u===0)N+="width: "+g.headers[t].width+"px;";N+='"'+(M!==undefined?' class="'+M+'"':"")+(E.title&&w?' title="'+a.jgrid.stripHtml(w)+'"':"");N+=' aria-describedby="'+d.p.id+"_"+S+'"';return N},o=function(t){return t===undefined||t===null||t===""?" ":d.p.autoencode?a.jgrid.htmlEncode(t):t+""},s=function(t,u,w,E,F){var N=d.p.colModel[w];if(typeof N.formatter!=="undefined"){t={rowId:t,colModel:N,gid:d.p.id,pos:w}; u=a.isFunction(N.formatter)?N.formatter.call(d,u,t,E,F):a.fmatter?a.fn.fmatter(N.formatter,u,t,E,F):o(u)}else u=o(u);return u},A=function(t,u,w,E,F){t=s(t,u,w,F,"add");return'"+t+""},C=function(t,u,w){t='';return'"+t+""},D=function(t,u,w,E){w=(parseInt(w,10)-1)*parseInt(E,10)+1+u;return'"+w+""},x=function(t){var u,w=[],E=0,F;for(F=0;Fdiv:first",t).css({height:"auto"}).children("div:first").css({height:0,display:"none"});t.scrollTop=0}},z=function(){var t=d.p.data.length,u,w,E;u=d.p.rownumbers===true?1:0;w=d.p.multiselect===true?1:0;E=d.p.subGrid===true?1:0;u=d.p.keyIndex===false||d.p.loadonce===true?d.p.localReader.id:d.p.colModel[d.p.keyIndex+w+E+u].name;for(w=0;w1?w:1;var H,K=0,O,X,fa=0,ea=0,Y=0,ja,Q=[],oa,ma={},ia,ga,pa=[],Ea=d.p.altRows===true?" "+d.p.altclass:"";d.p.xmlReader.repeatitems||(Q=x(aa));ja=d.p.keyIndex===false?d.p.xmlReader.id:d.p.keyIndex; if(Q.length>0&&!isNaN(ja)){if(d.p.remapColumns&&d.p.remapColumns.length)ja=a.inArray(ja,d.p.remapColumns);ja=Q[ja]}aa=(ja+"").indexOf("[")===-1?Q.length?function(xa,ra){return a(ja,xa).text()||ra}:function(xa,ra){return a(d.p.xmlReader.cell,xa).eq(ja).text()||ra}:function(xa,ra){return xa.getAttribute(ja.replace(/[\[\]]/g,""))||ra};d.p.userData={};a(d.p.xmlReader.page,t).each(function(){d.p.page=this.textContent||this.text||0});a(d.p.xmlReader.total,t).each(function(){d.p.lastpage=this.textContent|| this.text;if(d.p.lastpage===undefined)d.p.lastpage=1});a(d.p.xmlReader.records,t).each(function(){d.p.records=this.textContent||this.text||0});a(d.p.xmlReader.userdata,t).each(function(){d.p.userData[this.getAttribute("name")]=this.textContent||this.text});(t=a(d.p.xmlReader.root+" "+d.p.xmlReader.row,t))||(t=[]);var ya=t.length,sa=0;if(t&&ya){var Aa=parseInt(d.p.rowNum,10),Fa=d.p.scroll?(parseInt(d.p.page,10)-1)*Aa+1:1;if(F)Aa*=F+1;F=a.isFunction(d.p.afterInsertRow);var Ba={},Ha="";if(d.p.grouping&& d.p.groupingView.groupCollapse===true)Ha=' style="display:none;"';for(;sa');if(d.p.rownumbers===true){pa.push(D(0,sa,d.p.page,d.p.rowNum));Y=1}if(d.p.multiselect===true){pa.push(C(ga,Y,sa));fa=1}if(d.p.subGrid===true){pa.push(a(d).jqGrid("addSubGridCell",fa+Y,sa+w));ea=1}if(d.p.xmlReader.repeatitems){oa||(oa=B(fa+ea+Y));var Ja=a(d.p.xmlReader.cell, ia);a.each(oa,function(xa){var ra=Ja[this];if(!ra)return false;O=ra.textContent||ra.text;ma[d.p.colModel[xa+fa+ea+Y].name]=O;pa.push(A(ga,O,xa+fa+ea+Y,sa+w,ia))})}else for(H=0;H");if(d.p.grouping){H=d.p.groupingView.groupField.length;X=[];for(var Ia=0;Ia-1?d.p.treeANode:0;X=a(pa.join(""))[0];a(d.rows[sa+H]).after(X);try{a(d).jqGrid("setTreeNode",ma,X)}catch(La){}}else a("tbody:first",u).append(pa.join(""));if(d.p.subGrid===true)try{a(d).jqGrid("addSubGrid",d.rows[d.rows.length-1],fa+Y)}catch(Ma){}F&&d.p.afterInsertRow.call(d,ga,ma,ia);pa=[]}ma={};K++;sa++;if(K==Aa)break}}if(d.p.gridview===true)if(d.p.grouping){a(d).jqGrid("groupingRender",Ba,d.p.colModel.length);Ba=null}else a("tbody:first",u).append(pa.join("")); d.p.totaltime=new Date-N;if(K>0)if(d.p.records===0)d.p.records=ya;pa=null;if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop=0;d.p.reccount=K;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);if(M){d.p.records=ya;d.p.lastpage=Math.ceil(ya/Aa)}E||d.updatepager(false,true);if(M){for(;K1?w:1;var M,S,aa=d.p.datatype!="local"&&d.p.loadonce||d.p.datatype=="jsonstring";if(aa){d.p.data=[];d.p._index={};M=d.p.localReader.id="_id_"}d.p.reccount=0;if(d.p.datatype=="local"){u=d.p.localReader;S="local"}else{u=d.p.jsonReader; S="json"}var H=0,K,O,X,fa=[],ea,Y=0,ja=0,Q=0,oa,ma,ia={},ga;X=[];var pa=d.p.altRows===true?" "+d.p.altclass:"";d.p.page=a.jgrid.getAccessor(t,u.page)||0;oa=a.jgrid.getAccessor(t,u.total);d.p.lastpage=oa===undefined?1:oa;d.p.records=a.jgrid.getAccessor(t,u.records)||0;d.p.userData=a.jgrid.getAccessor(t,u.userdata)||{};u.repeatitems||(ea=fa=x(S));S=d.p.keyIndex===false?u.id:d.p.keyIndex;if(fa.length>0&&!isNaN(S)){if(d.p.remapColumns&&d.p.remapColumns.length)S=a.inArray(S,d.p.remapColumns);S=fa[S]}(ma= a.jgrid.getAccessor(t,u.root))||(ma=[]);oa=ma.length;t=0;var Ea=parseInt(d.p.rowNum,10),ya=d.p.scroll?(parseInt(d.p.page,10)-1)*Ea+1:1;if(F)Ea*=F+1;var sa=a.isFunction(d.p.afterInsertRow),Aa={},Fa="";if(d.p.grouping&&d.p.groupingView.groupCollapse===true)Fa=' style="display:none;"';for(;t');if(d.p.rownumbers===true){X.push(D(0,t,d.p.page,d.p.rowNum));Q=1}if(d.p.multiselect){X.push(C(ga,Q,t));Y=1}if(d.p.subGrid){X.push(a(d).jqGrid("addSubGridCell",Y+Q,t+w));ja=1}if(u.repeatitems){if(u.cell)F=a.jgrid.getAccessor(F,u.cell);ea||(ea=B(Y+ja+Q))}for(O=0;O");if(d.p.grouping){K=d.p.groupingView.groupField.length;O=[];for(var Ba=0;Ba-1?d.p.treeANode:0;X=a(X.join(""))[0];a(d.rows[t+K]).after(X);try{a(d).jqGrid("setTreeNode",ia,X)}catch(Ha){}}else a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").append(X.join(""));if(d.p.subGrid===true)try{a(d).jqGrid("addSubGrid",d.rows[d.rows.length-1],Y+Q)}catch(Ja){}sa&&d.p.afterInsertRow.call(d,ga,ia,F);X=[]}ia={};H++;t++;if(H==Ea)break}if(d.p.gridview=== true)d.p.grouping?a(d).jqGrid("groupingRender",Aa,d.p.colModel.length):a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").append(X.join(""));d.p.totaltime=new Date-N;if(H>0)if(d.p.records===0)d.p.records=oa;if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop=0;d.p.reccount=H;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);if(aa){d.p.records=oa;d.p.lastpage=Math.ceil(oa/Ea)}E||d.updatepager(false,true);if(aa){for(;H1)if(F.npage!==null){w[F.npage]=t;S=t-1;t=1}else N=function(H){d.p.page++;d.grid.hDiv.loading=false;M&&d.p.loadComplete.call(d,H);da(t-1)};else F.npage!==null&&delete d.p.postData[F.npage];if(d.p.grouping){a(d).jqGrid("groupingSetup");if(d.p.groupingView.groupDataSorted===true)w[F.sort]=d.p.groupingView.groupField[0]+" "+d.p.groupingView.groupOrder[0]+", "+w[F.sort]}a.extend(d.p.postData, w);var aa=!d.p.scroll?1:d.rows.length-1;if(a.isFunction(d.p.datatype))d.p.datatype.call(d,d.p.postData,"load_"+d.p.id);else{a.isFunction(d.p.beforeRequest)&&d.p.beforeRequest.call(d);E=d.p.datatype.toLowerCase();switch(E){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:d.p.url,type:d.p.mtype,dataType:E,data:a.isFunction(d.p.serializeGridData)?d.p.serializeGridData.call(d,d.p.postData):d.p.postData,success:function(H){E==="xml"?I(H,d.grid.bDiv,aa,t>1,S):L(H,d.grid.bDiv,aa,t> 1,S);N&&N.call(d,H);u&&d.grid.populateVisible();if(d.p.loadonce||d.p.treeGrid)d.p.datatype="local";ca()},error:function(H,K,O){a.isFunction(d.p.loadError)&&d.p.loadError.call(d,H,K,O);ca()},beforeSend:function(H){ha();a.isFunction(d.p.loadBeforeSend)&&d.p.loadBeforeSend.call(d,H)}},a.jgrid.ajaxOptions,d.p.ajaxGridOptions));break;case "xmlstring":ha();w=a.jgrid.stringToDoc(d.p.datastr);I(w,d.grid.bDiv);M&&d.p.loadComplete.call(d,w);d.p.datatype="local";d.p.datastr=null;ca();break;case "jsonstring":ha(); w=typeof d.p.datastr=="string"?a.jgrid.parse(d.p.datastr):d.p.datastr;L(w,d.grid.bDiv);M&&d.p.loadComplete.call(d,w);d.p.datatype="local";d.p.datastr=null;ca();break;case "local":case "clientside":ha();d.p.datatype="local";w=U();L(w,d.grid.bDiv,aa,t>1,S);N&&N.call(d,w);u&&d.grid.populateVisible();ca()}}}};m=function(t,u){var w="",E="",F="",N,M,S,aa,H=function(K){var O;if(a.isFunction(d.p.onPaging))O= d.p.onPaging.call(d,K);d.p.selrow=null;if(d.p.multiselect){d.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false)}d.p.savedRow=[];if(O=="stop")return false;return true};t=t.substr(1);N="pg_"+t;M=t+"_left";S=t+"_center";aa=t+"_right";a("#"+t).append("
    ").attr("dir","ltr");if(d.p.rowList.length>0){F="";F+=""}if(j=="rtl")E+=F;if(d.p.pginput===true)w=""+a.jgrid.format(d.p.pgtext|| "","","")+"";if(d.p.pgbuttons===true){M=["first"+u,"prev"+u,"next"+u,"last"+u];j=="rtl"&&M.reverse();E+="";E+="";E+=w!==""?""+ w+"":"";E+="";E+=""}else if(w!=="")E+=w;if(j=="ltr")E+=F;E+="";d.p.viewrecords===true&&a("td#"+t+"_"+d.p.recordpos,"#"+N).append("
    ");a("td#"+t+"_"+d.p.pagerpos,"#"+N).append(E);F=a(".ui-jqgrid").css("font-size")||"11px";a(document.body).append("");E=a(E).clone().appendTo("#testpg").width();a("#testpg").remove();if(E>0){if(w!="")E+=50;a("td#"+t+"_"+d.p.pagerpos,"#"+N).width(E)}d.p._nvtd=[];d.p._nvtd[0]=E?Math.floor((d.p.width-E)/2):Math.floor(d.p.width/3);d.p._nvtd[1]=0;E=null;a(".ui-pg-selbox", "#"+N).bind("change",function(){d.p.page=Math.round(d.p.rowNum*(d.p.page-1)/this.value-0.5)+1;d.p.rowNum=this.value;if(u)a(".ui-pg-selbox",d.p.pager).val(this.value);else d.p.toppager&&a(".ui-pg-selbox",d.p.toppager).val(this.value);if(!H("records"))return false;da();return false});if(d.p.pgbuttons===true){a(".ui-pg-button","#"+N).hover(function(){if(a(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{a(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!a(this).hasClass("ui-state-disabled")){a(this).removeClass("ui-state-hover"); this.style.cursor="default"}});a("#first"+u+", #prev"+u+", #next"+u+", #last"+u,"#"+t).click(function(){var K=r(d.p.page,1),O=r(d.p.lastpage,1),X=false,fa=true,ea=true,Y=true,ja=true;if(O===0||O===1)ja=Y=ea=fa=false;else if(O>1&&K>=1)if(K===1)ea=fa=false;else{if(!(K>1&&K1&&K===0){ja=Y=false;K=O-1}if(this.id==="first"+u&&fa){d.p.page=1;X=true}if(this.id==="prev"+u&&ea){d.p.page=K-1;X=true}if(this.id==="next"+u&&Y){d.p.page=K+1;X=true}if(this.id==="last"+u&&ja){d.p.page= O;X=true}if(X){if(!H(this.id))return false;da()}return false})}d.p.pginput===true&&a("input.ui-pg-input","#"+N).keypress(function(K){if((K.charCode?K.charCode:K.keyCode?K.keyCode:0)==13){d.p.page=a(this).val()>0?a(this).val():d.p.page;if(!H("user"))return false;da();return false}return this})};var qa=function(t,u,w,E){if(d.p.colModel[u].sortable)if(!(d.p.savedRow.length>0)){if(!w){if(d.p.lastsort==u)if(d.p.sortorder=="asc")d.p.sortorder="desc";else{if(d.p.sortorder=="desc")d.p.sortorder="asc"}else d.p.sortorder= d.p.colModel[u].firstsortorder||"asc";d.p.page=1}if(E)if(d.p.lastsort==u&&d.p.sortorder==E&&!w)return;else d.p.sortorder=E;w=a("thead:first",d.grid.hDiv).get(0);a("tr th:eq("+d.p.lastsort+") span.ui-grid-ico-sort",w).addClass("ui-state-disabled");a("tr th:eq("+d.p.lastsort+")",w).attr("aria-selected","false");a("tr th:eq("+u+") span.ui-icon-"+d.p.sortorder,w).removeClass("ui-state-disabled");a("tr th:eq("+u+")",w).attr("aria-selected","true");if(!d.p.viewsortcols[0])if(d.p.lastsort!=u){a("tr th:eq("+ d.p.lastsort+") span.s-ico",w).hide();a("tr th:eq("+u+") span.s-ico",w).show()}t=t.substring(5);d.p.sortname=d.p.colModel[u].index||t;w=d.p.sortorder;if(a.isFunction(d.p.onSortCol))if(d.p.onSortCol.call(d,t,u,w)=="stop"){d.p.lastsort=u;return}if(d.p.datatype=="local")d.p.deselectAfterSort&&a(d).jqGrid("resetSelection");else{d.p.selrow=null;d.p.multiselect&&a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false);d.p.selarrrow=[];d.p.savedRow=[]}if(d.p.scroll){w=d.grid.bDiv.scrollLeft;y(d.grid.bDiv, true);d.grid.hDiv.scrollLeft=w}d.p.subGrid&&d.p.datatype=="local"&&a("td.sgexpanded","#"+a.jgrid.jqID(d.p.id)).each(function(){a(this).trigger("click")});da();d.p.lastsort=u;if(d.p.sortname!=t&&u)d.p.lastsort=u}},ua=function(t){var u,w={},E=q?0:d.p.cellLayout;for(u=w[0]=w[1]=w[2]=0;u<=t;u++)if(d.p.colModel[u].hidden===false)w[0]+=d.p.colModel[u].width+E;if(d.p.direction=="rtl")w[0]=d.p.width-w[0];w[0]-=d.grid.bDiv.scrollLeft;if(a(d.grid.cDiv).is(":visible"))w[1]+=a(d.grid.cDiv).height()+parseInt(a(d.grid.cDiv).css("padding-top"), 10)+parseInt(a(d.grid.cDiv).css("padding-bottom"),10);if(d.p.toolbar[0]===true&&(d.p.toolbar[1]=="top"||d.p.toolbar[1]=="both"))w[1]+=a(d.grid.uDiv).height()+parseInt(a(d.grid.uDiv).css("border-top-width"),10)+parseInt(a(d.grid.uDiv).css("border-bottom-width"),10);if(d.p.toppager)w[1]+=a(d.grid.topDiv).height()+parseInt(a(d.grid.topDiv).css("border-bottom-width"),10);w[2]+=a(d.grid.bDiv).height()+a(d.grid.hDiv).height();return w};this.p.id=this.id;if(a.inArray(d.p.multikey,["shiftKey","altKey","ctrlKey"])== -1)d.p.multikey=false;d.p.keyIndex=false;for(h=0;h");this.p.colModel.unshift({name:"cb",width:q?d.p.multiselectWidth+d.p.cellLayout:d.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:d.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}d.p.xmlReader=a.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"}},d.p.xmlReader);d.p.jsonReader=a.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},d.p.jsonReader);d.p.localReader=a.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"}},d.p.localReader);if(d.p.scroll){d.p.pgbuttons=false;d.p.pginput=false;d.p.rowList=[]}d.p.data.length&&z();l="";var Da,G,J,T,P,V,R,W;G=W="";if(d.p.shrinkToFit===true&&d.p.forceFit===true)for(h=d.p.colModel.length-1;h>=0;h--)if(!d.p.colModel[h].hidden){d.p.colModel[h].resizable=false;break}if(d.p.viewsortcols[1]=="horizontal"){W=" ui-i-asc";G=" ui-i-desc"}Da=p?"class='ui-th-div-ie'":"";W="";for(h=0;h";G=d.p.colModel[h].index||d.p.colModel[h].name;l+= "
    "+d.p.colNames[h];d.p.colModel[h].width=d.p.colModel[h].width?parseInt(d.p.colModel[h].width,10):150;if(typeof d.p.colModel[h].title!=="boolean")d.p.colModel[h].title=true;if(G==d.p.sortname)d.p.lastsort=h;l+=W+"
    "}l+="";W=null;a(this).append(l);a("thead tr:first th",this).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});if(this.p.multiselect){var ka=[],Z;a("#cb_"+a.jgrid.jqID(d.p.id), this).bind("click",function(){d.p.selarrrow=[];if(this.checked){a("[id^=jqg_"+d.p.id+"_]").attr("checked","checked");a(d.rows).each(function(t){if(t>0)if(!a(this).hasClass("subgrid")&&!a(this).hasClass("jqgroup")){a(this).addClass("ui-state-highlight").attr("aria-selected","true");d.p.selarrrow.push(this.id);d.p.selrow=this.id}});Z=true;ka=[]}else{a("[id^=jqg_"+d.p.id+"_]").removeAttr("checked");a(d.rows).each(function(t){if(t>0)if(!a(this).hasClass("subgrid")){a(this).removeClass("ui-state-highlight").attr("aria-selected", "false");ka.push(this.id)}});d.p.selrow=null;Z=false}if(a.isFunction(d.p.onSelectAll))d.p.onSelectAll.call(d,Z?d.p.selarrrow:ka,Z)})}if(d.p.autowidth===true){l=a(v).innerWidth();d.p.width=l>0?l:"nw"}(function(){var t=0,u=d.p.cellLayout,w=0,E,F=d.p.scrollOffset,N,M=false,S,aa=0,H=0,K=0,O;if(q)u=0;a.each(d.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;if(this.hidden===false){t+=r(this.width,0);if(this.fixed){aa+=this.width;H+=this.width+u}else w++;K++}});if(isNaN(d.p.width))d.p.width= g.width=t;else g.width=d.p.width;d.p.tblwidth=t;if(d.p.shrinkToFit===false&&d.p.forceFit===true)d.p.forceFit=false;if(d.p.shrinkToFit===true&&w>0){S=g.width-u*w-H;if(!isNaN(d.p.height)){S-=F;M=true}t=0;a.each(d.p.colModel,function(X){if(this.hidden===false&&!this.fixed){this.width=N=Math.round(S*this.width/(d.p.tblwidth-aa));t+=N;E=X}});O=0;if(M){if(g.width-H-(t+u*w)!==F)O=g.width-H-(t+u*w)-F}else if(!M&&Math.abs(g.width-H-(t+u*w))!==1)O=g.width-H-(t+u*w);d.p.colModel[E].width+=O;d.p.tblwidth=t+O+ aa+K*u;if(d.p.tblwidth>d.p.width){d.p.colModel[E].width-=d.p.tblwidth-parseInt(d.p.width,10);d.p.tblwidth=d.p.width}}})();a(v).css("width",g.width+"px").append("
     
    ");a(k).css("width",g.width+"px");l=a("thead:first",d).get(0);var la="";if(d.p.footerrow)la+="";k=a("tr:first",l);var ba="";d.p.disableClick=false;a("th",k).each(function(t){J=d.p.colModel[t].width;if(typeof d.p.colModel[t].resizable==="undefined")d.p.colModel[t].resizable=true;if(d.p.colModel[t].resizable){T=document.createElement("span");a(T).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+j);a.browser.opera||a(T).css("cursor","col-resize");a(this).addClass(d.p.resizeclass)}else T="";a(this).css("width",J+"px").prepend(T); var u="";if(d.p.colModel[t].hidden){a(this).css("display","none");u="display:none;"}ba+="";g.headers[t]={width:J,el:this};P=d.p.colModel[t].sortable;if(typeof P!=="boolean")P=d.p.colModel[t].sortable=true;u=d.p.colModel[t].name;u=="cb"||u=="subgrid"||u=="rn"||d.p.viewsortcols[2]&&a("div",this).addClass("ui-jqgrid-sortable");if(P)if(d.p.viewsortcols[0]){a("div span.s-ico",this).show();t==d.p.lastsort&&a("div span.ui-icon-"+d.p.sortorder, this).removeClass("ui-state-disabled")}else if(t==d.p.lastsort){a("div span.s-ico",this).show();a("div span.ui-icon-"+d.p.sortorder,this).removeClass("ui-state-disabled")}if(d.p.footerrow)la+=""}).mousedown(function(t){if(a(t.target).closest("th>span.ui-jqgrid-resize").length==1){var u=a.jgrid.getCellIndex(this);if(d.p.forceFit===true){var w=d.p,E=u,F;for(F=u+1;F
     
    ").append(l);var $=d.p.caption&&d.p.hiddengrid===true?true:false;h=a("
    ");l=null;g.hDiv=document.createElement("div");a(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(h);a(h).append(k); k=null;$&&a(g.hDiv).hide();if(d.p.pager){if(typeof d.p.pager=="string"){if(d.p.pager.substr(0,1)!="#")d.p.pager="#"+d.p.pager}else d.p.pager="#"+a(d.p.pager).attr("id");a(d.p.pager).css({width:g.width+"px"}).appendTo(v).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");$&&a(d.p.pager).hide();m(d.p.pager,"")}d.p.cellEdit===false&&d.p.hoverrows===true&&a(d).bind("mouseover",function(t){R=a(t.target).closest("tr.jqgrow");a(R).attr("class")!=="subgrid"&&a(R).addClass("ui-state-hover");return false}).bind("mouseout", function(t){R=a(t.target).closest("tr.jqgrow");a(R).removeClass("ui-state-hover");return false});var va,na;a(d).before(g.hDiv).click(function(t){V=t.target;var u=a(V).hasClass("cbox");R=a(V,d.rows).closest("tr.jqgrow");if(a(R).length===0)return this;var w=true;if(a.isFunction(d.p.beforeSelectRow))w=d.p.beforeSelectRow.call(d,R[0].id,t);if(V.tagName=="A"||(V.tagName=="INPUT"||V.tagName=="TEXTAREA"||V.tagName=="OPTION"||V.tagName=="SELECT")&&!u)return this;if(w===true){if(d.p.cellEdit===true)if(d.p.multiselect&& u)a(d).jqGrid("setSelection",R[0].id,true);else{va=R[0].rowIndex;na=a.jgrid.getCellIndex(V);try{a(d).jqGrid("editCell",va,na,true)}catch(E){}}else if(d.p.multikey)if(t[d.p.multikey])a(d).jqGrid("setSelection",R[0].id,true);else{if(d.p.multiselect&&u){u=a("[id^=jqg_"+d.p.id+"_]").attr("checked");a("[id^=jqg_"+d.p.id+"_]").attr("checked",!u)}}else{if(d.p.multiselect&&d.p.multiboxonly)if(!u){a(d.p.selarrrow).each(function(F,N){var M=d.rows.namedItem(N);a(M).removeClass("ui-state-highlight");a("#jqg_"+ a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(N)).attr("checked",false)});d.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false)}a(d).jqGrid("setSelection",R[0].id,true)}if(a.isFunction(d.p.onCellSelect)){va=R[0].id;na=a.jgrid.getCellIndex(V);d.p.onCellSelect.call(d,va,na,a(V).html(),t)}t.stopPropagation()}else return this}).bind("reloadGrid",function(t,u){if(d.p.treeGrid===true)d.p.datatype=d.p.treedatatype;u&&u.current&&d.grid.selectionPreserver(d);if(d.p.datatype=="local"){a(d).jqGrid("resetSelection"); d.p.data.length&&z()}else if(!d.p.treeGrid){d.p.selrow=null;if(d.p.multiselect){d.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false)}d.p.savedRow=[]}d.p.scroll&&y(d.grid.bDiv,true);if(u&&u.page){var w=u.page;if(w>d.p.lastpage)w=d.p.lastpage;if(w<1)w=1;d.p.page=w;d.grid.bDiv.scrollTop=d.grid.prevRowHeight?(w-1)*d.grid.prevRowHeight*d.p.rowNum:0}if(d.grid.prevRowHeight&&d.p.scroll){delete d.p.lastpage;d.grid.populateVisible()}else d.grid.populate();return false});a.isFunction(this.p.ondblClickRow)&& a(this).dblclick(function(t){V=t.target;R=a(V,d.rows).closest("tr.jqgrow");if(a(R).length===0)return false;va=R[0].rowIndex;na=a.jgrid.getCellIndex(V);d.p.ondblClickRow.call(d,a(R).attr("id"),va,na,t);return false});a.isFunction(this.p.onRightClickRow);g.bDiv=document.createElement("div");a(g.bDiv).append(a('
    ').append("
    ").append(this)).addClass("ui-jqgrid-bdiv").css({height:d.p.height+(isNaN(d.p.height)? "":"px"),width:g.width+"px"}).scroll(g.scrollGrid);a("table:first",g.bDiv).css({width:d.p.tblwidth+"px"});if(p){a("tbody",this).size()==2&&a("tbody:gt(0)",this).remove();d.p.multikey&&a(g.bDiv).bind("selectstart",function(){return false})}else d.p.multikey&&a(g.bDiv).bind("mousedown",function(){return false});$&&a(g.bDiv).hide();g.cDiv=document.createElement("div");var ta=d.p.hidegrid===true?a("").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){ta.addClass("ui-state-hover")}, function(){ta.removeClass("ui-state-hover")}).append("").css(j=="rtl"?"left":"right","0px"):"";a(g.cDiv).append(ta).append(""+d.p.caption+"").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");a(g.cDiv).insertBefore(g.hDiv);if(d.p.toolbar[0]){g.uDiv=document.createElement("div");if(d.p.toolbar[1]=="top")a(g.uDiv).insertBefore(g.hDiv);else d.p.toolbar[1]== "bottom"&&a(g.uDiv).insertAfter(g.hDiv);if(d.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");a(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);a(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);$&&a(g.ubDiv).hide()}else a(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);$&&a(g.uDiv).hide()}if(d.p.toppager){d.p.toppager=a.jgrid.jqID(d.p.id)+"_toppager";g.topDiv= a("
    ")[0];d.p.toppager="#"+d.p.toppager;a(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);m(d.p.toppager,"_t")}if(d.p.footerrow){g.sDiv=a("
    ")[0];h=a("
    ");a(g.sDiv).append(h).insertAfter(g.hDiv).width(g.width);a(h).append(la);g.footers=a(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(d.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum"; $&&a(g.sDiv).hide()}h=null;if(d.p.caption){var Ga=d.p.datatype;if(d.p.hidegrid===true){a(".ui-jqgrid-titlebar-close",g.cDiv).click(function(t){var u=a.isFunction(d.p.onHeaderClick),w=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",E,F=this;if(d.p.toolbar[0]===true){if(d.p.toolbar[1]=="both")w+=", #"+a(g.ubDiv).attr("id");w+=", #"+a(g.uDiv).attr("id")}E=a(w,"#gview_"+a.jgrid.jqID(d.p.id)).length;if(d.p.gridstate=="visible")a(w,"#gbox_"+a.jgrid.jqID(d.p.id)).slideUp("fast",function(){E--; if(E==0){a("span",F).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");d.p.gridstate="hidden";a("#gbox_"+a.jgrid.jqID(d.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(d.p.id)).hide();if(u)$||d.p.onHeaderClick.call(d,d.p.gridstate,t)}});else d.p.gridstate=="hidden"&&a(w,"#gbox_"+a.jgrid.jqID(d.p.id)).slideDown("fast",function(){E--;if(E==0){a("span",F).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if($){d.p.datatype= Ga;da();$=false}d.p.gridstate="visible";a("#gbox_"+a.jgrid.jqID(d.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(d.p.id)).show();if(u)$||d.p.onHeaderClick.call(d,d.p.gridstate,t)}});return false});if($){d.p.datatype="local";a(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else a(g.cDiv).hide();a(g.hDiv).after(g.bDiv).mousemove(function(t){if(g.resizing){g.dragMove(t);return false}});a(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false}); a(document).mouseup(function(){if(g.resizing){g.dragEnd();return false}return true});d.formatCol=n;d.sortData=qa;d.updatepager=function(t,u){var w,E,F,N,M,S,aa,H="";F=parseInt(d.p.page,10)-1;if(F<0)F=0;F*=parseInt(d.p.rowNum,10);M=F+d.p.reccount;if(d.p.scroll){w=a("tbody:first > tr:gt(0)",d.grid.bDiv);F=M-w.length;d.p.reccount=w.length;if(E=w.outerHeight()||d.grid.prevRowHeight){w=F*E;E=parseInt(d.p.records,10)*E;a(">div:first",d.grid.bDiv).css({height:E}).children("div:first").css({height:w,display:w? "":"none"})}d.grid.bDiv.scrollLeft=d.grid.hDiv.scrollLeft}H=d.p.pager?d.p.pager:"";H+=d.p.toppager?H?","+d.p.toppager:d.p.toppager:"";if(H){aa=a.jgrid.formatter.integer||{};w=r(d.p.page);E=r(d.p.lastpage);a(".selbox",H).attr("disabled",false);if(d.p.pginput===true){a(".ui-pg-input",H).val(d.p.page);a("#sp_1",H).html(a.fmatter?a.fmatter.util.NumberFormat(d.p.lastpage,aa):d.p.lastpage)}if(d.p.viewrecords)if(d.p.reccount===0)a(".ui-paging-info",H).html(d.p.emptyrecords);else{N=F+1;S=d.p.records;if(a.fmatter){N= a.fmatter.util.NumberFormat(N,aa);M=a.fmatter.util.NumberFormat(M,aa);S=a.fmatter.util.NumberFormat(S,aa)}a(".ui-paging-info",H).html(a.jgrid.format(d.p.recordtext,N,M,S))}if(d.p.pgbuttons===true){if(w<=0)w=E=0;if(w==1||w===0){a("#first, #prev",d.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");d.p.toppager&&a("#first_t, #prev_t",d.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#first, #prev",d.p.pager).removeClass("ui-state-disabled");d.p.toppager&& a("#first_t, #prev_t",d.p.toppager).removeClass("ui-state-disabled")}if(w==E||w===0){a("#next, #last",d.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");d.p.toppager&&a("#next_t, #last_t",d.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#next, #last",d.p.pager).removeClass("ui-state-disabled");d.p.toppager&&a("#next_t, #last_t",d.p.toppager).removeClass("ui-state-disabled")}}}t===true&&d.p.rownumbers===true&&a("td.jqgrid-rownum",d.rows).each(function(K){a(this).html(F+ 1+K)});u&&d.p.jqgdnd&&a(d).jqGrid("gridDnD","updateDnD");a.isFunction(d.p.gridComplete)&&d.p.gridComplete.call(d)};d.refreshIndex=z;d.formatter=function(t,u,w,E,F){return s(t,u,w,E,F)};a.extend(g,{populate:da,emptyRows:y});this.grid=g;d.addXmlData=function(t){I(t,d.grid.bDiv)};d.addJSONData=function(t){L(t,d.grid.bDiv)};this.grid.cols=this.rows[0].cells;da();d.p.hiddengrid=false;a(window).unload(function(){d=null})}}}})};a.jgrid.extend({getGridParam:function(c){var e=this[0];if(e&&e.grid)return c? typeof e.p[c]!="undefined"?e.p[c]:null:e.p},setGridParam:function(c){return this.each(function(){this.grid&&typeof c==="object"&&a.extend(true,this.p,c)})},getDataIDs:function(){var c=[],e=0,b,f=0;this.each(function(){if((b=this.rows.length)&&b>0)for(;e=l+k)a(f.grid.bDiv)[0].scrollTop=m-(l+k)+d+k;else if(m=0&&b(g)}if(f.p.multiselect){f.p.selrow=h.id;j=a.inArray(f.p.selrow,f.p.selarrrow);if(j===-1){h.className!=="ui-subgrid"&&a(h).addClass("ui-state-highlight").attr("aria-selected","true");g=true;a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(f.p.selrow)).attr("checked", g);f.p.selarrrow.push(f.p.selrow)}else{h.className!=="ui-subgrid"&&a(h).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(f.p.selrow)).attr("checked",g);f.p.selarrrow.splice(j,1);j=f.p.selarrrow[0];f.p.selrow=j===undefined?null:j}f.p.onSelectRow&&e&&f.p.onSelectRow.call(f,h.id,g)}else if(h.className!=="ui-subgrid"){f.p.selrow&&a(f.rows.namedItem(f.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");if(f.p.selrow!= h.id){f.p.selrow=h.id;a(h).addClass("ui-state-highlight").attr("aria-selected","true");g=true}else{g=false;f.p.selrow=null}f.p.onSelectRow&&e&&f.p.onSelectRow.call(f,h.id,g)}}}})},resetSelection:function(){return this.each(function(){var c=this,e;if(c.p.multiselect){a(c.p.selarrrow).each(function(b,f){e=c.rows.namedItem(f);a(e).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(c.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",false)});a("#cb_"+a.jgrid.jqID(c.p.id)).attr("checked", false);c.p.selarrrow=[]}else if(c.p.selrow){a("#"+a.jgrid.jqID(c.p.id)+" tbody:first tr#"+a.jgrid.jqID(c.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");c.p.selrow=null}c.p.savedRow=[]})},getRowData:function(c){var e={},b,f=false,g,h=0;this.each(function(){var j=this,d,l;if(typeof c=="undefined"){f=true;b=[];g=j.rows.length}else{l=j.rows.namedItem(c);if(!l)return e;g=2}for(;h span:first",l).html(d).attr(h):a("td:eq("+v+")",l).html(d).attr(h)}});if(j.p.datatype=="local"){var p=j.p._index[c];if(typeof p!="undefined")j.p.data[p]= a.extend(true,j.p.data[p],m);m=null}}catch(q){g=false}if(g)if(k==="string")a(l).addClass(b);else k==="object"&&a(l).css(b)});return g},addRowData:function(c,e,b,f){b||(b="last");var g=false,h,j,d,l,k,m,p,q,v="",r,n,o,s,A;if(e){if(a.isArray(e)){r=true;b="last";n=c}else{e=[e];r=false}this.each(function(){var C=e.length;k=this.p.rownumbers===true?1:0;d=this.p.multiselect===true?1:0;l=this.p.subGrid===true?1:0;if(!r)if(typeof c!="undefined")c+="";else{c=this.p.records+1+"";if(this.p.keyIndex!==false){n= this.p.colModel[this.p.keyIndex+d+l+k].name;if(typeof e[0][n]!="undefined")c=e[0][n]}}o=this.p.altclass;for(var D=0,x="",B={},y=a.isFunction(this.p.afterInsertRow)?true:false;D0"}if(d){q='';v=this.formatCol(k,1,"");j+='"+q+""}if(l)j+=a(this).jqGrid("addSubGridCell",d+k,1);for(p=d+l+k;p"+q+""}j=''+j+"";if(this.p.subGrid===true){j=a(j)[0];a(this).jqGrid("addSubGrid",j,d+k)}if(this.rows.length===0)a("table:first",this.grid.bDiv).append(j);else switch(b){case "last":a(this.rows[this.rows.length-1]).after(j);break;case "first":a(this.rows[0]).after(j);break;case "after":if(m=this.rows.namedItem(f))a(this.rows[m.rowIndex+1]).hasClass("ui-subgrid")?a(this.rows[m.rowIndex+1]).after(j): a(m).after(j);break;case "before":if(m=this.rows.namedItem(f)){a(m).before(j);m=m.rowIndex}}this.p.records++;this.p.reccount++;y&&this.p.afterInsertRow.call(this,c,s,s);D++;if(this.p.datatype=="local"){this.p._index[c]=this.p.data.length;this.p.data.push(B);B={}}}if(this.p.altRows===true&&!r)if(b=="last")(this.rows.length-1)%2==1&&a(this.rows[this.rows.length-1]).addClass(o);else a(this.rows).each(function(I){I%2==1?a(this).addClass(o):a(this).removeClass(o)});this.updatepager(true,true);g=true})}return g}, footerData:function(c,e,b){function f(l){for(var k in l)if(l.hasOwnProperty(k))return false;return true}var g,h=false,j={},d;if(typeof c=="undefined")c="get";if(typeof b!="boolean")b=true;c=c.toLowerCase();this.each(function(){var l=this,k;if(!l.grid||!l.p.footerrow)return false;if(c=="set")if(f(e))return false;h=true;a(this.p.colModel).each(function(m){g=this.name;if(c=="set"){if(e[g]!==undefined){k=b?l.formatter("",e[g],m,e,"edit"):e[g];d=this.title?{title:a.jgrid.stripHtml(k)}:{};a("tr.footrow td:eq("+ m+")",l.grid.sDiv).html(k).attr(d);h=true}}else if(c=="get")j[g]=a("tr.footrow td:eq("+m+")",l.grid.sDiv).html()})});return c=="get"?j:h},ShowHideCol:function(c,e){return this.each(function(){var b=this,f=false;if(b.grid){if(typeof c==="string")c=[c];e=e!="none"?"":"none";var g=e===""?true:false;a(this.p.colModel).each(function(h){if(a.inArray(this.name,c)!==-1&&this.hidden===g){a("tr",b.grid.hDiv).each(function(){a(this).children("th:eq("+h+")").css("display",e)});a(b.rows).each(function(){a(this).children("td:eq("+ h+")").css("display",e)});b.p.footerrow&&a(b.grid.sDiv).children("td:eq("+h+")").css("display",e);if(e=="none")b.p.tblwidth-=this.width+b.p.cellLayout;else b.p.tblwidth+=this.width;this.hidden=!g;f=true}});if(f===true){a("table:first",b.grid.hDiv).width(b.p.tblwidth);a("table:first",b.grid.bDiv).width(b.p.tblwidth);b.grid.hDiv.scrollLeft=b.grid.bDiv.scrollLeft;if(b.p.footerrow){a("table:first",b.grid.sDiv).width(b.p.tblwidth);b.grid.sDiv.scrollLeft=b.grid.bDiv.scrollLeft}b.p.shrinkToFit===true&&a(b).jqGrid("setGridWidth", b.grid.width-0.0010,true)}}})},hideCol:function(c){return this.each(function(){a(this).jqGrid("ShowHideCol",c,"none")})},showCol:function(c){return this.each(function(){a(this).jqGrid("ShowHideCol",c,"")})},remapColumns:function(c,e,b){function f(j){var d;d=j.length?a.makeArray(j):a.extend({},j);a.each(c,function(l){j[l]=d[this]})}function g(j,d){a(">tr"+(d||""),j).each(function(){var l=this,k=a.makeArray(l.cells);a.each(c,function(){var m=k[this];m&&l.appendChild(m)})})}var h=this.get(0);f(h.p.colModel); f(h.p.colNames);f(h.grid.headers);g(a("thead:first",h.grid.hDiv),b&&":not(.ui-jqgrid-labels)");e&&g(a("#"+a.jgrid.jqID(h.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");h.p.footerrow&&g(a("tbody:first",h.grid.sDiv));if(h.p.remapColumns)if(h.p.remapColumns.length)f(h.p.remapColumns);else h.p.remapColumns=a.makeArray(c);h.p.lastsort=a.inArray(h.p.lastsort,c);if(h.p.treeGrid)h.p.expColInd=a.inArray(h.p.expColInd,c)},setGridWidth:function(c,e){return this.each(function(){if(this.grid){var b= this,f,g=0,h=b.p.cellLayout,j,d=0,l=false,k=b.p.scrollOffset,m,p=0,q=0,v=0,r;if(typeof e!="boolean")e=b.p.shrinkToFit;if(!isNaN(c)){c=parseInt(c,10);b.grid.width=b.p.width=c;a("#gbox_"+a.jgrid.jqID(b.p.id)).css("width",c+"px");a("#gview_"+a.jgrid.jqID(b.p.id)).css("width",c+"px");a(b.grid.bDiv).css("width",c+"px");a(b.grid.hDiv).css("width",c+"px");b.p.pager&&a(b.p.pager).css("width",c+"px");b.p.toppager&&a(b.p.toppager).css("width",c+"px");if(b.p.toolbar[0]===true){a(b.grid.uDiv).css("width",c+"px"); b.p.toolbar[1]=="both"&&a(b.grid.ubDiv).css("width",c+"px")}b.p.footerrow&&a(b.grid.sDiv).css("width",c+"px");if(e===false&&b.p.forceFit===true)b.p.forceFit=false;if(e===true){if(a.browser.safari)h=0;a.each(b.p.colModel,function(){if(this.hidden===false){g+=parseInt(this.width,10);if(this.fixed){q+=this.width;p+=this.width+h}else d++;v++}});if(d!==0){b.p.tblwidth=g;m=c-h*d-p;if(!isNaN(b.p.height))if(a(b.grid.bDiv)[0].clientHeight0;a.each(b.p.colModel,function(o){if(this.hidden===false&&!this.fixed){f=Math.round(m*this.width/(b.p.tblwidth-q));if(!(f<0)){this.width=f;g+=f;b.grid.headers[o].width=f;b.grid.headers[o].el.style.width=f+"px";if(b.p.footerrow)b.grid.footers[o].style.width=f+"px";if(n)b.grid.cols[o].style.width=f+"px";j=o}}});r=0;if(l){if(c-p-(g+h*d)!==k)r=c-p-(g+h*d)-k}else if(Math.abs(c-p-(g+h*d))!==1)r=c-p-(g+h*d);b.p.colModel[j].width+=r;b.p.tblwidth=g+r+q+h*v;if(b.p.tblwidth>c){l=b.p.tblwidth- parseInt(c,10);b.p.tblwidth=c;f=b.p.colModel[j].width-=l}else f=b.p.colModel[j].width;b.grid.headers[j].width=f;b.grid.headers[j].el.style.width=f+"px";if(n)b.grid.cols[j].style.width=f+"px";a("table:first",b.grid.bDiv).css("width",b.p.tblwidth+"px");a("table:first",b.grid.hDiv).css("width",b.p.tblwidth+"px");b.grid.hDiv.scrollLeft=b.grid.bDiv.scrollLeft;if(b.p.footerrow){b.grid.footers[j].style.width=f+"px";a("table:first",b.grid.sDiv).css("width",b.p.tblwidth+"px")}}}}}})},setGridHeight:function(c){return this.each(function(){if(this.grid){a(this.grid.bDiv).css({height:c+ (isNaN(c)?"":"px")});this.p.height=c;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(c){return this.each(function(){this.p.caption=c;a("span.ui-jqgrid-title",this.grid.cDiv).html(c);a(this.grid.cDiv).show()})},setLabel:function(c,e,b,f){return this.each(function(){var g=-1;if(this.grid){if(isNaN(c))a(this.p.colModel).each(function(d){if(this.name==c){g=d;return false}});else g=parseInt(c,10);if(g>=0){var h=a("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(e){var j=a(".s-ico", h);a("[id^=jqgh_]",h).empty().html(e).append(j);this.p.colNames[g]=e}if(b)typeof b==="string"?a(h).addClass(b):a(h).css(b);typeof f==="object"&&a(h).attr(f)}}})},setCell:function(c,e,b,f,g,h){return this.each(function(){var j=-1,d,l;if(this.grid){if(isNaN(e))a(this.p.colModel).each(function(m){if(this.name==e){j=m;return false}});else j=parseInt(e,10);if(j>=0)if(d=this.rows.namedItem(c)){var k=a("td:eq("+j+")",d);if(b!==""||h===true){d=this.formatter(c,b,j,d,"edit");l=this.p.colModel[j].title?{title:a.jgrid.stripHtml(d)}: {};this.p.treeGrid&&a(".tree-wrap",a(k)).length>0?a("span",a(k)).html(d).attr(l):a(k).html(d).attr(l);if(this.p.datatype=="local"){d=this.p.colModel[j];b=d.formatter&&typeof d.formatter==="string"&&d.formatter=="date"?a.unformat.date(b,d):b;l=this.p._index[c];if(typeof l!="undefined")this.p.data[l][d.name]=b}}if(typeof f==="string")a(k).addClass(f);else f&&a(k).css(f);typeof g==="object"&&a(k).attr(g)}}})},getCell:function(c,e){var b=false;this.each(function(){var f=-1;if(this.grid){if(isNaN(e))a(this.p.colModel).each(function(j){if(this.name=== e){f=j;return false}});else f=parseInt(e,10);if(f>=0){var g=this.rows.namedItem(c);if(g)try{b=a.unformat(a("td:eq("+f+")",g),{rowId:g.id,colModel:this.p.colModel[f]},f)}catch(h){b=a.jgrid.htmlDecode(a("td:eq("+f+")",g).html())}}}});return b},getCol:function(c,e,b){var f=[],g,h=0;e=typeof e!="boolean"?false:e;if(typeof b=="undefined")b=false;this.each(function(){var j=-1;if(this.grid){if(isNaN(c))a(this.p.colModel).each(function(m){if(this.name===c){j=m;return false}});else j=parseInt(c,10);if(j>= 0){var d=this.rows.length,l=0;if(d&&d>0){for(;l"+b.caption+"");var m=a("
    ").hover(function(){m.addClass("ui-state-hover")}, function(){m.removeClass("ui-state-hover")}).append("");a(k).append(m);if(d){j.dir="rtl";a(".ui-jqdialog-title",k).css("float","right");a(".ui-jqdialog-titlebar-close",k).css("left","0.3em")}else{j.dir="ltr";a(".ui-jqdialog-title",k).css("float","left");a(".ui-jqdialog-titlebar-close",k).css("right","0.3em")}var p=document.createElement("div");a(p).addClass("ui-jqdialog-content ui-widget-content").attr("id",c.modalcontent);a(p).append(e);j.appendChild(p); a(j).prepend(k);h===true?a("body").append(j):a(j).insertBefore(f);if(typeof b.jqModal==="undefined")b.jqModal=true;e={};if(a.fn.jqm&&b.jqModal===true){if(b.left===0&&b.top===0){p=[];p=this.findPos(g);b.left=p[0]+4;b.top=p[1]+4}e.top=b.top+"px";e.left=b.left}else if(b.left!==0||b.top!==0){e.left=b.left;e.top=b.top+"px"}a("a.ui-jqdialog-titlebar-close",k).click(function(){var r=a("#"+c.themodal).data("onClose")||b.onClose,n=a("#"+c.themodal).data("gbox")||b.gbox;l.hideModal("#"+c.themodal,{gb:n,jqm:b.jqModal, onClose:r});return false});if(b.width===0||!b.width)b.width=300;if(b.height===0||!b.height)b.height=200;if(!b.zIndex){f=a(f).parents("*[role=dialog]").first().css("z-index");b.zIndex=f?parseInt(f)+1:950}f=0;if(d&&e.left&&!h){f=a(b.gbox).width()-(!isNaN(b.width)?parseInt(b.width,10):0)-8;e.left=parseInt(e.left,10)+parseInt(f,10)}if(e.left)e.left+="px";a(j).css(a.extend({width:isNaN(b.width)?"auto":b.width+"px",height:isNaN(b.height)?"auto":b.height+"px",zIndex:b.zIndex,overflow:"hidden"},e)).attr({tabIndex:"-1", role:"dialog","aria-labelledby":c.modalhead,"aria-hidden":"true"});if(typeof b.drag=="undefined")b.drag=true;if(typeof b.resize=="undefined")b.resize=true;if(b.drag){a(k).css("cursor","move");if(a.fn.jqDrag)a(j).jqDrag(k);else try{a(j).draggable({handle:a("#"+k.id)})}catch(q){}}if(b.resize)if(a.fn.jqResize){a(j).append("
    ");a("#"+c.themodal).jqResize(".jqResize",c.scrollelm? "#"+c.scrollelm:false)}else try{a(j).resizable({handles:"se, sw",alsoResize:c.scrollelm?"#"+c.scrollelm:false})}catch(v){}b.closeOnEscape===true&&a(j).keydown(function(r){if(r.which==27){r=a("#"+c.themodal).data("onClose")||b.onClose;l.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:r})}})},viewModal:function(c,e){e=a.extend({toTop:true,overlay:10,modal:false,onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:true,jqM:true},e||{});if(a.fn.jqm&&e.jqm===true)e.jqM?a(c).attr("aria-hidden","false").jqm(e).jqmShow(): a(c).attr("aria-hidden","false").jqmShow();else{if(e.gbox!==""){a(".jqgrid-overlay:first",e.gbox).show();a(c).data("gbox",e.gbox)}a(c).show().attr("aria-hidden","false");try{a(":input:visible",c)[0].focus()}catch(b){}}},info_dialog:function(c,e,b,f){var g={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:""+c+"",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true,align:"center",buttonalign:"center",buttons:[]};a.extend(g,f||{});var h=g.jqModal,j= this;if(a.fn.jqm&&!h)h=false;c="";if(g.buttons.length>0)for(f=0;f"+g.buttons[f].text+""}f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";var d="
    ";d+="
    "+e+"
    ";d+=b?"
    "+b+""+c+"
    ":c!==""?"
    "+ c+"
    ":"";d+="
    ";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:h});a("#info_dialog").remove()}catch(l){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},d,g,"","",true);c&&a.each(g.buttons,function(m){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[m].onClick.call(a("#info_dialog"));return false})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:h}); 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(m){m.w.hide().remove();m.o&&m.o.remove()},modal:g.modal,jqm:h});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(k){}},createEl:function(c,e,b,f,g){function h(r,n){if(a.isFunction(n.dataInit)){r.id=n.id;n.dataInit(r);delete n.id;delete n.dataInit}if(n.dataEvents){a.each(n.dataEvents, function(){this.data!==undefined?a(r).bind(this.type,this.data,this.fn):a(r).bind(this.type,this.fn)});delete n.dataEvents}return n}var j="";e.defaultValue&&delete e.defaultValue;switch(c){case "textarea":j=document.createElement("textarea");if(f)e.cols||a(j).css({width:"98%"});else if(!e.cols)e.cols=20;if(!e.rows)e.rows=2;if(b==" "||b==" "||b.length==1&&b.charCodeAt(0)==160)b="";j.value=b;e=h(j,e);a(j).attr(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":j=document.createElement("input"); j.type="checkbox";if(e.value){var d=e.value.split(":");if(b===d[0]){j.checked=true;j.defaultChecked=true}j.value=d[0];a(j).attr("offval",d[1]);try{delete e.value}catch(l){}}else{d=b.toLowerCase();if(d.search(/(false|0|no|off|undefined)/i)<0&&d!==""){j.checked=true;j.defaultChecked=true;j.value=b}else j.value="on";a(j).attr("offval","off")}e=h(j,e);a(j).attr(e).attr("role","checkbox");break;case "select":j=document.createElement("select");j.setAttribute("role","select");var k,m=[];if(e.multiple=== true){k=true;j.multiple="multiple";a(j).attr("aria-multiselectable","true")}else k=false;if(typeof e.dataUrl!="undefined")a.ajax(a.extend({url:e.dataUrl,type:"GET",dataType:"html",success:function(r){try{delete e.dataUrl;delete e.value}catch(n){}if(typeof e.buildSelect!="undefined"){r=e.buildSelect(r);r=a(r).html();delete e.buildSelect}else r=a(r).html();if(r){a(j).append(r);e=h(j,e);if(typeof e.size==="undefined")e.size=k?3:1;if(k){m=b.split(",");m=a.map(m,function(o){return a.trim(o)})}else m[0]= a.trim(b);a(j).attr(e);setTimeout(function(){a("option",j).each(function(o){if(o===0)this.selected="";a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),m)>-1||a.inArray(a.trim(a(this).val()),m)>-1){this.selected="selected";if(!k)return false}})},0)}}},g||{}));else if(e.value){if(k){m=b.split(",");m=a.map(m,function(r){return a.trim(r)});if(typeof e.size==="undefined")e.size=3}else e.size=1;if(typeof e.value==="function")e.value=e.value();if(typeof e.value==="string"){f=e.value.split(";"); for(d=0;d2)g[1]=a.map(g,function(r,n){if(n>0)return r}).join(":");c=document.createElement("option");c.setAttribute("role","option");c.value=g[0];c.innerHTML=g[1];if(!k&&(a.trim(g[0])==a.trim(b)||a.trim(g[1])==a.trim(b)))c.selected="selected";if(k&&(a.inArray(a.trim(g[1]),m)>-1||a.inArray(a.trim(g[0]),m)>-1))c.selected="selected";j.appendChild(c)}}else if(typeof e.value==="object"){f=e.value;for(d in f)if(f.hasOwnProperty(d)){c=document.createElement("option"); c.setAttribute("role","option");c.value=d;c.innerHTML=f[d];if(!k&&(a.trim(d)==a.trim(b)||a.trim(f[d])==a.trim(b)))c.selected="selected";if(k&&(a.inArray(a.trim(f[d]),m)>-1||a.inArray(a.trim(d),m)>-1))c.selected="selected";j.appendChild(c)}}e=h(j,e);try{delete e.value}catch(p){}a(j).attr(e)}break;case "text":case "password":case "button":d=c=="button"?"button":"textbox";j=document.createElement("input");j.type=c;j.value=b;e=h(j,e);if(c!="button")if(f)e.size||a(j).css({width:"98%"});else if(!e.size)e.size= 20;a(j).attr(e).attr("role",d);break;case "image":case "file":j=document.createElement("input");j.type=c;e=h(j,e);a(j).attr(e);break;case "custom":j=document.createElement("span");try{if(a.isFunction(e.custom_element)){var q=e.custom_element.call(this,b,e);if(q){q=a(q).addClass("customelement").attr({id:e.id,name:e.name});a(j).empty().append(q)}else throw"e2";}else throw"e1";}catch(v){v=="e1"&&this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose); v=="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 v==="string"?v:v.message,a.jgrid.edit.bClose)}}return j},checkDate:function(c,e){var b={},f;c=c.toLowerCase();f=c.indexOf("/")!=-1?"/":c.indexOf("-")!=-1?"-":c.indexOf(".")!=-1?".":"/";c=c.split(f);e=e.split(f);if(e.length!=3)return false;f=-1;for(var g,h=-1,j=-1,d=0;d12)return false}if(h===-1)return false;else{l= b[c[h]].toString();if(l.length<1||b[c[h]]<1||b[c[h]]>31||b[c[j]]==2&&b[c[h]]>(b[c[f]]%4===0&&(b[c[f]]%100!==0||b[c[f]]%400===0)?29:28)||b[c[h]]>d[b[c[j]]])return false}return true},isEmpty:function(c){return c.match(/^\s+$/)||c===""?true:false},checkTime:function(c){var e=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(c))if(c=c.match(e)){if(c[3]){if(c[1]<1||c[1]>12)return false}else if(c[1]>23)return false;if(c[2]>59)return false}else return false;return true},checkValues:function(c,e,b){var f,g, h,j;if(typeof e=="string"){g=0;for(j=b.p.colModel.length;g=0)f=b.p.colModel[e].editrules;if(f){h||(h=b.p.colNames[e]);if(f.required===true)if(this.isEmpty(c))return[false,h+": "+a.jgrid.edit.msg.required,""];g=f.required===false?false:true;if(f.number===true)if(!(g===false&&this.isEmpty(c)))if(isNaN(c))return[false,h+": "+a.jgrid.edit.msg.number,""];if(typeof f.minValue!= "undefined"&&!isNaN(f.minValue))if(parseFloat(c)parseFloat(f.maxValue))return[false,h+": "+a.jgrid.edit.msg.maxValue+" "+f.maxValue,""];if(f.email===true)if(!(g===false&&this.isEmpty(c))){j=/^((([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; if(!j.test(c))return[false,h+": "+a.jgrid.edit.msg.email,""]}if(f.integer===true)if(!(g===false&&this.isEmpty(c))){if(isNaN(c))return[false,h+": "+a.jgrid.edit.msg.integer,""];if(c%1!==0||c.indexOf(".")!=-1)return[false,h+": "+a.jgrid.edit.msg.integer,""]}if(f.date===true)if(!(g===false&&this.isEmpty(c))){e=b.p.colModel[e].formatoptions&&b.p.colModel[e].formatoptions.newformat?b.p.colModel[e].formatoptions.newformat:b.p.colModel[e].datefmt||"Y-m-d";if(!this.checkDate(e,c))return[false,h+": "+a.jgrid.edit.msg.date+ " - "+e,""]}if(f.time===true)if(!(g===false&&this.isEmpty(c)))if(!this.checkTime(c))return[false,h+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(f.url===true)if(!(g===false&&this.isEmpty(c))){j=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!j.test(c))return[false,h+": "+a.jgrid.edit.msg.url,""]}if(f.custom===true)if(!(g===false&&this.isEmpty(c)))if(a.isFunction(f.custom_func)){c=f.custom_func.call(b,c,h);return a.isArray(c)? c:[false,a.jgrid.edit.msg.customarray,""]}else return[false,a.jgrid.edit.msg.customfcheck,""]}return[true,"",""]}})})(jQuery); (function(a){var c=null;a.jgrid.extend({searchGrid:function(e){e=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,cloneSearchRowOnAdd:true,sopt:null,stringResult:undefined,onClose:null,useDataProxy:false,overlay:true},a.jgrid.search,e||{});return this.each(function(){function b(C, D){var x=C.p.postData[D.sFilter];if(typeof x=="string")x=a.jgrid.parse(x);if(x){x.groupOp&&C.SearchFilter.setGroupOp(x.groupOp);if(x.rules){var B,y=0,z=x.rules.length;for(B=false;y1){var D=a("#"+l).css("zIndex");a("#"+l).css({zIndex:parseInt(D,10)+C})}a("#"+l).show();e.overlay===true&&a(".jqgrid-overlay:first","#gbox_"+d.p.id).show();try{a(":input:visible","#"+l)[0].focus()}catch(x){}}function h(C){var D=C!==undefined,x=a("#"+d.p.id),B={};if(e.multipleSearch===false){B[e.sField]=C.rules[0].field;B[e.sValue]=C.rules[0].data;B[e.sOper]=C.rules[0].op}else B[e.sFilter]=C;x[0].p.search=D;a.extend(x[0].p.postData, B);x.trigger("reloadGrid",[{page:1}]);e.closeAfterSearch&&f(a("#"+l))}function j(C){C=C&&C.hasOwnProperty("reload")?C.reload:true;var D=a("#"+d.p.id),x={};D[0].p.search=false;if(e.multipleSearch===false)x[e.sField]=x[e.sValue]=x[e.sOper]="";else x[e.sFilter]="";a.extend(D[0].p.postData,x);C&&D.trigger("reloadGrid",[{page:1}]);e.closeAfterReset&&f(a("#"+l))}var d=this;if(d.grid){var l="fbox_"+d.p.id,k=true;if(a.fn.searchFilter){e.recreateFilter===true&&a("#"+l).remove();if(a("#"+l).html()!=null){if(a.isFunction(e.beforeShowSearch)){k= e.beforeShowSearch(a("#"+l));if(typeof k=="undefined")k=true}if(k!==false){g();a.isFunction(e.afterShowSearch)&&e.afterShowSearch(a("#"+l))}}else{var m=[],p=a("#"+d.p.id).jqGrid("getGridParam","colNames"),q=a("#"+d.p.id).jqGrid("getGridParam","colModel"),v=["eq","ne","lt","le","gt","ge","bw","bn","in","ni","ew","en","cn","nc"],r,n,o,s=[];if(e.sopt!==null)for(r=o=0;r0)for(r=0;r0){a("").insertBefore("#gview_"+d.p.id);if(e.stringResult===undefined)e.stringResult=e.multipleSearch; d.SearchFilter=a("#"+l).searchFilter(m,{groupOps:e.groupOps,operators:s,onClose:f,resetText:e.Reset,searchText:e.Find,windowTitle:e.caption,rulesText:e.rulesText,matchText:e.matchText,onSearch:h,onReset:j,stringResult:e.stringResult,ajaxSelectOptions:a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}),clone:e.cloneSearchRowOnAdd});a(".ui-widget-overlay","#"+l).remove();d.p.direction=="rtl"&&a(".ui-closer","#"+l).css("float","left");if(e.drag===true){a("#"+l+" table thead tr:first td:first").css("cursor", "move");if(jQuery.fn.jqDrag)a("#"+l).jqDrag(a("#"+l+" table thead tr:first td:first"));else try{a("#"+l).draggable({handle:a("#"+l+" table thead tr:first td:first")})}catch(A){}}if(e.multipleSearch===false){a(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText","#"+l).hide();a("select[name='groupOp']","#"+l).hide()}e.multipleSearch===true&&e.loadDefaults===true&&b(d,e);a.isFunction(e.onInitializeSearch)&&e.onInitializeSearch(a("#"+l));if(a.isFunction(e.beforeShowSearch)){k=e.beforeShowSearch(a("#"+ l));if(typeof k=="undefined")k=true}if(k!==false){g();a.isFunction(e.afterShowSearch)&&e.afterShowSearch(a("#"+l));e.closeOnEscape===true&&a("#"+l).keydown(function(C){C.which==27&&f(a("#"+l));C.which==13&&a(".ui-search",this).click()})}}}}}})},editGridRow:function(e,b){c=b=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:false,overlay:10,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,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||{});return this.each(function(){function f(){a(".FormElement", "#"+n).each(function(){var G=a(".customelement",this);if(G.length){var J=a(G[0]).attr("name");a.each(q.p.colModel,function(){if(this.name==J&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{z[J]=this.editoptions.custom_value(a("#"+J,"#"+n),"get");if(z[J]===undefined)throw"e1";}catch(P){P=="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,P.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).attr("checked"))z[this.name]= a(this).val();else{G=a(this).attr("offval");z[this.name]=G}break;case "select-one":z[this.name]=a("option:selected",this).val();I[this.name]=a("option:selected",this).text();break;case "select-multiple":z[this.name]=a(this).val();z[this.name]=z[this.name]?z[this.name].join(","):"";var T=[];a("option:selected",this).each(function(P,V){T[P]=a(V).text()});I[this.name]=T.join(",");break;case "password":case "text":case "textarea":case "button":z[this.name]=a(this).val()}if(q.p.autoencode)z[this.name]= a.jgrid.htmlEncode(z[this.name])}});return true}function g(G,J,T,P){for(var V,R,W,ka=0,Z,la,ba,wa=[],$=false,va="",na=1;na<=P;na++)va+="  ";if(G!="_empty")$=a(J).jqGrid("getInd",G);a(J.p.colModel).each(function(ta){V=this.name;la=(R=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if(V!=="cb"&&V!=="subgrid"&&this.editable===true&&V!=="rn"){if($===false)Z="";else if(V==J.p.ExpandColumn&& J.p.treeGrid===true)Z=a("td:eq("+ta+")",J.rows[$]).text();else try{Z=a.unformat(a("td:eq("+ta+")",J.rows[$]),{rowId:G,colModel:this},ta)}catch(Ga){Z=a("td:eq("+ta+")",J.rows[$]).html()}var t=a.extend({},this.editoptions||{},{id:V,name:V}),u=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),w=parseInt(u.rowpos,10)||ka+1,E=parseInt((parseInt(u.colpos,10)||1)*2,10);if(G=="_empty"&&t.defaultValue)Z=a.isFunction(t.defaultValue)?t.defaultValue():t.defaultValue;if(!this.edittype)this.edittype= "text";if(q.p.autoencode)Z=a.jgrid.htmlDecode(Z);ba=a.jgrid.createEl(this.edittype,t,Z,false,a.extend({},a.jgrid.ajaxOptions,J.p.ajaxSelectOptions||{}));if(Z===""&&this.edittype=="checkbox")Z=a(ba).attr("offval");if(Z===""&&this.edittype=="select")Z=a("option:eq(0)",ba).text();if(c.checkOnSubmit||c.checkOnUpdate)c._savedData[V]=Z;a(ba).addClass("FormElement");if(this.edittype=="text"||this.edittype=="textarea")a(ba).addClass("ui-widget-content ui-corner-all");W=a(T).find("tr[rowpos="+w+"]");if(u.rowabove){t= a(""+u.rowcontent+"");a(T).append(t);t[0].rp=w}if(W.length===0){W=a("").addClass("FormData").attr("id","tr_"+V);a(W).append(va);a(T).append(W);W[0].rp=w}a("td:eq("+(E-2)+")",W[0]).html(typeof u.label==="undefined"?J.p.colNames[ta]:u.label);a("td:eq("+(E-1)+")",W[0]).append(u.elmprefix).append(ba).append(u.elmsuffix);wa[ka]=ta;ka++}});if(ka>0){na=a("");na[0].rp=ka+999;a(T).append(na);if(c.checkOnSubmit||c.checkOnUpdate)c._savedData[J.p.id+"_id"]=G}return wa}function h(G,J,T){var P,V=0,R,W,ka,Z,la;if(c.checkOnSubmit||c.checkOnUpdate){c._savedData={};c._savedData[J.p.id+"_id"]=G}var ba=J.p.colModel;if(G=="_empty"){a(ba).each(function(){P=this.name;ka=a.extend({},this.editoptions||{});W=a("#"+a.jgrid.jqID(P),"#"+T);if(W[0]!=null){Z= "";if(ka.defaultValue){Z=a.isFunction(ka.defaultValue)?ka.defaultValue():ka.defaultValue;if(W[0].type=="checkbox"){la=Z.toLowerCase();if(la.search(/(false|0|no|off|undefined)/i)<0&&la!==""){W[0].checked=true;W[0].defaultChecked=true;W[0].value=Z}else W.attr({checked:"",defaultChecked:""})}else W.val(Z)}else if(W[0].type=="checkbox"){W[0].checked=false;W[0].defaultChecked=false;Z=a(W).attr("offval")}else if(W[0].type&&W[0].type.substr(0,6)=="select")W[0].selectedIndex=0;else W.val(Z);if(c.checkOnSubmit=== true||c.checkOnUpdate)c._savedData[P]=Z}});a("#id_g","#"+T).val(G)}else{var wa=a(J).jqGrid("getInd",G,true);if(wa){a("td",wa).each(function($){P=ba[$].name;if(P!=="cb"&&P!=="subgrid"&&P!=="rn"&&ba[$].editable===true){if(P==J.p.ExpandColumn&&J.p.treeGrid===true)R=a(this).text();else try{R=a.unformat(a(this),{rowId:G,colModel:ba[$]},$)}catch(va){R=a(this).html()}if(q.p.autoencode)R=a.jgrid.htmlDecode(R);if(c.checkOnSubmit===true||c.checkOnUpdate)c._savedData[P]=R;P=a.jgrid.jqID(P);switch(ba[$].edittype){case "password":case "text":case "button":case "image":a("#"+ P,"#"+T).val(R);break;case "textarea":if(R==" "||R==" "||R.length==1&&R.charCodeAt(0)==160)R="";a("#"+P,"#"+T).val(R);break;case "select":var na=R.split(",");na=a.map(na,function(Ga){return a.trim(Ga)});a("#"+P+" option","#"+T).each(function(){this.selected=!ba[$].editoptions.multiple&&(na[0]==a.trim(a(this).text())||na[0]==a.trim(a(this).val()))?true:ba[$].editoptions.multiple?a.inArray(a.trim(a(this).text()),na)>-1||a.inArray(a.trim(a(this).val()),na)>-1?true:false:false});break;case "checkbox":R+= "";if(ba[$].editoptions&&ba[$].editoptions.value)if(ba[$].editoptions.value.split(":")[0]==R){a("#"+P,"#"+T).attr("checked",true);a("#"+P,"#"+T).attr("defaultChecked",true)}else{a("#"+P,"#"+T).attr("checked",false);a("#"+P,"#"+T).attr("defaultChecked","")}else{R=R.toLowerCase();if(R.search(/(false|0|no|off|undefined)/i)<0&&R!==""){a("#"+P,"#"+T).attr("checked",true);a("#"+P,"#"+T).attr("defaultChecked",true)}else{a("#"+P,"#"+T).attr("checked",false);a("#"+P,"#"+T).attr("defaultChecked","")}}break; case "custom":try{if(ba[$].editoptions&&a.isFunction(ba[$].editoptions.custom_value))ba[$].editoptions.custom_value(a("#"+P,"#"+T),"set",R);else throw"e1";}catch(ta){ta=="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,ta.message,jQuery.jgrid.edit.bClose)}}V++}});V>0&&a("#id_g","#"+n).val(G)}}}function j(){var G,J=[true,"",""],T={},P=q.p.prmNames,V,R;if(a.isFunction(c.beforeCheckValues)){var W= c.beforeCheckValues(z,a("#"+r),z[q.p.id+"_id"]=="_empty"?P.addoper:P.editoper);if(W&&typeof W==="object")z=W}for(var ka in z)if(z.hasOwnProperty(ka)){J=a.jgrid.checkValues(z[ka],ka,q);if(J[0]===false)break}if(J[0]){if(a.isFunction(c.onclickSubmit))T=c.onclickSubmit(c,z)||{};if(a.isFunction(c.beforeSubmit))J=c.beforeSubmit(z,a("#"+r))}if(J[0]&&!c.processing){c.processing=true;a("#sData","#"+n+"_2").addClass("ui-state-active");R=P.oper;V=P.id;z[R]=a.trim(z[q.p.id+"_id"])=="_empty"?P.addoper:P.editoper; if(z[R]!=P.addoper)z[V]=z[q.p.id+"_id"];else if(z[V]===undefined)z[V]=z[q.p.id+"_id"];delete z[q.p.id+"_id"];z=a.extend(z,c.editData,T);if(q.p.restful){c.mtype=z.id=="_empty"?"POST":"PUT";c.url=z.id=="_empty"?q.p.url:q.p.url+"/"+z.id}T=a.extend({url:c.url?c.url:a(q).jqGrid("getGridParam","editurl"),type:c.mtype,data:a.isFunction(c.serializeEditData)?c.serializeEditData(z):z,complete:function(Z,la){if(la!="success"){J[0]=false;J[1]=a.isFunction(c.errorTextFormat)?c.errorTextFormat(Z):la+" Status: '"+ Z.statusText+"'. Error code: "+Z.status}else if(a.isFunction(c.afterSubmit))J=c.afterSubmit(Z,z);if(J[0]===false){a("#FormError>td","#"+n).html(J[1]);a("#FormError","#"+n).show()}else{a.each(q.p.colModel,function(){if(I[this.name]&&this.formatter&&this.formatter=="select")try{delete I[this.name]}catch($){}});z=a.extend(z,I);q.p.autoencode&&a.each(z,function($,va){z[$]=a.jgrid.htmlDecode(va)});c.reloadAfterSubmit=c.reloadAfterSubmit&&q.p.datatype!="local";if(z[R]==P.addoper){J[2]||(J[2]=parseInt(q.p.records, 10)+1+"");z[V]=J[2];if(c.closeAfterAdd){if(c.reloadAfterSubmit)a(q).trigger("reloadGrid");else{a(q).jqGrid("addRowData",J[2],z,b.addedrow);a(q).jqGrid("setSelection",J[2])}a.jgrid.hideModal("#"+o.themodal,{gb:"#gbox_"+v,jqm:b.jqModal,onClose:c.onClose})}else if(c.clearAfterAdd){c.reloadAfterSubmit?a(q).trigger("reloadGrid"):a(q).jqGrid("addRowData",J[2],z,b.addedrow);h("_empty",q,r)}else c.reloadAfterSubmit?a(q).trigger("reloadGrid"):a(q).jqGrid("addRowData",J[2],z,b.addedrow)}else{if(c.reloadAfterSubmit){a(q).trigger("reloadGrid"); c.closeAfterEdit||setTimeout(function(){a(q).jqGrid("setSelection",z[V])},1E3)}else q.p.treeGrid===true?a(q).jqGrid("setTreeRow",z[V],z):a(q).jqGrid("setRowData",z[V],z);c.closeAfterEdit&&a.jgrid.hideModal("#"+o.themodal,{gb:"#gbox_"+v,jqm:b.jqModal,onClose:c.onClose})}if(a.isFunction(c.afterComplete)){G=Z;setTimeout(function(){c.afterComplete(G,z,a("#"+r));G=null},500)}}c.processing=false;if(c.checkOnSubmit||c.checkOnUpdate){a("#"+r).data("disabled",false);if(c._savedData[q.p.id+"_id"]!="_empty")for(var ba in c._savedData)if(z[ba])c._savedData[ba]= z[ba]}a("#sData","#"+n+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+r)[0].focus()}catch(wa){}},error:function(Z,la,ba){a("#FormError>td","#"+n).html(la+" : "+ba);a("#FormError","#"+n).show();c.processing=false;a("#"+r).data("disabled",false);a("#sData","#"+n+"_2").removeClass("ui-state-active")}},a.jgrid.ajaxOptions,c.ajaxEditOptions);if(!T.url&&!c.useDataProxy)if(a.isFunction(q.p.dataProxy))c.useDataProxy=true;else{J[0]=false;J[1]+=" "+a.jgrid.errors.nourl}if(J[0])c.useDataProxy? q.p.dataProxy.call(q,T,"set_"+q.p.id):a.ajax(T)}if(J[0]===false){a("#FormError>td","#"+n).html(J[1]);a("#FormError","#"+n).show()}}function d(G,J){var T=false,P;for(P in G)if(G[P]!=J[P]){T=true;break}return T}function l(){var G=true;a("#FormError","#"+n).hide();if(c.checkOnUpdate){z={};I={};f();L=a.extend({},z,I);if(U=d(L,c._savedData)){a("#"+r).data("disabled",true);a(".confirm","#"+o.themodal).show();G=false}}return G}function k(){if(e!=="_empty"&&typeof q.p.savedRow!=="undefined"&&q.p.savedRow.length> 0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var G=0;G").data("disabled",false);var da=a("
    "); if(C){x=C(a("#"+r));if(typeof x=="undefined")x=true}if(x===false)return;k();a(q.p.colModel).each(function(){var G=this.formoptions;B=Math.max(B,G?G.colpos||0:0);y=Math.max(y,G?G.rowpos||0:0)});a(ca).append(da);C=a("");C[0].rp=0;a(da).append(C);C=a(""+c.topinfo+"");C[0].rp=0;a(da).append(C);x=(C=q.p.direction=="rtl"?true: false)?"nData":"pData";var qa=C?"pData":"nData";g(e,q,da,B);x="";qa="";var ua=""+b.bSubmit+"",Ca=""+ b.bCancel+"";x="";x+="";x+="

    "+ua+Ca+"
    ";if(y>0){var za=[];a.each(a(da)[0].rows,function(G,J){za[G]=J});za.sort(function(G, J){if(G.rp>J.rp)return 1;if(G.rp").append(ca).append(x);a.jgrid.createModal(o,ca,b,"#gview_"+q.p.id,a("#gbox_"+q.p.id)[0]);if(C){a("#pData, #nData","#"+n+"_2").css("float","right");a(".EditButton","#"+n+"_2").css("text-align","left")}c.topinfo&&a(".tinfo","#"+n+"_2").show();c.bottominfo&&a(".binfo","#"+n+"_2").show(); x=ca=null;a("#"+o.themodal).keydown(function(G){var J=G.target;if(a("#"+r).data("disabled")===true)return false;if(c.savekey[0]===true&&G.which==c.savekey[1])if(J.tagName!="TEXTAREA"){a("#sData","#"+n+"_2").trigger("click");return false}if(G.which===27){if(!l())return false;Da&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:c.onClose});return false}if(c.navkeys[0]===true){if(a("#id_g","#"+n).val()=="_empty")return true;if(G.which==c.navkeys[1]){a("#pData","#"+n+"_2").trigger("click");return false}if(G.which== c.navkeys[2]){a("#nData","#"+n+"_2").trigger("click");return false}}});if(b.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span","#"+o.themodal).removeClass("jqmClose");a("a.ui-jqdialog-titlebar-close","#"+o.themodal).unbind("click").click(function(){if(!l())return false;a.jgrid.hideModal("#"+o.themodal,{gb:"#gbox_"+v,jqm:b.jqModal,onClose:c.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","#"+n+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(b.closeicon[0]===true)a("#cData","#"+n+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(c.checkOnSubmit||c.checkOnUpdate){ua=""+ b.bYes+"";qa=""+b.bNo+"";Ca=""+b.bExit+"";ca=b.zIndex||999;ca++;a("
    "+b.saveData+"

    "+ua+qa+Ca+"
    ").insertAfter("#"+r);a("#sNew","#"+o.themodal).click(function(){j();a("#"+r).data("disabled",false);a(".confirm","#"+o.themodal).hide();return false});a("#nNew","#"+o.themodal).click(function(){a(".confirm","#"+o.themodal).hide();a("#"+r).data("disabled",false);setTimeout(function(){a(":input","#"+r)[0].focus()},0);return false});a("#cNew","#"+o.themodal).click(function(){a(".confirm", "#"+o.themodal).hide();a("#"+r).data("disabled",false);a.jgrid.hideModal("#"+o.themodal,{gb:"#gbox_"+v,jqm:b.jqModal,onClose:c.onClose});return false})}D&&D(a("#"+r));e=="_empty"||!c.viewPagerButtons?a("#pData,#nData","#"+n+"_2").hide():a("#pData,#nData","#"+n+"_2").show();s&&s(a("#"+r));a("#"+o.themodal).data("onClose",c.onClose);a.jgrid.viewModal("#"+o.themodal,{gbox:"#gbox_"+v,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});ha||a(".jqmOverlay").click(function(){if(!l())return false;a.jgrid.hideModal("#"+ o.themodal,{gb:"#gbox_"+v,jqm:b.jqModal,onClose:c.onClose});return false});A&&A(a("#"+r));a(".fm-button","#"+o.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+n+"_2").click(function(){z={};I={};a("#FormError","#"+n).hide();f();if(z[q.p.id+"_id"]=="_empty")j();else if(b.checkOnSubmit===true){L=a.extend({},z,I);if(U=d(L,c._savedData)){a("#"+r).data("disabled",true);a(".confirm","#"+o.themodal).show()}else j()}else j(); return false});a("#cData","#"+n+"_2").click(function(){if(!l())return false;a.jgrid.hideModal("#"+o.themodal,{gb:"#gbox_"+v,jqm:b.jqModal,onClose:c.onClose});return false});a("#nData","#"+n+"_2").click(function(){if(!l())return false;a("#FormError","#"+n).hide();var G=p();G[0]=parseInt(G[0],10);if(G[0]!=-1&&G[1][G[0]+1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("next",a("#"+r),G[1][G[0]]);h(G[1][G[0]+1],q,r);a(q).jqGrid("setSelection",G[1][G[0]+1]);a.isFunction(b.afterclickPgButtons)&& b.afterclickPgButtons("next",a("#"+r),G[1][G[0]+1]);m(G[0]+1,G[1].length-1)}return false});a("#pData","#"+n+"_2").click(function(){if(!l())return false;a("#FormError","#"+n).hide();var G=p();if(G[0]!=-1&&G[1][G[0]-1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("prev",a("#"+r),G[1][G[0]]);h(G[1][G[0]-1],q,r);a(q).jqGrid("setSelection",G[1][G[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+r),G[1][G[0]-1]);m(G[0]-1,G[1].length-1)}return false})}s=p();m(s[0], s[1].length-1)}})},viewGridRow:function(e,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,overlay:10,drag:true,resize:true,jqModal:true,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 f(){if(b.closeOnEscape===true||b.navkeys[0]===true)setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+q.modalhead).focus()}, 0)}function g(y,z,I,L){for(var U,ha,ca,da=0,qa,ua,Ca=[],za=false,Da="  ",G="",J=["integer","number","currency"],T=0,P=0,V,R,W,ka=1;ka<=L;ka++)G+=ka==1?Da:"  ";a(z.p.colModel).each(function(){ha=this.editrules&& this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!ha&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,J)!==-1)T=Math.max(T,parseInt(this.width,10));else P=Math.max(P,parseInt(this.width,10))});V=T!==0?T:P!==0?P:0;za=a(z).jqGrid("getInd",y);a(z.p.colModel).each(function(Z){U=this.name;R=false;ua=(ha=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";W=typeof this.viewable!="boolean"?true:this.viewable; if(U!=="cb"&&U!=="subgrid"&&U!=="rn"&&W){qa=za===false?"":U==z.p.ExpandColumn&&z.p.treeGrid===true?a("td:eq("+Z+")",z.rows[za]).text():a("td:eq("+Z+")",z.rows[za]).html();R=this.align==="right"&&V!==0?true:false;a.extend({},this.editoptions||{},{id:U,name:U});var la=a.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),ba=parseInt(la.rowpos,10)||da+1,wa=parseInt((parseInt(la.colpos,10)||1)*2,10);if(la.rowabove){var $=a(""+la.rowcontent+""); a(I).append($);$[0].rp=ba}ca=a(I).find("tr[rowpos="+ba+"]");if(ca.length===0){ca=a("").addClass("FormData").attr("id","trv_"+U);a(ca).append(G);a(I).append(ca);ca[0].rp=ba}a("td:eq("+(wa-2)+")",ca[0]).html(""+(typeof la.label==="undefined"?z.p.colNames[Z]:la.label)+"");a("td:eq("+(wa-1)+")",ca[0]).append(""+qa+"").attr("id","v_"+U);R&&a("td:eq("+(wa-1)+") span",ca[0]).css({"text-align":"right",width:V+"px"});Ca[da]=Z;da++}});if(da>0){y=a("");y[0].rp=da+99;a(I).append(y)}return Ca}function h(y,z){var I,L,U=0,ha,ca;if(ca=a(z).jqGrid("getInd",y,true)){a("td",ca).each(function(da){I=z.p.colModel[da].name;L=z.p.colModel[da].editrules&&z.p.colModel[da].editrules.edithidden===true?false:z.p.colModel[da].hidden===true?true:false;if(I!=="cb"&&I!=="subgrid"&&I!=="rn"){ha=I==z.p.ExpandColumn&&z.p.treeGrid===true?a(this).text():a(this).html(); a.extend({},z.p.colModel[da].editoptions||{});I=a.jgrid.jqID("v_"+I);a("#"+I+" span","#"+p).html(ha);L&&a("#"+I,"#"+p).parents("tr:first").hide();U++}});U>0&&a("#id_g","#"+p).val(y)}}function j(y,z){y===0?a("#pData","#"+p+"_2").addClass("ui-state-disabled"):a("#pData","#"+p+"_2").removeClass("ui-state-disabled");y==z?a("#nData","#"+p+"_2").addClass("ui-state-disabled"):a("#nData","#"+p+"_2").removeClass("ui-state-disabled")}function d(){var y=a(l).jqGrid("getDataIDs"),z=a("#id_g","#"+p).val();return[a.inArray(z, y),y]}var l=this;if(l.grid&&e){if(!b.imgpath)b.imgpath=l.p.imgpath;var k=l.p.id,m="ViewGrid_"+k,p="ViewTbl_"+k,q={themodal:"viewmod"+k,modalhead:"viewhd"+k,modalcontent:"viewcnt"+k,scrollelm:m},v=a.isFunction(b.beforeInitData)?b.beforeInitData:false,r=true,n=1,o=0;if(a("#"+q.themodal).html()!=null){if(v){r=v(a("#"+m));if(typeof r=="undefined")r=true}if(r===false)return;a(".ui-jqdialog-title","#"+q.modalhead).html(b.caption);a("#FormError","#"+p).hide();h(e,l);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+ m));a.jgrid.viewModal("#"+q.themodal,{gbox:"#gbox_"+k,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal});f()}else{var s=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";s=a("
    ");var A=a("
    ");if(v){r=v(a("#"+m));if(typeof r=="undefined")r=true}if(r=== false)return;a(l.p.colModel).each(function(){var y=this.formoptions;n=Math.max(n,y?y.colpos||0:0);o=Math.max(o,y?y.rowpos||0:0)});a(s).append(A);g(e,l,A,n);v=l.p.direction=="rtl"?true:false;r="";var C="", D=""+b.bClose+"";if(o>0){var x=[];a.each(a(A)[0].rows,function(y,z){x[y]=z});x.sort(function(y,z){if(y.rp>z.rp)return 1;if(y.rp").append(s).append("
    "+D+"
    ");a.jgrid.createModal(q,s,b,"#gview_"+l.p.id,a("#gview_"+l.p.id)[0]);if(v){a("#pData, #nData","#"+p+"_2").css("float","right");a(".EditButton","#"+p+"_2").css("text-align","left")}b.viewPagerButtons||a("#pData, #nData","#"+p+"_2").hide();s=null;a("#"+q.themodal).keydown(function(y){if(y.which===27){B&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(y.which=== b.navkeys[1]){a("#pData","#"+p+"_2").trigger("click");return false}if(y.which===b.navkeys[2]){a("#nData","#"+p+"_2").trigger("click");return false}}});b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.closeicon[0]===true)a("#cData","#"+p+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+m));a.jgrid.viewModal("#"+q.themodal,{gbox:"#gbox_"+ k,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+p+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});f();a("#cData","#"+p+"_2").click(function(){a.jgrid.hideModal("#"+q.themodal,{gb:"#gbox_"+k,jqm:b.jqModal,onClose:b.onClose});return false});a("#nData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var y=d();y[0]=parseInt(y[0],10);if(y[0]!=-1&&y[1][y[0]+1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("next", a("#"+m),y[1][y[0]]);h(y[1][y[0]+1],l);a(l).jqGrid("setSelection",y[1][y[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+m),y[1][y[0]+1]);j(y[0]+1,y[1].length-1)}f();return false});a("#pData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var y=d();if(y[0]!=-1&&y[1][y[0]-1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("prev",a("#"+m),y[1][y[0]]);h(y[1][y[0]-1],l);a(l).jqGrid("setSelection",y[1][y[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev", a("#"+m),y[1][y[0]-1]);j(y[0]-1,y[1].length-1)}f();return false})}s=d();j(s[0],s[1].length-1)}})},delGridRow:function(e,b){c=b=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:false,overlay:10,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,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||{});return this.each(function(){var f=this;if(f.grid)if(e){var g=typeof b.beforeShowForm==="function"?true:false,h=typeof b.afterShowForm==="function"?true:false,j=a.isFunction(b.beforeInitData)?b.beforeInitData:false,d=f.p.id,l={},k=true,m="DelTbl_"+d,p,q,v,r,n={themodal:"delmod"+d,modalhead:"delhd"+d,modalcontent:"delcnt"+d,scrollelm:m};if(jQuery.isArray(e))e=e.join();if(a("#"+n.themodal).html()!=null){if(j){k=j(a("#"+m));if(typeof k=="undefined")k= true}if(k===false)return;a("#DelData>td","#"+m).text(e);a("#DelError","#"+m).hide();if(c.processing===true){c.processing=false;a("#dData","#"+m).removeClass("ui-state-active")}g&&b.beforeShowForm(a("#"+m));a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+d,jqm:b.jqModal,jqM:false,overlay:b.overlay,modal:b.modal})}else{var o=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";o="
    ";o+=""; o+="";o+="";o+='";o+="
    '+b.msg+"
     
    ";o+="

    "+(""+ b.bSubmit+"")+" "+(""+b.bCancel+"")+"
    ";b.gbox="#gbox_"+d;a.jgrid.createModal(n,o,b,"#gview_"+f.p.id,a("#gview_"+f.p.id)[0]);if(j){k=j(a("#"+m));if(typeof k=="undefined")k=true}if(k===false)return;a(".fm-button","#"+m+"_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"], b.delicon);b.cancelicon=a.extend([true,"left","ui-icon-cancel"],b.cancelicon);if(b.delicon[0]===true)a("#dData","#"+m+"_2").addClass(b.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(b.cancelicon[0]===true)a("#eData","#"+m+"_2").addClass(b.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");a("#dData","#"+m+"_2").click(function(){var s=[true,""]; l={};var A=a("#DelData>td","#"+m).text();if(typeof b.onclickSubmit==="function")l=b.onclickSubmit(c,A)||{};if(typeof b.beforeSubmit==="function")s=b.beforeSubmit(A);if(s[0]&&!c.processing){c.processing=true;a(this).addClass("ui-state-active");v=f.p.prmNames;p=a.extend({},c.delData,l);r=v.oper;p[r]=v.deloper;q=v.id;p[q]=A;if(f.p.restful){b.mtype="DELETE";c.url=f.p.url+"/"+A}var C=a.extend({url:c.url?c.url:a(f).jqGrid("getGridParam","editurl"),type:b.mtype,data:a.isFunction(b.serializeDelData)?b.serializeDelData(p): p,complete:function(D,x){if(x!="success"){s[0]=false;s[1]=a.isFunction(c.errorTextFormat)?c.errorTextFormat(D):x+" Status: '"+D.statusText+"'. Error code: "+D.status}else if(typeof c.afterSubmit==="function")s=c.afterSubmit(D,p);if(s[0]===false){a("#DelError>td","#"+m).html(s[1]);a("#DelError","#"+m).show()}else{if(c.reloadAfterSubmit&&f.p.datatype!="local")a(f).trigger("reloadGrid");else{var B=[];B=A.split(",");if(f.p.treeGrid===true)try{a(f).jqGrid("delTreeNode",B[0])}catch(y){}else for(var z=0;z< B.length;z++)a(f).jqGrid("delRowData",B[z]);f.p.selrow=null;f.p.selarrrow=[]}a.isFunction(c.afterComplete)&&setTimeout(function(){c.afterComplete(D,A)},500)}c.processing=false;a("#dData","#"+m+"_2").removeClass("ui-state-active");s[0]&&a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+d,jqm:b.jqModal,onClose:c.onClose})},error:function(D,x,B){a("#DelError>td","#"+m).html(x+" : "+B);a("#DelError","#"+m).show();c.processing=false;a("#dData","#"+m+"_2").removeClass("ui-state-active")}},a.jgrid.ajaxOptions, b.ajaxDelOptions);if(!C.url&&!c.useDataProxy)if(a.isFunction(f.p.dataProxy))c.useDataProxy=true;else{s[0]=false;s[1]+=" "+a.jgrid.errors.nourl}if(s[0])c.useDataProxy?f.p.dataProxy.call(f,C,"del_"+f.p.id):a.ajax(C)}if(s[0]===false){a("#DelError>td","#"+m).html(s[1]);a("#DelError","#"+m).show()}return false});a("#eData","#"+m+"_2").click(function(){a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+d,jqm:b.jqModal,onClose:c.onClose});return false});g&&b.beforeShowForm(a("#"+m));a.jgrid.viewModal("#"+n.themodal, {gbox:"#gbox_"+d,jqm:b.jqModal,overlay:b.overlay,modal:b.modal})}h&&b.afterShowForm(a("#"+m));b.closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+n.modalhead).focus()},0)}})},navGrid:function(e,b,f,g,h,j,d){b=a.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",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},a.jgrid.nav,b||{});return this.each(function(){var l={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},k=this,m,p,q;if(!(!k.grid||typeof e!="string")){if(a("#"+l.themodal).html()===null){if(typeof window.innerWidth!="undefined"){m=window.innerWidth;p=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!== 0){m=document.documentElement.clientWidth;p=document.documentElement.clientHeight}else{m=1024;p=768}a.jgrid.createModal(l,"
    "+b.alerttext+"
    ",{gbox:"#gbox_"+k.p.id,jqModal:true,drag:true,resize:true,caption:b.alertcap,top:p/2-25,left:m/2-100,width:200,height:"auto",closeOnEscape:b.closeOnEscape},"","",true)}m=1;if(b.cloneToTop&&k.p.toppager)m=2;for(p=0;p"), r,n;if(p===0){r=e;n=k.p.id;if(r==k.p.toppager){n+="_top";m=1}}else{r=k.p.toppager;n=k.p.id+"_top"}k.p.direction=="rtl"&&a(v).attr("dir","rtl").css("float","right");if(b.add){g=g||{};q=a("");a(q).append("
    "+b.addtext+"
    ");a("tr",v).append(q);a(q,v).attr({title:b.addtitle||"",id:g.id||"add_"+n}).click(function(){a(this).hasClass("ui-state-disabled")||(typeof b.addfunc=="function"?b.addfunc(): a(k).jqGrid("editGridRow","new",g));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});q=null}if(b.edit){q=a("");f=f||{};a(q).append("
    "+b.edittext+"
    ");a("tr",v).append(q);a(q,v).attr({title:b.edittitle||"",id:f.id||"edit_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var o= k.p.selrow;if(o)typeof b.editfunc=="function"?b.editfunc(o):a(k).jqGrid("editGridRow",o,f);else{a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.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")});q=null}if(b.view){q=a("");d=d||{};a(q).append("
    "+ b.viewtext+"
    ");a("tr",v).append(q);a(q,v).attr({title:b.viewtitle||"",id:d.id||"view_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var o=k.p.selrow;if(o)a(k).jqGrid("viewGridRow",o,d);else{a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.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")});q=null}if(b.del){q=a(""); h=h||{};a(q).append("
    "+b.deltext+"
    ");a("tr",v).append(q);a(q,v).attr({title:b.deltitle||"",id:h.id||"del_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var o;if(k.p.multiselect){o=k.p.selarrrow;if(o.length===0)o=null}else o=k.p.selrow;if(o)"function"==typeof b.delfunc?b.delfunc(o):a(k).jqGrid("delGridRow",o,h);else{a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.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")});q=null}if(b.add||b.edit||b.del||b.view)a("tr",v).append("");if(b.search){q=a("");j=j||{};a(q).append("
    "+b.searchtext+"
    ");a("tr",v).append(q);a(q,v).attr({title:b.searchtitle||"",id:j.id||"search_"+ n}).click(function(){a(this).hasClass("ui-state-disabled")||a(k).jqGrid("searchGrid",j);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});q=null}if(b.refresh){q=a("");a(q).append("
    "+b.refreshtext+"
    ");a("tr",v).append(q);a(q,v).attr({title:b.refreshtitle||"",id:"refresh_"+n}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&& b.beforeRefresh();k.p.search=false;try{a("#fbox_"+k.p.id).searchFilter().reset({reload:false});a.isFunction(k.clearToolbar)&&k.clearToolbar(false)}catch(o){}switch(b.refreshstate){case "firstpage":a(k).trigger("reloadGrid",[{page:1}]);break;case "current":a(k).trigger("reloadGrid",[{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")}); q=null}q=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("");q=a(v).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(r+"_"+b.position,r).append(v);if(k.p._nvtd){if(q>k.p._nvtd[0]){a(r+"_"+b.position,r).width(q);k.p._nvtd[0]=q}k.p._nvtd[1]=q}v=q=q=null}}})},navButtonAdd:function(e,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(e.indexOf("#")!==0)e="#"+e;var f=a(".navtable",e)[0],g=this;if(f){var h=a("");b.buttonicon.toString().toUpperCase()=="NONE"?a(h).addClass("ui-pg-button ui-corner-all").append("
    "+b.caption+"
    "):a(h).addClass("ui-pg-button ui-corner-all").append("
    "+b.caption+"
    ");b.id&&a(h).attr("id",b.id);if(b.position== "first")f.rows[0].cells.length===0?a("tr",f).append(h):a("tr td:eq(0)",f).before(h);else a("tr",f).append(h);a(h,f).attr("title",b.title||"").click(function(j){a(this).hasClass("ui-state-disabled")||a.isFunction(b.onClickButton)&&b.onClickButton.call(g,j);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(e,b){b=a.extend({sepclass:"ui-separator",sepcontent:""},b|| {});return this.each(function(){if(this.grid){if(e.indexOf("#")!==0)e="#"+e;var f=a(".navtable",e)[0];if(f){var g=""+b.sepcontent+"";a("tr",f).append(g)}}})},GridToForm:function(e,b){return this.each(function(){if(this.grid){var f=a(this).jqGrid("getRowData",e);if(f)for(var g in f)a("[name="+g+"]",b).is("input:radio")||a("[name="+g+"]",b).is("input:checkbox")?a("[name="+g+"]",b).each(function(){a(this).val()== f[g]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+g+"]",b).val(f[g])}})},FormToGrid:function(e,b,f,g){return this.each(function(){if(this.grid){f||(f="set");g||(g="first");var h=a(b).serializeArray(),j={};a.each(h,function(d,l){j[l.name]=l.value});if(f=="add")a(this).jqGrid("addRowData",e,j,g);else f=="set"&&a(this).jqGrid("setRowData",e,j)}})}})})(jQuery); (function(a){a.jgrid.extend({editRow:function(c,e,b,f,g,h,j,d,l){return this.each(function(){var k=this,m,p,q=0,v=null,r={},n,o;if(k.grid){n=a(k).jqGrid("getInd",c,true);if(n!==false)if((a(n).attr("editable")||"0")=="0"&&!a(n).hasClass("not-editable-row")){o=k.p.colModel;a("td",n).each(function(s){m=o[s].name;var A=k.p.treeGrid===true&&m==k.p.ExpandColumn;if(A)p=a("span:first",this).html();else try{p=a.unformat(this,{rowId:c,colModel:o[s]},s)}catch(C){p=a(this).html()}if(m!="cb"&&m!="subgrid"&&m!= "rn"){if(k.p.autoencode)p=a.jgrid.htmlDecode(p);r[m]=p;if(o[s].editable===true){if(v===null)v=s;A?a("span:first",this).html(""):a(this).html("");var D=a.extend({},o[s].editoptions||{},{id:c+"_"+m,name:m});if(!o[s].edittype)o[s].edittype="text";D=a.jgrid.createEl(o[s].edittype,D,p,true,a.extend({},a.jgrid.ajaxOptions,k.p.ajaxSelectOptions||{}));a(D).addClass("editable");A?a("span:first",this).append(D):a(this).append(D);o[s].edittype=="select"&&o[s].editoptions.multiple===true&&a.browser.msie&&a(D).width(a(D).width()); q++}}});if(q>0){r.id=c;k.p.savedRow.push(r);a(n).attr("editable","1");a("td:eq("+v+") input",n).focus();e===true&&a(n).bind("keydown",function(s){s.keyCode===27&&a(k).jqGrid("restoreRow",c,l);if(s.keyCode===13){if(s.target.tagName=="TEXTAREA")return true;a(k).jqGrid("saveRow",c,f,g,h,j,d,l);return false}s.stopPropagation()});a.isFunction(b)&&b.call(k,c)}}}})},saveRow:function(c,e,b,f,g,h,j){return this.each(function(){var d=this,l,k={},m={},p,q,v,r;if(d.grid){r=a(d).jqGrid("getInd",c,true);if(r!== false){p=a(r).attr("editable");b=b?b:d.p.editurl;if(p==="1"){var n;a("td",r).each(function(C){n=d.p.colModel[C];l=n.name;if(l!="cb"&&l!="subgrid"&&n.editable===true&&l!="rn"){switch(n.edittype){case "checkbox":var D=["Yes","No"];if(n.editoptions)D=n.editoptions.value.split(":");k[l]=a("input",this).attr("checked")?D[0]:D[1];break;case "text":case "password":case "textarea":case "button":k[l]=a("input, textarea",this).val();break;case "select":if(n.editoptions.multiple){D=a("select",this);var x=[]; k[l]=a(D).val();k[l]=k[l]?k[l].join(","):"";a("select > option:selected",this).each(function(y,z){x[y]=a(z).text()});m[l]=x.join(",")}else{k[l]=a("select>option:selected",this).val();m[l]=a("select>option:selected",this).text()}if(n.formatter&&n.formatter=="select")m={};break;case "custom":try{if(n.editoptions&&a.isFunction(n.editoptions.custom_value)){k[l]=n.editoptions.custom_value.call(d,a(".customelement",this),"get");if(k[l]===undefined)throw"e2";}else throw"e1";}catch(B){B=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);B=="e2"?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,B.message,jQuery.jgrid.edit.bClose)}}v=a.jgrid.checkValues(k[l],C,d);if(v[0]===false){v[1]=k[l]+" "+v[1];return false}if(d.p.autoencode)k[l]=a.jgrid.htmlEncode(k[l])}});if(v[0]===false)try{var o=a.jgrid.findPos(a("#"+a.jgrid.jqID(c),d.grid.bDiv)[0]); a.jgrid.info_dialog(a.jgrid.errors.errcap,v[1],a.jgrid.edit.bClose,{left:o[0],top:o[1]})}catch(s){alert(v[1])}else{if(k){var A;o=d.p.prmNames;A=o.oper;p=o.id;k[A]=o.editoper;k[p]=c;if(typeof d.p.inlineData=="undefined")d.p.inlineData={};if(typeof f=="undefined")f={};k=a.extend({},k,d.p.inlineData,f)}if(b=="clientArray"){k=a.extend({},k,m);d.p.autoencode&&a.each(k,function(C,D){k[C]=a.jgrid.htmlDecode(D)});p=a(d).jqGrid("setRowData",c,k);a(r).attr("editable","0");for(o=0;o=0&&d.p.savedRow.splice(q,1);a.isFunction(g)&&g.call(d,c,p)}else{a("#lui_"+d.p.id).show();if(d.p.restful){mtype="PUT";b=b+"/"+c}else mtype="POST";a.ajax(a.extend({url:b,data:a.isFunction(d.p.serializeRowData)?d.p.serializeRowData.call(d,k):k,type:mtype,complete:function(C,D){a("#lui_"+d.p.id).hide();if(D==="success")if((a.isFunction(e)?e.call(d,C):true)===true){d.p.autoencode&&a.each(k,function(B,y){k[B]=a.jgrid.htmlDecode(y)});k=a.extend({},k,m);a(d).jqGrid("setRowData",c,k);a(r).attr("editable", "0");for(var x=0;x=0&&d.p.savedRow.splice(q,1);a.isFunction(g)&&g.call(d,c,C)}else{a.isFunction(h)&&h.call(d,c,C,D);a(d).jqGrid("restoreRow",c,j)}},error:function(C,D){a("#lui_"+d.p.id).hide();a.isFunction(h)?h.call(d,c,C,D):alert("Error Row: "+c+" Result: "+C.status+":"+C.statusText+" Status: "+D);a(d).jqGrid("restoreRow",c,j)}},a.jgrid.ajaxOptions,d.p.ajaxRowOptions||{}))}a(r).unbind("keydown")}}}}})},restoreRow:function(c,e){return this.each(function(){var b= this,f,g,h={};if(b.grid){g=a(b).jqGrid("getInd",c,true);if(g!==false){for(var j=0;j=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(g.id)).datepicker("hide")}catch(d){}a.each(b.p.colModel,function(){if(this.editable===true&&this.name in b.p.savedRow[f])h[this.name]=b.p.savedRow[f][this.name]});a(b).jqGrid("setRowData",c,h);a(g).attr("editable","0").unbind("keydown");b.p.savedRow.splice(f,1)}a.isFunction(e)&& e.call(b,c)}}})}})})(jQuery); (function(a){a.jgrid.extend({editCell:function(c,e,b){return this.each(function(){var f=this,g,h,j;if(!(!f.grid||f.p.cellEdit!==true)){e=parseInt(e,10);f.p.selrow=f.rows[c].id;f.p.knv||a(f).jqGrid("GridNav");if(f.p.savedRow.length>0){if(b===true)if(c==f.p.iRow&&e==f.p.iCol)return;a(f).jqGrid("saveCell",f.p.savedRow[0].id,f.p.savedRow[0].ic)}else window.setTimeout(function(){a("#"+f.p.knv).attr("tabindex","-1").focus()},0);g=f.p.colModel[e].name;if(!(g=="subgrid"||g=="cb"||g=="rn")){j=a("td:eq("+e+ ")",f.rows[c]);if(f.p.colModel[e].editable===true&&b===true&&!j.hasClass("not-editable-cell")){if(parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0){a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight");a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")}a(j).addClass("edit-cell ui-state-highlight");a(f.rows[c]).addClass("selected-row ui-state-hover");try{h=a.unformat(j,{rowId:f.rows[c].id,colModel:f.p.colModel[e]},e)}catch(d){h=a(j).html()}if(f.p.autoencode)h= a.jgrid.htmlDecode(h);if(!f.p.colModel[e].edittype)f.p.colModel[e].edittype="text";f.p.savedRow.push({id:c,ic:e,name:g,v:h});if(a.isFunction(f.p.formatCell)){var l=f.p.formatCell.call(f,f.rows[c].id,g,h,c,e);if(l!==undefined)h=l}l=a.extend({},f.p.colModel[e].editoptions||{},{id:c+"_"+g,name:g});var k=a.jgrid.createEl(f.p.colModel[e].edittype,l,h,true,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell.call(f,f.rows[c].id,g,h,c,e);a(j).html("").append(k).attr("tabindex", "0");window.setTimeout(function(){a(k).focus()},0);a("input, select, textarea",j).bind("keydown",function(m){if(m.keyCode===27)if(a("input.hasDatepicker",j).length>0)a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",c,e):a("input.hasDatepicker",j).datepicker("hide");else a(f).jqGrid("restoreCell",c,e);m.keyCode===13&&a(f).jqGrid("saveCell",c,e);if(m.keyCode==9)if(f.grid.hDiv.loading)return false;else m.shiftKey?a(f).jqGrid("prevCell",c,e):a(f).jqGrid("nextCell",c,e);m.stopPropagation()}); a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell.call(f,f.rows[c].id,g,h,c,e)}else{if(parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0){a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight");a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")}j.addClass("edit-cell ui-state-highlight");a(f.rows[c]).addClass("selected-row ui-state-hover");if(a.isFunction(f.p.onSelectCell)){h=j.html().replace(/\ \;/ig,"");f.p.onSelectCell.call(f,f.rows[c].id,g,h,c,e)}}f.p.iCol= e;f.p.iRow=c}}})},saveCell:function(c,e){return this.each(function(){var b=this,f;if(!(!b.grid||b.p.cellEdit!==true)){f=b.p.savedRow.length>=1?0:null;if(f!==null){var g=a("td:eq("+e+")",b.rows[c]),h,j,d=b.p.colModel[e],l=d.name,k=a.jgrid.jqID(l);switch(d.edittype){case "select":if(d.editoptions.multiple){k=a("#"+c+"_"+k,b.rows[c]);var m=[];if(h=a(k).val())h.join(",");else h="";a("option:selected",k).each(function(s,A){m[s]=a(A).text()});j=m.join(",")}else{h=a("#"+c+"_"+k+">option:selected",b.rows[c]).val(); j=a("#"+c+"_"+k+">option:selected",b.rows[c]).text()}if(d.formatter)j=h;break;case "checkbox":var p=["Yes","No"];if(d.editoptions)p=d.editoptions.value.split(":");j=h=a("#"+c+"_"+k,b.rows[c]).attr("checked")?p[0]:p[1];break;case "password":case "text":case "textarea":case "button":j=h=a("#"+c+"_"+k,b.rows[c]).val();break;case "custom":try{if(d.editoptions&&a.isFunction(d.editoptions.custom_value)){h=d.editoptions.custom_value.call(b,a(".customelement",g),"get");if(h===undefined)throw"e2";else j=h}else throw"e1"; }catch(q){q=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);q=="e2"?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)}}if(j!=b.p.savedRow[f].v){if(a.isFunction(b.p.beforeSaveCell))if(f=b.p.beforeSaveCell.call(b,b.rows[c].id,l,h,c,e))j=h=f;var v=a.jgrid.checkValues(h, e,b);if(v[0]===true){f={};if(a.isFunction(b.p.beforeSubmitCell))(f=b.p.beforeSubmitCell.call(b,b.rows[c].id,l,h,c,e))||(f={});a("input.hasDatepicker",g).length>0&&a("input.hasDatepicker",g).datepicker("hide");if(b.p.cellsubmit=="remote")if(b.p.cellurl){var r={};if(b.p.autoencode)h=a.jgrid.htmlEncode(h);r[l]=h;p=b.p.prmNames;d=p.id;k=p.oper;r[d]=b.rows[c].id;r[k]=p.editoper;r=a.extend(f,r);a("#lui_"+b.p.id).show();b.grid.hDiv.loading=true;a.ajax(a.extend({url:b.p.cellurl,data:a.isFunction(b.p.serializeCellData)? b.p.serializeCellData.call(b,r):r,type:"POST",complete:function(s,A){a("#lui_"+b.p.id).hide();b.grid.hDiv.loading=false;if(A=="success")if(a.isFunction(b.p.afterSubmitCell)){var C=b.p.afterSubmitCell.call(b,s,r.id,l,h,c,e);if(C[0]===true){a(g).empty();a(b).jqGrid("setCell",b.rows[c].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(b.rows[c]).addClass("edited");a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[c].id,l,h,c,e);b.p.savedRow.splice(0,1)}else{a.jgrid.info_dialog(a.jgrid.errors.errcap, C[1],a.jgrid.edit.bClose);a(b).jqGrid("restoreCell",c,e)}}else{a(g).empty();a(b).jqGrid("setCell",b.rows[c].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(b.rows[c]).addClass("edited");a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[c].id,l,h,c,e);b.p.savedRow.splice(0,1)}},error:function(s,A){a("#lui_"+b.p.id).hide();b.grid.hDiv.loading=false;a.isFunction(b.p.errorCell)?b.p.errorCell.call(b,s,A):a.jgrid.info_dialog(a.jgrid.errors.errcap,s.status+" : "+s.statusText+"
    "+ A,a.jgrid.edit.bClose);a(b).jqGrid("restoreCell",c,e)}},a.jgrid.ajaxOptions,b.p.ajaxCellOptions||{}))}else try{a.jgrid.info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose);a(b).jqGrid("restoreCell",c,e)}catch(n){}if(b.p.cellsubmit=="clientArray"){a(g).empty();a(b).jqGrid("setCell",b.rows[c].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(b.rows[c]).addClass("edited");a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[c].id,l,h,c,e);b.p.savedRow.splice(0, 1)}}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,h+" "+v[1],a.jgrid.edit.bClose)},100);a(b).jqGrid("restoreCell",c,e)}catch(o){}}else a(b).jqGrid("restoreCell",c,e)}a.browser.opera?a("#"+b.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){a("#"+b.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(c,e){return this.each(function(){var b=this,f;if(!(!b.grid||b.p.cellEdit!==true)){f=b.p.savedRow.length>=1?0:null;if(f!==null){var g=a("td:eq("+ e+")",b.rows[c]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",g).datepicker("hide")}catch(h){}a(g).empty().attr("tabindex","-1");a(b).jqGrid("setCell",b.rows[c].id,e,b.p.savedRow[f].v,false,false,true);a.isFunction(b.p.afterRestoreCell)&&b.p.afterRestoreCell.call(b,b.rows[c].id,b.p.savedRow[f].v,c,e);b.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+b.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(c,e){return this.each(function(){var b=false;if(!(!this.grid|| this.p.cellEdit!==true)){for(var f=e+1;f0&&a(this).jqGrid("saveCell",c,e)}})},prevCell:function(c,e){return this.each(function(){var b=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var f=e-1;f>=0;f--)if(this.p.colModel[f].editable===true){b=f;break}if(b!==false)a(this).jqGrid("editCell",c,b,true);else this.p.savedRow.length>0&&a(this).jqGrid("saveCell", c,e)}})},GridNav:function(){return this.each(function(){function c(j,d,l){if(l.substr(0,1)=="v"){var k=a(b.grid.bDiv)[0].clientHeight,m=a(b.grid.bDiv)[0].scrollTop,p=b.rows[j].offsetTop+b.rows[j].clientHeight,q=b.rows[j].offsetTop;if(l=="vd")if(p>=k)a(b.grid.bDiv)[0].scrollTop=a(b.grid.bDiv)[0].scrollTop+b.rows[j].clientHeight;if(l=="vu")if(q=l+parseInt(k,10))a(b.grid.bDiv)[0].scrollLeft=a(b.grid.bDiv)[0].scrollLeft+b.rows[j].cells[d].clientWidth;else if(m=0;k--)if(b.p.colModel[k].hidden!==true){l=k;break}}if(d=="rgt"){l=j-1;for(k=j;k"),g,h;a(f).insertBefore(b.grid.cDiv);a("#"+b.p.knv).focus().keydown(function(j){h=j.keyCode;if(b.p.direction=="rtl")if(h==37)h=39;else if(h==39)h=37;switch(h){case 38:if(b.p.iRow-1>0){c(b.p.iRow-1,b.p.iCol,"vu");a(b).jqGrid("editCell",b.p.iRow-1,b.p.iCol, false)}break;case 40:if(b.p.iRow+1<=b.rows.length-1){c(b.p.iRow+1,b.p.iCol,"vd");a(b).jqGrid("editCell",b.p.iRow+1,b.p.iCol,false)}break;case 37:if(b.p.iCol-1>=0){g=e(b.p.iCol-1,"lft");c(b.p.iRow,g,"h");a(b).jqGrid("editCell",b.p.iRow,g,false)}break;case 39:if(b.p.iCol+1<=b.p.colModel.length-1){g=e(b.p.iCol+1,"rgt");c(b.p.iRow,g,"h");a(b).jqGrid("editCell",b.p.iRow,g,false)}break;case 13:parseInt(b.p.iCol,10)>=0&&parseInt(b.p.iRow,10)>=0&&a(b).jqGrid("editCell",b.p.iRow,b.p.iCol,true)}return false})}})}, getChangedCells:function(c){var e=[];c||(c="all");this.each(function(){var b=this,f;!b.grid||b.p.cellEdit!==true||a(b.rows).each(function(g){var h={};if(a(this).hasClass("edited")){a("td",this).each(function(j){f=b.p.colModel[j].name;if(f!=="cb"&&f!=="subgrid")if(c=="dirty"){if(a(this).hasClass("dirty-cell"))try{h[f]=a.unformat(this,{rowId:b.rows[g].id,colModel:b.p.colModel[j]},j)}catch(d){h[f]=a.jgrid.htmlDecode(a(this).html())}}else try{h[f]=a.unformat(this,{rowId:b.rows[g].id,colModel:b.p.colModel[j]}, j)}catch(l){h[f]=a.jgrid.htmlDecode(a(this).html())}});h.id=this.id;e.push(h)}})});return e}})})(jQuery); (function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var c;this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:a.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false,fixed:true});c=this.p.subGridModel;if(c[0]){c[0].align=a.extend([],c[0].align||[]);for(var e=0;e":'"},addSubGrid:function(c,e){return this.each(function(){var b=this;if(b.grid){var f=function(r,n,o){n=a("").html(n);a(r).append(n)},g=function(r,n){var o, s,A,C=a("
    "),D=a("");for(s=0;s");a(o).html(b.p.subGridModel[0].name[s]);a(o).width(b.p.subGridModel[0].width[s]);a(D).append(o)}a(C).append(D);if(r){A=b.p.xmlReader.subgrid;a(A.root+" "+A.row,r).each(function(){D=a("");if(A.repeatitems===true)a(A.cell, this).each(function(B){f(D,a(this).text()||" ",B)});else{var x=b.p.subGridModel[0].mapping||b.p.subGridModel[0].name;if(x)for(s=0;s"),B=a("");for(s=0;s");a(o).html(b.p.subGridModel[0].name[s]);a(o).width(b.p.subGridModel[0].width[s]);a(B).append(o)}a(x).append(B);if(r){C=b.p.jsonReader.subgrid;o=r[C.root];if(typeof o!=="undefined")for(s=0;s");if(C.repeatitems===true){if(C.cell)A=A[C.cell];for(D=0;D=1?" ":"";l=a(d).attr("id");v=true;if(a.isFunction(b.p.subGridBeforeExpand))v=b.p.subGridBeforeExpand.call(b,k+"_"+l,l);if(v===false)return false;p=0;a.each(b.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name== "cb")p++});q=""+m+"
    ";a(this).parent().after(q+"
    ");a.isFunction(b.p.subGridRowExpanded)?b.p.subGridRowExpanded.call(b,k+"_"+l,l):j(d);a(this).html("").removeClass("sgcollapsed").addClass("sgexpanded")}else if(a(this).hasClass("sgexpanded")){v= true;if(a.isFunction(b.p.subGridRowColapsed)){d=a(this).parent();l=a(d).attr("id");v=b.p.subGridRowColapsed.call(b,k+"_"+l,l)}if(v===false)return false;a(this).parent().next().remove(".ui-subgrid");a(this).html("").removeClass("sgexpanded").addClass("sgcollapsed")}return false});b.subGridXml=function(r,n){g(r,n)};b.subGridJson=function(r,n){h(r,n)}}})},expandSubGridRow:function(c){return this.each(function(){if(this.grid|| c)if(this.p.subGrid===true){var e=a(this).jqGrid("getInd",c,true);if(e)(e=a("td.sgcollapsed",e)[0])&&a(e).trigger("click")}})},collapseSubGridRow:function(c){return this.each(function(){if(this.grid||c)if(this.p.subGrid===true){var e=a(this).jqGrid("getInd",c,true);if(e)(e=a("td.sgexpanded",e)[0])&&a(e).trigger("click")}})},toggleSubGridRow:function(c){return this.each(function(){if(this.grid||c)if(this.p.subGrid===true){var e=a(this).jqGrid("getInd",c,true);if(e){var b=a("td.sgcollapsed",e)[0];if(b)a(b).trigger("click"); else(b=a("td.sgexpanded",e)[0])&&a(b).trigger("click")}}})}})})(jQuery); (function(a){a.jgrid.extend({setTreeNode:function(c,e){return this.each(function(){var b=this;if(b.grid&&b.p.treeGrid){var f=b.p.expColInd,g=b.p.treeReader.expanded_field,h=b.p.treeReader.leaf_field,j=b.p.treeReader.level_field,d=b.p.treeReader.loaded;e.level=c[j];if(b.p.treeGridModel=="nested"){var l=c[b.p.treeReader.left_field],k=c[b.p.treeReader.right_field];c[h]||(c[h]=parseInt(k,10)===parseInt(l,10)+1?"true":"false")}k=parseInt(c[j],10);if(b.p.tree_root_level===0){l=k+1;k=k}else{l=k;k=k-1}l= "
    ";l+="
    ";if(!b.p.loadonce){c[b.p.localReader.id]= e.id;b.p.data.push(c);b.p._index[e.id]=b.p.data.length-1}if(parseInt(c[j],10)!==parseInt(b.p.tree_root_level,10))a(b).jqGrid("isVisibleNode",c)||a(e).css("display","none");a("td:eq("+f+")",e).wrapInner("").prepend(l);a(".treeclick",e).bind("click",function(m){m=a(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;m=b.p._index[m];var p=b.p.treeReader.expanded_field;if(!b.p.data[m][b.p.treeReader.leaf_field])if(b.p.data[m][p]){a(b).jqGrid("collapseRow",b.p.data[m]);a(b).jqGrid("collapseNode", b.p.data[m])}else{a(b).jqGrid("expandRow",b.p.data[m]);a(b).jqGrid("expandNode",b.p.data[m])}return false});b.p.ExpandColClick===true&&a("span",e).css("cursor","pointer").bind("click",function(m){m=a(m.target||m.srcElement,b.rows).closest("tr.jqgrow")[0].id;var p=b.p._index[m],q=b.p.treeReader.expanded_field;if(!b.p.data[p][b.p.treeReader.leaf_field])if(b.p.data[p][q]){a(b).jqGrid("collapseRow",b.p.data[p]);a(b).jqGrid("collapseNode",b.p.data[p])}else{a(b).jqGrid("expandRow",b.p.data[p]);a(b).jqGrid("expandNode", b.p.data[p])}a(b).jqGrid("setSelection",m);return false})}})},setTreeGrid:function(){return this.each(function(){var c=this,e=0;if(c.p.treeGrid){c.p.treedatatype||a.extend(c.p,{treedatatype:c.p.datatype});c.p.subGrid=false;c.p.altRows=false;c.p.pgbuttons=false;c.p.pginput=false;c.p.multiselect=false;c.p.rowList=[];c.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+(c.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},c.p.treeIcons||{});if(c.p.treeGridModel=="nested")c.p.treeReader= a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded"},c.p.treeReader);else if(c.p.treeGridModel=="adjacency")c.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded"},c.p.treeReader);for(var b in c.p.colModel)if(c.p.colModel.hasOwnProperty(b)){if(c.p.colModel[b].name==c.p.ExpandColumn){c.p.expColInd=e;break}e++}if(!c.p.expColInd)c.p.expColInd=0;a.each(c.p.treeReader, function(f,g){if(g){c.p.colNames.push(g);c.p.colModel.push({name:g,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(c){this.each(function(){var e=this;if(e.grid&&e.p.treeGrid){var b=a(e).jqGrid("getNodeChildren",c),f=e.p.treeReader.expanded_field;a(b).each(function(){var g=a.jgrid.getAccessor(this,e.p.localReader.id);a("#"+g,e.grid.bDiv).css("display","");this[f]&&a(e).jqGrid("expandRow",this)})}})},collapseRow:function(c){this.each(function(){var e= this;if(e.grid&&e.p.treeGrid){var b=a(e).jqGrid("getNodeChildren",c),f=e.p.treeReader.expanded_field;a(b).each(function(){var g=a.jgrid.getAccessor(this,e.p.localReader.id);a("#"+g,e.grid.bDiv).css("display","none");this[f]&&a(e).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var c=[];this.each(function(){var e=this;if(e.grid&&e.p.treeGrid)switch(e.p.treeGridModel){case "nested":var b=e.p.treeReader.level_field;a(e.p.data).each(function(){parseInt(this[b],10)===parseInt(e.p.tree_root_level, 10)&&c.push(this)});break;case "adjacency":var f=e.p.treeReader.parent_id_field;a(e.p.data).each(function(){if(this[f]===null||String(this[f]).toLowerCase()=="null")c.push(this)})}});return c},getNodeDepth:function(c){var e=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":e=parseInt(c[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":e=a(this).jqGrid("getNodeAncestors",c).length}});return e},getNodeParent:function(c){var e= null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(c[b],10),j=parseInt(c[f],10),d=parseInt(c[g],10);a(this.p.data).each(function(){if(parseInt(this[g],10)===d-1&&parseInt(this[b],10)j){e=this;return false}});break;case "adjacency":var l=this.p.treeReader.parent_id_field,k=this.p.localReader.id;a(this.p.data).each(function(){if(this[k]== c[l]){e=this;return false}})}});return e},getNodeChildren:function(c){var e=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(c[b],10),j=parseInt(c[f],10),d=parseInt(c[g],10);a(this.p.data).each(function(){parseInt(this[g],10)===d+1&&parseInt(this[b],10)>h&&parseInt(this[f],10)=l&&parseInt(this[f],10)>=j&&parseInt(this[f],10)<=d&&e.push(this)}); break;case "adjacency":e.push(c);var k=this.p.treeReader.parent_id_field,m=this.p.localReader.id;a(this.p.data).each(function(p){b=e.length;for(p=0;p0?true:false}});return e},expandNode:function(c){return this.each(function(){if(this.grid&&this.p.treeGrid){var e=this.p.treeReader.expanded_field;if(!c[e]){var b= a.jgrid.getAccessor(c,this.p.localReader.id),f=a("#"+b,this.grid.bDiv)[0],g=this.p._index[b];if(a(this).jqGrid("isNodeLoaded",this.p.data[g])){c[e]=true;a("div.treeclick",f).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{c[e]=true;a("div.treeclick",f).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=f.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam", {postData:{nodeid:b,n_left:c.lft,n_right:c.rgt,n_level:c.level}}):a(this).jqGrid("setGridParam",{postData:{nodeid:b,parentid:c.parent_id,n_level:c.level}});a(this).trigger("reloadGrid");this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(c){return this.each(function(){if(this.grid&&this.p.treeGrid)if(c.expanded){c.expanded=false; var e=a.jgrid.getAccessor(c,this.p.localReader.id);e=a("#"+e,this.grid.bDiv)[0];a("div.treeclick",e).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},SortTree:function(c,e,b,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,h,j,d=[],l=this,k;g=a(this).jqGrid("getRootNodes");g=a.jgrid.from(g);g.orderBy(c,e,b,f);k=g.select();g=0;for(h=k.length;g0)for(var f=0;f";try{l=b.formatter(j,f.sortnames[0][p],k,f.sortitems[0])}catch(v){l= f.sortnames[0][p]}g+=''+h+a.jgrid.format(f.groupText[0],l,c[q].length)+"";for(var r=0;r
    ";l+="
    "+(!c.updateAfterCheck?""+c.bSubmit+"":"")+" "+(""+ c.bCancel+"")+"
    ";c.gbox="#gbox_"+h;a.jgrid.createModal(d,l,c,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);if(c.saveicon[0]==true)a("#dData","#"+j+"_2").addClass(c.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(c.closeicon[0]==true)a("#eData","#"+j+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");c.updateAfterCheck? a(":input","#"+j).click(function(){var k=this.id.substr(4);if(k){this.checked?a(e).jqGrid("showCol",k):a(e).jqGrid("hideCol",k);c.ShrinkToFit===true&&a(e).jqGrid("setGridWidth",e.grid.width-0.0010,true)}return this}):a("#dData","#"+j+"_2").click(function(){for(i=0;igrid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},c||{});return this.each(function(){var e=this,b=function(h,j){var d=a(j.xmlGrid.config,h)[0],l=a(j.xmlGrid.data,h)[0],k;if(xmlJsonClass.xml2json&&a.jgrid.parse){d=xmlJsonClass.xml2json(d," ");d=a.jgrid.parse(d);for(var m in d)if(d.hasOwnProperty(m))k=d[m];if(l){l=d.grid.datatype; d.grid.datatype="xmlstring";d.grid.datastr=h;a(e).jqGrid(k).jqGrid("setGridParam",{datatype:l})}else a(e).jqGrid(k)}else alert("xml2json or parse are not present")},f=function(h,j){if(h&&typeof h=="string"){var d=a.jgrid.parse(h),l=d[j.jsonGrid.config];if(d=d[j.jsonGrid.data]){var k=l.datatype;l.datatype="jsonstring";l.datastr=d;a(e).jqGrid(l).jqGrid("setGridParam",{datatype:k})}else a(e).jqGrid(l)}};switch(c.imptype){case "xml":a.ajax(a.extend({url:c.impurl,type:c.mtype,data:c.impData,dataType:"xml", complete:function(h,j){if(j=="success"){b(h.responseXML,c);a.isFunction(c.importComplete)&&c.importComplete(h)}}},c.ajaxOptions));break;case "xmlstring":if(c.impstring&&typeof c.impstring=="string"){var g=a.jgrid.stringToDoc(c.impstring);if(g){b(g,c);a.isFunction(c.importComplete)&&c.importComplete(g);c.impstring=null}g=null}break;case "json":a.ajax(a.extend({url:c.impurl,type:c.mtype,data:c.impData,dataType:"json",complete:function(h,j){if(j=="success"){f(h.responseText,c);a.isFunction(c.importComplete)&& c.importComplete(h)}}},c.ajaxOptions));break;case "jsonstring":if(c.impstring&&typeof c.impstring=="string"){f(c.impstring,c);a.isFunction(c.importComplete)&&c.importComplete(c.impstring);c.impstring=null}}})},jqGridExport:function(c){c=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},c||{});var e=null;this.each(function(){if(this.grid){var b=a.extend({},a(this).jqGrid("getGridParam"));if(b.rownumbers){b.colNames.splice(0,1);b.colModel.splice(0,1)}if(b.multiselect){b.colNames.splice(0,1);b.colModel.splice(0, 1)}if(b.subGrid){b.colNames.splice(0,1);b.colModel.splice(0,1)}b.knv=null;if(b.treeGrid)for(var f in b.treeReader)if(b.treeReader.hasOwnProperty(f)){b.colNames.splice(b.colNames.length-1);b.colModel.splice(b.colModel.length-1)}switch(c.exptype){case "xmlstring":e="<"+c.root+">"+xmlJsonClass.json2xml(b,c.ident)+"";break;case "jsonstring":e="{"+xmlJsonClass.toJson(b,c.root,c.ident)+"}";if(b.postData.filters!==undefined){e=e.replace(/filters":"/,'filters":');e=e.replace(/}]}"/,"}]}")}}}}); return e},excelExport:function(c){c=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},c||{});return this.each(function(){if(this.grid){var e;if(c.exptype=="remote"){e=a.extend({},this.p.postData);e[c.oper]=c.tag;e=jQuery.param(e);e=c.url.indexOf("?")!=-1?c.url+"&"+e:c.url+"?"+e;window.location=e}}})}})})(jQuery); (function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(c){return typeof c==="boolean"},isObject:function(c){return c&&(typeof c==="object"||a.isFunction(c))||false},isString:function(c){return typeof c==="string"},isNumber:function(c){return typeof c==="number"&&isFinite(c)},isNull:function(c){return c===null},isUndefined:function(c){return typeof c==="undefined"},isValue:function(c){return this.isObject(c)||this.isString(c)||this.isNumber(c)||this.isBoolean(c)},isEmpty:function(c){if(!this.isString(c)&& this.isValue(c))return false;else if(!this.isValue(c))return true;c=a.trim(c).replace(/\ \;/ig,"").replace(/\ \;/ig,"");return c===""}});a.fn.fmatter=function(c,e,b,f,g){var h=e;b=a.extend({},a.jgrid.formatter,b);if(a.fn.fmatter[c])h=a.fn.fmatter[c](e,b,f,g);return h};a.fmatter.util={NumberFormat:function(c,e){a.fmatter.isNumber(c)||(c*=1);if(a.fmatter.isNumber(c)){var b=c<0,f=c+"",g=e.decimalSeparator?e.decimalSeparator:".",h;if(a.fmatter.isNumber(e.decimalPlaces)){var j=e.decimalPlaces; f=Math.pow(10,j);f=Math.round(c*f)/f+"";h=f.lastIndexOf(".");if(j>0){if(h<0){f+=g;h=f.length-1}else if(g!==".")f=f.replace(".",g);for(;f.length-1-h-1?h:f.length;g=f.substring(h);for(var d=-1,l=h;l>0;l--){d++;if(d%3===0&&l!==h&&(!b||l>1))g=j+g;g=f.charAt(l-1)+g}f=g}f=e.prefix?e.prefix+f:f;return f=e.suffix?f+e.suffix:f}else return c},DateFormat:function(c,e,b,f){var g=/^\/Date((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?)\/$/, h=typeof e==="string"?e.match(g):null;g=function(s,A){s=String(s);for(A=parseInt(A,10)||2;s.length11)e[h]=d+1-12}if(e[h])j[c[h].toLowerCase()]=parseInt(e[h],10)}if(j.f)j.m=j.f;if(j.m===0&&j.y===0&&j.d===0)return" ";j.m=parseInt(j.m,10)-1;d=j.y;if(d>=70&&d<=99)j.y=1900+j.y;else if(d>=0&&d<=69)j.y=2E3+j.y;d=new Date(j.y, j.m,j.d,j.h,j.i,j.s,j.u)}if(b in f.masks)b=f.masks[b];else b||(b="Y-m-d");c=d.getHours();e=d.getMinutes();j=d.getDate();h=d.getMonth()+1;l=d.getTimezoneOffset();var m=d.getSeconds(),p=d.getMilliseconds(),q=d.getDay(),v=d.getFullYear(),r=(q+6)%7+1,n=(new Date(v,h-1,j)-new Date(v,0,1))/864E5,o={d:g(j),D:k.i18n.dayNames[q],j:j,l:k.i18n.dayNames[q+7],N:r,S:f.S(j),w:q,z:n,W:r<5?Math.floor((n+r-1)/7)+1:Math.floor((n+r-1)/7)||(((new Date(v-1,0,1)).getDay()+6)%7<4?53:52),F:k.i18n.monthNames[h-1+12],m:g(h), M:k.i18n.monthNames[h-1],n:h,t:"?",L:"?",o:"?",Y:v,y:String(v).substring(2),a:c<12?f.AmPm[0]:f.AmPm[1],A:c<12?f.AmPm[2]:f.AmPm[3],B:"?",g:c%12||12,G:c,h:g(c%12||12),H:g(c),i:g(e),s:g(m),u:p,e:"?",I:"?",O:(l>0?"-":"+")+g(Math.floor(Math.abs(l)/60)*100+Math.abs(l)%60,4),P:"?",T:(String(d).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(d/ 1E3)};return b.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(s){return s in o?o[s]:s.substring(1)})}};a.fn.fmatter.defaultFormat=function(c,e){return a.fmatter.isValue(c)&&c!==""?c:e.defaultValue?e.defaultValue:" "};a.fn.fmatter.email=function(c,e){return a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,e):''+c+""};a.fn.fmatter.checkbox=function(c,e){var b=a.extend({},e.checkbox),f;a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend({},b, e.colModel.formatoptions));f=b.disabled===true?'disabled="disabled"':"";if(a.fmatter.isEmpty(c)||a.fmatter.isUndefined(c))c=a.fn.fmatter.defaultFormat(c,b);c+="";c=c.toLowerCase();return'"};a.fn.fmatter.link=function(c,e){var b={target:e.target},f="";a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend({},b,e.colModel.formatoptions));if(b.target)f="target="+b.target;return a.fmatter.isEmpty(c)? a.fn.fmatter.defaultFormat(c,e):"'+c+""};a.fn.fmatter.showlink=function(c,e){var b={baseLinkUrl:e.baseLinkUrl,showAction:e.showAction,addParam:e.addParam||"",target:e.target,idName:e.idName},f="";a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend({},b,e.colModel.formatoptions));if(b.target)f="target="+b.target;b=b.baseLinkUrl+b.showAction+"?"+b.idName+"="+e.rowId+b.addParam;return a.fmatter.isString(c)||a.fmatter.isNumber(c)?"'+c+"":a.fn.fmatter.defaultFormat(c, e)};a.fn.fmatter.integer=function(c,e){var b=a.extend({},e.integer);a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend({},b,e.colModel.formatoptions));if(a.fmatter.isEmpty(c))return b.defaultValue;return a.fmatter.util.NumberFormat(c,b)};a.fn.fmatter.number=function(c,e){var b=a.extend({},e.number);a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend({},b,e.colModel.formatoptions));if(a.fmatter.isEmpty(c))return b.defaultValue;return a.fmatter.util.NumberFormat(c,b)};a.fn.fmatter.currency= function(c,e){var b=a.extend({},e.currency);a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend({},b,e.colModel.formatoptions));if(a.fmatter.isEmpty(c))return b.defaultValue;return a.fmatter.util.NumberFormat(c,b)};a.fn.fmatter.date=function(c,e,b,f){b=a.extend({},e.date);a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend({},b,e.colModel.formatoptions));return!b.reformatAfterEdit&&f=="edit"?a.fn.fmatter.defaultFormat(c,e):a.fmatter.isEmpty(c)?a.fn.fmatter.defaultFormat(c,e):a.fmatter.util.DateFormat(b.srcformat, c,b.newformat,b)};a.fn.fmatter.select=function(c,e){c+="";var b=false,f=[];if(a.fmatter.isUndefined(e.colModel.formatoptions)){if(!a.fmatter.isUndefined(e.colModel.editoptions))b=e.colModel.editoptions.value}else b=e.colModel.formatoptions.value;if(b){var g=e.colModel.editoptions.multiple===true?true:false,h=[],j;if(g){h=c.split(",");h=a.map(h,function(m){return a.trim(m)})}if(a.fmatter.isString(b))for(var d=b.split(";"),l=0,k=0;k2)j[1]=jQuery.map(j,function(m, p){if(p>0)return m}).join(":");if(g){if(jQuery.inArray(j[0],h)>-1){f[l]=j[1];l++}}else if(a.trim(j[0])==a.trim(c)){f[0]=j[1];break}}else if(a.fmatter.isObject(b))if(g)f=jQuery.map(h,function(m){return b[m]});else f[0]=b[c]||""}c=f.join(", ");return c===""?a.fn.fmatter.defaultFormat(c,e):c};a.fn.fmatter.rowactions=function(c,e,b,f){var g={keys:false,editbutton:true,delbutton:true,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{}}; f=a("#"+e)[0].p.colModel[f];a.fmatter.isUndefined(f.formatoptions)||(g=a.extend(g,f.formatoptions));f=function(j){g.afterSave&&g.afterSave(j);a("tr#"+c+" div.ui-inline-edit, tr#"+c+" div.ui-inline-del","#"+e).show();a("tr#"+c+" div.ui-inline-save, tr#"+c+" div.ui-inline-cancel","#"+e).hide()};var h=function(j){g.afterRestore&&g.afterRestore(j);a("tr#"+c+" div.ui-inline-edit, tr#"+c+" div.ui-inline-del","#"+e).show();a("tr#"+c+" div.ui-inline-save, tr#"+c+" div.ui-inline-cancel","#"+e).hide()};switch(b){case "edit":a("#"+ e).jqGrid("editRow",c,g.keys,g.onEdit,g.onSuccess,g.url,g.extraparam,f,g.onError,h);a("tr#"+c+" div.ui-inline-edit, tr#"+c+" div.ui-inline-del","#"+e).hide();a("tr#"+c+" div.ui-inline-save, tr#"+c+" div.ui-inline-cancel","#"+e).show();break;case "save":a("#"+e).jqGrid("saveRow",c,g.onSuccess,g.url,g.extraparam,f,g.onError,h);a("tr#"+c+" div.ui-inline-edit, tr#"+c+" div.ui-inline-del","#"+e).show();a("tr#"+c+" div.ui-inline-save, tr#"+c+" div.ui-inline-cancel","#"+e).hide();break;case "cancel":a("#"+ e).jqGrid("restoreRow",c,h);a("tr#"+c+" div.ui-inline-edit, tr#"+c+" div.ui-inline-del","#"+e).show();a("tr#"+c+" div.ui-inline-save, tr#"+c+" div.ui-inline-cancel","#"+e).hide();break;case "del":a("#"+e).jqGrid("delGridRow",c,g.delOptions)}};a.fn.fmatter.actions=function(c,e){var b={keys:false,editbutton:true,delbutton:true};a.fmatter.isUndefined(e.colModel.formatoptions)||(b=a.extend(b,e.colModel.formatoptions));var f=e.rowId,g="",h;if(typeof f=="undefined"||a.fmatter.isEmpty(f))return"";if(b.editbutton){h= "onclick=$.fn.fmatter.rowactions('"+f+"','"+e.gid+"','edit',"+e.pos+");";g=g+"
    "}if(b.delbutton){h="onclick=$.fn.fmatter.rowactions('"+f+"','"+e.gid+"','del',"+e.pos+");";g=g+"
    "}h= "onclick=$.fn.fmatter.rowactions('"+f+"','"+e.gid+"','save',"+e.pos+");";g=g+"";h="onclick=$.fn.fmatter.rowactions('"+f+"','"+e.gid+"','cancel',"+e.pos+");";return g=g+"
    "}; a.unformat=function(c,e,b,f){var g,h=e.colModel.formatter,j=e.colModel.formatoptions||{},d=/([\.\*\_\'\(\)\{\}\+\?\\])/g,l=e.colModel.unformat||a.fn.fmatter[h]&&a.fn.fmatter[h].unformat;if(typeof l!=="undefined"&&a.isFunction(l))g=l(a(c).text(),e,c);else if(!a.fmatter.isUndefined(h)&&a.fmatter.isString(h)){g=a.jgrid.formatter||{};switch(h){case "integer":j=a.extend({},g.integer,j);e=j.thousandsSeparator.replace(d,"\\$1");e=RegExp(e,"g");g=a(c).text().replace(e,"");break;case "number":j=a.extend({}, g.number,j);e=j.thousandsSeparator.replace(d,"\\$1");e=RegExp(e,"g");g=a(c).text().replace(e,"").replace(j.decimalSeparator,".");break;case "currency":j=a.extend({},g.currency,j);e=j.thousandsSeparator.replace(d,"\\$1");e=RegExp(e,"g");g=a(c).text().replace(e,"").replace(j.decimalSeparator,".").replace(j.prefix,"").replace(j.suffix,"");break;case "checkbox":j=e.colModel.editoptions?e.colModel.editoptions.value.split(":"):["Yes","No"];g=a("input",c).attr("checked")?j[0]:j[1];break;case "select":g= a.unformat.select(c,e,b,f);break;case "actions":return"";default:g=a(c).text()}}return g?g:f===true?a(c).text():a.jgrid.htmlDecode(a(c).html())};a.unformat.select=function(c,e,b,f){b=[];c=a(c).text();if(f===true)return c;e=a.extend({},e.colModel.editoptions);if(e.value){var g=e.value;e=e.multiple===true?true:false;f=[];var h;if(e){f=c.split(",");f=a.map(f,function(k){return a.trim(k)})}if(a.fmatter.isString(g))for(var j=g.split(";"),d=0,l=0;l2)h[1]=jQuery.map(h, function(k,m){if(m>0)return k}).join(":");if(e){if(jQuery.inArray(h[1],f)>-1){b[d]=h[0];d++}}else if(a.trim(h[1])==a.trim(c)){b[0]=h[0];break}}else if(a.fmatter.isObject(g)||a.isArray(g)){e||(f[0]=c);b=jQuery.map(f,function(k){var m;a.each(g,function(p,q){if(q==k){m=p;return false}});if(typeof m!="undefined")return m})}return b.join(", ")}else return c||""};a.unformat.date=function(c,e){var b=a.jgrid.formatter.date||{};a.fmatter.isUndefined(e.formatoptions)||(b=a.extend({},b,e.formatoptions));return a.fmatter.isEmpty(c)? a.fn.fmatter.defaultFormat(c,e):a.fmatter.util.DateFormat(b.newformat,c,b.srcformat,b)}})(jQuery); (function(a){a.fn.jqm=function(m){var p={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:g,ajaxText:"",target:g,modal:g,toTop:g,onShow:g,onHide:g,onLoad:g};return this.each(function(){if(this._jqm)return e[this._jqm].c=a.extend({},e[this._jqm].c,m);c++;this._jqm=c;e[c]={c:a.extend(p,a.jqm.params,m),a:g,w:a(this).addClass("jqmID"+c),s:c};p.trigger&&a(this).jqmAddTrigger(p.trigger)})};a.fn.jqmAddClose=function(m){return k(this,m,"jqmHide")};a.fn.jqmAddTrigger= function(m){return k(this,m,"jqmShow")};a.fn.jqmShow=function(m){return this.each(function(){a.jqm.open(this._jqm,m)})};a.fn.jqmHide=function(m){return this.each(function(){a.jqm.close(this._jqm,m)})};a.jqm={hash:{},open:function(m,p){var q=e[m],v=q.c,r="."+v.closeClass,n=parseInt(q.w.css("z-index"));n=n>0?n:3E3;var o=a("
    ").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":n-1,opacity:v.overlay/100});if(q.a)return g;q.t=p;q.a=true;q.w.css("z-index",n);if(v.modal){b[0]|| setTimeout(function(){d("bind")},1);b.push(m)}else if(v.overlay>0)v.closeoverlay&&q.w.jqmAddClose(o);else o=g;q.o=o?o.addClass(v.overlayClass).prependTo("body"):g;if(f){a("html,body").css({height:"100%",width:"100%"});if(o){o=o.css({position:"absolute"})[0];for(var s in{Top:1,Left:1})o.style.setExpression(s.toLowerCase(),"(_=(document.documentElement.scroll"+s+" || document.body.scroll"+s+"))+'px'")}}if(v.ajax){n=v.target||q.w;o=v.ajax;n=typeof n=="string"?a(n,q.w):a(n);o=o.substr(0,1)=="@"?a(p).attr(o.substring(1)): o;n.html(v.ajaxText).load(o,function(){v.onLoad&&v.onLoad.call(this,q);r&&q.w.jqmAddClose(a(r,q.w));h(q)})}else r&&q.w.jqmAddClose(a(r,q.w));v.toTop&&q.o&&q.w.before('').insertAfter(q.o);v.onShow?v.onShow(q):q.w.show();h(q);return g},close:function(m){m=e[m];if(!m.a)return g;m.a=g;if(b[0]){b.pop();b[0]||d("unbind")}m.c.toTop&&m.o&&a("#jqmP"+m.w[0]._jqm).after(m.w).remove();if(m.c.onHide)m.c.onHide(m);else{m.w.hide();m.o&&m.o.remove()}return g},params:{}};var c= 0,e=a.jqm.hash,b=[],f=a.browser.msie&&a.browser.version=="6.0",g=false,h=function(m){var p=a('').css({opacity:0});if(f)if(m.o)m.o.html('

    ').prepend(p);else a("iframe.jqm",m.w)[0]||m.w.prepend(p);j(m)},j=function(m){try{a(":input:visible",m.w)[0].focus()}catch(p){}},d=function(m){a(document)[m]("keypress",l)[m]("keydown",l)[m]("mousedown",l)},l=function(m){var p=e[b[b.length-1]];(m=!a(m.target).parents(".jqmID"+ p.s)[0])&&j(p);return!m},k=function(m,p,q){return m.each(function(){var v=this._jqm;a(p).each(function(){if(!this[q]){this[q]=[];a(this).click(function(){for(var r in{jqmShow:1,jqmHide:1})for(var n in this[r])e[this[r][n]]&&e[this[r][n]].w[r](this);return g})}this[q].push(v)})})}})(jQuery); (function(a){a.fn.jqDrag=function(j){return g(this,j,"d")};a.fn.jqResize=function(j,d){return g(this,j,"r",d)};a.jqDnR={dnr:{},e:0,drag:function(j){if(e.k=="d")b.css({left:e.X+j.pageX-e.pX,top:e.Y+j.pageY-e.pY});else{b.css({width:Math.max(j.pageX-e.pX+e.W,0),height:Math.max(j.pageY-e.pY+e.H,0)});M1&&f.css({width:Math.max(j.pageX-M1.pX+M1.W,0),height:Math.max(j.pageY-M1.pY+M1.H,0)})}return false},stop:function(){a(document).unbind("mousemove",c.drag).unbind("mouseup",c.stop)}};var c=a.jqDnR,e=c.dnr, b=c.e,f,g=function(j,d,l,k){return j.each(function(){d=d?a(d,j):j;d.bind("mousedown",{e:j,k:l},function(m){var p=m.data,q={};b=p.e;f=k?a(k):false;if(b.css("position")!="relative")try{b.position(q)}catch(v){}e={X:q.left||h("left")||0,Y:q.top||h("top")||0,W:h("width")||b[0].scrollWidth||0,H:h("height")||b[0].scrollHeight||0,pX:m.pageX,pY:m.pageY,k:p.k};M1=f&&p.k!="d"?{X:q.left||f1("left")||0,Y:q.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:m.pageX,pY:m.pageY, k:p.k}:false;try{a("input.hasDatepicker",b[0]).datepicker("hide")}catch(r){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return false})})},h=function(j){return parseInt(b.css(j))||false};f1=function(j){return parseInt(f.css(j))||false}})(jQuery); var xmlJsonClass={xml2json:function(a,c){if(a.nodeType===9)a=a.documentElement;var e=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+c+(c?e.replace(/\t/g,c):e.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,c){var e=function(g,h,j){var d="",l,k;if(g instanceof Array)if(g.length===0)d+=j+"<"+h+">__EMPTY_ARRAY_\n";else{l=0;for(k=g.length;l":"/>";if(l){for(k in g)if(g.hasOwnProperty(k))if(k==="#text")d+=g[k];else if(k==="#cdata")d+="";else if(k.charAt(0)!=="@")d+=e(g[k],k,j+"\t");d+=(d.charAt(d.length-1)==="\n"?j:"")+""}}else d+=typeof g==="function"?j+"<"+h+">":g.toString()==='""'||g.toString().length===0?j+"<"+h+">__EMPTY_STRING_":j+"<"+h+">"+g.toString()+"";return d},b="",f;for(f in a)if(a.hasOwnProperty(f))b+= e(a[f],f,"");return c?b.replace(/\t/g,c):b.replace(/\t|\n/g,"")},toObj:function(a){var c={},e=/function/i;if(a.nodeType===1){if(a.attributes.length){var b;for(b=0;b1)c=this.escape(this.innerXml(a));else for(h=a.firstChild;h;h=h.nextSibling)if(e.test(a.firstChild.nodeValue)){c=a.firstChild.nodeValue;break}else c["#cdata"]=this.escape(h.nodeValue)}if(!a.attributes.length&&!a.firstChild)c=null}else if(a.nodeType===9)c=this.toObj(a.documentElement);else alert("unhandled node type: "+ a.nodeType);return c},toJson:function(a,c,e){var b=c?'"'+c+'"':"";if(a==="[]")b+=c?":[]":"[]";else if(a instanceof Array){var f,g,h=[];g=0;for(f=a.length;g1?"\n"+e+"\t"+h.join(",\n"+e+"\t")+"\n"+e:h.join(""))+"]"}else if(a===null)b+=(c&&":")+"null";else if(typeof a==="object"){f=[];for(g in a)if(a.hasOwnProperty(g))f[f.length]=this.toJson(a[g],g,e+"\t");b+=(c?":{":"{")+(f.length>1?"\n"+e+"\t"+f.join(",\n"+e+"\t")+"\n"+e:f.join(""))+ "}"}else if(typeof a==="string"){e=/function/i;f=a.toString();b+=/(^-?\d+\.?\d*$)/.test(f)||e.test(f)||f==="false"||f==="true"?(c&&":")+f:(c&&":")+'"'+a+'"'}else b+=(c&&":")+a.toString();return b},innerXml:function(a){var c="";if("innerHTML"in a)c=a.innerHTML;else{var e=function(b){var f="",g;if(b.nodeType===1){f+="<"+b.nodeName;for(g=0;g"}else f+="/>"}else if(b.nodeType===3)f+=b.nodeValue;else if(b.nodeType===4)f+="";return f};for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}return c},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var c;for(c=a.firstChild;c;)if(c.nodeType===3)if(c.nodeValue.match(/[^ \f\n\r\t\v]/))c=c.nextSibling;else{var e=c.nextSibling;a.removeChild(c); c=e}else{c.nodeType===1&&this.removeWhite(c);c=c.nextSibling}return a}}; (function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(e){return e.offsetWidth===0||e.offsetHeight===0||e.style.display=="none"};a.jgrid._multiselect=false;if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var c=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(e,b){var f=c.call(this,e,b);if(b&&this.selectedList){var g=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(g)})}return f}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy= function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=true}a.jgrid.extend({sortableColumns:function(e){return this.each(function(){function b(){f.p.disableClick=true}var f=this,g={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)",placeholder:{element:function(j){return a(document.createElement(j[0].nodeName)).addClass(j[0].className+ " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(j,d){d.height(j.currentItem.innerHeight()-parseInt(j.currentItem.css("paddingTop")||0,10)-parseInt(j.currentItem.css("paddingBottom")||0,10));d.width(j.currentItem.innerWidth()-parseInt(j.currentItem.css("paddingLeft")||0,10)-parseInt(j.currentItem.css("paddingRight")||0,10))}},update:function(j,d){var l=a(d.item).parent();l=a(">th",l);var k={};a.each(f.p.colModel,function(p){k[this.name]=p});var m= [];l.each(function(){var p=a(">div",this).get(0).id.replace(/^jqgh_/,"");p in k&&m.push(k[p])});a(f).jqGrid("remapColumns",m,true,true);a.isFunction(f.p.sortable.update)&&f.p.sortable.update(m);setTimeout(function(){f.p.disableClick=false},50)}};if(f.p.sortable.options)a.extend(g,f.p.sortable.options);else if(a.isFunction(f.p.sortable))f.p.sortable={update:f.p.sortable};if(g.start){var h=g.start;g.start=function(j,d){b();h.call(this,j,d)}}else g.start=b;if(f.p.sortable.exclude)g.items+=":not("+f.p.sortable.exclude+ ")";e.sortable(g).data("sortable").floating=true})},columnChooser:function(e){function b(p,q){if(p)if(typeof p=="string")a.fn[p]&&a.fn[p].apply(q,a.makeArray(arguments).slice(2));else a.isFunction(p)&&p.apply(q,a.makeArray(arguments).slice(2))}var f=this;if(!a("#colchooser_"+f[0].p.id).length){var g=a('

    '),h=a("select",g);e=a.extend({width:420,height:240,classname:null, done:function(p){p&&f.jqGrid("remapColumns",p,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(p){var q={};q[p.bSubmit]=function(){p.apply_perm();p.cleanup(false)};q[p.bCancel]=function(){p.cleanup(true)};return{buttons:q,close:function(){p.cleanup(true)},modal:false,resizable:false,width:p.width+20}},apply_perm:function(){a("option",h).each(function(){this.selected?f.jqGrid("showCol",j[this.value].name):f.jqGrid("hideCol",j[this.value].name)});var p=[];a("option[selected]",h).each(function(){p.push(parseInt(this.value, 10))});a.each(p,function(){delete l[j[parseInt(this,10)].name]});a.each(l,function(){var q=parseInt(this,10);var v=p,r=q;if(r>=0){var n=v.slice(),o=n.splice(r,Math.max(v.length-r,r));if(r>v.length)r=v.length;n[r]=q;p=n.concat(o)}else p=void 0});e.done&&e.done.call(f,p)},cleanup:function(p){b(e.dlog,g,"destroy");b(e.msel,h,"destroy");g.remove();p&&e.done&&e.done.call(f)},msel_opts:{}},a.jgrid.col,e||{});if(a.ui)if(a.ui.multiselect)if(e.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!"); return}e.msel_opts=a.extend(a.ui.multiselect.defaults,e.msel_opts)}e.caption&&g.attr("title",e.caption);if(e.classname){g.addClass(e.classname);h.addClass(e.classname)}if(e.width){a(">div",g).css({width:e.width,margin:"0 auto"});h.css("width",e.width)}if(e.height){a(">div",g).css("height",e.height);h.css("height",e.height-10)}var j=f.jqGrid("getGridParam","colModel"),d=f.jqGrid("getGridParam","colNames"),l={},k=[];h.empty();a.each(j,function(p){l[this.name]=p;if(this.hidedlg)this.hidden||k.push(p); else h.append("")});var m=a.isFunction(e.dlog_opts)?e.dlog_opts.call(f,e):e.dlog_opts;b(e.dlog,g,m);m=a.isFunction(e.msel_opts)?e.msel_opts.call(f,e):e.msel_opts;b(e.msel,h,m)}},sortableRows:function(e){return this.each(function(){var b=this;if(b.grid)if(!b.p.treeGrid)if(a.fn.sortable){e=a.extend({cursor:"move",axis:"y",items:".jqgrow"},e||{});if(e.start&&a.isFunction(e.start)){e._start_=e.start;delete e.start}else e._start_= false;if(e.update&&a.isFunction(e.update)){e._update_=e.update;delete e.update}else e._update_=false;e.start=function(f,g){a(g.item).css("border-width","0px");a("td",g.item).each(function(d){this.style.width=b.grid.cols[d].style.width});if(b.p.subGrid){var h=a(g.item).attr("id");try{a(b).jqGrid("collapseSubGridRow",h)}catch(j){}}e._start_&&e._start_.apply(this,[f,g])};e.update=function(f,g){a(g.item).css("border-width","");b.p.rownumbers===true&&a("td.jqgrid-rownum",b.rows).each(function(h){a(this).html(h+ 1)});e._update_&&e._update_.apply(this,[f,g])};a("tbody:first",b).sortable(e);a("tbody:first",b).disableSelection()}})},gridDnD:function(e){return this.each(function(){function b(){var h=a.data(f,"dnd");a("tr.jqgrow:not(.ui-draggable)",f).draggable(a.isFunction(h.drag)?h.drag.call(a(f),h):h.drag)}var f=this;if(f.grid)if(!f.p.treeGrid)if(a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("
    ");if(typeof e=="string"&&e== "updateDnD"&&f.p.jqgdnd===true)b();else{e=a.extend({drag:function(h){return a.extend({start:function(j,d){if(f.p.subGrid){var l=a(d.helper).attr("id");try{a(f).jqGrid("collapseSubGridRow",l)}catch(k){}}for(l=0;l 0&&a.data(d[0],"dnd")!==undefined){j=a.data(d[0],"dnd").connectWith;return a.inArray("#"+this.id,j)!=-1?true:false}return j},drop:function(j,d){if(a(d.draggable).hasClass("jqgrow")){var l=a(d.draggable).attr("id");l=d.draggable.parent().parent().jqGrid("getRowData",l);if(!h.dropbyname){var k=0,m={},p,q=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var v in l){if(l.hasOwnProperty(v)&&q[k]){p=q[k].name;m[p]=l[v]}k++}l=m}catch(r){}}d.helper.dropped=true;if(h.beforedrop&&a.isFunction(h.beforedrop)){p= h.beforedrop.call(this,j,d,l,a("#"+f.id),a(this));if(typeof p!="undefined"&&p!==null&&typeof p=="object")l=p}if(d.helper.dropped){var n;if(h.autoid)if(a.isFunction(h.autoid))n=h.autoid.call(this,l);else{n=Math.ceil(Math.random()*1E3);n=h.autoidprefix+n}a("#"+this.id).jqGrid("addRowData",n,l,h.droppos)}h.ondrop&&a.isFunction(h.ondrop)&&h.ondrop.call(this,j,d,l)}}},h.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"}, drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},e||{});if(e.connectWith){e.connectWith=e.connectWith.split(",");e.connectWith=a.map(e.connectWith,function(h){return a.trim(h)});a.data(f,"dnd",e);f.p.reccount!="0"&&!f.p.jqgdnd&&b();f.p.jqgdnd=true;for(var g=0;g"+B+""},d=function(x,B,y){return""},l=function(x,B){var y=e.find("tr.sf td.data "+x);y[0]!=null&&B(y)},k=function(x,B){var y=e.find("tr.sf td.data "+x);y[0]!=null&&jQuery.each(B,function(){this.data!= null?y.bind(this.type,this.data,this.fn):y.bind(this.type,this.fn)})},m=jQuery.extend({},jQuery.fn.searchFilter.defaults,f),p=-1,q="";jQuery.each(m.groupOps,function(){q+=j(this.op,this.text)});q="";e.html("").addClass("ui-searchFilter").append("
     
    "+ m.windowTitle+"

    "+ m.resetText+""+m.searchText+""+m.matchText+" "+q+" "+m.rulesText+" 
    "); var v=e.find("tr.sf"),r=v.find("td.fields"),n=v.find("td.ops"),o=v.find("td.data"),s="";jQuery.each(m.operators,function(){s+=j(this.op,this.text)});s=d("default",s,true);n.append(s);o.append("");var A="",C=false,D=false;jQuery.each(b,function(x){A+=j(this.itemval,this.text);if(this.ops!=null){C=true;var B="";jQuery.each(this.ops,function(){B+=j(this.op,this.text)});B=d("field"+x,B,true);n.append(B)}if(this.dataUrl!=null){if(x>p)p=x;D=true; var y=this.dataEvents,z=this.dataInit,I=this.buildSelect;jQuery.ajax(jQuery.extend({url:this.dataUrl,complete:function(U){U=I!=null?jQuery("
    ").append(I(U)):jQuery("
    ").append(U.responseText);U.find("select").addClass("field"+x).hide();o.append(U.html());z&&l(".field"+x,z);y&&k(".field"+x,y);x==p&&e.find("tr.sf td.fields select[name='field']").change()}},m.ajaxSelectOptions))}else if(this.dataValues!=null){D=true;var L="";jQuery.each(this.dataValues,function(){L+=j(this.value,this.text)}); L=d("field"+x,L,true);o.append(L)}else if(this.dataEvents!=null||this.dataInit!=null){D=true;L="";o.append(L)}this.dataInit!=null&&x!=p&&l(".field"+x,this.dataInit);this.dataEvents!=null&&x!=p&&k(".field"+x,this.dataEvents)});A="";r.append(A);b=r.find("select[name='field']");C?b.change(function(x){var B=x.target.selectedIndex;x=jQuery(x.target).parents("tr.sf").find("td.ops");x.find("select").removeAttr("name").hide();B=x.find(".field"+ B);if(B[0]==null)B=x.find(".default");B.attr("name","op").show();return false}):n.find(".default").attr("name","op").show();D?b.change(function(x){var B=x.target.selectedIndex;x=jQuery(x.target).parents("tr.sf").find("td.data");x.find("select,input").removeClass("vdata").hide();B=x.find(".field"+B);if(B[0]==null)B=x.find(".default");B.show().addClass("vdata");return false}):o.find(".default").show().addClass("vdata");if(C||D)b.change();e.find(".ui-state-default").hover(g,g).mousedown(h).mouseup(h); e.find(".ui-closer").click(function(){m.onClose(jQuery(e.selector));return false});e.find(".ui-del").click(function(x){x=jQuery(x.target).parents(".sf");if(x.siblings(".sf").length>0){m.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&x.find(".hasDatepicker").datepicker("destroy");x.remove()}else{x.find("select[name='field']")[0].selectedIndex=0;x.find("select[name='op']")[0].selectedIndex=0;x.find(".data input").val("");x.find(".data select").each(function(){this.selectedIndex=0});x.find("select[name='field']").change(function(B){B.stopPropagation()})}return false}); e.find(".ui-add").click(function(x){x=jQuery(x.target).parents(".sf");var B=x.clone(true).insertAfter(x);B.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");if(m.clone){B.find("select[name='field']")[0].selectedIndex=x.find("select[name='field']")[0].selectedIndex;if(B.find("select[name='op']")[0]!=null)B.find("select[name='op']").focus()[0].selectedIndex=x.find("select[name='op']")[0].selectedIndex;var y=B.find("select.vdata");if(y[0]!=null)y[0].selectedIndex=x.find("select.vdata")[0].selectedIndex}else{B.find(".data input").val(""); B.find("select[name='field']").focus()}m.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&x.find(".hasDatepicker").each(function(){var z=jQuery.data(this,"datepicker").settings;B.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(z)});B.find("select[name='field']").change(function(z){z.stopPropagation()});return false});e.find(".ui-search").click(function(){var x=jQuery(e.selector),B,y=x.find("select[name='groupOp'] :selected").val();B=m.stringResult?'{"groupOp":"'+ y+'","rules":[':{groupOp:y,rules:[]};x.find(".sf").each(function(z){var I=jQuery(this).find("select[name='field'] :selected").val(),L=jQuery(this).find("select[name='op'] :selected").val(),U=jQuery(this).find("input.vdata,select.vdata :selected").val();U+="";U=U.replace(/\\/g,"\\\\").replace(/\"/g,'\\"');if(m.stringResult){if(z>0)B+=",";B+='{"field":"'+I+'",';B+='"op":"'+L+'",';B+='"data":"'+U+'"}'}else B.rules.push({field:I,op:L,data:U})});if(m.stringResult)B+="]}";m.onSearch(B);return false});e.find(".ui-reset").click(function(x, B){var y=jQuery(e.selector);y.find(".ui-del").click();y.find("select[name='groupOp']")[0].selectedIndex=0;m.onReset(B);return false});e.find(".ui-add-last").click(function(){var x=jQuery(e.selector+" .sf:last"),B=x.clone(true).insertAfter(x);B.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");B.find(".data input").val("");B.find("select[name='field']").focus();m.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&x.find(".hasDatepicker").each(function(){var y=jQuery.data(this, "datepicker").settings;B.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(y)});B.find("select[name='field']").change(function(y){y.stopPropagation()});return false});this.setGroupOp=function(x){selDOMobj=e.find("select[name='groupOp']")[0];var B={},y=selDOMobj.options.length,z;for(z=0;z select[class='field"+z+"']")[0]){I=0;for(U=selDOMobj.options.length;I select[class='field"+z+"']")[0]){ha[y[z]].data={};I=0;for(U=selDOMobj.options.length;I