(function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{htmlDecode:function(d){if(d==" "||d==" "||d.length==1&&d.charCodeAt(0)==160)return"";return!d?d:String(d).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"')},htmlEncode:function(d){return!d?d:String(d).replace(/&/g,"&").replace(/>/g,">").replace(/])*>/gi;if(d)return(d=d.replace(e,""))&&d!==" "&&d!==" "?d:"";else return d},stringToDoc:function(d){var e;if(typeof d!=="string")return d;try{e=(new DOMParser).parseFromString(d,"text/xml")}catch(b){e=new ActiveXObject("Microsoft.XMLDOM");e.async=false; e.loadXML(d)}return e&&e.documentElement&&e.documentElement.tagName!="parsererror"?e:null},parse:function(d){d=d;if(d.substr(0,9)=="while(1);")d=d.substr(9);if(d.substr(0,2)=="/*")d=d.substr(2,d.length-4);d||(d="{}");d=a.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(d):eval("("+d+")");return d.hasOwnProperty("d")?d.d:d},jqID:function(d){d+="";return d.replace(/([\.\:\[\]])/g,"\\$1")},ajaxOptions:{},extend:function(d){a.extend(a.fn.jqGrid,d);this.no_legacy_api|| a.fn.extend(d)}});a.fn.jqGrid=function(d){if(typeof d=="string"){var e=a.fn.jqGrid[d];if(!e)throw"jqGrid - No such method: "+d;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,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},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20, multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:200},a.jgrid.defaults,d||{}),g={headers:[],cols:[],footers:[],dragStart:function(p,s,t){this.resizing={idx:p,startX:s.clientX,sOL:t[0]};this.hDiv.style.cursor= "col-resize";this.curGbox=a("#rs_m"+f.id,"#gbox_"+f.id);this.curGbox.css({display:"block",left:t[0],top:t[1],height:t[2]});a.isFunction(f.resizeStart)&&f.resizeStart.call(this,s,p);document.onselectstart=function(){return false}},dragMove:function(p){if(this.resizing){var s=p.clientX-this.resizing.startX;p=this.headers[this.resizing.idx];var t=f.direction==="ltr"?p.width+s:p.width-s,B;if(t>33){this.curGbox.css({left:this.resizing.sOL+s});if(f.forceFit===true){B=this.headers[this.resizing.idx+f.nv]; s=f.direction==="ltr"?B.width-s:B.width+s;if(s>33){p.newWidth=t;B.newWidth=s}}else{this.newWidth=f.direction==="ltr"?f.tblwidth+s:f.tblwidth-s;p.newWidth=t}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var p=this.resizing.idx,s=this.headers[p].newWidth||this.headers[p].width;s=parseInt(s,10);this.resizing=false;a("#rs_m"+f.id).css("display","none");f.colModel[p].width=s;this.headers[p].width=s;this.headers[p].el.style.width=s+"px";if(this.cols.length>0)this.cols[p].style.width= s+"px";if(this.footers.length>0)this.footers[p].style.width=s+"px";if(f.forceFit===true){s=this.headers[p+f.nv].newWidth||this.headers[p+f.nv].width;this.headers[p+f.nv].width=s;this.headers[p+f.nv].el.style.width=s+"px";if(this.cols.length>0)this.cols[p+f.nv].style.width=s+"px";if(this.footers.length>0)this.footers[p+f.nv].style.width=s+"px";f.colModel[p+f.nv].width=s}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,s,p)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var p=a(g.bDiv).height();if(p){var s=a("table:first",g.bDiv),t=a("> tbody > tr:visible:first",s).outerHeight()||g.prevRowHeight;if(t){g.prevRowHeight= t;var B=f.rowNum,D=g.scrollTop=g.bDiv.scrollTop,G=Math.round(s.position().top)-D,H=G+s.height();t=t*B;var S,T,J;if(G<=0&&(f.lastpage===undefined||parseInt((H+D+t-1)/t,10)<=f.lastpage)){T=parseInt((p-H+t-1)/t,10);if(H>=0||T<2||f.scroll===true){S=Math.round((H+D)/t)+1;G=-1}else G=1}if(G>0){S=parseInt(D/t,10)+1;T=parseInt((D+p)/t,10)+2-S;J=true}if(T)if(!(f.lastpage&&S>f.lastpage))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,f.scrollTimeout);else{f.page=S;if(J){g.selectionPreserver(s[0]);g.emptyRows(g.bDiv, false)}g.populate(T)}}}},scrollGrid:function(){if(f.scroll){var p=g.bDiv.scrollTop;if(p!=g.scrollTop){g.scrollTop=p;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,200)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(f.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft},selectionPreserver:function(p){var s=p.p,t=s.selrow,B=s.selarrrow?a.makeArray(s.selarrrow):null,D=p.grid.bDiv.scrollLeft,G=s.gridComplete;s.gridComplete=function(){s.selrow=null;s.selarrrow=[];if(s.multiselect&&B&&B.length> 0)for(var H=0;H"),l,n=a.browser.msie?true:false,m=a.browser.safari? true:false;c=this;c.p.direction=a.trim(c.p.direction.toLowerCase());if(a.inArray(c.p.direction,["ltr","rtl"])==-1)c.p.direction="ltr";j=c.p.direction;a(k).insertBefore(this);a(this).appendTo(k).removeClass("scroll");var o=a("
");a(o).insertBefore(k).attr({id:"gbox_"+this.id,dir:j});a(k).appendTo(o).attr("id","gview_"+this.id);l=n&&a.browser.version<=6?'': "";a("
").append(l).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 q=function(p,s){p=parseInt(p,10);return isNaN(p)?s?s:0:p},r=function(p,s,t){var B=c.p.colModel[p],D=B.align,G='style="', H=B.classes,S=B.name;if(D)G+="text-align:"+D+";";if(B.hidden===true)G+="display:none;";if(s===0)G+="width: "+g.headers[p].width+"px;";G+='"'+(H!==undefined?' class="'+H+'"':"")+(B.title&&t?' title="'+a.jgrid.stripHtml(t)+'"':"");G+=' aria-describedby="'+c.p.id+"_"+S+'"';return G},u=function(p){return p===undefined||p===null||p===""?" ":c.p.autoencode?a.jgrid.htmlEncode(p):p+""},w=function(p,s,t,B,D){t=c.p.colModel[t];if(typeof t.formatter!=="undefined"){p={rowId:p,colModel:t,gid:c.p.id};s=a.isFunction(t.formatter)? t.formatter.call(c,s,p,B,D):a.fmatter?a.fn.fmatter(t.formatter,s,p,B,D):u(s)}else s=u(s);return s},z=function(p,s,t,B,D){p=w(p,s,t,D,"add");return'"+p+""},v=function(p,s,t){p='';s=r(s,t,"");return'"+p+""},C=function(p,s,t,B){t=(parseInt(t,10)-1)*parseInt(B,10)+1+s;p=r(p,s,"");return'"+t+""},E=function(p){var s,t=[],B=0,D;for(D=0;Ddiv:first",p).css({height:"auto"}).children("div:first").css({height:0,display:"none"});p.scrollTop=0}},A=function(p,s){var t,B,D;if(typeof s==="function")return s(p);t=p[s];if(t===undefined){if(typeof s==="string")D=s.split(".");try{if(D.length)for(t=p;t&&D.length;){B=D.shift();t=t[B]}}catch(G){}}return t},L=function(p,s,t,B,D){var G=new Date;c.p.reccount=0;if(a.isXMLDoc(p)){if(c.p.treeANode===-1&&!c.p.scroll){x(s,false);t=0}else t=t>0?t:0;var H,S=0,T,J,I=0,Q=0,da= 0,ha,oa,na=[],ta,ja={},Ea=c.rows.length,ia,Aa,ga=[],va=0,Fa=c.p.altRows===true?" "+c.p.altclass:"";c.p.xmlReader.repeatitems||(na=E("xml"));ha=c.p.keyIndex===false?c.p.xmlReader.id:c.p.keyIndex;if(na.length>0&&!isNaN(ha)){if(c.p.remapColumns&&c.p.remapColumns.length)ha=a.inArray(ha,c.p.remapColumns);ha=na[ha]}oa=(ha+"").indexOf("[")===-1?na.length?function(Ba,xa){return a(ha,Ba).text()||xa}:function(Ba,xa){return a(c.p.xmlReader.cell,Ba).eq(ha).text()||xa}:function(Ba,xa){return Ba.getAttribute(ha.replace(/[\[\]]/g, ""))||xa};c.p.userData={};a(c.p.xmlReader.page,p).each(function(){c.p.page=this.textContent||this.text||0});a(c.p.xmlReader.total,p).each(function(){c.p.lastpage=this.textContent||this.text;if(c.p.lastpage===undefined)c.p.lastpage=1});a(c.p.xmlReader.records,p).each(function(){c.p.records=this.textContent||this.text||0});a(c.p.xmlReader.userdata,p).each(function(){c.p.userData[this.getAttribute("name")]=this.textContent||this.text});p=a(c.p.xmlReader.root+" "+c.p.xmlReader.row,p);var Ga=p.length, qa=0;if(p&&Ga){var Ha=parseInt(c.p.rowNum,10),Ja=c.p.scroll?(parseInt(c.p.page,10)-1)*Ha+1:1;if(D)Ha*=D+1;for(D=a.isFunction(c.p.afterInsertRow);qa';if(c.p.rownumbers===true){ga[va++]=C(0,qa,c.p.page,c.p.rowNum);da=1}if(c.p.multiselect===true){ga[va++]=v(Aa,da,qa);I=1}if(c.p.subGrid===true){ga[va++]=a(c).jqGrid("addSubGridCell",I+da, qa+t);Q=1}if(c.p.xmlReader.repeatitems){ta||(ta=y(I+Q+da));var Ka=a(c.p.xmlReader.cell,ia);a.each(ta,function(Ba){var xa=Ka[this];if(!xa)return false;T=xa.textContent||xa.text;ja[c.p.colModel[Ba+I+Q+da].name]=T;ga[va++]=z(Aa,T,Ba+I+Q+da,qa+t,ia)})}else for(H=0;H";if(c.p.gridview===false){if(c.p.treeGrid===true){H=c.p.treeANode>=-1?c.p.treeANode:0;J=a(ga.join(""))[0];try{a(c).jqGrid("setTreeNode", ja,J)}catch(La){}Ea===0?a("tbody:first",s).append(J):a(c.rows[qa+H+t]).after(J)}else a("tbody:first",s).append(ga.join(""));if(c.p.subGrid===true)try{a(c).jqGrid("addSubGrid",c.rows[c.rows.length-1],I+da)}catch(Ma){}D&&c.p.afterInsertRow.call(c,Aa,ja,ia);ga=[];va=0}ja={};S++;qa++;if(S==Ha)break}}c.p.gridview===true&&a("tbody:first",s).append(ga.join(""));c.p.totaltime=new Date-G;if(S>0){c.grid.cols=c.rows[0].cells;if(c.p.records===0)c.p.records=Ga}ga=null;if(!c.p.treeGrid&&!c.p.scroll)c.grid.bDiv.scrollTop= 0;c.p.reccount=S;c.p.treeANode=-1;c.p.userDataOnFooter&&a(c).jqGrid("footerData","set",c.p.userData,true);B||aa(false,true)}},R=function(p,s,t,B,D){var G=new Date;c.p.reccount=0;if(p){if(c.p.treeANode===-1&&!c.p.scroll){x(s,false);t=0}else t=t>0?t:0;var H=0,S,T,J,I=[],Q,da=0,ha=0,oa=0,na,ta,ja,Ea={},ia,Aa=c.rows.length,ga;J=[];ia=0;var va=c.p.altRows===true?" "+c.p.altclass:"";c.p.page=A(p,c.p.jsonReader.page)||0;ja=A(p,c.p.jsonReader.total);c.p.lastpage=ja===undefined?1:ja;c.p.records=A(p,c.p.jsonReader.records)|| 0;c.p.userData=A(p,c.p.jsonReader.userdata)||{};c.p.jsonReader.repeatitems||(Q=I=E("json"));ja=c.p.keyIndex===false?c.p.jsonReader.id:c.p.keyIndex;if(I.length>0&&!isNaN(ja)){if(c.p.remapColumns&&c.p.remapColumns.length)ja=a.inArray(ja,c.p.remapColumns);ja=I[ja]}if(ta=A(p,c.p.jsonReader.root)){na=ta.length;p=0;var Fa=parseInt(c.p.rowNum,10),Ga=c.p.scroll?(parseInt(c.p.page,10)-1)*Fa+1:1;if(D)Fa*=D+1;for(var qa=a.isFunction(c.p.afterInsertRow);p';if(c.p.rownumbers===true){J[ia++]=C(0,p,c.p.page,c.p.rowNum);oa=1}if(c.p.multiselect){J[ia++]=v(ga,oa,p);da=1}if(c.p.subGrid){J[ia++]=a(c).jqGrid("addSubGridCell",da+oa,p+t);ha=1}if(c.p.jsonReader.repeatitems){if(c.p.jsonReader.cell)D=A(D,c.p.jsonReader.cell);Q||(Q=y(da+ha+oa))}for(T=0;T";if(c.p.gridview===false){if(c.p.treeGrid===true){ia=c.p.treeANode>=-1?c.p.treeANode:0;J=a(J.join(""))[0];try{a(c).jqGrid("setTreeNode",Ea,J)}catch(Ha){}Aa===0?a("tbody:first",s).append(J):a(c.rows[p+ia+t]).after(J)}else a("tbody:first",s).append(J.join(""));if(c.p.subGrid===true)try{a(c).jqGrid("addSubGrid",c.rows[c.rows.length-1],da+oa)}catch(Ja){}qa&&c.p.afterInsertRow.call(c,ga,Ea,D);J=[];ia=0}Ea={};H++; p++;if(H==Fa)break}c.p.gridview===true&&a("tbody:first",s).append(J.join(""));c.p.totaltime=new Date-G;if(H>0){c.grid.cols=c.rows[0].cells;if(c.p.records===0)c.p.records=na}}if(!c.p.treeGrid&&!c.p.scroll)c.grid.bDiv.scrollTop=0;c.p.reccount=H;c.p.treeANode=-1;c.p.userDataOnFooter&&a(c).jqGrid("footerData","set",c.p.userData,true);B||aa(false,true)}},aa=function(p,s){var t,B,D,G,H,S,T,J="";D=parseInt(c.p.page,10)-1;if(D<0)D=0;D*=parseInt(c.p.rowNum,10);H=D+c.p.reccount;if(c.p.scroll){t=a("tbody:first > tr", c.grid.bDiv);D=H-t.length;if(B=t.outerHeight()){t=D*B;B=parseInt(c.p.records,10)*B;a(">div:first",c.grid.bDiv).css({height:B}).children("div:first").css({height:t,display:t?"":"none"})}}J=c.p.pager?c.p.pager:"";J+=c.p.toppager?J?","+c.p.toppager:c.p.toppager:"";if(J){T=a.jgrid.formatter.integer||{};if(c.p.loadonce){t=B=1;c.p.lastpage=c.page=1;a(".selbox",J).attr("disabled",true)}else{t=q(c.p.page);B=q(c.p.lastpage);a(".selbox",J).attr("disabled",false)}if(c.p.pginput===true){a(".ui-pg-input",J).val(c.p.page); a("#sp_1",J).html(a.fmatter?a.fmatter.util.NumberFormat(c.p.lastpage,T):c.p.lastpage)}if(c.p.viewrecords)if(c.p.reccount===0)a(".ui-paging-info",J).html(c.p.emptyrecords);else{G=D+1;S=c.p.records;if(a.fmatter){G=a.fmatter.util.NumberFormat(G,T);H=a.fmatter.util.NumberFormat(H,T);S=a.fmatter.util.NumberFormat(S,T)}a(".ui-paging-info",J).html(a.jgrid.format(c.p.recordtext,G,H,S))}if(c.p.pgbuttons===true){if(t<=0)t=B=0;if(t==1||t===0){a("#first, #prev",c.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover"); c.p.toppager&&a("#first_t, #prev_t",c.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#first, #prev",c.p.pager).removeClass("ui-state-disabled");c.p.toppager&&a("#first_t, #prev_t",c.p.toppager).removeClass("ui-state-disabled")}if(t==B||t===0){a("#next, #last",c.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");c.p.toppager&&a("#next_t, #last_t",c.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#next, #last",c.p.pager).removeClass("ui-state-disabled"); c.p.toppager&&a("#next_t, #last_t",c.p.toppager).removeClass("ui-state-disabled")}}}p===true&&c.p.rownumbers===true&&a("td.jqgrid-rownum",c.rows).each(function(I){a(this).html(D+1+I)});s&&c.p.jqgdnd&&a(c).jqGrid("gridDnD","updateDnD");a.isFunction(c.p.gridComplete)&&c.p.gridComplete.call(c)},M=function(p){if(!c.grid.hDiv.loading){var s=c.p.scroll&&p===false,t={},B,D=c.p.prmNames;if(c.p.page<=0)c.p.page=1;if(D.search!==null)t[D.search]=c.p.search;if(D.nd!==null)t[D.nd]=(new Date).getTime();if(D.rows!== null)t[D.rows]=c.p.rowNum;if(D.page!==null)t[D.page]=c.p.page;if(D.sort!==null)t[D.sort]=c.p.sortname;if(D.order!==null)t[D.order]=c.p.sortorder;var G=c.p.loadComplete,H=a.isFunction(G);H||(G=null);var S=0;p=p||1;if(p>1)if(D.npage!==null){t[D.npage]=p;S=p-1;p=1}else G=function(J){H&&c.p.loadComplete.call(c,J);c.grid.hDiv.loading=false;c.p.page++;M(p-1)};else D.npage!==null&&delete c.p.postData[D.npage];a.extend(c.p.postData,t);var T=!c.p.scroll?0:c.rows.length-1;if(a.isFunction(c.p.datatype))c.p.datatype.call(c, c.p.postData,"load_"+c.p.id);else{a.isFunction(c.p.beforeRequest)&&c.p.beforeRequest.call(c);B=c.p.datatype.toLowerCase();switch(B){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:c.p.url,type:c.p.mtype,dataType:B,data:a.isFunction(c.p.serializeGridData)?c.p.serializeGridData.call(c,c.p.postData):c.p.postData,complete:function(J,I){if(I=="success"||J.statusText=="OK"&&J.status=="200"){B==="xml"?L(J.responseXML,c.grid.bDiv,T,p>1,S):R(a.jgrid.parse(J.responseText),c.grid.bDiv, T,p>1,S);G&&G.call(c,J);s&&c.grid.populateVisible()}ca()},error:function(J,I,Q){a.isFunction(c.p.loadError)&&c.p.loadError.call(c,J,I,Q);ca()},beforeSend:function(J){Z();a.isFunction(c.p.loadBeforeSend)&&c.p.loadBeforeSend.call(c,J)}},a.jgrid.ajaxOptions,c.p.ajaxGridOptions));if(c.p.loadonce||c.p.treeGrid)c.p.datatype="local";break;case "xmlstring":Z();t=a.jgrid.stringToDoc(c.p.datastr);H&&c.p.loadComplete.call(c,t);L(t,c.grid.bDiv);c.p.datatype="local";c.p.datastr=null;ca();break;case "jsonstring":Z(); t=typeof c.p.datastr=="string"?a.jgrid.parse(c.p.datastr):c.p.datastr;H&&c.p.loadComplete.call(c,t);R(t,c.grid.bDiv);c.p.datatype="local";c.p.datastr=null;ca();break;case "local":case "clientside":Z();c.p.datatype="local";H&&c.p.loadComplete.call(c,"");ea();aa(true,true);ca();break}}}},Z=function(){c.grid.hDiv.loading=true;if(!c.p.hiddengrid)switch(c.p.loadui){case "disable":break;case "enable":a("#load_"+c.p.id).show();break;case "block":a("#lui_"+c.p.id).show();a("#load_"+c.p.id).show();break}}, ca=function(){c.grid.hDiv.loading=false;switch(c.p.loadui){case "disable":break;case "enable":a("#load_"+c.p.id).hide();break;case "block":a("#lui_"+c.p.id).hide();a("#load_"+c.p.id).hide();break}},ea=function(){var p=/[\$,%]/g,s=[],t=0,B,D,G,H=c.p.sortorder=="asc"?1:-1,S=false,T;a.each(c.p.colModel,function(I){if(this.index==c.p.sortname||this.name==c.p.sortname){if(c.p.lastsort==I)S=true;t=I;B=this.sorttype;return false}});G=B=="float"||B=="number"||B=="currency"?function(I){I=parseFloat(I.replace(p, ""));return isNaN(I)?0:I}:B=="int"||B=="integer"?function(I){return q(I.replace(p,""),0)}:B=="date"||B=="datetime"?function(I){return ua(c.p.colModel[t].datefmt||"Y-m-d",I).getTime()}:function(I){return a.trim(I.toUpperCase())};T=c.p.colModel[t];a.each(c.rows,function(I,Q){try{D=a.unformat(a(Q).children("td").eq(t),{rowId:Q.id,colModel:T},t,true)}catch(da){D=a(Q).children("td").eq(t).text()}Q.sortKey=T.custom_sort===undefined?G(D):T.custom_sort.call(c,D);s[I]=this});if(c.p.treeGrid)a(c).jqGrid("SortTree", H);else{S?s.reverse():s.sort(function(I,Q){if(I.sortKeyQ.sortKey)return H;return 0});if(s[0]){a("td",s[0]).each(function(I){a(this).css("width",g.headers[I].width+"px")});c.grid.cols=s[0].cells}var J="";if(c.p.altRows)J=c.p.altclass;a.each(s,function(I,Q){if(J)I%2==1?a(Q).addClass(J):a(Q).removeClass(J);a("tbody",c.grid.bDiv).append(Q);Q.sortKey=null})}c.grid.bDiv.scrollTop=0},ua=function(p,s){var t={m:1,d:1,y:1970,h:0,i:0,s:0},B,D,G;if(s=a.trim(s)){s=s.split(/[\\\/:_;.\t\T\s-]/); p=p.split(/[\\\/:_;.\t\T\s-]/);var H=a.jgrid.formatter.date.monthNames,S=a.jgrid.formatter.date.AmPm,T=function(J,I){if(J===0){if(I==12)I=0}else if(I!=12)I+=12;return I};B=0;for(D=p.length;B11)s[B]=G+1-12}if(p[B]=="a"){G=a.inArray(s[B],S);if(G!==-1&&G<2&&s[B]==S[G]){s[B]=G;t.h=T(s[B],t.h)}}if(p[B]=="A"){G=a.inArray(s[B],S);if(G!==-1&&G>1&&s[B]==S[G]){s[B]=G-2;t.h=T(s[B],t.h)}}t[p[B].toLowerCase()]= parseInt(s[B],10)}t.m=parseInt(t.m,10)-1;p=t.y;if(p>=70&&p<=99)t.y=1900+t.y;else if(p>=0&&p<=69)t.y=2E3+t.y}return new Date(t.y,t.m,t.d,t.h,t.i,t.s,0)};l=function(p,s){var t="",B="",D="",G,H,S,T,J=function(I){var Q;if(a.isFunction(c.p.onPaging))Q=c.p.onPaging.call(c,I);c.p.selrow=null;if(c.p.multiselect){c.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(c.p.id),c.grid.hDiv).attr("checked",false)}c.p.savedRow= [];if(Q=="stop")return false;return true};p=p.substr(1);G="pg_"+p;H=p+"_left";S=p+"_center";T=p+"_right";a("#"+p).append("
").attr("dir","ltr");if(c.p.rowList.length> 0){D="";D+=""}if(j=="rtl")B+=D;if(c.p.pginput===true)t=""+a.jgrid.format(c.p.pgtext||"","","")+"";if(c.p.pgbuttons===true){H=["first"+ s,"prev"+s,"next"+s,"last"+s];j=="rtl"&&H.reverse();B+="";B+="";B+=t!=""?""+t+"":"";B+="";B+=""}else if(t!="")B+=t;if(j=="ltr")B+=D;B+="";c.p.viewrecords===true&&a("td#"+p+"_"+c.p.recordpos,"#"+G).append("
");a("td#"+p+"_"+c.p.pagerpos,"#"+G).append(B);D=a(".ui-jqgrid").css("font-size")|| "11px";a("body").append("");B=a(B).clone().appendTo("#testpg").width();a("#testpg").remove();if(B>0){if(t!="")B+=50;a("td#"+p+"_"+c.p.pagerpos,"#"+G).width(B)}c.p._nvtd=[];c.p._nvtd[0]=B?Math.floor((c.p.width-B)/2):Math.floor(c.p.width/3);c.p._nvtd[1]=0;B=null;a(".ui-pg-selbox","#"+G).bind("change",function(){c.p.page=Math.round(c.p.rowNum*(c.p.page-1)/this.value-0.5)+1;c.p.rowNum=this.value; if(s)a(".ui-pg-selbox",c.p.pager).val(this.value);else c.p.toppager&&a(".ui-pg-selbox",c.p.toppager).val(this.value);if(!J("records"))return false;M();return false});if(c.p.pgbuttons===true){a(".ui-pg-button","#"+G).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"+ s+", #prev"+s+", #next"+s+", #last"+s,"#"+p).click(function(){var I=q(c.p.page,1),Q=q(c.p.lastpage,1),da=false,ha=true,oa=true,na=true,ta=true;if(Q===0||Q===1)ta=na=oa=ha=false;else if(Q>1&&I>=1)if(I===1)oa=ha=false;else{if(!(I>1&&I1&&I===0){ta=na=false;I=Q-1}if(this.id==="first"+s&&ha){c.p.page=1;da=true}if(this.id==="prev"+s&&oa){c.p.page=I-1;da=true}if(this.id==="next"+s&&na){c.p.page=I+1;da=true}if(this.id==="last"+s&&ta){c.p.page=Q;da=true}if(da){if(!J(this.id))return false; M()}return false})}c.p.pginput===true&&a("input.ui-pg-input","#"+G).keypress(function(I){if((I.charCode?I.charCode:I.keyCode?I.keyCode:0)==13){c.p.page=a(this).val()>0?a(this).val():c.p.page;if(!J("user"))return false;M();return false}return this})};var ya=function(p,s,t,B){if(c.p.colModel[s].sortable)if(!(c.p.savedRow.length>0)){if(!t){if(c.p.lastsort==s)if(c.p.sortorder=="asc")c.p.sortorder="desc";else{if(c.p.sortorder=="desc")c.p.sortorder="asc"}else c.p.sortorder="asc";c.p.page=1}if(B)if(c.p.lastsort== s&&c.p.sortorder==B&&!t)return;else c.p.sortorder=B;t=a("thead:first",c.grid.hDiv).get(0);a("tr th:eq("+c.p.lastsort+") span.ui-grid-ico-sort",t).addClass("ui-state-disabled");a("tr th:eq("+c.p.lastsort+")",t).attr("aria-selected","false");a("tr th:eq("+s+") span.ui-icon-"+c.p.sortorder,t).removeClass("ui-state-disabled");a("tr th:eq("+s+")",t).attr("aria-selected","true");if(!c.p.viewsortcols[0])if(c.p.lastsort!=s){a("tr th:eq("+c.p.lastsort+") span.s-ico",t).hide();a("tr th:eq("+s+") span.s-ico", t).show()}p=p.substring(5);c.p.sortname=c.p.colModel[s].index||p;t=c.p.sortorder;if(a.isFunction(c.p.onSortCol))if(c.p.onSortCol.call(c,p,s,t)=="stop"){c.p.lastsort=s;return}if(c.p.datatype=="local")c.p.deselectAfterSort&&a(c).jqGrid("resetSelection");else{c.p.selrow=null;c.p.multiselect&&a("#cb_"+a.jgrid.jqID(c.p.id),c.grid.hDiv).attr("checked",false);c.p.selarrrow=[];c.p.savedRow=[];c.p.scroll&&x(c.grid.bDiv,true)}c.p.subGrid&&c.p.datatype=="local"&&a("td.sgexpanded","#"+c.p.id).each(function(){a(this).trigger("click")}); M();c.p.lastsort=s;if(c.p.sortname!=p&&s)c.p.lastsort=s}},Ca=function(p){var s=p,t;for(t=p+1;t");this.p.colModel.unshift({name:"cb",width:m?c.p.multiselectWidth+c.p.cellLayout: c.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:c.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}c.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"}},c.p.xmlReader);c.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"}},c.p.jsonReader);if(c.p.scroll){c.p.pgbuttons=false;c.p.pginput=false;c.p.rowList=[]}var O="",N,X,Y,W,fa,P,U,V;X=V="";if(c.p.shrinkToFit===true&&c.p.forceFit===true)for(h=c.p.colModel.length-1;h>=0;h--)if(!c.p.colModel[h].hidden){c.p.colModel[h].resizable= false;break}if(c.p.viewsortcols[1]=="horizontal"){V=" ui-i-asc";X=" ui-i-desc"}N=n?"class='ui-th-div-ie'":"";V="";for(h=0;h";X=c.p.colModel[h].index||c.p.colModel[h].name;O+="
"+c.p.colNames[h];c.p.colModel[h].width=c.p.colModel[h].width?parseInt(c.p.colModel[h].width,10):150;if(typeof c.p.colModel[h].title!=="boolean")c.p.colModel[h].title=true;if(X==c.p.sortname)c.p.lastsort=h;O+=V+"
"}O+="";a(this).append(O);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 pa=true,ba=[],ra;if(typeof c.p.onSelectAll!=="function")pa=false;a("#cb_"+a.jgrid.jqID(c.p.id),this).bind("click",function(){if(this.checked){a("[id^=jqg_]",c.rows).attr("checked",true);a(c.rows).each(function(p){if(!a(this).hasClass("subgrid")){a(this).addClass("ui-state-highlight").attr("aria-selected","true");c.p.selarrrow[p]=c.p.selrow=this.id}});ra=true;ba= []}else{a("[id^=jqg_]",c.rows).attr("checked",false);a(c.rows).each(function(p){if(!a(this).hasClass("subgrid")){a(this).removeClass("ui-state-highlight").attr("aria-selected","false");ba[p]=this.id}});c.p.selarrrow=[];c.p.selrow=null;ra=false}if(pa)c.p.onSelectAll.call(c,ra?c.p.selarrrow:ba,ra)})}if(c.p.autowidth===true){O=a(o).innerWidth();c.p.width=O>0?O:"nw"}(function(){var p=0,s=c.p.cellLayout,t=0,B,D=c.p.scrollOffset,G,H=false,S,T=0,J=0,I=0,Q;if(m)s=0;a.each(c.p.colModel,function(){if(typeof this.hidden=== "undefined")this.hidden=false;if(this.hidden===false){p+=q(this.width,0);if(this.fixed){T+=this.width;J+=this.width+s}else t++;I++}});if(isNaN(c.p.width))c.p.width=g.width=p;else g.width=c.p.width;c.p.tblwidth=p;if(c.p.shrinkToFit===false&&c.p.forceFit===true)c.p.forceFit=false;if(c.p.shrinkToFit===true&&t>0){S=g.width-s*t-J;if(!isNaN(c.p.height)){S-=D;H=true}p=0;a.each(c.p.colModel,function(da){if(this.hidden===false&&!this.fixed){this.width=G=Math.round(S*this.width/(c.p.tblwidth-T));p+=G;B=da}}); Q=0;if(H){if(g.width-J-(p+s*t)!==D)Q=g.width-J-(p+s*t)-D}else if(!H&&Math.abs(g.width-J-(p+s*t))!==1)Q=g.width-J-(p+s*t);c.p.colModel[B].width+=Q;c.p.tblwidth=p+Q+T+I*s;if(c.p.tblwidth>c.p.width){c.p.colModel[B].width-=c.p.tblwidth-parseInt(c.p.width,10);c.p.tblwidth=c.p.width}}})();a(o).css("width",g.width+"px").append("
 
");a(k).css("width",g.width+"px");O=a("thead:first",c).get(0);var ma="";k=a("tr:first",O);c.p.disableClick=false;a("th",k).each(function(p){Y=c.p.colModel[p].width;if(typeof c.p.colModel[p].resizable==="undefined")c.p.colModel[p].resizable=true;if(c.p.colModel[p].resizable){W=document.createElement("span");a(W).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+j);a.browser.opera||a(W).css("cursor","col-resize");a(this).addClass(c.p.resizeclass)}else W= "";a(this).css("width",Y+"px").prepend(W);c.p.colModel[p].hidden&&a(this).css("display","none");g.headers[p]={width:Y,el:this};fa=c.p.colModel[p].sortable;if(typeof fa!=="boolean")fa=c.p.colModel[p].sortable=true;var s=c.p.colModel[p].name;s=="cb"||s=="subgrid"||s=="rn"||c.p.viewsortcols[2]&&a("div",this).addClass("ui-jqgrid-sortable");if(fa)if(c.p.viewsortcols[0]){a("div span.s-ico",this).show();p==c.p.lastsort&&a("div span.ui-icon-"+c.p.sortorder,this).removeClass("ui-state-disabled")}else if(p== c.p.lastsort){a("div span.s-ico",this).show();a("div span.ui-icon-"+c.p.sortorder,this).removeClass("ui-state-disabled")}ma+=""}).mousedown(function(p){if(a(p.target).closest("th>span.ui-jqgrid-resize").length==1){var s=a.jgrid.getCellIndex(this);if(c.p.forceFit===true)c.p.nv=Ca(s);g.dragStart(s,p,za(s));return false}}).click(function(p){if(c.p.disableClick)return c.p.disableClick=false;var s="th>div.ui-jqgrid-sortable",t,B;c.p.viewsortcols[2]||(s="th>div>span>span.ui-grid-ico-sort"); p=a(p.target).closest(s);if(p.length==1){s=a.jgrid.getCellIndex(this);if(!c.p.viewsortcols[2]){t=true;B=p.attr("sort")}ya(a("div",this)[0].id,s,t,B);return false}});if(c.p.sortable&&a.fn.sortable)try{a(c).jqGrid("sortableColumns",k)}catch(wa){}ma+="
 
";this.appendChild(document.createElement("tbody"));a(this).addClass("ui-jqgrid-btable");k=a("
").append(O); var sa=c.p.caption&&c.p.hiddengrid===true?true:false;O=a("
");g.hDiv=document.createElement("div");a(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(O);a(O).append(k);sa&&a(g.hDiv).hide();if(c.p.pager){if(typeof c.p.pager=="string"){if(c.p.pager.substr(0,1)!="#")c.p.pager="#"+c.p.pager}else c.p.pager="#"+a(c.p.pager).attr("id");a(c.p.pager).css({width:g.width+"px"}).appendTo(o).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom"); sa&&a(c.p.pager).hide();l(c.p.pager,"")}c.p.cellEdit===false&&c.p.hoverrows===true&&a(c).bind("mouseover",function(p){U=a(p.target).closest("tr.jqgrow");a(U).attr("class")!=="subgrid"&&a(U).addClass("ui-state-hover");return false}).bind("mouseout",function(p){U=a(p.target).closest("tr.jqgrow");a(U).removeClass("ui-state-hover");return false});var ka,la;a(c).before(g.hDiv).click(function(p){P=p.target;var s=a(P).hasClass("cbox");U=a(P,c.rows).closest("tr.jqgrow");if(a(U).length===0)return this;var t= true;if(a.isFunction(c.p.beforeSelectRow))t=c.p.beforeSelectRow.call(c,U[0].id,p);if(P.tagName=="A"||(P.tagName=="INPUT"||P.tagName=="TEXTAREA"||P.tagName=="OPTION"||P.tagName=="SELECT")&&!s)return this;if(t===true){if(c.p.cellEdit===true)if(c.p.multiselect&&s)a(c).jqGrid("setSelection",U[0].id,true);else{ka=U[0].rowIndex;la=a.jgrid.getCellIndex(P);try{a(c).jqGrid("editCell",ka,la,true)}catch(B){}}else if(c.p.multikey)if(p[c.p.multikey])a(c).jqGrid("setSelection",U[0].id,true);else{if(c.p.multiselect&& s){s=a("[id^=jqg_]",U).attr("checked");a("[id^=jqg_]",U).attr("checked",!s)}}else{if(c.p.multiselect&&c.p.multiboxonly)if(!s){a(c.p.selarrrow).each(function(D,G){D=c.rows.namedItem(G);a(D).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(G),D).attr("checked",false)});c.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(c.p.id),c.grid.hDiv).attr("checked",false)}a(c).jqGrid("setSelection",U[0].id,true)}if(a.isFunction(c.p.onCellSelect)){ka=U[0].id;la=a.jgrid.getCellIndex(P);c.p.onCellSelect.call(c,ka,la, a(P).html(),p)}p.stopPropagation()}else return this}).bind("reloadGrid",function(p,s){if(c.p.treeGrid===true)c.p.datatype=c.p.treedatatype;s&&s.current&&c.grid.selectionPreserver(c);if(c.p.datatype=="local")a(c).jqGrid("resetSelection");else if(!c.p.treeGrid){c.p.selrow=null;if(c.p.multiselect){c.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(c.p.id),c.grid.hDiv).attr("checked",false)}c.p.savedRow=[];c.p.scroll&&x(c.grid.bDiv,true)}if(s&&s.page){p=s.page;if(p>c.p.lastpage)p=c.p.lastpage;if(p<1)p=1;c.p.page= p;c.grid.bDiv.scrollTop=c.grid.prevRowHeight?(p-1)*c.grid.prevRowHeight*c.p.rowNum:0}if(c.grid.prevRowHeight&&c.p.scroll){delete c.p.lastpage;c.grid.populateVisible()}else c.grid.populate();return false});a.isFunction(this.p.ondblClickRow)&&a(this).dblclick(function(p){P=p.target;U=a(P,c.rows).closest("tr.jqgrow");if(a(U).length===0)return false;ka=U[0].rowIndex;la=a.jgrid.getCellIndex(P);c.p.ondblClickRow.call(c,a(U).attr("id"),ka,la,p);return false});a.isFunction(this.p.onRightClickRow)&&a(this).bind("contextmenu", function(p){P=p.target;U=a(P,c.rows).closest("tr.jqgrow");if(a(U).length===0)return false;c.p.multiselect||a(c).jqGrid("setSelection",U[0].id,true);ka=U[0].rowIndex;la=a.jgrid.getCellIndex(P);c.p.onRightClickRow.call(c,a(U).attr("id"),ka,la,p);return false});g.bDiv=document.createElement("div");a(g.bDiv).append(a('
').append("
").append(this)).addClass("ui-jqgrid-bdiv").css({height:c.p.height+(isNaN(c.p.height)? "":"px"),width:g.width+"px"}).scroll(g.scrollGrid);a("table:first",g.bDiv).css({width:c.p.tblwidth+"px"});if(n){a("tbody",this).size()==2&&a("tbody:first",this).remove();c.p.multikey&&a(g.bDiv).bind("selectstart",function(){return false})}else c.p.multikey&&a(g.bDiv).bind("mousedown",function(){return false});sa&&a(g.bDiv).hide();g.cDiv=document.createElement("div");var Da=c.p.hidegrid===true?a("").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Da.addClass("ui-state-hover")}, function(){Da.removeClass("ui-state-hover")}).append("").css(j=="rtl"?"left":"right","0px"):"";a(g.cDiv).append(Da).append(""+c.p.caption+"").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");a(g.cDiv).insertBefore(g.hDiv);if(c.p.toolbar[0]){g.uDiv=document.createElement("div");if(c.p.toolbar[1]=="top")a(g.uDiv).insertBefore(g.hDiv);else c.p.toolbar[1]== "bottom"&&a(g.uDiv).insertAfter(g.hDiv);if(c.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);sa&&a(g.ubDiv).hide()}else a(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);sa&&a(g.uDiv).hide()}if(c.p.toppager){c.p.toppager=c.p.id+"_toppager";g.topDiv=a("
")[0];c.p.toppager="#"+c.p.toppager;a(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);l(c.p.toppager,"_t")}if(c.p.footerrow){g.sDiv=a("
")[0];O=a("
");a(g.sDiv).append(O).insertAfter(g.hDiv).width(g.width);a(O).append(ma);g.footers=a(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(c.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum"; sa&&a(g.sDiv).hide()}if(c.p.caption){var Ia=c.p.datatype;if(c.p.hidegrid===true){a(".ui-jqgrid-titlebar-close",g.cDiv).click(function(p){var s=a.isFunction(c.p.onHeaderClick);if(c.p.gridstate=="visible"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+c.p.id).slideUp("fast");c.p.pager&&a(c.p.pager).slideUp("fast");c.p.toppager&&a(c.p.toppager).slideUp("fast");if(c.p.toolbar[0]===true){c.p.toolbar[1]=="both"&&a(g.ubDiv).slideUp("fast");a(g.uDiv).slideUp("fast")}c.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+ c.p.id).slideUp("fast");a("span",this).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");c.p.gridstate="hidden";a("#gbox_"+c.p.id).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+c.p.id).hide();if(s)sa||c.p.onHeaderClick.call(c,c.p.gridstate,p)}else if(c.p.gridstate=="hidden"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+c.p.id).slideDown("fast");c.p.pager&&a(c.p.pager).slideDown("fast");c.p.toppager&&a(c.p.toppager).slideDown("fast");if(c.p.toolbar[0]=== true){c.p.toolbar[1]=="both"&&a(g.ubDiv).slideDown("fast");a(g.uDiv).slideDown("fast")}c.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+c.p.id).slideDown("fast");a("span",this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(sa){c.p.datatype=Ia;M();sa=false}c.p.gridstate="visible";a("#gbox_"+c.p.id).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+c.p.id).show();s&&c.p.onHeaderClick.call(c,c.p.gridstate,p)}return false});if(sa){c.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(p){if(g.resizing){g.dragMove(p);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});this.updateColumns=function(){var p=this.rows[0],s=this;if(p){a("td",p).each(function(t){a(this).css("width",s.grid.headers[t].width+"px")});this.grid.cols=p.cells}return this};c.formatCol=r;c.sortData= ya;c.updatepager=aa;c.formatter=function(p,s,t,B,D){return w(p,s,t,B,D)};a.extend(g,{populate:M,emptyRows:x});this.grid=g;c.addXmlData=function(p){L(p,c.grid.bDiv)};c.addJSONData=function(p){R(p,c.grid.bDiv)};M();c.p.hiddengrid=false;a(window).unload(function(){c=null})}}})};a.jgrid.extend({getGridParam:function(d){var e=this[0];if(e.grid)return d?typeof e.p[d]!="undefined"?e.p[d]:null:e.p},setGridParam:function(d){return this.each(function(){this.grid&&typeof d==="object"&&a.extend(true,this.p,d)})}, getDataIDs:function(){var d=[],e=0,b;this.each(function(){if((b=this.rows.length)&&b>0)for(;e=k+l)a(f.grid.bDiv)[0].scrollTop=n-(k+l)+c+l;else if(n=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.selrow),f.rows[h.rowIndex]).attr("checked",g);f.p.selarrrow.push(f.p.selrow);f.p.onSelectRow&&e&&f.p.onSelectRow.call(f,f.p.selrow,g)}else{h.className!=="ui-subgrid"&&a(h).removeClass("ui-state-highlight").attr("aria-selected", "false");g=false;a("#jqg_"+a.jgrid.jqID(f.p.selrow),f.rows[h.rowIndex]).attr("checked",g);f.p.selarrrow.splice(j,1);f.p.onSelectRow&&e&&f.p.onSelectRow.call(f,f.p.selrow,g);h=f.p.selarrrow[0];f.p.selrow=h===undefined?null:h}}else if(h.className!=="ui-subgrid"){f.p.selrow&&a(f.rows.namedItem(f.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");f.p.selrow=h.id;a(h).addClass("ui-state-highlight").attr("aria-selected","true");f.p.onSelectRow&&e&&f.p.onSelectRow.call(f,f.p.selrow, true)}}}})},resetSelection:function(){return this.each(function(){var d=this,e;if(d.p.multiselect){a(d.p.selarrrow).each(function(b,f){e=d.rows.namedItem(f);a(e).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(f),e).attr("checked",false)});a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false);d.p.selarrrow=[]}else if(d.p.selrow){a("tr#"+a.jgrid.jqID(d.p.selrow),d.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");d.p.selrow= null}d.p.savedRow=[]})},getRowData:function(d){var e={},b,f=false,g,h=0;this.each(function(){var j=this,c,k;if(typeof d=="undefined"){f=true;b=[];g=j.rows.length}else{k=j.rows.namedItem(d);if(!k)return e;g=1}for(;h span:first",k).html(c).attr(h):a("td:eq("+n+")",k).html(c).attr(h);g=true}});if(l==="string")a(k).addClass(b);else l==="object"&& a(k).css(b)});return g},addRowData:function(d,e,b,f){b||(b="last");var g=false,h,j,c,k,l,n,m,o,q="",r,u,w,z;if(e){if(a.isArray(e)){r=true;b="last";u=d}else{e=[e];r=false}this.each(function(){var v=this,C=e.length;l=v.p.rownumbers===true?1:0;c=v.p.multiselect===true?1:0;k=v.p.subGrid===true?1:0;if(!r)if(typeof d!="undefined")d+="";else{d=v.p.records+1+"";if(v.p.keyIndex!==false){u=v.p.colModel[v.p.keyIndex+c+k+l].name;if(typeof e[0][u]!="undefined")d=e[0][u]}}w=v.p.altclass;for(var E=0,y="",x=a.isFunction(v.p.afterInsertRow)? true:false;E0"}if(c){o='';q=v.formatCol(l,1,"");j+='"+o+""}if(k)j+=a(v).jqGrid("addSubGridCell",c+l,1);for(m=c+k+l;m"+o+""}j=''+j+"";if(v.p.subGrid===true){j=a(j)[0];a(v).jqGrid("addSubGrid",j,c+l)}if(v.rows.length===0)a("table:first",v.grid.bDiv).append(j);else switch(b){case "last":a(v.rows[v.rows.length-1]).after(j);break;case "first":a(v.rows[0]).before(j);break;case "after":if(n= v.rows.namedItem(f))a(v.rows[n.rowIndex+1]).hasClass("ui-subgrid")?a(v.rows[n.rowIndex+1]).after(j):a(n).after(j);break;case "before":if(n=v.rows.namedItem(f)){a(n).before(j);n=n.rowIndex}break}v.p.records++;v.p.reccount++;if(!v.grid.cols||!v.grid.cols.length)v.grid.cols=v.rows[0].cells;if(b==="first"||b==="before"&&n<=1||v.rows.length===1)v.updateColumns();x&&v.p.afterInsertRow.call(v,d,z,z);E++}if(v.p.altRows===true&&!r)if(b=="last")(v.rows.length-1)%2==1&&a(v.rows[v.rows.length-1]).addClass(w); else a(v.rows).each(function(L){L%2==1?a(this).addClass(w):a(this).removeClass(w)});v.updatepager(true,true);g=true})}return g},footerData:function(d,e,b){function f(k){for(var l in k)if(k.hasOwnProperty(l))return false;return true}var g,h=false,j={},c;if(typeof d=="undefined")d="get";if(typeof b!="boolean")b=true;d=d.toLowerCase();this.each(function(){var k=this,l;if(!k.grid||!k.p.footerrow)return false;if(d=="set")if(f(e))return false;h=true;a(this.p.colModel).each(function(n){g=this.name;if(d== "set"){if(e[g]!==undefined){l=b?k.formatter("",e[g],n,e,"edit"):e[g];c=this.title?{title:a.jgrid.stripHtml(l)}:{};a("tr.footrow td:eq("+n+")",k.grid.sDiv).html(l).attr(c);h=true}}else if(d=="get")j[g]=a("tr.footrow td:eq("+n+")",k.grid.sDiv).html()})});return d=="get"?j:h},ShowHideCol:function(d,e){return this.each(function(){var b=this,f=false;if(b.grid){if(typeof d==="string")d=[d];e=e!="none"?"":"none";var g=e==""?true:false;a(this.p.colModel).each(function(h){if(a.inArray(this.name,d)!==-1&&this.hidden=== g){a("tr",b.grid.hDiv).each(function(){a("th:eq("+h+")",this).css("display",e)});a(b.rows).each(function(j){a("td:eq("+h+")",b.rows[j]).css("display",e)});b.p.footerrow&&a("td:eq("+h+")",b.grid.sDiv).css("display",e);if(e=="none")b.p.tblwidth-=this.width;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}}}})},hideCol:function(d){return this.each(function(){a(this).jqGrid("ShowHideCol",d,"none")})},showCol:function(d){return this.each(function(){a(this).jqGrid("ShowHideCol",d,"")})},remapColumns:function(d,e,b){function f(j){var c;c=j.length?a.makeArray(j):a.extend({},j);a.each(d,function(k){j[k]=c[this]})}function g(j,c){a(">tr"+(c||""),j).each(function(){var k=this,l=a.makeArray(k.cells);a.each(d,function(){var n=l[this]; n&&k.appendChild(n)})})}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("tbody:first",h.grid.bDiv),".jqgrow");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(d);h.p.lastsort=a.inArray(h.p.lastsort,d);if(h.p.treeGrid)h.p.expColInd=a.inArray(h.p.expColInd,d)},setGridWidth:function(d,e){return this.each(function(){var b= this,f,g=0,h=b.p.cellLayout,j,c=0,k=false,l=b.p.scrollOffset,n,m=0,o=0,q=0,r;if(b.grid){if(typeof e!="boolean")e=b.p.shrinkToFit;if(!isNaN(d)){d=parseInt(d,10);b.grid.width=b.p.width=d;a("#gbox_"+b.p.id).css("width",d+"px");a("#gview_"+b.p.id).css("width",d+"px");a(b.grid.bDiv).css("width",d+"px");a(b.grid.hDiv).css("width",d+"px");b.p.pager&&a(b.p.pager).css("width",d+"px");b.p.toppager&&a(b.p.toppager).css("width",d+"px");if(b.p.toolbar[0]===true){a(b.grid.uDiv).css("width",d+"px");b.p.toolbar[1]== "both"&&a(b.grid.ubDiv).css("width",d+"px")}b.p.footerrow&&a(b.grid.sDiv).css("width",d+"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){o+=this.width;m+=this.width+h}else c++;q++}});if(c!==0){b.p.tblwidth=g;n=d-h*c-m;if(!isNaN(b.p.height))if(a(b.grid.bDiv)[0].clientHeight0;a.each(b.p.colModel, function(w){if(this.hidden===false&&!this.fixed){f=Math.round(n*this.width/(b.p.tblwidth-o));if(!(f<0)){this.width=f;g+=f;b.grid.headers[w].width=f;b.grid.headers[w].el.style.width=f+"px";if(b.p.footerrow)b.grid.footers[w].style.width=f+"px";if(u)b.grid.cols[w].style.width=f+"px";j=w}}});r=0;if(k){if(d-m-(g+h*c)!==l)r=d-m-(g+h*c)-l}else if(Math.abs(d-m-(g+h*c))!==1)r=d-m-(g+h*c);b.p.colModel[j].width+=r;b.p.tblwidth=g+r+o+h*q;if(b.p.tblwidth>d){k=b.p.tblwidth-parseInt(d,10);b.p.tblwidth=d;f=b.p.colModel[j].width-= k}else f=b.p.colModel[j].width;b.grid.headers[j].width=f;b.grid.headers[j].el.style.width=f+"px";if(u)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(d){return this.each(function(){var e=this;if(e.grid){a(e.grid.bDiv).css({height:d+ (isNaN(d)?"":"px")});e.p.height=d;e.p.scroll&&e.grid.populateVisible()}})},setCaption:function(d){return this.each(function(){this.p.caption=d;a("span.ui-jqgrid-title",this.grid.cDiv).html(d);a(this.grid.cDiv).show()})},setLabel:function(d,e,b,f){return this.each(function(){var g=this,h=-1;if(g.grid){if(isNaN(d))a(g.p.colModel).each(function(k){if(this.name==d){h=k;return false}});else h=parseInt(d,10);if(h>=0){var j=a("tr.ui-jqgrid-labels th:eq("+h+")",g.grid.hDiv);if(e){var c=a(".s-ico",j);a("[id^=jqgh_]", j).empty().html(e).append(c);g.p.colNames[h]=e}if(b)typeof b==="string"?a(j).addClass(b):a(j).css(b);typeof f==="object"&&a(j).attr(f)}}})},setCell:function(d,e,b,f,g,h){return this.each(function(){var j=this,c=-1,k,l;if(j.grid){if(isNaN(e))a(j.p.colModel).each(function(m){if(this.name==e){c=m;return false}});else c=parseInt(e,10);if(c>=0)if(k=j.rows.namedItem(d)){var n=a("td:eq("+c+")",k);if(b!==""||h===true){k=j.formatter(d,b,c,k,"edit");l=j.p.colModel[c].title?{title:a.jgrid.stripHtml(k)}:{};j.p.treeGrid&& a(".tree-wrap",a(n)).length>0?a("span",a(n)).html(k).attr(l):a(n).html(k).attr(l)}if(typeof f==="string")a(n).addClass(f);else f&&a(n).css(f);typeof g==="object"&&a(n).attr(g)}}})},getCell:function(d,e){var b=false;this.each(function(){var f=this,g=-1;if(f.grid){if(isNaN(e))a(f.p.colModel).each(function(c){if(this.name===e){g=c;return false}});else g=parseInt(e,10);if(g>=0){var h=f.rows.namedItem(d);if(h)try{b=a.unformat(a("td:eq("+g+")",h),{rowId:h.id,colModel:f.p.colModel[g]},g)}catch(j){b=a.jgrid.htmlDecode(a("td:eq("+ g+")",h).html())}}}});return b},getCol:function(d,e,b){var f=[],g,h=0;e=typeof e!="boolean"?false:e;if(typeof b=="undefined")b=false;this.each(function(){var j=this,c=-1;if(j.grid){if(isNaN(d))a(j.p.colModel).each(function(m){if(this.name===d){c=m;return false}});else c=parseInt(d,10);if(c>=0){var k=j.rows.length,l=0;if(k&&k>0){for(;l0){if(b===true)if(d==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[d]);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[d]).addClass("selected-row ui-state-hover");try{h=a.unformat(j,{rowId:f.rows[d].id,colModel:f.p.colModel[e]},e)}catch(c){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:d,ic:e,name:g,v:h});if(a.isFunction(f.p.formatCell)){var k=f.p.formatCell(f.rows[d].id,g,h,d,e);if(k!==undefined)h=k}k=a.extend({},f.p.colModel[e].editoptions||{},{id:d+"_"+g,name:g});var l=createEl(f.p.colModel[e].edittype,k,h,true,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell(f.rows[d].id,g,h,d,e);a(j).html("").append(l).attr("tabindex", "0");window.setTimeout(function(){a(l).focus().select()},0);a("input, select, textarea",j).bind("keydown",function(n){if(n.keyCode===27)if(a("input.hasDatepicker",j).length>0)a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",d,e):a("input.hasDatepicker",j).datepicker("hide");else a(f).jqGrid("restoreCell",d,e);n.keyCode===13&&a(f).jqGrid("saveCell",d,e);if(n.keyCode==9)if(f.grid.hDiv.loading)return false;else n.shiftKey?a(f).jqGrid("prevCell",d,e):a(f).jqGrid("nextCell",d,e);n.stopPropagation()}); a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell(f.rows[d].id,g,h,d,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[d]).addClass("selected-row ui-state-hover");if(a.isFunction(f.p.onSelectCell)){h=j.html().replace(/\ \;/ig,"");f.p.onSelectCell(f.rows[d].id,g,h,d,e)}}f.p.iCol=e;f.p.iRow= d}}})},saveCell:function(d,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[d]),h,j,c=b.p.colModel[e],k=c.name,l=a.jgrid.jqID(k);switch(c.edittype){case "select":if(c.editoptions.multiple){l=a("#"+d+"_"+l,b.rows[d]);var n=[];if(h=a(l).val())h.join(",");else h="";a("option:selected",l).each(function(z,v){n[z]=a(v).text()});j=n.join(",")}else{h=a("#"+d+"_"+l+">option:selected",b.rows[d]).val(); j=a("#"+d+"_"+l+">option:selected",b.rows[d]).text()}if(c.formatter)j=h;break;case "checkbox":var m=["Yes","No"];if(c.editoptions)m=c.editoptions.value.split(":");j=h=a("#"+d+"_"+l,b.rows[d]).attr("checked")?m[0]:m[1];break;case "password":case "text":case "textarea":case "button":j=h=a("#"+d+"_"+l,b.rows[d]).val();break;case "custom":try{if(c.editoptions&&a.isFunction(c.editoptions.custom_value)){h=c.editoptions.custom_value(a(".customelement",g),"get");if(h===undefined)throw"e2";else j=h}else throw"e1"; }catch(o){o=="e1"&&info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);o=="e2"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,o.message,jQuery.jgrid.edit.bClose)}break}if(j!=b.p.savedRow[f].v){if(a.isFunction(b.p.beforeSaveCell))if(f=b.p.beforeSaveCell(b.rows[d].id,k,h,d,e))h=f;var q=checkValues(h,e,b);if(q[0]===true){f={}; if(a.isFunction(b.p.beforeSubmitCell))(f=b.p.beforeSubmitCell(b.rows[d].id,k,h,d,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[k]=h;m=b.p.prmNames;c=m.id;l=m.oper;r[c]=b.rows[d].id;r[l]=m.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(r): r,type:"POST",complete:function(z,v){a("#lui_"+b.p.id).hide();b.grid.hDiv.loading=false;if(v=="success")if(a.isFunction(b.p.afterSubmitCell)){z=b.p.afterSubmitCell(z,r.id,k,h,d,e);if(z[0]===true){a(g).empty();a(b).jqGrid("setCell",b.rows[d].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(b.rows[d]).addClass("edited");a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell(b.rows[d].id,k,h,d,e);b.p.savedRow.splice(0,1)}else{info_dialog(a.jgrid.errors.errcap,z[1],a.jgrid.edit.bClose);a(b).jqGrid("restoreCell", d,e)}}else{a(g).empty();a(b).jqGrid("setCell",b.rows[d].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(b.rows[d]).addClass("edited");a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell(b.rows[d].id,k,h,d,e);b.p.savedRow.splice(0,1)}},error:function(z,v){a("#lui_"+b.p.id).hide();b.grid.hDiv.loading=false;a.isFunction(b.p.errorCell)?b.p.errorCell(z,v):info_dialog(a.jgrid.errors.errcap,z.status+" : "+z.statusText+"
"+v,a.jgrid.edit.bClose);a(b).jqGrid("restoreCell",d,e)}},a.jgrid.ajaxOptions, b.p.ajaxCellOptions||{}))}else try{info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose);a(b).jqGrid("restoreCell",d,e)}catch(u){}if(b.p.cellsubmit=="clientArray"){a(g).empty();a(b).jqGrid("setCell",b.rows[d].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(b.rows[d]).addClass("edited");a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell(b.rows[d].id,k,h,d,e);b.p.savedRow.splice(0,1)}}else try{window.setTimeout(function(){info_dialog(a.jgrid.errors.errcap,h+" "+q[1],a.jgrid.edit.bClose)}, 100);a(b).jqGrid("restoreCell",d,e)}catch(w){}}else a(b).jqGrid("restoreCell",d,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(d,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[d]);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[d].id,e,b.p.savedRow[f].v,false,false,true);b.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+b.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(d,e){return this.each(function(){var b=this,f=false;if(!(!b.grid||b.p.cellEdit!==true)){for(var g=e+1;g0&&a(b).jqGrid("saveCell",d,e)}})},prevCell:function(d, e){return this.each(function(){var b=this,f=false;if(!(!b.grid||b.p.cellEdit!==true)){for(var g=e-1;g>=0;g--)if(b.p.colModel[g].editable===true){f=g;break}if(f!==false)a(b).jqGrid("editCell",d,f,true);else b.p.savedRow.length>0&&a(b).jqGrid("saveCell",d,e)}})},GridNav:function(){return this.each(function(){function d(j,c,k){if(k.substr(0,1)=="v"){var l=a(b.grid.bDiv)[0].clientHeight,n=a(b.grid.bDiv)[0].scrollTop,m=b.rows[j].offsetTop+b.rows[j].clientHeight,o=b.rows[j].offsetTop;if(k=="vd")if(m>=l)a(b.grid.bDiv)[0].scrollTop= a(b.grid.bDiv)[0].scrollTop+b.rows[j].clientHeight;if(k=="vu")if(o=k+parseInt(l,10))a(b.grid.bDiv)[0].scrollLeft=a(b.grid.bDiv)[0].scrollLeft+b.rows[j].cells[c].clientWidth;else if(n=0;l--)if(b.p.colModel[l].hidden!==true){k=l;break}}if(c=="rgt"){k=j-1;for(l=j;l"),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){d(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){d(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");d(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");d(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);break}return false})}})},getChangedCells:function(d){var e=[];d||(d="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(d=="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(c){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(k){h[f]=a.jgrid.htmlDecode(a(this).html())}});h.id=this.id;e.push(h)}})});return e}})})(jQuery); var showModal=function(a){a.w.show()},closeModal=function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal=function(a,d){d=jQuery.extend({jqm:true,gb:""},d||{});if(d.onClose){var e=d.onClose(a);if(typeof e=="boolean"&&!e)return}if(jQuery.fn.jqm&&d.jqm===true)jQuery(a).attr("aria-hidden","true").jqmHide();else{if(d.gb!="")try{jQuery(".jqgrid-overlay:first",d.gb).hide()}catch(b){}jQuery(a).hide().attr("aria-hidden","true")}}; function findPos(a){var d=0,e=0;if(a.offsetParent){do{d+=a.offsetLeft;e+=a.offsetTop}while(a=a.offsetParent)}return[d,e]} var createModal=function(a,d,e,b,f,g){var h=document.createElement("div"),j;j=jQuery(e.gbox).attr("dir")=="rtl"?true:false;h.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";h.id=a.themodal;var c=document.createElement("div");c.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";c.id=a.modalhead;jQuery(c).append(""+e.caption+"");var k=jQuery("
").hover(function(){k.addClass("ui-state-hover")}, function(){k.removeClass("ui-state-hover")}).append("");jQuery(c).append(k);if(j){h.dir="rtl";jQuery(".ui-jqdialog-title",c).css("float","right");jQuery(".ui-jqdialog-titlebar-close",c).css("left","0.3em")}else{h.dir="ltr";jQuery(".ui-jqdialog-title",c).css("float","left");jQuery(".ui-jqdialog-titlebar-close",c).css("right","0.3em")}var l=document.createElement("div");jQuery(l).addClass("ui-jqdialog-content ui-widget-content").attr("id",a.modalcontent); jQuery(l).append(d);h.appendChild(l);jQuery(h).prepend(c);g===true?jQuery("body").append(h):jQuery(h).insertBefore(b);if(typeof e.jqModal==="undefined")e.jqModal=true;d={};if(jQuery.fn.jqm&&e.jqModal===true){if(e.left===0&&e.top===0){b=[];b=findPos(f);e.left=b[0]+4;e.top=b[1]+4}d.top=e.top+"px";d.left=e.left}else if(e.left!==0||e.top!==0){d.left=e.left;d.top=e.top+"px"}jQuery("a.ui-jqdialog-titlebar-close",c).click(function(){var o=jQuery("#"+a.themodal).data("onClose")||e.onClose,q=jQuery("#"+a.themodal).data("gbox")|| e.gbox;hideModal("#"+a.themodal,{gb:q,jqm:e.jqModal,onClose:o});return false});if(e.width===0||!e.width)e.width=300;if(e.height===0||!e.height)e.height=200;if(!e.zIndex)e.zIndex=950;f=0;if(j&&d.left&&!g){f=jQuery(e.gbox).width()-(!isNaN(e.width)?parseInt(e.width,10):0)-8;d.left=parseInt(d.left,10)+parseInt(f,10)}if(d.left)d.left+="px";jQuery(h).css(jQuery.extend({width:isNaN(e.width)?"auto":e.width+"px",height:isNaN(e.height)?"auto":e.height+"px",zIndex:e.zIndex,overflow:"hidden"},d)).attr({tabIndex:"-1", role:"dialog","aria-labelledby":a.modalhead,"aria-hidden":"true"});if(typeof e.drag=="undefined")e.drag=true;if(typeof e.resize=="undefined")e.resize=true;if(e.drag){jQuery(c).css("cursor","move");if(jQuery.fn.jqDrag)jQuery(h).jqDrag(c);else try{jQuery(h).draggable({handle:jQuery("#"+c.id)})}catch(n){}}if(e.resize)if(jQuery.fn.jqResize){jQuery(h).append("
");jQuery("#"+a.themodal).jqResize(".jqResize", a.scrollelm?"#"+a.scrollelm:false)}else try{jQuery(h).resizable({handles:"se, sw",alsoResize:a.scrollelm?"#"+a.scrollelm:false})}catch(m){}e.closeOnEscape===true&&jQuery(h).keydown(function(o){if(o.which==27){o=jQuery("#"+a.themodal).data("onClose")||e.onClose;hideModal(this,{gb:e.gbox,jqm:e.jqModal,onClose:o})}})},viewModal=function(a,d){d=jQuery.extend({toTop:true,overlay:10,modal:false,onShow:showModal,onHide:closeModal,gbox:"",jqm:true,jqM:true},d||{});if(jQuery.fn.jqm&&d.jqm===true)d.jqM?jQuery(a).attr("aria-hidden", "false").jqm(d).jqmShow():jQuery(a).attr("aria-hidden","false").jqmShow();else{if(d.gbox!=""){jQuery(".jqgrid-overlay:first",d.gbox).show();jQuery(a).data("gbox",d.gbox)}jQuery(a).show().attr("aria-hidden","false");try{jQuery(":input:visible",a)[0].focus()}catch(e){}}}; function info_dialog(a,d,e,b){var f={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:""+a+"",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true,align:"center",buttonalign:"center",buttons:[]};jQuery.extend(f,b||{});var g=f.jqModal;if(jQuery.fn.jqm&&!g)g=false;a="";if(f.buttons.length>0)for(b=0;b"+ f.buttons[b].text+""}b=isNaN(f.dataheight)?f.dataheight:f.dataheight+"px";var h="
";h+="
"+d+"
";h+=e?"
"+ e+""+a+"
":a!=""?"
"+a+"
":"";h+="
";try{jQuery("#info_dialog").attr("aria-hidden")=="false"&&hideModal("#info_dialog",{jqm:g});jQuery("#info_dialog").remove()}catch(j){}createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},h,f,"","",true);a&&jQuery.each(f.buttons, function(k){jQuery("#"+this.id,"#info_id").bind("click",function(){f.buttons[k].onClick.call(jQuery("#info_dialog"));return false})});jQuery("#closedialog","#info_id").click(function(){hideModal("#info_dialog",{jqm:g});return false});jQuery(".fm-button","#info_dialog").hover(function(){jQuery(this).addClass("ui-state-hover")},function(){jQuery(this).removeClass("ui-state-hover")});viewModal("#info_dialog",{onHide:function(k){k.w.hide().remove();k.o&&k.o.remove()},modal:f.modal,jqm:g});try{$("#info_dialog").focus()}catch(c){}} function createEl(a,d,e,b,f){function g(q,r){if(jQuery.isFunction(r.dataInit)){q.id=r.id;r.dataInit(q);delete r.id;delete r.dataInit}if(r.dataEvents){jQuery.each(r.dataEvents,function(){this.data!==undefined?jQuery(q).bind(this.type,this.data,this.fn):jQuery(q).bind(this.type,this.fn)});delete r.dataEvents}return r}var h="";d.defaultValue&&delete d.defaultValue;switch(a){case "textarea":h=document.createElement("textarea");if(b)d.cols||jQuery(h).css({width:"98%"});else if(!d.cols)d.cols=20;if(!d.rows)d.rows= 2;if(e==" "||e==" "||e.length==1&&e.charCodeAt(0)==160)e="";h.value=e;d=g(h,d);jQuery(h).attr(d).attr({role:"textbox",multiline:"true"});break;case "checkbox":h=document.createElement("input");h.type="checkbox";if(d.value){var j=d.value.split(":");if(e===j[0]){h.checked=true;h.defaultChecked=true}h.value=j[0];jQuery(h).attr("offval",j[1]);try{delete d.value}catch(c){}}else{j=e.toLowerCase();if(j.search(/(false|0|no|off|undefined)/i)<0&&j!==""){h.checked=true;h.defaultChecked=true;h.value= e}else h.value="on";jQuery(h).attr("offval","off")}d=g(h,d);jQuery(h).attr(d).attr("role","checkbox");break;case "select":h=document.createElement("select");h.setAttribute("role","select");var k,l=[];if(d.multiple===true){k=true;h.multiple="multiple";$(h).attr("aria-multiselectable","true")}else k=false;if(typeof d.dataUrl!="undefined")jQuery.ajax(jQuery.extend({url:d.dataUrl,type:"GET",complete:function(q){try{delete d.dataUrl;delete d.value}catch(r){}if(typeof d.buildSelect!="undefined"){q=d.buildSelect(q); q=jQuery(q).html();delete d.buildSelect}else q=jQuery(q.responseText).html();if(q){jQuery(h).append(q);d=g(h,d);if(typeof d.size==="undefined")d.size=k?3:1;if(k){l=e.split(",");l=jQuery.map(l,function(u){return jQuery.trim(u)})}else l[0]=jQuery.trim(e);jQuery(h).attr(d);setTimeout(function(){jQuery("option",h).each(function(u){if(u===0)this.selected="";$(this).attr("role","option");if(jQuery.inArray(jQuery.trim(jQuery(this).text()),l)>-1||jQuery.inArray(jQuery.trim(jQuery(this).val()),l)>-1){this.selected= "selected";if(!k)return false}})},0)}}},f||{}));else if(d.value){if(k){l=e.split(",");l=jQuery.map(l,function(q){return jQuery.trim(q)});if(typeof d.size==="undefined")d.size=3}else d.size=1;if(typeof d.value==="function")d.value=d.value();if(typeof d.value==="string"){b=d.value.split(";");for(j=0;j2)f[1]=jQuery.map(f,function(q,r){if(r>0)return q}).join(":");a=document.createElement("option");a.setAttribute("role","option");a.value=f[0];a.innerHTML=f[1]; if(!k&&(jQuery.trim(f[0])==jQuery.trim(e)||jQuery.trim(f[1])==jQuery.trim(e)))a.selected="selected";if(k&&(jQuery.inArray(jQuery.trim(f[1]),l)>-1||jQuery.inArray(jQuery.trim(f[0]),l)>-1))a.selected="selected";h.appendChild(a)}}else if(typeof d.value==="object"){b=d.value;for(j in b)if(b.hasOwnProperty(j)){a=document.createElement("option");a.setAttribute("role","option");a.value=j;a.innerHTML=b[j];if(!k&&(jQuery.trim(j)==jQuery.trim(e)||jQuery.trim(b[j])==jQuery.trim(e)))a.selected="selected";if(k&& (jQuery.inArray(jQuery.trim(b[j]),l)>-1||jQuery.inArray(jQuery.trim(j),l)>-1))a.selected="selected";h.appendChild(a)}}d=g(h,d);try{delete d.value}catch(n){}jQuery(h).attr(d)}break;case "text":case "password":case "button":j=a=="button"?"button":"textbox";h=document.createElement("input");h.type=a;h.value=e;d=g(h,d);if(a!="button")if(b)d.size||jQuery(h).css({width:"98%"});else if(!d.size)d.size=20;jQuery(h).attr(d).attr("role",j);break;case "image":case "file":h=document.createElement("input");h.type= a;d=g(h,d);jQuery(h).attr(d);break;case "custom":h=document.createElement("span");try{if(jQuery.isFunction(d.custom_element)){var m=d.custom_element.call(this,e,d);if(m){m=jQuery(m).addClass("customelement").attr({id:d.id,name:d.name});jQuery(h).empty().append(m)}else throw"e2";}else throw"e1";}catch(o){o=="e1"&&info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+jQuery.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);o=="e2"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+ jQuery.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,o.message,jQuery.jgrid.edit.bClose)}break}return h}function daysInFebruary(a){return a%4===0&&(a%100!==0||a%400===0)?29:28}function DaysArray(a){for(var d=1;d<=a;d++){this[d]=31;if(d==4||d==6||d==9||d==11)this[d]=30;if(d==2)this[d]=29}return this} function checkDate(a,d){var e={},b;a=a.toLowerCase();b=a.indexOf("/")!=-1?"/":a.indexOf("-")!=-1?"-":a.indexOf(".")!=-1?".":"/";a=a.split(b);d=d.split(b);if(d.length!=3)return false;b=-1;for(var f,g=-1,h=-1,j=0;j12)return false}if(g===-1)return false;else{c=e[a[g]].toString();if(c.length<1||e[a[g]]<1||e[a[g]]>31||e[a[h]]==2&&e[a[g]]>daysInFebruary(e[a[b]])||e[a[g]]>j[e[a[h]]])return false}return true}function isEmpty(a){return a.match(/^s+$/)||a==""?true:false} function checkTime(a){var d=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!isEmpty(a))if(a=a.match(d)){if(a[3]){if(a[1]<1||a[1]>12)return false}else if(a[1]>23)return false;if(a[2]>59)return false}else return false;return true} function checkValues(a,d,e){var b,f,g;if(typeof d=="string"){f=0;for(len=e.p.colModel.length;f=0)b=e.p.colModel[d].editrules;if(b){g||(g=e.p.colNames[d]);if(b.required===true)if(a.match(/^s+$/)||a=="")return[false,g+": "+jQuery.jgrid.edit.msg.required,""];f=b.required===false?false:true;if(b.number===true)if(!(f===false&&isEmpty(a)))if(isNaN(a))return[false,g+": "+ jQuery.jgrid.edit.msg.number,""];if(typeof b.minValue!="undefined"&&!isNaN(b.minValue))if(parseFloat(a)parseFloat(b.maxValue))return[false,g+": "+jQuery.jgrid.edit.msg.maxValue+" "+b.maxValue,""];var j;if(b.email===true)if(!(f===false&&isEmpty(a))){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(a))return[false,g+": "+jQuery.jgrid.edit.msg.email,""]}if(b.integer===true)if(!(f===false&&isEmpty(a))){if(isNaN(a))return[false,g+": "+jQuery.jgrid.edit.msg.integer,""];if(a%1!==0||a.indexOf(".")!=-1)return[false,g+": "+jQuery.jgrid.edit.msg.integer,""]}if(b.date===true)if(!(f===false&&isEmpty(a))){d=e.p.colModel[d].datefmt||"Y-m-d";if(!checkDate(d,a))return[false,g+": "+jQuery.jgrid.edit.msg.date+" - "+d,""]}if(b.time===true)if(!(f===false&&isEmpty(a)))if(!checkTime(a))return[false,g+ ": "+jQuery.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(b.url===true)if(!(f===false&&isEmpty(a))){j=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!j.test(a))return[false,g+": "+jQuery.jgrid.edit.msg.url,""]}if(b.custom===true)if(!(f===false&&isEmpty(a)))if(jQuery.isFunction(b.custom_func)){a=b.custom_func.call(e,a,g);return jQuery.isArray(a)?a:[false,jQuery.jgrid.edit.msg.customarray,""]}else return[false,jQuery.jgrid.edit.msg.customfcheck, ""]}return[true,"",""]} (function(a){a.jgrid.extend({getColProp:function(d){var e={},b=this[0];if(b.grid){b=b.p.colModel;for(var f=0;f0&&a(d).each(function(){l=this;if(k=j.rows.namedItem(l[e])){n=l[e];if(b===true)if(j.p.jsonReader.repeatitems===true){if(j.p.jsonReader.cell)l=l[j.p.jsonReader.cell];for(var m=0;m span:first",k).html(c).attr(h):a("td:eq("+m+")",k).html(c).attr(h)}return g=true}a(j.p.colModel).each(function(o){f=b===true?this.jsonmap|| this.name:this.name;if(l[f]!==undefined){c=j.formatter(n,l[f],o,l,"edit");h=this.title?{title:a.jgrid.stripHtml(c)}:{};j.p.treeGrid===true&&f==j.p.ExpandColumn?a("td:eq("+o+") > span:first",k).html(c).attr(h):a("td:eq("+o+")",k).html(c).attr(h);g=true}})}})});return g},filterGrid:function(d,e){e=a.extend({gridModel:false,gridNames:false,gridToolbar:false,filterModel:[],formtype:"horizontal",autosearch:true,formclass:"filterform",tableclass:"filtertable",buttonclass:"filterbutton",searchButton:"Search", clearButton:"Clear",enableSearch:false,enableClear:false,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,url:"",marksearched:true},e||{});return this.each(function(){var b=this;this.p=e;if(this.p.filterModel.length===0&&this.p.gridModel===false)alert("No filter is set");else if(d){this.p.gridid=d.indexOf("#")!=-1?d:"#"+d;var f=a(this.p.gridid).jqGrid("getGridParam","colModel");if(f){if(this.p.gridModel===true){var g=a(this.p.gridid)[0],h;a.each(f,function(n){var m=[];this.search= this.search===false?false:true;h=this.editrules&&this.editrules.searchhidden===true?true:this.hidden===true?false:true;if(this.search===true&&h===true){m.label=b.p.gridNames===true?g.p.colNames[n]:"";m.name=this.name;m.index=this.index||this.name;m.stype=this.edittype||"text";if(m.stype!="select")m.stype="text";m.defval=this.defval||"";m.surl=this.surl||"";m.sopt=this.editoptions||{};m.width=this.width;b.p.filterModel.push(m)}})}else a.each(b.p.filterModel,function(){for(var n=0;n0?true:false;a.extend(q.p.postData,n);var w;if(b.p.url){w=a(q).jqGrid("getGridParam","url");a(q).jqGrid("setGridParam",{url:b.p.url})}a(q).jqGrid("setGridParam",{search:u}).trigger("reloadGrid",[{page:1}]);w&&a(q).jqGrid("setGridParam", {url:w});a.isFunction(b.p.afterSearch)&&b.p.afterSearch()},c=function(){var n={},m,o=0,q=a(b.p.gridid)[0],r;a.isFunction(b.p.beforeClear)&&b.p.beforeClear();a.each(b.p.filterModel,function(){r=this.index;m=this.defval?this.defval:"";if(!this.stype)this.stype="text";switch(this.stype){case "select":var z;a("select[name="+r+"] option",b).each(function(E){if(E===0)this.selected=true;if(a(this).text()==m){this.selected=true;z=a(this).val();return false}});if(z){n[r]=z;b.p.marksearched&&a("#jqgh_"+this.name, q.grid.hDiv).addClass("dirty-cell");o++}else{b.p.marksearched&&a("#jqgh_"+this.name,q.grid.hDiv).removeClass("dirty-cell");try{delete q.p.postData[this.index]}catch(v){}}break;case "text":a("input[name="+r+"]",b).val(m);if(m){n[r]=m;b.p.marksearched&&a("#jqgh_"+this.name,q.grid.hDiv).addClass("dirty-cell");o++}else{b.p.marksearched&&a("#jqgh_"+this.name,q.grid.hDiv).removeClass("dirty-cell");try{delete q.p.postData[this.index]}catch(C){}}break}});var u=o>0?true:false;a.extend(q.p.postData,n);var w; if(b.p.url){w=a(q).jqGrid("getGridParam","url");a(q).jqGrid("setGridParam",{url:b.p.url})}a(q).jqGrid("setGridParam",{search:u}).trigger("reloadGrid",[{page:1}]);w&&a(q).jqGrid("setGridParam",{url:w});a.isFunction(b.p.afterClear)&&b.p.afterClear()},k=a("
"),l=a("
");a(k).append(l);(function(){var n=document.createElement("tr"), m,o,q,r;b.p.formtype=="horizontal"&&a(l).append(n);a.each(b.p.filterModel,function(u){q=document.createElement("td");a(q).append("");r=document.createElement("td");var w=this;if(!this.stype)this.stype="text";switch(this.stype){case "select":if(this.surl)a(r).load(this.surl,function(){w.defval&&a("select",this).val(w.defval);a("select",this).attr({name:w.index||w.name,id:"sg_"+w.name});w.sopt&&a("select",this).attr(w.sopt);b.p.gridToolbar===true&&w.width&& a("select",this).width(w.width);b.p.autosearch===true&&a("select",this).change(function(){j();return false})});else if(w.sopt.value){var z=w.sopt.value,v=document.createElement("select");a(v).attr({name:w.index||w.name,id:"sg_"+w.name}).attr(w.sopt);var C;if(typeof z==="string"){u=z.split(";");for(var E=0;E");w.sopt&&a("input",r).attr(w.sopt);if(b.p.gridToolbar===true&&w.width)a.browser.msie?a("input",r).width(w.width- 4):a("input",r).width(w.width-2);b.p.autosearch===true&&a("input",r).keypress(function(y){if((y.charCode?y.charCode:y.keyCode?y.keyCode:0)==13){j();return false}return this});break}if(b.p.formtype=="horizontal"){b.p.gridToolbar===true&&b.p.gridNames===false?a(n).append(r):a(n).append(q).append(r);a(n).append(r)}else{m=document.createElement("tr");a(m).append(q).append(r);a(l).append(m)}});r=document.createElement("td");if(b.p.enableSearch===true){o="";a(r).append(o);a("input#sButton",r).click(function(){j();return false})}if(b.p.enableClear===true){o="";a(r).append(o);a("input#cButton",r).click(function(){c();return false})}if(b.p.enableClear===true||b.p.enableSearch===true)if(b.p.formtype=="horizontal")a(n).append(r);else{m=document.createElement("tr");a(m).append(" ").append(r);a(l).append(m)}})();a(this).append(k); this.triggerSearch=j;this.clearSearch=c}else alert("Could not get grid colModel")}else alert("No target grid is set!")})},filterToolbar:function(d){d=a.extend({autosearch:true,searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND"},d||{});return this.each(function(){function e(j,c){var k=a(j);k[0]&&jQuery.each(c,function(){this.data!==undefined?k.bind(this.type,this.data,this.fn):k.bind(this.type,this.fn)})}var b=this,f= function(){var j={},c=0,k,l,n={};a.each(b.p.colModel,function(){l=this.index||this.name;var w=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"bw";switch(this.stype){case "select":if(k=a("select[name="+l+"]",b.grid.hDiv).val()){j[l]=k;n[l]=w;c++}else try{delete b.p.postData[l]}catch(z){}break;case "text":if(k=a("input[name="+l+"]",b.grid.hDiv).val()){j[l]=k;n[l]=w;c++}else try{delete b.p.postData[l]}catch(v){}break}});var m=c>0?true:false;if(d.stringResult){var o='{"groupOp":"'+ d.groupOp+'","rules":[',q=0;a.each(j,function(w,z){if(q>0)o+=",";o+='{"field":"'+w+'",';o+='"op":"'+n[w]+'",';o+='"data":"'+z+'"}';q++});o+="]}";a.extend(b.p.postData,{filters:o})}else a.extend(b.p.postData,j);var r;if(b.p.searchurl){r=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var u=false;if(a.isFunction(d.beforeSearch))u=d.beforeSearch.call(b);u||a(b).jqGrid("setGridParam",{search:m}).trigger("reloadGrid",[{page:1}]);r&&a(b).jqGrid("setGridParam",{url:r});a.isFunction(d.afterSearch)&& d.afterSearch()},g=a(""),h;a.each(b.p.colModel,function(){var j=this,c,k,l,n;k=a("");c=a("
");this.hidden===true&&a(k).css("display","none");this.search=this.search===false?false:true;if(typeof this.stype=="undefined")this.stype="text";l=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(n= this.surl||l.dataUrl)a.ajax(a.extend({url:n,dataType:"html",complete:function(u){if(l.buildSelect!==undefined)(u=l.buildSelect(u))&&a(c).append(u);else a(c).append(u.responseText);l.defaultValue&&a("select",c).val(l.defaultValue);a("select",c).attr({name:j.index||j.name,id:"gs_"+j.name});l.attr&&a("select",c).attr(l.attr);a("select",c).css({width:"100%"});l.dataInit!==undefined&&l.dataInit(a("select",c)[0]);l.dataEvents!==undefined&&e(a("select",c)[0],l.dataEvents);d.autosearch===true&&a("select", c).change(function(){f();return false});u=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var m;if(j.searchoptions&&j.searchoptions.value)m=j.searchoptions.value;else if(j.editoptions&&j.editoptions.value)m=j.editoptions.value;if(m){n=document.createElement("select");n.style.width="100%";a(n).attr({name:j.index||j.name,id:"gs_"+j.name});var o,q;if(typeof m==="string"){m=m.split(";");for(var r=0;r");l.attr&&a("input",c).attr(l.attr);l.dataInit!==undefined&&l.dataInit(a("input",c)[0]);l.dataEvents!==undefined&&e(a("input",c)[0],l.dataEvents);if(d.autosearch===true)d.searchOnEnter?a("input",c).keypress(function(u){if((u.charCode?u.charCode:u.keyCode?u.keyCode:0)==13){f();return false}return this}):a("input",c).keydown(function(u){switch(u.which){case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:h&&clearTimeout(h);h=setTimeout(function(){f()}, 500)}});break}a(k).append(c);a(g).append(k)});a("table thead",b.grid.hDiv).append(g);this.triggerToolbar=f;this.clearToolbar=function(j){var c={},k,l=0,n;j=typeof j!="boolean"?true:j;a.each(b.p.colModel,function(){k=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";n=this.index||this.name;switch(this.stype){case "select":var w;a("select[name="+n+"] option",b.grid.hDiv).each(function(C){if(C===0)this.selected=true;if(a(this).text()==k){this.selected=true;w=a(this).val(); return false}});if(w){c[n]=w;l++}else try{delete b.p.postData[n]}catch(z){}break;case "text":a("input[name="+n+"]",b.grid.hDiv).val(k);if(k){c[n]=k;l++}else try{delete b.p.postData[n]}catch(v){}break}});var m=l>0?true:false;if(d.stringResult){var o='{"groupOp":"'+d.groupOp+'","rules":[',q=0;a.each(c,function(w,z){if(q>0)o+=",";o+='{"field":"'+w+'",';o+='"op":"eq",';o+='"data":"'+z+'"}';q++});o+="]}";a.extend(b.p.postData,{filters:o})}else a.extend(b.p.postData,c);var r;if(b.p.searchurl){r=b.p.url; a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var u=false;if(a.isFunction(d.beforeClear))u=d.beforeClear.call(b);u||j&&a(b).jqGrid("setGridParam",{search:m}).trigger("reloadGrid",[{page:1}]);r&&a(b).jqGrid("setGridParam",{url:r});a.isFunction(d.afterClear)&&d.afterClear()};this.toggleToolbar=function(){var j=a("tr.ui-search-toolbar",b.grid.hDiv);j.css("display")=="none"?j.show():j.hide()}})}})})(jQuery); (function(a){var d=null;a.jgrid.extend({searchGrid:function(e){e=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:false,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,cloneSearchRowOnAdd:true,sopt:null,stringResult:undefined,onClose:null,useDataProxy:false},a.jgrid.search,e||{});return this.each(function(){function b(v, C){if(C=v.p.postData[C.sFilter]){C.groupOp&&v.SearchFilter.setGroupOp(C.groupOp);if(C.rules)for(var E,y=0,x=C.rules.length;y1){var C=a("#"+k).css("zIndex");a("#"+k).css({zIndex:parseInt(C,10)+v})}a("#"+k).show();a(".jqgrid-overlay:first","#gbox_"+c.p.id).show();try{a(":input:visible","#"+k)[0].focus()}catch(E){}}var c=this;if(c.grid)if(a.fn.searchFilter){var k="fbox_"+c.p.id;e.recreateFilter===true&&a("#"+k).remove();if(a("#"+k).html()!=null){a.isFunction(e.beforeShowSearch)&&e.beforeShowSearch(a("#"+k));j();a.isFunction(e.afterShowSearch)&&e.afterShowSearch(a("#"+k))}else{var l= [],n=a("#"+c.p.id).jqGrid("getGridParam","colNames"),m=a("#"+c.p.id).jqGrid("getGridParam","colModel"),o=["eq","ne","lt","le","gt","ge","bw","bn","in","ni","ew","en","cn","nc"],q,r,u,w;w=jQuery.fn.searchFilter.defaults.operators;if(e.sopt!==null){w=[];for(q=u=0;q0)for(q=0;q0){a("").insertBefore("#gview_"+c.p.id);if(e.stringResult===undefined)e.stringResult=e.multipleSearch;c.SearchFilter=a("#"+k).searchFilter(l,{groupOps:e.groupOps,operators:w,onClose:h,resetText:e.Reset,searchText:e.Find,windowTitle:e.caption,rulesText:e.rulesText,matchText:e.matchText, onSearch:f,onReset:g,stringResult:e.stringResult,ajaxSelectOptions:a.extend({},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}),clone:e.cloneSearchRowOnAdd});a(".ui-widget-overlay","#"+k).remove();c.p.direction=="rtl"&&a(".ui-closer","#"+k).css("float","left");if(e.drag===true){a("#"+k+" table thead tr:first td:first").css("cursor","move");if(jQuery.fn.jqDrag)a("#"+k).jqDrag(a("#"+k+" table thead tr:first td:first"));else try{a("#"+k).draggable({handle:a("#"+k+" table thead tr:first td:first")})}catch(z){}}if(e.multipleSearch=== false){a(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText","#"+k).hide();a("select[name='groupOp']","#"+k).hide()}e.multipleSearch===true&&e.loadDefaults===true&&b(c,e);a.isFunction(e.onInitializeSearch)&&e.onInitializeSearch(a("#"+k));a.isFunction(e.beforeShowSearch)&&e.beforeShowSearch(a("#"+k));j();a.isFunction(e.afterShowSearch)&&e.afterShowSearch(a("#"+k));e.closeOnEscape===true&&a("#"+k).keydown(function(v){v.which==27&&h(a("#"+k))})}}}})},editGridRow:function(e,b){d=b=a.extend({top:0, left:0,width:300,height:"auto",dataheight:"auto",modal:false,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(F,K){F===0?a("#pData","#"+r+"_2").addClass("ui-state-disabled"):a("#pData","#"+r+"_2").removeClass("ui-state-disabled");F==K?a("#nData","#"+r+"_2").addClass("ui-state-disabled"):a("#nData","#"+r+"_2").removeClass("ui-state-disabled")}function g(){var F=a(m).jqGrid("getDataIDs"), K=a("#id_g","#"+r).val();return[a.inArray(K,F),F]}function h(){var F=true;a("#FormError","#"+r).hide();if(d.checkOnUpdate){x={};A={};j();L=a.extend({},x,A);if(R=n(L,d._savedData)){a("#"+q).data("disabled",true);a(".confirm","#"+u.themodal).show();F=false}}return F}function j(){a(".FormElement","#"+r).each(function(){var F=a(".customelement",this);if(F.length){var K=F[0].name;a.each(m.p.colModel,function(){if(this.name==K&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{x[K]=this.editoptions.custom_value(a("#"+ K,"#"+r),"get");if(x[K]===undefined)throw"e1";}catch(N){N=="e1"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,N.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).attr("checked"))x[this.name]=a(this).val();else{F=a(this).attr("offval");x[this.name]=F}break;case "select-one":x[this.name]=a("option:selected",this).val();A[this.name]= a("option:selected",this).text();break;case "select-multiple":x[this.name]=a(this).val();x[this.name]=x[this.name]?x[this.name].join(","):"";var O=[];a("option:selected",this).each(function(N,X){O[N]=a(X).text()});A[this.name]=O.join(",");break;case "password":case "text":case "textarea":case "button":x[this.name]=a(this).val();break}if(m.p.autoencode)x[this.name]=a.jgrid.htmlEncode(x[this.name])}});return true}function c(F,K,O,N){for(var X,Y,W,fa=0,P,U,V,pa=[],ba=false,ra="",ma=1;ma<=N;ma++)ra+= "  ";if(F!="_empty")ba=a(K).jqGrid("getInd",F);a(K.p.colModel).each(function(wa){X=this.name;U=(Y=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if(X!=="cb"&&X!=="subgrid"&&this.editable===true&&X!=="rn"){if(ba===false)P="";else if(X==K.p.ExpandColumn&&K.p.treeGrid===true)P=a("td:eq("+wa+")",K.rows[ba]).text();else try{P= a.unformat(a("td:eq("+wa+")",K.rows[ba]),{rowId:F,colModel:this},wa)}catch(sa){P=a("td:eq("+wa+")",K.rows[ba]).html()}var ka=a.extend({},this.editoptions||{},{id:X,name:X}),la=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),Da=parseInt(la.rowpos,10)||fa+1,Ia=parseInt((parseInt(la.colpos,10)||1)*2,10);if(F=="_empty"&&ka.defaultValue)P=a.isFunction(ka.defaultValue)?ka.defaultValue():ka.defaultValue;if(!this.edittype)this.edittype="text";if(m.p.autoencode)P= a.jgrid.htmlDecode(P);V=createEl(this.edittype,ka,P,false,a.extend({},a.jgrid.ajaxOptions,K.p.ajaxSelectOptions||{}));if(P==""&&this.edittype=="checkbox")P=a(V).attr("offval");if(P==""&&this.edittype=="select")P=a("option:eq(0)",V).text();if(d.checkOnSubmit||d.checkOnUpdate)d._savedData[X]=P;a(V).addClass("FormElement");W=a(O).find("tr[rowpos="+Da+"]");if(la.rowabove){ka=a(""+la.rowcontent+"");a(O).append(ka);ka[0].rp=Da}if(W.length===0){W=a("").addClass("FormData").attr("id","tr_"+X);a(W).append(ra);a(O).append(W);W[0].rp=Da}a("td:eq("+(Ia-2)+")",W[0]).html(typeof la.label==="undefined"?K.p.colNames[wa]:la.label);a("td:eq("+(Ia-1)+")",W[0]).append(la.elmprefix).append(V).append(la.elmsuffix);pa[fa]=wa;fa++}});if(fa>0){ma=a("");ma[0].rp=fa+999;a(O).append(ma);if(d.checkOnSubmit||d.checkOnUpdate)d._savedData[K.p.id+"_id"]=F}return pa}function k(F,K,O){var N,X=0,Y,W,fa,P,U;if(d.checkOnSubmit||d.checkOnUpdate){d._savedData={};d._savedData[K.p.id+"_id"]=F}var V=K.p.colModel;if(F=="_empty"){a(V).each(function(){N=this.name;fa=a.extend({},this.editoptions||{});W=a("#"+a.jgrid.jqID(N),"#"+O);if(W[0]!=null){P="";if(fa.defaultValue){P=a.isFunction(fa.defaultValue)?fa.defaultValue():fa.defaultValue;if(W[0].type== "checkbox"){U=P.toLowerCase();if(U.search(/(false|0|no|off|undefined)/i)<0&&U!==""){W[0].checked=true;W[0].defaultChecked=true;W[0].value=P}else W.attr({checked:"",defaultChecked:""})}else W.val(P)}else if(W[0].type=="checkbox"){W[0].checked=false;W[0].defaultChecked=false;P=a(W).attr("offval")}else if(W[0].type.substr(0,6)=="select")W[0].selectedIndex=0;else W.val(P);if(d.checkOnSubmit===true||d.checkOnUpdate)d._savedData[N]=P}});a("#id_g","#"+O).val(F)}else{var pa=a(K).jqGrid("getInd",F,true);if(pa){a("td", pa).each(function(ba){N=V[ba].name;if(N!=="cb"&&N!=="subgrid"&&N!=="rn"&&V[ba].editable===true){if(N==K.p.ExpandColumn&&K.p.treeGrid===true)Y=a(this).text();else try{Y=a.unformat(this,{rowId:F,colModel:V[ba]},ba)}catch(ra){Y=a(this).html()}if(m.p.autoencode)Y=a.jgrid.htmlDecode(Y);if(d.checkOnSubmit===true||d.checkOnUpdate)d._savedData[N]=Y;N=a.jgrid.jqID(N);switch(V[ba].edittype){case "password":case "text":case "button":case "image":a("#"+N,"#"+O).val(Y);break;case "textarea":if(Y==" "||Y== " "||Y.length==1&&Y.charCodeAt(0)==160)Y="";a("#"+N,"#"+O).val(Y);break;case "select":var ma=Y.split(",");ma=a.map(ma,function(sa){return a.trim(sa)});a("#"+N+" option","#"+O).each(function(){this.selected=!V[ba].editoptions.multiple&&(ma[0]==a.trim(a(this).text())||ma[0]==a.trim(a(this).val()))?true:V[ba].editoptions.multiple?a.inArray(a.trim(a(this).text()),ma)>-1||a.inArray(a.trim(a(this).val()),ma)>-1?true:false:false});break;case "checkbox":Y+="";if(V[ba].editoptions&&V[ba].editoptions.value)if(V[ba].editoptions.value.split(":")[0]== Y){a("#"+N,"#"+O).attr("checked",true);a("#"+N,"#"+O).attr("defaultChecked",true)}else{a("#"+N,"#"+O).attr("checked",false);a("#"+N,"#"+O).attr("defaultChecked","")}else{Y=Y.toLowerCase();if(Y.search(/(false|0|no|off|undefined)/i)<0&&Y!==""){a("#"+N,"#"+O).attr("checked",true);a("#"+N,"#"+O).attr("defaultChecked",true)}else{a("#"+N,"#"+O).attr("checked",false);a("#"+N,"#"+O).attr("defaultChecked","")}}break;case "custom":try{if(V[ba].editoptions&&a.isFunction(V[ba].editoptions.custom_value))V[ba].editoptions.custom_value(a("#"+ N,"#"+O),"set",Y);else throw"e1";}catch(wa){wa=="e1"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,wa.message,jQuery.jgrid.edit.bClose)}break}X++}});X>0&&a("#id_g","#"+r).val(F)}}}function l(){var F,K=[true,"",""],O={},N=m.p.prmNames,X,Y;if(a.isFunction(d.beforeCheckValues)){var W=d.beforeCheckValues(x,a("#"+q),x[m.p.id+"_id"]=="_empty"?N.addoper:N.editoper);if(W&&typeof W==="object")x= W}for(var fa in x)if(x.hasOwnProperty(fa)){K=checkValues(x[fa],fa,m);if(K[0]===false)break}if(K[0]){if(a.isFunction(d.onclickSubmit))O=d.onclickSubmit(d,x)||{};if(a.isFunction(d.beforeSubmit))K=d.beforeSubmit(x,a("#"+q))}if(K[0]&&!d.processing){d.processing=true;a("#sData","#"+r+"_2").addClass("ui-state-active");Y=N.oper;X=N.id;x[Y]=a.trim(x[m.p.id+"_id"])=="_empty"?N.addoper:N.editoper;if(x[Y]!=N.addoper)x[X]=x[m.p.id+"_id"];else if(x[X]===undefined)x[X]=x[m.p.id+"_id"];delete x[m.p.id+"_id"];x= a.extend(x,d.editData,O);if(m.p.restful){d.mtype=x.id=="_empty"?"POST":"PUT";d.url=x.id=="_empty"?m.p.url:m.p.url+"/"+x.id}O=a.extend({url:d.url?d.url:a(m).jqGrid("getGridParam","editurl"),type:d.mtype,data:a.isFunction(d.serializeEditData)?d.serializeEditData(x):x,complete:function(P,U){if(U!="success"){K[0]=false;K[1]=a.isFunction(d.errorTextFormat)?d.errorTextFormat(P):U+" Status: '"+P.statusText+"'. Error code: "+P.status}else if(a.isFunction(d.afterSubmit))K=d.afterSubmit(P,x);if(K[0]===false){a("#FormError>td", "#"+r).html(K[1]);a("#FormError","#"+r).show()}else{a.each(m.p.colModel,function(){if(A[this.name]&&this.formatter&&this.formatter=="select")try{delete A[this.name]}catch(ba){}});x=a.extend(x,A);m.p.autoencode&&a.each(x,function(ba,ra){x[ba]=a.jgrid.htmlDecode(ra)});if(x[Y]==N.addoper){K[2]||(K[2]=parseInt(m.p.records,10)+1);x[X]=K[2];if(d.closeAfterAdd){if(d.reloadAfterSubmit)a(m).trigger("reloadGrid");else{a(m).jqGrid("addRowData",K[2],x,b.addedrow);a(m).jqGrid("setSelection",K[2])}hideModal("#"+ u.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:d.onClose})}else if(d.clearAfterAdd){d.reloadAfterSubmit?a(m).trigger("reloadGrid"):a(m).jqGrid("addRowData",K[2],x,b.addedrow);k("_empty",m,q)}else d.reloadAfterSubmit?a(m).trigger("reloadGrid"):a(m).jqGrid("addRowData",K[2],x,b.addedrow)}else{if(d.reloadAfterSubmit){a(m).trigger("reloadGrid");d.closeAfterEdit||setTimeout(function(){a(m).jqGrid("setSelection",x[X])},1E3)}else m.p.treeGrid===true?a(m).jqGrid("setTreeRow",x[X],x):a(m).jqGrid("setRowData", x[X],x);d.closeAfterEdit&&hideModal("#"+u.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:d.onClose})}if(a.isFunction(d.afterComplete)){F=P;setTimeout(function(){d.afterComplete(F,x,a("#"+q));F=null},500)}}d.processing=false;if(d.checkOnSubmit||d.checkOnUpdate){a("#"+q).data("disabled",false);if(d._savedData[m.p.id+"_id"]!="_empty")for(var V in d._savedData)if(x[V])d._savedData[V]=x[V]}a("#sData","#"+r+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+q)[0].focus()}catch(pa){}},error:function(P, U,V){a("#FormError>td","#"+r).html(U+" : "+V);a("#FormError","#"+r).show();d.processing=false;a("#"+q).data("disabled",false);a("#sData","#"+r+"_2").removeClass("ui-state-active")}},a.jgrid.ajaxOptions,d.ajaxEditOptions);if(!O.url&&!d.useDataProxy)if(a.isFunction(m.p.dataProxy))d.useDataProxy=true;else{K[0]=false;K[1]+=" "+a.jgrid.errors.nourl}if(K[0])d.useDataProxy?m.p.dataProxy.call(m,O,"set_"+m.p.id):a.ajax(O)}if(K[0]===false){a("#FormError>td","#"+r).html(K[1]);a("#FormError","#"+r).show()}}function n(F, K){var O=false,N;for(N in F)if(F[N]!=K[N]){O=true;break}return O}var m=this;if(m.grid&&e){var o=m.p.id,q="FrmGrid_"+o,r="TblGrid_"+o,u={themodal:"editmod"+o,modalhead:"edithd"+o,modalcontent:"editcnt"+o,scrollelm:q},w=a.isFunction(d.beforeShowForm)?d.beforeShowForm:false,z=a.isFunction(d.afterShowForm)?d.afterShowForm:false,v=a.isFunction(d.beforeInitData)?d.beforeInitData:false,C=a.isFunction(d.onInitializeForm)?d.onInitializeForm:false,E=1,y=0,x,A,L,R;if(e=="new"){e="_empty";b.caption=b.addCaption}else b.caption= b.editCaption;b.recreateForm===true&&a("#"+u.themodal).html()!=null&&a("#"+u.themodal).remove();var aa=true;if(b.checkOnUpdate&&b.jqModal&&!b.modal)aa=false;if(a("#"+u.themodal).html()!=null){a(".ui-jqdialog-title","#"+u.modalhead).html(b.caption);a("#FormError","#"+r).hide();if(d.topinfo){a(".topinfo","#"+r+"_2").html(d.topinfo);a(".tinfo","#"+r+"_2").show()}else a(".tinfo","#"+r+"_2").hide();if(d.bottominfo){a(".bottominfo","#"+r+"_2").html(d.bottominfo);a(".binfo","#"+r+"_2").show()}else a(".binfo", "#"+r+"_2").hide();v&&v(a("#"+q));k(e,m,q);e=="_empty"||!d.viewPagerButtons?a("#pData, #nData","#"+r+"_2").hide():a("#pData, #nData","#"+r+"_2").show();if(d.processing===true){d.processing=false;a("#sData","#"+r+"_2").removeClass("ui-state-active")}if(a("#"+q).data("disabled")===true){a(".confirm","#"+u.themodal).hide();a("#"+q).data("disabled",false)}w&&w(a("#"+q));a("#"+u.themodal).data("onClose",d.onClose);viewModal("#"+u.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,jqM:false,closeoverlay:aa,modal:b.modal}); aa||a(".jqmOverlay").click(function(){if(!h())return false;hideModal("#"+u.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:d.onClose});return false});z&&z(a("#"+q))}else{a(m.p.colModel).each(function(){var F=this.formoptions;E=Math.max(E,F?F.colpos||0:0);y=Math.max(y,F?F.rowpos||0:0)});var M=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",Z;M=a("
").data("disabled", false);var ca=a("
");a(M).append(ca);Z=a("");Z[0].rp=0;a(ca).append(Z);Z=a(""+d.topinfo+"");Z[0].rp=0;a(ca).append(Z);v&&v(a("#"+q));Z=(v=m.p.direction=="rtl"?true:false)?"nData":"pData";var ea=v?"pData":"nData";c(e,m,ca, E);Z="";ea="";var ua=""+b.bSubmit+"",ya=""+ b.bCancel+"";Z="";Z+="";Z+="
"+ua+ya+"
";if(y>0){var Ca=[];a.each(a(ca)[0].rows,function(F,K){Ca[F]=K});Ca.sort(function(F,K){if(F.rp>K.rp)return 1;if(F.rp").append(M).append(Z);createModal(u,M,b,"#gview_"+m.p.id,a("#gview_"+m.p.id)[0]);if(v){a("#pData, #nData","#"+r+"_2").css("float","right");a(".EditButton","#"+r+"_2").css("text-align","left")}d.topinfo&&a(".tinfo","#"+r+"_2").show();d.bottominfo&&a(".binfo","#"+r+"_2").show();Z=M=null;a("#"+u.themodal).keydown(function(F){var K=F.target;if(a("#"+q).data("disabled")=== true)return false;if(d.savekey[0]===true&&F.which==d.savekey[1])if(K.tagName!="TEXTAREA"){a("#sData","#"+r+"_2").trigger("click");return false}if(F.which===27){if(!h())return false;za&&hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:d.onClose});return false}if(d.navkeys[0]===true){if(a("#id_g","#"+r).val()=="_empty")return true;if(F.which==d.navkeys[1]){a("#pData","#"+r+"_2").trigger("click");return false}if(F.which==d.navkeys[2]){a("#nData","#"+r+"_2").trigger("click");return false}}});if(b.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span", "#"+u.themodal).removeClass("jqmClose");a("a.ui-jqdialog-titlebar-close","#"+u.themodal).unbind("click").click(function(){if(!h())return false;hideModal("#"+u.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:d.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","#"+r+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(b.closeicon[0]===true)a("#cData","#"+r+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(d.checkOnSubmit||d.checkOnUpdate){ua=""+b.bYes+"";ea=""+b.bNo+""; ya=""+b.bExit+"";M=b.zIndex||999;M++;a("
"+ b.saveData+"

"+ua+ea+ya+"
").insertAfter("#"+q);a("#sNew","#"+u.themodal).click(function(){l();a("#"+q).data("disabled",false);a(".confirm","#"+u.themodal).hide();return false});a("#nNew","#"+u.themodal).click(function(){a(".confirm","#"+u.themodal).hide();a("#"+q).data("disabled",false);setTimeout(function(){a(":input","#"+q)[0].focus()},0);return false});a("#cNew","#"+u.themodal).click(function(){a(".confirm","#"+u.themodal).hide();a("#"+q).data("disabled",false);hideModal("#"+u.themodal, {gb:"#gbox_"+o,jqm:b.jqModal,onClose:d.onClose});return false})}C&&C(a("#"+q));e=="_empty"||!d.viewPagerButtons?a("#pData,#nData","#"+r+"_2").hide():a("#pData,#nData","#"+r+"_2").show();w&&w(a("#"+q));a("#"+u.themodal).data("onClose",d.onClose);viewModal("#"+u.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,closeoverlay:aa,modal:b.modal});aa||a(".jqmOverlay").click(function(){if(!h())return false;hideModal("#"+u.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:d.onClose});return false});z&&z(a("#"+q));a(".fm-button", "#"+u.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+r+"_2").click(function(){x={};A={};a("#FormError","#"+r).hide();j();if(x[m.p.id+"_id"]=="_empty")l();else if(b.checkOnSubmit===true){L=a.extend({},x,A);if(R=n(L,d._savedData)){a("#"+q).data("disabled",true);a(".confirm","#"+u.themodal).show()}else l()}else l();return false});a("#cData","#"+r+"_2").click(function(){if(!h())return false;hideModal("#"+u.themodal,{gb:"#gbox_"+ o,jqm:b.jqModal,onClose:d.onClose});return false});a("#nData","#"+r+"_2").click(function(){if(!h())return false;a("#FormError","#"+r).hide();var F=g();F[0]=parseInt(F[0],10);if(F[0]!=-1&&F[1][F[0]+1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("next",a("#"+q),F[1][F[0]]);k(F[1][F[0]+1],m,q);a(m).jqGrid("setSelection",F[1][F[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+q),F[1][F[0]+1]);f(F[0]+1,F[1].length-1)}return false});a("#pData","#"+r+"_2").click(function(){if(!h())return false; a("#FormError","#"+r).hide();var F=g();if(F[0]!=-1&&F[1][F[0]-1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("prev",a("#"+q),F[1][F[0]]);k(F[1][F[0]-1],m,q);a(m).jqGrid("setSelection",F[1][F[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+q),F[1][F[0]-1]);f(F[0]-1,F[1].length-1)}return false})}w=g();f(w[0],w[1].length-1)}})},viewGridRow:function(e,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,drag:true,resize:true,jqModal:true, closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm: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","#"+o.modalhead).focus()},0)}function g(A,L){A===0?a("#pData","#"+m+"_2").addClass("ui-state-disabled"):a("#pData","#"+m+"_2").removeClass("ui-state-disabled");A==L?a("#nData","#"+m+"_2").addClass("ui-state-disabled"): a("#nData","#"+m+"_2").removeClass("ui-state-disabled")}function h(){var A=a(k).jqGrid("getDataIDs"),L=a("#id_g","#"+m).val();return[a.inArray(L,A),A]}function j(A,L,R,aa){for(var M,Z,ca,ea=0,ua,ya,Ca=[],za=false,F="  ",K="",O=["integer","number","currency"],N=0,X=0,Y,W,fa,P=1;P<=aa;P++)K+=P==1?F:"  "; a(L.p.colModel).each(function(){Z=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!Z&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,O)!==-1)N=Math.max(N,parseInt(this.width,10));else X=Math.max(X,parseInt(this.width,10))});Y=N!==0?N:X!==0?X:0;za=a(L).jqGrid("getInd",A);a(L.p.colModel).each(function(U){M=this.name;W=false;ya=(Z=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";fa= typeof this.viewable!="boolean"?true:this.viewable;if(M!=="cb"&&M!=="subgrid"&&M!=="rn"&&fa){ua=za===false?"":M==L.p.ExpandColumn&&L.p.treeGrid===true?a("td:eq("+U+")",L.rows[za]).text():a("td:eq("+U+")",L.rows[za]).html();W=this.align==="right"&&Y!==0?true:false;a.extend({},this.editoptions||{},{id:M,name:M});var V=a.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),pa=parseInt(V.rowpos,10)||ea+1,ba=parseInt((parseInt(V.colpos,10)||1)*2,10);if(V.rowabove){var ra=a(""+V.rowcontent+"");a(R).append(ra);ra[0].rp=pa}ca=a(R).find("tr[rowpos="+pa+"]");if(ca.length===0){ca=a("").addClass("FormData").attr("id","trv_"+M);a(ca).append(K);a(R).append(ca);ca[0].rp=pa}a("td:eq("+(ba-2)+")",ca[0]).html(""+(typeof V.label==="undefined"?L.p.colNames[U]:V.label)+"");a("td:eq("+(ba-1)+")",ca[0]).append(""+ua+"").attr("id","v_"+M);W&&a("td:eq("+(ba-1)+") span",ca[0]).css({"text-align":"right",width:Y+"px"}); Ca[ea]=U;ea++}});if(ea>0){A=a("");A[0].rp=ea+99;a(R).append(A)}return Ca}function c(A,L){var R,aa,M=0,Z,ca;if(ca=a(L).jqGrid("getInd",A,true)){a("td",ca).each(function(ea){R=L.p.colModel[ea].name;aa=L.p.colModel[ea].editrules&&L.p.colModel[ea].editrules.edithidden===true?false:L.p.colModel[ea].hidden===true? true:false;if(R!=="cb"&&R!=="subgrid"&&R!=="rn"){Z=R==L.p.ExpandColumn&&L.p.treeGrid===true?a(this).text():a(this).html();a.extend({},L.p.colModel[ea].editoptions||{});R=a.jgrid.jqID("v_"+R);a("#"+R+" span","#"+m).html(Z);aa&&a("#"+R,"#"+m).parents("tr:first").hide();M++}});M>0&&a("#id_g","#"+m).val(A)}}var k=this;if(k.grid&&e){if(!b.imgpath)b.imgpath=k.p.imgpath;var l=k.p.id,n="ViewGrid_"+l,m="ViewTbl_"+l,o={themodal:"viewmod"+l,modalhead:"viewhd"+l,modalcontent:"viewcnt"+l,scrollelm:n},q=1,r=0; if(a("#"+o.themodal).html()!=null){a(".ui-jqdialog-title","#"+o.modalhead).html(b.caption);a("#FormError","#"+m).hide();c(e,k);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+n));viewModal("#"+o.themodal,{gbox:"#gbox_"+l,jqm:b.jqModal,jqM:false,modal:b.modal});f()}else{a(k.p.colModel).each(function(){var A=this.formoptions;q=Math.max(q,A?A.colpos||0:0);r=Math.max(r,A?A.rowpos||0:0)});var u=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",w=a("
"),z=a("
");a(w).append(z);j(e,k,z,q);u=k.p.direction=="rtl"?true:false;var v="",C="", E=""+b.bClose+"";if(r>0){var y=[];a.each(a(z)[0].rows,function(A,L){y[A]=L});y.sort(function(A,L){if(A.rp>L.rp)return 1;if(A.rp").append(w).append("
"+E+"
");createModal(o,w,b,"#gview_"+k.p.id,a("#gview_"+k.p.id)[0]);if(u){a("#pData, #nData","#"+m+"_2").css("float","right");a(".EditButton","#"+m+"_2").css("text-align","left")}b.viewPagerButtons||a("#pData, #nData","#"+m+"_2").hide();w=null;a("#"+o.themodal).keydown(function(A){if(A.which===27){x&&hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(A.which=== b.navkeys[1]){a("#pData","#"+m+"_2").trigger("click");return false}if(A.which===b.navkeys[2]){a("#nData","#"+m+"_2").trigger("click");return false}}});b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.closeicon[0]===true)a("#cData","#"+m+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+n));viewModal("#"+o.themodal,{gbox:"#gbox_"+l, jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+m+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});f();a("#cData","#"+m+"_2").click(function(){hideModal("#"+o.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:b.onClose});return false});a("#nData","#"+m+"_2").click(function(){a("#FormError","#"+m).hide();var A=h();A[0]=parseInt(A[0],10);if(A[0]!=-1&&A[1][A[0]+1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("next", a("#"+n),A[1][A[0]]);c(A[1][A[0]+1],k);a(k).jqGrid("setSelection",A[1][A[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+n),A[1][A[0]+1]);g(A[0]+1,A[1].length-1)}f();return false});a("#pData","#"+m+"_2").click(function(){a("#FormError","#"+m).hide();var A=h();if(A[0]!=-1&&A[1][A[0]-1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("prev",a("#"+n),A[1][A[0]]);c(A[1][A[0]-1],k);a(k).jqGrid("setSelection",A[1][A[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev", a("#"+n),A[1][A[0]-1]);g(A[0]-1,A[1].length-1)}f();return false})}u=h();g(u[0],u[1].length-1)}})},delGridRow:function(e,b){d=b=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:false,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,beforeShowForm: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=f.p.id,c={},k="DelTbl_"+j,l,n,m,o,q={themodal:"delmod"+j,modalhead:"delhd"+j,modalcontent:"delcnt"+j,scrollelm:k};if(jQuery.isArray(e))e=e.join();if(a("#"+q.themodal).html()!=null){a("#DelData>td","#"+k).text(e);a("#DelError","#"+k).hide();if(d.processing===true){d.processing=false;a("#dData","#"+k).removeClass("ui-state-active")}g&& b.beforeShowForm(a("#"+k));viewModal("#"+q.themodal,{gbox:"#gbox_"+j,jqm:b.jqModal,jqM:false,modal:b.modal})}else{var r=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";r="
";r+="";r+="";r+="";r+='";r+="
'+ b.msg+"
 
";r+="
"+(""+b.bSubmit+"")+" "+(""+ b.bCancel+"")+"
";b.gbox="#gbox_"+j;createModal(q,r,b,"#gview_"+f.p.id,a("#gview_"+f.p.id)[0]);a(".fm-button","#"+k+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});b.delicon=a.extend([true,"left","ui-icon-scissors"],b.delicon);b.cancelicon=a.extend([true,"left","ui-icon-cancel"],b.cancelicon);if(b.delicon[0]===true)a("#dData","#"+k+"_2").addClass(b.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(b.cancelicon[0]===true)a("#eData","#"+k+"_2").addClass(b.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");a("#dData","#"+k+"_2").click(function(){var u=[true,""];c={};var w=a("#DelData>td","#"+k).text();if(typeof b.onclickSubmit==="function")c=b.onclickSubmit(d,w)||{};if(typeof b.beforeSubmit==="function")u=b.beforeSubmit(w);if(u[0]&&!d.processing){d.processing=true;a(this).addClass("ui-state-active"); m=f.p.prmNames;l=a.extend({},d.delData,c);o=m.oper;l[o]=m.deloper;n=m.id;l[n]=w;if(f.p.restful){b.mtype="DELETE";d.url=f.p.url+"/"+w}var z=a.extend({url:d.url?d.url:a(f).jqGrid("getGridParam","editurl"),type:b.mtype,data:a.isFunction(b.serializeDelData)?b.serializeDelData(l):l,complete:function(v,C){if(C!="success"){u[0]=false;u[1]=a.isFunction(d.errorTextFormat)?d.errorTextFormat(v):C+" Status: '"+v.statusText+"'. Error code: "+v.status}else if(typeof d.afterSubmit==="function")u=d.afterSubmit(v, l);if(u[0]===false){a("#DelError>td","#"+k).html(u[1]);a("#DelError","#"+k).show()}else{if(d.reloadAfterSubmit)a(f).trigger("reloadGrid");else{C=[];C=w.split(",");if(f.p.treeGrid===true)try{a(f).jqGrid("delTreeNode",C[0])}catch(E){}else for(var y=0;ytd","#"+k).html(C+" : "+E);a("#DelError","#"+k).show();d.processing=false;a("#dData","#"+k+"_2").removeClass("ui-state-active")}},a.jgrid.ajaxOptions,b.ajaxDelOptions);if(!z.url&&!d.useDataProxy)if(a.isFunction(f.p.dataProxy))d.useDataProxy=true;else{u[0]=false;u[1]+=" "+a.jgrid.errors.nourl}if(u[0])d.useDataProxy?f.p.dataProxy.call(f,z,"del_"+f.p.id):a.ajax(z)}if(u[0]===false){a("#DelError>td","#"+k).html(u[1]); a("#DelError","#"+k).show()}return false});a("#eData","#"+k+"_2").click(function(){hideModal("#"+q.themodal,{gb:"#gbox_"+j,jqm:b.jqModal,onClose:d.onClose});return false});g&&b.beforeShowForm(a("#"+k));viewModal("#"+q.themodal,{gbox:"#gbox_"+j,jqm:b.jqModal,modal:b.modal})}h&&b.afterShowForm(a("#"+k));b.closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+q.modalhead).focus()},0)}})},navGrid:function(e,b,f,g,h,j,c){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 k={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},l=this,n,m,o;if(!(!l.grid||typeof e!="string")){if(a("#"+k.themodal).html()===null){if(typeof window.innerWidth!= "undefined"){n=window.innerWidth;m=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==0){n=document.documentElement.clientWidth;m=document.documentElement.clientHeight}else{n=1024;m=768}createModal(k,"
"+b.alerttext+"
",{gbox:"#gbox_"+l.p.id,jqModal:true,drag:true,resize:true,caption:b.alertcap,top:m/2-25, left:n/2-100,width:200,height:"auto",closeOnEscape:b.closeOnEscape},"","",true)}n=1;if(b.cloneToTop&&l.p.toppager)n=2;for(m=0;m"),r,u;if(m===0){r=e;u=l.p.id;if(r==l.p.toppager){u+="_top";n=1}}else{r=l.p.toppager;u=l.p.id+"_top"}l.p.direction=="rtl"&&a(q).attr("dir","rtl").css("float","right");if(b.add){g=g||{};o=a(""); a(o).append("
"+b.addtext+"
");a("tr",q).append(o);a(o,q).attr({title:b.addtitle||"",id:g.id||"add_"+u}).click(function(){typeof b.addfunc=="function"?b.addfunc():a(l).jqGrid("editGridRow","new",g);return false}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.edit){o=a("");f=f||{};a(o).append("
"+b.edittext+"
");a("tr",q).append(o);a(o,q).attr({title:b.edittitle||"",id:f.id||"edit_"+u}).click(function(){var w=l.p.selrow;if(w)typeof b.editfunc=="function"?b.editfunc(w):a(l).jqGrid("editGridRow",w,f);else{viewModal("#"+k.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});a("#jqg_alrt").focus()}return false}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.view){o=a(""); c=c||{};a(o).append("
"+b.viewtext+"
");a("tr",q).append(o);a(o,q).attr({title:b.viewtitle||"",id:c.id||"view_"+u}).click(function(){var w=l.p.selrow;if(w)a(l).jqGrid("viewGridRow",w,c);else{viewModal("#"+k.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});a("#jqg_alrt").focus()}return false}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.del){o=a(""); h=h||{};a(o).append("
"+b.deltext+"
");a("tr",q).append(o);a(o,q).attr({title:b.deltitle||"",id:h.id||"del_"+u}).click(function(){var w;if(l.p.multiselect){w=l.p.selarrrow;if(w.length===0)w=null}else w=l.p.selrow;if(w)"function"==typeof b.delfunc?b.delfunc(w):a(l).jqGrid("delGridRow",w,h);else{viewModal("#"+k.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});a("#jqg_alrt").focus()}return false}).hover(function(){a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")});o=null}if(b.add||b.edit||b.del||b.view)a("tr",q).append("");if(b.search){o=a("");j=j||{};a(o).append("
"+b.searchtext+"
");a("tr",q).append(o);a(o,q).attr({title:b.searchtitle||"",id:j.id||"search_"+u}).click(function(){a(l).jqGrid("searchGrid", j);return false}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}if(b.refresh){o=a("");a(o).append("
"+b.refreshtext+"
");a("tr",q).append(o);a(o,q).attr({title:b.refreshtitle||"",id:"refresh_"+u}).click(function(){a.isFunction(b.beforeRefresh)&&b.beforeRefresh();l.p.search=false;try{a("#fbox_"+l.p.id).searchFilter().reset(); a.isFunction(l.clearToolbar)&&l.clearToolbar(false)}catch(w){}switch(b.refreshstate){case "firstpage":a(l).trigger("reloadGrid",[{page:1}]);break;case "current":a(l).trigger("reloadGrid",[{current:true}]);break}a.isFunction(b.afterRefresh)&&b.afterRefresh();return false}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});o=null}o=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("");o=a(q).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(r+"_"+b.position,r).append(q);if(l.p._nvtd){if(o>l.p._nvtd[0]){a(r+"_"+b.position,r).width(o);l.p._nvtd[0]=o}l.p._nvtd[1]=o}q=o=o=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.isFunction(b.onClickButton)&& b.onClickButton.call(g,j);return false}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).css("cursor",b.cursor?b.cursor:"normal")}}})},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(){var f=this;if(f.grid){var g=a(f).jqGrid("getRowData",e);if(g)for(var h in g)a("[name="+h+"]",b).is("input:radio")||a("[name="+h+"]",b).is("input:checkbox")?a("[name="+h+"]",b).each(function(){a(this).val()==g[h]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+h+"]",b).val(g[h])}})},FormToGrid:function(e,b,f,g){return this.each(function(){var h=this;if(h.grid){f||(f="set");g||(g="first"); var j=a(b).serializeArray(),c={};a.each(j,function(k,l){c[l.name]=l.value});if(f=="add")a(h).jqGrid("addRowData",e,c,g);else f=="set"&&a(h).jqGrid("setRowData",e,c)}})}})})(jQuery); (function(a){a.jgrid.extend({jqGridImport:function(d){d=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},d||{});return this.each(function(){var e=this,b=function(h,j){var c=a(j.xmlGrid.config,h)[0];j=a(j.xmlGrid.data,h)[0];var k;if(xmlJsonClass.xml2json&&a.jgrid.parse){c=xmlJsonClass.xml2json(c," ");c=a.jgrid.parse(c);for(var l in c)if(c.hasOwnProperty(l))k=c[l];if(j){l=c.grid.datatype; c.grid.datatype="xmlstring";c.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 c=a.jgrid.parse(h);h=c[j.jsonGrid.config];if(j=c[j.jsonGrid.data]){c=h.datatype;h.datatype="jsonstring";h.datastr=j;a(e).jqGrid(h).jqGrid("setGridParam",{datatype:c})}else a(e).jqGrid(h)}};switch(d.imptype){case "xml":a.ajax(a.extend({url:d.impurl,type:d.mtype,data:d.impData,dataType:"xml", complete:function(h,j){if(j=="success"){b(h.responseXML,d);a.isFunction(d.importComplete)&&d.importComplete(h)}}},d.ajaxOptions));break;case "xmlstring":if(d.impstring&&typeof d.impstring=="string"){var g=a.jgrid.stringToDoc(d.impstring);if(g){b(g,d);a.isFunction(d.importComplete)&&d.importComplete(g);d.impstring=null}g=null}break;case "json":a.ajax(a.extend({url:d.impurl,type:d.mtype,data:d.impData,dataType:"json",complete:function(h,j){if(j=="success"){f(h.responseText,d);a.isFunction(d.importComplete)&& d.importComplete(h)}}},d.ajaxOptions));break;case "jsonstring":if(d.impstring&&typeof d.impstring=="string"){f(d.impstring,d);a.isFunction(d.importComplete)&&d.importComplete(d.impstring);d.impstring=null}break}})},jqGridExport:function(d){d=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},d||{});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(d.exptype){case "xmlstring":e="<"+d.root+">"+xmlJsonClass.json2xml(b,d.ident)+"";break;case "jsonstring":e="{"+xmlJsonClass.toJson(b,d.root,d.ident)+"}";if(b.postData.filters!==undefined){e=e.replace(/filters":"/,'filters":');e=e.replace(/}]}"/, "}]}")}break}}});return e},excelExport:function(d){d=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},d||{});return this.each(function(){$t=this;if(this.grid)if(d.exptype=="remote"){var e=a.extend({},this.p.postData);e[d.oper]=d.tag;e=jQuery.param(e);window.location=d.url+"?"+e}})}})})(jQuery); (function(a){a.jgrid.extend({editRow:function(d,e,b,f,g,h,j,c,k){return this.each(function(){var l=this,n,m,o=0,q=null,r={},u,w;if(l.grid){u=a(l).jqGrid("getInd",d,true);if(u!==false)if((a(u).attr("editable")||"0")=="0"&&!a(u).hasClass("not-editable-row")){w=l.p.colModel;a("td",u).each(function(z){n=w[z].name;var v=l.p.treeGrid===true&&n==l.p.ExpandColumn;if(v)m=a("span:first",this).html();else try{m=a.unformat(this,{rowId:d,colModel:w[z]},z)}catch(C){m=a(this).html()}if(n!="cb"&&n!="subgrid"&&n!= "rn"){if(l.p.autoencode)m=a.jgrid.htmlDecode(m);r[n]=m;if(w[z].editable===true){if(q===null)q=z;v?a("span:first",this).html(""):a(this).html("");var E=a.extend({},w[z].editoptions||{},{id:d+"_"+n,name:n});if(!w[z].edittype)w[z].edittype="text";E=createEl(w[z].edittype,E,m,true,a.extend({},a.jgrid.ajaxOptions,l.p.ajaxSelectOptions||{}));a(E).addClass("editable");v?a("span:first",this).append(E):a(this).append(E);w[z].edittype=="select"&&w[z].editoptions.multiple===true&&a.browser.msie&&a(E).width(a(E).width()); o++}}});if(o>0){r.id=d;l.p.savedRow.push(r);a(u).attr("editable","1");a("td:eq("+q+") input",u).focus();e===true&&a(u).bind("keydown",function(z){z.keyCode===27&&a(l).jqGrid("restoreRow",d,k);if(z.keyCode===13){if(z.target.tagName=="TEXTAREA")return true;a(l).jqGrid("saveRow",d,f,g,h,j,c,k);return false}z.stopPropagation()});a.isFunction(b)&&b(d)}}}})},saveRow:function(d,e,b,f,g,h,j){return this.each(function(){var c=this,k,l={},n={},m,o,q,r;if(c.grid){r=a(c).jqGrid("getInd",d,true);if(r!==false){m= a(r).attr("editable");b=b?b:c.p.editurl;if(m==="1"){var u;a("td",r).each(function(C){u=c.p.colModel[C];k=u.name;if(k!="cb"&&k!="subgrid"&&u.editable===true&&k!="rn"){switch(u.edittype){case "checkbox":var E=["Yes","No"];if(u.editoptions)E=u.editoptions.value.split(":");l[k]=a("input",this).attr("checked")?E[0]:E[1];break;case "text":case "password":case "textarea":case "button":l[k]=a("input, textarea",this).val();break;case "select":if(u.editoptions.multiple){E=a("select",this);var y=[];l[k]=a(E).val(); l[k]=l[k]?l[k].join(","):"";a("select > option:selected",this).each(function(A,L){y[A]=a(L).text()});n[k]=y.join(",")}else{l[k]=a("select>option:selected",this).val();n[k]=a("select>option:selected",this).text()}if(u.formatter&&u.formatter=="select")n={};break;case "custom":try{if(u.editoptions&&a.isFunction(u.editoptions.custom_value)){l[k]=u.editoptions.custom_value(a(".customelement",this),"get");if(l[k]===undefined)throw"e2";}else throw"e1";}catch(x){x=="e1"&&info_dialog(jQuery.jgrid.errors.errcap, "function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);x=="e2"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,x.message,jQuery.jgrid.edit.bClose)}break}q=checkValues(l[k],C,c);if(q[0]===false){q[1]=l[k]+" "+q[1];return false}if(c.p.autoencode)l[k]=a.jgrid.htmlEncode(l[k])}});if(q[0]===false)try{var w=findPos(a("#"+d)[0]);info_dialog(a.jgrid.errors.errcap,q[1],a.jgrid.edit.bClose, {left:w[0],top:w[1]})}catch(z){alert(q[1])}else{if(l){var v;w=c.p.prmNames;v=w.oper;m=w.id;l[v]=w.editoper;l[m]=d;if(typeof c.p.inlineData=="undefined")c.p.inlineData={};if(typeof f=="undefined")f={};l=a.extend({},l,c.p.inlineData,f)}if(b=="clientArray"){l=a.extend({},l,n);c.p.autoencode&&a.each(l,function(C,E){l[C]=a.jgrid.htmlDecode(E)});m=a(c).jqGrid("setRowData",d,l);a(r).attr("editable","0");for(w=0;w=0&&c.p.savedRow.splice(o,1); a.isFunction(g)&&g(d,m)}else{a("#lui_"+c.p.id).show();if(c.p.restful){mtype="PUT";b=b+"/"+d}else mtype="POST";a.ajax(a.extend({url:b,data:a.isFunction(c.p.serializeRowData)?c.p.serializeRowData(l):l,type:mtype,complete:function(C,E){a("#lui_"+c.p.id).hide();if(E==="success")if((a.isFunction(e)?e(C):true)===true){c.p.autoencode&&a.each(l,function(y,x){l[y]=a.jgrid.htmlDecode(x)});l=a.extend({},l,n);a(c).jqGrid("setRowData",d,l);a(r).attr("editable","0");for(E=0;E=0&&c.p.savedRow.splice(o,1);a.isFunction(g)&&g(d,C)}else a(c).jqGrid("restoreRow",d,j)},error:function(C,E){a("#lui_"+c.p.id).hide();a.isFunction(h)?h(d,C,E):alert("Error Row: "+d+" Result: "+C.status+":"+C.statusText+" Status: "+E)}},a.jgrid.ajaxOptions,c.p.ajaxRowOptions||{}))}a(r).unbind("keydown")}}}}})},restoreRow:function(d,e){return this.each(function(){var b=this,f,g,h={};if(b.grid){g=a(b).jqGrid("getInd",d,true);if(g!==false){for(var j=0;j=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+g.id).datepicker("hide")}catch(c){}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",d,h);a(g).attr("editable","0").unbind("keydown");b.p.savedRow.splice(f,1)}a.isFunction(e)&&e(d)}}})}})})(jQuery); (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"};if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var d=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(e,b){e=d.call(this,e,b);if(b&&this.selectedList){var f=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(f)})}return e}}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.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,c){c.height(j.currentItem.innerHeight()-parseInt(j.currentItem.css("paddingTop")||0,10)-parseInt(j.currentItem.css("paddingBottom")||0,10));c.width(j.currentItem.innerWidth()-parseInt(j.currentItem.css("paddingLeft")||0,10)-parseInt(j.currentItem.css("paddingRight")||0,10))}},update:function(j,c){j=a(c.item).parent();j=a(">th",j);var k={};a.each(f.p.colModel,function(n){k[this.name]=n});var l=[]; j.each(function(){var n=a(">div",this).get(0).id.replace(/^jqgh_/,"");n in k&&l.push(k[n])});a(f).jqGrid("remapColumns",l,true,true);a.isFunction(f.p.sortable.update)&&f.p.sortable.update(l);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,c){b();h.call(this,j,c)}}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(o,q,r){if(q>=0){var u=o.slice(),w=u.splice(q,Math.max(o.length-q,q));if(q>o.length)q=o.length;u[q]=r;return u.concat(w)}}function f(o,q){if(o)if(typeof o=="string")a.fn[o]&&a.fn[o].apply(q,a.makeArray(arguments).slice(2));else a.isFunction(o)&&o.apply(q,a.makeArray(arguments).slice(2))}var g=this;if(!a("#colchooser_"+g[0].p.id).length){var h=a('
'), j=a("select",h);e=a.extend({width:420,height:240,classname:null,done:function(o){o&&g.jqGrid("remapColumns",o,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(o){var q={};q[o.bSubmit]=function(){o.apply_perm();o.cleanup(false)};q[o.bCancel]=function(){o.cleanup(true)};return{buttons:q,close:function(){o.cleanup(true)},modal:false,resizable:false,width:o.width+20}},apply_perm:function(){a("option",j).each(function(){this.selected?g.jqGrid("showCol",c[this.value].name):g.jqGrid("hideCol", c[this.value].name)});var o=[];a("option[selected]",j).each(function(){o.push(parseInt(this.value,10))});a.each(o,function(){delete l[c[parseInt(this,10)].name]});a.each(l,function(){var q=parseInt(this,10);o=b(o,q,q)});e.done&&e.done.call(g,o)},cleanup:function(o){f(e.dlog,h,"destroy");f(e.msel,j,"destroy");h.remove();o&&e.done&&e.done.call(g)},msel_opts:{}},a.jgrid.col,e||{});if(a.ui)if(a.ui.multiselect)e.msel_opts=a.extend(a.ui.multiselect.defaults,e.msel_opts);e.caption&&h.attr("title",e.caption); if(e.classname){h.addClass(e.classname);j.addClass(e.classname)}if(e.width){a(">div",h).css({width:e.width,margin:"0 auto"});j.css("width",e.width)}if(e.height){a(">div",h).css("height",e.height);j.css("height",e.height-10)}var c=g.jqGrid("getGridParam","colModel"),k=g.jqGrid("getGridParam","colNames"),l={},n=[];j.empty();a.each(c,function(o){l[this.name]=o;if(this.hidedlg)this.hidden||n.push(o);else j.append("")}); var m=a.isFunction(e.dlog_opts)?e.dlog_opts.call(g,e):e.dlog_opts;f(e.dlog,h,m);m=a.isFunction(e.msel_opts)?e.msel_opts.call(g,e):e.msel_opts;f(e.msel,j,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(c){this.style.width=b.grid.cols[c].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.updateColumns();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, c){if(f.p.subGrid){var k=a(c.helper).attr("id");try{a(f).jqGrid("collapseSubGridRow",k)}catch(l){}}for(k=0;k";k+="";for(i=0;i");k+="
";k+="
"+(!d.updateAfterCheck?""+d.bSubmit+"":"")+" "+(""+ d.bCancel+"")+"
";d.gbox="#gbox_"+h;createModal(c,k,d,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);if(d.saveicon[0]==true)a("#dData","#"+j+"_2").addClass(d.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(d.closeicon[0]==true)a("#eData","#"+j+"_2").addClass(d.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");d.updateAfterCheck? a(":input","#"+j).click(function(){var l=this.id.substr(4);if(l){this.checked?a(e).jqGrid("showCol",l):a(e).jqGrid("hideCol",l);d.ShrinkToFit===true&&a(e).jqGrid("setGridWidth",e.grid.width-0.0010,true)}return this}):a("#dData","#"+j+"_2").click(function(){for(i=0;i":'"},addSubGrid:function(d,e){return this.each(function(){var b=this;if(b.grid){var f,g,h,j,c,k,l;a("td:eq("+e+")",d).click(function(){if(a(this).hasClass("sgcollapsed")){h=b.p.id;f=a(this).parent(); j=e>=1?" ":"";g=a(f).attr("id");l=true;if(a.isFunction(b.p.subGridBeforeExpand))l=b.p.subGridBeforeExpand(h+"_"+g,g);if(l===false)return false;c=0;a.each(b.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name=="cb")c++});k=""+j+"
";a(this).parent().after(k+"
");a.isFunction(b.p.subGridRowExpanded)?b.p.subGridRowExpanded(h+"_"+g,g):n(f);a(this).html("").removeClass("sgcollapsed").addClass("sgexpanded")}else if(a(this).hasClass("sgexpanded")){l=true;if(a.isFunction(b.p.subGridRowColapsed)){f=a(this).parent();g=a(f).attr("id");l=b.p.subGridRowColapsed(h+"_"+g,g)}if(l===false)return false;a(this).parent().next().remove(".ui-subgrid"); a(this).html("").removeClass("sgexpanded").addClass("sgcollapsed")}return false});var n=function(r){var u,w,z,v;u=a(r).attr("id");w={nd_:(new Date).getTime()};w[b.p.prmNames.subgridid]=u;if(!b.p.subGridModel[0])return false;if(b.p.subGridModel[0].params)for(v=0;v").html(u);a(r).append(u)},o=function(r,u){var w,z,v,C=a("
"),E=a("");for(z=0;z");a(w).html(b.p.subGridModel[0].name[z]); a(w).width(b.p.subGridModel[0].width[z]);a(E).append(w)}a(C).append(E);if(r){v=b.p.xmlReader.subgrid;a(v.root+" "+v.row,r).each(function(){E=a("");if(v.repeatitems===true)a(v.cell,this).each(function(x){m(E,a(this).text()||" ",x)});else{var y=b.p.subGridModel[0].mapping||b.p.subGridModel[0].name;if(y)for(z=0;z"),y=a("");for(z=0;z");a(w).html(b.p.subGridModel[0].name[z]);a(w).width(b.p.subGridModel[0].width[z]);a(y).append(w)}a(E).append(y);if(r){w=b.p.jsonReader.subgrid;r=r[w.root];if(typeof r!=="undefined")for(z=0;z< r.length;z++){v=r[z];y=a("");if(w.repeatitems===true){if(w.cell)v=v[w.cell];for(C=0;C0,h=!g&&f.length>0,j=g||h;b=b.attr("name")||f.attr("name");var c=[],k=[];jQuery("th",jQuery(this)).each(function(){if(c.length===0&&j){c.push({name:"__selection__",index:"__selection__",width:0,hidden:true});k.push("__selection__")}else{c.push({name:jQuery(this).attr("id")|| jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150});k.push(jQuery(this).html())}});var l=[],n=[],m=[];jQuery("tbody > tr",jQuery(this)).each(function(){var o={},q=0;jQuery("td",jQuery(this)).each(function(){if(q===0&&j){var r=jQuery("input",jQuery(this)),u=r.attr("value");n.push(u||l.length);r.attr("checked")&&m.push(u);o[c[q].name]= r.attr("value")}else o[c[q].name]=jQuery(this).html();q++});q>0&&l.push(o)});jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid($.extend({datatype:"local",width:e,colNames:k,colModel:c,multiselect:g},d||{}));for(e=0;e0)if((g=n[e])&&g.replace)g=encodeURIComponent(g).replace(/[.\-%]/g,"_");if(g===null)g=e+1;jQuery(this).jqGrid("addRowData",g,l[e])}for(e=0;e";k+="
";if(parseInt(d[j],10)!==parseInt(b.p.tree_root_level, 10))a(b).jqGrid("isVisibleNode",e)||a(e).css("display","none");a("td:eq("+f+")",e).wrapInner("").prepend(k);a(".treeclick",e).bind("click",function(l){l=a(l.target||l.srcElement,b.rows).parents("tr.jqgrow")[0].rowIndex;if(!b.rows[l].isLeaf)if(b.rows[l].expanded){a(b).jqGrid("collapseRow",b.rows[l]);a(b).jqGrid("collapseNode",b.rows[l])}else{a(b).jqGrid("expandRow",b.rows[l]);a(b).jqGrid("expandNode",b.rows[l])}return false});b.p.ExpandColClick===true&&a("span",e).css("cursor","pointer").bind("click", function(l){l=a(l.target||l.srcElement,b.rows).parents("tr.jqgrow")[0].rowIndex;if(!b.rows[l].isLeaf)if(b.rows[l].expanded){a(b).jqGrid("collapseRow",b.rows[l]);a(b).jqGrid("collapseNode",b.rows[l])}else{a(b).jqGrid("expandRow",b.rows[l]);a(b).jqGrid("expandNode",b.rows[l])}a(b).jqGrid("setSelection",b.rows[l].id);return false})}})},setTreeGrid:function(){return this.each(function(){var d=this,e=0;if(d.p.treeGrid){d.p.treedatatype||a.extend(d.p,{treedatatype:d.p.datatype});d.p.subGrid=false;d.p.altRows= false;d.p.pgbuttons=false;d.p.pginput=false;d.p.multiselect=false;d.p.rowList=[];d.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+(d.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},d.p.treeIcons||{});if(d.p.treeGridModel=="nested")d.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded"},d.p.treeReader);else if(d.p.treeGridModel=="adjacency")d.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent", leaf_field:"isLeaf",expanded_field:"expanded"},d.p.treeReader);for(var b in d.p.colModel)if(d.p.colModel.hasOwnProperty(b)){if(d.p.colModel[b].name==d.p.ExpandColumn){d.p.expColInd=e;break}e++}if(!d.p.expColInd)d.p.expColInd=0;a.each(d.p.treeReader,function(f,g){if(g){d.p.colNames.push(g);d.p.colModel.push({name:g,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(d){this.each(function(){var e=this;if(e.grid&&e.p.treeGrid){var b= a(e).jqGrid("getNodeChildren",d);a(b).each(function(){a(this).css("display","");this.expanded&&a(e).jqGrid("expandRow",this)})}})},collapseRow:function(d){this.each(function(){var e=this;if(e.grid&&e.p.treeGrid){var b=a(e).jqGrid("getNodeChildren",d);a(b).each(function(){a(this).css("display","none");this.expanded&&a(e).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var d=[];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.rows).each(function(){parseInt(this[b],10)===parseInt(e.p.tree_root_level,10)&&d.push(this)});break;case "adjacency":a(e.rows).each(function(){if(this.parent_id===null||String(this.parent_id).toLowerCase()=="null")d.push(this)});break}});return d},getNodeDepth:function(d){var e=null;this.each(function(){var b=this;if(this.grid&&this.p.treeGrid)switch(b.p.treeGridModel){case "nested":e=parseInt(d.level,10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":e=a(b).jqGrid("getNodeAncestors", d).length;break}});return e},getNodeParent:function(d){var e=null;this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)switch(b.p.treeGridModel){case "nested":var f=parseInt(d.lft,10),g=parseInt(d.rgt,10),h=parseInt(d.level,10);a(this.rows).each(function(){if(parseInt(this.level,10)===h-1&&parseInt(this.lft,10)g){e=this;return false}});break;case "adjacency":a(this.rows).each(function(){if(this.id==d.parent_id){e=this;return false}});break}});return e},getNodeChildren:function(d){var e= [];this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)switch(b.p.treeGridModel){case "nested":var f=parseInt(d.lft,10),g=parseInt(d.rgt,10),h=parseInt(d.level,10);a(this.rows).each(function(){parseInt(this.level,10)===h+1&&parseInt(this.lft,10)>f&&parseInt(this.rgt,10)=j&&parseInt(this.lft,10)>=g&&parseInt(this.lft,10)<=h&&e.push(this)});break;case "adjacency":e.push(d);a(this.rows).each(function(c){f=e.length;for(c=0;c0?true:false});return e},expandNode:function(d){return this.each(function(){if(this.grid&&this.p.treeGrid)if(!d.expanded)if(a(this).jqGrid("isNodeLoaded", d)){d.expanded=true;a("div.treeclick",d).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{d.expanded=true;a("div.treeclick",d).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=d.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:d.id,n_left:d.lft,n_right:d.rgt,n_level:d.level}}):a(this).jqGrid("setGridParam",{postData:{nodeid:d.id, parentid:d.parent_id,n_level:d.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(d){return this.each(function(){if(this.grid&&this.p.treeGrid)if(d.expanded){d.expanded=false;a("div.treeclick",d).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})}, SortTree:function(d){return this.each(function(){if(this.grid&&this.p.treeGrid){var e,b,f,g=[],h=this,j=a(this).jqGrid("getRootNodes");j.sort(function(c,k){if(c.sortKeyk.sortKey)return d;return 0});if(j[0]){a("td",j[0]).each(function(c){a(this).css("width",h.grid.headers[c].width+"px")});h.grid.cols=j[0].cells}e=0;for(b=j.length;ek.sortKey)return b;return 0});f=0;for(g=j.length;f0)for(var g=0;g0?u:3E3;var w=a("
").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":u-1,opacity:q.overlay/100});if(o.a)return g;o.t=m;o.a=true;o.w.css("z-index",u);if(q.modal){b[0]|| setTimeout(function(){c("bind")},1);b.push(n)}else if(q.overlay>0)q.closeoverlay&&o.w.jqmAddClose(w);else w=g;o.o=w?w.addClass(q.overlayClass).prependTo("body"):g;if(f){a("html,body").css({height:"100%",width:"100%"});if(w){w=w.css({position:"absolute"})[0];for(var z in{Top:1,Left:1})w.style.setExpression(z.toLowerCase(),"(_=(document.documentElement.scroll"+z+" || document.body.scroll"+z+"))+'px'")}}if(q.ajax){n=q.target||o.w;u=q.ajax;n=typeof n=="string"?a(n,o.w):a(n);u=u.substr(0,1)=="@"?a(m).attr(u.substring(1)): u;n.html(q.ajaxText).load(u,function(){q.onLoad&&q.onLoad.call(this,o);r&&o.w.jqmAddClose(a(r,o.w));h(o)})}else r&&o.w.jqmAddClose(a(r,o.w));q.toTop&&o.o&&o.w.before('').insertAfter(o.o);q.onShow?q.onShow(o):o.w.show();h(o);return g},close:function(n){n=e[n];if(!n.a)return g;n.a=g;if(b[0]){b.pop();b[0]||c("unbind")}n.c.toTop&&n.o&&a("#jqmP"+n.w[0]._jqm).after(n.w).remove();if(n.c.onHide)n.c.onHide(n);else{n.w.hide();n.o&&n.o.remove()}return g},params:{}};var d= 0,e=a.jqm.hash,b=[],f=a.browser.msie&&a.browser.version=="6.0",g=false,h=function(n){var m=a('').css({opacity:0});if(f)if(n.o)n.o.html('

').prepend(m);else a("iframe.jqm",n.w)[0]||n.w.prepend(m);j(n)},j=function(n){try{a(":input:visible",n.w)[0].focus()}catch(m){}},c=function(n){a(document)[n]("keypress",k)[n]("keydown",k)[n]("mousedown",k)},k=function(n){var m=e[b[b.length-1]];(n=!a(n.target).parents(".jqmID"+ m.s)[0])&&j(m);return!n},l=function(n,m,o){return n.each(function(){var q=this._jqm;a(m).each(function(){if(!this[o]){this[o]=[];a(this).click(function(){for(var r in{jqmShow:1,jqmHide:1})for(var u in this[r])e[this[r][u]]&&e[this[r][u]].w[r](this);return g})}this[o].push(q)})})}})(jQuery); (function(a){function d(e,b,f,g,h){var j=b;if(a.fn.fmatter[e])j=a.fn.fmatter[e](b,f,g,h);return j}a.fmatter={};a.fn.fmatter=function(e,b,f,g,h){f=a.extend({},a.jgrid.formatter,f);return d(e,b,f,g,h)};a.fmatter.util={NumberFormat:function(e,b){isNumber(e)||(e*=1);if(isNumber(e)){var f=e<0,g=e+"",h=b.decimalSeparator?b.decimalSeparator:".";if(isNumber(b.decimalPlaces)){var j=b.decimalPlaces;g=Math.pow(10,j);g=Math.round(e*g)/g+"";e=g.lastIndexOf(".");if(j>0){if(e<0){g+=h;e=g.length-1}else if(h!==".")g= g.replace(".",h);for(;g.length-1-e-1?e:g.length;h=g.substring(e);for(var c=-1,k=e;k>0;k--){c++;if(c%3===0&&k!==e&&(!f||k>1))h=j+h;h=g.charAt(k-1)+h}g=h}g=b.prefix?b.prefix+g:g;return g=b.suffix?g+b.suffix:g}else return e},DateFormat:function(e,b,f,g){var h=function(v,C){v=String(v);for(C=parseInt(C,10)||2;v.length11)b[k]=c+1-12}j[e[k].toLowerCase()]=parseInt(b[k],10)}j.m=parseInt(j.m,10)-1;c=j.y;if(c>=70&&c<=99)j.y=1900+j.y;else if(c>=0&&c<=69)j.y=2E3+j.y;c=new Date(j.y,j.m,j.d,j.h,j.i,j.s,j.u);if(f in g.masks)f=g.masks[f];else f|| (f="Y-m-d");j=c.getHours();e=c.getMinutes();b=c.getDate();k=c.getMonth()+1;l=c.getTimezoneOffset();var m=c.getSeconds(),o=c.getMilliseconds(),q=c.getDay(),r=c.getFullYear(),u=(q+6)%7+1,w=(new Date(r,k-1,b)-new Date(r,0,1))/864E5,z={d:h(b),D:n.i18n.dayNames[q],j:b,l:n.i18n.dayNames[q+7],N:u,S:g.S(b),w:q,z:w,W:u<5?Math.floor((w+u-1)/7)+1:Math.floor((w+u-1)/7)||(((new Date(r-1,0,1)).getDay()+6)%7<4?53:52),F:n.i18n.monthNames[k-1+12],m:h(k),M:n.i18n.monthNames[k-1],n:k,t:"?",L:"?",o:"?",Y:r,y:String(r).substring(2), a:j<12?g.AmPm[0]:g.AmPm[1],A:j<12?g.AmPm[2]:g.AmPm[3],B:"?",g:j%12||12,G:j,h:h(j%12||12),H:h(j),i:h(e),s:h(m),u:o,e:"?",I:"?",O:(l>0?"-":"+")+h(Math.floor(Math.abs(l)/60)*100+Math.abs(l)%60,4),P:"?",T:(String(c).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(c/1E3)};return f.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(v){return v in z?z[v]:v.substring(1)})}};a.fn.fmatter.defaultFormat=function(e,b){return isValue(e)&&e!==""?e:b.defaultValue?b.defaultValue:" "};a.fn.fmatter.email=function(e,b){return isEmpty(e)?a.fn.fmatter.defaultFormat(e,b):''+e+""};a.fn.fmatter.checkbox=function(e,b){var f=a.extend({},b.checkbox);isUndefined(b.colModel.formatoptions)||(f=a.extend({},f,b.colModel.formatoptions));b=f.disabled===true?"disabled":"";if(isEmpty(e)||isUndefined(e))e=a.fn.fmatter.defaultFormat(e,f); e+="";e=e.toLowerCase();return'"};a.fn.fmatter.link=function(e,b){var f={target:b.target},g="";isUndefined(b.colModel.formatoptions)||(f=a.extend({},f,b.colModel.formatoptions));if(f.target)g="target="+f.target;return isEmpty(e)?a.fn.fmatter.defaultFormat(e,b):"'+e+""};a.fn.fmatter.showlink=function(e,b){var f={baseLinkUrl:b.baseLinkUrl,showAction:b.showAction, addParam:b.addParam||"",target:b.target,idName:b.idName},g="";isUndefined(b.colModel.formatoptions)||(f=a.extend({},f,b.colModel.formatoptions));if(f.target)g="target="+f.target;f=f.baseLinkUrl+f.showAction+"?"+f.idName+"="+b.rowId+f.addParam;return isString(e)?"'+e+"":a.fn.fmatter.defaultFormat(e,b)};a.fn.fmatter.integer=function(e,b){var f=a.extend({},b.integer);isUndefined(b.colModel.formatoptions)||(f=a.extend({},f,b.colModel.formatoptions));if(isEmpty(e))return f.defaultValue; return a.fmatter.util.NumberFormat(e,f)};a.fn.fmatter.number=function(e,b){var f=a.extend({},b.number);isUndefined(b.colModel.formatoptions)||(f=a.extend({},f,b.colModel.formatoptions));if(isEmpty(e))return f.defaultValue;return a.fmatter.util.NumberFormat(e,f)};a.fn.fmatter.currency=function(e,b){var f=a.extend({},b.currency);isUndefined(b.colModel.formatoptions)||(f=a.extend({},f,b.colModel.formatoptions));if(isEmpty(e))return f.defaultValue;return a.fmatter.util.NumberFormat(e,f)};a.fn.fmatter.date= function(e,b,f,g){f=a.extend({},b.date);isUndefined(b.colModel.formatoptions)||(f=a.extend({},f,b.colModel.formatoptions));return!f.reformatAfterEdit&&g=="edit"?a.fn.fmatter.defaultFormat(e,b):isEmpty(e)?a.fn.fmatter.defaultFormat(e,b):a.fmatter.util.DateFormat(f.srcformat,e,f.newformat,f)};a.fn.fmatter.select=function(e,b){e+="";var f=false,g=[];if(!isUndefined(b.colModel.editoptions))f=b.colModel.editoptions.value;if(f){var h=b.colModel.editoptions.multiple===true?true:false,j=[],c;if(h){j=e.split(","); j=a.map(j,function(m){return a.trim(m)})}if(isString(f))for(var k=f.split(";"),l=0,n=0;n2)c[1]=jQuery.map(c,function(m,o){if(o>0)return m}).join(":");if(h){if(jQuery.inArray(c[0],j)>-1){g[l]=c[1];l++}}else if(a.trim(c[0])==a.trim(e)){g[0]=c[1];break}}else if(isObject(f))if(h)g=jQuery.map(j,function(m){return f[m]});else g[0]=f[e]||""}e=g.join(", ");return e==""?a.fn.fmatter.defaultFormat(e,b):e};a.fn.fmatter.rowactions=function(e,b,f,g){switch(f){case "edit":f= function(){a("tr#"+e+" div.ui-inline-edit, tr#"+e+" div.ui-inline-del","#"+b).show();a("tr#"+e+" div.ui-inline-save, tr#"+e+" div.ui-inline-cancel","#"+b).hide()};a("#"+b).jqGrid("editRow",e,g,null,null,null,{oper:"edit"},f,null,f);a("tr#"+e+" div.ui-inline-edit, tr#"+e+" div.ui-inline-del","#"+b).hide();a("tr#"+e+" div.ui-inline-save, tr#"+e+" div.ui-inline-cancel","#"+b).show();break;case "save":a("#"+b).jqGrid("saveRow",e,null,null);a("tr#"+e+" div.ui-inline-edit, tr#"+e+" div.ui-inline-del","#"+ b).show();a("tr#"+e+" div.ui-inline-save, tr#"+e+" div.ui-inline-cancel","#"+b).hide();break;case "cancel":a("#"+b).jqGrid("restoreRow",e);a("tr#"+e+" div.ui-inline-edit, tr#"+e+" div.ui-inline-del","#"+b).show();a("tr#"+e+" div.ui-inline-save, tr#"+e+" div.ui-inline-cancel","#"+b).hide();break}};a.fn.fmatter.actions=function(e,b){e={keys:false,editbutton:true,delbutton:true};isUndefined(b.colModel.formatoptions)||(e=a.extend(e,b.colModel.formatoptions));var f=b.rowId,g="",h;if(typeof f=="undefined"|| isEmpty(f))return"";if(e.editbutton){h="onclick=$.fn.fmatter.rowactions('"+f+"','"+b.gid+"','edit',"+e.keys+");";g=g+"

"}if(e.delbutton){h="onclick=jQuery('#"+b.gid+"').jqGrid('delGridRow','"+f+"');";g=g+"
"}h="onclick=$.fn.fmatter.rowactions('"+f+"','"+b.gid+"','save',false);";g=g+"";h="onclick=$.fn.fmatter.rowactions('"+f+"','"+b.gid+"','cancel',false);";return g=g+"
"};a.unformat=function(e,b,f,g){var h,j=b.colModel.formatter,c=b.colModel.formatoptions||{},k=/([\.\*\_\'\(\)\{\}\+\?\\])/g;unformatFunc=b.colModel.unformat||a.fn.fmatter[j]&&a.fn.fmatter[j].unformat;if(typeof unformatFunc!=="undefined"&&isFunction(unformatFunc))h=unformatFunc(a(e).text(),b,e);else if(typeof j!=="undefined"&&isString(j)){h=a.jgrid.formatter||{};switch(j){case "integer":c=a.extend({},h.integer,c);b=c.thousandsSeparator.replace(k,"\\$1");b=new RegExp(b,"g");h= a(e).text().replace(b,"");break;case "number":c=a.extend({},h.number,c);b=c.thousandsSeparator.replace(k,"\\$1");b=new RegExp(b,"g");h=a(e).text().replace(b,"").replace(c.decimalSeparator,".");break;case "currency":c=a.extend({},h.currency,c);b=c.thousandsSeparator.replace(k,"\\$1");b=new RegExp(b,"g");h=a(e).text().replace(b,"").replace(c.decimalSeparator,".").replace(c.prefix,"").replace(c.suffix,"");break;case "checkbox":c=b.colModel.editoptions?b.colModel.editoptions.value.split(":"):["Yes","No"]; h=a("input",e).attr("checked")?c[0]:c[1];break;case "select":h=a.unformat.select(e,b,f,g);break;case "actions":return"";default:h=a(e).text()}}return h?h:g===true?a(e).text():a.jgrid.htmlDecode(a(e).html())};a.unformat.select=function(e,b,f,g){f=[];e=a(e).text();if(g===true)return e;b=a.extend({},b.colModel.editoptions);if(b.value){var h=b.value;b=b.multiple===true?true:false;g=[];var j;if(b){g=e.split(",");g=a.map(g,function(n){return a.trim(n)})}if(isString(h))for(var c=h.split(";"),k=0,l=0;l-1){f[k]=j[0];k++}}else if(a.trim(j[1])==a.trim(e)){f[0]=j[0];break}}else if(isObject(h)){b||(g[0]=e);f=jQuery.map(g,function(n){var m;a.each(h,function(o,q){if(q==n){m=o;return false}});if(m)return m})}return f.join(", ")}else return e||""};isValue=function(e){return isObject(e)||isString(e)||isNumber(e)||isBoolean(e)};isBoolean=function(e){return typeof e==="boolean"};isNull=function(e){return e===null};isNumber=function(e){return typeof e==="number"&& isFinite(e)};isString=function(e){return typeof e==="string"};isEmpty=function(e){if(!isString(e)&&isValue(e))return false;else if(!isValue(e))return true;e=a.trim(e).replace(/\ \;/ig,"").replace(/\ \;/ig,"");return e===""};isUndefined=function(e){return typeof e==="undefined"};isObject=function(e){return e&&(typeof e==="object"||isFunction(e))||false};isFunction=function(e){return typeof e==="function"}})(jQuery); jQuery.fn.searchFilter=function(a,d){function e(b,f,g){this.$=b;this.add=function(y){y==null?b.find(".ui-add-last").click():b.find(".sf:eq("+y+") .ui-add").click();return this};this.del=function(y){y==null?b.find(".sf:last .ui-del").click():b.find(".sf:eq("+y+") .ui-del").click();return this};this.search=function(){b.find(".ui-search").click();return this};this.reset=function(){b.find(".ui-reset").click();return this};this.close=function(){b.find(".ui-closer").click();return this};if(f!=null){function h(){jQuery(this).toggleClass("ui-state-hover"); return false}function j(y){jQuery(this).toggleClass("ui-state-active",y.type=="mousedown");return false}function c(y,x){return""}function k(y,x,A){return""}function l(y,x){y=b.find("tr.sf td.data "+y);y[0]!=null&&x(y)}function n(y,x){var A=b.find("tr.sf td.data "+y);A[0]!=null&&jQuery.each(x,function(){this.data!=null?A.bind(this.type,this.data,this.fn):A.bind(this.type,this.fn)})}var m=jQuery.extend({}, jQuery.fn.searchFilter.defaults,g),o=-1,q="";jQuery.each(m.groupOps,function(){q+=c(this.op,this.text)});q="";b.html("").addClass("ui-searchFilter").append("
 
"+ m.windowTitle+"
 
"+ m.resetText+""+m.searchText+""+m.matchText+" "+q+" "+m.rulesText+" 
"); g=b.find("tr.sf");var r=g.find("td.fields"),u=g.find("td.ops"),w=g.find("td.data"),z="";jQuery.each(m.operators,function(){z+=c(this.op,this.text)});z=k("default",z,true);u.append(z);w.append("");var v="",C=false,E=false;jQuery.each(f,function(y){v+=c(this.itemval,this.text);if(this.ops!=null){C=true;var x="";jQuery.each(this.ops,function(){x+=c(this.op,this.text)});x=k("field"+y,x,true);u.append(x)}if(this.dataUrl!=null){if(y>o)o=y;E=true; var A=this.dataEvents,L=this.dataInit,R=this.buildSelect;jQuery.ajax(jQuery.extend({url:this.dataUrl,complete:function(M){M=R!=null?jQuery("
").append(R(M)):jQuery("
").append(M.responseText);M.find("select").addClass("field"+y).hide();w.append(M.html());L&&l(".field"+y,L);A&&n(".field"+y,A);y==o&&b.find("tr.sf td.fields select[name='field']").change()}},m.ajaxSelectOptions))}else if(this.dataValues!=null){E=true;var aa="";jQuery.each(this.dataValues,function(){aa+=c(this.value,this.text)}); aa=k("field"+y,aa,true);w.append(aa)}else if(this.dataEvents!=null||this.dataInit!=null){E=true;aa="";w.append(aa)}this.dataInit!=null&&y!=o&&l(".field"+y,this.dataInit);this.dataEvents!=null&&y!=o&&n(".field"+y,this.dataEvents)});v="";r.append(v);f=r.find("select[name='field']");C?f.change(function(y){var x=y.target.selectedIndex;y=jQuery(y.target).parents("tr.sf").find("td.ops");y.find("select").removeAttr("name").hide(); x=y.find(".field"+x);if(x[0]==null)x=y.find(".default");x.attr("name","op").show()}):u.find(".default").attr("name","op").show();E?f.change(function(y){var x=y.target.selectedIndex;y=jQuery(y.target).parents("tr.sf").find("td.data");y.find("select,input").removeClass("vdata").hide();x=y.find(".field"+x);if(x[0]==null)x=y.find(".default");x.show().addClass("vdata")}):w.find(".default").show().addClass("vdata");if(C||E)f.change();b.find(".ui-state-default").hover(h,h).mousedown(j).mouseup(j);b.find(".ui-closer").click(function(){m.onClose(jQuery(b.selector)); return false});b.find(".ui-del").click(function(y){y=jQuery(y.target).parents(".sf");if(y.siblings(".sf").length>0){m.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&y.find(".hasDatepicker").datepicker("destroy");y.remove()}else{y.find("select[name='field']")[0].selectedIndex=0;y.find("select[name='op']")[0].selectedIndex=0;y.find(".data input").val("");y.find(".data select").each(function(){this.selectedIndex=0});y.find("select[name='field']").change()}return false});b.find(".ui-add").click(function(y){y= jQuery(y.target).parents(".sf");var x=y.clone(true).insertAfter(y);x.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");if(m.clone){x.find("select[name='field']")[0].selectedIndex=y.find("select[name='field']")[0].selectedIndex;if(x.find("select[name='op']")[0]!=null)x.find("select[name='op']").focus()[0].selectedIndex=y.find("select[name='op']")[0].selectedIndex;var A=x.find("select.vdata");if(A[0]!=null)A[0].selectedIndex=y.find("select.vdata")[0].selectedIndex}else{x.find(".data input").val(""); x.find("select[name='field']").focus()}m.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&y.find(".hasDatepicker").each(function(){var L=jQuery.data(this,"datepicker").settings;x.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(L)});x.find("select[name='field']").change();return false});b.find(".ui-search").click(function(){var y=jQuery(b.selector),x,A=y.find("select[name='groupOp'] :selected").val();x=m.stringResult?'{"groupOp":"'+A+'","rules":[':{groupOp:A, rules:[]};y.find(".sf").each(function(L){var R=jQuery(this).find("select[name='field'] :selected").val(),aa=jQuery(this).find("select[name='op'] :selected").val(),M=jQuery(this).find("input.vdata,select.vdata :selected").val();M+="";M=M.replace(/\\/g,"\\\\").replace(/\"/g,'\\"');if(m.stringResult){if(L>0)x+=",";x+='{"field":"'+R+'",';x+='"op":"'+aa+'",';x+='"data":"'+M+'"}'}else x.rules.push({field:R,op:aa,data:M})});if(m.stringResult)x+="]}";m.onSearch(x);return false});b.find(".ui-reset").click(function(){var y= jQuery(b.selector);y.find(".ui-del").click();y.find("select[name='groupOp']")[0].selectedIndex=0;m.onReset();return false});b.find(".ui-add-last").click(function(){var y=jQuery(b.selector+" .sf:last"),x=y.clone(true).insertAfter(y);x.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");x.find(".data input").val("");x.find("select[name='field']").focus();m.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&y.find(".hasDatepicker").each(function(){var A=jQuery.data(this,"datepicker").settings; x.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(A)});x.find("select[name='field']").change();return false});this.setGroupOp=function(y){selDOMobj=this.$.find("select[name='groupOp']")[0];var x={},A=selDOMobj.options.length,L;for(L=0;L select[class='field"+R+"']")[0])for(var M=0,Z=selDOMobj.options.length;M select[class='field"+R+"']")[0]){L[A[R]].data={};M=0;for(Z=selDOMobj.options.length;M__EMPTY_ARRAY_\n";else{k=0;for(l=g.length;k":"/>";if(k){for(l in g)if(g.hasOwnProperty(l))if(l==="#text")c+=g[l];else if(l==="#cdata")c+="";else if(l.charAt(0)!=="@")c+=e(g[l],l,j+"\t");c+=(c.charAt(c.length-1)==="\n"?j:"")+""}}else c+=typeof g==="function"?j+"<"+h+">":g.toString()==='""'||g.toString().length===0?j+"<"+h+">__EMPTY_STRING_":j+"<"+h+">"+g.toString()+"";return c},b="",f;for(f in a)if(a.hasOwnProperty(f))b+= e(a[f],f,"");return d?b.replace(/\t/g,d):b.replace(/\t|\n/g,"")},toObj:function(a){var d={},e=/function/i;if(a.nodeType===1){if(a.attributes.length){var b;for(b=0;b1)d=this.escape(this.innerXml(a));else for(h=a.firstChild;h;h=h.nextSibling)if(e.test(a.firstChild.nodeValue)){d=a.firstChild.nodeValue;break}else d["#cdata"]=this.escape(h.nodeValue)}if(!a.attributes.length&&!a.firstChild)d=null}else if(a.nodeType===9)d=this.toObj(a.documentElement);else alert("unhandled node type: "+ a.nodeType);return d},toJson:function(a,d,e){var b=d?'"'+d+'"':"";if(a==="[]")b+=d?":[]":"[]";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+=(d&&":")+"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+=(d?":{":"{")+(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"?(d&&":")+f:(d&&":")+'"'+a+'"'}else b+=(d&&":")+a.toString();return b},innerXml:function(a){var d="";if("innerHTML"in a)d=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)d+=e(a)}return d},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var d;for(d=a.firstChild;d;)if(d.nodeType===3)if(d.nodeValue.match(/[^ \f\n\r\t\v]/))d=d.nextSibling;else{var e=d.nextSibling;a.removeChild(d); d=e}else{d.nodeType===1&&this.removeWhite(d);d=d.nextSibling}return a}}; 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 d= 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);d.onDragStart&&d.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);d.onDragStart&&d.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,d){d=d||window.event; a=this.getPosition(a);d=this.mouseCoords(d);return{x:d.x-a.x,y:d.y-a.y}},getPosition:function(a){var d=0,e=0;if(a.offsetHeight==0)a=a.firstChild;if(a&&a.offsetParent){for(;a.offsetParent;){d+=a.offsetLeft;e+=a.offsetTop;a=a.offsetParent}d+=a.offsetLeft;e+=a.offsetTop}return{x:d,y:e}},mousemove:function(a){if(jQuery.tableDnD.dragObject!=null){var d=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?d.addClass(e.onDragClass):d.css(e.onDragStyle);if(d=jQuery.tableDnD.findDropTargetRow(d,a))if(b&&jQuery.tableDnD.dragObject!=d)jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,d.nextSibling);else!b&&jQuery.tableDnD.dragObject!=d&&jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,d)}return false}},findDropTargetRow:function(a,d){for(var e=jQuery.tableDnD.currentTable.rows,b=0;bg-h&&d0)d+="&";var g=b[f].id;if(g&&g&&a.tableDnDConfig&& a.tableDnDConfig.serializeRegexp)g=g.match(a.tableDnDConfig.serializeRegexp)[0];d+=e+"[]="+g}return d},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 d=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(){d.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(d.element)})},receive:function(e, b){b.item.data("optionLink").attr("selected",true);d.count+=1;d._updateCount();d.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"));d._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(){d._populateLists(d.element.find("option").removeAttr("selected")); return false});a(".add-all").click(function(){d._populateLists(d.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(d){this.selectedList.children(".ui-element").remove();this.availableList.children(".ui-element").remove();this.count=0;var e=this;a(d.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(d){d=a(d);var e=a('
  • '+d.text()+'
  • ').hide();e.data("optionLink",d);return e},_cloneWithData:function(d){var e= d.clone();e.data("optionLink",d.data("optionLink"));e.data("idx",d.data("idx"));return e},_setSelected:function(d,e){d.data("optionLink").attr("selected",e);if(e){e=this._cloneWithData(d);d[this.options.hide](this.options.animated,function(){a(this).remove()});e.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);this._applyItemState(e,true);return e}else{var b=this.availableList.find("li"),f=this.options.nodeComparator;e=null;var g=d.data("idx"),h=f(d,a(b[g]));if(h)for(;g>= 0&&g0?g++:g--;if(h!=f(d,a(b[g]))){e=b[h>0?g:g+1];break}}else e=b[g];b=this._cloneWithData(d);e?b.insertBefore(a(e)):b.appendTo(this.availableList);d[this.options.hide](this.options.animated,function(){a(this).remove()});b.hide()[this.options.show](this.options.animated);this._applyItemState(b,false);return b}},_applyItemState:function(d,e){if(e){this.options.sortable?d.children("span").addClass("ui-icon-arrowthick-2-n-s").removeClass("ui-helper-hidden").addClass("ui-icon"):d.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"); d.find("a.action span").addClass("ui-icon-minus").removeClass("ui-icon-plus");this._registerRemoveEvents(d.find("a.action"))}else{d.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon");d.find("a.action span").addClass("ui-icon-plus").removeClass("ui-icon-minus");this._registerAddEvents(d.find("a.action"))}this._registerHoverEvents(d)},_filter:function(d){var e=a(this),b=d.children("li");d=b.map(function(){return a(this).text().toLowerCase()}); var f=a.trim(e.val().toLowerCase()),g=[];if(f){b.hide();d.each(function(h){this.indexOf(f)>-1&&g.push(h)});a.each(g,function(){a(b[this]).show()})}else b.show()},_registerHoverEvents:function(d){d.removeClass("ui-state-hover");d.mouseover(function(){a(this).addClass("ui-state-hover")});d.mouseout(function(){a(this).removeClass("ui-state-hover")})},_registerAddEvents:function(d){var e=this;d.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(d){var e=this;d.click(function(){e._setSelected(a(this).parent(),false);e.count-=1;e._updateCount();return false})},_registerSearchEvents:function(d){var e=this;d.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(d,e){d=d.text();e=e.text();return d==e?0:d