compass-jquery-plugin 0.2.4.1 → 0.2.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/README.textile +6 -6
  2. data/VERSION.yml +1 -1
  3. data/compass-jquery-plugin.gemspec +7 -2
  4. data/gem_tasks/jqgrid.rake +13 -4
  5. data/lib/jquery/jqgrid.rb +11 -10
  6. data/lib/jquery/jrails.rb +10 -18
  7. data/templates/jqgrid/i18n/jqgrid/locale-bg.js +132 -128
  8. data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +1 -1
  9. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +132 -128
  10. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +1 -1
  11. data/templates/jqgrid/i18n/jqgrid/locale-cat.js +128 -124
  12. data/templates/jqgrid/i18n/jqgrid/locale-cat.min.js +1 -1
  13. data/templates/jqgrid/i18n/jqgrid/locale-cs.js +127 -123
  14. data/templates/jqgrid/i18n/jqgrid/locale-cs.min.js +1 -1
  15. data/templates/jqgrid/i18n/jqgrid/locale-de.js +127 -123
  16. data/templates/jqgrid/i18n/jqgrid/locale-de.min.js +1 -1
  17. data/templates/jqgrid/i18n/jqgrid/locale-dk.js +128 -124
  18. data/templates/jqgrid/i18n/jqgrid/locale-dk.min.js +1 -1
  19. data/templates/jqgrid/i18n/jqgrid/locale-el.js +126 -122
  20. data/templates/jqgrid/i18n/jqgrid/locale-el.min.js +1 -1
  21. data/templates/jqgrid/i18n/jqgrid/locale-en.js +128 -123
  22. data/templates/jqgrid/i18n/jqgrid/locale-en.min.js +1 -1
  23. data/templates/jqgrid/i18n/jqgrid/locale-fa.js +125 -121
  24. data/templates/jqgrid/i18n/jqgrid/locale-fa.min.js +1 -1
  25. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +128 -124
  26. data/templates/jqgrid/i18n/jqgrid/locale-fi.min.js +1 -1
  27. data/templates/jqgrid/i18n/jqgrid/locale-fr.js +126 -122
  28. data/templates/jqgrid/i18n/jqgrid/locale-fr.min.js +1 -1
  29. data/templates/jqgrid/i18n/jqgrid/locale-he.js +127 -0
  30. data/templates/jqgrid/i18n/jqgrid/locale-he.min.js +1 -0
  31. data/templates/jqgrid/i18n/jqgrid/locale-is.js +126 -122
  32. data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +1 -1
  33. data/templates/jqgrid/i18n/jqgrid/locale-it.js +126 -122
  34. data/templates/jqgrid/i18n/jqgrid/locale-it.min.js +1 -1
  35. data/templates/jqgrid/i18n/jqgrid/locale-jp.js +127 -123
  36. data/templates/jqgrid/i18n/jqgrid/locale-jp.min.js +1 -1
  37. data/templates/jqgrid/i18n/jqgrid/locale-nl.js +148 -144
  38. data/templates/jqgrid/i18n/jqgrid/locale-nl.min.js +1 -1
  39. data/templates/jqgrid/i18n/jqgrid/locale-no.js +121 -116
  40. data/templates/jqgrid/i18n/jqgrid/locale-no.min.js +1 -1
  41. data/templates/jqgrid/i18n/jqgrid/locale-pl.js +126 -122
  42. data/templates/jqgrid/i18n/jqgrid/locale-pl.min.js +1 -1
  43. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +127 -123
  44. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +1 -1
  45. data/templates/jqgrid/i18n/jqgrid/locale-pt.js +125 -121
  46. data/templates/jqgrid/i18n/jqgrid/locale-pt.min.js +1 -1
  47. data/templates/jqgrid/i18n/jqgrid/locale-ro.js +139 -0
  48. data/templates/jqgrid/i18n/jqgrid/locale-ro.min.js +1 -0
  49. data/templates/jqgrid/i18n/jqgrid/locale-ru.js +127 -123
  50. data/templates/jqgrid/i18n/jqgrid/locale-ru.min.js +1 -1
  51. data/templates/jqgrid/i18n/jqgrid/locale-sp.js +128 -124
  52. data/templates/jqgrid/i18n/jqgrid/locale-sp.min.js +1 -1
  53. data/templates/jqgrid/i18n/jqgrid/locale-sv.js +117 -112
  54. data/templates/jqgrid/i18n/jqgrid/locale-sv.min.js +1 -1
  55. data/templates/jqgrid/i18n/jqgrid/locale-tr.js +126 -122
  56. data/templates/jqgrid/i18n/jqgrid/locale-tr.min.js +1 -1
  57. data/templates/jqgrid/i18n/jqgrid/locale-ua.js +127 -123
  58. data/templates/jqgrid/i18n/jqgrid/locale-ua.min.js +1 -1
  59. data/templates/jqgrid/jquery.jqGrid.js +9913 -8988
  60. data/templates/jqgrid/jquery.jqGrid.min.js +1 -1
  61. data/templates/jqgrid/jquery.ui/jqGrid.sass +745 -580
  62. data/templates/jqgrid/manifest.rb +62 -57
  63. data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +13 -0
  64. data/templates/jrails/jquery.js +7644 -7626
  65. data/templates/jrails/jquery.min.js +19 -19
  66. data/templates/jrails/jrails.js +192 -197
  67. data/templates/jrails/jrails.min.js +1 -1
  68. data/templates/secret_sauce/app/views/ui/_ui_grid_for_without_block.js.haml +139 -136
  69. metadata +7 -2
@@ -1 +1 @@
1
- (function($){$.jgrid=$.jgrid||{};$.extend($.jgrid,{htmlDecode:function(value){if(value=="&nbsp;"||value=="&#160;"||(value.length==1&&value.charCodeAt(0)==160)){return""}return !value?value:String(value).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(value){return !value?value:String(value).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(format){var args=$.makeArray(arguments).slice(1);return format.replace(/\{(\d+)\}/g,function(m,i){return args[i]})},getCellIndex:function(cell){cell=$(cell);cell=(!cell.is("td")&&!cell.is("th")?cell.closest("td,th"):cell)[0];if($.browser.msie){return $.inArray(cell,cell.parentNode.cells)}return cell.cellIndex},stripHtml:function(v){var regexp=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(v){return v.replace(regexp,"")}else{return v}},stringToDoc:function(xmlString){var xmlDoc;if(typeof xmlString!=="string"){return xmlString}try{var parser=new DOMParser();xmlDoc=parser.parseFromString(xmlString,"text/xml")}catch(e){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.loadXML(xmlString)}return(xmlDoc&&xmlDoc.documentElement&&xmlDoc.documentElement.tagName!="parsererror")?xmlDoc:null},parse:function(jsonString){var js=jsonString;if(js.substr(0,9)=="while(1);"){js=js.substr(9)}if(js.substr(0,2)=="/*"){js=js.substr(2,js.length-4)}if(!js){js="{}"}with(window){return eval("("+js+")")}},empty:function(){while(this.firstChild){this.removeChild(this.firstChild)}},jqID:function(sid){sid=sid+"";return sid.replace(/([\.\:\[\]])/g,"\\$1")},extend:function(methods){$.extend($.fn.jqGrid,methods);if(!this.no_legacy_api){$.fn.extend(methods)}}});$.fn.jqGrid=function(p){if(typeof p=="string"){var fn=$.fn.jqGrid[p];if(!fn){throw ("jqGrid - No such method: "+p)}var args=$.makeArray(arguments).slice(1);return fn.apply(this,args)}p=$.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"},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:[]},$.jgrid.defaults,p||{});var grid={headers:[],cols:[],footers:[],dragStart:function(i,x,y){this.resizing={idx:i,startX:x.clientX,sOL:y[0]};this.hDiv.style.cursor="col-resize";this.curGbox=$("#rs_m"+p.id,"#gbox_"+p.id);this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]});document.onselectstart=new Function("return false")},dragMove:function(x){if(this.resizing){var diff=x.clientX-this.resizing.startX,h=this.headers[this.resizing.idx],newWidth=h.width+diff,hn,nWn;if(newWidth>33){this.curGbox.css({left:this.resizing.sOL+diff});if(p.forceFit===true){hn=this.headers[this.resizing.idx+p.nv];nWn=hn.width-diff;if(nWn>33){h.newWidth=newWidth;hn.newWidth=nWn;this.newWidth=p.tblwidth}}else{this.newWidth=p.tblwidth+diff;h.newWidth=newWidth}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var idx=this.resizing.idx,nw=this.headers[idx].newWidth||this.headers[idx].width;this.resizing=false;$("#rs_m"+p.id).css("display","none");p.colModel[idx].width=nw;this.headers[idx].width=nw;this.headers[idx].el.style.width=nw+"px";if(this.cols.length>0){this.cols[idx].style.width=nw+"px"}if(this.footers.length>0){this.footers[idx].style.width=nw+"px"}if(p.forceFit===true){nw=this.headers[idx+p.nv].newWidth||this.headers[idx+p.nv].width;this.headers[idx+p.nv].width=nw;this.headers[idx+p.nv].el.style.width=nw+"px";if(this.cols.length>0){this.cols[idx+p.nv].style.width=nw+"px"}if(this.footers.length>0){this.footers[idx+p.nv].style.width=nw+"px"}p.colModel[idx+p.nv].width=nw}else{p.tblwidth=this.newWidth;$("table:first",this.bDiv).css("width",p.tblwidth+"px");$("table:first",this.hDiv).css("width",p.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(p.footerrow){$("table:first",this.sDiv).css("width",p.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}}this.curGbox=null;document.onselectstart=new Function("return true")},scrollGrid:function(){if(p.scroll===true){var scrollTop=this.bDiv.scrollTop;if(scrollTop!=this.scrollTop){this.scrollTop=scrollTop;if((this.bDiv.scrollHeight-scrollTop-$(this.bDiv).height())<=0){if(parseInt(p.page,10)+1<=parseInt(p.lastpage,10)){p.page=parseInt(p.page,10)+1;this.populate()}}}}this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(p.footerrow){this.sDiv.scrollLeft=this.bDiv.scrollLeft}}};return this.each(function(){if(this.grid){return}this.p=p;var i;if(this.p.colNames.length===0){for(i=0;i<this.p.colModel.length;i++){this.p.colNames[i]=this.p.colModel[i].label||this.p.colModel[i].name}}if(this.p.colNames.length!==this.p.colModel.length){alert($.jgrid.errors.model);return}var gv=$("<div class='ui-jqgrid-view'></div>"),ii,isMSIE=$.browser.msie?true:false,isSafari=$.browser.safari?true:false;$(gv).insertBefore(this);$(this).appendTo(gv).removeClass("scroll");var eg=$("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");$(eg).insertBefore(gv).attr("id","gbox_"+this.id);$(gv).appendTo(eg).attr("id","gview_"+this.id);if(isMSIE&&$.browser.version<=6){ii='<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>'}else{ii=""}$("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv);$("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv);$(this).attr({cellSpacing:"0",cellPadding:"0",border:"0",role:"grid","aria-multiselectable":this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var ts=this,bSR=$.isFunction(this.p.beforeSelectRow)?this.p.beforeSelectRow:false,ondblClickRow=$.isFunction(this.p.ondblClickRow)?this.p.ondblClickRow:false,onSortCol=$.isFunction(this.p.onSortCol)?this.p.onSortCol:false,loadComplete=$.isFunction(this.p.loadComplete)?this.p.loadComplete:false,loadError=$.isFunction(this.p.loadError)?this.p.loadError:false,loadBeforeSend=$.isFunction(this.p.loadBeforeSend)?this.p.loadBeforeSend:false,onRightClickRow=$.isFunction(this.p.onRightClickRow)?this.p.onRightClickRow:false,afterInsRow=$.isFunction(this.p.afterInsertRow)?this.p.afterInsertRow:false,onHdCl=$.isFunction(this.p.onHeaderClick)?this.p.onHeaderClick:false,beReq=$.isFunction(this.p.beforeRequest)?this.p.beforeRequest:false,onSC=$.isFunction(this.p.onCellSelect)?this.p.onCellSelect:false,sortkeys=["shiftKey","altKey","ctrlKey"],IntNum=function(val,defval){val=parseInt(val,10);if(isNaN(val)){return defval?defval:0}else{return val}},formatCol=function(pos,rowInd){var ral=ts.p.colModel[pos].align,result='style="';if(ral){result+="text-align:"+ral+";"}if(ts.p.colModel[pos].hidden===true){result+="display:none;"}if(rowInd===0){result+="width: "+grid.headers[pos].width+"px;"}return result+'"'},addCell=function(rowId,cell,pos,irow,srvr){var v,prp;v=formatter(rowId,cell,pos,srvr,"add");prp=formatCol(pos,irow);return'<td role="gridcell" '+prp+' title="'+$.jgrid.stripHtml(v)+'">'+v+"</td>"},formatter=function(rowId,cellval,colpos,rwdat,_act){var cm=ts.p.colModel[colpos],v;if(typeof cm.formatter!=="undefined"){var opts={rowId:rowId,colModel:cm};if($.isFunction(cm.formatter)){v=cm.formatter(cellval,opts,rwdat,_act)}else{if($.fmatter){v=$.fn.fmatter(cm.formatter,cellval,opts,rwdat,_act)}else{v=cellVal(cellval)}}}else{v=cellVal(cellval)}return v},cellVal=function(val){return val===undefined||val===null||val===""?"&#160;":ts.p.autoencode?$.jgrid.htmlEncode(val+""):val+""},addMulti=function(rowid,pos,irow){var v='<input type="checkbox" id="jqg_'+rowid+'" class="cbox" name="jqg_'+rowid+'"/>',prp=formatCol(pos,irow);return"<td role='gridcell' "+prp+">"+v+"</td>"},addRowNum=function(pos,irow,pG,rN){var v=(parseInt(pG)-1)*parseInt(rN)+1+irow,prp=formatCol(pos,irow);return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+prp+">"+v+"</td>"},reader=function(datatype){var field,f=[],j=0,i;for(i=0;i<ts.p.colModel.length;i++){field=ts.p.colModel[i];if(field.name!=="cb"&&field.name!=="subgrid"&&field.name!=="rn"){f[j]=(datatype=="xml")?field.xmlmap||field.name:field.jsonmap||field.name;j++}}return f},orderedCols=function(offset){var order=ts.p.remapColumns;if(!order||!order.length){order=$.map(ts.p.colModel,function(v,i){return i})}if(offset){order=$.map(order,function(v){return v<offset?null:v-offset})}return order},emptyRows=function(parent){var tBody=$("tbody:first",parent);if(!ts.p.gridview){$("*",tBody).children().unbind()}if(isMSIE){$.jgrid.empty.apply(tBody[0])}else{tBody[0].innerHTML=""}tBody=null},addXmlData=function(xml,t,rcnt){var startReq=new Date();ts.p.reccount=0;if($.isXMLDoc(xml)){if(ts.p.treeANode===-1&&ts.p.scroll===false){emptyRows(t);rcnt=0}else{rcnt=rcnt>0?rcnt:0}}else{return}var i,fpos,ir=0,v,row,gi=0,si=0,ni=0,idn,getId,f=[],F,rd={},rl=ts.rows.length,xmlr,rid,rowData=[],ari=0,cn=(ts.p.altRows===true)?ts.p.altclass:"",cn1;if(!ts.p.xmlReader.repeatitems){f=reader("xml")}if(ts.p.keyIndex===false){idn=ts.p.xmlReader.id}else{idn=ts.p.keyIndex}if(f.length>0&&!isNaN(idn)){if(ts.p.remapColumns&&ts.p.remapColumns.length){idn=$.inArray(idn,ts.p.remapColumns)}idn=f[idn]}if((idn+"").indexOf("[")===-1){if(f.length){getId=function(trow,k){return $(idn,trow).text()||k}}else{getId=function(trow,k){return $(ts.p.xmlReader.cell,trow).eq(idn).text()||k}}}else{getId=function(trow,k){return trow.getAttribute(idn.replace(/[\[\]]/g,""))||k}}$(ts.p.xmlReader.page,xml).each(function(){ts.p.page=this.textContent||this.text||1});$(ts.p.xmlReader.total,xml).each(function(){ts.p.lastpage=this.textContent||this.text||1});$(ts.p.xmlReader.records,xml).each(function(){ts.p.records=this.textContent||this.text||0});$(ts.p.xmlReader.userdata,xml).each(function(){ts.p.userData[this.getAttribute("name")]=this.textContent||this.text});var gxml=$(ts.p.xmlReader.root+" "+ts.p.xmlReader.row,xml),gl=gxml.length,j=0;if(gxml&&gl){var rn=ts.p.rowNum;while(j<gl){xmlr=gxml[j];rid=getId(xmlr,j+1);cn1=j%2==1?cn:"";rowData[ari++]='<tr id="'+rid+'" role="row" class ="ui-widget-content jqgrow '+cn1+'">';if(ts.p.rownumbers===true){rowData[ari++]=addRowNum(0,j,ts.p.page,ts.p.rowNum);ni=1}if(ts.p.multiselect===true){rowData[ari++]=addMulti(rid,ni,j);gi=1}if(ts.p.subGrid===true){rowData[ari++]=$(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt);si=1}if(ts.p.xmlReader.repeatitems){if(!F){F=orderedCols(gi+si+ni)}var cells=$(ts.p.xmlReader.cell,xmlr);$.each(F,function(k){var cell=cells[this];if(!cell){return false}v=cell.textContent||cell.text;rd[ts.p.colModel[k+gi+si+ni].name]=v;rowData[ari++]=addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr)})}else{for(i=0;i<f.length;i++){v=$(f[i],xmlr).text();rd[ts.p.colModel[i+gi+si+ni].name]=v;rowData[ari++]=addCell(rid,v,i+gi+si+ni,j+rcnt,xmlr)}}rowData[ari++]="</tr>";if(ts.p.gridview===false){if(ts.p.treeGrid===true){fpos=ts.p.treeANode>=-1?ts.p.treeANode:0;row=$(rowData.join(""))[0];try{$(ts).jqGrid("setTreeNode",rd,row)}catch(e){}rl===0?$("tbody:first",t).append(row):$(ts.rows[j+fpos+rcnt]).after(row)}else{$("tbody:first",t).append(rowData.join(""))}if(ts.p.subGrid===true){try{$(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni)}catch(e){}}if(afterInsRow){ts.p.afterInsertRow(rid,rd,xmlr)}rowData=[];ari=0}rd={};ir++;j++;if(rn!=-1&&ir>rn){break}}}if(ts.p.gridview===true){$("tbody:first",t).append(rowData.join(""))}ts.p.totaltime=new Date()-startReq;if(ir>0){ts.grid.cols=ts.rows[0].cells;if(ts.p.records===0){ts.p.records=gl}}rowData=null;if(!ts.p.treeGrid&&!ts.p.scroll){ts.grid.bDiv.scrollTop=0}ts.p.reccount=ir;ts.p.treeANode=-1;if(ts.p.userDataOnFooter){$(ts).jqGrid("footerData","set",ts.p.userData,true)}updatepager(false)},addJSONData=function(data,t,rcnt){var startReq=new Date();ts.p.reccount=0;if(data){if(ts.p.treeANode===-1&&ts.p.scroll===false){emptyRows(t);rcnt=0}else{rcnt=rcnt>0?rcnt:0}}else{return}var ir=0,v,i,j,row,f=[],F,cur,gi=0,si=0,ni=0,len,drows,idn,rd={},fpos,rl=ts.rows.length,idr,rowData=[],ari=0,cn=(ts.p.altRows===true)?ts.p.altclass:"",cn1;ts.p.page=data[ts.p.jsonReader.page]||1;ts.p.lastpage=data[ts.p.jsonReader.total]||1;ts.p.records=data[ts.p.jsonReader.records]||0;ts.p.userData=data[ts.p.jsonReader.userdata]||{};if(!ts.p.jsonReader.repeatitems){F=f=reader("json")}if(ts.p.keyIndex===false){idn=ts.p.jsonReader.id}else{idn=ts.p.keyIndex}if(f.length>0&&!isNaN(idn)){if(ts.p.remapColumns&&ts.p.remapColumns.length){idn=$.inArray(idn,ts.p.remapColumns)}idn=f[idn]}drows=data[ts.p.jsonReader.root];if(drows){len=drows.length,i=0;var rn=ts.p.rowNum;while(i<len){cur=drows[i];idr=cur[idn];if(idr===undefined){if(f.length===0){if(ts.p.jsonReader.cell){var ccur=cur[ts.p.jsonReader.cell];idr=ccur[idn]||i+1;ccur=null}else{idr=i+1}}else{idr=i+1}}cn1=i%2==1?cn:"";rowData[ari++]='<tr id="'+idr+'" role="row" class= "ui-widget-content jqgrow '+cn1+'">';if(ts.p.rownumbers===true){rowData[ari++]=addRowNum(0,i,ts.p.page,ts.p.rowNum);ni=1}if(ts.p.multiselect){rowData[ari++]=addMulti(idr,ni,i);gi=1}if(ts.p.subGrid){rowData[ari++]=$(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt);si=1}if(ts.p.jsonReader.repeatitems){if(ts.p.jsonReader.cell){cur=cur[ts.p.jsonReader.cell]}if(!F){F=orderedCols(gi+si+ni)}}for(j=0;j<F.length;j++){v=cur[F[j]];if(v===undefined){try{v=eval("cur."+F[j])}catch(e){}}rowData[ari++]=addCell(idr,v,j+gi+si+ni,i+rcnt,cur);rd[ts.p.colModel[j+gi+si+ni].name]=v}rowData[ari++]="</tr>";if(ts.p.gridview===false){if(ts.p.treeGrid===true){fpos=ts.p.treeANode>=-1?ts.p.treeANode:0;row=$(rowData.join(""))[0];try{$(ts).jqGrid("setTreeNode",rd,row)}catch(e){}rl===0?$("tbody:first",t).append(row):$(ts.rows[i+fpos+rcnt]).after(row)}else{$("tbody:first",t).append(rowData.join(""))}if(ts.p.subGrid===true){try{$(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni)}catch(e){}}if(afterInsRow){ts.p.afterInsertRow(idr,rd,cur)}rowData=[];ari=0}rd={};ir++;i++;if(rn!=-1&&ir>rn){break}}if(ts.p.gridview===true){$("tbody:first",t).append(rowData.join(""))}ts.p.totaltime=new Date()-startReq;if(ir>0){ts.grid.cols=ts.rows[0].cells;if(ts.p.records===0){ts.p.records=len}}}if(!ts.p.treeGrid&&!ts.p.scroll){ts.grid.bDiv.scrollTop=0}ts.p.reccount=ir;ts.p.treeANode=-1;if(ts.p.userDataOnFooter){$(ts).jqGrid("footerData","set",ts.p.userData,true)}updatepager(false)},updatepager=function(rn){var cp,last,base,bs,from,to,tot,fmt;base=(parseInt(ts.p.page)-1)*parseInt(ts.p.rowNum);if(ts.p.pager){if(ts.p.loadonce){cp=last=1;ts.p.lastpage=ts.page=1;$(".selbox",ts.p.pager).attr("disabled",true)}else{cp=IntNum(ts.p.page);last=IntNum(ts.p.lastpage);$(".selbox",ts.p.pager).attr("disabled",false)}if(ts.p.pginput===true){$(".ui-pg-input",ts.p.pager).val(ts.p.page);$("#sp_1",ts.p.pager).html(ts.p.lastpage)}if(ts.p.viewrecords){bs=ts.p.scroll===true?0:base;if(ts.p.reccount===0){$(".ui-paging-info",ts.p.pager).html(ts.p.emptyrecords)}else{from=bs+1;to=base+ts.p.reccount;tot=ts.p.records;if($.fmatter){fmt=$.jgrid.formatter.integer||{};from=$.fmatter.util.NumberFormat(from,fmt);to=$.fmatter.util.NumberFormat(to,fmt);tot=$.fmatter.util.NumberFormat(tot,fmt)}$(".ui-paging-info",ts.p.pager).html($.jgrid.format(ts.p.recordtext,from,to,tot))}}if(ts.p.pgbuttons===true){if(cp<=0){cp=last=1}if(cp==1){$("#first, #prev",ts.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{$("#first, #prev",ts.p.pager).removeClass("ui-state-disabled")}if(cp==last){$("#next, #last",ts.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{$("#next, #last",ts.p.pager).removeClass("ui-state-disabled")}}}if(rn===true&&ts.p.rownumbers===true){$("td.jqgrid-rownum",ts.rows).each(function(i){$(this).html(base+1+i)})}if($.isFunction(ts.p.gridComplete)){ts.p.gridComplete()}},populate=function(){if(!ts.grid.hDiv.loading){var prm={},dt,dstr,pN=ts.p.prmNames;if(pN.search!==null){prm[pN.search]=ts.p.search}if(pN.nd!=null){prm[pN.nd]=new Date().getTime()}if(pN.rows!==null){prm[pN.rows]=ts.p.rowNum}if(pN.page!==null){prm[pN.page]=ts.p.page}if(pN.sort!==null){prm[pN.sort]=ts.p.sortname}if(pN.order!==null){prm[pN.order]=ts.p.sortorder}$.extend(ts.p.postData,prm);var rcnt=ts.p.scroll===false?0:ts.rows.length-1;if($.isFunction(ts.p.datatype)){ts.p.datatype(ts.p.postData,"load_"+ts.p.id);return}else{if(beReq){ts.p.beforeRequest()}}dt=ts.p.datatype.toLowerCase();switch(dt){case"json":case"jsonp":case"xml":case"script":$.ajax({url:ts.p.url,type:ts.p.mtype,dataType:dt,data:ts.p.postData,complete:function(req,st){if(st=="success"||(req.statusText=="OK"&&req.status=="200")){if(dt==="xml"){addXmlData(req.responseXML,ts.grid.bDiv,rcnt)}else{addJSONData($.jgrid.parse(req.responseText),ts.grid.bDiv,rcnt)}if(loadComplete){loadComplete(req)}}req=null;endReq()},error:function(xhr,st,err){if(loadError){loadError(xhr,st,err)}endReq();xhr=null},beforeSend:function(xhr){beginReq();if(loadBeforeSend){loadBeforeSend(xhr)}}});if(ts.p.loadonce||ts.p.treeGrid){ts.p.datatype="local"}break;case"xmlstring":beginReq();addXmlData(dstr=$.jgrid.stringToDoc(ts.p.datastr),ts.grid.bDiv);ts.p.datatype="local";if(loadComplete){loadComplete(dstr)}ts.p.datastr=null;endReq();break;case"jsonstring":beginReq();if(typeof ts.p.datastr=="string"){dstr=$.jgrid.parse(ts.p.datastr)}else{dstr=ts.p.datastr}addJSONData(dstr,ts.grid.bDiv);ts.p.datatype="local";if(loadComplete){loadComplete(dstr)}ts.p.datastr=null;endReq();break;case"local":case"clientside":beginReq();ts.p.datatype="local";sortArrayData();endReq();break}}},beginReq=function(){ts.grid.hDiv.loading=true;if(ts.p.hiddengrid){return}switch(ts.p.loadui){case"disable":break;case"enable":$("#load_"+ts.p.id).show();break;case"block":$("#lui_"+ts.p.id).show();$("#load_"+ts.p.id).show();break}},endReq=function(){ts.grid.hDiv.loading=false;switch(ts.p.loadui){case"disable":break;case"enable":$("#load_"+ts.p.id).hide();break;case"block":$("#lui_"+ts.p.id).hide();$("#load_"+ts.p.id).hide();break}},sortArrayData=function(){var stripNum=/[\$,%]/g;var rows=[],col=0,st,sv,findSortKey,newDir=(ts.p.sortorder=="asc")?1:-1;$.each(ts.p.colModel,function(i,v){if(this.index==ts.p.sortname||this.name==ts.p.sortname){col=ts.p.lastsort=i;st=this.sorttype;return false}});if(st=="float"||st=="number"||st=="currency"){findSortKey=function($cell){var key=parseFloat($cell.replace(stripNum,""));return isNaN(key)?0:key}}else{if(st=="int"||st=="integer"){findSortKey=function($cell){return IntNum($cell.replace(stripNum,""))}}else{if(st=="date"){findSortKey=function($cell){var fd=ts.p.colModel[col].datefmt||"Y-m-d";return parseDate(fd,$cell).getTime()}}else{findSortKey=function($cell){return $.trim($cell.toUpperCase())}}}}$.each(ts.rows,function(index,row){try{sv=$.unformat($(row).children("td").eq(col),{colModel:ts.p.colModel[col]},col,true)}catch(_){sv=$(row).children("td").eq(col).text()}row.sortKey=findSortKey(sv);rows[index]=this});if(ts.p.treeGrid){$(ts).jqGrid("SortTree",newDir)}else{rows.sort(function(a,b){if(a.sortKey<b.sortKey){return -newDir}if(a.sortKey>b.sortKey){return newDir}return 0});if(rows[0]){$("td",rows[0]).each(function(k){$(this).css("width",grid.headers[k].width+"px")});grid.cols=rows[0].cells}$.each(rows,function(index,row){$("tbody",ts.grid.bDiv).append(row);row.sortKey=null})}if(ts.p.multiselect){$("tbody tr",ts.grid.bDiv).removeClass("ui-state-highlight");$("[id^=jqg_]",ts.rows).attr("checked",false);$("#cb_jqg",ts.grid.hDiv).attr("checked",false);ts.p.selarrrow=[]}ts.grid.bDiv.scrollTop=0},parseDate=function(format,date){var tsp={m:1,d:1,y:1970,h:0,i:0,s:0},k,hl,dM;date=date.split(/[\\\/:_;.\t\T\s-]/);format=format.split(/[\\\/:_;.\t\T\s-]/);var dfmt=$.jgrid.formatter.date.monthNames;for(k=0,hl=format.length;k<hl;k++){if(format[k]=="M"){dM=$.inArray(date[k],dfmt);if(dM!==-1&&dM<12){date[k]=dM+1}}if(format[k]=="F"){dM=$.inArray(date[k],dfmt);if(dM!==-1&&dM>11){date[k]=dM+1-12}}tsp[format[k].toLowerCase()]=parseInt(date[k],10)}tsp.m=parseInt(tsp.m,10)-1;var ty=tsp.y;if(ty>=70&&ty<=99){tsp.y=1900+tsp.y}else{if(ty>=0&&ty<=69){tsp.y=2000+tsp.y}}return new Date(tsp.y,tsp.m,tsp.d,tsp.h,tsp.i,tsp.s,0)},setPager=function(){var sep="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",pgid=$(ts.p.pager).attr("id")||"pager",pginp=(ts.p.pginput===true)?"<td>"+$.jgrid.format(ts.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>":"",pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",str,pgcnt,lft,cent,rgt,twd,tdw,i,clearVals=function(onpaging){if($.isFunction(ts.p.onPaging)){ts.p.onPaging(onpaging)}ts.p.selrow=null;if(ts.p.multiselect){ts.p.selarrrow=[];$("#cb_jqg",ts.grid.hDiv).attr("checked",false)}ts.p.savedRow=[]};pgcnt="pg_"+pgid;lft=pgid+"_left";cent=pgid+"_center";rgt=pgid+"_right";$(ts.p.pager).addClass("ui-jqgrid-pager corner-bottom").append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:nowrap;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>");if(ts.p.pgbuttons===true){pgl+="<td id='first' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";pgl+="<td id='prev' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";pgl+=pginp!=""?sep+pginp+sep:"";pgl+="<td id='next' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";pgl+="<td id='last' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else{if(pginp!=""){pgl+=pginp}}if(ts.p.rowList.length>0){str="<select class='ui-pg-selbox' role='listbox'>";for(i=0;i<ts.p.rowList.length;i++){str+="<option role='option' value="+ts.p.rowList[i]+((ts.p.rowNum==ts.p.rowList[i])?" selected":"")+">"+ts.p.rowList[i]}str+="</select>";pgl+="<td>"+str+"</td>"}pgl+="</tr></tbody></table>";if(ts.p.viewrecords===true){$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>")}$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl);tdw=$(".ui-jqgrid").css("font-size")||"11px";$("body").append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");twd=$(pgl).clone().appendTo("#testpg").width();$("#testpg").remove();if(twd>0){twd+=25;$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd)}ts.p._nvtd=[];ts.p._nvtd[0]=twd?Math.floor((ts.p.width-twd)/2):Math.floor(ts.p.width/3);ts.p._nvtd[1]=0;pgl=null;$(".ui-pg-selbox","#"+pgcnt).bind("change",function(){ts.p.page=Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;ts.p.rowNum=this.value;clearVals("records");populate();return false});if(ts.p.pgbuttons===true){$(".ui-pg-button","#"+pgcnt).hover(function(e){if($(this).hasClass("ui-state-disabled")){this.style.cursor="default"}else{$(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(e){if($(this).hasClass("ui-state-disabled")){}else{$(this).removeClass("ui-state-hover");this.style.cursor="default"}});$("#first, #prev, #next, #last",ts.p.pager).click(function(e){var cp=IntNum(ts.p.page),last=IntNum(ts.p.lastpage),selclick=false,fp=true,pp=true,np=true,lp=true;if(last===0||last===1){fp=false;pp=false;np=false;lp=false}else{if(last>1&&cp>=1){if(cp===1){fp=false;pp=false}else{if(cp>1&&cp<last){}else{if(cp===last){np=false;lp=false}}}}else{if(last>1&&cp===0){np=false;lp=false;cp=last-1}}}if(this.id==="first"&&fp){ts.p.page=1;selclick=true}if(this.id==="prev"&&pp){ts.p.page=(cp-1);selclick=true}if(this.id==="next"&&np){ts.p.page=(cp+1);selclick=true}if(this.id==="last"&&lp){ts.p.page=last;selclick=true}if(selclick){clearVals(this.id);populate()}return false})}if(ts.p.pginput===true){$("input.ui-pg-input","#"+pgcnt).keypress(function(e){var key=e.charCode?e.charCode:e.keyCode?e.keyCode:0;if(key==13){ts.p.page=($(this).val()>0)?$(this).val():ts.p.page;clearVals("user");populate();return false}return this})}},sortData=function(index,idxcol,reload,sor){if(!ts.p.colModel[idxcol].sortable){return}var imgs,so;if(ts.p.savedRow.length>0){return}if(!reload){if(ts.p.lastsort==idxcol){if(ts.p.sortorder=="asc"){ts.p.sortorder="desc"}else{if(ts.p.sortorder=="desc"){ts.p.sortorder="asc"}}}else{ts.p.sortorder="asc"}ts.p.page=1}if(sor){if(ts.p.lastsort==idxcol&&ts.p.sortorder==sor){return}else{ts.p.sortorder=sor}}var thd=$("thead:first",ts.grid.hDiv).get(0);$("tr th:eq("+ts.p.lastsort+") span.ui-grid-ico-sort",thd).addClass("ui-state-disabled");$("tr th:eq("+ts.p.lastsort+")",thd).attr("aria-selected","false");$("tr th:eq("+idxcol+") span.ui-icon-"+ts.p.sortorder,thd).removeClass("ui-state-disabled");$("tr th:eq("+idxcol+")",thd).attr("aria-selected","true");if(!ts.p.viewsortcols[0]){if(ts.p.lastsort!=idxcol){$("tr th:eq("+ts.p.lastsort+") span.s-ico",thd).hide();$("tr th:eq("+idxcol+") span.s-ico",thd).show()}}ts.p.lastsort=idxcol;index=index.substring(5);ts.p.sortname=ts.p.colModel[idxcol].index||index;so=ts.p.sortorder;if(onSortCol){onSortCol(index,idxcol,so)}if(ts.p.datatype=="local"){if(ts.p.deselectAfterSort){$(ts).jqGrid("resetSelection")}}else{ts.p.selrow=null;if(ts.p.multiselect){$("#cb_jqg",ts.grid.hDiv).attr("checked",false)}ts.p.selarrrow=[];ts.p.savedRow=[];if(ts.p.scroll===true){emptyRows(ts.grid.bDiv)}}if(ts.p.subGrid&&ts.p.datatype=="local"){$("td.sgexpanded","#"+ts.p.id).each(function(){$(this).trigger("click")})}populate();if(ts.p.sortname!=index&&idxcol){ts.p.lastsort=idxcol}},setColWidth=function(){var initwidth=0,brd=ts.p.cellLayout,vc=0,lvc,scw=ts.p.scrollOffset,cw,hs=false,aw,tw=0,gw=0,msw=ts.p.multiselectWidth,sgw=ts.p.subGridWidth,rnw=ts.p.rownumWidth,cl=ts.p.cellLayout,cr;$.each(ts.p.colModel,function(i){if(typeof this.hidden==="undefined"){this.hidden=false}if(this.hidden===false){initwidth+=IntNum(this.width);vc++}});if(isNaN(ts.p.width)){ts.p.width=grid.width=initwidth}else{grid.width=ts.p.width}ts.p.tblwidth=initwidth;if(ts.p.shrinkToFit===false&&ts.p.forceFit===true){ts.p.forceFit=false}if(ts.p.shrinkToFit===true){if(isSafari){brd=0;msw+=cl;sgw+=cl;rnw+=cl}if(ts.p.multiselect){tw=msw;gw=msw+brd;vc--}if(ts.p.subGrid){tw+=sgw;gw+=sgw+brd;vc--}if(ts.p.rownumbers){tw+=rnw;gw+=rnw+brd;vc--}aw=grid.width-brd*vc-gw;if(isNaN(ts.p.height)){}else{aw-=scw;hs=true}initwidth=0;$.each(ts.p.colModel,function(i){if(this.hidden===false&&this.name!=="cb"&&this.name!=="subgrid"&&this.name!=="rn"){cw=Math.floor(aw/(ts.p.tblwidth-tw)*this.width);this.width=cw;initwidth+=cw;lvc=i}});cr=0;if(hs&&grid.width-gw-(initwidth+brd*vc)!==scw){cr=grid.width-gw-(initwidth+brd*vc)-scw}else{if(!hs&&Math.abs(grid.width-gw-(initwidth+brd*vc))!==1){cr=grid.width-gw-(initwidth+brd*vc)}}ts.p.colModel[lvc].width+=cr;ts.p.tblwidth=initwidth+tw+cr}},nextVisible=function(iCol){var ret=iCol,j=iCol,i;for(i=iCol+1;i<ts.p.colModel.length;i++){if(ts.p.colModel[i].hidden!==true){j=i;break}}return j-ret},getOffset=function(iCol){var i,ret={},brd1=isSafari?0:ts.p.cellLayout;ret[0]=ret[1]=ret[2]=0;for(i=0;i<=iCol;i++){if(ts.p.colModel[i].hidden===false){ret[0]+=ts.p.colModel[i].width+brd1}}ret[0]=ret[0]-ts.grid.bDiv.scrollLeft;if($(ts.grid.cDiv).is(":visible")){ret[1]+=$(ts.grid.cDiv).height()+parseInt($(ts.grid.cDiv).css("padding-top"))+parseInt($(ts.grid.cDiv).css("padding-bottom"))}if(ts.p.toolbar[0]==true&&(ts.p.toolbar[1]=="top"||ts.p.toolbar[1]=="both")){ret[1]+=$(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"))+parseInt($(ts.grid.uDiv).css("border-bottom-width"))}ret[2]+=$(ts.grid.bDiv).height()+$(ts.grid.hDiv).height();return ret};this.p.id=this.id;if($.inArray(ts.p.multikey,sortkeys)==-1){ts.p.multikey=false}ts.p.keyIndex=false;for(i=0;i<ts.p.colModel.length;i++){if(ts.p.colModel[i].key===true){ts.p.keyIndex=i;break}}ts.p.sortorder=ts.p.sortorder.toLowerCase();if(this.p.treeGrid===true){try{$(this).jqGrid("setTreeGrid")}catch(_){}}if(this.p.subGrid){try{$(ts).jqGrid("setSubGrid")}catch(_){}}if(this.p.multiselect){this.p.colNames.unshift("<input id='cb_jqg' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:isSafari?ts.p.multiselectWidth+ts.p.cellLayout:ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center"})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center"})}ts.p.xmlReader=$.extend({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"}},ts.p.xmlReader);ts.p.jsonReader=$.extend({root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},ts.p.jsonReader);if(ts.p.scroll===true){ts.p.pgbuttons=false;ts.p.pginput=false;ts.p.rowList=[]}var thead="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",tdc,idn,w,res,sort,td,ptr,tbody,imgs,iac="",idc="";if(ts.p.shrinkToFit===true&&ts.p.forceFit===true){for(i=ts.p.colModel.length-1;i>=0;i--){if(!ts.p.colModel[i].hidden){ts.p.colModel[i].resizable=false;break}}}if(ts.p.viewsortcols[1]=="horizontal"){iac=" ui-i-asc";idc=" ui-i-desc"}tdc=isMSIE?"class='ui-th-div-ie'":"";imgs="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n'></span>";imgs+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s'></span></span>";for(i=0;i<this.p.colNames.length;i++){thead+="<th role='columnheader' class='ui-state-default ui-th-column'>";idn=ts.p.colModel[i].index||ts.p.colModel[i].name;thead+="<div id='jqgh_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];if(idn==ts.p.sortname){ts.p.lastsort=i}thead+=imgs+"</div></th>"}thead+="</tr></thead>";$(this).append(thead);$("thead tr:first th",this).hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")});if(this.p.multiselect){var onSA=true,emp=[],chk;if(typeof ts.p.onSelectAll!=="function"){onSA=false}$("#cb_jqg",this).bind("click",function(){if(this.checked){$("[id^=jqg_]",ts.rows).attr("checked",true);$(ts.rows).each(function(i){if(!$(this).hasClass("subgrid")){$(this).addClass("ui-state-highlight").attr("aria-selected","true");ts.p.selarrrow[i]=ts.p.selrow=this.id}});chk=true;emp=[]}else{$("[id^=jqg_]",ts.rows).attr("checked",false);$(ts.rows).each(function(i){if(!$(this).hasClass("subgrid")){$(this).removeClass("ui-state-highlight").attr("aria-selected","false");emp[i]=this.id}});ts.p.selarrrow=[];ts.p.selrow=null;chk=false}if(onSA){ts.p.onSelectAll(chk?ts.p.selarrrow:emp,chk)}})}$.each(ts.p.colModel,function(i){if(!this.width){this.width=150}});if(ts.p.autowidth===true){var pw=$(eg).innerWidth();ts.p.width=pw>0?pw:"nw"}setColWidth();$(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'>&nbsp;</div>");$(gv).css("width",grid.width+"px");thead=$("thead:first",ts).get(0);var tfoot="<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow'>";var thr=$("tr:first",thead);ts.p.disableClick=false;$("th",thr).each(function(j){var ht=$("div",this)[0];w=ts.p.colModel[j].width;if(typeof ts.p.colModel[j].resizable==="undefined"){ts.p.colModel[j].resizable=true}if(ts.p.colModel[j].resizable){res=document.createElement("span");$(res).html("&#160;").addClass("ui-jqgrid-resize");$(this).addClass(ts.p.resizeclass)}else{res=""}$(this).css("width",w+"px").prepend(res);if(ts.p.colModel[j].hidden){$(this).css("display","none")}grid.headers[j]={width:w,el:this};sort=ts.p.colModel[j].sortable;if(typeof sort!=="boolean"){ts.p.colModel[j].sortable=true;sort=true}var nm=ts.p.colModel[j].name;if(!(nm=="cb"||nm=="subgrid"||nm=="rn")){if(ts.p.viewsortcols[2]){$("div",this).addClass("ui-jqgrid-sortable")}}if(sort){if(ts.p.viewsortcols[0]){$("div span.s-ico",this).show();if(j==ts.p.lastsort){$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled")}}else{if(j==ts.p.lastsort){$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled")}}}tfoot+="<td role='gridcell' "+formatCol(j,0)+">&nbsp;</td>"}).mousedown(function(e){if($(e.target).closest("th>span.ui-jqgrid-resize").length!=1){return}var ci=$.jgrid.getCellIndex(this);if(ts.p.forceFit===true){ts.p.nv=nextVisible(ci)}grid.dragStart(ci,e,getOffset(ci));return false}).click(function(e){if(ts.p.disableClick){ts.p.disableClick=false;return false}var s="th>div.ui-jqgrid-sortable",r,d;if(!ts.p.viewsortcols[2]){s="th>div>span>span.ui-grid-ico-sort"}var t=$(e.target).closest(s);if(t.length!=1){return}var ci=$.jgrid.getCellIndex(this);if(!ts.p.viewsortcols[2]){r=true,d=t.attr("sort")}sortData($("div",this)[0].id,ci,r,d);return false});if(ts.p.sortable&&$.fn.sortable){try{$(ts).jqGrid("sortableColumns",thr)}catch(e){}}tfoot+="</tr></tbody></table>";tbody=document.createElement("tbody");this.appendChild(tbody);$(this).addClass("ui-jqgrid-btable");var hTable=$("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead),hg=(ts.p.caption&&ts.p.hiddengrid===true)?true:false,hb=$("<div class='ui-jqgrid-hbox'></div>");grid.hDiv=document.createElement("div");$(grid.hDiv).css({width:grid.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(hb);$(hb).append(hTable);if(hg){$(grid.hDiv).hide()}ts.p._height=0;if(ts.p.pager){if(typeof ts.p.pager=="string"){if(ts.p.pager.substr(0,1)!="#"){ts.p.pager="#"+ts.p.pager}}$(ts.p.pager).css({width:grid.width+"px"}).appendTo(eg).addClass("ui-state-default ui-jqgrid-pager");ts.p._height+=parseInt($(ts.p.pager).height(),10);if(hg){$(ts.p.pager).hide()}setPager()}if(ts.p.cellEdit===false&&ts.p.hoverrows===true){$(ts).bind("mouseover",function(e){ptr=$(e.target).parents("tr.jqgrow");if($(ptr).attr("class")!=="subgrid"){$(ptr).addClass("ui-state-hover")}return false}).bind("mouseout",function(e){ptr=$(e.target).parents("tr.jqgrow");$(ptr).removeClass("ui-state-hover");return false})}var ri,ci;$(ts).before(grid.hDiv).click(function(e){td=e.target;var scb=$(td).hasClass("cbox");ptr=$(td,ts.rows).parents("tr.jqgrow");if($(ptr).length===0){return this}var cSel=true;if(bSR){cSel=bSR(ptr[0].id,e)}if(td.tagName=="A"||((td.tagName=="INPUT"||td.tagName=="TEXTAREA"||td.tagName=="OPTION"||td.tagName=="SELECT")&&!scb)){return true}if(cSel===true){if(ts.p.cellEdit===true){if(ts.p.multiselect&&scb){$(ts).jqGrid("setSelection",ptr[0].id,true)}else{ri=ptr[0].rowIndex;ci=$.jgrid.getCellIndex(td);try{$(ts).jqGrid("editCell",ri,ci,true)}catch(_){}}}else{if(!ts.p.multikey){if(ts.p.multiselect&&ts.p.multiboxonly){if(scb){$(ts).jqGrid("setSelection",ptr[0].id,true)}else{$(ts.p.selarrrow).each(function(i,n){var ind=ts.rows.namedItem(n);$(ind).removeClass("ui-state-highlight");$("#jqg_"+$.jgrid.jqID(n),ind).attr("checked",false)});ts.p.selarrrow=[];$("#cb_jqg",ts.grid.hDiv).attr("checked",false);$(ts).jqGrid("setSelection",ptr[0].id,true)}}else{$(ts).jqGrid("setSelection",ptr[0].id,true)}}else{if(e[ts.p.multikey]){$(ts).jqGrid("setSelection",ptr[0].id,true)}else{if(ts.p.multiselect&&scb){scb=$("[id^=jqg_]",ptr).attr("checked");$("[id^=jqg_]",ptr).attr("checked",!scb)}}}}if(onSC){ri=ptr[0].id;ci=$.jgrid.getCellIndex(td);onSC(ri,ci,$(td).html(),td)}}e.stopPropagation()}).bind("reloadGrid",function(e){if(ts.p.treeGrid===true){ts.p.datatype=ts.p.treedatatype}if(ts.p.datatype=="local"){$(ts).jqGrid("resetSelection")}else{if(!ts.p.treeGrid){ts.p.selrow=null;if(ts.p.multiselect){ts.p.selarrrow=[];$("#cb_jqg",ts.grid.hDiv).attr("checked",false)}ts.p.savedRow=[];if(ts.p.scroll===true){emptyRows(ts.grid.bDiv)}}}ts.grid.populate();return false});if(ondblClickRow){$(this).dblclick(function(e){td=e.target;ptr=$(td,ts.rows).parents("tr.jqgrow");if($(ptr).length===0){return false}ri=ptr[0].rowIndex;ci=$.jgrid.getCellIndex(td);ts.p.ondblClickRow($(ptr).attr("id"),ri,ci,e);return false})}if(onRightClickRow){$(this).bind("contextmenu",function(e){td=e.target;ptr=$(td,ts.rows).parents("tr.jqgrow");if($(ptr).length===0){return false}if(!ts.p.multiselect){$(ts).jqGrid("setSelection",ptr[0].id,true)}ri=ptr[0].rowIndex;ci=$.jgrid.getCellIndex(td);ts.p.onRightClickRow($(ptr).attr("id"),ri,ci,e);return false})}grid.bDiv=document.createElement("div");$(grid.bDiv).append(this).addClass("ui-jqgrid-bdiv").css({height:ts.p.height+(isNaN(ts.p.height)?"":"px"),width:(grid.width)+"px"}).scroll(function(e){grid.scrollGrid()});$("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"});if(isMSIE){if($("tbody",this).size()==2){$("tbody:first",this).remove()}if(ts.p.multikey){$(grid.bDiv).bind("selectstart",function(){return false})}}else{if(ts.p.multikey){$(grid.bDiv).bind("mousedown",function(){return false})}}if(hg){$(grid.bDiv).hide()}grid.cDiv=document.createElement("div");var arf=ts.p.hidegrid===true?$("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){arf.addClass("ui-state-hover")},function(){arf.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>"):"";$(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title'>"+ts.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix");$(grid.cDiv).insertBefore(grid.hDiv);if(ts.p.toolbar[0]){grid.uDiv=document.createElement("div");if(ts.p.toolbar[1]=="top"){$(grid.uDiv).insertBefore(grid.hDiv)}else{if(ts.p.toolbar[1]=="bottom"){$(grid.uDiv).insertAfter(grid.hDiv)}}if(ts.p.toolbar[1]=="both"){grid.ubDiv=document.createElement("div");$(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);$(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ts.p._height+=IntNum($(grid.ubDiv).height());if(hg){$(grid.ubDiv).hide()}}else{$(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id)}ts.p._height+=IntNum($(grid.uDiv).height());if(hg){$(grid.uDiv).hide()}}if(ts.p.footerrow){grid.sDiv=document.createElement("div");hb=$("<div class='ui-jqgrid-hbox'></div>");$(grid.sDiv).addClass("ui-jqgrid-sdiv").append(hb).insertAfter(grid.hDiv).width(grid.width);$(hb).append(tfoot);grid.footers=$(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells;if(ts.p.rownumbers){grid.footers[0].className="ui-state-default jqgrid-rownum"}if(hg){$(grid.sDiv).hide()}}if(ts.p.caption){ts.p._height+=parseInt($(grid.cDiv,ts).height(),10);var tdt=ts.p.datatype;if(ts.p.hidegrid===true){$(".ui-jqgrid-titlebar-close",grid.cDiv).click(function(){if(ts.p.gridstate=="visible"){$(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+ts.p.id).slideUp("fast");if(ts.p.pager){$(ts.p.pager).slideUp("fast")}if(ts.p.toolbar[0]===true){if(ts.p.toolbar[1]=="both"){$(grid.ubDiv).slideUp("fast")}$(grid.uDiv).slideUp("fast")}if(ts.p.footerrow){$(".ui-jqgrid-sdiv","#gbox_"+ts.p.id).slideUp("fast")}$("span",this).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");ts.p.gridstate="hidden";if(onHdCl){if(!hg){ts.p.onHeaderClick(ts.p.gridstate)}}}else{if(ts.p.gridstate=="hidden"){$(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+ts.p.id).slideDown("fast");if(ts.p.pager){$(ts.p.pager).slideDown("fast")}if(ts.p.toolbar[0]===true){if(ts.p.toolbar[1]=="both"){$(grid.ubDiv).slideDown("fast")}$(grid.uDiv).slideDown("fast")}if(ts.p.footerrow){$(".ui-jqgrid-sdiv","#gbox_"+ts.p.id).slideDown("fast")}$("span",this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(hg){ts.p.datatype=tdt;populate();hg=false}ts.p.gridstate="visible";if(onHdCl){ts.p.onHeaderClick(ts.p.gridstate)}}}return false});if(hg){ts.p.datatype="local";$(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click")}}}else{$(grid.cDiv).hide()}$(grid.hDiv).after(grid.bDiv);$(".ui-jqgrid-labels",grid.hDiv).bind("selectstart",function(){return false}).mousemove(function(e){if(grid.resizing){grid.dragMove(e);return false}});ts.p._height+=parseInt($(grid.hDiv).height(),10);$(document).mouseup(function(e){if(grid.resizing){grid.dragEnd();return false}return true});this.updateColumns=function(){var r=this.rows[0],self=this;if(r){$("td",r).each(function(k){$(this).css("width",self.grid.headers[k].width+"px")});this.grid.cols=r.cells}return this};ts.formatCol=function(a,b){return formatCol(a,b)};ts.sortData=function(a,b,c){sortData(a,b,c)};ts.updatepager=function(a){updatepager(a)};ts.formatter=function(rowId,cellval,colpos,rwdat,act){return formatter(rowId,cellval,colpos,rwdat,act)};$.extend(grid,{populate:function(){populate()}});this.grid=grid;ts.addXmlData=function(d){addXmlData(d,ts.grid.bDiv)};ts.addJSONData=function(d){addJSONData(d,ts.grid.bDiv)};populate();ts.p.hiddengrid=false;$(window).unload(function(){$(this).empty();this.grid=null;this.p=null})})};$.jgrid.extend({getGridParam:function(pName){var $t=this[0];if(!$t.grid){return}if(!pName){return $t.p}else{return $t.p[pName]?$t.p[pName]:null}},setGridParam:function(newParams){return this.each(function(){if(this.grid&&typeof(newParams)==="object"){$.extend(true,this.p,newParams)}})},getDataIDs:function(){var ids=[],i=0,len;this.each(function(){len=this.rows.length;if(len&&len>0){while(i<len){ids[i]=this.rows[i].id;i++}}});return ids},setSelection:function(selection,onsr){return this.each(function(){var $t=this,stat,pt,olr,ner,ia,tpsr;if(selection===undefined){return}onsr=onsr===false?false:true;pt=$t.rows.namedItem(selection);if(pt==null){return}if($t.p.selrow&&$t.p.scrollrows===true){olr=$t.rows.namedItem($t.p.selrow).rowIndex;ner=$t.rows.namedItem(selection).rowIndex;if(ner>=0){if(ner>olr){scrGrid(ner,"d")}else{scrGrid(ner,"u")}}}if(!$t.p.multiselect){if($(pt).attr("class")!=="subgrid"){if($t.p.selrow){$("tr#"+$.jgrid.jqID($t.p.selrow),$t.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false")}$t.p.selrow=pt.id;$(pt).addClass("ui-state-highlight").attr("aria-selected","true");if($t.p.onSelectRow&&onsr){$t.p.onSelectRow($t.p.selrow,true)}}}else{$t.p.selrow=pt.id;ia=$.inArray($t.p.selrow,$t.p.selarrrow);if(ia===-1){if($(pt).attr("class")!=="subgrid"){$(pt).addClass("ui-state-highlight").attr("aria-selected","true")}stat=true;$("#jqg_"+$.jgrid.jqID($t.p.selrow),$t.rows).attr("checked",stat);$t.p.selarrrow.push($t.p.selrow);if($t.p.onSelectRow&&onsr){$t.p.onSelectRow($t.p.selrow,stat)}}else{if($(pt).attr("class")!=="subgrid"){$(pt).removeClass("ui-state-highlight").attr("aria-selected","false")}stat=false;$("#jqg_"+$.jgrid.jqID($t.p.selrow),$t.rows).attr("checked",stat);$t.p.selarrrow.splice(ia,1);if($t.p.onSelectRow&&onsr){$t.p.onSelectRow($t.p.selrow,stat)}tpsr=$t.p.selarrrow[0];$t.p.selrow=(tpsr===undefined)?null:tpsr}}function scrGrid(iR,tp){var ch=$($t.grid.bDiv)[0].clientHeight,st=$($t.grid.bDiv)[0].scrollTop,nROT=$t.rows[iR].offsetTop+$t.rows[iR].clientHeight,pROT=$t.rows[iR].offsetTop;if(tp=="d"){if(nROT>=ch){$($t.grid.bDiv)[0].scrollTop=st+nROT-pROT}}if(tp=="u"){if(pROT<st){$($t.grid.bDiv)[0].scrollTop=st-nROT+pROT}}}})},resetSelection:function(){return this.each(function(){var t=this,ind;if(!t.p.multiselect){if(t.p.selrow){$("tr#"+$.jgrid.jqID(t.p.selrow),t.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");t.p.selrow=null}}else{$(t.p.selarrrow).each(function(i,n){ind=t.rows.namedItem(n);$(ind).removeClass("ui-state-highlight").attr("aria-selected","false");$("#jqg_"+$.jgrid.jqID(n),ind).attr("checked",false)});$("#cb_jqg",t.grid.hDiv).attr("checked",false);t.p.selarrrow=[]}t.p.savedRow=[]})},getRowData:function(rowid){var res={},resall,getall=false,len,j=0;this.each(function(){var $t=this,nm,ind;if(typeof(rowid)=="undefined"){getall=true;resall=[];len=$t.rows.length}else{ind=$t.rows.namedItem(rowid);if(!ind){return res}len=1}while(j<len){if(getall){ind=$t.rows[j]}$("td",ind).each(function(i){nm=$t.p.colModel[i].name;if(nm!=="cb"&&nm!=="subgrid"){if($t.p.treeGrid===true&&nm==$t.p.ExpandColumn){res[nm]=$.jgrid.htmlDecode($("span:first",this).html())}else{try{res[nm]=$.unformat(this,{colModel:$t.p.colModel[i]},i)}catch(e){res[nm]=$.jgrid.htmlDecode($(this).html())}}}});j++;if(getall){resall.push(res);res={}}}});return resall?resall:res},delRowData:function(rowid){var success=false,rowInd,ia,ri;this.each(function(){var $t=this;rowInd=$t.rows.namedItem(rowid);if(!rowInd){return false}else{ri=rowInd.rowIndex;$(rowInd).remove();$t.p.records--;$t.p.reccount--;$t.updatepager(true);success=true;if(rowid==$t.p.selrow){$t.p.selrow=null}ia=$.inArray(rowid,$t.p.selarrrow);if(ia!=-1){$t.p.selarrrow.splice(ia,1)}}if(ri==0&&success){$t.updateColumns()}if($t.p.altRows===true&&success){var cn=$t.p.altclass;$($t.rows).each(function(i){if(i%2==1){$(this).addClass(cn)}else{$(this).removeClass(cn)}})}});return success},setRowData:function(rowid,data,cssp){var nm,success=false;this.each(function(){var t=this,vl,ind,cp=typeof cssp;if(!t.grid){return false}ind=t.rows.namedItem(rowid);if(!ind){return false}if(data){$(this.p.colModel).each(function(i){nm=this.name;if(data[nm]!=undefined){vl=t.formatter(rowid,data[nm],i,data,"edit");if(t.p.treeGrid===true&&nm==t.p.ExpandColumn){$("td:eq("+i+") > span:first",ind).html(vl).attr("title",$.jgrid.stripHtml(vl))}else{$("td:eq("+i+")",ind).html(vl).attr("title",$.jgrid.stripHtml(vl))}success=true}})}if(cp==="string"){$(ind).addClass(cssp)}else{if(cp==="object"){$(ind).css(cssp)}}});return success},addRowData:function(rowid,data,pos,src){if(!pos){pos="last"}var success=false,nm,row,gi=0,si=0,ni=0,sind,i,v,prp="";if(data){this.each(function(){var t=this;rowid=typeof(rowid)!="undefined"?rowid+"":(t.p.records+1)+"";row='<tr id="'+rowid+'" role="row" class="ui-widget-content jqgrow">';if(t.p.rownumbers===true){prp=t.formatCol(ni,1);row+='<td role="gridcell" class="ui-state-default jqgrid-rownum" '+prp+">0</td>";ni=1}if(t.p.multiselect){v='<input type="checkbox" id="jqg_'+rowid+'" class="cbox"/>';prp=t.formatCol(ni,1);row+='<td role="gridcell" '+prp+">"+v+"</td>";gi=1}if(t.p.subGrid===true){row+=$(t).jqGrid("addSubGridCell",gi+ni,1);si=1}for(i=gi+si+ni;i<this.p.colModel.length;i++){nm=this.p.colModel[i].name;v=t.formatter(rowid,data[nm],i,data,"add");prp=t.formatCol(i,1);row+='<td role="gridcell" '+prp+' title="'+$.jgrid.stripHtml(v)+'">'+v+"</td>"}row+="</tr>";if(t.p.subGrid===true){row=$(row)[0];$(t).jqGrid("addSubGrid",row,gi+ni)}if(t.rows.length===0){$("table:first",t.grid.bDiv).append(row)}else{switch(pos){case"last":$(t.rows[t.rows.length-1]).after(row);break;case"first":$(t.rows[0]).before(row);break;case"after":sind=t.rows.namedItem(src);if(sind){$(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")?$(t.rows[sind.rowIndex+1]).after(row):$(sind).after(row)}break;case"before":sind=t.rows.namedItem(src);if(sind){$(sind).before(row);sind=sind.rowIndex}break}}t.p.records++;t.p.reccount++;if(pos==="first"||(pos==="before"&&sind<=1)||t.rows.length===1){t.updateColumns()}if(t.p.altRows===true){var cn=t.p.altclass;if(pos=="last"){if(t.rows.length%2==1){$(t.rows[t.rows.length-1]).addClass(cn)}}else{$(t.rows).each(function(i){if(i%2==1){$(this).addClass(cn)}else{$(this).removeClass(cn)}})}}try{t.p.afterInsertRow(rowid,data)}catch(e){}t.updatepager(true);success=true})}return success},footerData:function(action,data,format){var nm,success=false,res={};function isEmpty(obj){for(var i in obj){return false}return true}if(typeof(action)=="undefined"){action="get"}if(typeof(format)!="boolean"){format=true}action=action.toLowerCase();this.each(function(){var t=this,vl,ind;if(!t.grid||!t.p.footerrow){return false}if(action=="set"){if(isEmpty(data)){return false}}success=true;$(this.p.colModel).each(function(i){nm=this.name;if(action=="set"){if(data[nm]!=undefined){vl=format?t.formatter("",data[nm],i,data,"edit"):data[nm];$("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr("title",$.jgrid.stripHtml(vl));success=true}}else{if(action=="get"){res[nm]=$("tr.footrow td:eq("+i+")",t.grid.sDiv).html()}}})});return action=="get"?res:success},ShowHideCol:function(colname,show){return this.each(function(){var $t=this,fndh=false;if(!$t.grid){return}if(typeof colname==="string"){colname=[colname]}show=show!="none"?"":"none";var sw=show==""?true:false;$(this.p.colModel).each(function(i){if($.inArray(this.name,colname)!==-1&&this.hidden===sw){$("tr",$t.grid.hDiv).each(function(){$("th:eq("+i+")",this).css("display",show)});$($t.rows).each(function(j){$("td:eq("+i+")",$t.rows[j]).css("display",show)});if($t.p.footerrow){$("td:eq("+i+")",$t.grid.sDiv).css("display",show)}if(show=="none"){$t.p.tblwidth-=this.width}else{$t.p.tblwidth+=this.width}this.hidden=!sw;fndh=true}});if(fndh===true){$("table:first",$t.grid.hDiv).width($t.p.tblwidth);$("table:first",$t.grid.bDiv).width($t.p.tblwidth);$t.grid.hDiv.scrollLeft=$t.grid.bDiv.scrollLeft;if($t.p.footerrow){$("table:first",$t.grid.sDiv).width($t.p.tblwidth);$t.grid.sDiv.scrollLeft=$t.grid.bDiv.scrollLeft}}})},hideCol:function(colname){return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"none")})},showCol:function(colname){return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"")})},remapColumns:function(permutation,updateCells,keepHeader){function resortArray(a){var ac;if(a.length){ac=$.makeArray(a)}else{ac=$.extend({},a)}$.each(permutation,function(i){a[i]=ac[this]})}var ts=this.get(0);function resortRows(parent,clobj){$(">tr"+(clobj||""),parent).each(function(){var row=this;var elems=$.makeArray(row.cells);$.each(permutation,function(){var e=elems[this];if(e){row.appendChild(e)}})})}resortArray(ts.p.colModel);resortArray(ts.p.colNames);resortArray(ts.grid.headers);resortRows($("thead:first",ts.grid.hDiv),keepHeader&&":not(.ui-jqgrid-labels)");if(updateCells){resortRows($("tbody:first",ts.grid.bDiv),".jqgrow");if(ts.p.footerrow){resortRows($("tbody:first",ts.grid.sDiv))}}if(ts.p.remapColumns){if(!ts.p.remapColumns.length){ts.p.remapColumns=$.makeArray(permutation)}else{resortArray(ts.p.remapColumns)}}ts.p.lastsort=$.inArray(ts.p.lastsort,permutation);if(ts.p.treeGrid){ts.p.expColInd=$.inArray(ts.p.expColInd,permutation)}},setGridWidth:function(nwidth,shrink){return this.each(function(){var $t=this,cw,initwidth=0,brd=$t.p.cellLayout,lvc,vc=0,isSafari,hs=false,scw=$t.p.scrollOffset,aw,gw=0,tw=0,msw=$t.p.multiselectWidth,sgw=$t.p.subGridWidth,rnw=$t.p.rownumWidth,cl=$t.p.cellLayout,cr;if(!$t.grid){return}if(typeof shrink!="boolean"){shrink=$t.p.shrinkToFit}if(isNaN(nwidth)){return}if(nwidth==$t.grid.width){return}else{$t.grid.width=$t.p.width=nwidth}$("#gbox_"+$t.p.id).css("width",nwidth+"px");$("#gview_"+$t.p.id).css("width",nwidth+"px");$($t.grid.bDiv).css("width",nwidth+"px");$($t.grid.hDiv).css("width",nwidth+"px");if($t.p.pager){$($t.p.pager).css("width",nwidth+"px")}if($t.p.toolbar[0]===true){$($t.grid.uDiv).css("width",nwidth+"px");if($t.p.toolbar[1]=="both"){$($t.grid.ubDiv).css("width",nwidth+"px")}}if($t.p.footerrow){$($t.grid.sDiv).css("width",nwidth+"px")}if(shrink===false&&$t.p.forceFit==true){$t.p.forceFit=false}if(shrink===true){$.each($t.p.colModel,function(i){if(this.hidden===false){initwidth+=parseInt(this.width,10);vc++}});isSafari=$.browser.safari?true:false;if(isSafari){brd=0;msw+=cl;sgw+=cl;rnw+=cl}if($t.p.multiselect){tw=msw;gw=msw+brd;vc--}if($t.p.subGrid){tw+=sgw;gw+=sgw+brd;vc--}if($t.p.rownumbers){tw+=rnw;gw+=rnw+brd;vc--}$t.p.tblwidth=initwidth;aw=nwidth-brd*vc-gw;if(!isNaN($t.p.height)){if($($t.grid.bDiv)[0].clientHeight<$($t.grid.bDiv)[0].scrollHeight){hs=true;aw-=scw}}initwidth=0;var cle=$t.grid.cols.length>0;$.each($t.p.colModel,function(i){var tn=this.name;if(this.hidden===false&&tn!=="cb"&&tn!=="subgrid"&&tn!=="rn"){cw=Math.floor((aw)/($t.p.tblwidth-tw)*this.width);this.width=cw;initwidth+=cw;$t.grid.headers[i].width=cw;$t.grid.headers[i].el.style.width=cw+"px";if($t.p.footerrow){$t.grid.footers[i].style.width=cw+"px"}if(cle){$t.grid.cols[i].style.width=cw+"px"}lvc=i}});cr=0;if(hs&&nwidth-gw-(initwidth+brd*vc)!==scw){cr=nwidth-gw-(initwidth+brd*vc)-scw}else{if(Math.abs(nwidth-gw-(initwidth+brd*vc))!==1){cr=nwidth-gw-(initwidth+brd*vc)}}$t.p.colModel[lvc].width+=cr;cw=$t.p.colModel[lvc].width;$t.grid.headers[lvc].width=cw;$t.grid.headers[lvc].el.style.width=cw+"px";if(cle){$t.grid.cols[lvc].style.width=cw+"px"}$t.p.tblwidth=initwidth+tw+cr;$("table:first",$t.grid.bDiv).css("width",initwidth+tw+cr+"px");$("table:first",$t.grid.hDiv).css("width",initwidth+tw+cr+"px");$t.grid.hDiv.scrollLeft=$t.grid.bDiv.scrollLeft;if($t.p.footerrow){$t.grid.footers[lvc].style.width=cw+"px";$("table:first",$t.grid.sDiv).css("width",initwidth+tw+cr+"px")}}})},setGridHeight:function(nh){return this.each(function(){var $t=this;if(!$t.grid){return}$($t.grid.bDiv).css({height:nh+(isNaN(nh)?"":"px")});$t.p.height=nh})},setCaption:function(newcap){return this.each(function(){this.p.caption=newcap;$("span.ui-jqgrid-title",this.grid.cDiv).html(newcap);$(this.grid.cDiv).show()})},setLabel:function(colname,nData,prop,attrp){return this.each(function(){var $t=this,pos=-1;if(!$t.grid){return}if(isNaN(colname)){$($t.p.colModel).each(function(i){if(this.name==colname){pos=i;return false}})}else{pos=parseInt(colname,10)}if(pos>=0){var thecol=$("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv);if(nData){var ico=$(".s-ico",thecol);$("[id^=jqgh_]",thecol).empty().html(nData).append(ico);$t.p.colNames[pos]=nData}if(prop){if(typeof prop==="string"){$(thecol).addClass(prop)}else{$(thecol).css(prop)}}if(typeof attrp==="object"){$(thecol).attr(attrp)}}})},setCell:function(rowid,colname,nData,cssp,attrp){return this.each(function(){var $t=this,pos=-1,v;if(!$t.grid){return}if(isNaN(colname)){$($t.p.colModel).each(function(i){if(this.name==colname){pos=i;return false}})}else{pos=parseInt(colname,10)}if(pos>=0){var ind=$t.rows.namedItem(rowid);if(ind){var tcell=$("td:eq("+pos+")",ind);if(nData!==""){v=$t.formatter(rowid,nData,pos,ind,"edit");$(tcell).html(v).attr("title",$.jgrid.stripHtml(v))}if(cssp){if(typeof cssp==="string"){$(tcell).addClass(cssp)}else{$(tcell).css(cssp)}}if(typeof attrp==="object"){$(tcell).attr(attrp)}}}})},getCell:function(rowid,col){var ret=false;this.each(function(){var $t=this,pos=-1;if(!$t.grid){return}if(isNaN(col)){$($t.p.colModel).each(function(i){if(this.name===col){pos=i;return false}})}else{pos=parseInt(col,10)}if(pos>=0){var ind=$t.rows.namedItem(rowid);if(ind){try{ret=$.unformat($("td:eq("+pos+")",ind),{colModel:$t.p.colModel[pos]},pos)}catch(e){ret=$.jgrid.htmlDecode($("td:eq("+pos+")",ind).html())}}}});return ret},getCol:function(col,obj,mathopr){var ret=[],val,sum=0;obj=typeof(obj)!="boolean"?false:obj;if(typeof mathopr=="undefined"){mathopr=false}this.each(function(){var $t=this,pos=-1;if(!$t.grid){return}if(isNaN(col)){$($t.p.colModel).each(function(i){if(this.name===col){pos=i;return false}})}else{pos=parseInt(col,10)}if(pos>=0){var ln=$t.rows.length,i=0;if(ln&&ln>0){while(i<ln){try{val=$.unformat($($t.rows[i].cells[pos]),{colModel:$t.p.colModel[pos]},pos)}catch(e){val=$.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML)}mathopr?sum+=parseFloat(val,10):obj?ret.push({id:$t.rows[i].id,value:val}):ret[i]=val;i++}if(mathopr){switch(mathopr.toLowerCase()){case"sum":ret=sum;break;case"avg":ret=sum/ln;break;case"count":ret=ln;break}}}}});return ret},clearGridData:function(clearfooter){return this.each(function(){var $t=this;if(!$t.grid){return}if(typeof clearfooter!="boolean"){clearfooter=false}$("tbody:first tr",$t.grid.bDiv).remove();if($t.p.footerrow&&clearfooter){$(".ui-jqgrid-ftable td",$t.grid.sDiv).html("&nbsp;")}$t.p.selrow=null;$t.p.selarrrow=[];$t.p.savedRow=[];$t.p.records=0;$t.p.page="0";$t.p.lastpage="0";$t.p.reccount=0;$t.updatepager(true)})},getInd:function(rowid,rc){var ret=false,rw;this.each(function(){rw=this.rows.namedItem(rowid);if(rw){ret=rc===true?rw:rw.rowIndex}});return ret}})})(jQuery);(function(a){a.jgrid.extend({editCell:function(d,c,b){return this.each(function(){var k=this,n,l,g;if(!k.grid||k.p.cellEdit!==true){return}c=parseInt(c,10);k.p.selrow=k.rows[d].id;if(!k.p.knv){a(k).jqGrid("GridNav")}if(k.p.savedRow.length>0){if(b===true){if(d==k.p.iRow&&c==k.p.iCol){return}}var h=a("td:eq("+k.p.savedRow[0].ic+")>#"+k.p.savedRow[0].id+"_"+a.jgrid.jqID(k.p.savedRow[0].name),k.rows[k.p.savedRow[0].id]).val();if(k.p.savedRow[0].v!=h){a(k).jqGrid("saveCell",k.p.savedRow[0].id,k.p.savedRow[0].ic)}else{a(k).jqGrid("restoreCell",k.p.savedRow[0].id,k.p.savedRow[0].ic)}}else{window.setTimeout(function(){a("#"+k.p.knv).attr("tabindex","-1").focus()},0)}n=k.p.colModel[c].name;if(n=="subgrid"||n=="cb"||n=="rn"){return}if(k.p.colModel[c].editable===true&&b===true){g=a("td:eq("+c+")",k.rows[d]);if(parseInt(k.p.iCol)>=0&&parseInt(k.p.iRow)>=0){a("td:eq("+k.p.iCol+")",k.rows[k.p.iRow]).removeClass("edit-cell ui-state-highlight");a(k.rows[k.p.iRow]).removeClass("selected-row ui-state-hover")}a(g).addClass("edit-cell ui-state-highlight");a(k.rows[d]).addClass("selected-row ui-state-hover");try{l=a.unformat(g,{colModel:k.p.colModel[c]},c)}catch(m){l=a(g).html()}if(!k.p.colModel[c].edittype){k.p.colModel[c].edittype="text"}k.p.savedRow.push({id:d,ic:c,name:n,v:l});if(a.isFunction(k.p.formatCell)){var j=k.p.formatCell(k.rows[d].id,n,l,d,c);if(j!=undefined){l=j}}var f=a.extend({},k.p.colModel[c].editoptions||{},{id:d+"_"+n,name:n});var e=createEl(k.p.colModel[c].edittype,f,l,true);if(a.isFunction(k.p.beforeEditCell)){k.p.beforeEditCell(k.rows[d].id,n,l,d,c)}a(g).html("").append(e).attr("tabindex","0");window.setTimeout(function(){a(e).focus()},0);a("input, select, textarea",g).bind("keydown",function(o){if(o.keyCode===27){a(k).jqGrid("restoreCell",d,c)}if(o.keyCode===13){a(k).jqGrid("saveCell",d,c)}if(o.keyCode==9){if(o.shiftKey){a(k).jqGrid("prevCell",d,c)}else{a(k).jqGrid("nextCell",d,c)}}o.stopPropagation()});if(a.isFunction(k.p.afterEditCell)){k.p.afterEditCell(k.rows[d].id,n,l,d,c)}}else{if(parseInt(k.p.iCol)>=0&&parseInt(k.p.iRow)>=0){a("td:eq("+k.p.iCol+")",k.rows[k.p.iRow]).removeClass("edit-cell ui-state-highlight");a(k.rows[k.p.iRow]).removeClass("selected-row ui-state-hover")}a("td:eq("+c+")",k.rows[d]).addClass("edit-cell ui-state-highlight");a(k.rows[d]).addClass("selected-row ui-state-hover");if(a.isFunction(k.p.onSelectCell)){l=a("td:eq("+c+")",k.rows[d]).html().replace(/\&nbsp\;/ig,"");k.p.onSelectCell(k.rows[d].id,n,l,d,c)}}k.p.iCol=c;k.p.iRow=d})},saveCell:function(c,b){return this.each(function(){var l=this,n;if(!l.grid||l.p.cellEdit!==true){return}if(l.p.savedRow.length>=1){n=0}else{n=null}if(n!=null){var h=a("td:eq("+b+")",l.rows[c]),s,q,t=l.p.colModel[b].name,g=a.jgrid.jqID(t);switch(l.p.colModel[b].edittype){case"select":if(!l.p.colModel[b].editoptions.multiple){s=a("#"+c+"_"+g+">option:selected",l.rows[c]).val();q=a("#"+c+"_"+g+">option:selected",l.rows[c]).text()}else{var d=a("#"+c+"_"+g,l.rows[c]),f=[];s=a(d).val();if(s){s.join(",")}else{s=""}a("option:selected",d).each(function(e,u){f[e]=a(u).text()});q=f.join(",")}if(l.p.colModel[b].formatter){q=s}break;case"checkbox":var j=["Yes","No"];if(l.p.colModel[b].editoptions){j=l.p.colModel[b].editoptions.value.split(":")}s=a("#"+c+"_"+g,l.rows[c]).attr("checked")?j[0]:j[1];q=s;break;case"password":case"text":case"textarea":case"button":s=!l.p.autoencode?a("#"+c+"_"+g,l.rows[c]).val():a.jgrid.htmlEncode(a("#"+c+"_"+g,l.rows[c]).val());q=s;break}if(q!=l.p.savedRow[n].v){if(a.isFunction(l.p.beforeSaveCell)){var r=l.p.beforeSaveCell(l.rows[c].id,t,s,c,b);if(r){s=r}}var k=checkValues(s,b,l);if(k[0]===true){var m={};if(a.isFunction(l.p.beforeSubmitCell)){m=l.p.beforeSubmitCell(l.rows[c].id,t,s,c,b);if(!m){m={}}}if(q==""){q=" "}if(l.p.cellsubmit=="remote"){if(l.p.cellurl){var p={};p[t]=s;p.id=l.rows[c].id;p=a.extend(m,p);a.ajax({url:l.p.cellurl,data:p,type:"POST",complete:function(e,v){if(v=="success"){if(a.isFunction(l.p.afterSubmitCell)){var u=l.p.afterSubmitCell(e,p.id,t,s,c,b);if(u[0]===true){a(h).empty();a(l).jqGrid("setCell",l.rows[c].id,b,q);a(h).addClass("dirty-cell");a(l.rows[c]).addClass("edited");if(a.isFunction(l.p.afterSaveCell)){l.p.afterSaveCell(l.rows[c].id,t,s,c,b)}l.p.savedRow.splice(0,1)}else{info_dialog(a.jgrid.errors.errcap,u[1],a.jgrid.edit.bClose);a(l).jqGrid("restoreCell",c,b)}}else{a(h).empty();a(l).jqGrid("setCell",l.rows[c].id,b,q);a(h).addClass("dirty-cell");a(l.rows[c]).addClass("edited");if(a.isFunction(l.p.afterSaveCell)){l.p.afterSaveCell(l.rows[c].id,t,s,c,b)}l.p.savedRow.splice(0,1)}}},error:function(e,u){if(a.isFunction(l.p.errorCell)){l.p.errorCell(e,u);a(l).jqGrid("restoreCell",c,b)}else{info_dialog(a.jgrid.errors.errcap,e.status+" : "+e.statusText+"<br/>"+u,a.jgrid.edit.bClose);a(l).jqGrid("restoreCell",c,b)}}})}else{try{info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose);a(l).jqGrid("restoreCell",c,b)}catch(o){}}}if(l.p.cellsubmit=="clientArray"){a(h).empty();a(l).jqGrid("setCell",l.rows[c].id,b,q);a(h).addClass("dirty-cell");a(l.rows[c]).addClass("edited");if(a.isFunction(l.p.afterSaveCell)){l.p.afterSaveCell(l.rows[c].id,t,s,c,b)}l.p.savedRow.splice(0,1)}}else{try{window.setTimeout(function(){info_dialog(a.jgrid.errors.errcap,s+" "+k[1],a.jgrid.edit.bClose)},100);a(l).jqGrid("restoreCell",c,b)}catch(o){}}}else{a(l).jqGrid("restoreCell",c,b)}}if(a.browser.opera){a("#"+l.p.knv).attr("tabindex","-1").focus()}else{window.setTimeout(function(){a("#"+l.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(c,b){return this.each(function(){var h=this,d;if(!h.grid||h.p.cellEdit!==true){return}if(h.p.savedRow.length>=1){d=0}else{d=null}if(d!=null){var g=a("td:eq("+b+")",h.rows[c]);if(a.isFunction(a.fn.datepicker)){try{a("input.hasDatepicker",g).datepicker("hide")}catch(f){}}a(g).empty().attr("tabindex","-1");a(h).jqGrid("setCell",h.rows[c].id,b,h.p.savedRow[d].v);h.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+h.p.knv).attr("tabindex","-1").focus()},0)})},nextCell:function(c,b){return this.each(function(){var f=this,e=false;if(!f.grid||f.p.cellEdit!==true){return}for(var d=b+1;d<f.p.colModel.length;d++){if(f.p.colModel[d].editable===true){e=d;break}}if(e!==false){a(f).jqGrid("editCell",c,e,true)}else{if(f.p.savedRow.length>0){a(f).jqGrid("saveCell",c,b)}}})},prevCell:function(c,b){return this.each(function(){var f=this,e=false;if(!f.grid||f.p.cellEdit!==true){return}for(var d=b-1;d>=0;d--){if(f.p.colModel[d].editable===true){e=d;break}}if(e!==false){a(f).jqGrid("editCell",c,e,true)}else{if(f.p.savedRow.length>0){a(f).jqGrid("saveCell",c,b)}}})},GridNav:function(){return this.each(function(){var f=this;if(!f.grid||f.p.cellEdit!==true){return}f.p.knv=a("table:first",f.grid.bDiv).attr("id")+"_kn";var e=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+f.p.knv+"'></span></span>"),c;a(e).insertBefore(f.grid.cDiv);a("#"+f.p.knv).focus();a("#"+f.p.knv).keydown(function(g){switch(g.keyCode){case 38:if(f.p.iRow-1>=0){d(f.p.iRow-1,f.p.iCol,"vu");a(f).jqGrid("editCell",f.p.iRow-1,f.p.iCol,false)}break;case 40:if(f.p.iRow+1<=f.rows.length-1){d(f.p.iRow+1,f.p.iCol,"vd");a(f).jqGrid("editCell",f.p.iRow+1,f.p.iCol,false)}break;case 37:if(f.p.iCol-1>=0){c=b(f.p.iCol-1,"lft");d(f.p.iRow,c,"h");a(f).jqGrid("editCell",f.p.iRow,c,false)}break;case 39:if(f.p.iCol+1<=f.p.colModel.length-1){c=b(f.p.iCol+1,"rgt");d(f.p.iRow,c,"h");a(f).jqGrid("editCell",f.p.iRow,c,false)}break;case 13:if(parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0){a(f).jqGrid("editCell",f.p.iRow,f.p.iCol,true)}break}return false});function d(p,n,o){if(o.substr(0,1)=="v"){var g=a(f.grid.bDiv)[0].clientHeight,q=a(f.grid.bDiv)[0].scrollTop,r=f.rows[p].offsetTop+f.rows[p].clientHeight,l=f.rows[p].offsetTop;if(o=="vd"){if(r>=g){a(f.grid.bDiv)[0].scrollTop=a(f.grid.bDiv)[0].scrollTop+f.rows[p].clientHeight}}if(o=="vu"){if(l<q){a(f.grid.bDiv)[0].scrollTop=a(f.grid.bDiv)[0].scrollTop-f.rows[p].clientHeight}}}if(o=="h"){var k=a(f.grid.bDiv)[0].clientWidth,j=a(f.grid.bDiv)[0].scrollLeft,h=f.rows[p].cells[n].offsetLeft+f.rows[p].cells[n].clientWidth,m=f.rows[p].cells[n].offsetLeft;if(h>=k+parseInt(j)){a(f.grid.bDiv)[0].scrollLeft=a(f.grid.bDiv)[0].scrollLeft+f.rows[p].cells[n].clientWidth}else{if(m<j){a(f.grid.bDiv)[0].scrollLeft=a(f.grid.bDiv)[0].scrollLeft-f.rows[p].cells[n].clientWidth}}}}function b(k,g){var j,h;if(g=="lft"){j=k+1;for(h=k;h>=0;h--){if(f.p.colModel[h].hidden!==true){j=h;break}}}if(g=="rgt"){j=k-1;for(h=k;h<f.p.colModel.length;h++){if(f.p.colModel[h].hidden!==true){j=h;break}}}return j}})},getChangedCells:function(c){var b=[];if(!c){c="all"}this.each(function(){var e=this,d;if(!e.grid||e.p.cellEdit!==true){return}a(e.rows).each(function(f){var g={};if(a(this).hasClass("edited")){a("td",this).each(function(h){d=e.p.colModel[h].name;if(d!=="cb"&&d!=="subgrid"){if(c=="dirty"){if(a(this).hasClass("dirty-cell")){try{g[d]=a.unformat(this,{colModel:e.p.colModel[h]},h)}catch(j){g[d]=a.jgrid.htmlDecode(a(this).html())}}}else{try{g[d]=a.unformat(this,{colModel:e.p.colModel[h]},h)}catch(j){g[d]=a.jgrid.htmlDecode(a(this).html())}}}});g.id=this.id;b.push(g)}})});return b}})})(jQuery);var showModal=function(a){a.w.show()};var closeModal=function(a){a.w.hide().attr("aria-hidden","true");if(a.o){a.o.remove()}};var createModal=function(j,d,a,l,n,m){var h=document.createElement("div");h.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";h.id=j.themodal;var b=document.createElement("div");b.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";b.id=j.modalhead;jQuery(b).append("<span class='ui-jqdialog-title'>"+a.caption+"</span>");var k=jQuery("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){k.addClass("ui-state-hover")},function(){k.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");jQuery(b).append(k);var g=document.createElement("div");jQuery(g).addClass("ui-jqdialog-content ui-widget-content").attr("id",j.modalcontent);jQuery(g).append(d);h.appendChild(g);jQuery(h).prepend(b);if(m===true){jQuery("body").append(h)}else{jQuery(h).insertBefore(l)}if(typeof a.jqModal==="undefined"){a.jqModal=true}if(jQuery.fn.jqm&&a.jqModal===true){if(a.left==0&&a.top==0){var f=[];f=findPos(n);a.left=f[0]+4;a.top=f[1]+4}}jQuery("a.ui-jqdialog-titlebar-close",b).click(function(p){var o=jQuery("#"+j.themodal).data("onClose")||a.onClose;var q=jQuery("#"+j.themodal).data("gbox")||a.gbox;hideModal("#"+j.themodal,{gb:q,jqm:a.jqModal,onClose:o});return false});if(a.width==0||!a.width){a.width=300}if(a.height==0||!a.height){a.height=200}if(!a.zIndex){a.zIndex=950}jQuery(h).css({top:a.top+"px",left:a.left+"px",width:isNaN(a.width)?"auto":a.width+"px",height:isNaN(a.height)?"auto":a.height+"px",zIndex:a.zIndex,overflow:"hidden"}).attr({tabIndex:"-1",role:"dialog","aria-labelledby":j.modalhead,"aria-hidden":"true"});if(typeof a.drag=="undefined"){a.drag=true}if(typeof a.resize=="undefined"){a.resize=true}if(a.drag){jQuery(b).css("cursor","move");if(jQuery.fn.jqDrag){jQuery(h).jqDrag(b)}else{try{jQuery(h).draggable({handle:jQuery("#"+b.id)})}catch(c){}}}if(a.resize){if(jQuery.fn.jqResize){jQuery(h).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");jQuery("#"+j.themodal).jqResize(".jqResize",j.scrollelm?"#"+j.scrollelm:false)}else{try{jQuery(h).resizable({handles:"se",alsoResize:j.scrollelm?"#"+j.scrollelm:false})}catch(c){}}}if(a.closeOnEscape===true){jQuery(h).keydown(function(p){if(p.which==27){var o=jQuery("#"+j.themodal).data("onClose")||a.onClose;hideModal(this,{gb:a.gbox,jqm:a.jqModal,onClose:o})}})}};var viewModal=function(a,c){c=jQuery.extend({toTop:true,overlay:10,modal:false,onShow:showModal,onHide:closeModal,gbox:"",jqm:true,jqM:true},c||{});if(jQuery.fn.jqm&&c.jqm==true){if(c.jqM){jQuery(a).attr("aria-hidden","false").jqm(c).jqmShow()}else{jQuery(a).attr("aria-hidden","false").jqmShow()}}else{if(c.gbox!=""){jQuery(".jqgrid-overlay:first",c.gbox).show();jQuery(a).data("gbox",c.gbox)}jQuery(a).show().attr("aria-hidden","false");try{jQuery(":input:visible",a)[0].focus()}catch(b){}}};var hideModal=function(a,d){d=jQuery.extend({jqm:true,gb:""},d||{});if(d.onClose){var b=d.onClose(a);if(typeof b=="boolean"&&!b){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(c){}}jQuery(a).hide().attr("aria-hidden","true")}};function info_dialog(l,f,b,k){var g={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:"<b>"+l+"</b>",left:250,top:170,jqModal:true,closeOnEscape:true,align:"center",buttonalign:"center"};jQuery.extend(g,k||{});var c=g.jqModal;if(jQuery.fn.jqm&&!c){c=false}var h=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px",j="text-align:"+g.align+";";var a="<div id='info_id'>";a+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+h+";"+j+"'>"+f+"</div>";a+=b?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+b+"</a></div>":"";a+="</div>";try{jQuery("#info_dialog").remove()}catch(d){}createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},a,g,"","",true);jQuery("#closedialog","#info_id").click(function(m){hideModal("#info_dialog",{jqm:c});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(e){e.w.hide().remove();if(e.o){e.o.remove()}},modal:true,jqm:c})}function findPos(a){var b=curtop=0;if(a.offsetParent){do{b+=a.offsetLeft;curtop+=a.offsetTop}while(a=a.offsetParent)}return[b,curtop]}function isArray(a){if(a.constructor.toString().indexOf("Array")==-1){return false}else{return true}}function createEl(h,r,f,s){var g="";if(r.defaultValue){delete r.defaultValue}function o(t,e){if(jQuery.isFunction(e.dataInit)){t.id=e.id;e.dataInit(t);delete e.id;delete e.dataInit}if(e.dataEvents){jQuery.each(e.dataEvents,function(){if(this.data!=null){jQuery(t).bind(this.type,this.data,this.fn)}else{jQuery(t).bind(this.type,this.fn)}});delete e.dataEvents}return e}switch(h){case"textarea":g=document.createElement("textarea");if(s){if(!r.cols){jQuery(g).css({width:"98%"})}}else{if(!r.cols){r.cols=20}}if(!r.rows){r.rows=2}if(f=="&nbsp;"||f=="&#160;"||(f.length==1&&f.charCodeAt(0)==160)){f=""}g.value=f;r=o(g,r);jQuery(g).attr(r);break;case"checkbox":g=document.createElement("input");g.type="checkbox";if(!r.value){var p=f.toLowerCase();if(p.search(/(false|0|no|off|undefined)/i)<0&&p!==""){g.checked=true;g.defaultChecked=true;g.value=f}else{g.value="on"}jQuery(g).attr("offval","off")}else{var a=r.value.split(":");if(f===a[0]){g.checked=true;g.defaultChecked=true}g.value=a[0];jQuery(g).attr("offval",a[1]);try{delete r.value}catch(l){}}r=o(g,r);jQuery(g).attr(r);break;case"select":g=document.createElement("select");var q=r.multiple===true?true:false;if(r.dataUrl!=null){jQuery.get(r.dataUrl,{_nsd:(new Date().getTime())},function(u){try{delete r.dataUrl;delete r.value}catch(v){}var t=jQuery(u).html();jQuery(g).append(t);r=o(g,r);if(typeof r.size==="undefined"){r.size=q?3:1}jQuery(g).attr(r);setTimeout(function(){jQuery("option",g).each(function(e){if(jQuery(this).text()==f||jQuery(this).val()==f){this.selected="selected";return false}})},0)},"html")}else{if(r.value){var j=[],k;if(q){j=f.split(",");j=jQuery.map(j,function(e){return jQuery.trim(e)});if(typeof r.size==="undefined"){r.size=3}}else{r.size=1}if(typeof r.value==="function"){r.value=r.value()}if(typeof r.value==="string"){var c=r.value.split(";"),n,d;for(k=0;k<c.length;k++){n=c[k].split(":");d=document.createElement("option");d.value=n[0];d.innerHTML=n[1];if(!q&&(n[0]==f||n[1]==f)){d.selected="selected"}if(q&&(jQuery.inArray(n[1],j)>-1||jQuery.inArray(n[0],j)>-1)){d.selected="selected"}g.appendChild(d)}}else{if(typeof r.value==="object"){var b=r.value;k=0;for(var m in b){k++;d=document.createElement("option");d.value=m;d.innerHTML=b[m];if(!q&&(m==f||b[m]==f)){d.selected="selected"}if(q&&(jQuery.inArray(b[m],j)>-1||jQuery.inArray(m,j)>-1)){d.selected="selected"}g.appendChild(d)}}}r=o(g,r);try{delete r.value}catch(l){}jQuery(g).attr(r)}}break;case"text":case"password":case"button":g=document.createElement("input");g.type=h;g.value=jQuery.jgrid.htmlDecode(f);r=o(g,r);if(h!="button"){if(s){if(!r.size){jQuery(g).css({width:"98%"})}}else{if(!r.size){r.size=20}}}jQuery(g).attr(r);break;case"image":case"file":g=document.createElement("input");g.type=h;r=o(g,r);jQuery(g).attr(r);break}return g}function checkValues(c,l,j){var f,h,m;if(typeof(l)=="string"){for(h=0,len=j.p.colModel.length;h<len;h++){if(j.p.colModel[h].name==l){f=j.p.colModel[h].editrules;l=h;try{m=j.p.colModel[h].formoptions.label}catch(k){}break}}}else{if(l>=0){f=j.p.colModel[l].editrules}}if(f){if(!m){m=j.p.colNames[l]}if(f.required===true){if(c.match(/^s+$/)||c==""){return[false,m+": "+jQuery.jgrid.edit.msg.required,""]}}var d=f.required===false?false:true;if(f.number===true){if(!(d===false&&isEmpty(c))){if(isNaN(c)){return[false,m+": "+jQuery.jgrid.edit.msg.number,""]}}}if(typeof f.minValue!="undefined"&&!isNaN(f.minValue)){if(parseFloat(c)<parseFloat(f.minValue)){return[false,m+": "+jQuery.jgrid.edit.msg.minValue+" "+f.minValue,""]}}if(typeof f.maxValue!="undefined"&&!isNaN(f.maxValue)){if(parseFloat(c)>parseFloat(f.maxValue)){return[false,m+": "+jQuery.jgrid.edit.msg.maxValue+" "+f.maxValue,""]}}var a;if(f.email===true){if(!(d===false&&isEmpty(c))){a=/^((([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(!a.test(c)){return[false,m+": "+jQuery.jgrid.edit.msg.email,""]}}}if(f.integer===true){if(!(d===false&&isEmpty(c))){if(isNaN(c)){return[false,m+": "+jQuery.jgrid.edit.msg.integer,""]}if((c%1!=0)||(c.indexOf(".")!=-1)){return[false,m+": "+jQuery.jgrid.edit.msg.integer,""]}}}if(f.date===true){if(!(d===false&&isEmpty(c))){var b=j.p.colModel[l].datefmt||"Y-m-d";if(!checkDate(b,c)){return[false,m+": "+jQuery.jgrid.edit.msg.date+" - "+b,""]}}}if(f.time===true){if(!(d===false&&isEmpty(c))){if(!checkTime(c)){return[false,m+": "+jQuery.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]}}}if(f.url===true){if(!(d===false&&isEmpty(c))){a=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!a.test(c)){return[false,m+": "+jQuery.jgrid.edit.msg.url,""]}}}}return[true,"",""]}function checkDate(l,c){var e={},n;l=l.toLowerCase();if(l.indexOf("/")!=-1){n="/"}else{if(l.indexOf("-")!=-1){n="-"}else{if(l.indexOf(".")!=-1){n="."}else{n="/"}}}l=l.split(n);c=c.split(n);if(c.length!=3){return false}var f=-1,m,g=-1,d=-1;for(var h=0;h<l.length;h++){var b=isNaN(c[h])?0:parseInt(c[h],10);e[l[h]]=b;m=l[h];if(m.indexOf("y")!=-1){f=h}if(m.indexOf("m")!=-1){d=h}if(m.indexOf("d")!=-1){g=h}}if(l[f]=="y"||l[f]=="yyyy"){m=4}else{if(l[f]=="yy"){m=2}else{m=-1}}var a=DaysArray(12);var k;if(f===-1){return false}else{k=e[l[f]].toString();if(m==2&&k.length==1){m=1}if(k.length!=m||e[l[f]]==0){return false}}if(d===-1){return false}else{k=e[l[d]].toString();if(k.length<1||e[l[d]]<1||e[l[d]]>12){return false}}if(g===-1){return false}else{k=e[l[g]].toString();if(k.length<1||e[l[g]]<1||e[l[g]]>31||(e[l[d]]==2&&e[l[g]]>daysInFebruary(e[l[f]]))||e[l[g]]>a[e[l[d]]]){return false}}return true}function daysInFebruary(a){return(((a%4==0)&&((!(a%100==0))||(a%400==0)))?29:28)}function DaysArray(b){for(var a=1;a<=b;a++){this[a]=31;if(a==4||a==6||a==9||a==11){this[a]=30}if(a==2){this[a]=29}}return this}function isEmpty(a){if(a.match(/^s+$/)||a==""){return true}else{return false}}function checkTime(c){var b=/^(\d{1,2}):(\d{2})([ap]m)?$/,a;if(!isEmpty(c)){a=c.match(b);if(a){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(a){a.jgrid.extend({getColProp:function(d){var b={},f=this[0];if(!f.grid){return}var e=f.p.colModel;for(var c=0;c<e.length;c++){if(e[c].name==d){b=e[c];break}}return b},setColProp:function(c,b){return this.each(function(){if(this.grid){if(b){var e=this.p.colModel;for(var d=0;d<e.length;d++){if(e[d].name==c){a.extend(this.p.colModel[d],b);break}}}}})},sortGrid:function(c,b){return this.each(function(){var g=this,d=-1;if(!g.grid){return}if(!c){c=g.p.sortname}for(var f=0;f<g.p.colModel.length;f++){if(g.p.colModel[f].index==c||g.p.colModel[f].name==c){d=f;break}}if(d!=-1){var e=g.p.colModel[d].sortable;if(typeof e!=="boolean"){e=true}if(typeof b!=="boolean"){b=false}if(e){g.sortData("jqgh_"+c,d,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){if(this.p.pager){a(this.p.pager).remove()}var c=this.id;try{a("#gbox_"+c).remove()}catch(b){}}})},GridUnload:function(){return this.each(function(){if(!this.grid){return}var d={id:a(this).attr("id"),cl:a(this).attr("class")};if(this.p.pager){a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom")}var b=document.createElement("table");a(b).attr({id:d.id});b.className=d.cl;var c=this.id;a(b).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+c).length===1){a(b).insertBefore("#gbox_"+c).show();a(this.p.pager).insertBefore("#gbox_"+c)}else{a(b).insertBefore("#gbox_"+c).show()}a("#gbox_"+c).remove()})},setGridState:function(b){return this.each(function(){if(!this.grid){return}$t=this;if(b=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+$t.p.id).slideUp("fast");if($t.p.pager){a($t.p.pager).slideUp("fast")}if($t.p.toolbar[0]===true){if($t.p.toolbar[1]=="both"){a($t.grid.ubDiv).slideUp("fast")}a($t.grid.uDiv).slideUp("fast")}if($t.p.footerrow){a(".ui-jqgrid-sdiv","#gbox_"+$s.p.id).slideUp("fast")}a(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");$t.p.gridstate="hidden"}else{if(b=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+$t.p.id).slideDown("fast");if($t.p.pager){a($t.p.pager).slideDown("fast")}if($t.p.toolbar[0]===true){if($t.p.toolbar[1]=="both"){a($t.grid.ubDiv).slideDown("fast")}a($t.grid.uDiv).slideDown("fast")}if($t.p.footerrow){a(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideDown("fast")}a(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");$t.p.gridstate="visible"}}})},updateGridRows:function(e,c,d){var b,f=false;this.each(function(){var h=this,k,l,j,g;if(!h.grid){return false}if(!c){c="id"}if(e&&e.length>0){a(e).each(function(n){j=this;l=h.rows.namedItem(j[c]);if(l){g=j[c];if(d===true){if(h.p.jsonReader.repeatitems===true){if(h.p.jsonReader.cell){j=j[h.p.jsonReader.cell]}for(var m=0;m<j.length;m++){k=h.formatter(g,j[m],m,j,"edit");if(h.p.treeGrid===true&&b==h.p.ExpandColumn){a("td:eq("+m+") > span:first",l).html(k).attr("title",a.jgrid.stripHtml(k))}else{a("td:eq("+m+")",l).html(k).attr("title",a.jgrid.stripHtml(k))}}f=true;return true}}a(h.p.colModel).each(function(o){b=d===true?this.jsonmap||this.name:this.name;if(j[b]!=undefined){k=h.formatter(g,j[b],o,j,"edit");if(h.p.treeGrid===true&&b==h.p.ExpandColumn){a("td:eq("+o+") > span:first",l).html(k).attr("title",a.jgrid.stripHtml(k))}else{a("td:eq("+o+")",l).html(k).attr("title",a.jgrid.stripHtml(k))}f=true}})}})}});return f},filterGrid:function(c,b){b=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},b||{});return this.each(function(){var m=this;this.p=b;if(this.p.filterModel.length==0&&this.p.gridModel===false){alert("No filter is set");return}if(!c){alert("No target grid is set!");return}this.p.gridid=c.indexOf("#")!=-1?c:"#"+c;var d=a(this.p.gridid).jqGrid("getGridParam","colModel");if(d){if(this.p.gridModel===true){var e=a(this.p.gridid)[0];var g;a.each(d,function(p,q){var o=[];this.search=this.search===false?false:true;if(this.editrules&&this.editrules.searchhidden===true){g=true}else{if(this.hidden===true){g=false}else{g=true}}if(this.search===true&&g===true){if(m.p.gridNames===true){o.label=e.p.colNames[p]}else{o.label=""}o.name=this.name;o.index=this.index||this.name;o.stype=this.edittype||"text";if(o.stype!="select"){o.stype="text"}o.defval=this.defval||"";o.surl=this.surl||"";o.sopt=this.editoptions||{};o.width=this.width;m.p.filterModel.push(o)}})}else{a.each(m.p.filterModel,function(p,q){for(var o=0;o<d.length;o++){if(this.name==d[o].name){this.index=d[o].index||this.name;break}}if(!this.index){this.index=this.name}})}}else{alert("Could not get grid colModel");return}var h=function(){var r={},q=0,o;var p=a(m.p.gridid)[0],n;p.p.searchdata={};if(a.isFunction(m.p.beforeSearch)){m.p.beforeSearch()}a.each(m.p.filterModel,function(u,w){n=this.index;switch(this.stype){case"select":o=a("select[name="+n+"]",m).val();if(o){r[n]=o;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}break;default:o=a("input[name="+n+"]",m).val();if(o){r[n]=o;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}}});var s=q>0?true:false;a.extend(p.p.postData,r);var t;if(m.p.url){t=a(p).jqGrid("getGridParam","url");a(p).jqGrid("setGridParam",{url:m.p.url})}a(p).jqGrid("setGridParam",{search:s,page:1}).trigger("reloadGrid");if(t){a(p).jqGrid("setGridParam",{url:t})}if(a.isFunction(m.p.afterSearch)){m.p.afterSearch()}};var l=function(){var r={},o,q=0;var p=a(m.p.gridid)[0],n;if(a.isFunction(m.p.beforeClear)){m.p.beforeClear()}a.each(m.p.filterModel,function(u,x){n=this.index;o=(this.defval)?this.defval:"";if(!this.stype){this.stype=="text"}switch(this.stype){case"select":var w;a("select[name="+n+"] option",m).each(function(y){if(y==0){this.selected=true}if(a(this).text()==o){this.selected=true;w=a(this).val();return false}});if(w){r[n]=w;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}break;case"text":a("input[name="+n+"]",m).val(o);if(o){r[n]=o;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}break}});var s=q>0?true:false;a.extend(p.p.postData,r);var t;if(m.p.url){t=a(p).jqGrid("getGridParam","url");a(p).jqGrid("setGridParam",{url:m.p.url})}a(p).jqGrid("setGridParam",{search:s,page:1}).trigger("reloadGrid");if(t){a(p).jqGrid("setGridParam",{url:t})}if(a.isFunction(m.p.afterClear)){m.p.afterClear()}};var j=function(){var r=document.createElement("tr");var o,t,n,p,s,q;if(m.p.formtype=="horizontal"){a(f).append(r)}a.each(m.p.filterModel,function(B,w){p=document.createElement("td");a(p).append("<label for='"+this.name+"'>"+this.label+"</label>");s=document.createElement("td");var A=this;if(!this.stype){this.stype="text"}switch(this.stype){case"select":if(this.surl){a(s).load(this.surl,function(){if(A.defval){a("select",this).val(A.defval)}a("select",this).attr({name:A.index||A.name,id:"sg_"+A.name});if(A.sopt){a("select",this).attr(A.sopt)}if(m.p.gridToolbar===true&&A.width){a("select",this).width(A.width)}if(m.p.autosearch===true){a("select",this).change(function(F){h();return false})}})}else{if(A.sopt.value){var u=A.sopt.value;var x=document.createElement("select");a(x).attr({name:A.index||A.name,id:"sg_"+A.name}).attr(A.sopt);if(typeof u==="string"){var v=u.split(";"),E,y;for(var z=0;z<v.length;z++){E=v[z].split(":");y=document.createElement("option");y.value=E[0];y.innerHTML=E[1];if(E[1]==A.defval){y.selected="selected"}x.appendChild(y)}}else{if(typeof u==="object"){for(var D in u){B++;y=document.createElement("option");y.value=D;y.innerHTML=u[D];if(u[D]==A.defval){y.selected="selected"}x.appendChild(y)}}}if(m.p.gridToolbar===true&&A.width){a(x).width(A.width)}a(s).append(x);if(m.p.autosearch===true){a(x).change(function(F){h();return false})}}}break;case"text":var C=this.defval?this.defval:"";a(s).append("<input type='text' name='"+(this.index||this.name)+"' id='sg_"+this.name+"' value='"+C+"'/>");if(A.sopt){a("input",s).attr(A.sopt)}if(m.p.gridToolbar===true&&A.width){if(a.browser.msie){a("input",s).width(A.width-4)}else{a("input",s).width(A.width-2)}}if(m.p.autosearch===true){a("input",s).keypress(function(G){var F=G.charCode?G.charCode:G.keyCode?G.keyCode:0;if(F==13){h();return false}return this})}break}if(m.p.formtype=="horizontal"){if(m.p.gridToolbar===true&&m.p.gridNames===false){a(r).append(s)}else{a(r).append(p).append(s)}a(r).append(s)}else{o=document.createElement("tr");a(o).append(p).append(s);a(f).append(o)}});s=document.createElement("td");if(m.p.enableSearch===true){t="<input type='button' id='sButton' class='"+m.p.buttonclass+"' value='"+m.p.searchButton+"'/>";a(s).append(t);a("input#sButton",s).click(function(){h();return false})}if(m.p.enableClear===true){n="<input type='button' id='cButton' class='"+m.p.buttonclass+"' value='"+m.p.clearButton+"'/>";a(s).append(n);a("input#cButton",s).click(function(){l();return false})}if(m.p.enableClear===true||m.p.enableSearch===true){if(m.p.formtype=="horizontal"){a(r).append(s)}else{o=document.createElement("tr");a(o).append("<td>&nbsp;</td>").append(s);a(f).append(o)}}};var k=a("<form name='SearchForm' style=display:inline;' class='"+this.p.formclass+"'></form>");var f=a("<table class='"+this.p.tableclass+"' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");a(k).append(f);j();a(this).append(k);this.triggerSearch=function(){h()};this.clearSearch=function(){l()}})},filterToolbar:function(b){b=a.extend({autosearch:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:""},b||{});return this.each(function(){var g=this;var c=function(){var p={},o=0,n,m;g.p.searchdata={};if(a.isFunction(b.beforeSearch)){b.beforeSearch()}a.each(g.p.colModel,function(s,u){m=this.index||this.name;switch(this.stype){case"select":n=a("select[name="+m+"]",g.grid.hDiv).val();if(n){p[m]=n;o++}else{try{delete g.p.postData[m]}catch(t){}}break;case"text":n=a("input[name="+m+"]",g.grid.hDiv).val();if(n){p[m]=n;o++}else{try{delete g.p.postData[m]}catch(t){}}break}});var q=o>0?true:false;a.extend(g.p.postData,p);var r;if(g.p.searchurl){r=g.p.url;a(g).jqGrid("setGridParam",{url:g.p.searchurl})}a(g).jqGrid("setGridParam",{search:q,page:1}).trigger("reloadGrid");if(r){a(g).jqGrid("setGridParam",{url:r})}if(a.isFunction(b.afterSearch)){b.afterSearch()}};var k=function(){var p={},n,o=0,m;if(a.isFunction(b.beforeClear)){b.beforeClear()}a.each(g.p.colModel,function(s,v){n=(this.searchoptions&&this.searchoptions.defaultValue)?this.searchoptions.defaultValue:"";m=this.index||this.name;switch(this.stype){case"select":var u;a("select[name="+m+"] option",g.grid.hDiv).each(function(w){if(w==0){this.selected=true}if(a(this).text()==n){this.selected=true;u=a(this).val();return false}});if(u){p[m]=u;o++}else{try{delete g.p.postData[m]}catch(t){}}break;case"text":a("input[name="+m+"]",g.grid.hDiv).val(n);if(n){p[m]=n;o++}else{try{delete g.p.postData[m]}catch(t){}}break}});var q=o>0?true:false;a.extend(g.p.postData,p);var r;if(g.p.searchurl){r=g.p.url;a(g).jqGrid("setGridParam",{url:g.p.searchurl})}a(g).jqGrid("setGridParam",{search:q,page:1}).trigger("reloadGrid");if(r){a(g).jqGrid("setGridParam",{url:r})}if(a.isFunction(b.afterClear)){b.afterClear()}};var l=function(){var m=a("tr.ui-search-toolbar",g.grid.hDiv);if(m.css("display")=="none"){m.show()}else{m.hide()}};function f(m,o){var n=a(m);if(n[0]!=null){jQuery.each(o,function(){if(this.data!=null){n.bind(this.type,this.data,this.fn)}else{n.bind(this.type,this.fn)}})}}var h=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),d,j,e;a.each(g.p.colModel,function(t,p){var v=this;d=a("<th role='columnheader' class='ui-state-default ui-th-column'></th>");j=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");if(this.hidden===true){a(d).css("display","none")}this.search=this.search===false?false:true;if(typeof this.stype=="undefined"){this.stype="text"}e=a.extend({},this.searchoptions||{});if(this.search){switch(this.stype){case"select":if(this.surl){a(j).load(this.surl,{_nsd:(new Date().getTime())},function(){if(e.defaultValue){a("select",this).val(e.defaultValue)}a("select",this).attr({name:v.index||v.name,id:"gs_"+v.name});if(e.attr){a("select",this).attr(e.attr)}a("select",this).css({width:"100%"});if(e.dataInit!=null){e.dataInit(a("select",this)[0])}if(e.dataEvents!=null){f(a("select",this)[0],e.dataEvents)}if(b.autosearch===true){a("select",this).change(function(n){c();return false})}})}else{if(v.editoptions&&v.editoptions.value){var m=v.editoptions.value,q=document.createElement("select");q.style.width="100%";a(q).attr({name:v.index||v.name,id:"gs_"+v.name});if(typeof m==="string"){var o=m.split(";"),x,r;for(var s=0;s<o.length;s++){x=o[s].split(":");r=document.createElement("option");r.value=x[0];r.innerHTML=x[1];q.appendChild(r)}}else{if(typeof m==="object"){for(var w in m){t++;r=document.createElement("option");r.value=w;r.innerHTML=m[w];q.appendChild(r)}}}if(e.defaultValue){a(q).val(e.defaultValue)}if(e.attr){a(q).attr(e.attr)}if(e.dataInit!=null){e.dataInit(q)}if(e.dataEvents!=null){f(q,e.dataEvents)}a(j).append(q);if(b.autosearch===true){a(q).change(function(n){c();return false})}}}break;case"text":var u=e.defaultValue?e.defaultValue:"";a(j).append("<input type='text' style='width:95%;padding:0px;' name='"+(v.index||v.name)+"' id='gs_"+v.name+"' value='"+u+"'/>");if(e.attr){a("input",j).attr(e.attr)}if(e.dataInit!=null){e.dataInit(a("input",j)[0])}if(e.dataEvents!=null){f(a("input",j)[0],e.dataEvents)}if(b.autosearch===true){a("input",j).keypress(function(y){var n=y.charCode?y.charCode:y.keyCode?y.keyCode:0;if(n==13){c();return false}return this})}break}}a(d).append(j);a(h).append(d)});a("table thead",g.grid.hDiv).append(h);this.triggerToolbar=function(){c()};this.clearToolbar=function(){k()};this.toggleToolbar=function(){l()}})}})})(jQuery);(function(b){var a=null;b.jgrid.extend({searchGrid:function(c){c=b.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:false,closeOnEscape:false,multipleSearch:false,sopt:null,onClose:null},b.jgrid.search,c||{});return this.each(function(){var m=this;if(!m.grid){return}if(b.fn.searchFilter){var g="fbox_"+m.p.id;if(c.recreateFilter===true){b("#"+g).remove()}if(b("#"+g).html()!=null){if(b.isFunction(c.beforeShowSearch)){c.beforeShowSearch(b("#"+g))}f();if(b.isFunction(c.afterShowSearch)){c.afterShowSearch(b("#"+g))}}else{var o=[],v=jQuery("#"+m.p.id).jqGrid("getGridParam","colNames"),s=jQuery("#"+m.p.id).jqGrid("getGridParam","colModel"),u=["eq","ne","lt","le","gt","ge","bw","bn","in","ni","ew","en","cn","nc"],l,r,h,q;q=jQuery.fn.searchFilter.defaults.operators;if(c.sopt!=null){q=[];h=0;for(l=0;l<c.sopt.length;l++){if((r=b.inArray(c.sopt[l],u))!=-1){q[h]={op:c.sopt[l],text:c.odata[r]};h++}}}b.each(s,function(x,C){var z=(typeof C.search==="undefined")?true:C.search,y=(C.hidden===true),k=b.extend({},{text:v[x],value:C.index||C.name},this.searchoptions),w=(k.searchhidden===true)||true;if(typeof k.sopt=="undefined"){k.sopt=c.sopt||u}h=0;k.ops=[];if(k.sopt.length>0){for(l=0;l<k.sopt.length;l++){if((r=b.inArray(k.sopt[l],u))!=-1){k.ops[h]={op:k.sopt[l],text:c.odata[r]};h++}}}if(typeof(this.stype)==="undefined"){this.stype="text"}if(this.stype=="select"){if(k.dataUrl!=null){}else{if(this.editoptions){var j=this.editoptions.value;if(j){k.dataValues=[];if(typeof(j)==="string"){var e=j.split(";"),B;for(l=0;l<e.length;l++){B=e[l].split(":");k.dataValues[l]={value:B[0],text:B[1]}}}else{if(typeof(j)==="object"){l=0;for(var A in j){k.dataValues[l]={value:A,text:j[A]};l++}}}}}}}if((w&&z)||(z&&!y)){o.push(k)}});if(o.length>0){b("<div id='"+g+"' role='dialog' tabindex='-1'></div>").insertBefore("#gview_"+m.p.id);jQuery("#"+g).searchFilter(o,{groupOps:c.groupOps,operators:q,onClose:d,resetText:c.Reset,searchText:c.Find,windowTitle:c.caption,rulesText:c.rulesText,matchText:c.matchText,onSearch:t,onReset:n,stringResult:c.multipleSearch});b(".ui-widget-overlay","#"+g).remove();if(c.drag===true){b("#"+g+" table thead tr:first td:first").css("cursor","move");if(jQuery.fn.jqDrag){jQuery("#"+g).jqDrag(b("#"+g+" table thead tr:first td:first"))}else{try{b("#"+g).draggable({handle:jQuery("#"+g+" table thead tr:first td:first")})}catch(p){}}}if(c.multipleSearch===false){b(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText","#"+g).hide();b("select[name='groupOp']","#"+g).hide()}if(b.isFunction(c.onInitializeSearch)){c.onInitializeSearch(b("#"+g))}if(b.isFunction(c.beforeShowSearch)){c.beforeShowSearch(b("#"+g))}f();if(b.isFunction(c.afterShowSearch)){c.afterShowSearch(b("#"+g))}if(c.closeOnEscape===true){jQuery("#"+g).keydown(function(j){if(j.which==27){d(b("#"+g))}})}}}}function t(w){var e=(w!==undefined),k=jQuery("#"+m.p.id),j={};if(c.multipleSearch===false){j[c.sField]=w.rules[0].field;j[c.sValue]=w.rules[0].data;j[c.sOper]=w.rules[0].op}else{j[c.sFilter]=w}k[0].p.search=e;b.extend(k[0].p.postData,j);k[0].p.page=1;k.trigger("reloadGrid");if(c.closeAfterSearch){d(b("#"+g))}}function n(w){var e=(w!==undefined),k=jQuery("#"+m.p.id),j=[];k[0].p.search=e;if(c.multipleSearch===false){j[c.sField]=j[c.sValue]=j[c.sOper]=""}else{j[c.sFilter]=""}b.extend(k[0].p.postData,j);k[0].p.page=1;k.trigger("reloadGrid")}function d(e){if(c.onClose){var j=c.onClose(e);if(typeof j=="boolean"&&!j){return}}e.hide();b(".jqgrid-overlay","#gbox_"+m.p.id).hide()}function f(){b("#"+g).show();b(".jqgrid-overlay","#gbox_"+m.p.id).show();try{b(":input:visible","#"+g)[0].focus()}catch(e){}}})},editGridRow:function(c,d){d=b.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:{},onClose:null},b.jgrid.edit,d||{});a=d;return this.each(function(){var e=this;if(!e.grid||!c){return}var C=e.p.id,y="FrmGrid_"+C,u="TblGrid_"+C,h={themodal:"editmod"+C,modalhead:"edithd"+C,modalcontent:"editcnt"+C,scrollelm:y},D=b.isFunction(a.beforeShowForm)?a.beforeShowForm:false,O=b.isFunction(a.afterShowForm)?a.afterShowForm:false,N=b.isFunction(a.beforeInitData)?a.beforeInitData:false,o=b.isFunction(a.onInitializeForm)?a.onInitializeForm:false,I=null,J=1,q=0,v,E,F,R,H,B;if(c=="new"){c="_empty";d.caption=d.addCaption}else{d.caption=d.editCaption}if(d.recreateForm===true&&b("#"+h.themodal).html()!=null){b("#"+h.themodal).remove()}var k=true;if(d.checkOnUpdate&&d.jqModal&&!d.modal){k=false}if(b("#"+h.themodal).html()!=null){b(".ui-jqdialog-title","#"+h.modalhead).html(d.caption);b("#FormError","#"+u).hide();if(N){N(b("#"+y))}n(c,e,y);if(c=="_empty"){b("#pData, #nData","#"+u+"_2").hide()}else{b("#pData, #nData","#"+u+"_2").show()}if(d.processing===true){d.processing=false;b("#sData","#"+u).removeClass("ui-state-active")}if(b("#"+y).data("disabled")===true){b(".confirm","#"+h.themodal).hide();b("#"+y).data("disabled",false)}if(D){D(b("#"+y))}b("#"+h.themodal).data("onClose",a.onClose);viewModal("#"+h.themodal,{gbox:"#gbox_"+C,jqm:d.jqModal,jqM:false,closeoverlay:k,modal:d.modal});if(!k){b(".jqmOverlay").click(function(){if(!f()){return false}hideModal("#"+h.themodal,{gb:"#gbox_"+C,jqm:d.jqModal,onClose:a.onClose});return false})}if(O){O(b("#"+y))}}else{b(e.p.colModel).each(function(W){var X=this.formoptions;J=Math.max(J,X?X.colpos||0:0);q=Math.max(q,X?X.rowpos||0:0)});var r=isNaN(d.dataheight)?d.dataheight:d.dataheight+"px";var M,T=b("<form name='FormPost' id='"+y+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+r+";'></form>").data("disabled",false),A=b("<table id='"+u+"' class='EditTable' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");b(T).append(A);M=b("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+(J*2)+"'></td></tr>");M[0].rp=0;b(A).append(M);if(a.topinfo){M=b("<tr><td class='topinfo' colspan='"+(J*2)+"'>"+a.topinfo+"</td></tr>");M[0].rp=0;b(A).append(M)}if(N){N(b("#"+y))}var z=s(c,e,A,J),l="<a href='javascript:void(0)' id='pData' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",m="<a href='javascript:void(0)' id='nData' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",g="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+d.bSubmit+"</a>",t="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+d.bCancel+"</a>";var Q="<table border='0' class='EditTable' id='"+u+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content'>"+l+m+"</td><td class='EditButton ui-widget-content'>"+g+"&nbsp;"+t+"</td></tr>";if(a.bottominfo){Q+="<tr><td class='bottominfo' colspan='2'>"+a.bottominfo+"</td></tr>"}Q+="</tbody></table>";if(q>0){var x=[];b.each(b(A)[0].rows,function(W,X){x[W]=X});x.sort(function(X,W){if(X.rp>W.rp){return 1}if(X.rp<W.rp){return -1}return 0});b.each(x,function(W,X){b("tbody",A).append(X)})}d.gbox="#gbox_"+C;var p=false;if(d.closeOnEscape===true){d.closeOnEscape=false;p=true}var P=b("<span></span>").append(T).append(Q);createModal(h,P,d,"#gview_"+e.p.id,b("#gview_"+e.p.id)[0]);P=null;Q=null;jQuery("#"+h.themodal).keydown(function(W){if(b("#"+y).data("disabled")===true){return false}if(a.savekey[0]===true&&W.which==a.savekey[1]){b("#sData","#"+u+"_2").trigger("click");return false}if(W.which===27){if(!f()){return false}if(p){hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:a.onClose})}return false}if(a.navkeys[0]===true){if(b("#id_g","#"+u).val()=="_empty"){return true}if(W.which==a.navkeys[1]){b("#pData","#"+u+"_2").trigger("click");return false}if(W.which==a.navkeys[2]){b("#nData","#"+u+"_2").trigger("click");return false}}});if(d.checkOnUpdate){b("a.ui-jqdialog-titlebar-close span","#"+h.themodal).removeClass("jqmClose");b("a.ui-jqdialog-titlebar-close","#"+h.themodal).unbind("click").click(function(){if(!f()){return false}hideModal("#"+h.themodal,{gb:"#gbox_"+C,jqm:d.jqModal,onClose:a.onClose});return false})}d.saveicon=b.extend([true,"left","ui-icon-disk"],d.saveicon);d.closeicon=b.extend([true,"left","ui-icon-close"],d.closeicon);if(d.saveicon[0]==true){b("#sData","#"+u+"_2").addClass(d.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.saveicon[2]+"'></span>")}if(d.closeicon[0]==true){b("#cData","#"+u+"_2").addClass(d.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.closeicon[2]+"'></span>")}if(a.checkOnSubmit||a.checkOnUpdate){g="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bYes+"</a>";m="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bNo+"</a>";t="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bExit+"</a>";var G,w=d.zIndex||999;w++;if(b.browser.msie&&b.browser.version==6){G='<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>'}else{G=""}b("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+w+";display:none;'>&nbsp;"+G+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(w+1)+"'>"+d.saveData+"<br/><br/>"+g+m+t+"</div>").insertAfter("#"+y);b("#sNew","#"+h.themodal).click(function(){j([true,"",""]);b("#"+y).data("disabled",false);b(".confirm","#"+h.themodal).hide();return false});b("#nNew","#"+h.themodal).click(function(){b(".confirm","#"+h.themodal).hide();b("#"+y).data("disabled",false);setTimeout(function(){b(":input","#"+y)[0].focus()},0);return false});b("#cNew","#"+h.themodal).click(function(){b(".confirm","#"+h.themodal).hide();b("#"+y).data("disabled",false);hideModal("#"+h.themodal,{gb:"#gbox_"+C,jqm:d.jqModal,onClose:a.onClose});return false})}if(o){o(b("#"+y))}if(c=="_empty"){b("#pData,#nData","#"+u+"_2").hide()}else{b("#pData,#nData","#"+u+"_2").show()}if(D){D(b("#"+y))}b("#"+h.themodal).data("onClose",a.onClose);viewModal("#"+h.themodal,{gbox:"#gbox_"+C,jqm:d.jqModal,closeoverlay:k,modal:d.modal});if(!k){b(".jqmOverlay").click(function(){if(!f()){return false}hideModal("#"+h.themodal,{gb:"#gbox_"+C,jqm:d.jqModal,onClose:a.onClose});return false})}if(O){O(b("#"+y))}b(".fm-button","#"+h.themodal).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});b("#sData","#"+u+"_2").click(function(W){E={};R={};b("#FormError","#"+u).hide();U();if(E.id=="_empty"){j()}else{if(d.checkOnSubmit===true){H=b.extend({},E,R);B=K(H,a._savedData);if(B){b("#"+y).data("disabled",true);b(".confirm","#"+h.themodal).show()}else{j()}}else{j()}}return false});b("#cData","#"+u+"_2").click(function(W){if(!f()){return false}hideModal("#"+h.themodal,{gb:"#gbox_"+C,jqm:d.jqModal,onClose:a.onClose});return false});b("#nData","#"+u+"_2").click(function(W){if(!f()){return false}b("#FormError","#"+u).hide();var X=V();X[0]=parseInt(X[0]);if(X[0]!=-1&&X[1][X[0]+1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("next",b("#"+y),X[1][X[0]])}n(X[1][X[0]+1],e,y);b(e).jqGrid("setSelection",X[1][X[0]+1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("next",b("#"+y),X[1][X[0]+1])}L(X[0]+1,X[1].length-1)}return false});b("#pData","#"+u+"_2").click(function(X){if(!f()){return false}b("#FormError","#"+u).hide();var W=V();if(W[0]!=-1&&W[1][W[0]-1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("prev",b("#"+y),W[1][W[0]])}n(W[1][W[0]-1],e,y);b(e).jqGrid("setSelection",W[1][W[0]-1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("prev",b("#"+y),W[1][W[0]-1])}L(W[0]-1,W[1].length-1)}return false})}var S=V();L(S[0],S[1].length-1);function L(X,Y,W){if(X==0){b("#pData","#"+u+"_2").addClass("ui-state-disabled")}else{b("#pData","#"+u+"_2").removeClass("ui-state-disabled")}if(X==Y){b("#nData","#"+u+"_2").addClass("ui-state-disabled")}else{b("#nData","#"+u+"_2").removeClass("ui-state-disabled")}}function V(){var X=b(e).jqGrid("getDataIDs"),W=b("#id_g","#"+u).val(),Y=b.inArray(W,X);return[Y,X]}function f(){var W=true;b("#FormError","#"+u).hide();if(a.checkOnUpdate){E={};R={};U();H=b.extend({},E,R);B=K(H,a._savedData);if(B){b("#"+y).data("disabled",true);b(".confirm","#"+h.themodal).show();W=false}}return W}function U(){b(".FormElement","#"+u).each(function(X){switch(b(this).get(0).type){case"checkbox":if(b(this).attr("checked")){E[this.name]=b(this).val()}else{var W=b(this).attr("offval");E[this.name]=W}break;case"select-one":E[this.name]=b("option:selected",this).val();R[this.name]=b("option:selected",this).text();break;case"select-multiple":E[this.name]=b(this).val();if(E[this.name]){E[this.name]=E[this.name].join(",")}else{E[this.name]=""}var Y=[];b("option:selected",this).each(function(Z,aa){Y[Z]=b(aa).text()});R[this.name]=Y.join(",");break;case"password":case"text":case"textarea":case"button":E[this.name]=b(this).val();E[this.name]=!e.p.autoencode?E[this.name]:b.jgrid.htmlEncode(E[this.name]);break}});return true}function s(Z,af,ac,ak){var W,X,ah,ai=0,am,an,ag,al=[],ad=false,ae,Y,aa="<td class='CaptionTD ui-widget-content'>&nbsp;</td><td class='DataTD ui-widget-content' style='white-space:pre'>&nbsp;</td>",ab="";for(var aj=1;aj<=ak;aj++){ab+=aa}if(Z!="_empty"){ad=b(af).jqGrid("getInd",Z)}b(af.p.colModel).each(function(ar){W=this.name;if(this.editrules&&this.editrules.edithidden==true){X=false}else{X=this.hidden===true?true:false}an=X?"style='display:none'":"";if(W!=="cb"&&W!=="subgrid"&&this.editable===true&&W!=="rn"){if(ad===false){am=""}else{if(W==af.p.ExpandColumn&&af.p.treeGrid===true){am=b("td:eq("+ar+")",af.rows[ad]).text()}else{try{am=b.unformat(b("td:eq("+ar+")",af.rows[ad]),{colModel:this},ar)}catch(ap){am=b("td:eq("+ar+")",af.rows[ad]).html()}}}var aq=b.extend({},this.editoptions||{},{id:W,name:W});frmopt=b.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),ae=parseInt(frmopt.rowpos)||ai+1,Y=parseInt((parseInt(frmopt.colpos)||1)*2);if(Z=="_empty"&&aq.defaultValue){am=b.isFunction(aq.defaultValue)?aq.defaultValue():aq.defaultValue}if(!this.edittype){this.edittype="text"}ag=createEl(this.edittype,aq,am);if(am==""&&this.edittype=="checkbox"){am=b(ag).attr("offval")}if(a.checkOnSubmit||a.checkOnUpdate){a._savedData[W]=am}b(ag).addClass("FormElement");ah=b(ac).find("tr[rowpos="+ae+"]");if(frmopt.rowabove){var at=b("<tr><td class='contentinfo' colspan='"+(ak*2)+"'>"+frmopt.rowcontent+"</td></tr>");b(ac).append(at);at[0].rp=ae}if(ah.length==0){ah=b("<tr "+an+" rowpos='"+ae+"'></tr>").addClass("FormData").attr("id","tr_"+W);b(ah).append(ab);b(ac).append(ah);ah[0].rp=ae}b("td:eq("+(Y-2)+")",ah[0]).html(typeof frmopt.label==="undefined"?af.p.colNames[ar]:frmopt.label);b("td:eq("+(Y-1)+")",ah[0]).append(frmopt.elmprefix).append(ag).append(frmopt.elmsuffix);al[ai]=ar;ai++}});if(ai>0){var ao=b("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(ak*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+Z+"'/></td></tr>");ao[0].rp=ai+999;b(ac).append(ao);if(a.checkOnSubmit||a.checkOnUpdate){a._savedData.id=Z}}return al}function n(X,ad,Z){var ai,af,aa=0,ae,ac,W,ab,ag;if(a.checkOnSubmit||a.checkOnUpdate){a._savedData={};a._savedData.id=X}var ah=ad.p.colModel;if(X=="_empty"){b(ah).each(function(aj){ai=this.name;W=b.extend({},this.editoptions||{});ac=b("#"+b.jgrid.jqID(ai),"#"+Z);if(ac[0]!=null){ab="";if(W.defaultValue){ab=b.isFunction(W.defaultValue)?W.defaultValue():W.defaultValue;if(ac[0].type=="checkbox"){ag=ab.toLowerCase();if(ag.search(/(false|0|no|off|undefined)/i)<0&&ag!==""){ac[0].checked=true;ac[0].defaultChecked=true;ac[0].value=ab}else{ac.attr({checked:"",defaultChecked:""})}}else{ac.val(ab)}}else{if(ac[0].type=="checkbox"){ac[0].checked=false;ac[0].defaultChecked=false;ab=b(ac).attr("offval")}else{if(ac[0].type.substr(0,6)=="select"){ac[0].selectedIndex=0}else{ac.val(ab)}}}if(a.checkOnSubmit===true||a.checkOnUpdate){a._savedData[ai]=ab}}});b("#id_g","#"+Z).val("_empty");return}var Y=b(ad).jqGrid("getInd",X,true);if(!Y){return}b("td",Y).each(function(ak){ai=ah[ak].name;if(ah[ak].editrules&&ah[ak].editrules.edithidden===true){af=false}else{af=ah[ak].hidden===true?true:false}if(ai!=="cb"&&ai!=="subgrid"&&ah[ak].editable===true){if(ai==ad.p.ExpandColumn&&ad.p.treeGrid===true){ae=b(this).text()}else{try{ae=b.unformat(this,{colModel:ah[ak]},ak)}catch(aj){ae=b(this).html()}}if(a.checkOnSubmit===true||a.checkOnUpdate){a._savedData[ai]=ae}ai=b.jgrid.jqID(ai);switch(ah[ak].edittype){case"password":case"text":case"button":case"image":ae=b.jgrid.htmlDecode(ae);b("#"+ai,"#"+Z).val(ae);break;case"textarea":if(ae=="&nbsp;"||ae=="&#160;"||(ae.length==1&&ae.charCodeAt(0)==160)){ae=""}b("#"+ai,"#"+Z).val(ae);break;case"select":b("#"+ai+" option","#"+Z).each(function(al){if(!ah[ak].editoptions.multiple&&(ae==b(this).text()||ae==b(this).val())){this.selected=true}else{if(ah[ak].editoptions.multiple){if(b.inArray(b(this).text(),ae.split(","))>-1||b.inArray(b(this).val(),ae.split(","))>-1){this.selected=true}else{this.selected=false}}else{this.selected=false}}});break;case"checkbox":ae=ae+"";ae=ae.toLowerCase();if(ae.search(/(false|0|no|off|undefined)/i)<0&&ae!==""){b("#"+ai,"#"+Z).attr("checked",true);b("#"+ai,"#"+Z).attr("defaultChecked",true)}else{b("#"+ai,"#"+Z).attr("checked",false);b("#"+ai,"#"+Z).attr("defaultChecked","")}break}aa++}});if(aa>0){b("#id_g","#"+u).val(X)}}function j(){var Z,X=[true,"",""],W={};for(var Y in E){X=checkValues(E[Y],Y,e);if(X[0]==false){break}}if(X[0]){if(b.isFunction(a.onclickSubmit)){W=a.onclickSubmit(a,E)||{}}if(b.isFunction(a.beforeSubmit)){X=a.beforeSubmit(E,b("#"+y))}}v=a.url?a.url:e.p.editurl;if(X[0]){if(!v){X[0]=false;X[1]+=" "+b.jgrid.errors.nourl}}if(X[0]===false){b("#FormError>td","#"+u).html(X[1]);b("#FormError","#"+u).show();return}if(!d.processing){d.processing=true;b("#sData","#"+u+"_2").addClass("ui-state-active");E.oper=E.id=="_empty"?"add":"edit";E=b.extend(E,a.editData,W);b.ajax({url:v,type:a.mtype,data:E,complete:function(ab,aa){if(aa!="success"){X[0]=false;if(b.isFunction(a.errorTextFormat)){X[1]=a.errorTextFormat(ab)}else{X[1]=aa+" Status: '"+ab.statusText+"'. Error code: "+ab.status}}else{if(b.isFunction(a.afterSubmit)){X=a.afterSubmit(ab,E)}}if(X[0]===false){b("#FormError>td","#"+u).html(X[1]);b("#FormError","#"+u).show()}else{b.each(e.p.colModel,function(ad,af){if(R[this.name]&&this.formatter&&this.formatter=="select"){try{delete R[this.name]}catch(ae){}}});E=b.extend(E,R);if(E.id=="_empty"){if(!X[2]){X[2]=parseInt(e.p.records)+1}E.id=X[2];if(a.closeAfterAdd){if(a.reloadAfterSubmit){b(e).trigger("reloadGrid")}else{b(e).jqGrid("addRowData",X[2],E,d.addedrow);b(e).jqGrid("setSelection",X[2])}hideModal("#"+h.themodal,{gb:"#gbox_"+C,jqm:d.jqModal,onClose:a.onClose})}else{if(a.clearAfterAdd){if(a.reloadAfterSubmit){b(e).trigger("reloadGrid")}else{b(e).jqGrid("addRowData",X[2],E,d.addedrow)}n("_empty",e,y)}else{if(a.reloadAfterSubmit){b(e).trigger("reloadGrid")}else{b(e).jqGrid("addRowData",X[2],E,d.addedrow)}}}}else{if(a.reloadAfterSubmit){b(e).trigger("reloadGrid");if(!a.closeAfterEdit){setTimeout(function(){b(e).jqGrid("setSelection",E.id)},1000)}}else{if(e.p.treeGrid===true){b(e).jqGrid("setTreeRow",E.id,E)}else{b(e).jqGrid("setRowData",E.id,E)}}if(a.closeAfterEdit){hideModal("#"+h.themodal,{gb:"#gbox_"+C,jqm:d.jqModal,onClose:a.onClose})}}if(b.isFunction(a.afterComplete)){Z=ab;setTimeout(function(){a.afterComplete(Z,E,b("#"+y));Z=null},500)}}d.processing=false;if(a.checkOnSubmit||a.checkOnUpdate){b("#"+y).data("disabled",false);if(a._savedData.id!="_empty"){a._savedData=E}}b("#sData","#"+u+"_2").removeClass("ui-state-active");try{b(":input:visible","#"+y)[0].focus()}catch(ac){}},error:function(ac,aa,ab){b("#FormError>td","#"+u).html(aa+" : "+ab);b("#FormError","#"+u).show();d.processing=false;b("#"+y).data("disabled",false);b("#sData","#"+u+"_2").removeClass("ui-state-active")}})}}function K(Z,W){var X=false,Y;for(Y in Z){if(Z[Y]!=W[Y]){X=true;break}}return X}})},viewGridRow:function(c,d){d=b.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},b.jgrid.view,d||{});return this.each(function(){var x=this;if(!x.grid||!c){return}if(!d.imgpath){d.imgpath=x.p.imgpath}var r=x.p.id,z="ViewGrid_"+r,s="ViewTbl_"+r,j={themodal:"viewmod"+r,modalhead:"viewhd"+r,modalcontent:"viewcnt"+r,scrollelm:z},g=1,e=0;if(b("#"+j.themodal).html()!=null){b(".ui-jqdialog-title","#"+j.modalhead).html(d.caption);b("#FormError","#"+s).hide();m(c,x);viewModal("#"+j.themodal,{gbox:"#gbox_"+r,jqm:d.jqModal,jqM:false,modal:d.modal});k()}else{b(x.p.colModel).each(function(D){var E=this.formoptions;g=Math.max(g,E?E.colpos||0:0);e=Math.max(e,E?E.rowpos||0:0)});var y=isNaN(d.dataheight)?d.dataheight:d.dataheight+"px";var w,B=b("<form name='FormPost' id='"+z+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+y+";'></form>"),l=b("<table id='"+s+"' class='EditTable' cellspacing='1' cellpading='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");b(B).append(l);var v=n(c,x,l,g),t="<a href='javascript:void(0)' id='pData' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",u="<a href='javascript:void(0)' id='nData' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",C="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+d.bClose+"</a>";if(e>0){var f=[];b.each(b(l)[0].rows,function(D,E){f[D]=E});f.sort(function(E,D){if(E.rp>D.rp){return 1}if(E.rp<D.rp){return -1}return 0});b.each(f,function(D,E){b("tbody",l).append(E)})}d.gbox="#gbox_"+r;var q=false;if(d.closeOnEscape===true){d.closeOnEscape=false;q=true}var A=b("<span></span>").append(B).append("<table border='0' class='EditTable' id='"+s+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content' width='"+d.labelswidth+"'>"+t+u+"</td><td class='EditButton ui-widget-content'>"+C+"</td></tr></tbody></table>");createModal(j,A,d,"#gview_"+x.p.id,b("#gview_"+x.p.id)[0]);A=null;jQuery("#"+j.themodal).keydown(function(D){if(D.which===27){if(q){hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:d.onClose})}return false}if(d.navkeys[0]===true){if(D.which===d.navkeys[1]){b("#pData","#"+s+"_2").trigger("click");return false}if(D.which===d.navkeys[2]){b("#nData","#"+s+"_2").trigger("click");return false}}});d.closeicon=b.extend([true,"left","ui-icon-close"],d.closeicon);if(d.closeicon[0]==true){b("#cData","#"+s+"_2").addClass(d.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.closeicon[2]+"'></span>")}viewModal("#"+j.themodal,{gbox:"#gbox_"+r,jqm:d.jqModal,modal:d.modal});b(".fm-button:not(.ui-state-disabled)","#"+s+"_2").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});k();b("#cData","#"+s+"_2").click(function(D){hideModal("#"+j.themodal,{gb:"#gbox_"+r,jqm:d.jqModal,onClose:d.onClose});return false});b("#nData","#"+s+"_2").click(function(D){b("#FormError","#"+s).hide();var E=h();E[0]=parseInt(E[0]);if(E[0]!=-1&&E[1][E[0]+1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("next",b("#"+z),E[1][E[0]])}m(E[1][E[0]+1],x);b(x).jqGrid("setSelection",E[1][E[0]+1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("next",b("#"+z),E[1][E[0]+1])}o(E[0]+1,E[1].length-1)}k();return false});b("#pData","#"+s+"_2").click(function(E){b("#FormError","#"+s).hide();var D=h();if(D[0]!=-1&&D[1][D[0]-1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("prev",b("#"+z),D[1][D[0]])}m(D[1][D[0]-1],x);b(x).jqGrid("setSelection",D[1][D[0]-1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("prev",b("#"+z),D[1][D[0]-1])}o(D[0]-1,D[1].length-1)}k();return false})}function k(){if(d.closeOnEscape===true||d.navkeys[0]===true){setTimeout(function(){b(".ui-jqdialog-titlebar-close","#"+j.modalhead).focus()},0)}}var p=h();o(p[0],p[1].length-1);function o(E,F,D){if(E==0){b("#pData","#"+s+"_2").addClass("ui-state-disabled")}else{b("#pData","#"+s+"_2").removeClass("ui-state-disabled")}if(E==F){b("#nData","#"+s+"_2").addClass("ui-state-disabled")}else{b("#nData","#"+s+"_2").removeClass("ui-state-disabled")}}function h(){var E=b(x).jqGrid("getDataIDs"),D=b("#id_g","#"+s).val(),F=b.inArray(D,E);return[F,E]}function n(J,P,N,V){var F,I,Q,Y,D,T=0,X,Z,W=[],O=false,L="<td class='CaptionTD ui-widget-content' width='"+d.labelswidth+"'>&nbsp;</td><td class='DataTD ui-helper-reset ui-widget-content' style='white-space:pre;'>&nbsp;</td>",M="",G="<td class='CaptionTD ui-widget-content'>&nbsp;</td><td class='DataTD ui-widget-content' style='white-space:pre;'>&nbsp;</td>",K=["integer","number","currency"],S=0,R=0,H,E;for(var U=1;U<=V;U++){M+=U==1?L:G}b(P.p.colModel).each(function(ab){if(this.editrules&&this.editrules.edithidden===true){I=false}else{I=this.hidden===true?true:false}if(!I&&this.align==="right"){if(this.formatter&&b.inArray(this.formatter,K)!==-1){S=Math.max(S,parseInt(this.width,10))}else{R=Math.max(R,parseInt(this.width,10))}}});H=S!==0?S:R!==0?R:0;O=b(P).jqGrid("getInd",J);b(P.p.colModel).each(function(ac){F=this.name;E=false;if(this.editrules&&this.editrules.edithidden===true){I=false}else{I=this.hidden===true?true:false}Z=I?"style='display:none'":"";if(F!=="cb"&&F!=="subgrid"&&this.editable===true){if(O===false){X=""}else{if(F==P.p.ExpandColumn&&P.p.treeGrid===true){X=b("td:eq("+ac+")",P.rows[O]).text()}else{X=b("td:eq("+ac+")",P.rows[O]).html()}}E=this.align==="right"&&H!==0?true:false;var ab=b.extend({},this.editoptions||{},{id:F,name:F}),ag=b.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),ad=parseInt(ag.rowpos)||T+1,af=parseInt((parseInt(ag.colpos)||1)*2);if(ag.rowabove){var ae=b("<tr><td class='contentinfo' colspan='"+(V*2)+"'>"+ag.rowcontent+"</td></tr>");b(N).append(ae);ae[0].rp=ad}Q=b(N).find("tr[rowpos="+ad+"]");if(Q.length==0){Q=b("<tr "+Z+" rowpos='"+ad+"'></tr>").addClass("FormData").attr("id","trv_"+F);b(Q).append(M);b(N).append(Q);Q[0].rp=ad}b("td:eq("+(af-2)+")",Q[0]).html("<b>"+(typeof ag.label==="undefined"?P.p.colNames[ac]:ag.label)+"</b>");b("td:eq("+(af-1)+")",Q[0]).append("<span>"+X+"</span>").attr("id","v_"+F);if(E){b("td:eq("+(af-1)+") span",Q[0]).css({"text-align":"right",width:H+"px"})}W[T]=ac;T++}});if(T>0){var aa=b("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(V*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+J+"'/></td></tr>");aa[0].rp=T+99;b(N).append(aa)}return W}function m(H,J){var D,K,G=0,F,E,I;I=b(J).jqGrid("getInd",H,true);if(!I){return}b("td",I).each(function(L){D=J.p.colModel[L].name;if(J.p.colModel[L].editrules&&J.p.colModel[L].editrules.edithidden===true){K=false}else{K=J.p.colModel[L].hidden===true?true:false}if(D!=="cb"&&D!=="subgrid"&&J.p.colModel[L].editable===true){if(D==J.p.ExpandColumn&&J.p.treeGrid===true){F=b(this).text()}else{F=b(this).html()}E=b.extend({},J.p.colModel[L].editoptions||{});D=b.jgrid.jqID("v_"+D);b("#"+D+" span","#"+s).html(F);if(K){b("#"+D,"#"+s).parents("tr:first").hide()}G++}});if(G>0){b("#id_g","#"+s).val(H)}}})},delGridRow:function(c,d){d=b.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},b.jgrid.del,d||{});a=d;return this.each(function(){var m=this;if(!m.grid){return}if(!c){return}var n=typeof d.beforeShowForm==="function"?true:false,g=typeof d.afterShowForm==="function"?true:false,e=m.p.id,f={},k="DelTbl_"+e,h={themodal:"delmod"+e,modalhead:"delhd"+e,modalcontent:"delcnt"+e,scrollelm:k};if(isArray(c)){c=c.join()}if(b("#"+h.themodal).html()!=null){b("#DelData>td","#"+k).text(c);b("#DelError","#"+k).hide();if(d.processing===true){d.processing=false;b("#dData","#"+k).removeClass("ui-state-active")}if(n){d.beforeShowForm(b("#"+k))}viewModal("#"+h.themodal,{gbox:"#gbox_"+e,jqm:d.jqModal,jqM:false,modal:d.modal});if(g){d.afterShowForm(b("#"+k))}}else{var o=isNaN(d.dataheight)?d.dataheight:d.dataheight+"px";var l="<div id='"+k+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+o+";'>";l+="<table class='DelTable'><tbody>";l+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";l+="<tr id='DelData' style='display:none'><td >"+c+"</td></tr>";l+='<tr><td class="delmsg" style="white-space:pre;">'+d.msg+"</td></tr><tr><td >&nbsp;</td></tr>";l+="</tbody></table></div>";var j="<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+d.bSubmit+"</a>",p="<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+d.bCancel+"</a>";l+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+k+"_2'><tbody><tr><td class='DataTD ui-widget-content'></td></tr><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DelButton EditButton'>"+j+"&nbsp;"+p+"</td></tr></tbody></table>";d.gbox="#gbox_"+e;createModal(h,l,d,"#gview_"+m.p.id,b("#gview_"+m.p.id)[0]);b(".fm-button","#"+k+"_2").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});d.delicon=b.extend([true,"left","ui-icon-scissors"],d.delicon);d.cancelicon=b.extend([true,"left","ui-icon-cancel"],d.cancelicon);if(d.delicon[0]==true){b("#dData","#"+k+"_2").addClass(d.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.delicon[2]+"'></span>")}if(d.cancelicon[0]==true){b("#eData","#"+k+"_2").addClass(d.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.cancelicon[2]+"'></span>")}b("#dData","#"+k+"_2").click(function(t){var r=[true,""];f={};var s=b("#DelData>td","#"+k).text();if(typeof d.onclickSubmit==="function"){f=d.onclickSubmit(a)||{}}if(typeof d.beforeSubmit==="function"){r=d.beforeSubmit(s)}if(r[0]){var q=a.url?a.url:m.p.editurl;if(!q){r[0]=false;r[1]+=" "+b.jgrid.errors.nourl}}if(r[0]===false){b("#DelError>td","#"+k).html(r[1]);b("#DelError","#"+k).show()}else{if(!d.processing){d.processing=true;b(this).addClass("ui-state-active");var u=b.extend({oper:"del",id:s},d.delData,f);b.ajax({url:q,type:d.mtype,data:u,complete:function(y,w){if(w!="success"){r[0]=false;if(b.isFunction(a.errorTextFormat)){r[1]=a.errorTextFormat(y)}else{r[1]=w+" Status: '"+y.statusText+"'. Error code: "+y.status}}else{if(typeof a.afterSubmit==="function"){r=a.afterSubmit(y,s)}}if(r[0]===false){b("#DelError>td","#"+k).html(r[1]);b("#DelError","#"+k).show()}else{if(a.reloadAfterSubmit){if(m.p.treeGrid){b(m).jqGrid("setGridParam",{treeANode:0,datatype:m.p.treedatatype})}b(m).trigger("reloadGrid")}else{var v=[];v=s.split(",");if(m.p.treeGrid===true){try{b(m).jqGrid("delTreeNode",v[0])}catch(z){}}else{for(var x=0;x<v.length;x++){b(m).jqGrid("delRowData",v[x])}}m.p.selrow=null;m.p.selarrrow=[]}if(b.isFunction(a.afterComplete)){setTimeout(function(){a.afterComplete(y,s)},500)}}d.processing=false;b("#dData","#"+k+"_2").removeClass("ui-state-active");if(r[0]){hideModal("#"+h.themodal,{gb:"#gbox_"+e,jqm:d.jqModal,onClose:a.onClose})}},error:function(x,v,w){b("#DelError>td","#"+k).html(v+" : "+w);b("#DelError","#"+k).show();d.processing=false;b("#dData","#"+k+"_2").removeClass("ui-state-active")}})}}return false});b("#eData","#"+k+"_2").click(function(q){hideModal("#"+h.themodal,{gb:"#gbox_"+e,jqm:d.jqModal,onClose:a.onClose});return false});if(n){d.beforeShowForm(b("#"+k))}viewModal("#"+h.themodal,{gbox:"#gbox_"+e,jqm:d.jqModal,modal:d.modal});if(g){d.afterShowForm(b("#"+k))}}if(d.closeOnEscape===true){setTimeout(function(){b(".ui-jqdialog-titlebar-close","#"+h.modalhead).focus()},0)}})},navGrid:function(f,h,e,g,d,c,j){h=b.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,afterRefresh:null},b.jgrid.nav,h||{});return this.each(function(){var k={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},o=this,n,t,p,l;if(!o.grid){return}if(b("#"+k.themodal).html()==null){if(typeof window.innerWidth!="undefined"){n=window.innerWidth,t=window.innerHeight}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){n=document.documentElement.clientWidth,t=document.documentElement.clientHeight}else{n=1024;t=768}}createModal(k,"<div>"+h.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+o.p.id,jqModal:true,drag:true,resize:true,caption:h.alertcap,top:t/2-25,left:n/2-100,width:200,height:"auto",closeOnEscape:h.closeOnEscape},"","",true)}var q,r=b("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),s="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",m=b(o.p.pager).attr("id")||"pager";if(h.add){g=g||{};q=b("<td class='ui-pg-button ui-corner-all'></td>");b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.addicon+"'></span>"+h.addtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.addtitle||"",id:g.id||"add_"+o.p.id}).click(function(){if(typeof h.addfunc=="function"){h.addfunc()}else{b(o).jqGrid("editGridRow","new",g)}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.edit){q=b("<td class='ui-pg-button ui-corner-all'></td>");e=e||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.editicon+"'></span>"+h.edittext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.edittitle||"",id:e.id||"edit_"+o.p.id}).click(function(){var u=o.p.selrow;if(u){if(typeof h.editfunc=="function"){h.editfunc(u)}else{b(o).jqGrid("editGridRow",u,e)}}else{viewModal("#"+k.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});b("#jqg_alrt").focus()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.view){q=b("<td class='ui-pg-button ui-corner-all'></td>");j=j||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.viewicon+"'></span>"+h.viewtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.viewtitle||"",id:j.id||"view_"+o.p.id}).click(function(){var u=o.p.selrow;if(u){b(o).jqGrid("viewGridRow",u,j)}else{viewModal("#"+k.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});b("#jqg_alrt").focus()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.del){q=b("<td class='ui-pg-button ui-corner-all'></td>");d=d||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.delicon+"'></span>"+h.deltext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.deltitle||"",id:d.id||"del_"+o.p.id}).click(function(){var u;if(o.p.multiselect){u=o.p.selarrrow;if(u.length==0){u=null}}else{u=o.p.selrow}if(u){b(o).jqGrid("delGridRow",u,d)}else{viewModal("#"+k.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});b("#jqg_alrt").focus()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.add||h.edit||h.del||h.view){b("tr",r).append(s)}if(h.search){q=b("<td class='ui-pg-button ui-corner-all'></td>");c=c||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.searchicon+"'></span>"+h.searchtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.searchtitle||"",id:c.id||"search_"+o.p.id}).click(function(){b(o).jqGrid("searchGrid",c);return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.refresh){q=b("<td class='ui-pg-button ui-corner-all'></td>");b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.refreshicon+"'></span>"+h.refreshtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.refreshtitle||"",id:"refresh_"+o.p.id}).click(function(){o.p.search=false;try{var v=o.p.id;b("#fbox_"+v).searchFilter().reset()}catch(w){}switch(h.refreshstate){case"firstpage":o.p.page=1;b(o).trigger("reloadGrid");break;case"current":var u=o.p.multiselect===true?o.p.selarrrow:o.p.selrow;b(o).trigger("reloadGrid");setTimeout(function(){if(o.p.multiselect===true){if(u.length>0){for(var x=0;x<u.length;x++){b(o).jqGrid("setSelection",u[x],false)}}}else{if(u){b(o).jqGrid("setSelection",u,false)}}},1000);break}if(b.isFunction(h.afterRefresh)){h.afterRefresh()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}l=b(".ui-jqgrid").css("font-size")||"11px";b("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+l+";visibility:hidden;' ></div>");p=b(r).clone().appendTo("#testpg2").width();b("#testpg2").remove();b("#"+m+"_"+h.position,"#"+m).append(r);if(o.p._nvtd){if(p>o.p._nvtd[0]){b("#"+m+"_"+h.position,"#"+m).width(p);o.p._nvtd[0]=p}o.p._nvtd[1]=p}})},navButtonAdd:function(c,d){d=b.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},d||{});return this.each(function(){if(!this.grid){return}if(c.indexOf("#")!=0){c="#"+c}var e=b(".navtable",c)[0];if(e){var f=b("<td></td>");b(f).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+d.buttonicon+"'></span>"+d.caption+"</div>");if(d.id){b(f).attr("id",d.id)}if(d.position=="first"){if(e.rows[0].cells.length===0){b("tr",e).append(f)}else{b("tr td:eq(0)",e).before(f)}}else{b("tr",e).append(f)}b(f,e).attr("title",d.title||"").click(function(g){if(b.isFunction(d.onClickButton)){d.onClickButton()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")}).css("cursor",d.cursor?d.cursor:"normal")}})},navSeparatorAdd:function(c,d){d=b.extend({sepclass:"ui-separator",sepcontent:""},d||{});return this.each(function(){if(!this.grid){return}if(c.indexOf("#")!=0){c="#"+c}var f=b(".navtable",c)[0];if(f){var e="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+d.sepclass+"'></span>"+d.sepcontent+"</td>";b("tr",f).append(e)}})},GridToForm:function(c,d){return this.each(function(){var g=this;if(!g.grid){return}var f=b(g).jqGrid("getRowData",c);if(f){for(var e in f){if(b("[name="+e+"]",d).is("input:radio")||b("[name="+e+"]",d).is("input:checkbox")){b("[name="+e+"]",d).each(function(){if(b(this).val()==f[e]){b(this).attr("checked","checked")}else{b(this).attr("checked","")}})}else{b("[name="+e+"]",d).val(f[e])}}}})},FormToGrid:function(d,e,f,c){return this.each(function(){var j=this;if(!j.grid){return}if(!f){f="set"}if(!c){c="first"}var g=b(e).serializeArray();var h={};b.each(g,function(k,l){h[l.name]=l.value});if(f=="add"){b(j).jqGrid("addRowData",d,h,c)}else{if(f=="set"){b(j).jqGrid("setRowData",d,h)}}})}})})(jQuery);(function(a){a.jgrid.extend({jqGridImport:function(b){b=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"}},b||{});return this.each(function(){var f=this;var d=function(h,n){var g=a(n.xmlGrid.config,h)[0];var m=a(n.xmlGrid.data,h)[0];if(xmlJsonClass.xml2json&&a.jgrid.parse){var p=xmlJsonClass.xml2json(g," ");var p=a.jgrid.parse(p);for(var j in p){var k=p[j]}if(m){var l=p.grid.datatype;p.grid.datatype="xmlstring";p.grid.datastr=h;a(f).jqGrid(k).jqGrid("setGridParam",{datatype:l})}else{a(f).jqGrid(k)}p=null;k=null}else{alert("xml2json or parse are not present")}};var e=function(h,l){if(h&&typeof h=="string"){var g=a.jgrid.parse(h);var m=g[l.jsonGrid.config];var j=g[l.jsonGrid.data];if(j){var k=m.datatype;m.datatype="jsonstring";m.datastr=j;a(f).jqGrid(m).jqGrid("setGridParam",{datatype:k})}else{a(f).jqGrid(m)}}};switch(b.imptype){case"xml":a.ajax({url:b.impurl,type:b.mtype,data:b.impData,dataType:"xml",complete:function(g,h){if(h=="success"){d(g.responseXML,b);if(a.isFunction(b.importComplete)){b.importComplete(g)}}g=null}});break;case"xmlstring":if(b.impstring&&typeof b.impstring=="string"){var c=a.jgrid.stringToDoc(b.impstring);if(c){d(c,b);if(a.isFunction(b.importComplete)){b.importComplete(c)}b.impstring=null}c=null}break;case"json":a.ajax({url:b.impurl,type:b.mtype,data:b.impData,dataType:"json",complete:function(g,h){if(h=="success"){e(g.responseText,b);if(a.isFunction(b.importComplete)){b.importComplete(g)}}g=null}});break;case"jsonstring":if(b.impstring&&typeof b.impstring=="string"){e(b.impstring,b);if(a.isFunction(b.importComplete)){b.importComplete(b.impstring)}b.impstring=null}break}})},jqGridExport:function(c){c=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},c||{});var b=null;this.each(function(){if(!this.grid){return}var e=a(this).jqGrid("getGridParam");if(e.rownumbers){e.colNames.splice(0);e.colModel.splice(0)}if(e.multiselect){e.colNames.splice(0);e.colModel.splice(0)}if(e.subgrid){e.colNames.splice(0);e.colModel.splice(0)}if(e.treeGrid){for(var d in e.treeReader){e.colNames.splice(e.colNames.length-1);e.colModel.splice(e.colModel.length-1)}}switch(c.exptype){case"xmlstring":b="<"+c.root+">"+xmlJsonClass.json2xml(e,c.ident)+"</"+c.root+">";break;case"jsonstring":b="{"+xmlJsonClass.toJson(e,c.root,c.ident)+"}";break}});return b}})})(jQuery);(function(a){a.jgrid.extend({editRow:function(c,j,h,k,b,e,d,f,g){return this.each(function(){var o=this,t,p,m,n=0,s=null,r={},l,q;if(!o.grid){return}l=a(o).jqGrid("getInd",c,true);if(l==false){return}m=a(l).attr("editable")||"0";if(m=="0"){q=o.p.colModel;a("td",l).each(function(x){t=q[x].name;var w=o.p.treeGrid===true&&t==o.p.ExpandColumn;if(w){p=a("span:first",this).html()}else{try{p=a.unformat(this,{colModel:q[x]},x)}catch(u){p=a(this).html()}}if(t!="cb"&&t!="subgrid"&&t!="rn"){r[t]=p;if(q[x].editable===true){if(s===null){s=x}if(w){a("span:first",this).html("")}else{a(this).html("")}var v=a.extend({},q[x].editoptions||{},{id:c+"_"+t,name:t});if(!q[x].edittype){q[x].edittype="text"}var y=createEl(q[x].edittype,v,p,true);a(y).addClass("editable");if(w){a("span:first",this).append(y)}else{a(this).append(y)}if(q[x].edittype=="select"&&q[x].editoptions.multiple===true&&a.browser.msie){a(y).width(a(y).width())}n++}}});if(n>0){r.id=c;o.p.savedRow.push(r);a(l).attr("editable","1");a("td:eq("+s+") input",l).focus();if(j===true){a(l).bind("keydown",function(u){if(u.keyCode===27){a(o).jqGrid("restoreRow",c,g)}if(u.keyCode===13){a(o).jqGrid("saveRow",c,k,b,e,d,f,g);return false}u.stopPropagation()})}if(a.isFunction(h)){h(c)}}}})},saveRow:function(h,g,e,f,d,c,b){return this.each(function(){var p=this,v,q={},m={},l,s,r,j;if(!p.grid){return}j=a(p).jqGrid("getInd",h,true);if(j==false){return}l=a(j).attr("editable");e=e?e:p.p.editurl;if(l==="1"&&e){var u;a("td",j).each(function(w){u=p.p.colModel[w];v=u.name;if(v!="cb"&&v!="subgrid"&&u.editable===true&&v!="rn"){switch(u.edittype){case"checkbox":var k=["Yes","No"];if(u.editoptions){k=u.editoptions.value.split(":")}q[v]=a("input",this).attr("checked")?k[0]:k[1];break;case"text":case"password":case"textarea":case"button":q[v]=!p.p.autoencode?a("input, textarea",this).val():a.jgrid.htmlEncode(a("input, textarea",this).val());break;case"select":if(!u.editoptions.multiple){q[v]=a("select>option:selected",this).val();m[v]=a("select>option:selected",this).text()}else{var x=a("select",this),y=[];q[v]=a(x).val();if(q[v]){q[v]=q[v].join(",")}else{q[v]=""}a("select > option:selected",this).each(function(z,A){y[z]=a(A).text()});m[v]=y.join(",")}if(u.formatter&&u.formatter=="select"){m={}}break}r=checkValues(q[v],w,p);if(r[0]===false){r[1]=q[v]+" "+r[1];return false}}});if(r[0]===false){try{info_dialog(a.jgrid.errors.errcap,r[1],a.jgrid.edit.bClose)}catch(t){alert(r[1])}return}if(q){q.id=h;if(f){q=a.extend({},q,f)}}if(!p.grid.hDiv.loading){p.grid.hDiv.loading=true;a("div.loading",p.grid.hDiv).fadeIn("fast");if(e=="clientArray"){q=a.extend({},q,m);var o=a(p).jqGrid("setRowData",h,q);a(j).attr("editable","0");for(var n=0;n<p.p.savedRow.length;n++){if(p.p.savedRow[n].id==h){s=n;break}}if(s>=0){p.p.savedRow.splice(s,1)}if(a.isFunction(d)){d(h,o)}}else{a.ajax({url:e,data:q,type:"POST",complete:function(y,z){if(z==="success"){var x;if(a.isFunction(g)){x=g(y)}else{x=true}if(x===true){q=a.extend({},q,m);a(p).jqGrid("setRowData",h,q);a(j).attr("editable","0");for(var w=0;w<p.p.savedRow.length;w++){if(p.p.savedRow[w].id==h){s=w;break}}if(s>=0){p.p.savedRow.splice(s,1)}if(a.isFunction(d)){d(h,y.responseText)}}else{a(p).jqGrid("restoreRow",h,b)}}},error:function(k,w){if(a.isFunction(c)){c(h,k,w)}else{alert("Error Row: "+h+" Result: "+k.status+":"+k.statusText+" Status: "+w)}}})}p.grid.hDiv.loading=false;a("div.loading",p.grid.hDiv).fadeOut("fast");a(j).unbind("keydown")}}})},restoreRow:function(c,b){return this.each(function(){var j=this,d,g;if(!j.grid){return}g=a(j).jqGrid("getInd",c,true);if(g==false){return}for(var f=0;f<j.p.savedRow.length;f++){if(j.p.savedRow[f].id==c){d=f;break}}if(d>=0){if(a.isFunction(a.fn.datepicker)){try{a("input.hasDatepicker","#"+g.id).datepicker("hide")}catch(h){}}a(j).jqGrid("setRowData",c,j.p.savedRow[d]);a(g).attr("editable","0");j.p.savedRow.splice(d,1)}if(a.isFunction(b)){b(c)}})}})})(jQuery);(function(b){if(b.browser.msie&&b.browser.version==8){b.expr[":"].hidden=function(c){return c.offsetWidth===0||c.offsetHeight===0||c.style.display=="none"}}if(b.ui.multiselect&&b.ui.multiselect.prototype._setSelected){var a=b.ui.multiselect.prototype._setSelected;b.ui.multiselect.prototype._setSelected=function(f,e){var d=a.call(this,f,e);if(e&&this.selectedList){var c=this.element;this.selectedList.find("li").each(function(){if(b(this).data("optionLink")){b(this).data("optionLink").remove().appendTo(c)}})}return d}}b.jgrid.extend({sortableColumns:function(c){return this.each(function(){ts=this;function f(){ts.p.disableClick=true}var e={tolerance:"pointer",axis:"x",items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)",placeholder:{element:function(h){var g=b(document.createElement(h[0].nodeName)).addClass(h[0].className+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0];return g},update:function(g,h){h.height(g.currentItem.innerHeight()-parseInt(g.currentItem.css("paddingTop")||0,10)-parseInt(g.currentItem.css("paddingBottom")||0,10));h.width(g.currentItem.innerWidth()-parseInt(g.currentItem.css("paddingLeft")||0,10)-parseInt(g.currentItem.css("paddingRight")||0,10))}},update:function(k,m){var n=b(m.item).parent();var j=b(">th",n);var g=ts.p.colModel;var l={};b.each(g,function(o){l[this.name]=o});var h=[];j.each(function(o){var p=b(">div",this).get(0).id.replace(/^jqgh_/,"");if(p in l){h.push(l[p])}});b(ts).jqGrid("remapColumns",h,true,true);if(b.isFunction(ts.p.sortable.update)){ts.p.sortable.update(h)}setTimeout(function(){ts.p.disableClick=false},50)}};if(ts.p.sortable.options){b.extend(e,ts.p.sortable.options)}else{if(b.isFunction(ts.p.sortable)){ts.p.sortable={update:ts.p.sortable}}}if(e.start){var d=e.start;e.start=function(h,g){f();d.call(this,h,g)}}else{e.start=f}if(ts.p.sortable.exclude){e.items+=":not("+ts.p.sortable.exclude+")"}c.sortable(e).data("sortable").floating=true})},columnChooser:function(c){var l=this;var d=b('<div style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');var k=b("select",d);c=b.extend({title:"Select columns",width:420,height:240,classname:null,done:function(o){if(o){l.jqGrid("remapColumns",o,true)}},ok:"Ok",cancel:"Cancel",msel:"multiselect",dlog:"dialog",dlog_opts:function(p){var o={};o[p.ok]=function(){p.apply_perm();p.cleanup(false)};o[p.cancel]=function(){p.cleanup(true)};return{buttons:o,close:function(){p.cleanup(true)},resizable:false,width:p.width+20}},apply_perm:function(){b("option",k).each(function(p){if(this.selected){l.jqGrid("showCol",j[this.value].name)}else{l.jqGrid("hideCol",j[this.value].name)}});var o=h.slice(0);b("option[selected]",k).each(function(){o.push(parseInt(this.value))});b.each(o,function(){delete g[j[this].name]});b.each(g,function(){o.push(this)});if(c.done){c.done.call(l,o)}},cleanup:function(o){m(c.dlog,d,"destroy");m(c.msel,k,"destroy");d.remove();if(o&&c.done){c.done.call(l)}}},c||{});if(c.title){d.attr("title",c.title)}if(c.classname){d.addClass(classname);k.addClass(classname)}if(c.width){b(">div",d).css({width:c.width,margin:"0 auto"});k.css("width",c.width)}if(c.height){b(">div",d).css("height",c.height);k.css("height",c.height-10)}var j=l.jqGrid("getGridParam","colModel");var n=l.jqGrid("getGridParam","colNames");var g={},h=[];k.empty();b.each(j,function(o){g[this.name]=o;if(this.hidedlg){if(!this.hidden){h.push(o)}return}k.append("<option value='"+o+"' "+(this.hidden?"":"selected='selected'")+">"+n[o]+"</option>")});function m(o,p){if(!o){return}if(typeof o=="string"){if(b.fn[o]){b.fn[o].apply(p,b.makeArray(arguments).slice(2))}}else{if(b.isFunction(o)){o.apply(p,b.makeArray(arguments).slice(2))}}}var e=b.isFunction(c.dlog_opts)?c.dlog_opts.call(l,c):c.dlog_opts;m(c.dlog,d,e);var f=b.isFunction(c.msel_opts)?c.msel_opts.call(l,c):c.msel_opts;m(c.msel,k,c.msel_opts)}})})(jQuery);(function(a){a.jgrid.extend({getPostData:function(){var b=this[0];if(!b.grid){return}return b.p.postData},setPostData:function(b){var c=this[0];if(!c.grid){return}if(typeof(b)==="object"){c.p.postData=b}else{alert("Error: cannot add a non-object postData value. postData unchanged.")}},appendPostData:function(b){var c=this[0];if(!c.grid){return}if(typeof(b)==="object"){a.extend(c.p.postData,b)}else{alert("Error: cannot append a non-object postData value. postData unchanged.")}},setPostDataItem:function(b,c){var d=this[0];if(!d.grid){return}d.p.postData[b]=c},getPostDataItem:function(b){var c=this[0];if(!c.grid){return}return c.p.postData[b]},removePostDataItem:function(b){var c=this[0];if(!c.grid){return}delete c.p.postData[b]},getUserData:function(){var b=this[0];if(!b.grid){return}return b.p.userData},getUserDataItem:function(b){var c=this[0];if(!c.grid){return}return c.p.userData[b]}})})(jQuery);(function(a){a.jgrid.extend({setColumns:function(b){b=a.extend({top:0,left:0,width:200,height:"auto",dataheight:"auto",modal:false,drag:true,beforeShowForm:null,afterShowForm:null,afterSubmitForm:null,closeOnEscape:true,ShrinkToFit:false,jqModal:false,saveicon:[true,"left","ui-icon-disk"],closeicon:[true,"left","ui-icon-close"],onClose:null,colnameview:true,closeAfterSubmit:true,updateAfterCheck:false},a.jgrid.col,b||{});return this.each(function(){var j=this;if(!j.grid){return}var k=typeof b.beforeShowForm==="function"?true:false;var d=typeof b.afterShowForm==="function"?true:false;var e=typeof b.afterSubmitForm==="function"?true:false;if(!b.imgpath){b.imgpath=j.p.imgpath}var c=j.p.id,h="ColTbl_"+c,f={themodal:"colmod"+c,modalhead:"colhd"+c,modalcontent:"colcnt"+c,scrollelm:h};if(a("#"+f.themodal).html()!=null){if(k){b.beforeShowForm(a("#"+h))}viewModal("#"+f.themodal,{gbox:"#gbox_"+c,jqm:b.jqModal,jqM:false,modal:b.modal});if(d){b.afterShowForm(a("#"+h))}}else{var l=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";var m="<div id='"+h+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+l+";'>";m+="<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>";for(i=0;i<this.p.colNames.length;i++){if(!j.p.colModel[i].hidedlg){m+="<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_"+this.p.colModel[i].name+"' class='cbox' value='T' "+((this.p.colModel[i].hidden===false)?"checked":"")+"/><label for='col_"+this.p.colModel[i].name+"'>"+this.p.colNames[i]+((b.colnameview)?" ("+this.p.colModel[i].name+")":"")+"</label></td></tr>"}}m+="</tbody></table></div>";var g=!b.updateAfterCheck?"<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>":"",n="<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>";m+="<table border='0' class='EditTable' id='"+h+"_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>"+g+"&nbsp;"+n+"</td></tr></tbody></table>";b.gbox="#gbox_"+c;createModal(f,m,b,"#gview_"+j.p.id,a("#gview_"+j.p.id)[0]);if(b.saveicon[0]==true){a("#dData","#"+h+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>")}if(b.closeicon[0]==true){a("#eData","#"+h+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>")}if(!b.updateAfterCheck){a("#dData","#"+h+"_2").click(function(p){for(i=0;i<j.p.colModel.length;i++){if(!j.p.colModel[i].hidedlg){var o=j.p.colModel[i].name.replace(".","\\.");if(a("#col_"+o,"#"+h).attr("checked")){a(j).jqGrid("showCol",j.p.colModel[i].name);a("#col_"+o,"#"+h).attr("defaultChecked",true)}else{a(j).jqGrid("hideCol",j.p.colModel[i].name);a("#col_"+o,"#"+h).attr("defaultChecked","")}}}if(b.ShrinkToFit===true){a(j).jqGrid("setGridWidth",j.grid.width-0.001,true)}if(b.closeAfterSubmit){hideModal("#"+f.themodal,{gb:"#gbox_"+c,jqm:b.jqModal,onClose:b.onClose})}if(e){b.afterSubmitForm(a("#"+h))}return false})}else{a(":input","#"+h).click(function(o){var p=this.id.substr(4);if(p){if(this.checked){a(j).jqGrid("showCol",p)}else{a(j).jqGrid("hideCol",p)}if(b.ShrinkToFit===true){a(j).jqGrid("setGridWidth",j.grid.width-0.001,true)}}return this})}a("#eData","#"+h+"_2").click(function(o){hideModal("#"+f.themodal,{gb:"#gbox_"+c,jqm:b.jqModal,onClose:b.onClose});return false});a("#dData, #eData","#"+h+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});if(k){b.beforeShowForm(a("#"+h))}viewModal("#"+f.themodal,{gbox:"#gbox_"+c,jqm:b.jqModal,jqM:true,modal:b.modal});if(d){b.afterShowForm(a("#"+h))}}})}})})(jQuery);(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var c=this,b;c.p.colNames.unshift("");c.p.colModel.unshift({name:"subgrid",width:a.browser.safari?c.p.subGridWidth+c.p.cellLayout:c.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false});b=c.p.subGridModel;if(b[0]){b[0].align=a.extend([],b[0].align||[]);for(i=0;i<b[0].name.length;i++){b[0].align[i]=b[0].align[i]||"left"}}})},addSubGridCell:function(e,c){var b="",d;this.each(function(){b=this.formatCol(e,c);d=this.p.gridview});if(d===false){return"<td role='grid' class='ui-sgcollapsed sgcollapsed' "+b+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>"}else{return"<td role='grid' "+b+"></td>"}},addSubGrid:function(b,c){return this.each(function(){var m=this;if(!m.grid){return}var n,o,p,j,k,g,h;a("td:eq("+c+")",b).click(function(q){if(a(this).hasClass("sgcollapsed")){p=m.p.id;n=a(this).parent();j=c>=1?"<td colspan='"+c+"'>&nbsp;</td>":"";o=a(n).attr("id");h=true;if(a.isFunction(m.p.subGridBeforeExpand)){h=m.p.subGridBeforeExpand(p+"_"+o,o)}if(h===false){return false}k=0;a.each(m.p.colModel,function(s,r){if(this.hidden===true||this.name=="rn"||this.name=="cb"){k++}});g="<tr role='row' class='ui-subgrid'>"+j+"<td><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='"+parseInt(m.p.colNames.length-1-k)+"' class='ui-widget-content subgrid-data'><div id="+p+"_"+o+" class='tablediv'>";a(this).parent().after(g+"</div></td></tr>");if(a.isFunction(m.p.subGridRowExpanded)){m.p.subGridRowExpanded(p+"_"+o,o)}else{l(n)}a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded")}else{if(a(this).hasClass("sgexpanded")){h=true;if(a.isFunction(m.p.subGridRowColapsed)){n=a(this).parent();o=a(n).attr("id");h=m.p.subGridRowColapsed(p+"_"+o,o)}if(h===false){return false}a(this).parent().next().remove(".ui-subgrid");a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}}return false});var l=function(u){var t,q,v,s,r;q=a(u).attr("id");v={id:q,nd_:(new Date().getTime())};if(!m.p.subGridModel[0]){return false}if(m.p.subGridModel[0].params){for(r=0;r<m.p.subGridModel[0].params.length;r++){for(s=0;s<m.p.colModel.length;s++){if(m.p.colModel[s].name==m.p.subGridModel[0].params[r]){v[m.p.colModel[s].name]=a("td:eq("+s+")",u).text().replace(/\&nbsp\;/ig,"")}}}}if(!m.grid.hDiv.loading){m.grid.hDiv.loading=true;a("#load_"+m.p.id).show();if(!m.p.subgridtype){m.p.subgridtype=m.p.datatype}if(a.isFunction(m.p.subgridtype)){m.p.subgridtype(v)}switch(m.p.subgridtype){case"xml":a.ajax({type:m.p.mtype,url:m.p.subGridUrl,dataType:"xml",data:v,complete:function(w){d(w.responseXML,q);w=null}});break;case"json":a.ajax({type:m.p.mtype,url:m.p.subGridUrl,dataType:"text",data:v,complete:function(w){f(a.jgrid.parse(w.responseText),q);w=null}});break}}return false};var e=function(r,q,t){var s=a("<td align='"+m.p.subGridModel[0].align[t]+"'></td>").html(q);a(r).append(s)};var d=function(v,t){var x,u,w,q,s=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),r=a("<tr></tr>");for(u=0;u<m.p.subGridModel[0].name.length;u++){x=a("<th class='ui-state-default ui-th-column'></th>");a(x).html(m.p.subGridModel[0].name[u]);a(x).width(m.p.subGridModel[0].width[u]);a(r).append(x)}a(s).append(r);if(v){q=m.p.xmlReader.subgrid;a(q.root+" "+q.row,v).each(function(){r=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(q.repeatitems===true){a(q.cell,this).each(function(A){e(r,a(this).text()||"&nbsp;",A)})}else{var z=m.p.subGridModel[0].mapping||m.p.subGridModel[0].name;if(z){for(u=0;u<z.length;u++){e(r,a(z[u],this).text()||"&nbsp;",u)}}}a(s).append(r)})}var y=a("table:first",m.grid.bDiv).attr("id")+"_";a("#"+y+t).append(s);m.grid.hDiv.loading=false;a("#load_"+m.p.id).hide();return false};var f=function(x,u){var z,B,v,y,q,s=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),r=a("<tr></tr>");for(v=0;v<m.p.subGridModel[0].name.length;v++){z=a("<th class='ui-state-default ui-th-column'></th>");a(z).html(m.p.subGridModel[0].name[v]);a(z).width(m.p.subGridModel[0].width[v]);a(r).append(z)}a(s).append(r);if(x){q=m.p.jsonReader.subgrid;B=x[q.root];if(typeof B!=="undefined"){for(v=0;v<B.length;v++){y=B[v];r=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(q.repeatitems===true){if(q.cell){y=y[q.cell]}for(var t=0;t<y.length;t++){e(r,y[t]||"&nbsp;",t)}}else{var w=m.p.subGridModel[0].mapping||m.p.subGridModel[0].name;if(w.length){for(var t=0;t<w.length;t++){e(r,y[w[t]]||"&nbsp;",t)}}}a(s).append(r)}}}var A=a("table:first",m.grid.bDiv).attr("id")+"_";a("#"+A+u).append(s);m.grid.hDiv.loading=false;a("#load_"+m.p.id).hide();return false};m.subGridXml=function(r,q){d(r,q)};m.subGridJson=function(r,q){f(r,q)}})},expandSubGridRow:function(b){return this.each(function(){var e=this;if(!e.grid&&!b){return}if(e.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){var d=a("td.sgcollapsed",c)[0];if(d){a(d).trigger("click")}}}})},collapseSubGridRow:function(b){return this.each(function(){var e=this;if(!e.grid&&!b){return}if(e.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){var d=a("td.sgexpanded",c)[0];if(d){a(d).trigger("click")}}}})},toggleSubGridRow:function(b){return this.each(function(){var e=this;if(!e.grid&&!b){return}if(e.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){var d=a("td.sgcollapsed",c)[0];if(d){a(d).trigger("click")}else{d=a("td.sgexpanded",c)[0];if(d){a(d).trigger("click")}}}}})}})})(jQuery);function tableToGrid(a,b){$(a).each(function(){if(this.grid){return}$(this).width("99%");var o=$(this).width();var q=$("input[type=checkbox]:first",$(this));var h=$("input[type=radio]:first",$(this));var d=q.length>0;var g=!d&&h.length>0;var k=d||g;var j=q.attr("name")||h.attr("name");var m=[];var p=[];$("th",$(this)).each(function(){if(m.length==0&&k){m.push({name:"__selection__",index:"__selection__",width:0,hidden:true});p.push("__selection__")}else{m.push({name:$(this).attr("id")||$(this).html(),index:$(this).attr("id")||$(this).html(),width:$(this).width()||150});p.push($(this).html())}});var f=[];var e=[];var n=[];$("tbody > tr",$(this)).each(function(){var s={};var r=0;$("td",$(this)).each(function(){if(r==0&&k){var t=$("input",$(this));var u=t.attr("value");e.push(u||f.length);if(t.attr("checked")){n.push(u)}s[m[r].name]=t.attr("value")}else{s[m[r].name]=$(this).html()}r++});if(r>0){f.push(s)}});$(this).empty();$(this).addClass("scroll");$(this).jqGrid($.extend({datatype:"local",width:o,colNames:p,colModel:m,multiselect:d},b||{}));for(var l=0;l<f.length;l++){var c=null;if(e.length>0){c=e[l];if(c&&c.replace){c=encodeURIComponent(c).replace(/[.\-%]/g,"_")}}if(c==null){c=l+1}$(this).jqGrid("addRowData",c,f[l])}for(var l=0;l<n.length;l++){$(this).jqGrid("setSelection",n[l])}})}(function(a){a.jgrid.extend({setTreeNode:function(b,c){return this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}var k=g.p.expColInd;var j=g.p.treeReader.expanded_field;var f=g.p.treeReader.leaf_field;var e=g.p.treeReader.level_field;c.level=b[e];if(g.p.treeGridModel=="nested"){c.lft=b[g.p.treeReader.left_field];c.rgt=b[g.p.treeReader.right_field];if(!b[f]){b[f]=(parseInt(c.rgt,10)===parseInt(c.lft,10)+1)?"true":"false"}}else{c.parent_id=b[g.p.treeReader.parent_id_field]}var l=parseInt(c.level,10),h,m;if(g.p.tree_root_level===0){h=l+1;m=l}else{h=l;m=l-1}var d="<div class='tree-wrap' style='width:"+(h*18)+"px;'>";d+="<div style='left:"+(m*18)+"px;' class='ui-icon ";if(b[f]=="true"||b[f]==true){d+=g.p.treeIcons.leaf+" tree-leaf'";c.isLeaf=true}else{if(b[j]=="true"||b[j]==true){d+=g.p.treeIcons.minus+" tree-minus treeclick'";c.expanded=true}else{d+=g.p.treeIcons.plus+" tree-plus treeclick'";c.expanded=false}c.isLeaf=false}d+="</div></div>";if(parseInt(b[e],10)!==parseInt(g.p.tree_root_level,10)){if(!a(g).jqGrid("isVisibleNode",c)){a(c).css("display","none")}}a("td:eq("+k+")",c).wrapInner("<span></span>").prepend(d);a(".treeclick",c).bind("click",function(p){var o=p.target||p.srcElement;var n=a(o,g.rows).parents("tr.jqgrow")[0].rowIndex;if(!g.rows[n].isLeaf){if(g.rows[n].expanded){a(g).jqGrid("collapseRow",g.rows[n]);a(g).jqGrid("collapseNode",g.rows[n])}else{a(g).jqGrid("expandRow",g.rows[n]);a(g).jqGrid("expandNode",g.rows[n])}}return false});if(g.p.ExpandColClick===true){a("span",c).css("cursor","pointer").bind("click",function(p){var o=p.target||p.srcElement;var n=a(o,g.rows).parents("tr.jqgrow")[0].rowIndex;if(!g.rows[n].isLeaf){if(g.rows[n].expanded){a(g).jqGrid("collapseRow",g.rows[n]);a(g).jqGrid("collapseNode",g.rows[n])}else{a(g).jqGrid("expandRow",g.rows[n]);a(g).jqGrid("expandNode",g.rows[n])}}a(g).jqGrid("setSelection",g.rows[n].id);return false})}})},setTreeGrid:function(){return this.each(function(){var d=this,c=0;if(!d.p.treeGrid){return}if(!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-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[b].name==d.p.ExpandColumn){d.p.expColInd=c;break}c++}if(!d.p.expColInd){d.p.expColInd=0}a.each(d.p.treeReader,function(e,f){if(f){d.p.colNames.push(f);d.p.colModel.push({name:f,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})})},expandRow:function(b){this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}var c=a(d).jqGrid("getNodeChildren",b);a(c).each(function(e){a(this).css("display","");if(this.expanded){a(d).jqGrid("expandRow",this)}})})},collapseRow:function(b){this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}var c=a(d).jqGrid("getNodeChildren",b);a(c).each(function(e){a(this).css("display","none");a(d).jqGrid("collapseRow",this)})})},getRootNodes:function(){var b=[];this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}switch(d.p.treeGridModel){case"nested":var c=d.p.treeReader.level_field;a(d.rows).each(function(e){if(parseInt(this[c],10)===parseInt(d.p.tree_root_level,10)){b.push(this)}});break;case"adjacency":a(d.rows).each(function(e){if(this.parent_id==null||this.parent_id.toLowerCase()=="null"){b.push(this)}});break}});return b},getNodeDepth:function(c){var b=null;this.each(function(){var d=this;if(!this.grid||!this.p.treeGrid){return}switch(d.p.treeGridModel){case"nested":b=parseInt(c.level,10)-parseInt(this.p.tree_root_level,10);break;case"adjacency":b=a(d).jqGrid("getNodeAncestors",c).length;break}});return b},getNodeParent:function(c){var b=null;this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}switch(g.p.treeGridModel){case"nested":var e=parseInt(c.lft,10),d=parseInt(c.rgt,10),f=parseInt(c.level,10);a(this.rows).each(function(){if(parseInt(this.level,10)===f-1&&parseInt(this.lft)<e&&parseInt(this.rgt)>d){b=this;return false}});break;case"adjacency":a(this.rows).each(function(){if(this.id==c.parent_id){b=this;return false}});break}});return b},getNodeChildren:function(c){var b=[];this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}switch(g.p.treeGridModel){case"nested":var e=parseInt(c.lft,10),d=parseInt(c.rgt,10),f=parseInt(c.level,10);a(this.rows).each(function(h){if(parseInt(this.level,10)===f+1&&parseInt(this.lft,10)>e&&parseInt(this.rgt,10)<d){b.push(this)}});break;case"adjacency":a(this.rows).each(function(h){if(this.parent_id==c.id){b.push(this)}});break}});return b},getFullTreeNode:function(c){var b=[];this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}switch(g.p.treeGridModel){case"nested":var e=parseInt(c.lft,10),d=parseInt(c.rgt,10),f=parseInt(c.level,10);a(this.rows).each(function(h){if(parseInt(this.level,10)>=f&&parseInt(this.lft,10)>=e&&parseInt(this.lft,10)<=d){b.push(this)}});break;case"adjacency":b.push(c);a(this.rows).each(function(h){len=b.length;for(h=0;h<len;h++){if(b[h].id==this.parent_id){b.push(this);break}}});break}});return b},getNodeAncestors:function(c){var b=[];this.each(function(){if(!this.grid||!this.p.treeGrid){return}var d=a(this).jqGrid("getNodeParent",c);while(d){b.push(d);d=a(this).jqGrid("getNodeParent",d)}});return b},isVisibleNode:function(c){var b=true;this.each(function(){var e=this;if(!e.grid||!e.p.treeGrid){return}var d=a(e).jqGrid("getNodeAncestors",c);a(d).each(function(){b=b&&this.expanded;if(!b){return false}})});return b},isNodeLoaded:function(c){var b;this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}if(c.loaded!==undefined){b=c.loaded}else{if(c.isLeaf||a(d).jqGrid("getNodeChildren",c).length>0){b=true}else{b=false}}});return b},expandNode:function(b){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}if(!b.expanded){if(a(this).jqGrid("isNodeLoaded",b)){b.expanded=true;a("div.treeclick",b).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{b.expanded=true;a("div.treeclick",b).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=b.rowIndex;this.p.datatype=this.p.treedatatype;if(this.p.treeGridModel=="nested"){a(this).jqGrid("setGridParam",{postData:{nodeid:b.id,n_left:b.lft,n_right:b.rgt,n_level:b.level}})}else{a(this).jqGrid("setGridParam",{postData:{nodeid:b.id,parentid:b.parent_id,n_level:b.level}})}a(this).trigger("reloadGrid");if(this.p.treeGridModel=="nested"){a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}})}else{a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(b){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}if(b.expanded){b.expanded=false;a("div.treeclick",b).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},SortTree:function(b){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}var f,c,g,e=[],h=this,d=a(this).jqGrid("getRootNodes");d.sort(function(k,j){if(k.sortKey<j.sortKey){return -b}if(k.sortKey>j.sortKey){return b}return 0});if(d[0]){a("td",d[0]).each(function(j){a(this).css("width",h.grid.headers[j].width+"px")});h.grid.cols=d[0].cells}for(f=0,c=d.length;f<c;f++){g=d[f];e.push(g);a(this).jqGrid("collectChildrenSortTree",e,g,b)}a.each(e,function(j,k){a("tbody",h.grid.bDiv).append(k);k.sortKey=null})})},collectChildrenSortTree:function(b,d,c){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}var g,e,h,f=a(this).jqGrid("getNodeChildren",d);f.sort(function(k,j){if(k.sortKey<j.sortKey){return -c}if(k.sortKey>j.sortKey){return c}return 0});for(g=0,e=f.length;g<e;g++){h=f[g];b.push(h);a(this).jqGrid("collectChildrenSortTree",b,h,c)}})},setTreeRow:function(c,d){var b,e=false;this.each(function(){var f=this;if(!f.grid||!f.p.treeGrid){return}e=a(f).jqGrid("setRowData",c,d)});return e},delTreeNode:function(b){return this.each(function(){var f=this;if(!f.grid||!f.p.treeGrid){return}var d=a(f).jqGrid("getInd",b,true);if(d){var e=a(f).jqGrid("getNodeChildren",d);if(e.length>0){for(var c=0;c<e.length;c++){a(f).jqGrid("delRowData",e[c].id)}}a(f).jqGrid("delRowData",d.id)}})}})})(jQuery);(function(g){g.fn.jqDrag=function(f){return c(this,f,"d")};g.fn.jqResize=function(j,f){return c(this,j,"r",f)};g.jqDnR={dnr:{},e:0,drag:function(f){if(h.k=="d"){e.css({left:h.X+f.pageX-h.pX,top:h.Y+f.pageY-h.pY})}else{e.css({width:Math.max(f.pageX-h.pX+h.W,0),height:Math.max(f.pageY-h.pY+h.H,0)});if(M1){a.css({width:Math.max(f.pageX-M1.pX+M1.W,0),height:Math.max(f.pageY-M1.pY+M1.H,0)})}}return false},stop:function(){g().unbind("mousemove",b.drag).unbind("mouseup",b.stop)}};var b=g.jqDnR,h=b.dnr,e=b.e,a,c=function(m,l,j,f){return m.each(function(){l=(l)?g(l,m):m;l.bind("mousedown",{e:m,k:j},function(k){var q=k.data,o={};e=q.e;a=f?g(f):false;if(e.css("position")!="relative"){try{e.position(o)}catch(n){}}h={X:o.left||d("left")||0,Y:o.top||d("top")||0,W:d("width")||e[0].scrollWidth||0,H:d("height")||e[0].scrollHeight||0,pX:k.pageX,pY:k.pageY,k:q.k};if(a&&q.k!="d"){M1={X:o.left||f1("left")||0,Y:o.top||f1("top")||0,W:a[0].offsetWidth||f1("width")||0,H:a[0].offsetHeight||f1("height")||0,pX:k.pageX,pY:k.pageY,k:q.k}}else{M1=false}g().mousemove(g.jqDnR.drag).mouseup(g.jqDnR.stop);return false})})},d=function(f){return parseInt(e.css(f))||false};f1=function(f){return parseInt(a.css(f))||false}})(jQuery);(function(d){d.fn.jqm=function(f){var e={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:n,ajaxText:"",target:n,modal:n,toTop:n,onShow:n,onHide:n,onLoad:n};return this.each(function(){if(this._jqm){return l[this._jqm].c=d.extend({},l[this._jqm].c,f)}o++;this._jqm=o;l[o]={c:d.extend(e,d.jqm.params,f),a:n,w:d(this).addClass("jqmID"+o),s:o};if(e.trigger){d(this).jqmAddTrigger(e.trigger)}})};d.fn.jqmAddClose=function(f){return k(this,f,"jqmHide")};d.fn.jqmAddTrigger=function(f){return k(this,f,"jqmShow")};d.fn.jqmShow=function(e){return this.each(function(){d.jqm.open(this._jqm,e)})};d.fn.jqmHide=function(e){return this.each(function(){d.jqm.close(this._jqm,e)})};d.jqm={hash:{},open:function(B,A){var p=l[B],q=p.c,m="."+q.closeClass,v=(parseInt(p.w.css("z-index")));v=(v>0)?v:3000;var f=d("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":v-1,opacity:q.overlay/100});if(p.a){return n}p.t=A;p.a=true;p.w.css("z-index",v);if(q.modal){if(!a[0]){setTimeout(function(){j("bind")},1)}a.push(B)}else{if(q.overlay>0){if(q.closeoverlay){p.w.jqmAddClose(f)}}else{f=n}}p.o=(f)?f.addClass(q.overlayClass).prependTo("body"):n;if(c){d("html,body").css({height:"100%",width:"100%"});if(f){f=f.css({position:"absolute"})[0];for(var w in {Top:1,Left:1}){f.style.setExpression(w.toLowerCase(),"(_=(document.documentElement.scroll"+w+" || document.body.scroll"+w+"))+'px'")}}}if(q.ajax){var e=q.target||p.w,x=q.ajax;e=(typeof e=="string")?d(e,p.w):d(e);x=(x.substr(0,1)=="@")?d(A).attr(x.substring(1)):x;e.html(q.ajaxText).load(x,function(){if(q.onLoad){q.onLoad.call(this,p)}if(m){p.w.jqmAddClose(d(m,p.w))}h(p)})}else{if(m){p.w.jqmAddClose(d(m,p.w))}}if(q.toTop&&p.o){p.w.before('<span id="jqmP'+p.w[0]._jqm+'"></span>').insertAfter(p.o)}(q.onShow)?q.onShow(p):p.w.show();h(p);return n},close:function(f){var e=l[f];if(!e.a){return n}e.a=n;if(a[0]){a.pop();if(!a[0]){j("unbind")}}if(e.c.toTop&&e.o){d("#jqmP"+e.w[0]._jqm).after(e.w).remove()}if(e.c.onHide){e.c.onHide(e)}else{e.w.hide();if(e.o){e.o.remove()}}return n},params:{}};var o=0,l=d.jqm.hash,a=[],c=d.browser.msie&&(d.browser.version=="6.0"),n=false,h=function(f){var e=d('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(c){if(f.o){f.o.html('<p style="width:100%;height:100%"/>').prepend(e)}else{if(!d("iframe.jqm",f.w)[0]){f.w.prepend(e)}}}g(f)},g=function(f){try{d(":input:visible",f.w)[0].focus()}catch(e){}},j=function(e){d()[e]("keypress",b)[e]("keydown",b)[e]("mousedown",b)},b=function(p){var f=l[a[a.length-1]],m=(!d(p.target).parents(".jqmID"+f.s)[0]);if(m){g(f)}return !m},k=function(e,f,m){return e.each(function(){var p=this._jqm;d(f).each(function(){if(!this[m]){this[m]=[];d(this).click(function(){for(var q in {jqmShow:1,jqmHide:1}){for(var r in this[q]){if(l[this[q][r]]){l[this[q][r]].w[q](this)}}}return n})}this[m].push(p)})})}})(jQuery);(function(c){c.fmatter={};c.fn.fmatter=function(g,h,f,d,e){f=c.extend({},c.jgrid.formatter,f);return a(g,h,f,d,e)};c.fmatter.util={NumberFormat:function(f,d){if(!isNumber(f)){f*=1}if(isNumber(f)){var h=(f<0);var n=f+"";var k=(d.decimalSeparator)?d.decimalSeparator:".";var l;if(isNumber(d.decimalPlaces)){var m=d.decimalPlaces;var g=Math.pow(10,m);n=Math.round(f*g)/g+"";l=n.lastIndexOf(".");if(m>0){if(l<0){n+=k;l=n.length-1}else{if(k!=="."){n=n.replace(".",k)}}while((n.length-1-l)<m){n+="0"}}}if(d.thousandsSeparator){var p=d.thousandsSeparator;l=n.lastIndexOf(k);l=(l>-1)?l:n.length;var o=n.substring(l);var e=-1;for(var j=l;j>0;j--){e++;if((e%3===0)&&(j!==l)&&(!h||(j>1))){o=p+o}o=n.charAt(j-1)+o}n=o}n=(d.prefix)?d.prefix+n:n;n=(d.suffix)?n+d.suffix:n;return n}else{return f}},DateFormat:function(I,L,O,x){var m=/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,C=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,K=/[^-+\dA-Z]/g,J=function(k,j){k=String(k);j=parseInt(j)||2;while(k.length<j){k="0"+k}return k},d={m:1,d:1,y:1970,h:0,i:0,s:0},g=0,q,E,f,D=["i18n"];D.i18n={dayNames:x.dayNames,monthNames:x.monthNames};if(I in x.masks){I=x.masks[I]}L=L.split(/[\\\/:_;.\t\T\s-]/);I=I.split(/[\\\/:_;.\t\T\s-]/);for(E=0,f=I.length;E<f;E++){if(I[E]=="M"){q=c.inArray(L[E],D.i18n.monthNames);if(q!==-1&&q<12){L[E]=q+1}}if(I[E]=="F"){q=c.inArray(L[E],D.i18n.monthNames);if(q!==-1&&q>11){L[E]=q+1-12}}d[I[E].toLowerCase()]=parseInt(L[E],10)}d.m=parseInt(d.m)-1;var M=d.y;if(M>=70&&M<=99){d.y=1900+d.y}else{if(M>=0&&M<=69){d.y=2000+d.y}}g=new Date(d.y,d.m,d.d,d.h,d.i,d.s,0);if(O in x.masks){O=x.masks[O]}else{if(!O){O="Y-m-d"}}var t=g.getHours(),H=g.getMinutes(),F=g.getDate(),B=g.getMonth()+1,A=g.getTimezoneOffset(),y=g.getSeconds(),v=g.getMilliseconds(),r=g.getDay(),e=g.getFullYear(),l=(r+6)%7+1,p=(new Date(e,B-1,F)-new Date(e,0,1))/86400000,h={d:J(F),D:D.i18n.dayNames[r],j:F,l:D.i18n.dayNames[r+7],N:l,S:x.S(F),w:r,z:p,W:l<5?Math.floor((p+l-1)/7)+1:Math.floor((p+l-1)/7)||((new Date(e-1,0,1).getDay()+6)%7<4?53:52),F:D.i18n.monthNames[B-1+12],m:J(B),M:D.i18n.monthNames[B-1],n:B,t:"?",L:"?",o:"?",Y:e,y:String(e).substring(2),a:t<12?x.AmPm[0]:x.AmPm[1],A:t<12?x.AmPm[2]:x.AmPm[3],B:"?",g:t%12||12,G:t,h:J(t%12||12),H:J(t),i:J(H),s:J(y),u:v,e:"?",I:"?",O:(A>0?"-":"+")+J(Math.floor(Math.abs(A)/60)*100+Math.abs(A)%60,4),P:"?",T:(String(g).match(C)||[""]).pop().replace(K,""),Z:"?",c:"?",r:"?",U:Math.floor(g/1000)};return O.replace(m,function(j){return j in h?h[j]:j.substring(1)})}};c.fn.fmatter.defaultFormat=function(e,d){return(isValue(e)&&e!=="")?e:d.defaultValue?d.defaultValue:"&#160;"};c.fn.fmatter.email=function(e,d){if(!isEmpty(e)){return'<a href="mailto:'+e+'">'+e+"</a>"}else{return c.fn.fmatter.defaultFormat(e,d)}};c.fn.fmatter.checkbox=function(g,e){var h=c.extend({},e.checkbox),f;if(!isUndefined(e.colModel.formatoptions)){h=c.extend({},h,e.colModel.formatoptions)}if(h.disabled===true){f="disabled"}else{f=""}g=g+"";g=g.toLowerCase();var d=g.search(/(false|0|no|off)/i)<0?" checked='checked' ":"";return'<input type="checkbox" '+d+' value="'+g+'" offval="no" '+f+"/>"},c.fn.fmatter.link=function(f,d){var g={target:d.target};var e="";if(!isUndefined(d.colModel.formatoptions)){g=c.extend({},g,d.colModel.formatoptions)}if(g.target){e="target="+g.target}if(!isEmpty(f)){return"<a "+e+' href="'+f+'">'+f+"</a>"}else{return c.fn.fmatter.defaultFormat(f,d)}};c.fn.fmatter.showlink=function(f,d){var g={baseLinkUrl:d.baseLinkUrl,showAction:d.showAction,addParam:d.addParam||"",target:d.target,idName:d.idName},e="";if(!isUndefined(d.colModel.formatoptions)){g=c.extend({},g,d.colModel.formatoptions)}if(g.target){e="target="+g.target}idUrl=g.baseLinkUrl+g.showAction+"?"+g.idName+"="+d.rowId+g.addParam;if(isString(f)){return"<a "+e+' href="'+idUrl+'">'+f+"</a>"}else{return c.fn.fmatter.defaultFormat(f,d)}};c.fn.fmatter.integer=function(e,d){var f=c.extend({},d.integer);if(!isUndefined(d.colModel.formatoptions)){f=c.extend({},f,d.colModel.formatoptions)}if(isEmpty(e)){return f.defaultValue}return c.fmatter.util.NumberFormat(e,f)};c.fn.fmatter.number=function(e,d){var f=c.extend({},d.number);if(!isUndefined(d.colModel.formatoptions)){f=c.extend({},f,d.colModel.formatoptions)}if(isEmpty(e)){return f.defaultValue}return c.fmatter.util.NumberFormat(e,f)};c.fn.fmatter.currency=function(e,d){var f=c.extend({},d.currency);if(!isUndefined(d.colModel.formatoptions)){f=c.extend({},f,d.colModel.formatoptions)}if(isEmpty(e)){return f.defaultValue}return c.fmatter.util.NumberFormat(e,f)};c.fn.fmatter.date=function(f,e,d){var g=c.extend({},e.date);if(!isUndefined(e.colModel.formatoptions)){g=c.extend({},g,e.colModel.formatoptions)}if(!g.reformatAfterEdit&&d=="edit"){return c.fn.fmatter.defaultFormat(f,e)}else{if(!isEmpty(f)){return c.fmatter.util.DateFormat(g.srcformat,f,g.newformat,g)}else{return c.fn.fmatter.defaultFormat(f,e)}}};c.fn.fmatter.select=function(h,d,m){if(!h){h=""}var f=false;if(!isUndefined(d.colModel.editoptions)){f=d.colModel.editoptions.value}if(f){var l=[],p=d.colModel.editoptions.multiple===true?true:false,n=[],o;if(p){n=h.split(",");n=c.map(n,function(j){return c.trim(j)})}if(isString(f)){var e=f.split(";"),g=0;for(var k=0;k<e.length;k++){o=e[k].split(":");if(p){if(jQuery.inArray(o[0],n)>-1){l[g]=o[1];g++}}else{if(c.trim(o[0])==c.trim(h)){l[0]=o[1];break}}}}else{if(isObject(f)){if(p){l=jQuery.map(n,function(q,j){return f[q]})}else{l[0]=f[h]||""}}}return l.join(", ")}};c.unformat=function(g,o,l,e){var k,h=o.colModel.formatter,j=o.colModel.formatoptions||{},p,n=/([\.\*\_\'\(\)\{\}\+\?\\])/g;unformatFunc=o.colModel.unformat||(c.fn.fmatter[h]&&c.fn.fmatter[h].unformat);if(typeof unformatFunc!=="undefined"&&isFunction(unformatFunc)){k=unformatFunc(c(g).text(),o)}else{if(typeof h!=="undefined"&&isString(h)){var d=c.jgrid.formatter||{},m;switch(h){case"integer":j=c.extend({},d.integer,j);p=j.thousandsSeparator.replace(n,"\\$1");m=new RegExp(p,"g");k=c(g).text().replace(m,"");break;case"number":j=c.extend({},d.number,j);p=j.thousandsSeparator.replace(n,"\\$1");m=new RegExp(p,"g");k=c(g).text().replace(j.decimalSeparator,".").replace(m,"");break;case"currency":j=c.extend({},d.currency,j);p=j.thousandsSeparator.replace(n,"\\$1");m=new RegExp(p,"g");k=c(g).text().replace(j.decimalSeparator,".").replace(j.prefix,"").replace(j.suffix,"").replace(m,"");break;case"checkbox":var f=(o.colModel.editoptions)?o.colModel.editoptions.value.split(":"):["Yes","No"];k=c("input",g).attr("checked")?f[0]:f[1];break;case"select":k=c.unformat.select(g,o,l,e);break;default:k=c(g).text();break}}}return k?k:e===true?c(g).text():c.jgrid.htmlDecode(c(g).html())};c.unformat.select=function(h,s,n,e){var m=[];var q=c(h).text();if(e==true){return q}var l=c.extend({},s.colModel.editoptions);if(l.value){var f=l.value,r=l.multiple===true?true:false,p=[],o;if(r){p=q.split(",");p=c.map(p,function(j){return c.trim(j)})}if(isString(f)){var d=f.split(";"),g=0;for(var k=0;k<d.length;k++){o=d[k].split(":");if(r){if(jQuery.inArray(o[1],p)>-1){m[g]=o[0];g++}}else{if(c.trim(o[1])==c.trim(q)){m[0]=o[0];break}}}}else{if(isObject(f)){if(!r){p[0]=q}m=jQuery.map(p,function(t){var j;c.each(f,function(u,v){if(v==t){j=u;return false}});if(j){return j}})}}return m.join(", ")}else{return q||""}};function a(h,j,g,d,e){h=h.toLowerCase();var f=j;if(c.fn.fmatter[h]){f=c.fn.fmatter[h](j,g,e)}return f}function b(d){if(window.console&&window.console.log){window.console.log(d)}}isValue=function(d){return(isObject(d)||isString(d)||isNumber(d)||isBoolean(d))};isBoolean=function(d){return typeof d==="boolean"};isNull=function(d){return d===null};isNumber=function(d){return typeof d==="number"&&isFinite(d)};isString=function(d){return typeof d==="string"};isEmpty=function(d){if(!isString(d)&&isValue(d)){return false}else{if(!isValue(d)){return true}}d=c.trim(d).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return d===""};isUndefined=function(d){return typeof d==="undefined"};isObject=function(d){return(d&&(typeof d==="object"||isFunction(d)))||false};isFunction=function(d){return typeof d==="function"}})(jQuery);jQuery.fn.searchFilter=function(a,c){function b(k,q,g){this.$=k;this.add=function(A){if(A==null){k.find(".ui-add-last").click()}else{k.find(".sf:eq("+A+") .ui-add").click()}return this};this.del=function(A){if(A==null){k.find(".sf:last .ui-del").click()}else{k.find(".sf:eq("+A+") .ui-del").click()}return this};this.search=function(A){k.find(".ui-search").click();return this};this.reset=function(A){k.find(".ui-reset").click();return this};this.close=function(){k.find(".ui-closer").click();return this};if(q!=null){function w(){jQuery(this).toggleClass("ui-state-hover");return false}function j(A){jQuery(this).toggleClass("ui-state-active",(A.type=="mousedown"));return false}function e(A,B){return"<option value='"+A+"'>"+B+"</option>"}function t(C,A,B){return"<select class='"+C+"'"+(B?" style='display:none;'":"")+">"+A+"</select>"}function x(A,C){var B=k.find("tr.sf td.data "+A);if(B[0]!=null){C(B)}}function r(A,C){var B=k.find("tr.sf td.data "+A);if(B[0]!=null){jQuery.each(C,function(){if(this.data!=null){B.bind(this.type,this.data,this.fn)}else{B.bind(this.type,this.fn)}})}}var o=jQuery.extend({},jQuery.fn.searchFilter.defaults,g);var z=-1;var y="";jQuery.each(o.groupOps,function(){y+=e(this.op,this.text)});y="<select name='groupOp'>"+y+"</select>";k.html("").addClass("ui-searchFilter").append("<div class='ui-widget-overlay' style='z-index: -1'>&nbsp;</div><table class='ui-widget-content ui-corner-all'><thead><tr><td colspan='5' class='ui-widget-header ui-corner-all' style='line-height: 18px;'><div class='ui-closer ui-state-default ui-corner-all ui-helper-clearfix' style='float: right;'><span class='ui-icon ui-icon-close'></span></div>"+o.windowTitle+"</td></tr></thead><tbody><tr class='sf'><td class='fields'></td><td class='ops'></td><td class='data'></td><td><div class='ui-del ui-state-default ui-corner-all'><span class='ui-icon ui-icon-minus'></span></div></td><td><div class='ui-add ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plus'></span></div></td></tr><tr><td colspan='5' class='divider'><div>&nbsp;</div></td></tr></tbody><tfoot><tr><td colspan='3'><span class='ui-reset ui-state-default ui-corner-all' style='display: inline-block; float: left;'><span class='ui-icon ui-icon-arrowreturnthick-1-w' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>"+o.resetText+"</span></span><span class='ui-search ui-state-default ui-corner-all' style='display: inline-block; float: right;'><span class='ui-icon ui-icon-search' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>"+o.searchText+"</span></span><span class='matchText'>"+o.matchText+"</span> "+y+" <span class='rulesText'>"+o.rulesText+"</span></td><td>&nbsp;</td><td><div class='ui-add-last ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plusthick'></span></div></td></tr></tfoot></table>");var l=k.find("tr.sf");var h=l.find("td.fields");var f=l.find("td.ops");var p=l.find("td.data");var s="";jQuery.each(o.operators,function(){s+=e(this.op,this.text)});s=t("default",s,true);f.append(s);var m="<input type='text' class='default' style='display:none;' />";p.append(m);var v="";var u=false;var d=false;jQuery.each(q,function(C){var B=C;v+=e(this.value,this.text);if(this.ops!=null){u=true;var A="";jQuery.each(this.ops,function(){A+=e(this.op,this.text)});A=t("field"+B,A,true);f.append(A)}if(this.dataUrl!=null){if(C>z){z=C}d=true;var F=this.dataEvents;var D=this.dataInit;jQuery.get(this.dataUrl,function(H){var G=jQuery("<div />").append(H);G.find("select").addClass("field"+B).hide();p.append(G.html());if(D){x(".field"+C,D)}if(F){r(".field"+C,F)}if(C==z){k.find("tr.sf td.fields select[name='field']").change()}})}else{if(this.dataValues!=null){d=true;var E="";jQuery.each(this.dataValues,function(){E+=e(this.value,this.text)});E=t("field"+B,E,true);p.append(E)}else{if(this.dataEvents!=null||this.dataInit!=null){d=true;var E="<input type='text' class='field"+B+"' />";p.append(E)}}}if(this.dataInit!=null&&C!=z){x(".field"+C,this.dataInit)}if(this.dataEvents!=null&&C!=z){r(".field"+C,this.dataEvents)}});v="<select name='field'>"+v+"</select>";h.append(v);var n=h.find("select[name='field']");if(u){n.change(function(C){var B=C.target.selectedIndex;var D=jQuery(C.target).parents("tr.sf").find("td.ops");D.find("select").removeAttr("name").hide();var A=D.find(".field"+B);if(A[0]==null){A=D.find(".default")}A.attr("name","op").show()})}else{f.find(".default").attr("name","op").show()}if(d){n.change(function(C){var B=C.target.selectedIndex;var D=jQuery(C.target).parents("tr.sf").find("td.data");D.find("select,input").removeClass("vdata").hide();var A=D.find(".field"+B);if(A[0]==null){A=D.find(".default")}A.show().addClass("vdata")})}else{p.find(".default").show().addClass("vdata")}if(u||d){n.change()}k.find(".ui-state-default").hover(w,w).mousedown(j).mouseup(j);k.find(".ui-closer").click(function(A){o.onClose(jQuery(k.selector));return false});k.find(".ui-del").click(function(A){var B=jQuery(A.target).parents(".sf");if(B.siblings(".sf").length>0){if(o.datepickerFix===true&&jQuery.fn.datepicker!==undefined){B.find(".hasDatepicker").datepicker("destroy")}B.remove()}else{B.find("select[name='field']")[0].selectedIndex=0;B.find("select[name='op']")[0].selectedIndex=0;B.find(".data input").val("");B.find(".data select").each(function(){this.selectedIndex=0});B.find("select[name='field']").change()}return false});k.find(".ui-add").click(function(D){var E=jQuery(D.target).parents(".sf");var C=E.clone(true).insertAfter(E);C.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");if(o.clone){C.find("select[name='field']")[0].selectedIndex=E.find("select[name='field']")[0].selectedIndex;var B=(C.find("select[name='op']")[0]==null);if(!B){C.find("select[name='op']").focus()[0].selectedIndex=E.find("select[name='op']")[0].selectedIndex}var A=C.find("select.vdata");if(A[0]!=null){A[0].selectedIndex=E.find("select.vdata")[0].selectedIndex}}else{C.find(".data input").val("");C.find("select[name='field']").focus()}if(o.datepickerFix===true&&jQuery.fn.datepicker!==undefined){E.find(".hasDatepicker").each(function(){var F=jQuery.data(this,"datepicker").settings;C.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(F)})}C.find("select[name='field']").change();return false});k.find(".ui-search").click(function(D){var C=jQuery(k.selector);var A;var B=C.find("select[name='groupOp'] :selected").val();if(!o.stringResult){A={groupOp:B,rules:[]}}else{A='{"groupOp":"'+B+'","rules":['}C.find(".sf").each(function(E){var H=jQuery(this).find("select[name='field'] :selected").val();var G=jQuery(this).find("select[name='op'] :selected").val();var F=jQuery(this).find("input.vdata,select.vdata :selected").val();if(!o.stringResult){A.rules.push({field:H,op:G,data:F})}else{if(E>0){A+=","}A+='{"field":"'+H+'",';A+='"op":"'+G+'",';A+='"data":"'+F+'"}'}});if(o.stringResult){A+="]}"}o.onSearch(A);return false});k.find(".ui-reset").click(function(B){var A=jQuery(k.selector);A.find(".ui-del").click();A.find("select[name='groupOp']")[0].selectedIndex=0;o.onReset();return false});k.find(".ui-add-last").click(function(){var B=jQuery(k.selector+" .sf:last");var A=B.clone(true).insertAfter(B);A.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");A.find(".data input").val("");A.find("select[name='field']").focus();if(o.datepickerFix===true&&jQuery.fn.datepicker!==undefined){B.find(".hasDatepicker").each(function(){var C=jQuery.data(this,"datepicker").settings;A.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(C)})}A.find("select[name='field']").change();return false})}}return new b(this,a,c)};jQuery.fn.searchFilter.version="1.2.9";jQuery.fn.searchFilter.defaults={clone:true,datepickerFix:true,onReset:function(a){alert("Reset Clicked. Data Returned: "+a)},onSearch:function(a){alert("Search Clicked. Data Returned: "+a)},onClose:function(a){a.hide()},groupOps:[{op:"AND",text:"all"},{op:"OR",text:"any"}],operators:[{op:"eq",text:"is equal to"},{op:"ne",text:"is not equal to"},{op:"lt",text:"is less than"},{op:"le",text:"is less or equal to"},{op:"gt",text:"is greater than"},{op:"ge",text:"is greater or equal to"},{op:"in",text:"is in"},{op:"ni",text:"is not in"},{op:"bw",text:"begins with"},{op:"bn",text:"does not begin with"},{op:"ew",text:"ends with"},{op:"en",text:"does not end with"},{op:"cn",text:"contains"},{op:"nc",text:"does not contain"}],matchText:"match",rulesText:"rules",resetText:"Reset",searchText:"Search",stringResult:true,windowTitle:"Search Rules"};var xmlJsonClass={xml2json:function(b,d){if(b.nodeType===9){b=b.documentElement}var a=this.removeWhite(b);var e=this.toObj(a);var c=this.toJson(e,b.nodeName,"\t");return"{\n"+d+(d?c.replace(/\t/g,d):c.replace(/\t|\n/g,""))+"\n}"},json2xml:function(d,c){var e=function(q,f,h){var o="";var l,g;if(q instanceof Array){if(q.length===0){o+=h+"<"+f+">__EMPTY_ARRAY_</"+f+">\n"}else{for(l=0,g=q.length;l<g;l+=1){var p=h+e(q[l],f,h+"\t")+"\n";o+=p}}}else{if(typeof(q)==="object"){var k=false;o+=h+"<"+f;var j;for(j in q){if(q.hasOwnProperty(j)){if(j.charAt(0)==="@"){o+=" "+j.substr(1)+'="'+q[j].toString()+'"'}else{k=true}}}o+=k?">":"/>";if(k){for(j in q){if(q.hasOwnProperty(j)){if(j==="#text"){o+=q[j]}else{if(j==="#cdata"){o+="<![CDATA["+q[j]+"]]>"}else{if(j.charAt(0)!=="@"){o+=e(q[j],j,h+"\t")}}}}}o+=(o.charAt(o.length-1)==="\n"?h:"")+"</"+f+">"}}else{if(typeof(q)==="function"){o+=h+"<"+f+"><![CDATA["+q+"]]></"+f+">"}else{if(q.toString()==='""'||q.toString().length===0){o+=h+"<"+f+">__EMPTY_STRING_</"+f+">"}else{o+=h+"<"+f+">"+q.toString()+"</"+f+">"}}}}return o};var b="";var a;for(a in d){if(d.hasOwnProperty(a)){b+=e(d[a],a,"")}}return c?b.replace(/\t/g,c):b.replace(/\t|\n/g,"")},toObj:function(b){var g={};var f=/function/i;if(b.nodeType===1){if(b.attributes.length){var e;for(e=0;e<b.attributes.length;e+=1){g["@"+b.attributes[e].nodeName]=(b.attributes[e].nodeValue||"").toString()}}if(b.firstChild){var a=0,d=0,c=false;var h;for(h=b.firstChild;h;h=h.nextSibling){if(h.nodeType===1){c=true}else{if(h.nodeType===3&&h.nodeValue.match(/[^ \f\n\r\t\v]/)){a+=1}else{if(h.nodeType===4){d+=1}}}}if(c){if(a<2&&d<2){this.removeWhite(b);for(h=b.firstChild;h;h=h.nextSibling){if(h.nodeType===3){g["#text"]=this.escape(h.nodeValue)}else{if(h.nodeType===4){if(f.test(h.nodeValue)){g[h.nodeName]=[g[h.nodeName],h.nodeValue]}else{g["#cdata"]=this.escape(h.nodeValue)}}else{if(g[h.nodeName]){if(g[h.nodeName] instanceof Array){g[h.nodeName][g[h.nodeName].length]=this.toObj(h)}else{g[h.nodeName]=[g[h.nodeName],this.toObj(h)]}}else{g[h.nodeName]=this.toObj(h)}}}}}else{if(!b.attributes.length){g=this.escape(this.innerXml(b))}else{g["#text"]=this.escape(this.innerXml(b))}}}else{if(a){if(!b.attributes.length){g=this.escape(this.innerXml(b));if(g==="__EMPTY_ARRAY_"){g="[]"}else{if(g==="__EMPTY_STRING_"){g=""}}}else{g["#text"]=this.escape(this.innerXml(b))}}else{if(d){if(d>1){g=this.escape(this.innerXml(b))}else{for(h=b.firstChild;h;h=h.nextSibling){if(f.test(b.firstChild.nodeValue)){g=b.firstChild.nodeValue;break}else{g["#cdata"]=this.escape(h.nodeValue)}}}}}}}if(!b.attributes.length&&!b.firstChild){g=null}}else{if(b.nodeType===9){g=this.toObj(b.documentElement)}else{alert("unhandled node type: "+b.nodeType)}}return g},toJson:function(b,a,d){var j=a?('"'+a+'"'):"";if(b==="[]"){j+=(a?":[]":"[]")}else{if(b instanceof Array){var c,f;for(f=0,c=b.length;f<c;f+=1){b[f]=this.toJson(b[f],"",d+"\t")}j+=(a?":[":"[")+(b.length>1?("\n"+d+"\t"+b.join(",\n"+d+"\t")+"\n"+d):b.join(""))+"]"}else{if(b===null){j+=(a&&":")+"null"}else{if(typeof(b)==="object"){var g=[];var e;for(e in b){if(b.hasOwnProperty(e)){g[g.length]=this.toJson(b[e],e,d+"\t")}}j+=(a?":{":"{")+(g.length>1?("\n"+d+"\t"+g.join(",\n"+d+"\t")+"\n"+d):g.join(""))+"}"}else{if(typeof(b)==="string"){var h=/(^-?\d+\.?\d*$)/;var k=/function/i;b=b.toString();if(h.test(b)||k.test(b)||b==="false"||b==="true"){j+=(a&&":")+b}else{j+=(a&&":")+'"'+b+'"'}}else{j+=(a&&":")+b.toString()}}}}}return j},innerXml:function(d){var b="";if("innerHTML" in d){b=d.innerHTML}else{var a=function(j){var g="",f;if(j.nodeType===1){g+="<"+j.nodeName;for(f=0;f<j.attributes.length;f+=1){g+=" "+j.attributes[f].nodeName+'="'+(j.attributes[f].nodeValue||"").toString()+'"'}if(j.firstChild){g+=">";for(var h=j.firstChild;h;h=h.nextSibling){g+=a(h)}g+="</"+j.nodeName+">"}else{g+="/>"}}else{if(j.nodeType===3){g+=j.nodeValue}else{if(j.nodeType===4){g+="<![CDATA["+j.nodeValue+"]]>"}}}return g};for(var e=d.firstChild;e;e=e.nextSibling){b+=a(e)}}return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(b){b.normalize();var c;for(c=b.firstChild;c;){if(c.nodeType===3){if(!c.nodeValue.match(/[^ \f\n\r\t\v]/)){var a=c.nextSibling;b.removeChild(c);c=a}else{c=c.nextSibling}}else{if(c.nodeType===1){this.removeWhite(c);c=c.nextSibling}else{c=c.nextSibling}}}return b}};(function(f){var a,k,c,h,e,b;var d={menuStyle:{listStyle:"none",padding:"1px",margin:"0px",backgroundColor:"#fff",border:"1px solid #999",width:"100px"},itemStyle:{margin:"0px",color:"#000",display:"block",cursor:"default",padding:"3px",border:"1px solid #fff",backgroundColor:"transparent"},itemHoverStyle:{border:"1px solid #0a246a",backgroundColor:"#b6bdd2"},eventPosX:"pageX",eventPosY:"pageY",shadow:true,onContextMenu:null,onShowMenu:null};f.fn.contextMenu=function(n,m){if(!a){a=f('<div id="jqContextMenu"></div>').hide().css({position:"absolute",zIndex:"500"}).appendTo("body").bind("click",function(o){o.stopPropagation()})}if(!k){k=f("<div></div>").css({backgroundColor:"#000",position:"absolute",opacity:0.2,zIndex:499}).appendTo("body").hide()}e=e||[];e.push({id:n,menuStyle:f.extend({},d.menuStyle,m.menuStyle||{}),itemStyle:f.extend({},d.itemStyle,m.itemStyle||{}),itemHoverStyle:f.extend({},d.itemHoverStyle,m.itemHoverStyle||{}),bindings:m.bindings||{},shadow:m.shadow||m.shadow===false?m.shadow:d.shadow,onContextMenu:m.onContextMenu||d.onContextMenu,onShowMenu:m.onShowMenu||d.onShowMenu,eventPosX:m.eventPosX||d.eventPosX,eventPosY:m.eventPosY||d.eventPosY});var l=e.length-1;f(this).bind("contextmenu",function(p){var o=(!!e[l].onContextMenu)?e[l].onContextMenu(p):true;if(o){j(l,this,p,m)}return false});return this};function j(n,m,o,l){var p=e[n];h=f("#"+p.id).find("ul:first").clone(true);h.css(p.menuStyle).find("li").css(p.itemStyle).hover(function(){f(this).css(p.itemHoverStyle)},function(){f(this).css(p.itemStyle)}).find("img").css({verticalAlign:"middle",paddingRight:"2px"});a.html(h);if(!!p.onShowMenu){a=p.onShowMenu(o,a)}f.each(p.bindings,function(r,q){f("#"+r,a).bind("click",function(s){g();q(m,b)})});a.css({left:o[p.eventPosX],top:o[p.eventPosY]}).show();if(p.shadow){k.css({width:a.width(),height:a.height(),left:o.pageX+2,top:o.pageY+2}).show()}f(document).one("click",g)}function g(){a.hide();k.hide()}f.contextMenu={defaults:function(l){f.each(l,function(m,n){if(typeof n=="object"&&d[m]){f.extend(d[m],n)}else{d[m]=n}})}}})(jQuery);$(function(){$("div.contextMenu").hide()});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(c){var b=c.tableDnDConfig;if(c.tableDnDConfig.dragHandle){var a=jQuery("td."+c.tableDnDConfig.dragHandle,c);a.each(function(){jQuery(this).mousedown(function(e){jQuery.tableDnD.dragObject=this.parentNode;jQuery.tableDnD.currentTable=c;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,e);if(b.onDragStart){b.onDragStart(c,this)}return false})})}else{var d=jQuery("tr",c);d.each(function(){var e=jQuery(this);if(!e.hasClass("nodrag")){e.mousedown(function(f){if(f.target.tagName=="TD"){jQuery.tableDnD.dragObject=this;jQuery.tableDnD.currentTable=c;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,f);if(b.onDragStart){b.onDragStart(c,this)}return false}}).css("cursor","move")}})}},updateTables:function(){this.each(function(){if(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(d,c){c=c||window.event;var b=this.getPosition(d);var a=this.mouseCoords(c);return{x:a.x-b.x,y:a.y-b.y}},getPosition:function(c){var b=0;var a=0;if(c.offsetHeight==0){c=c.firstChild}if(c&&c.offsetParent){while(c.offsetParent){b+=c.offsetLeft;a+=c.offsetTop;c=c.offsetParent}b+=c.offsetLeft;a+=c.offsetTop}return{x:b,y:a}},mousemove:function(g){if(jQuery.tableDnD.dragObject==null){return}var d=jQuery(jQuery.tableDnD.dragObject);var b=jQuery.tableDnD.currentTable.tableDnDConfig;var j=jQuery.tableDnD.mouseCoords(g);var f=j.y-jQuery.tableDnD.mouseOffset.y;var c=window.pageYOffset;if(document.all){if(typeof document.compatMode!="undefined"&&document.compatMode!="BackCompat"){c=document.documentElement.scrollTop}else{if(typeof document.body!="undefined"){c=document.body.scrollTop}}}if(j.y-c<b.scrollAmount){window.scrollBy(0,-b.scrollAmount)}else{var a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;if(a-(j.y-c)<b.scrollAmount){window.scrollBy(0,b.scrollAmount)}}if(f!=jQuery.tableDnD.oldY){var e=f>jQuery.tableDnD.oldY;jQuery.tableDnD.oldY=f;if(b.onDragClass){d.addClass(b.onDragClass)}else{d.css(b.onDragStyle)}var h=jQuery.tableDnD.findDropTargetRow(d,f);if(h){if(e&&jQuery.tableDnD.dragObject!=h){jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,h.nextSibling)}else{if(!e&&jQuery.tableDnD.dragObject!=h){jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,h)}}}}return false},findDropTargetRow:function(f,g){var j=jQuery.tableDnD.currentTable.rows;for(var e=0;e<j.length;e++){var h=j[e];var b=this.getPosition(h).y;var a=parseInt(h.offsetHeight)/2;if(h.offsetHeight==0){b=this.getPosition(h.firstChild).y;a=parseInt(h.firstChild.offsetHeight)/2}if((g>b-a)&&(g<(b+a))){if(h==f){return null}var c=jQuery.tableDnD.currentTable.tableDnDConfig;if(c.onAllowDrop){if(c.onAllowDrop(f,h)){return h}else{return null}}else{var d=jQuery(h).hasClass("nodrop");if(!d){return h}else{return null}}return h}}return null},mouseup:function(c){if(jQuery.tableDnD.currentTable&&jQuery.tableDnD.dragObject){var b=jQuery.tableDnD.dragObject;var a=jQuery.tableDnD.currentTable.tableDnDConfig;if(a.onDragClass){jQuery(b).removeClass(a.onDragClass)}else{jQuery(b).css(a.onDropStyle)}jQuery.tableDnD.dragObject=null;if(a.onDrop){a.onDrop(jQuery.tableDnD.currentTable,b)}jQuery.tableDnD.currentTable=null}},serialize:function(){if(jQuery.tableDnD.currentTable){return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable)}else{return"Error: No Table id set, you need to set an id on your table and every row"}},serializeTable:function(d){var a="";var c=d.id;var e=d.rows;for(var b=0;b<e.length;b++){if(a.length>0){a+="&"}var f=e[b].id;if(f&&f&&d.tableDnDConfig&&d.tableDnDConfig.serializeRegexp){f=f.match(d.tableDnDConfig.serializeRegexp)[0]}a+=c+"[]="+f}return a},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});
1
+ (function($){$.jgrid=$.jgrid||{};$.extend($.jgrid,{htmlDecode:function(value){if(value=="&nbsp;"||value=="&#160;"||(value.length==1&&value.charCodeAt(0)==160)){return""}return !value?value:String(value).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(value){return !value?value:String(value).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(format){var args=$.makeArray(arguments).slice(1);if(format===undefined){format=""}return format.replace(/\{(\d+)\}/g,function(m,i){return args[i]})},getCellIndex:function(cell){cell=$(cell);cell=(!cell.is("td")&&!cell.is("th")?cell.closest("td,th"):cell)[0];if($.browser.msie){return $.inArray(cell,cell.parentNode.cells)}return cell.cellIndex},stripHtml:function(v){v=v+"";var regexp=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(v){return v.replace(regexp,"")}else{return v}},stringToDoc:function(xmlString){var xmlDoc;if(typeof xmlString!=="string"){return xmlString}try{var parser=new DOMParser();xmlDoc=parser.parseFromString(xmlString,"text/xml")}catch(e){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.loadXML(xmlString)}return(xmlDoc&&xmlDoc.documentElement&&xmlDoc.documentElement.tagName!="parsererror")?xmlDoc:null},parse:function(jsonString){var js=jsonString,msg;if(js.substr(0,9)=="while(1);"){js=js.substr(9)}if(js.substr(0,2)=="/*"){js=js.substr(2,js.length-4)}if(!js){js="{}"}($.jgrid.useJSON===true&&typeof(JSON)==="object"&&typeof(JSON.parse)==="function")?msg=JSON.parse(js):msg=eval("("+js+")");return msg.hasOwnProperty("d")?msg.d:msg},empty:function(){while(this.firstChild){this.removeChild(this.firstChild)}},jqID:function(sid){sid=sid+"";return sid.replace(/([\.\:\[\]])/g,"\\$1")},ajaxOptions:{},extend:function(methods){$.extend($.fn.jqGrid,methods);if(!this.no_legacy_api){$.fn.extend(methods)}}});$.fn.jqGrid=function(pin){if(typeof pin=="string"){var fn=$.fn.jqGrid[pin];if(!fn){throw ("jqGrid - No such method: "+pin)}var args=$.makeArray(arguments).slice(1);return fn.apply(this,args)}return this.each(function(){if(this.grid){return}var p=$.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"},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"},$.jgrid.defaults,pin||{});var grid={headers:[],cols:[],footers:[],dragStart:function(i,x,y){this.resizing={idx:i,startX:x.clientX,sOL:y[0]};this.hDiv.style.cursor="col-resize";this.curGbox=$("#rs_m"+p.id,"#gbox_"+p.id);this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]});if($.isFunction(p.resizeStart)){p.resizeStart.call(this,x,i)}document.onselectstart=new Function("return false")},dragMove:function(x){if(this.resizing){var diff=x.clientX-this.resizing.startX,h=this.headers[this.resizing.idx],newWidth=p.direction==="ltr"?h.width+diff:h.width-diff,hn,nWn;if(newWidth>33){this.curGbox.css({left:this.resizing.sOL+diff});if(p.forceFit===true){hn=this.headers[this.resizing.idx+p.nv];nWn=p.direction==="ltr"?hn.width-diff:hn.width+diff;if(nWn>33){h.newWidth=newWidth;hn.newWidth=nWn}}else{this.newWidth=p.direction==="ltr"?p.tblwidth+diff:p.tblwidth-diff;h.newWidth=newWidth}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var idx=this.resizing.idx,nw=this.headers[idx].newWidth||this.headers[idx].width;nw=parseInt(nw);this.resizing=false;$("#rs_m"+p.id).css("display","none");p.colModel[idx].width=nw;this.headers[idx].width=nw;this.headers[idx].el.style.width=nw+"px";if(this.cols.length>0){this.cols[idx].style.width=nw+"px"}if(this.footers.length>0){this.footers[idx].style.width=nw+"px"}if(p.forceFit===true){nw=this.headers[idx+p.nv].newWidth||this.headers[idx+p.nv].width;this.headers[idx+p.nv].width=nw;this.headers[idx+p.nv].el.style.width=nw+"px";if(this.cols.length>0){this.cols[idx+p.nv].style.width=nw+"px"}if(this.footers.length>0){this.footers[idx+p.nv].style.width=nw+"px"}p.colModel[idx+p.nv].width=nw}else{p.tblwidth=this.newWidth||p.tblwidth;$("table:first",this.bDiv).css("width",p.tblwidth+"px");$("table:first",this.hDiv).css("width",p.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(p.footerrow){$("table:first",this.sDiv).css("width",p.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}if($.isFunction(p.resizeStop)){p.resizeStop.call(this,nw,idx)}}this.curGbox=null;document.onselectstart=new Function("return true")},populateVisible:function(){if(grid.timer){clearTimeout(grid.timer)}grid.timer=null;var dh=$(grid.bDiv).height();if(!dh){return}var table=$("table:first",grid.bDiv);var rows=$("> tbody > tr:visible:first",table);var rh=rows.outerHeight()||grid.prevRowHeight;if(!rh){return}grid.prevRowHeight=rh;var rn=p.rowNum;if(rn<10){rn=parseInt(dh/rh)+1<<1;if(rn<10){rn=10}p.rowNum=rn}var scrollTop=grid.scrollTop=grid.bDiv.scrollTop;var ttop=table.position().top-scrollTop;var tbot=ttop+table.height();var div=rh*rn;var page,npage,empty;if(ttop<=0&&tbot<dh&&parseInt((tbot+scrollTop+div-1)/div)<p.lastpage){npage=parseInt((dh-tbot+div-1)/div);if(tbot>=0||npage<2||p.scroll===true){page=parseInt((tbot+scrollTop)/div)+1;ttop=-1}else{ttop=1}}if(ttop>0){page=parseInt(scrollTop/div)+1;npage=parseInt((scrollTop+dh)/div)+2-page;empty=true}if(npage){if(page>p.lastpage){return}if(grid.hDiv.loading){grid.timer=setTimeout(grid.populateVisible,200)}else{p.page=page;if(empty){grid.selectionPreserver(table[0]);grid.emptyRows(grid.bDiv)}grid.populate(npage)}}},scrollGrid:function(){if(p.scroll){var scrollTop=grid.bDiv.scrollTop;if(scrollTop!=grid.scrollTop){grid.scrollTop=scrollTop;if(grid.timer){clearTimeout(grid.timer)}grid.timer=setTimeout(grid.populateVisible,200)}}grid.hDiv.scrollLeft=grid.bDiv.scrollLeft;if(p.footerrow){grid.sDiv.scrollLeft=grid.bDiv.scrollLeft}},selectionPreserver:function(ts){var p=ts.p;var sr=p.selrow,sra=p.selarrrow?$.makeArray(p.selarrrow):null;var left=ts.grid.bDiv.scrollLeft;var complete=p.gridComplete;p.gridComplete=function(){p.selrow=null;p.selarrrow=[];if(p.multiselect&&sra&&sra.length>0){for(var i=0;i<sra.length;i++){if(sra[i]!=sr){$(ts).jqGrid("setSelection",sra[i],false)}}}if(sr){$(ts).jqGrid("setSelection",sr,false)}ts.grid.bDiv.scrollLeft=left;if(p.gridComplete=complete){complete()}}}};this.p=p;var i,dir,ts;if(this.p.colNames.length===0){for(i=0;i<this.p.colModel.length;i++){this.p.colNames[i]=this.p.colModel[i].label||this.p.colModel[i].name}}if(this.p.colNames.length!==this.p.colModel.length){alert($.jgrid.errors.model);return}var gv=$("<div class='ui-jqgrid-view'></div>"),ii,isMSIE=$.browser.msie?true:false,isSafari=$.browser.safari?true:false;ts=this;ts.p.direction=$.trim(ts.p.direction.toLowerCase());if($.inArray(ts.p.direction,["ltr","rtl"])==-1){ts.p.direction="ltr"}dir=ts.p.direction;$(gv).insertBefore(this);$(this).appendTo(gv).removeClass("scroll");var eg=$("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");$(eg).insertBefore(gv).attr({id:"gbox_"+this.id,dir:dir});$(gv).appendTo(eg).attr("id","gview_"+this.id);if(isMSIE&&$.browser.version<=6){ii='<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>'}else{ii=""}$("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv);$("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv);$(this).attr({cellSpacing:"0",cellPadding:"0",border:"0",role:"grid","aria-multiselectable":this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var sortkeys=["shiftKey","altKey","ctrlKey"],IntNum=function(val,defval){val=parseInt(val,10);if(isNaN(val)){return defval?defval:0}else{return val}},formatCol=function(pos,rowInd){var ral=ts.p.colModel[pos].align,result='style="',clas=ts.p.colModel[pos].classes;if(ral){result+="text-align:"+ral+";"}if(ts.p.colModel[pos].hidden===true){result+="display:none;"}if(rowInd===0){result+="width: "+grid.headers[pos].width+"px;"}return result+'"'+(clas!==undefined?(' class="'+clas+'"'):"")},addCell=function(rowId,cell,pos,irow,srvr){var v,prp;v=formatter(rowId,cell,pos,srvr,"add");prp=formatCol(pos,irow);return'<td role="gridcell" '+prp+' title="'+$.jgrid.stripHtml(v)+'">'+v+"</td>"},formatter=function(rowId,cellval,colpos,rwdat,_act){var cm=ts.p.colModel[colpos],v;if(typeof cm.formatter!=="undefined"){var opts={rowId:rowId,colModel:cm};if($.isFunction(cm.formatter)){v=cm.formatter(cellval,opts,rwdat,_act)}else{if($.fmatter){v=$.fn.fmatter(cm.formatter,cellval,opts,rwdat,_act)}else{v=cellVal(cellval)}}}else{v=cellVal(cellval)}return v},cellVal=function(val){return val===undefined||val===null||val===""?"&#160;":ts.p.autoencode?$.jgrid.htmlEncode(val+""):val+""},addMulti=function(rowid,pos,irow){var v='<input type="checkbox" id="jqg_'+rowid+'" class="cbox" name="jqg_'+rowid+'"/>',prp=formatCol(pos,irow);return"<td role='gridcell' "+prp+">"+v+"</td>"},addRowNum=function(pos,irow,pG,rN){var v=(parseInt(pG)-1)*parseInt(rN)+1+irow,prp=formatCol(pos,irow);return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+prp+">"+v+"</td>"},reader=function(datatype){var field,f=[],j=0,i;for(i=0;i<ts.p.colModel.length;i++){field=ts.p.colModel[i];if(field.name!=="cb"&&field.name!=="subgrid"&&field.name!=="rn"){f[j]=(datatype=="xml")?field.xmlmap||field.name:field.jsonmap||field.name;j++}}return f},orderedCols=function(offset){var order=ts.p.remapColumns;if(!order||!order.length){order=$.map(ts.p.colModel,function(v,i){return i})}if(offset){order=$.map(order,function(v){return v<offset?null:v-offset})}return order},emptyRows=function(parent,scroll){var tBody=$("tbody:first",parent);if(!ts.p.gridview||ts.p.jqgdnd){$("*",tBody).children().unbind()}if(isMSIE){$.jgrid.empty.apply(tBody[0])}else{tBody[0].innerHTML=""}if(scroll&&ts.p.scroll){$(">div:first",parent).css({height:"auto"}).children("div:first").css({height:0,display:"none"});parent.scrollTop=0}tBody=null},addXmlData=function(xml,t,rcnt,more,adjust){var startReq=new Date();ts.p.reccount=0;if($.isXMLDoc(xml)){if(ts.p.treeANode===-1&&!ts.p.scroll){emptyRows(t);rcnt=0}else{rcnt=rcnt>0?rcnt:0}}else{return}var i,fpos,ir=0,v,row,gi=0,si=0,ni=0,idn,getId,f=[],F,rd={},rl=ts.rows.length,xmlr,rid,rowData=[],ari=0,cn=(ts.p.altRows===true)?" "+ts.p.altclass:"",cn1;if(!ts.p.xmlReader.repeatitems){f=reader("xml")}if(ts.p.keyIndex===false){idn=ts.p.xmlReader.id}else{idn=ts.p.keyIndex}if(f.length>0&&!isNaN(idn)){if(ts.p.remapColumns&&ts.p.remapColumns.length){idn=$.inArray(idn,ts.p.remapColumns)}idn=f[idn]}if((idn+"").indexOf("[")===-1){if(f.length){getId=function(trow,k){return $(idn,trow).text()||k}}else{getId=function(trow,k){return $(ts.p.xmlReader.cell,trow).eq(idn).text()||k}}}else{getId=function(trow,k){return trow.getAttribute(idn.replace(/[\[\]]/g,""))||k}}$(ts.p.xmlReader.page,xml).each(function(){ts.p.page=this.textContent||this.text||1});$(ts.p.xmlReader.total,xml).each(function(){ts.p.lastpage=this.textContent||this.text||1});$(ts.p.xmlReader.records,xml).each(function(){ts.p.records=this.textContent||this.text||0});$(ts.p.xmlReader.userdata,xml).each(function(){ts.p.userData[this.getAttribute("name")]=this.textContent||this.text});var gxml=$(ts.p.xmlReader.root+" "+ts.p.xmlReader.row,xml),gl=gxml.length,j=0;if(gxml&&gl){var rn=parseInt(ts.p.rowNum),br=ts.p.scroll?(parseInt(ts.p.page)-1)*rn+1:1;if(adjust){rn*=adjust+1}var afterInsRow=$.isFunction(ts.p.afterInsertRow);while(j<gl){xmlr=gxml[j];rid=getId(xmlr,br+j);cn1=j%2==1?cn:"";rowData[ari++]='<tr id="'+rid+'" role="row" class ="ui-widget-content jqgrow ui-row-'+ts.p.direction+""+cn1+'">';if(ts.p.rownumbers===true){rowData[ari++]=addRowNum(0,j,ts.p.page,ts.p.rowNum);ni=1}if(ts.p.multiselect===true){rowData[ari++]=addMulti(rid,ni,j);gi=1}if(ts.p.subGrid===true){rowData[ari++]=$(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt);si=1}if(ts.p.xmlReader.repeatitems){if(!F){F=orderedCols(gi+si+ni)}var cells=$(ts.p.xmlReader.cell,xmlr);$.each(F,function(k){var cell=cells[this];if(!cell){return false}v=cell.textContent||cell.text;rd[ts.p.colModel[k+gi+si+ni].name]=v;rowData[ari++]=addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr)})}else{for(i=0;i<f.length;i++){v=$(f[i],xmlr).text();rd[ts.p.colModel[i+gi+si+ni].name]=v;rowData[ari++]=addCell(rid,v,i+gi+si+ni,j+rcnt,xmlr)}}rowData[ari++]="</tr>";if(ts.p.gridview===false){if(ts.p.treeGrid===true){fpos=ts.p.treeANode>=-1?ts.p.treeANode:0;row=$(rowData.join(""))[0];try{$(ts).jqGrid("setTreeNode",rd,row)}catch(e){}rl===0?$("tbody:first",t).append(row):$(ts.rows[j+fpos+rcnt]).after(row)}else{$("tbody:first",t).append(rowData.join(""))}if(ts.p.subGrid===true){try{$(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni)}catch(e){}}if(afterInsRow){ts.p.afterInsertRow.call(ts,rid,rd,xmlr)}rowData=[];ari=0}rd={};ir++;j++;if(ir==rn){break}}}if(ts.p.gridview===true){$("tbody:first",t).append(rowData.join(""))}ts.p.totaltime=new Date()-startReq;if(ir>0){ts.grid.cols=ts.rows[0].cells;if(ts.p.records===0){ts.p.records=gl}}rowData=null;if(!ts.p.treeGrid&&!ts.p.scroll){ts.grid.bDiv.scrollTop=0}ts.p.reccount=ir;ts.p.treeANode=-1;if(ts.p.userDataOnFooter){$(ts).jqGrid("footerData","set",ts.p.userData,true)}if(!more){updatepager(false,true)}},addJSONData=function(data,t,rcnt,more,adjust){var startReq=new Date();ts.p.reccount=0;if(data){if(ts.p.treeANode===-1&&!ts.p.scroll){emptyRows(t);rcnt=0}else{rcnt=rcnt>0?rcnt:0}}else{return}var ir=0,v,i,j,row,f=[],F,cur,gi=0,si=0,ni=0,len,drows,idn,rd={},fpos,rl=ts.rows.length,idr,rowData=[],ari=0,cn=(ts.p.altRows===true)?" "+ts.p.altclass:"",cn1;ts.p.page=data[ts.p.jsonReader.page]||1;ts.p.lastpage=data[ts.p.jsonReader.total]||1;ts.p.records=data[ts.p.jsonReader.records]||0;ts.p.userData=data[ts.p.jsonReader.userdata]||{};if(!ts.p.jsonReader.repeatitems){F=f=reader("json")}if(ts.p.keyIndex===false){idn=ts.p.jsonReader.id}else{idn=ts.p.keyIndex}if(f.length>0&&!isNaN(idn)){if(ts.p.remapColumns&&ts.p.remapColumns.length){idn=$.inArray(idn,ts.p.remapColumns)}idn=f[idn]}drows=data[ts.p.jsonReader.root];if(drows){len=drows.length,i=0;var rn=parseInt(ts.p.rowNum),br=ts.p.scroll?(parseInt(ts.p.page)-1)*rn+1:1;if(adjust){rn*=adjust+1}var afterInsRow=$.isFunction(ts.p.afterInsertRow);while(i<len){cur=drows[i];idr=cur[idn];if(idr===undefined){idr=br+i;if(f.length===0){if(ts.p.jsonReader.cell){var ccur=cur[ts.p.jsonReader.cell];idr=ccur[idn]||idr;ccur=null}}}cn1=i%2==1?cn:"";rowData[ari++]='<tr id="'+idr+'" role="row" class= "ui-widget-content jqgrow ui-row-'+ts.p.direction+""+cn1+'">';if(ts.p.rownumbers===true){rowData[ari++]=addRowNum(0,i,ts.p.page,ts.p.rowNum);ni=1}if(ts.p.multiselect){rowData[ari++]=addMulti(idr,ni,i);gi=1}if(ts.p.subGrid){rowData[ari++]=$(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt);si=1}if(ts.p.jsonReader.repeatitems){if(ts.p.jsonReader.cell){cur=cur[ts.p.jsonReader.cell]}if(!F){F=orderedCols(gi+si+ni)}}for(j=0;j<F.length;j++){v=cur[F[j]];if(v===undefined){try{v=eval("cur."+F[j])}catch(e){}}rowData[ari++]=addCell(idr,v,j+gi+si+ni,i+rcnt,cur);rd[ts.p.colModel[j+gi+si+ni].name]=v}rowData[ari++]="</tr>";if(ts.p.gridview===false){if(ts.p.treeGrid===true){fpos=ts.p.treeANode>=-1?ts.p.treeANode:0;row=$(rowData.join(""))[0];try{$(ts).jqGrid("setTreeNode",rd,row)}catch(e){}rl===0?$("tbody:first",t).append(row):$(ts.rows[i+fpos+rcnt]).after(row)}else{$("tbody:first",t).append(rowData.join(""))}if(ts.p.subGrid===true){try{$(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni)}catch(e){}}if(afterInsRow){ts.p.afterInsertRow(idr,rd,cur)}rowData=[];ari=0}rd={};ir++;i++;if(ir==rn){break}}if(ts.p.gridview===true){$("tbody:first",t).append(rowData.join(""))}ts.p.totaltime=new Date()-startReq;if(ir>0){ts.grid.cols=ts.rows[0].cells;if(ts.p.records===0){ts.p.records=len}}}if(!ts.p.treeGrid&&!ts.p.scroll){ts.grid.bDiv.scrollTop=0}ts.p.reccount=ir;ts.p.treeANode=-1;if(ts.p.userDataOnFooter){$(ts).jqGrid("footerData","set",ts.p.userData,true)}if(!more){updatepager(false,true)}},updatepager=function(rn,dnd){var cp,last,base,bs,from,to,tot,fmt;base=(parseInt(ts.p.page)-1)*parseInt(ts.p.rowNum);to=base+ts.p.reccount;if(ts.p.scroll){var rows=$("tbody:first > tr",ts.grid.bDiv);base=to-rows.length;var rh=rows.outerHeight();if(rh){var top=base*rh;var height=parseInt(ts.p.records,10)*rh;$(">div:first",ts.grid.bDiv).css({height:height}).children("div:first").css({height:top,display:top?"":"none"})}}if(ts.p.pager){fmt=$.jgrid.formatter.integer||{};if(ts.p.loadonce){cp=last=1;ts.p.lastpage=ts.page=1;$(".selbox",ts.p.pager).attr("disabled",true)}else{cp=IntNum(ts.p.page);last=IntNum(ts.p.lastpage);$(".selbox",ts.p.pager).attr("disabled",false)}if(ts.p.pginput===true){$(".ui-pg-input",ts.p.pager).val(ts.p.page);$("#sp_1",ts.p.pager).html($.fmatter?$.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage).width()}if(ts.p.viewrecords){if(ts.p.reccount===0){$(".ui-paging-info",ts.p.pager).html(ts.p.emptyrecords)}else{from=base+1;tot=ts.p.records;if($.fmatter){from=$.fmatter.util.NumberFormat(from,fmt);to=$.fmatter.util.NumberFormat(to,fmt);tot=$.fmatter.util.NumberFormat(tot,fmt)}$(".ui-paging-info",ts.p.pager).html($.jgrid.format(ts.p.recordtext,from,to,tot))}}if(ts.p.pgbuttons===true){if(cp<=0){cp=last=1}if(cp==1){$("#first, #prev",ts.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{$("#first, #prev",ts.p.pager).removeClass("ui-state-disabled")}if(cp==last){$("#next, #last",ts.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{$("#next, #last",ts.p.pager).removeClass("ui-state-disabled")}}}if(rn===true&&ts.p.rownumbers===true){$("td.jqgrid-rownum",ts.rows).each(function(i){$(this).html(base+1+i)})}if(dnd&&ts.p.jqgdnd){$(ts).jqGrid("gridDnD","updateDnD")}if($.isFunction(ts.p.gridComplete)){ts.p.gridComplete()}},populate=function(npage){if(!ts.grid.hDiv.loading){var pvis=ts.p.scroll&&npage==false;var prm={},dt,dstr,pN=ts.p.prmNames;if(pN.search!==null){prm[pN.search]=ts.p.search}if(pN.nd!=null){prm[pN.nd]=new Date().getTime()}if(pN.rows!==null){prm[pN.rows]=ts.p.rowNum}if(pN.page!==null){prm[pN.page]=ts.p.page}if(pN.sort!==null){prm[pN.sort]=ts.p.sortname}if(pN.order!==null){prm[pN.order]=ts.p.sortorder}var lc=ts.p.loadComplete;var lcf=$.isFunction(lc);if(!lcf){lc=null}var adjust=0;npage=npage||1;if(npage>1){if(pN.npage!=null){prm[pN.npage]=npage;adjust=npage-1;npage=1}else{lc=function(req){if(lcf){ts.p.loadComplete.call(ts,req)}ts.grid.hDiv.loading=false;ts.p.page++;populate(npage-1)}}}else{if(pN.npage!=null){delete ts.p.postData[pN.npage]}}$.extend(ts.p.postData,prm);var rcnt=!ts.p.scroll?0:ts.rows.length-1;if($.isFunction(ts.p.datatype)){ts.p.datatype(ts.p.postData,"load_"+ts.p.id);return}else{if($.isFunction(ts.p.beforeRequest)){ts.p.beforeRequest.call(ts)}}dt=ts.p.datatype.toLowerCase();switch(dt){case"json":case"jsonp":case"xml":case"script":$.ajax($.extend({url:ts.p.url,type:ts.p.mtype,dataType:dt,data:$.isFunction(ts.p.serializeGridData)?ts.p.serializeGridData(ts.p.postData):ts.p.postData,complete:function(req,st){if(st=="success"||(req.statusText=="OK"&&req.status=="200")){if(dt==="xml"){addXmlData(req.responseXML,ts.grid.bDiv,rcnt,npage>1,adjust)}else{addJSONData($.jgrid.parse(req.responseText),ts.grid.bDiv,rcnt,npage>1,adjust)}if(lc){lc.call(ts,req)}if(pvis){ts.grid.populateVisible()}}req=null;endReq()},error:function(xhr,st,err){if($.isFunction(ts.p.loadError)){ts.p.loadError.call(ts,xhr,st,err)}endReq();xhr=null},beforeSend:function(xhr){beginReq();if($.isFunction(ts.p.loadBeforeSend)){ts.p.loadBeforeSend.call(this,xhr)}}},$.jgrid.ajaxOptions,ts.p.ajaxGridOptions));if(ts.p.loadonce||ts.p.treeGrid){ts.p.datatype="local"}break;case"xmlstring":beginReq();addXmlData(dstr=$.jgrid.stringToDoc(ts.p.datastr),ts.grid.bDiv);ts.p.datatype="local";if(lcf){ts.p.loadComplete.call(ts,dstr)}ts.p.datastr=null;endReq();break;case"jsonstring":beginReq();if(typeof ts.p.datastr=="string"){dstr=$.jgrid.parse(ts.p.datastr)}else{dstr=ts.p.datastr}addJSONData(dstr,ts.grid.bDiv);ts.p.datatype="local";if(lcf){ts.p.loadComplete.call(ts,dstr)}ts.p.datastr=null;endReq();break;case"local":case"clientside":beginReq();ts.p.datatype="local";sortArrayData();endReq();break}}},beginReq=function(){ts.grid.hDiv.loading=true;if(ts.p.hiddengrid){return}switch(ts.p.loadui){case"disable":break;case"enable":$("#load_"+ts.p.id).show();break;case"block":$("#lui_"+ts.p.id).show();$("#load_"+ts.p.id).show();break}},endReq=function(){ts.grid.hDiv.loading=false;switch(ts.p.loadui){case"disable":break;case"enable":$("#load_"+ts.p.id).hide();break;case"block":$("#lui_"+ts.p.id).hide();$("#load_"+ts.p.id).hide();break}},sortArrayData=function(){var stripNum=/[\$,%]/g;var rows=[],col=0,st,sv,findSortKey,newDir=(ts.p.sortorder=="asc")?1:-1;$.each(ts.p.colModel,function(i,v){if(this.index==ts.p.sortname||this.name==ts.p.sortname){col=ts.p.lastsort=i;st=this.sorttype;return false}});if(st=="float"||st=="number"||st=="currency"){findSortKey=function($cell){var key=parseFloat($cell.replace(stripNum,""));return isNaN(key)?0:key}}else{if(st=="int"||st=="integer"){findSortKey=function($cell){return IntNum($cell.replace(stripNum,""))}}else{if(st=="date"){findSortKey=function($cell){var fd=ts.p.colModel[col].datefmt||"Y-m-d";return parseDate(fd,$cell).getTime()}}else{findSortKey=function($cell){return $.trim($cell.toUpperCase())}}}}$.each(ts.rows,function(index,row){try{sv=$.unformat($(row).children("td").eq(col),{colModel:ts.p.colModel[col]},col,true)}catch(_){sv=$(row).children("td").eq(col).text()}row.sortKey=findSortKey(sv);rows[index]=this});if(ts.p.treeGrid){$(ts).jqGrid("SortTree",newDir)}else{rows.sort(function(a,b){if(a.sortKey<b.sortKey){return -newDir}if(a.sortKey>b.sortKey){return newDir}return 0});if(rows[0]){$("td",rows[0]).each(function(k){$(this).css("width",grid.headers[k].width+"px")});ts.grid.cols=rows[0].cells}var cn="";if(ts.p.altRows){cn=ts.p.altclass}$.each(rows,function(i,row){if(cn){if(i%2==1){$(row).addClass(cn)}else{$(row).removeClass(cn)}}$("tbody",ts.grid.bDiv).append(row);row.sortKey=null})}ts.grid.bDiv.scrollTop=0},parseDate=function(format,date){var tsp={m:1,d:1,y:1970,h:0,i:0,s:0},k,hl,dM;date=date.split(/[\\\/:_;.\t\T\s-]/);format=format.split(/[\\\/:_;.\t\T\s-]/);var dfmt=$.jgrid.formatter.date.monthNames;for(k=0,hl=format.length;k<hl;k++){if(format[k]=="M"){dM=$.inArray(date[k],dfmt);if(dM!==-1&&dM<12){date[k]=dM+1}}if(format[k]=="F"){dM=$.inArray(date[k],dfmt);if(dM!==-1&&dM>11){date[k]=dM+1-12}}tsp[format[k].toLowerCase()]=parseInt(date[k],10)}tsp.m=parseInt(tsp.m,10)-1;var ty=tsp.y;if(ty>=70&&ty<=99){tsp.y=1900+tsp.y}else{if(ty>=0&&ty<=69){tsp.y=2000+tsp.y}}return new Date(tsp.y,tsp.m,tsp.d,tsp.h,tsp.i,tsp.s,0)},setPager=function(){var sep="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",pgid=$(ts.p.pager).attr("id")||"pager",pginp="",pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",str="",pgcnt,lft,cent,rgt,twd,tdw,i,clearVals=function(onpaging){if($.isFunction(ts.p.onPaging)){ts.p.onPaging(onpaging)}ts.p.selrow=null;if(ts.p.multiselect){ts.p.selarrrow=[];$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false)}ts.p.savedRow=[]};pgcnt="pg_"+pgid;lft=pgid+"_left";cent=pgid+"_center";rgt=pgid+"_right";$(ts.p.pager).addClass("ui-jqgrid-pager corner-bottom").append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:pre;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(ts.p.rowList.length>0){str="<td dir='"+dir+"'>";str+="<select class='ui-pg-selbox' role='listbox'>";for(i=0;i<ts.p.rowList.length;i++){str+="<option role='option' value="+ts.p.rowList[i]+((ts.p.rowNum==ts.p.rowList[i])?" selected":"")+">"+ts.p.rowList[i]}str+="</select></td>"}if(dir=="rtl"){pgl+=str}if(ts.p.pginput===true){pginp="<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>"}if(ts.p.pgbuttons===true){var po=["first","prev","next","last"];if(dir=="rtl"){po.reverse()}pgl+="<td id='"+po[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";pgl+="<td id='"+po[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";pgl+=pginp!=""?sep+pginp+sep:"";pgl+="<td id='"+po[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";pgl+="<td id='"+po[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else{if(pginp!=""){pgl+=pginp}}if(dir=="ltr"){pgl+=str}pgl+="</tr></tbody></table>";if(ts.p.viewrecords===true){$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div dir='"+dir+"' style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>")}$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl);tdw=$(".ui-jqgrid").css("font-size")||"11px";$("body").append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");twd=$(pgl).clone().appendTo("#testpg").width();$("#testpg").remove();if(twd>0){if(pginp!=""){twd+=50}$("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd)}ts.p._nvtd=[];ts.p._nvtd[0]=twd?Math.floor((ts.p.width-twd)/2):Math.floor(ts.p.width/3);ts.p._nvtd[1]=0;pgl=null;$(".ui-pg-selbox","#"+pgcnt).bind("change",function(){ts.p.page=Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;ts.p.rowNum=this.value;clearVals("records");populate();return false});if(ts.p.pgbuttons===true){$(".ui-pg-button","#"+pgcnt).hover(function(e){if($(this).hasClass("ui-state-disabled")){this.style.cursor="default"}else{$(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(e){if($(this).hasClass("ui-state-disabled")){}else{$(this).removeClass("ui-state-hover");this.style.cursor="default"}});$("#first, #prev, #next, #last",ts.p.pager).click(function(e){var cp=IntNum(ts.p.page),last=IntNum(ts.p.lastpage),selclick=false,fp=true,pp=true,np=true,lp=true;if(last===0||last===1){fp=false;pp=false;np=false;lp=false}else{if(last>1&&cp>=1){if(cp===1){fp=false;pp=false}else{if(cp>1&&cp<last){}else{if(cp===last){np=false;lp=false}}}}else{if(last>1&&cp===0){np=false;lp=false;cp=last-1}}}if(this.id==="first"&&fp){ts.p.page=1;selclick=true}if(this.id==="prev"&&pp){ts.p.page=(cp-1);selclick=true}if(this.id==="next"&&np){ts.p.page=(cp+1);selclick=true}if(this.id==="last"&&lp){ts.p.page=last;selclick=true}if(selclick){clearVals(this.id);populate()}return false})}if(ts.p.pginput===true){$("input.ui-pg-input","#"+pgcnt).keypress(function(e){var key=e.charCode?e.charCode:e.keyCode?e.keyCode:0;if(key==13){ts.p.page=($(this).val()>0)?$(this).val():ts.p.page;clearVals("user");populate();return false}return this})}},sortData=function(index,idxcol,reload,sor){if(!ts.p.colModel[idxcol].sortable){return}var imgs,so;if(ts.p.savedRow.length>0){return}if(!reload){if(ts.p.lastsort==idxcol){if(ts.p.sortorder=="asc"){ts.p.sortorder="desc"}else{if(ts.p.sortorder=="desc"){ts.p.sortorder="asc"}}}else{ts.p.sortorder="asc"}ts.p.page=1}if(sor){if(ts.p.lastsort==idxcol&&ts.p.sortorder==sor){return}else{ts.p.sortorder=sor}}var thd=$("thead:first",ts.grid.hDiv).get(0);$("tr th:eq("+ts.p.lastsort+") span.ui-grid-ico-sort",thd).addClass("ui-state-disabled");$("tr th:eq("+ts.p.lastsort+")",thd).attr("aria-selected","false");$("tr th:eq("+idxcol+") span.ui-icon-"+ts.p.sortorder,thd).removeClass("ui-state-disabled");$("tr th:eq("+idxcol+")",thd).attr("aria-selected","true");if(!ts.p.viewsortcols[0]){if(ts.p.lastsort!=idxcol){$("tr th:eq("+ts.p.lastsort+") span.s-ico",thd).hide();$("tr th:eq("+idxcol+") span.s-ico",thd).show()}}ts.p.lastsort=idxcol;index=index.substring(5);ts.p.sortname=ts.p.colModel[idxcol].index||index;so=ts.p.sortorder;if($.isFunction(ts.p.onSortCol)){ts.p.onSortCol.call(ts,index,idxcol,so)}if(ts.p.datatype=="local"){if(ts.p.deselectAfterSort){$(ts).jqGrid("resetSelection")}}else{ts.p.selrow=null;if(ts.p.multiselect){$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false)}ts.p.selarrrow=[];ts.p.savedRow=[];if(ts.p.scroll){emptyRows(ts.grid.bDiv,true)}}if(ts.p.subGrid&&ts.p.datatype=="local"){$("td.sgexpanded","#"+ts.p.id).each(function(){$(this).trigger("click")})}populate();if(ts.p.sortname!=index&&idxcol){ts.p.lastsort=idxcol}},setColWidth=function(){var initwidth=0,brd=ts.p.cellLayout,vc=0,lvc,scw=ts.p.scrollOffset,cw,hs=false,aw,tw=0,gw=0,cl=0,cr;if(isSafari){brd=0}$.each(ts.p.colModel,function(i){if(typeof this.hidden==="undefined"){this.hidden=false}if(this.hidden===false){initwidth+=IntNum(this.width);if(this.fixed){tw+=this.width;gw+=this.width+brd}else{vc++}cl++}});if(isNaN(ts.p.width)){ts.p.width=grid.width=initwidth}else{grid.width=ts.p.width}ts.p.tblwidth=initwidth;if(ts.p.shrinkToFit===false&&ts.p.forceFit===true){ts.p.forceFit=false}if(ts.p.shrinkToFit===true&&vc>0){aw=grid.width-brd*vc-gw;if(isNaN(ts.p.height)){}else{aw-=scw;hs=true}initwidth=0;$.each(ts.p.colModel,function(i){if(this.hidden===false&&!this.fixed){cw=Math.floor(aw/(ts.p.tblwidth-tw)*this.width);this.width=cw;initwidth+=cw;lvc=i}});cr=0;if(hs){if(grid.width-gw-(initwidth+brd*vc)!==scw){cr=grid.width-gw-(initwidth+brd*vc)-scw}}else{if(!hs&&Math.abs(grid.width-gw-(initwidth+brd*vc))!==1){cr=grid.width-gw-(initwidth+brd*vc)}}ts.p.colModel[lvc].width+=cr;ts.p.tblwidth=initwidth+cr+tw+cl*brd}},nextVisible=function(iCol){var ret=iCol,j=iCol,i;for(i=iCol+1;i<ts.p.colModel.length;i++){if(ts.p.colModel[i].hidden!==true){j=i;break}}return j-ret},getOffset=function(iCol){var i,ret={},brd1=isSafari?0:ts.p.cellLayout;ret[0]=ret[1]=ret[2]=0;for(i=0;i<=iCol;i++){if(ts.p.colModel[i].hidden===false){ret[0]+=ts.p.colModel[i].width+brd1}}if(ts.p.direction=="rtl"){ret[0]=ts.p.width-ret[0]}ret[0]=ret[0]-ts.grid.bDiv.scrollLeft;if($(ts.grid.cDiv).is(":visible")){ret[1]+=$(ts.grid.cDiv).height()+parseInt($(ts.grid.cDiv).css("padding-top"))+parseInt($(ts.grid.cDiv).css("padding-bottom"))}if(ts.p.toolbar[0]==true&&(ts.p.toolbar[1]=="top"||ts.p.toolbar[1]=="both")){ret[1]+=$(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"))+parseInt($(ts.grid.uDiv).css("border-bottom-width"))}ret[2]+=$(ts.grid.bDiv).height()+$(ts.grid.hDiv).height();return ret};this.p.id=this.id;if($.inArray(ts.p.multikey,sortkeys)==-1){ts.p.multikey=false}ts.p.keyIndex=false;for(i=0;i<ts.p.colModel.length;i++){if(ts.p.colModel[i].key===true){ts.p.keyIndex=i;break}}ts.p.sortorder=ts.p.sortorder.toLowerCase();if(this.p.treeGrid===true){try{$(this).jqGrid("setTreeGrid")}catch(_){}}if(this.p.subGrid){try{$(ts).jqGrid("setSubGrid")}catch(_){}}if(this.p.multiselect){this.p.colNames.unshift("<input id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:isSafari?ts.p.multiselectWidth+ts.p.cellLayout:ts.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:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}ts.p.xmlReader=$.extend({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"}},ts.p.xmlReader);ts.p.jsonReader=$.extend({root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},ts.p.jsonReader);if(ts.p.scroll){ts.p.pgbuttons=false;ts.p.pginput=false;ts.p.rowList=[]}var thead="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",tdc,idn,w,res,sort,td,ptr,tbody,imgs,iac="",idc="";if(ts.p.shrinkToFit===true&&ts.p.forceFit===true){for(i=ts.p.colModel.length-1;i>=0;i--){if(!ts.p.colModel[i].hidden){ts.p.colModel[i].resizable=false;break}}}if(ts.p.viewsortcols[1]=="horizontal"){iac=" ui-i-asc";idc=" ui-i-desc"}tdc=isMSIE?"class='ui-th-div-ie'":"";imgs="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+dir+"'></span>";imgs+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+dir+"'></span></span>";for(i=0;i<this.p.colNames.length;i++){thead+="<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+dir+"'>";idn=ts.p.colModel[i].index||ts.p.colModel[i].name;thead+="<div id='jqgh_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];if(idn==ts.p.sortname){ts.p.lastsort=i}thead+=imgs+"</div></th>"}thead+="</tr></thead>";$(this).append(thead);$("thead tr:first th",this).hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")});if(this.p.multiselect){var onSA=true,emp=[],chk;if(typeof ts.p.onSelectAll!=="function"){onSA=false}$("#cb_"+$.jgrid.jqID(ts.p.id),this).bind("click",function(){if(this.checked){$("[id^=jqg_]",ts.rows).attr("checked",true);$(ts.rows).each(function(i){if(!$(this).hasClass("subgrid")){$(this).addClass("ui-state-highlight").attr("aria-selected","true");ts.p.selarrrow[i]=ts.p.selrow=this.id}});chk=true;emp=[]}else{$("[id^=jqg_]",ts.rows).attr("checked",false);$(ts.rows).each(function(i){if(!$(this).hasClass("subgrid")){$(this).removeClass("ui-state-highlight").attr("aria-selected","false");emp[i]=this.id}});ts.p.selarrrow=[];ts.p.selrow=null;chk=false}if(onSA){ts.p.onSelectAll(chk?ts.p.selarrrow:emp,chk)}})}$.each(ts.p.colModel,function(i){if(!this.width){this.width=150}this.width=parseInt(this.width)});if(ts.p.autowidth===true){var pw=$(eg).innerWidth();ts.p.width=pw>0?pw:"nw"}setColWidth();$(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'>&nbsp;</div>");$(gv).css("width",grid.width+"px");thead=$("thead:first",ts).get(0);var tfoot="<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+dir+"'>";var thr=$("tr:first",thead);ts.p.disableClick=false;$("th",thr).each(function(j){var ht=$("div",this)[0];w=ts.p.colModel[j].width;if(typeof ts.p.colModel[j].resizable==="undefined"){ts.p.colModel[j].resizable=true}if(ts.p.colModel[j].resizable){res=document.createElement("span");$(res).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+dir);!$.browser.opera?$(res).css("cursor","col-resize"):"";$(this).addClass(ts.p.resizeclass)}else{res=""}$(this).css("width",w+"px").prepend(res);if(ts.p.colModel[j].hidden){$(this).css("display","none")}grid.headers[j]={width:w,el:this};sort=ts.p.colModel[j].sortable;if(typeof sort!=="boolean"){ts.p.colModel[j].sortable=true;sort=true}var nm=ts.p.colModel[j].name;if(!(nm=="cb"||nm=="subgrid"||nm=="rn")){if(ts.p.viewsortcols[2]){$("div",this).addClass("ui-jqgrid-sortable")}}if(sort){if(ts.p.viewsortcols[0]){$("div span.s-ico",this).show();if(j==ts.p.lastsort){$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled")}}else{if(j==ts.p.lastsort){$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled")}}}tfoot+="<td role='gridcell' "+formatCol(j,0)+">&nbsp;</td>"}).mousedown(function(e){if($(e.target).closest("th>span.ui-jqgrid-resize").length!=1){return}var ci=$.jgrid.getCellIndex(this);if(ts.p.forceFit===true){ts.p.nv=nextVisible(ci)}grid.dragStart(ci,e,getOffset(ci));return false}).click(function(e){if(ts.p.disableClick){ts.p.disableClick=false;return false}var s="th>div.ui-jqgrid-sortable",r,d;if(!ts.p.viewsortcols[2]){s="th>div>span>span.ui-grid-ico-sort"}var t=$(e.target).closest(s);if(t.length!=1){return}var ci=$.jgrid.getCellIndex(this);if(!ts.p.viewsortcols[2]){r=true,d=t.attr("sort")}sortData($("div",this)[0].id,ci,r,d);return false});if(ts.p.sortable&&$.fn.sortable){try{$(ts).jqGrid("sortableColumns",thr)}catch(e){}}tfoot+="</tr></tbody></table>";tbody=document.createElement("tbody");this.appendChild(tbody);$(this).addClass("ui-jqgrid-btable");var hTable=$("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead),hg=(ts.p.caption&&ts.p.hiddengrid===true)?true:false,hb=$("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>");grid.hDiv=document.createElement("div");$(grid.hDiv).css({width:grid.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(hb);$(hb).append(hTable);if(hg){$(grid.hDiv).hide()}ts.p._height=0;if(ts.p.pager){if(typeof ts.p.pager=="string"){if(ts.p.pager.substr(0,1)!="#"){ts.p.pager="#"+ts.p.pager}}$(ts.p.pager).css({width:grid.width+"px"}).appendTo(eg).addClass("ui-state-default ui-jqgrid-pager");ts.p._height+=parseInt($(ts.p.pager).height(),10);if(hg){$(ts.p.pager).hide()}setPager()}if(ts.p.cellEdit===false&&ts.p.hoverrows===true){$(ts).bind("mouseover",function(e){ptr=$(e.target).closest("tr.jqgrow");if($(ptr).attr("class")!=="subgrid"){$(ptr).addClass("ui-state-hover")}return false}).bind("mouseout",function(e){ptr=$(e.target).closest("tr.jqgrow");$(ptr).removeClass("ui-state-hover");return false})}var ri,ci;$(ts).before(grid.hDiv).click(function(e){td=e.target;var scb=$(td).hasClass("cbox");ptr=$(td,ts.rows).closest("tr.jqgrow");if($(ptr).length===0){return this}var cSel=true;if($.isFunction(ts.p.beforeSelectRow)){cSel=ts.p.beforeSelectRow.call(ts,ptr[0].id,e)}if(td.tagName=="A"||((td.tagName=="INPUT"||td.tagName=="TEXTAREA"||td.tagName=="OPTION"||td.tagName=="SELECT")&&!scb)){return true}if(cSel===true){if(ts.p.cellEdit===true){if(ts.p.multiselect&&scb){$(ts).jqGrid("setSelection",ptr[0].id,true)}else{ri=ptr[0].rowIndex;ci=$.jgrid.getCellIndex(td);try{$(ts).jqGrid("editCell",ri,ci,true)}catch(_){}}}else{if(!ts.p.multikey){if(ts.p.multiselect&&ts.p.multiboxonly){if(scb){$(ts).jqGrid("setSelection",ptr[0].id,true)}else{$(ts.p.selarrrow).each(function(i,n){var ind=ts.rows.namedItem(n);$(ind).removeClass("ui-state-highlight");$("#jqg_"+$.jgrid.jqID(n),ind).attr("checked",false)});ts.p.selarrrow=[];$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);$(ts).jqGrid("setSelection",ptr[0].id,true)}}else{$(ts).jqGrid("setSelection",ptr[0].id,true)}}else{if(e[ts.p.multikey]){$(ts).jqGrid("setSelection",ptr[0].id,true)}else{if(ts.p.multiselect&&scb){scb=$("[id^=jqg_]",ptr).attr("checked");$("[id^=jqg_]",ptr).attr("checked",!scb)}}}}if($.isFunction(ts.p.onCellSelect)){ri=ptr[0].id;ci=$.jgrid.getCellIndex(td);ts.p.onCellSelect.call(ts,ri,ci,$(td).html(),e)}}e.stopPropagation()}).bind("reloadGrid",function(e,opts){if(ts.p.treeGrid===true){ts.p.datatype=ts.p.treedatatype}if(opts&&opts.current){ts.grid.selectionPreserver(ts)}if(ts.p.datatype=="local"&&!sr){$(ts).jqGrid("resetSelection")}else{if(!ts.p.treeGrid){ts.p.selrow=null;if(ts.p.multiselect){ts.p.selarrrow=[];$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false)}ts.p.savedRow=[];if(ts.p.scroll){emptyRows(ts.grid.bDiv)}}}if(opts&&opts.page){var page=opts.page;if(page>ts.p.lastpage){page=ts.p.lastpage}if(page<1){page=1}ts.p.page=page;if(ts.grid.prevRowHeight){ts.grid.bDiv.scrollTop=(page-1)*ts.grid.prevRowHeight*ts.p.rowNum}else{ts.grid.bDiv.scrollTop=0}}if(ts.grid.prevRowHeight&&ts.p.scroll){ts.grid.populateVisible()}else{ts.grid.populate()}return false});if($.isFunction(this.p.ondblClickRow)){$(this).dblclick(function(e){td=e.target;ptr=$(td,ts.rows).closest("tr.jqgrow");if($(ptr).length===0){return false}ri=ptr[0].rowIndex;ci=$.jgrid.getCellIndex(td);ts.p.ondblClickRow.call(ts,$(ptr).attr("id"),ri,ci,e);return false})}if($.isFunction(this.p.onRightClickRow)){$(this).bind("contextmenu",function(e){td=e.target;ptr=$(td,ts.rows).closest("tr.jqgrow");if($(ptr).length===0){return false}if(!ts.p.multiselect){$(ts).jqGrid("setSelection",ptr[0].id,true)}ri=ptr[0].rowIndex;ci=$.jgrid.getCellIndex(td);ts.p.onRightClickRow.call(ts,$(ptr).attr("id"),ri,ci,e);return false})}grid.bDiv=document.createElement("div");$(grid.bDiv).append($('<div style="position:relative"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:ts.p.height+(isNaN(ts.p.height)?"":"px"),width:(grid.width)+"px"}).scroll(grid.scrollGrid);$("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"});if(isMSIE){if($("tbody",this).size()==2){$("tbody:first",this).remove()}if(ts.p.multikey){$(grid.bDiv).bind("selectstart",function(){return false})}}else{if(ts.p.multikey){$(grid.bDiv).bind("mousedown",function(){return false})}}if(hg){$(grid.bDiv).hide()}grid.cDiv=document.createElement("div");var arf=ts.p.hidegrid===true?$("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){arf.addClass("ui-state-hover")},function(){arf.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css((dir=="rtl"?"left":"right"),"0px"):"";$(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title"+(dir=="rtl"?"-rtl":"")+"'>"+ts.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix");$(grid.cDiv).insertBefore(grid.hDiv);if(ts.p.toolbar[0]){grid.uDiv=document.createElement("div");if(ts.p.toolbar[1]=="top"){$(grid.uDiv).insertBefore(grid.hDiv)}else{if(ts.p.toolbar[1]=="bottom"){$(grid.uDiv).insertAfter(grid.hDiv)}}if(ts.p.toolbar[1]=="both"){grid.ubDiv=document.createElement("div");$(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);$(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);ts.p._height+=IntNum($(grid.ubDiv).height());if(hg){$(grid.ubDiv).hide()}}else{$(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id)}ts.p._height+=IntNum($(grid.uDiv).height());if(hg){$(grid.uDiv).hide()}}if(ts.p.footerrow){grid.sDiv=$("<div class='ui-jqgrid-sdiv'></div>")[0];hb=$("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>");$(grid.sDiv).append(hb).insertAfter(grid.hDiv).width(grid.width);$(hb).append(tfoot);grid.footers=$(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells;if(ts.p.rownumbers){grid.footers[0].className="ui-state-default jqgrid-rownum"}if(hg){$(grid.sDiv).hide()}}if(ts.p.caption){ts.p._height+=parseInt($(grid.cDiv,ts).height(),10);var tdt=ts.p.datatype;if(ts.p.hidegrid===true){$(".ui-jqgrid-titlebar-close",grid.cDiv).click(function(e){var onHdCl=$.isFunction(ts.p.onHeaderClick);if(ts.p.gridstate=="visible"){$(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+ts.p.id).slideUp("fast");if(ts.p.pager){$(ts.p.pager).slideUp("fast")}if(ts.p.toolbar[0]===true){if(ts.p.toolbar[1]=="both"){$(grid.ubDiv).slideUp("fast")}$(grid.uDiv).slideUp("fast")}if(ts.p.footerrow){$(".ui-jqgrid-sdiv","#gbox_"+ts.p.id).slideUp("fast")}$("span",this).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");ts.p.gridstate="hidden";if(onHdCl){if(!hg){ts.p.onHeaderClick.call(ts,ts.p.gridstate,e)}}}else{if(ts.p.gridstate=="hidden"){$(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+ts.p.id).slideDown("fast");if(ts.p.pager){$(ts.p.pager).slideDown("fast")}if(ts.p.toolbar[0]===true){if(ts.p.toolbar[1]=="both"){$(grid.ubDiv).slideDown("fast")}$(grid.uDiv).slideDown("fast")}if(ts.p.footerrow){$(".ui-jqgrid-sdiv","#gbox_"+ts.p.id).slideDown("fast")}$("span",this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(hg){ts.p.datatype=tdt;populate();hg=false}ts.p.gridstate="visible";if(onHdCl){ts.p.onHeaderClick.call(ts,ts.p.gridstate,e)}}}return false});if(hg){ts.p.datatype="local";$(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click")}}}else{$(grid.cDiv).hide()}$(grid.hDiv).after(grid.bDiv);$(".ui-jqgrid-labels",grid.hDiv).bind("selectstart",function(){return false}).mousemove(function(e){if(grid.resizing){grid.dragMove(e);return false}});ts.p._height+=parseInt($(grid.hDiv).height(),10);$(document).mouseup(function(e){if(grid.resizing){grid.dragEnd();return false}return true});this.updateColumns=function(){var r=this.rows[0],self=this;if(r){$("td",r).each(function(k){$(this).css("width",self.grid.headers[k].width+"px")});this.grid.cols=r.cells}return this};ts.formatCol=formatCol;ts.sortData=sortData;ts.updatepager=updatepager;ts.formatter=function(rowId,cellval,colpos,rwdat,act){return formatter(rowId,cellval,colpos,rwdat,act)};$.extend(grid,{populate:populate,emptyRows:emptyRows});this.grid=grid;ts.addXmlData=function(d){addXmlData(d,ts.grid.bDiv)};ts.addJSONData=function(d){addJSONData(d,ts.grid.bDiv)};populate();ts.p.hiddengrid=false;$(window).unload(function(){$(this).empty();this.grid=null;this.p=null})})};$.jgrid.extend({getGridParam:function(pName){var $t=this[0];if(!$t.grid){return}if(!pName){return $t.p}else{return typeof($t.p[pName])!="undefined"?$t.p[pName]:null}},setGridParam:function(newParams){return this.each(function(){if(this.grid&&typeof(newParams)==="object"){$.extend(true,this.p,newParams)}})},getDataIDs:function(){var ids=[],i=0,len;this.each(function(){len=this.rows.length;if(len&&len>0){while(i<len){ids[i]=this.rows[i].id;i++}}});return ids},setSelection:function(selection,onsr){return this.each(function(){var $t=this,stat,pt,olr,ner,ia,tpsr;if(selection===undefined){return}onsr=onsr===false?false:true;pt=$t.rows.namedItem(selection);if(pt==null){return}if($t.p.selrow&&$t.p.scrollrows===true){olr=$t.rows.namedItem($t.p.selrow).rowIndex;ner=$t.rows.namedItem(selection).rowIndex;if(ner>=0){if(ner>olr){scrGrid(ner,"d")}else{scrGrid(ner,"u")}}}if(!$t.p.multiselect){if($(pt).attr("class")!=="subgrid"){if($t.p.selrow){$("tr#"+$.jgrid.jqID($t.p.selrow),$t.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false")}$t.p.selrow=pt.id;$(pt).addClass("ui-state-highlight").attr("aria-selected","true");if($t.p.onSelectRow&&onsr){$t.p.onSelectRow($t.p.selrow,true)}}}else{$t.p.selrow=pt.id;ia=$.inArray($t.p.selrow,$t.p.selarrrow);if(ia===-1){if($(pt).attr("class")!=="subgrid"){$(pt).addClass("ui-state-highlight").attr("aria-selected","true")}stat=true;$("#jqg_"+$.jgrid.jqID($t.p.selrow),$t.rows).attr("checked",stat);$t.p.selarrrow.push($t.p.selrow);if($t.p.onSelectRow&&onsr){$t.p.onSelectRow($t.p.selrow,stat)}}else{if($(pt).attr("class")!=="subgrid"){$(pt).removeClass("ui-state-highlight").attr("aria-selected","false")}stat=false;$("#jqg_"+$.jgrid.jqID($t.p.selrow),$t.rows).attr("checked",stat);$t.p.selarrrow.splice(ia,1);if($t.p.onSelectRow&&onsr){$t.p.onSelectRow($t.p.selrow,stat)}tpsr=$t.p.selarrrow[0];$t.p.selrow=(tpsr===undefined)?null:tpsr}}function scrGrid(iR,tp){var ch=$($t.grid.bDiv)[0].clientHeight,st=$($t.grid.bDiv)[0].scrollTop,nROT=$t.rows[iR].offsetTop+$t.rows[iR].clientHeight,pROT=$t.rows[iR].offsetTop;if(tp=="d"){if(nROT>=ch){$($t.grid.bDiv)[0].scrollTop=st+nROT-pROT}}if(tp=="u"){if(pROT<st){$($t.grid.bDiv)[0].scrollTop=st-nROT+pROT}}}})},resetSelection:function(){return this.each(function(){var t=this,ind;if(!t.p.multiselect){if(t.p.selrow){$("tr#"+$.jgrid.jqID(t.p.selrow),t.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");t.p.selrow=null}}else{$(t.p.selarrrow).each(function(i,n){ind=t.rows.namedItem(n);$(ind).removeClass("ui-state-highlight").attr("aria-selected","false");$("#jqg_"+$.jgrid.jqID(n),ind).attr("checked",false)});$("#cb_"+$.jgrid.jqID(t.p.id),t.grid.hDiv).attr("checked",false);t.p.selarrrow=[]}t.p.savedRow=[]})},getRowData:function(rowid){var res={},resall,getall=false,len,j=0;this.each(function(){var $t=this,nm,ind;if(typeof(rowid)=="undefined"){getall=true;resall=[];len=$t.rows.length}else{ind=$t.rows.namedItem(rowid);if(!ind){return res}len=1}while(j<len){if(getall){ind=$t.rows[j]}$("td",ind).each(function(i){nm=$t.p.colModel[i].name;if(nm!=="cb"&&nm!=="subgrid"){if($t.p.treeGrid===true&&nm==$t.p.ExpandColumn){res[nm]=$.jgrid.htmlDecode($("span:first",this).html())}else{try{res[nm]=$.unformat(this,{colModel:$t.p.colModel[i]},i)}catch(e){res[nm]=$.jgrid.htmlDecode($(this).html())}}}});j++;if(getall){resall.push(res);res={}}}});return resall?resall:res},delRowData:function(rowid){var success=false,rowInd,ia,ri;this.each(function(){var $t=this;rowInd=$t.rows.namedItem(rowid);if(!rowInd){return false}else{ri=rowInd.rowIndex;$(rowInd).remove();$t.p.records--;$t.p.reccount--;$t.updatepager(true,false);success=true;if(rowid==$t.p.selrow){$t.p.selrow=null}ia=$.inArray(rowid,$t.p.selarrrow);if(ia!=-1){$t.p.selarrrow.splice(ia,1)}}if(ri==0&&success){$t.updateColumns()}if($t.p.altRows===true&&success){var cn=$t.p.altclass;$($t.rows).each(function(i){if(i%2==1){$(this).addClass(cn)}else{$(this).removeClass(cn)}})}});return success},setRowData:function(rowid,data,cssp){var nm,success=false;this.each(function(){var t=this,vl,ind,cp=typeof cssp;if(!t.grid){return false}ind=t.rows.namedItem(rowid);if(!ind){return false}if(data){$(this.p.colModel).each(function(i){nm=this.name;if(data[nm]!=undefined){vl=t.formatter(rowid,data[nm],i,data,"edit");if(t.p.treeGrid===true&&nm==t.p.ExpandColumn){$("td:eq("+i+") > span:first",ind).html(vl).attr("title",$.jgrid.stripHtml(vl))}else{$("td:eq("+i+")",ind).html(vl).attr("title",$.jgrid.stripHtml(vl))}success=true}})}if(cp==="string"){$(ind).addClass(cssp)}else{if(cp==="object"){$(ind).css(cssp)}}});return success},addRowData:function(rowid,data,pos,src){if(!pos){pos="last"}var success=false,nm,row="",gi=0,si=0,ni=0,sind,i,v,prp="";if(data){this.each(function(){var t=this;if(t.p.rownumbers===true){prp=t.formatCol(ni,1);row+='<td role="gridcell" class="ui-state-default jqgrid-rownum" '+prp+">0</td>";ni=1}if(t.p.multiselect){v='<input type="checkbox" id="jqg_'+rowid+'" class="cbox"/>';prp=t.formatCol(ni,1);row+='<td role="gridcell" '+prp+">"+v+"</td>";gi=1}if(t.p.subGrid===true){row+=$(t).jqGrid("addSubGridCell",gi+ni,1);si=1}if(typeof(rowid)!="undefined"){rowid=rowid+""}else{rowid=(t.p.records+1)+"";if(t.p.keyIndex!==false){var cmn=t.p.colModel[t.p.keyIndex+gi+si+ni].name;if(typeof data[cmn]!="undefined"){rowid=data[cmn]}}}for(i=gi+si+ni;i<this.p.colModel.length;i++){nm=this.p.colModel[i].name;v=t.formatter(rowid,data[nm],i,data,"add");prp=t.formatCol(i,1);row+='<td role="gridcell" '+prp+' title="'+$.jgrid.stripHtml(v)+'">'+v+"</td>"}row='<tr id="'+rowid+'" role="row" class="ui-widget-content jqgrow ui-row-'+t.p.direction+'">'+row+"</tr>";if(t.p.subGrid===true){row=$(row)[0];$(t).jqGrid("addSubGrid",row,gi+ni)}if(t.rows.length===0){$("table:first",t.grid.bDiv).append(row)}else{switch(pos){case"last":$(t.rows[t.rows.length-1]).after(row);break;case"first":$(t.rows[0]).before(row);break;case"after":sind=t.rows.namedItem(src);if(sind){$(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")?$(t.rows[sind.rowIndex+1]).after(row):$(sind).after(row)}break;case"before":sind=t.rows.namedItem(src);if(sind){$(sind).before(row);sind=sind.rowIndex}break}}t.p.records++;t.p.reccount++;if(!t.grid.cols||!t.grid.cols.length){t.grid.cols=t.rows[0].cells}if(pos==="first"||(pos==="before"&&sind<=1)||t.rows.length===1){t.updateColumns()}if(t.p.altRows===true){var cn=t.p.altclass;if(pos=="last"){if((t.rows.length-1)%2==1){$(t.rows[t.rows.length-1]).addClass(cn)}}else{$(t.rows).each(function(i){if(i%2==1){$(this).addClass(cn)}else{$(this).removeClass(cn)}})}}try{t.p.afterInsertRow(rowid,data)}catch(e){}t.updatepager(true,true);success=true})}return success},footerData:function(action,data,format){var nm,success=false,res={};function isEmpty(obj){for(var i in obj){return false}return true}if(typeof(action)=="undefined"){action="get"}if(typeof(format)!="boolean"){format=true}action=action.toLowerCase();this.each(function(){var t=this,vl,ind;if(!t.grid||!t.p.footerrow){return false}if(action=="set"){if(isEmpty(data)){return false}}success=true;$(this.p.colModel).each(function(i){nm=this.name;if(action=="set"){if(data[nm]!=undefined){vl=format?t.formatter("",data[nm],i,data,"edit"):data[nm];$("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr("title",$.jgrid.stripHtml(vl));success=true}}else{if(action=="get"){res[nm]=$("tr.footrow td:eq("+i+")",t.grid.sDiv).html()}}})});return action=="get"?res:success},ShowHideCol:function(colname,show){return this.each(function(){var $t=this,fndh=false;if(!$t.grid){return}if(typeof colname==="string"){colname=[colname]}show=show!="none"?"":"none";var sw=show==""?true:false;$(this.p.colModel).each(function(i){if($.inArray(this.name,colname)!==-1&&this.hidden===sw){$("tr",$t.grid.hDiv).each(function(){$("th:eq("+i+")",this).css("display",show)});$($t.rows).each(function(j){$("td:eq("+i+")",$t.rows[j]).css("display",show)});if($t.p.footerrow){$("td:eq("+i+")",$t.grid.sDiv).css("display",show)}if(show=="none"){$t.p.tblwidth-=this.width}else{$t.p.tblwidth+=this.width}this.hidden=!sw;fndh=true}});if(fndh===true){$("table:first",$t.grid.hDiv).width($t.p.tblwidth);$("table:first",$t.grid.bDiv).width($t.p.tblwidth);$t.grid.hDiv.scrollLeft=$t.grid.bDiv.scrollLeft;if($t.p.footerrow){$("table:first",$t.grid.sDiv).width($t.p.tblwidth);$t.grid.sDiv.scrollLeft=$t.grid.bDiv.scrollLeft}}})},hideCol:function(colname){return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"none")})},showCol:function(colname){return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"")})},remapColumns:function(permutation,updateCells,keepHeader){function resortArray(a){var ac;if(a.length){ac=$.makeArray(a)}else{ac=$.extend({},a)}$.each(permutation,function(i){a[i]=ac[this]})}var ts=this.get(0);function resortRows(parent,clobj){$(">tr"+(clobj||""),parent).each(function(){var row=this;var elems=$.makeArray(row.cells);$.each(permutation,function(){var e=elems[this];if(e){row.appendChild(e)}})})}resortArray(ts.p.colModel);resortArray(ts.p.colNames);resortArray(ts.grid.headers);resortRows($("thead:first",ts.grid.hDiv),keepHeader&&":not(.ui-jqgrid-labels)");if(updateCells){resortRows($("tbody:first",ts.grid.bDiv),".jqgrow")}if(ts.p.footerrow){resortRows($("tbody:first",ts.grid.sDiv))}if(ts.p.remapColumns){if(!ts.p.remapColumns.length){ts.p.remapColumns=$.makeArray(permutation)}else{resortArray(ts.p.remapColumns)}}ts.p.lastsort=$.inArray(ts.p.lastsort,permutation);if(ts.p.treeGrid){ts.p.expColInd=$.inArray(ts.p.expColInd,permutation)}},setGridWidth:function(nwidth,shrink){return this.each(function(){var $t=this,cw,initwidth=0,brd=$t.p.cellLayout,lvc,vc=0,hs=false,scw=$t.p.scrollOffset,aw,gw=0,tw=0,cl=0,cr;if(!$t.grid){return}if(typeof shrink!="boolean"){shrink=$t.p.shrinkToFit}if(isNaN(nwidth)){return}else{nwidth=parseInt(nwidth);$t.grid.width=$t.p.width=nwidth}$("#gbox_"+$t.p.id).css("width",nwidth+"px");$("#gview_"+$t.p.id).css("width",nwidth+"px");$($t.grid.bDiv).css("width",nwidth+"px");$($t.grid.hDiv).css("width",nwidth+"px");if($t.p.pager){$($t.p.pager).css("width",nwidth+"px")}if($t.p.toolbar[0]===true){$($t.grid.uDiv).css("width",nwidth+"px");if($t.p.toolbar[1]=="both"){$($t.grid.ubDiv).css("width",nwidth+"px")}}if($t.p.footerrow){$($t.grid.sDiv).css("width",nwidth+"px")}if(shrink===false&&$t.p.forceFit==true){$t.p.forceFit=false}if(shrink===true){if($.browser.safari){brd=0}$.each($t.p.colModel,function(i){if(this.hidden===false){initwidth+=parseInt(this.width,10);if(this.fixed){tw+=this.width;gw+=this.width+brd}else{vc++}cl++}});if(vc==0){return}$t.p.tblwidth=initwidth;aw=nwidth-brd*vc-gw;if(!isNaN($t.p.height)){if($($t.grid.bDiv)[0].clientHeight<$($t.grid.bDiv)[0].scrollHeight){hs=true;aw-=scw}}initwidth=0;var cle=$t.grid.cols.length>0;$.each($t.p.colModel,function(i){var tn=this.name;if(this.hidden===false&&!this.fixed){cw=Math.floor((aw)/($t.p.tblwidth-tw)*this.width);this.width=cw;initwidth+=cw;$t.grid.headers[i].width=cw;$t.grid.headers[i].el.style.width=cw+"px";if($t.p.footerrow){$t.grid.footers[i].style.width=cw+"px"}if(cle){$t.grid.cols[i].style.width=cw+"px"}lvc=i}});cr=0;if(hs){if(nwidth-gw-(initwidth+brd*vc)!==scw){cr=nwidth-gw-(initwidth+brd*vc)-scw}}else{if(Math.abs(nwidth-gw-(initwidth+brd*vc))!==1){cr=nwidth-gw-(initwidth+brd*vc)}}$t.p.colModel[lvc].width+=cr;cw=$t.p.colModel[lvc].width;$t.grid.headers[lvc].width=cw;$t.grid.headers[lvc].el.style.width=cw+"px";if(cle){$t.grid.cols[lvc].style.width=cw+"px"}$t.p.tblwidth=initwidth+cr+tw+brd*cl;$("table:first",$t.grid.bDiv).css("width",$t.p.tblwidth+"px");$("table:first",$t.grid.hDiv).css("width",$t.p.tblwidth+"px");$t.grid.hDiv.scrollLeft=$t.grid.bDiv.scrollLeft;if($t.p.footerrow){$t.grid.footers[lvc].style.width=cw+"px";$("table:first",$t.grid.sDiv).css("width",$t.p.tblwidth+"px")}}})},setGridHeight:function(nh){return this.each(function(){var $t=this;if(!$t.grid){return}$($t.grid.bDiv).css({height:nh+(isNaN(nh)?"":"px")});$t.p.height=nh;if($t.p.scroll){$t.grid.populateVisible()}})},setCaption:function(newcap){return this.each(function(){this.p.caption=newcap;$("span.ui-jqgrid-title",this.grid.cDiv).html(newcap);$(this.grid.cDiv).show()})},setLabel:function(colname,nData,prop,attrp){return this.each(function(){var $t=this,pos=-1;if(!$t.grid){return}if(isNaN(colname)){$($t.p.colModel).each(function(i){if(this.name==colname){pos=i;return false}})}else{pos=parseInt(colname,10)}if(pos>=0){var thecol=$("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv);if(nData){var ico=$(".s-ico",thecol);$("[id^=jqgh_]",thecol).empty().html(nData).append(ico);$t.p.colNames[pos]=nData}if(prop){if(typeof prop==="string"){$(thecol).addClass(prop)}else{$(thecol).css(prop)}}if(typeof attrp==="object"){$(thecol).attr(attrp)}}})},setCell:function(rowid,colname,nData,cssp,attrp){return this.each(function(){var $t=this,pos=-1,v;if(!$t.grid){return}if(isNaN(colname)){$($t.p.colModel).each(function(i){if(this.name==colname){pos=i;return false}})}else{pos=parseInt(colname,10)}if(pos>=0){var ind=$t.rows.namedItem(rowid);if(ind){var tcell=$("td:eq("+pos+")",ind);if(nData!==""){v=$t.formatter(rowid,nData,pos,ind,"edit");$(tcell).html(v).attr("title",$.jgrid.stripHtml(v))}if(cssp){if(typeof cssp==="string"){$(tcell).addClass(cssp)}else{$(tcell).css(cssp)}}if(typeof attrp==="object"){$(tcell).attr(attrp)}}}})},getCell:function(rowid,col){var ret=false;this.each(function(){var $t=this,pos=-1;if(!$t.grid){return}if(isNaN(col)){$($t.p.colModel).each(function(i){if(this.name===col){pos=i;return false}})}else{pos=parseInt(col,10)}if(pos>=0){var ind=$t.rows.namedItem(rowid);if(ind){try{ret=$.unformat($("td:eq("+pos+")",ind),{colModel:$t.p.colModel[pos]},pos)}catch(e){ret=$.jgrid.htmlDecode($("td:eq("+pos+")",ind).html())}}}});return ret},getCol:function(col,obj,mathopr){var ret=[],val,sum=0;obj=typeof(obj)!="boolean"?false:obj;if(typeof mathopr=="undefined"){mathopr=false}this.each(function(){var $t=this,pos=-1;if(!$t.grid){return}if(isNaN(col)){$($t.p.colModel).each(function(i){if(this.name===col){pos=i;return false}})}else{pos=parseInt(col,10)}if(pos>=0){var ln=$t.rows.length,i=0;if(ln&&ln>0){while(i<ln){try{val=$.unformat($($t.rows[i].cells[pos]),{colModel:$t.p.colModel[pos]},pos)}catch(e){val=$.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML)}mathopr?sum+=parseFloat(val,10):obj?ret.push({id:$t.rows[i].id,value:val}):ret[i]=val;i++}if(mathopr){switch(mathopr.toLowerCase()){case"sum":ret=sum;break;case"avg":ret=sum/ln;break;case"count":ret=ln;break}}}}});return ret},clearGridData:function(clearfooter){return this.each(function(){var $t=this;if(!$t.grid){return}if(typeof clearfooter!="boolean"){clearfooter=false}$("tbody:first tr",$t.grid.bDiv).remove();if($t.p.footerrow&&clearfooter){$(".ui-jqgrid-ftable td",$t.grid.sDiv).html("&nbsp;")}$t.p.selrow=null;$t.p.selarrrow=[];$t.p.savedRow=[];$t.p.records=0;$t.p.page="0";$t.p.lastpage="0";$t.p.reccount=0;$t.updatepager(true,false)})},getInd:function(rowid,rc){var ret=false,rw;this.each(function(){rw=this.rows.namedItem(rowid);if(rw){ret=rc===true?rw:rw.rowIndex}});return ret}})})(jQuery);(function(a){a.jgrid.extend({editCell:function(d,c,b){return this.each(function(){var k=this,n,l,g;if(!k.grid||k.p.cellEdit!==true){return}c=parseInt(c,10);k.p.selrow=k.rows[d].id;if(!k.p.knv){a(k).jqGrid("GridNav")}if(k.p.savedRow.length>0){if(b===true){if(d==k.p.iRow&&c==k.p.iCol){return}}var h=a("td:eq("+k.p.savedRow[0].ic+")>#"+k.p.savedRow[0].id+"_"+a.jgrid.jqID(k.p.savedRow[0].name),k.rows[k.p.savedRow[0].id]).val();if(k.p.savedRow[0].v!=h){a(k).jqGrid("saveCell",k.p.savedRow[0].id,k.p.savedRow[0].ic)}else{a(k).jqGrid("restoreCell",k.p.savedRow[0].id,k.p.savedRow[0].ic)}}else{window.setTimeout(function(){a("#"+k.p.knv).attr("tabindex","-1").focus()},0)}n=k.p.colModel[c].name;if(n=="subgrid"||n=="cb"||n=="rn"){return}g=a("td:eq("+c+")",k.rows[d]);if(k.p.colModel[c].editable===true&&b===true&&!g.hasClass("not-editable-cell")){if(parseInt(k.p.iCol)>=0&&parseInt(k.p.iRow)>=0){a("td:eq("+k.p.iCol+")",k.rows[k.p.iRow]).removeClass("edit-cell ui-state-highlight");a(k.rows[k.p.iRow]).removeClass("selected-row ui-state-hover")}a(g).addClass("edit-cell ui-state-highlight");a(k.rows[d]).addClass("selected-row ui-state-hover");try{l=a.unformat(g,{colModel:k.p.colModel[c]},c)}catch(m){l=a(g).html()}if(!k.p.colModel[c].edittype){k.p.colModel[c].edittype="text"}k.p.savedRow.push({id:d,ic:c,name:n,v:l});if(a.isFunction(k.p.formatCell)){var j=k.p.formatCell(k.rows[d].id,n,l,d,c);if(j!=undefined){l=j}}var f=a.extend({},k.p.colModel[c].editoptions||{},{id:d+"_"+n,name:n});var e=createEl(k.p.colModel[c].edittype,f,l,true,a.extend({},a.jgrid.ajaxOptions,k.p.ajaxSelectOptions||{}));if(a.isFunction(k.p.beforeEditCell)){k.p.beforeEditCell(k.rows[d].id,n,l,d,c)}a(g).html("").append(e).attr("tabindex","0");window.setTimeout(function(){a(e).focus()},0);a("input, select, textarea",g).bind("keydown",function(o){if(o.keyCode===27){if(a("input.hasDatepicker",g).length>0){if(a(".ui-datepicker").is(":hidden")){a(k).jqGrid("restoreCell",d,c)}else{a("input.hasDatepicker",g).datepicker("hide")}}else{a(k).jqGrid("restoreCell",d,c)}}if(o.keyCode===13){a(k).jqGrid("saveCell",d,c)}if(o.keyCode==9){if(o.shiftKey){a(k).jqGrid("prevCell",d,c)}else{a(k).jqGrid("nextCell",d,c)}}o.stopPropagation()});if(a.isFunction(k.p.afterEditCell)){k.p.afterEditCell(k.rows[d].id,n,l,d,c)}}else{if(parseInt(k.p.iCol)>=0&&parseInt(k.p.iRow)>=0){a("td:eq("+k.p.iCol+")",k.rows[k.p.iRow]).removeClass("edit-cell ui-state-highlight");a(k.rows[k.p.iRow]).removeClass("selected-row ui-state-hover")}g.addClass("edit-cell ui-state-highlight");a(k.rows[d]).addClass("selected-row ui-state-hover");if(a.isFunction(k.p.onSelectCell)){l=g.html().replace(/\&nbsp\;/ig,"");k.p.onSelectCell(k.rows[d].id,n,l,d,c)}}k.p.iCol=c;k.p.iRow=d})},saveCell:function(c,b){return this.each(function(){var l=this,n;if(!l.grid||l.p.cellEdit!==true){return}if(l.p.savedRow.length>=1){n=0}else{n=null}if(n!=null){var h=a("td:eq("+b+")",l.rows[c]),t,q,s=l.p.colModel[b],u=s.name,g=a.jgrid.jqID(u);switch(s.edittype){case"select":if(!s.editoptions.multiple){t=a("#"+c+"_"+g+">option:selected",l.rows[c]).val();q=a("#"+c+"_"+g+">option:selected",l.rows[c]).text()}else{var d=a("#"+c+"_"+g,l.rows[c]),f=[];t=a(d).val();if(t){t.join(",")}else{t=""}a("option:selected",d).each(function(e,v){f[e]=a(v).text()});q=f.join(",")}if(s.formatter){q=t}break;case"checkbox":var j=["Yes","No"];if(s.editoptions){j=s.editoptions.value.split(":")}t=a("#"+c+"_"+g,l.rows[c]).attr("checked")?j[0]:j[1];q=t;break;case"password":case"text":case"textarea":case"button":t=!l.p.autoencode?a("#"+c+"_"+g,l.rows[c]).val():a.jgrid.htmlEncode(a("#"+c+"_"+g,l.rows[c]).val());q=t;break;case"custom":try{if(s.editoptions&&a.isFunction(s.editoptions.custom_value)){t=s.editoptions.custom_value(a(".customelement",h));if(t===undefined){throw"e2"}else{q=t}}else{throw"e1"}}catch(o){if(o=="e1"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose)}if(o=="e2"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose)}else{info_dialog(jQuery.jgrid.errors.errcap,o.message,jQuery.jgrid.edit.bClose)}}break}if(q!=l.p.savedRow[n].v){if(a.isFunction(l.p.beforeSaveCell)){var r=l.p.beforeSaveCell(l.rows[c].id,u,t,c,b);if(r){t=r}}var k=checkValues(t,b,l);if(k[0]===true){var m={};if(a.isFunction(l.p.beforeSubmitCell)){m=l.p.beforeSubmitCell(l.rows[c].id,u,t,c,b);if(!m){m={}}}if(q==""){q=" "}if(a("input.hasDatepicker",h).length>0){a("input.hasDatepicker",h).datepicker("hide")}if(l.p.cellsubmit=="remote"){if(l.p.cellurl){var p={};p[u]=t;p.id=l.rows[c].id;p=a.extend(m,p);a.ajax(a.extend({url:l.p.cellurl,data:a.isFunction(l.p.serializeCellData)?l.p.serializeCellData(p):p,type:"POST",complete:function(e,w){if(w=="success"){if(a.isFunction(l.p.afterSubmitCell)){var v=l.p.afterSubmitCell(e,p.id,u,t,c,b);if(v[0]===true){a(h).empty();a(l).jqGrid("setCell",l.rows[c].id,b,q);a(h).addClass("dirty-cell");a(l.rows[c]).addClass("edited");if(a.isFunction(l.p.afterSaveCell)){l.p.afterSaveCell(l.rows[c].id,u,t,c,b)}l.p.savedRow.splice(0,1)}else{info_dialog(a.jgrid.errors.errcap,v[1],a.jgrid.edit.bClose);a(l).jqGrid("restoreCell",c,b)}}else{a(h).empty();a(l).jqGrid("setCell",l.rows[c].id,b,q);a(h).addClass("dirty-cell");a(l.rows[c]).addClass("edited");if(a.isFunction(l.p.afterSaveCell)){l.p.afterSaveCell(l.rows[c].id,u,t,c,b)}l.p.savedRow.splice(0,1)}}},error:function(e,v){if(a.isFunction(l.p.errorCell)){l.p.errorCell(e,v);a(l).jqGrid("restoreCell",c,b)}else{info_dialog(a.jgrid.errors.errcap,e.status+" : "+e.statusText+"<br/>"+v,a.jgrid.edit.bClose);a(l).jqGrid("restoreCell",c,b)}}},a.jgrid.ajaxOptions,l.p.ajaxCellOptions||{}))}else{try{info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose);a(l).jqGrid("restoreCell",c,b)}catch(o){}}}if(l.p.cellsubmit=="clientArray"){a(h).empty();a(l).jqGrid("setCell",l.rows[c].id,b,q);a(h).addClass("dirty-cell");a(l.rows[c]).addClass("edited");if(a.isFunction(l.p.afterSaveCell)){l.p.afterSaveCell(l.rows[c].id,u,t,c,b)}l.p.savedRow.splice(0,1)}}else{try{window.setTimeout(function(){info_dialog(a.jgrid.errors.errcap,t+" "+k[1],a.jgrid.edit.bClose)},100);a(l).jqGrid("restoreCell",c,b)}catch(o){}}}else{a(l).jqGrid("restoreCell",c,b)}}if(a.browser.opera){a("#"+l.p.knv).attr("tabindex","-1").focus()}else{window.setTimeout(function(){a("#"+l.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(c,b){return this.each(function(){var h=this,d;if(!h.grid||h.p.cellEdit!==true){return}if(h.p.savedRow.length>=1){d=0}else{d=null}if(d!=null){var g=a("td:eq("+b+")",h.rows[c]);if(a.isFunction(a.fn.datepicker)){try{a("input.hasDatepicker",g).datepicker("hide")}catch(f){}}a(g).empty().attr("tabindex","-1");a(h).jqGrid("setCell",h.rows[c].id,b,h.p.savedRow[d].v);h.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+h.p.knv).attr("tabindex","-1").focus()},0)})},nextCell:function(c,b){return this.each(function(){var f=this,e=false;if(!f.grid||f.p.cellEdit!==true){return}for(var d=b+1;d<f.p.colModel.length;d++){if(f.p.colModel[d].editable===true){e=d;break}}if(e!==false){a(f).jqGrid("editCell",c,e,true)}else{if(f.p.savedRow.length>0){a(f).jqGrid("saveCell",c,b)}}})},prevCell:function(c,b){return this.each(function(){var f=this,e=false;if(!f.grid||f.p.cellEdit!==true){return}for(var d=b-1;d>=0;d--){if(f.p.colModel[d].editable===true){e=d;break}}if(e!==false){a(f).jqGrid("editCell",c,e,true)}else{if(f.p.savedRow.length>0){a(f).jqGrid("saveCell",c,b)}}})},GridNav:function(){return this.each(function(){var g=this;if(!g.grid||g.p.cellEdit!==true){return}g.p.knv=g.p.id+"_kn";var f=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+g.p.knv+"'></span></span>"),d,c;a(f).insertBefore(g.grid.cDiv);a("#"+g.p.knv).focus().keydown(function(h){c=h.keyCode;if(g.p.direction=="rtl"){if(c==37){c=39}else{if(c==39){c=37}}}switch(c){case 38:if(g.p.iRow-1>=0){e(g.p.iRow-1,g.p.iCol,"vu");a(g).jqGrid("editCell",g.p.iRow-1,g.p.iCol,false)}break;case 40:if(g.p.iRow+1<=g.rows.length-1){e(g.p.iRow+1,g.p.iCol,"vd");a(g).jqGrid("editCell",g.p.iRow+1,g.p.iCol,false)}break;case 37:if(g.p.iCol-1>=0){d=b(g.p.iCol-1,"lft");e(g.p.iRow,d,"h");a(g).jqGrid("editCell",g.p.iRow,d,false)}break;case 39:if(g.p.iCol+1<=g.p.colModel.length-1){d=b(g.p.iCol+1,"rgt");e(g.p.iRow,d,"h");a(g).jqGrid("editCell",g.p.iRow,d,false)}break;case 13:if(parseInt(g.p.iCol,10)>=0&&parseInt(g.p.iRow,10)>=0){a(g).jqGrid("editCell",g.p.iRow,g.p.iCol,true)}break}return false});function e(q,o,p){if(p.substr(0,1)=="v"){var h=a(g.grid.bDiv)[0].clientHeight,r=a(g.grid.bDiv)[0].scrollTop,s=g.rows[q].offsetTop+g.rows[q].clientHeight,m=g.rows[q].offsetTop;if(p=="vd"){if(s>=h){a(g.grid.bDiv)[0].scrollTop=a(g.grid.bDiv)[0].scrollTop+g.rows[q].clientHeight}}if(p=="vu"){if(m<r){a(g.grid.bDiv)[0].scrollTop=a(g.grid.bDiv)[0].scrollTop-g.rows[q].clientHeight}}}if(p=="h"){var l=a(g.grid.bDiv)[0].clientWidth,k=a(g.grid.bDiv)[0].scrollLeft,j=g.rows[q].cells[o].offsetLeft+g.rows[q].cells[o].clientWidth,n=g.rows[q].cells[o].offsetLeft;if(j>=l+parseInt(k)){a(g.grid.bDiv)[0].scrollLeft=a(g.grid.bDiv)[0].scrollLeft+g.rows[q].cells[o].clientWidth}else{if(n<k){a(g.grid.bDiv)[0].scrollLeft=a(g.grid.bDiv)[0].scrollLeft-g.rows[q].cells[o].clientWidth}}}}function b(l,h){var k,j;if(h=="lft"){k=l+1;for(j=l;j>=0;j--){if(g.p.colModel[j].hidden!==true){k=j;break}}}if(h=="rgt"){k=l-1;for(j=l;j<g.p.colModel.length;j++){if(g.p.colModel[j].hidden!==true){k=j;break}}}return k}})},getChangedCells:function(c){var b=[];if(!c){c="all"}this.each(function(){var e=this,d;if(!e.grid||e.p.cellEdit!==true){return}a(e.rows).each(function(f){var g={};if(a(this).hasClass("edited")){a("td",this).each(function(h){d=e.p.colModel[h].name;if(d!=="cb"&&d!=="subgrid"){if(c=="dirty"){if(a(this).hasClass("dirty-cell")){try{g[d]=a.unformat(this,{colModel:e.p.colModel[h]},h)}catch(j){g[d]=a.jgrid.htmlDecode(a(this).html())}}}else{try{g[d]=a.unformat(this,{colModel:e.p.colModel[h]},h)}catch(j){g[d]=a.jgrid.htmlDecode(a(this).html())}}}});g.id=this.id;b.push(g)}})});return b}})})(jQuery);var showModal=function(a){a.w.show()};var closeModal=function(a){a.w.hide().attr("aria-hidden","true");if(a.o){a.o.remove()}};var createModal=function(m,g,b,o,r,q){var l=document.createElement("div"),a;a=jQuery(b.gbox).attr("dir")=="rtl"?true:false;l.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";l.id=m.themodal;var d=document.createElement("div");d.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";d.id=m.modalhead;jQuery(d).append("<span class='ui-jqdialog-title'>"+b.caption+"</span>");var n=jQuery("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){n.addClass("ui-state-hover")},function(){n.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");jQuery(d).append(n);if(a){l.dir="rtl";jQuery(".ui-jqdialog-title",d).css("float","right");jQuery(".ui-jqdialog-titlebar-close",d).css("left",0.3+"em")}else{l.dir="ltr";jQuery(".ui-jqdialog-title",d).css("float","left");jQuery(".ui-jqdialog-titlebar-close",d).css("right",0.3+"em")}var j=document.createElement("div");jQuery(j).addClass("ui-jqdialog-content ui-widget-content").attr("id",m.modalcontent);jQuery(j).append(g);l.appendChild(j);jQuery(l).prepend(d);if(q===true){jQuery("body").append(l)}else{jQuery(l).insertBefore(o)}if(typeof b.jqModal==="undefined"){b.jqModal=true}var c={};if(jQuery.fn.jqm&&b.jqModal===true){if(b.left==0&&b.top==0){var h=[];h=findPos(r);b.left=h[0]+4;b.top=h[1]+4}c.top=b.top+"px";c.left=b.left}else{if(b.left!=0||b.top!=0){c.left=b.left;c.top=b.top+"px"}}jQuery("a.ui-jqdialog-titlebar-close",d).click(function(s){var p=jQuery("#"+m.themodal).data("onClose")||b.onClose;var t=jQuery("#"+m.themodal).data("gbox")||b.gbox;hideModal("#"+m.themodal,{gb:t,jqm:b.jqModal,onClose:p});return false});if(b.width==0||!b.width){b.width=300}if(b.height==0||!b.height){b.height=200}if(!b.zIndex){b.zIndex=950}var k=0;if(a&&c.left&&!q){k=jQuery(b.gbox).width()-(!isNaN(b.width)?parseInt(b.width):0)-8;c.left=parseInt(c.left)+parseInt(k)}if(c.left){c.left+="px"}jQuery(l).css(jQuery.extend({width:isNaN(b.width)?"auto":b.width+"px",height:isNaN(b.height)?"auto":b.height+"px",zIndex:b.zIndex,overflow:"hidden"},c)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":m.modalhead,"aria-hidden":"true"});if(typeof b.drag=="undefined"){b.drag=true}if(typeof b.resize=="undefined"){b.resize=true}if(b.drag){jQuery(d).css("cursor","move");if(jQuery.fn.jqDrag){jQuery(l).jqDrag(d)}else{try{jQuery(l).draggable({handle:jQuery("#"+d.id)})}catch(f){}}}if(b.resize){if(jQuery.fn.jqResize){jQuery(l).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");jQuery("#"+m.themodal).jqResize(".jqResize",m.scrollelm?"#"+m.scrollelm:false)}else{try{jQuery(l).resizable({handles:"se, sw",alsoResize:m.scrollelm?"#"+m.scrollelm:false})}catch(f){}}}if(b.closeOnEscape===true){jQuery(l).keydown(function(s){if(s.which==27){var p=jQuery("#"+m.themodal).data("onClose")||b.onClose;hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:p})}})}};var viewModal=function(a,c){c=jQuery.extend({toTop:true,overlay:10,modal:false,onShow:showModal,onHide:closeModal,gbox:"",jqm:true,jqM:true},c||{});if(jQuery.fn.jqm&&c.jqm==true){if(c.jqM){jQuery(a).attr("aria-hidden","false").jqm(c).jqmShow()}else{jQuery(a).attr("aria-hidden","false").jqmShow()}}else{if(c.gbox!=""){jQuery(".jqgrid-overlay:first",c.gbox).show();jQuery(a).data("gbox",c.gbox)}jQuery(a).show().attr("aria-hidden","false");try{jQuery(":input:visible",a)[0].focus()}catch(b){}}};var hideModal=function(a,d){d=jQuery.extend({jqm:true,gb:""},d||{});if(d.onClose){var b=d.onClose(a);if(typeof b=="boolean"&&!b){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(c){}}jQuery(a).hide().attr("aria-hidden","true")}};function info_dialog(n,h,b,m){var k={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:"<b>"+n+"</b>",left:250,top:170,zIndex:1000,jqModal:true,closeOnEscape:true,align:"center",buttonalign:"center",buttons:[]};jQuery.extend(k,m||{});var c=k.jqModal;if(jQuery.fn.jqm&&!c){c=false}var f="";if(k.buttons.length>0){for(var d=0;d<k.buttons.length;d++){if(typeof k.buttons[d].id=="undefined"){k.buttons[d].id="info_button_"+d}f+="<a href='javascript:void(0)' id='"+k.buttons[d].id+"' class='fm-button ui-state-default ui-corner-all'>"+k.buttons[d].text+"</a>"}}var j=isNaN(k.dataheight)?k.dataheight:k.dataheight+"px",l="text-align:"+k.align+";";var a="<div id='info_id'>";a+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+j+";"+l+"'>"+h+"</div>";a+=b?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+k.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+b+"</a>"+f+"</div>":"";a+="</div>";try{if(jQuery("#info_dialog").attr("aria-hidden")=="false"){hideModal("#info_dialog",{jqm:c})}jQuery("#info_dialog").remove()}catch(g){}createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},a,k,"","",true);if(f){jQuery.each(k.buttons,function(e){jQuery("#"+this.id,"#info_id").bind("click",function(){k.buttons[e].onClick.call(jQuery("#info_dialog"));return false})})}jQuery("#closedialog","#info_id").click(function(o){hideModal("#info_dialog",{jqm:c});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(e){e.w.hide().remove();if(e.o){e.o.remove()}},modal:true,jqm:c})}function findPos(a){var b=curtop=0;if(a.offsetParent){do{b+=a.offsetLeft;curtop+=a.offsetTop}while(a=a.offsetParent)}return[b,curtop]}function isArray(a){if(a.constructor.toString().indexOf("Array")==-1){return false}else{return true}}function createEl(d,f,s,j,q){var r="";if(f.defaultValue){delete f.defaultValue}function k(v,e){if(jQuery.isFunction(e.dataInit)){v.id=e.id;e.dataInit(v);delete e.id;delete e.dataInit}if(e.dataEvents){jQuery.each(e.dataEvents,function(){if(this.data!=null){jQuery(v).bind(this.type,this.data,this.fn)}else{jQuery(v).bind(this.type,this.fn)}});delete e.dataEvents}return e}switch(d){case"textarea":r=document.createElement("textarea");if(j){if(!f.cols){jQuery(r).css({width:"98%"})}}else{if(!f.cols){f.cols=20}}if(!f.rows){f.rows=2}if(s=="&nbsp;"||s=="&#160;"||(s.length==1&&s.charCodeAt(0)==160)){s=""}r.value=s;f=k(r,f);jQuery(r).attr(f);break;case"checkbox":r=document.createElement("input");r.type="checkbox";if(!f.value){var u=s.toLowerCase();if(u.search(/(false|0|no|off|undefined)/i)<0&&u!==""){r.checked=true;r.defaultChecked=true;r.value=s}else{r.value="on"}jQuery(r).attr("offval","off")}else{var m=f.value.split(":");if(s===m[0]){r.checked=true;r.defaultChecked=true}r.value=m[0];jQuery(r).attr("offval",m[1]);try{delete f.value}catch(p){}}f=k(r,f);jQuery(r).attr(f);break;case"select":r=document.createElement("select");var b,g=[];if(f.multiple===true){b=true;r.multiple="multiple"}else{b=false}if(f.dataUrl!=null){jQuery.ajax(jQuery.extend({url:f.dataUrl,type:"GET",complete:function(y,x){try{delete f.dataUrl;delete f.value}catch(z){}var w;if(f.buildSelect!=null){var v=f.buildSelect(y);w=jQuery(v).html();delete f.buildSelect}else{w=jQuery(y.responseText).html()}if(w){jQuery(r).append(w);f=k(r,f);if(typeof f.size==="undefined"){f.size=b?3:1}if(b){g=s.split(",");g=jQuery.map(g,function(e){return jQuery.trim(e)})}else{g[0]=s}jQuery(r).attr(f);setTimeout(function(){jQuery("option",r).each(function(e){if(e==0){this.selected=""}if(jQuery.inArray(jQuery(this).text(),g)>-1||jQuery.inArray(jQuery(this).val(),g)>-1){this.selected="selected";if(!b){return false}}})},0)}}},q||{}))}else{if(f.value){var n;if(b){g=s.split(",");g=jQuery.map(g,function(e){return jQuery.trim(e)});if(typeof f.size==="undefined"){f.size=3}}else{f.size=1}if(typeof f.value==="function"){f.value=f.value()}if(typeof f.value==="string"){var o=f.value.split(";"),l,h;for(n=0;n<o.length;n++){l=o[n].split(":");h=document.createElement("option");h.value=l[0];h.innerHTML=l[1];if(!b&&(l[0]==s||l[1]==s)){h.selected="selected"}if(b&&(jQuery.inArray(l[1],g)>-1||jQuery.inArray(l[0],g)>-1)){h.selected="selected"}r.appendChild(h)}}else{if(typeof f.value==="object"){var c=f.value;for(var t in c){h=document.createElement("option");h.value=t;h.innerHTML=c[t];if(!b&&(t==s||c[t]==s)){h.selected="selected"}if(b&&(jQuery.inArray(c[t],g)>-1||jQuery.inArray(t,g)>-1)){h.selected="selected"}r.appendChild(h)}}}f=k(r,f);try{delete f.value}catch(p){}jQuery(r).attr(f)}}break;case"text":case"password":case"button":r=document.createElement("input");r.type=d;r.value=jQuery.jgrid.htmlDecode(s);f=k(r,f);if(d!="button"){if(j){if(!f.size){jQuery(r).css({width:"98%"})}}else{if(!f.size){f.size=20}}}jQuery(r).attr(f);break;case"image":case"file":r=document.createElement("input");r.type=d;f=k(r,f);jQuery(r).attr(f);break;case"custom":r=document.createElement("span");try{if(jQuery.isFunction(f.custom_element)){var a=f.custom_element.call(this,s,f);if(a){a=jQuery(a).addClass("customelement").attr({id:f.id,name:f.name});jQuery(r).empty().append(a)}else{throw"e2"}}else{throw"e1"}}catch(p){if(p=="e1"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+jQuery.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose)}if(p=="e2"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+jQuery.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose)}else{info_dialog(jQuery.jgrid.errors.errcap,p.message,jQuery.jgrid.edit.bClose)}}break}return r}function checkValues(c,m,j){var f,h,n;if(typeof(m)=="string"){for(h=0,len=j.p.colModel.length;h<len;h++){if(j.p.colModel[h].name==m){f=j.p.colModel[h].editrules;m=h;try{n=j.p.colModel[h].formoptions.label}catch(l){}break}}}else{if(m>=0){f=j.p.colModel[m].editrules}}if(f){if(!n){n=j.p.colNames[m]}if(f.required===true){if(c.match(/^s+$/)||c==""){return[false,n+": "+jQuery.jgrid.edit.msg.required,""]}}var d=f.required===false?false:true;if(f.number===true){if(!(d===false&&isEmpty(c))){if(isNaN(c)){return[false,n+": "+jQuery.jgrid.edit.msg.number,""]}}}if(typeof f.minValue!="undefined"&&!isNaN(f.minValue)){if(parseFloat(c)<parseFloat(f.minValue)){return[false,n+": "+jQuery.jgrid.edit.msg.minValue+" "+f.minValue,""]}}if(typeof f.maxValue!="undefined"&&!isNaN(f.maxValue)){if(parseFloat(c)>parseFloat(f.maxValue)){return[false,n+": "+jQuery.jgrid.edit.msg.maxValue+" "+f.maxValue,""]}}var a;if(f.email===true){if(!(d===false&&isEmpty(c))){a=/^((([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(!a.test(c)){return[false,n+": "+jQuery.jgrid.edit.msg.email,""]}}}if(f.integer===true){if(!(d===false&&isEmpty(c))){if(isNaN(c)){return[false,n+": "+jQuery.jgrid.edit.msg.integer,""]}if((c%1!=0)||(c.indexOf(".")!=-1)){return[false,n+": "+jQuery.jgrid.edit.msg.integer,""]}}}if(f.date===true){if(!(d===false&&isEmpty(c))){var b=j.p.colModel[m].datefmt||"Y-m-d";if(!checkDate(b,c)){return[false,n+": "+jQuery.jgrid.edit.msg.date+" - "+b,""]}}}if(f.time===true){if(!(d===false&&isEmpty(c))){if(!checkTime(c)){return[false,n+": "+jQuery.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]}}}if(f.url===true){if(!(d===false&&isEmpty(c))){a=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!a.test(c)){return[false,n+": "+jQuery.jgrid.edit.msg.url,""]}}}if(f.custom===true){if(!(d===false&&isEmpty(c))){if(jQuery.isFunction(f.custom_func)){var k=f.custom_func.call(j,c,n);if(jQuery.isArray(k)){return k}else{return[false,jQuery.jgrid.edit.msg.customarray,""]}}else{return[false,jQuery.jgrid.edit.msg.customfcheck,""]}}}}return[true,"",""]}function checkDate(l,c){var e={},n;l=l.toLowerCase();if(l.indexOf("/")!=-1){n="/"}else{if(l.indexOf("-")!=-1){n="-"}else{if(l.indexOf(".")!=-1){n="."}else{n="/"}}}l=l.split(n);c=c.split(n);if(c.length!=3){return false}var f=-1,m,g=-1,d=-1;for(var h=0;h<l.length;h++){var b=isNaN(c[h])?0:parseInt(c[h],10);e[l[h]]=b;m=l[h];if(m.indexOf("y")!=-1){f=h}if(m.indexOf("m")!=-1){d=h}if(m.indexOf("d")!=-1){g=h}}if(l[f]=="y"||l[f]=="yyyy"){m=4}else{if(l[f]=="yy"){m=2}else{m=-1}}var a=DaysArray(12);var k;if(f===-1){return false}else{k=e[l[f]].toString();if(m==2&&k.length==1){m=1}if(k.length!=m||e[l[f]]==0){return false}}if(d===-1){return false}else{k=e[l[d]].toString();if(k.length<1||e[l[d]]<1||e[l[d]]>12){return false}}if(g===-1){return false}else{k=e[l[g]].toString();if(k.length<1||e[l[g]]<1||e[l[g]]>31||(e[l[d]]==2&&e[l[g]]>daysInFebruary(e[l[f]]))||e[l[g]]>a[e[l[d]]]){return false}}return true}function daysInFebruary(a){return(((a%4==0)&&((!(a%100==0))||(a%400==0)))?29:28)}function DaysArray(b){for(var a=1;a<=b;a++){this[a]=31;if(a==4||a==6||a==9||a==11){this[a]=30}if(a==2){this[a]=29}}return this}function isEmpty(a){if(a.match(/^s+$/)||a==""){return true}else{return false}}function checkTime(c){var b=/^(\d{1,2}):(\d{2})([ap]m)?$/,a;if(!isEmpty(c)){a=c.match(b);if(a){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(a){a.jgrid.extend({getColProp:function(d){var b={},f=this[0];if(!f.grid){return}var e=f.p.colModel;for(var c=0;c<e.length;c++){if(e[c].name==d){b=e[c];break}}return b},setColProp:function(c,b){return this.each(function(){if(this.grid){if(b){var e=this.p.colModel;for(var d=0;d<e.length;d++){if(e[d].name==c){a.extend(this.p.colModel[d],b);break}}}}})},sortGrid:function(c,b){return this.each(function(){var g=this,d=-1;if(!g.grid){return}if(!c){c=g.p.sortname}for(var f=0;f<g.p.colModel.length;f++){if(g.p.colModel[f].index==c||g.p.colModel[f].name==c){d=f;break}}if(d!=-1){var e=g.p.colModel[d].sortable;if(typeof e!=="boolean"){e=true}if(typeof b!=="boolean"){b=false}if(e){g.sortData("jqgh_"+c,d,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){if(this.p.pager){a(this.p.pager).remove()}var c=this.id;try{a("#gbox_"+c).remove()}catch(b){}}})},GridUnload:function(){return this.each(function(){if(!this.grid){return}var d={id:a(this).attr("id"),cl:a(this).attr("class")};if(this.p.pager){a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom")}var b=document.createElement("table");a(b).attr({id:d.id});b.className=d.cl;var c=this.id;a(b).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+c).length===1){a(b).insertBefore("#gbox_"+c).show();a(this.p.pager).insertBefore("#gbox_"+c)}else{a(b).insertBefore("#gbox_"+c).show()}a("#gbox_"+c).remove()})},setGridState:function(b){return this.each(function(){if(!this.grid){return}$t=this;if(b=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+$t.p.id).slideUp("fast");if($t.p.pager){a($t.p.pager).slideUp("fast")}if($t.p.toolbar[0]===true){if($t.p.toolbar[1]=="both"){a($t.grid.ubDiv).slideUp("fast")}a($t.grid.uDiv).slideUp("fast")}if($t.p.footerrow){a(".ui-jqgrid-sdiv","#gbox_"+$s.p.id).slideUp("fast")}a(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");$t.p.gridstate="hidden"}else{if(b=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+$t.p.id).slideDown("fast");if($t.p.pager){a($t.p.pager).slideDown("fast")}if($t.p.toolbar[0]===true){if($t.p.toolbar[1]=="both"){a($t.grid.ubDiv).slideDown("fast")}a($t.grid.uDiv).slideDown("fast")}if($t.p.footerrow){a(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideDown("fast")}a(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");$t.p.gridstate="visible"}}})},updateGridRows:function(e,c,d){var b,f=false;this.each(function(){var h=this,k,l,j,g;if(!h.grid){return false}if(!c){c="id"}if(e&&e.length>0){a(e).each(function(n){j=this;l=h.rows.namedItem(j[c]);if(l){g=j[c];if(d===true){if(h.p.jsonReader.repeatitems===true){if(h.p.jsonReader.cell){j=j[h.p.jsonReader.cell]}for(var m=0;m<j.length;m++){k=h.formatter(g,j[m],m,j,"edit");if(h.p.treeGrid===true&&b==h.p.ExpandColumn){a("td:eq("+m+") > span:first",l).html(k).attr("title",a.jgrid.stripHtml(k))}else{a("td:eq("+m+")",l).html(k).attr("title",a.jgrid.stripHtml(k))}}f=true;return true}}a(h.p.colModel).each(function(o){b=d===true?this.jsonmap||this.name:this.name;if(j[b]!=undefined){k=h.formatter(g,j[b],o,j,"edit");if(h.p.treeGrid===true&&b==h.p.ExpandColumn){a("td:eq("+o+") > span:first",l).html(k).attr("title",a.jgrid.stripHtml(k))}else{a("td:eq("+o+")",l).html(k).attr("title",a.jgrid.stripHtml(k))}f=true}})}})}});return f},filterGrid:function(c,b){b=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},b||{});return this.each(function(){var m=this;this.p=b;if(this.p.filterModel.length==0&&this.p.gridModel===false){alert("No filter is set");return}if(!c){alert("No target grid is set!");return}this.p.gridid=c.indexOf("#")!=-1?c:"#"+c;var d=a(this.p.gridid).jqGrid("getGridParam","colModel");if(d){if(this.p.gridModel===true){var e=a(this.p.gridid)[0];var g;a.each(d,function(p,q){var o=[];this.search=this.search===false?false:true;if(this.editrules&&this.editrules.searchhidden===true){g=true}else{if(this.hidden===true){g=false}else{g=true}}if(this.search===true&&g===true){if(m.p.gridNames===true){o.label=e.p.colNames[p]}else{o.label=""}o.name=this.name;o.index=this.index||this.name;o.stype=this.edittype||"text";if(o.stype!="select"){o.stype="text"}o.defval=this.defval||"";o.surl=this.surl||"";o.sopt=this.editoptions||{};o.width=this.width;m.p.filterModel.push(o)}})}else{a.each(m.p.filterModel,function(p,q){for(var o=0;o<d.length;o++){if(this.name==d[o].name){this.index=d[o].index||this.name;break}}if(!this.index){this.index=this.name}})}}else{alert("Could not get grid colModel");return}var h=function(){var r={},q=0,o;var p=a(m.p.gridid)[0],n;p.p.searchdata={};if(a.isFunction(m.p.beforeSearch)){m.p.beforeSearch()}a.each(m.p.filterModel,function(u,w){n=this.index;switch(this.stype){case"select":o=a("select[name="+n+"]",m).val();if(o){r[n]=o;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}break;default:o=a("input[name="+n+"]",m).val();if(o){r[n]=o;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}}});var s=q>0?true:false;a.extend(p.p.postData,r);var t;if(m.p.url){t=a(p).jqGrid("getGridParam","url");a(p).jqGrid("setGridParam",{url:m.p.url})}a(p).jqGrid("setGridParam",{search:s}).trigger("reloadGrid",[{page:1}]);if(t){a(p).jqGrid("setGridParam",{url:t})}if(a.isFunction(m.p.afterSearch)){m.p.afterSearch()}};var l=function(){var r={},o,q=0;var p=a(m.p.gridid)[0],n;if(a.isFunction(m.p.beforeClear)){m.p.beforeClear()}a.each(m.p.filterModel,function(u,x){n=this.index;o=(this.defval)?this.defval:"";if(!this.stype){this.stype=="text"}switch(this.stype){case"select":var w;a("select[name="+n+"] option",m).each(function(y){if(y==0){this.selected=true}if(a(this).text()==o){this.selected=true;w=a(this).val();return false}});if(w){r[n]=w;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}break;case"text":a("input[name="+n+"]",m).val(o);if(o){r[n]=o;if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).addClass("dirty-cell")}q++}else{if(m.p.marksearched){a("#jqgh_"+this.name,p.grid.hDiv).removeClass("dirty-cell")}try{delete p.p.postData[this.index]}catch(v){}}break}});var s=q>0?true:false;a.extend(p.p.postData,r);var t;if(m.p.url){t=a(p).jqGrid("getGridParam","url");a(p).jqGrid("setGridParam",{url:m.p.url})}a(p).jqGrid("setGridParam",{search:s}).trigger("reloadGrid",[{page:1}]);if(t){a(p).jqGrid("setGridParam",{url:t})}if(a.isFunction(m.p.afterClear)){m.p.afterClear()}};var j=function(){var r=document.createElement("tr");var o,t,n,p,s,q;if(m.p.formtype=="horizontal"){a(f).append(r)}a.each(m.p.filterModel,function(B,w){p=document.createElement("td");a(p).append("<label for='"+this.name+"'>"+this.label+"</label>");s=document.createElement("td");var A=this;if(!this.stype){this.stype="text"}switch(this.stype){case"select":if(this.surl){a(s).load(this.surl,function(){if(A.defval){a("select",this).val(A.defval)}a("select",this).attr({name:A.index||A.name,id:"sg_"+A.name});if(A.sopt){a("select",this).attr(A.sopt)}if(m.p.gridToolbar===true&&A.width){a("select",this).width(A.width)}if(m.p.autosearch===true){a("select",this).change(function(F){h();return false})}})}else{if(A.sopt.value){var u=A.sopt.value;var x=document.createElement("select");a(x).attr({name:A.index||A.name,id:"sg_"+A.name}).attr(A.sopt);if(typeof u==="string"){var v=u.split(";"),E,y;for(var z=0;z<v.length;z++){E=v[z].split(":");y=document.createElement("option");y.value=E[0];y.innerHTML=E[1];if(E[1]==A.defval){y.selected="selected"}x.appendChild(y)}}else{if(typeof u==="object"){for(var D in u){B++;y=document.createElement("option");y.value=D;y.innerHTML=u[D];if(u[D]==A.defval){y.selected="selected"}x.appendChild(y)}}}if(m.p.gridToolbar===true&&A.width){a(x).width(A.width)}a(s).append(x);if(m.p.autosearch===true){a(x).change(function(F){h();return false})}}}break;case"text":var C=this.defval?this.defval:"";a(s).append("<input type='text' name='"+(this.index||this.name)+"' id='sg_"+this.name+"' value='"+C+"'/>");if(A.sopt){a("input",s).attr(A.sopt)}if(m.p.gridToolbar===true&&A.width){if(a.browser.msie){a("input",s).width(A.width-4)}else{a("input",s).width(A.width-2)}}if(m.p.autosearch===true){a("input",s).keypress(function(G){var F=G.charCode?G.charCode:G.keyCode?G.keyCode:0;if(F==13){h();return false}return this})}break}if(m.p.formtype=="horizontal"){if(m.p.gridToolbar===true&&m.p.gridNames===false){a(r).append(s)}else{a(r).append(p).append(s)}a(r).append(s)}else{o=document.createElement("tr");a(o).append(p).append(s);a(f).append(o)}});s=document.createElement("td");if(m.p.enableSearch===true){t="<input type='button' id='sButton' class='"+m.p.buttonclass+"' value='"+m.p.searchButton+"'/>";a(s).append(t);a("input#sButton",s).click(function(){h();return false})}if(m.p.enableClear===true){n="<input type='button' id='cButton' class='"+m.p.buttonclass+"' value='"+m.p.clearButton+"'/>";a(s).append(n);a("input#cButton",s).click(function(){l();return false})}if(m.p.enableClear===true||m.p.enableSearch===true){if(m.p.formtype=="horizontal"){a(r).append(s)}else{o=document.createElement("tr");a(o).append("<td>&nbsp;</td>").append(s);a(f).append(o)}}};var k=a("<form name='SearchForm' style=display:inline;' class='"+this.p.formclass+"'></form>");var f=a("<table class='"+this.p.tableclass+"' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");a(k).append(f);j();a(this).append(k);this.triggerSearch=h;this.clearSearch=l})},filterToolbar:function(b){b=a.extend({autosearch:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:""},b||{});return this.each(function(){var g=this;var c=function(){var p={},o=0,n,m;g.p.searchdata={};a.each(g.p.colModel,function(t,v){m=this.index||this.name;switch(this.stype){case"select":n=a("select[name="+m+"]",g.grid.hDiv).val();if(n){p[m]=n;o++}else{try{delete g.p.postData[m]}catch(u){}}break;case"text":n=a("input[name="+m+"]",g.grid.hDiv).val();if(n){p[m]=n;o++}else{try{delete g.p.postData[m]}catch(u){}}break}});var q=o>0?true:false;a.extend(g.p.postData,p);var s;if(g.p.searchurl){s=g.p.url;a(g).jqGrid("setGridParam",{url:g.p.searchurl})}var r=false;if(a.isFunction(b.beforeSearch)){r=b.beforeSearch.call(g)}if(!r){a(g).jqGrid("setGridParam",{search:q}).trigger("reloadGrid",[{page:1}])}if(s){a(g).jqGrid("setGridParam",{url:s})}if(a.isFunction(b.afterSearch)){b.afterSearch()}};var k=function(){var p={},n,o=0,m;a.each(g.p.colModel,function(t,w){n=(this.searchoptions&&this.searchoptions.defaultValue)?this.searchoptions.defaultValue:"";m=this.index||this.name;switch(this.stype){case"select":var v;a("select[name="+m+"] option",g.grid.hDiv).each(function(x){if(x==0){this.selected=true}if(a(this).text()==n){this.selected=true;v=a(this).val();return false}});if(v){p[m]=v;o++}else{try{delete g.p.postData[m]}catch(u){}}break;case"text":a("input[name="+m+"]",g.grid.hDiv).val(n);if(n){p[m]=n;o++}else{try{delete g.p.postData[m]}catch(u){}}break}});var r=o>0?true:false;a.extend(g.p.postData,p);var s;if(g.p.searchurl){s=g.p.url;a(g).jqGrid("setGridParam",{url:g.p.searchurl})}var q=false;if(a.isFunction(b.beforeClear)){q=b.beforeClear.call(g)}if(!q){a(g).jqGrid("setGridParam",{search:r}).trigger("reloadGrid",[{page:1}])}if(s){a(g).jqGrid("setGridParam",{url:s})}if(a.isFunction(b.afterClear)){b.afterClear()}};var l=function(){var m=a("tr.ui-search-toolbar",g.grid.hDiv);if(m.css("display")=="none"){m.show()}else{m.hide()}};function f(m,o){var n=a(m);if(n[0]!=null){jQuery.each(o,function(){if(this.data!=null){n.bind(this.type,this.data,this.fn)}else{n.bind(this.type,this.fn)}})}}var h=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),d,j,e;a.each(g.p.colModel,function(u,q){var w=this;d=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+g.p.direction+"'></th>");j=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");if(this.hidden===true){a(d).css("display","none")}this.search=this.search===false?false:true;if(typeof this.stype=="undefined"){this.stype="text"}e=a.extend({},this.searchoptions||{});if(this.search){switch(this.stype){case"select":var m=this.surl||e.dataUrl;if(m){var z=j;a.ajax(a.extend({url:m,dataType:"html",complete:function(A,n){if(e.buildSelect!=null){var B=e.buildSelect(A);if(B){a(z).append(B)}}else{a(z).append(A.responseText)}if(e.defaultValue){a("select",z).val(e.defaultValue)}a("select",z).attr({name:w.index||w.name,id:"gs_"+w.name});if(e.attr){a("select",z).attr(e.attr)}a("select",z).css({width:"100%"});if(e.dataInit!=null){e.dataInit(a("select",z)[0])}if(e.dataEvents!=null){f(a("select",z)[0],e.dataEvents)}if(b.autosearch===true){a("select",z).change(function(C){c();return false})}}},a.jgrid.ajaxOptions,g.p.ajaxSelectOptions||{}))}else{var o;if(w.searchoptions&&w.searchoptions.value){o=w.searchoptions.value}else{if(w.editoptions&&w.editoptions.value){o=w.editoptions.value}}if(o){var s=document.createElement("select");s.style.width="100%";a(s).attr({name:w.index||w.name,id:"gs_"+w.name});if(typeof o==="string"){var p=o.split(";"),y,r;for(var t=0;t<p.length;t++){y=p[t].split(":");r=document.createElement("option");r.value=y[0];r.innerHTML=y[1];s.appendChild(r)}}else{if(typeof o==="object"){for(var x in o){r=document.createElement("option");r.value=x;r.innerHTML=o[x];s.appendChild(r)}}}if(e.defaultValue){a(s).val(e.defaultValue)}if(e.attr){a(s).attr(e.attr)}if(e.dataInit!=null){e.dataInit(s)}if(e.dataEvents!=null){f(s,e.dataEvents)}a(j).append(s);if(b.autosearch===true){a(s).change(function(n){c();return false})}}}break;case"text":var v=e.defaultValue?e.defaultValue:"";a(j).append("<input type='text' style='width:95%;padding:0px;' name='"+(w.index||w.name)+"' id='gs_"+w.name+"' value='"+v+"'/>");if(e.attr){a("input",j).attr(e.attr)}if(e.dataInit!=null){e.dataInit(a("input",j)[0])}if(e.dataEvents!=null){f(a("input",j)[0],e.dataEvents)}if(b.autosearch===true){a("input",j).keypress(function(A){var n=A.charCode?A.charCode:A.keyCode?A.keyCode:0;if(n==13){c();return false}return this})}break}}a(d).append(j);a(h).append(d)});a("table thead",g.grid.hDiv).append(h);this.triggerToolbar=c;this.clearToolbar=k;this.toggleToolbar=l})}})})(jQuery);(function(b){var a=null;b.jgrid.extend({searchGrid:function(c){c=b.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:false,closeOnEscape:false,multipleSearch:false,sopt:null,onClose:null},b.jgrid.search,c||{});return this.each(function(){var m=this;if(!m.grid){return}if(b.fn.searchFilter){var g="fbox_"+m.p.id;if(c.recreateFilter===true){b("#"+g).remove()}if(b("#"+g).html()!=null){if(b.isFunction(c.beforeShowSearch)){c.beforeShowSearch(b("#"+g))}f();if(b.isFunction(c.afterShowSearch)){c.afterShowSearch(b("#"+g))}}else{var o=[],w=b("#"+m.p.id).jqGrid("getGridParam","colNames"),t=b("#"+m.p.id).jqGrid("getGridParam","colModel"),v=["eq","ne","lt","le","gt","ge","bw","bn","in","ni","ew","en","cn","nc"],l,s,h,q;q=jQuery.fn.searchFilter.defaults.operators;if(c.sopt!=null){q=[];h=0;for(l=0;l<c.sopt.length;l++){if((s=b.inArray(c.sopt[l],v))!=-1){q[h]={op:c.sopt[l],text:c.odata[s]};h++}}}var r;b.each(t,function(x,j){r=(typeof j.search==="undefined")?true:j.search,hidden=(j.hidden===true),soptions=b.extend({},this.searchoptions,{text:w[x],value:j.index||j.name}),ignoreHiding=(soptions.searchhidden===true);if(typeof soptions.sopt=="undefined"){soptions.sopt=c.sopt||v}h=0;soptions.ops=[];if(soptions.sopt.length>0){for(l=0;l<soptions.sopt.length;l++){if((s=b.inArray(soptions.sopt[l],v))!=-1){soptions.ops[h]={op:soptions.sopt[l],text:c.odata[s]};h++}}}if(typeof(this.stype)==="undefined"){this.stype="text"}if(this.stype=="select"){if(soptions.dataUrl!=null){}else{var y;if(soptions.value){y=soptions.value}else{if(this.editoptions){y=this.editoptions.value}}if(y){soptions.dataValues=[];if(typeof(y)==="string"){var z=y.split(";"),e;for(l=0;l<z.length;l++){e=z[l].split(":");soptions.dataValues[l]={value:e[0],text:e[1]}}}else{if(typeof(y)==="object"){l=0;for(var k in y){soptions.dataValues[l]={value:k,text:y[k]};l++}}}}}}if((ignoreHiding&&r)||(r&&!hidden)){o.push(soptions)}});if(o.length>0){b("<div id='"+g+"' role='dialog' tabindex='-1'></div>").insertBefore("#gview_"+m.p.id);b("#"+g).searchFilter(o,{groupOps:c.groupOps,operators:q,onClose:d,resetText:c.Reset,searchText:c.Find,windowTitle:c.caption,rulesText:c.rulesText,matchText:c.matchText,onSearch:u,onReset:n,stringResult:c.multipleSearch,ajaxSelectOptions:b.extend({},b.jgrid.ajaxOptions,m.p.ajaxSelectOptions||{})});b(".ui-widget-overlay","#"+g).remove();if(m.p.direction=="rtl"){b(".ui-closer","#"+g).css("float","left")}if(c.drag===true){b("#"+g+" table thead tr:first td:first").css("cursor","move");if(jQuery.fn.jqDrag){b("#"+g).jqDrag(b("#"+g+" table thead tr:first td:first"))}else{try{b("#"+g).draggable({handle:b("#"+g+" table thead tr:first td:first")})}catch(p){}}}if(c.multipleSearch===false){b(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText","#"+g).hide();b("select[name='groupOp']","#"+g).hide()}if(b.isFunction(c.onInitializeSearch)){c.onInitializeSearch(b("#"+g))}if(b.isFunction(c.beforeShowSearch)){c.beforeShowSearch(b("#"+g))}f();if(b.isFunction(c.afterShowSearch)){c.afterShowSearch(b("#"+g))}if(c.closeOnEscape===true){b("#"+g).keydown(function(j){if(j.which==27){d(b("#"+g))}})}}}}function u(x){var e=(x!==undefined),k=b("#"+m.p.id),j={};if(c.multipleSearch===false){j[c.sField]=x.rules[0].field;j[c.sValue]=x.rules[0].data;j[c.sOper]=x.rules[0].op}else{j[c.sFilter]=x}k[0].p.search=e;b.extend(k[0].p.postData,j);k.trigger("reloadGrid",[{page:1}]);if(c.closeAfterSearch){d(b("#"+g))}}function n(x){var e=(x!==undefined),k=b("#"+m.p.id),j=[];k[0].p.search=e;if(c.multipleSearch===false){j[c.sField]=j[c.sValue]=j[c.sOper]=""}else{j[c.sFilter]=""}b.extend(k[0].p.postData,j);k.trigger("reloadGrid",[{page:1}])}function d(e){if(c.onClose){var j=c.onClose(e);if(typeof j=="boolean"&&!j){return}}e.hide();b(".jqgrid-overlay:first","#gbox_"+m.p.id).hide()}function f(){var k=b(".ui-searchFilter").length;if(k>1){var j=b("#"+g).css("zIndex");b("#"+g).css({zIndex:parseInt(j)+k})}b("#"+g).show();b(".jqgrid-overlay:first","#gbox_"+m.p.id).show();try{b(":input:visible","#"+g)[0].focus()}catch(e){}}})},editGridRow:function(c,d){d=b.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:{},onClose:null,ajaxEditOptions:{},serializeEditData:null},b.jgrid.edit,d||{});a=d;return this.each(function(){var e=this;if(!e.grid||!c){return}var D=e.p.id,z="FrmGrid_"+D,v="TblGrid_"+D,j={themodal:"editmod"+D,modalhead:"edithd"+D,modalcontent:"editcnt"+D,scrollelm:z},E=b.isFunction(a.beforeShowForm)?a.beforeShowForm:false,P=b.isFunction(a.afterShowForm)?a.afterShowForm:false,O=b.isFunction(a.beforeInitData)?a.beforeInitData:false,p=b.isFunction(a.onInitializeForm)?a.onInitializeForm:false,J=null,K=1,r=0,w,F,G,S,I,C;if(c=="new"){c="_empty";d.caption=d.addCaption}else{d.caption=d.editCaption}if(d.recreateForm===true&&b("#"+j.themodal).html()!=null){b("#"+j.themodal).remove()}var l=true;if(d.checkOnUpdate&&d.jqModal&&!d.modal){l=false}if(b("#"+j.themodal).html()!=null){b(".ui-jqdialog-title","#"+j.modalhead).html(d.caption);b("#FormError","#"+v).hide();if(a.topinfo){b(".topinfo","#"+v+"_2").html(a.topinfo);b(".tinfo","#"+v+"_2").show()}else{b(".tinfo","#"+v+"_2").hide()}if(a.bottominfo){b(".bottominfo","#"+v+"_2").html(a.bottominfo);b(".binfo","#"+v+"_2").show()}else{b(".binfo","#"+v+"_2").hide()}if(O){O(b("#"+z))}o(c,e,z);if(c=="_empty"){b("#pData, #nData","#"+v+"_2").hide()}else{b("#pData, #nData","#"+v+"_2").show()}if(d.processing===true){d.processing=false;b("#sData","#"+v+"_2").removeClass("ui-state-active")}if(b("#"+z).data("disabled")===true){b(".confirm","#"+j.themodal).hide();b("#"+z).data("disabled",false)}if(E){E(b("#"+z))}b("#"+j.themodal).data("onClose",a.onClose);viewModal("#"+j.themodal,{gbox:"#gbox_"+D,jqm:d.jqModal,jqM:false,closeoverlay:l,modal:d.modal});if(!l){b(".jqmOverlay").click(function(){if(!g()){return false}hideModal("#"+j.themodal,{gb:"#gbox_"+D,jqm:d.jqModal,onClose:a.onClose});return false})}if(P){P(b("#"+z))}}else{b(e.p.colModel).each(function(Z){var aa=this.formoptions;K=Math.max(K,aa?aa.colpos||0:0);r=Math.max(r,aa?aa.rowpos||0:0)});var s=isNaN(d.dataheight)?d.dataheight:d.dataheight+"px";var N,V=b("<form name='FormPost' id='"+z+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+s+";'></form>").data("disabled",false),B=b("<table id='"+v+"' class='EditTable' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");b(V).append(B);N=b("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+(K*2)+"'></td></tr>");N[0].rp=0;b(B).append(N);N=b("<tr style='display:none' clas=='tinfo'><td class='topinfo' colspan='"+(K*2)+"'>"+a.topinfo+"</td></tr>");N[0].rp=0;b(B).append(N);if(O){O(b("#"+z))}var f=e.p.direction=="rtl"?true:false,U=f?"nData":"pData",W=f?"pData":"nData",A=t(c,e,B,K),m="<a href='javascript:void(0)' id='"+U+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",n="<a href='javascript:void(0)' id='"+W+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",h="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+d.bSubmit+"</a>",u="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+d.bCancel+"</a>";var R="<table border='0' class='EditTable' id='"+v+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content'>"+(f?n+m:m+n)+"</td><td class='EditButton ui-widget-content'>"+h+u+"</td></tr>";R+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+a.bottominfo+"</td></tr>";R+="</tbody></table>";if(r>0){var y=[];b.each(b(B)[0].rows,function(Z,aa){y[Z]=aa});y.sort(function(aa,Z){if(aa.rp>Z.rp){return 1}if(aa.rp<Z.rp){return -1}return 0});b.each(y,function(Z,aa){b("tbody",B).append(aa)})}d.gbox="#gbox_"+D;var q=false;if(d.closeOnEscape===true){d.closeOnEscape=false;q=true}var Q=b("<span></span>").append(V).append(R);createModal(j,Q,d,"#gview_"+e.p.id,b("#gview_"+e.p.id)[0]);if(f){b("#pData, #nData","#"+v+"_2").css("float","right");b(".EditButton","#"+v+"_2").css("text-align","left")}if(a.topinfo){b(".tinfo","#"+v+"_2").show()}if(a.bottominfo){b(".binfo","#"+v+"_2").show()}Q=null;R=null;b("#"+j.themodal).keydown(function(Z){var aa=Z.target;if(b("#"+z).data("disabled")===true){return false}if(a.savekey[0]===true&&Z.which==a.savekey[1]){if(aa.tagName!="TEXTAREA"){b("#sData","#"+v+"_2").trigger("click");return false}}if(Z.which===27){if(!g()){return false}if(q){hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:a.onClose})}return false}if(a.navkeys[0]===true){if(b("#id_g","#"+v).val()=="_empty"){return true}if(Z.which==a.navkeys[1]){b("#pData","#"+v+"_2").trigger("click");return false}if(Z.which==a.navkeys[2]){b("#nData","#"+v+"_2").trigger("click");return false}}});if(d.checkOnUpdate){b("a.ui-jqdialog-titlebar-close span","#"+j.themodal).removeClass("jqmClose");b("a.ui-jqdialog-titlebar-close","#"+j.themodal).unbind("click").click(function(){if(!g()){return false}hideModal("#"+j.themodal,{gb:"#gbox_"+D,jqm:d.jqModal,onClose:a.onClose});return false})}d.saveicon=b.extend([true,"left","ui-icon-disk"],d.saveicon);d.closeicon=b.extend([true,"left","ui-icon-close"],d.closeicon);if(d.saveicon[0]==true){b("#sData","#"+v+"_2").addClass(d.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.saveicon[2]+"'></span>")}if(d.closeicon[0]==true){b("#cData","#"+v+"_2").addClass(d.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.closeicon[2]+"'></span>")}if(a.checkOnSubmit||a.checkOnUpdate){h="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bYes+"</a>";n="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bNo+"</a>";u="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+d.bExit+"</a>";var H,x=d.zIndex||999;x++;if(b.browser.msie&&b.browser.version==6){H='<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>'}else{H=""}b("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+x+";display:none;'>&nbsp;"+H+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(x+1)+"'>"+d.saveData+"<br/><br/>"+h+n+u+"</div>").insertAfter("#"+z);b("#sNew","#"+j.themodal).click(function(){k();b("#"+z).data("disabled",false);b(".confirm","#"+j.themodal).hide();return false});b("#nNew","#"+j.themodal).click(function(){b(".confirm","#"+j.themodal).hide();b("#"+z).data("disabled",false);setTimeout(function(){b(":input","#"+z)[0].focus()},0);return false});b("#cNew","#"+j.themodal).click(function(){b(".confirm","#"+j.themodal).hide();b("#"+z).data("disabled",false);hideModal("#"+j.themodal,{gb:"#gbox_"+D,jqm:d.jqModal,onClose:a.onClose});return false})}if(p){p(b("#"+z))}if(c=="_empty"){b("#pData,#nData","#"+v+"_2").hide()}else{b("#pData,#nData","#"+v+"_2").show()}if(E){E(b("#"+z))}b("#"+j.themodal).data("onClose",a.onClose);viewModal("#"+j.themodal,{gbox:"#gbox_"+D,jqm:d.jqModal,closeoverlay:l,modal:d.modal});if(!l){b(".jqmOverlay").click(function(){if(!g()){return false}hideModal("#"+j.themodal,{gb:"#gbox_"+D,jqm:d.jqModal,onClose:a.onClose});return false})}if(P){P(b("#"+z))}b(".fm-button","#"+j.themodal).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});b("#sData","#"+v+"_2").click(function(Z){F={};S={};b("#FormError","#"+v).hide();X();if(F.id=="_empty"){k()}else{if(d.checkOnSubmit===true){I=b.extend({},F,S);C=L(I,a._savedData);if(C){b("#"+z).data("disabled",true);b(".confirm","#"+j.themodal).show()}else{k()}}else{k()}}return false});b("#cData","#"+v+"_2").click(function(Z){if(!g()){return false}hideModal("#"+j.themodal,{gb:"#gbox_"+D,jqm:d.jqModal,onClose:a.onClose});return false});b("#nData","#"+v+"_2").click(function(Z){if(!g()){return false}b("#FormError","#"+v).hide();var aa=Y();aa[0]=parseInt(aa[0]);if(aa[0]!=-1&&aa[1][aa[0]+1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("next",b("#"+z),aa[1][aa[0]])}o(aa[1][aa[0]+1],e,z);b(e).jqGrid("setSelection",aa[1][aa[0]+1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("next",b("#"+z),aa[1][aa[0]+1])}M(aa[0]+1,aa[1].length-1)}return false});b("#pData","#"+v+"_2").click(function(aa){if(!g()){return false}b("#FormError","#"+v).hide();var Z=Y();if(Z[0]!=-1&&Z[1][Z[0]-1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("prev",b("#"+z),Z[1][Z[0]])}o(Z[1][Z[0]-1],e,z);b(e).jqGrid("setSelection",Z[1][Z[0]-1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("prev",b("#"+z),Z[1][Z[0]-1])}M(Z[0]-1,Z[1].length-1)}return false})}var T=Y();M(T[0],T[1].length-1);function M(aa,ab,Z){if(aa==0){b("#pData","#"+v+"_2").addClass("ui-state-disabled")}else{b("#pData","#"+v+"_2").removeClass("ui-state-disabled")}if(aa==ab){b("#nData","#"+v+"_2").addClass("ui-state-disabled")}else{b("#nData","#"+v+"_2").removeClass("ui-state-disabled")}}function Y(){var aa=b(e).jqGrid("getDataIDs"),Z=b("#id_g","#"+v).val(),ab=b.inArray(Z,aa);return[ab,aa]}function g(){var Z=true;b("#FormError","#"+v).hide();if(a.checkOnUpdate){F={};S={};X();I=b.extend({},F,S);C=L(I,a._savedData);if(C){b("#"+z).data("disabled",true);b(".confirm","#"+j.themodal).show();Z=false}}return Z}function X(){b(".FormElement","#"+v).each(function(ab){if(b(this).hasClass("customelement")){var Z=this.name,ac=this;b.each(e.p.colModel,function(ae,ag){if(this.name==Z&&this.editoptions&&b.isFunction(this.editoptions.custom_value)){try{F[Z]=cm.editoptions.custom_value(b("#"+Z,"#"+v),"get");if(F[Z]===undefined){throw"e1"}}catch(af){if(af=="e1"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose)}else{info_dialog(jQuery.jgrid.errors.errcap,af.message,jQuery.jgrid.edit.bClose)}}return true}})}else{switch(b(this).get(0).type){case"checkbox":if(b(this).attr("checked")){F[this.name]=b(this).val()}else{var aa=b(this).attr("offval");F[this.name]=aa}break;case"select-one":F[this.name]=b("option:selected",this).val();S[this.name]=b("option:selected",this).text();break;case"select-multiple":F[this.name]=b(this).val();if(F[this.name]){F[this.name]=F[this.name].join(",")}else{F[this.name]=""}var ad=[];b("option:selected",this).each(function(ae,af){ad[ae]=b(af).text()});S[this.name]=ad.join(",");break;case"password":case"text":case"textarea":case"button":F[this.name]=b(this).val();F[this.name]=!e.p.autoencode?F[this.name]:b.jgrid.htmlEncode(F[this.name]);break}}});return true}function t(ac,ai,af,an){var Z,aa,ak,al=0,ap,aq,aj,ao=[],ag=false,ah,ab,ad="<td class='CaptionTD ui-widget-content'>&nbsp;</td><td class='DataTD ui-widget-content' style='white-space:pre'>&nbsp;</td>",ae="";for(var am=1;am<=an;am++){ae+=ad}if(ac!="_empty"){ag=b(ai).jqGrid("getInd",ac)}b(ai.p.colModel).each(function(av){Z=this.name;if(this.editrules&&this.editrules.edithidden==true){aa=false}else{aa=this.hidden===true?true:false}aq=aa?"style='display:none'":"";if(Z!=="cb"&&Z!=="subgrid"&&this.editable===true&&Z!=="rn"){if(ag===false){ap=""}else{if(Z==ai.p.ExpandColumn&&ai.p.treeGrid===true){ap=b("td:eq("+av+")",ai.rows[ag]).text()}else{try{ap=b.unformat(b("td:eq("+av+")",ai.rows[ag]),{colModel:this},av)}catch(at){ap=b("td:eq("+av+")",ai.rows[ag]).html()}}}var au=b.extend({},this.editoptions||{},{id:Z,name:Z});frmopt=b.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),ah=parseInt(frmopt.rowpos)||al+1,ab=parseInt((parseInt(frmopt.colpos)||1)*2);if(ac=="_empty"&&au.defaultValue){ap=b.isFunction(au.defaultValue)?au.defaultValue():au.defaultValue}if(!this.edittype){this.edittype="text"}aj=createEl(this.edittype,au,ap,false,b.extend({},b.jgrid.ajaxOptions,ai.p.ajaxSelectOptions||{}));if(ap==""&&this.edittype=="checkbox"){ap=b(aj).attr("offval")}if(a.checkOnSubmit||a.checkOnUpdate){a._savedData[Z]=ap}b(aj).addClass("FormElement");ak=b(af).find("tr[rowpos="+ah+"]");if(frmopt.rowabove){var aw=b("<tr><td class='contentinfo' colspan='"+(an*2)+"'>"+frmopt.rowcontent+"</td></tr>");b(af).append(aw);aw[0].rp=ah}if(ak.length==0){ak=b("<tr "+aq+" rowpos='"+ah+"'></tr>").addClass("FormData").attr("id","tr_"+Z);b(ak).append(ae);b(af).append(ak);ak[0].rp=ah}b("td:eq("+(ab-2)+")",ak[0]).html(typeof frmopt.label==="undefined"?ai.p.colNames[av]:frmopt.label);b("td:eq("+(ab-1)+")",ak[0]).append(frmopt.elmprefix).append(aj).append(frmopt.elmsuffix);ao[al]=av;al++}});if(al>0){var ar=b("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(an*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+ac+"'/></td></tr>");ar[0].rp=al+999;b(af).append(ar);if(a.checkOnSubmit||a.checkOnUpdate){a._savedData.id=ac}}return ao}function o(aa,ag,ac){var al,ai,ad=0,ah,af,Z,ae,aj;if(a.checkOnSubmit||a.checkOnUpdate){a._savedData={};a._savedData.id=aa}var ak=ag.p.colModel;if(aa=="_empty"){b(ak).each(function(am){al=this.name;Z=b.extend({},this.editoptions||{});af=b("#"+b.jgrid.jqID(al),"#"+ac);if(af[0]!=null){ae="";if(Z.defaultValue){ae=b.isFunction(Z.defaultValue)?Z.defaultValue():Z.defaultValue;if(af[0].type=="checkbox"){aj=ae.toLowerCase();if(aj.search(/(false|0|no|off|undefined)/i)<0&&aj!==""){af[0].checked=true;af[0].defaultChecked=true;af[0].value=ae}else{af.attr({checked:"",defaultChecked:""})}}else{af.val(ae)}}else{if(af[0].type=="checkbox"){af[0].checked=false;af[0].defaultChecked=false;ae=b(af).attr("offval")}else{if(af[0].type.substr(0,6)=="select"){af[0].selectedIndex=0}else{af.val(ae)}}}if(a.checkOnSubmit===true||a.checkOnUpdate){a._savedData[al]=ae}}});b("#id_g","#"+ac).val("_empty");return}var ab=b(ag).jqGrid("getInd",aa,true);if(!ab){return}b("td",ab).each(function(ao){al=ak[ao].name;if(al!=="cb"&&al!=="subgrid"&&al!=="rn"&&ak[ao].editable===true){if(al==ag.p.ExpandColumn&&ag.p.treeGrid===true){ah=b(this).text()}else{try{ah=b.unformat(this,{colModel:ak[ao]},ao)}catch(an){ah=b(this).html()}}if(a.checkOnSubmit===true||a.checkOnUpdate){a._savedData[al]=ah}al=b.jgrid.jqID(al);switch(ak[ao].edittype){case"password":case"text":case"button":case"image":ah=b.jgrid.htmlDecode(ah);b("#"+al,"#"+ac).val(ah);break;case"textarea":if(ah=="&nbsp;"||ah=="&#160;"||(ah.length==1&&ah.charCodeAt(0)==160)){ah=""}b("#"+al,"#"+ac).val(ah);break;case"select":var am=ah.split(",");am=b.map(am,function(ar){return b.trim(ar)});b("#"+al+" option","#"+ac).each(function(ar){if(!ak[ao].editoptions.multiple&&(am[0]==b(this).text()||am[0]==b(this).val())){this.selected=true}else{if(ak[ao].editoptions.multiple){if(b.inArray(b(this).text(),am)>-1||b.inArray(b(this).val(),am)>-1){this.selected=true}else{this.selected=false}}else{this.selected=false}}});break;case"checkbox":ah=ah+"";ah=ah.toLowerCase();if(ah.search(/(false|0|no|off|undefined)/i)<0&&ah!==""){b("#"+al,"#"+ac).attr("checked",true);b("#"+al,"#"+ac).attr("defaultChecked",true)}else{b("#"+al,"#"+ac).attr("checked",false);b("#"+al,"#"+ac).attr("defaultChecked","")}break;case"custom":try{if(ak[ao].editoptions&&b.isFunction(ak[ao].editoptions.custom_value)){var aq=ak[ao].editoptions.custom_value(b("#"+al,"#"+ac),"set",ah)}else{throw"e1"}}catch(ap){if(ap=="e1"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose)}else{info_dialog(jQuery.jgrid.errors.errcap,ap.message,jQuery.jgrid.edit.bClose)}}break}ad++}});if(ad>0){b("#id_g","#"+v).val(aa)}}function k(){var ad,ab=[true,"",""],aa={};if(b.isFunction(a.beforeCheckValues)){var Z=a.beforeCheckValues(F,b("#"+z),F.id=="_empty"?"add":"edit");if(Z&&typeof(Z)==="object"){F=Z}}for(var ac in F){ab=checkValues(F[ac],ac,e);if(ab[0]==false){break}}if(ab[0]){if(b.isFunction(a.onclickSubmit)){aa=a.onclickSubmit(a,F)||{}}if(b.isFunction(a.beforeSubmit)){ab=a.beforeSubmit(F,b("#"+z))}}w=a.url?a.url:b(e).jqGrid("getGridParam","editurl");if(ab[0]){if(!w){ab[0]=false;ab[1]+=" "+b.jgrid.errors.nourl}}if(ab[0]===false){b("#FormError>td","#"+v).html(ab[1]);b("#FormError","#"+v).show();return}if(!d.processing){d.processing=true;b("#sData","#"+v+"_2").addClass("ui-state-active");F.oper=F.id=="_empty"?"add":"edit";F=b.extend(F,a.editData,aa);b.ajax(b.extend({url:w,type:a.mtype,data:b.isFunction(a.serializeEditData)?a.serializeEditData(F):F,complete:function(af,ae){if(ae!="success"){ab[0]=false;if(b.isFunction(a.errorTextFormat)){ab[1]=a.errorTextFormat(af)}else{ab[1]=ae+" Status: '"+af.statusText+"'. Error code: "+af.status}}else{if(b.isFunction(a.afterSubmit)){ab=a.afterSubmit(af,F)}}if(ab[0]===false){b("#FormError>td","#"+v).html(ab[1]);b("#FormError","#"+v).show()}else{b.each(e.p.colModel,function(ah,aj){if(S[this.name]&&this.formatter&&this.formatter=="select"){try{delete S[this.name]}catch(ai){}}});F=b.extend(F,S);if(F.id=="_empty"){if(!ab[2]){ab[2]=parseInt(e.p.records)+1}F.id=ab[2];if(a.closeAfterAdd){if(a.reloadAfterSubmit){b(e).trigger("reloadGrid")}else{b(e).jqGrid("addRowData",ab[2],F,d.addedrow);b(e).jqGrid("setSelection",ab[2])}hideModal("#"+j.themodal,{gb:"#gbox_"+D,jqm:d.jqModal,onClose:a.onClose})}else{if(a.clearAfterAdd){if(a.reloadAfterSubmit){b(e).trigger("reloadGrid")}else{b(e).jqGrid("addRowData",ab[2],F,d.addedrow)}o("_empty",e,z)}else{if(a.reloadAfterSubmit){b(e).trigger("reloadGrid")}else{b(e).jqGrid("addRowData",ab[2],F,d.addedrow)}}}}else{if(a.reloadAfterSubmit){b(e).trigger("reloadGrid");if(!a.closeAfterEdit){setTimeout(function(){b(e).jqGrid("setSelection",F.id)},1000)}}else{if(e.p.treeGrid===true){b(e).jqGrid("setTreeRow",F.id,F)}else{b(e).jqGrid("setRowData",F.id,F)}}if(a.closeAfterEdit){hideModal("#"+j.themodal,{gb:"#gbox_"+D,jqm:d.jqModal,onClose:a.onClose})}}if(b.isFunction(a.afterComplete)){ad=af;setTimeout(function(){a.afterComplete(ad,F,b("#"+z));ad=null},500)}}d.processing=false;if(a.checkOnSubmit||a.checkOnUpdate){b("#"+z).data("disabled",false);if(a._savedData.id!="_empty"){a._savedData=F}}b("#sData","#"+v+"_2").removeClass("ui-state-active");try{b(":input:visible","#"+z)[0].focus()}catch(ag){}},error:function(ag,ae,af){b("#FormError>td","#"+v).html(ae+" : "+af);b("#FormError","#"+v).show();d.processing=false;b("#"+z).data("disabled",false);b("#sData","#"+v+"_2").removeClass("ui-state-active")}},b.jgrid.ajaxOptions,a.ajaxEditOptions))}}function L(ac,Z){var aa=false,ab;for(ab in ac){if(ac[ab]!=Z[ab]){aa=true;break}}return aa}})},viewGridRow:function(c,d){d=b.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},b.jgrid.view,d||{});return this.each(function(){var y=this;if(!y.grid||!c){return}if(!d.imgpath){d.imgpath=y.p.imgpath}var s=y.p.id,B="ViewGrid_"+s,t="ViewTbl_"+s,k={themodal:"viewmod"+s,modalhead:"viewhd"+s,modalcontent:"viewcnt"+s,scrollelm:B},h=1,f=0;if(b("#"+k.themodal).html()!=null){b(".ui-jqdialog-title","#"+k.modalhead).html(d.caption);b("#FormError","#"+t).hide();n(c,y);viewModal("#"+k.themodal,{gbox:"#gbox_"+s,jqm:d.jqModal,jqM:false,modal:d.modal});l()}else{b(y.p.colModel).each(function(G){var H=this.formoptions;h=Math.max(h,H?H.colpos||0:0);f=Math.max(f,H?H.rowpos||0:0)});var z=isNaN(d.dataheight)?d.dataheight:d.dataheight+"px";var x,D=b("<form name='FormPost' id='"+B+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+z+";'></form>"),m=b("<table id='"+t+"' class='EditTable' cellspacing='1' cellpading='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");b(D).append(m);var w=o(c,y,m,h),A=y.p.direction=="rtl"?true:false,F=A?"nData":"pData",g=A?"pData":"nData",u="<a href='javascript:void(0)' id='"+F+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",v="<a href='javascript:void(0)' id='"+g+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",E="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+d.bClose+"</a>";if(f>0){var e=[];b.each(b(m)[0].rows,function(G,H){e[G]=H});e.sort(function(H,G){if(H.rp>G.rp){return 1}if(H.rp<G.rp){return -1}return 0});b.each(e,function(G,H){b("tbody",m).append(H)})}d.gbox="#gbox_"+s;var r=false;if(d.closeOnEscape===true){d.closeOnEscape=false;r=true}var C=b("<span></span>").append(D).append("<table border='0' class='EditTable' id='"+t+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content' width='"+d.labelswidth+"'>"+(A?v+u:u+v)+"</td><td class='EditButton ui-widget-content'>"+E+"</td></tr></tbody></table>");createModal(k,C,d,"#gview_"+y.p.id,b("#gview_"+y.p.id)[0]);if(A){b("#pData, #nData","#"+t+"_2").css("float","right");b(".EditButton","#"+t+"_2").css("text-align","left")}C=null;b("#"+k.themodal).keydown(function(G){if(G.which===27){if(r){hideModal(this,{gb:d.gbox,jqm:d.jqModal,onClose:d.onClose})}return false}if(d.navkeys[0]===true){if(G.which===d.navkeys[1]){b("#pData","#"+t+"_2").trigger("click");return false}if(G.which===d.navkeys[2]){b("#nData","#"+t+"_2").trigger("click");return false}}});d.closeicon=b.extend([true,"left","ui-icon-close"],d.closeicon);if(d.closeicon[0]==true){b("#cData","#"+t+"_2").addClass(d.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.closeicon[2]+"'></span>")}viewModal("#"+k.themodal,{gbox:"#gbox_"+s,jqm:d.jqModal,modal:d.modal});b(".fm-button:not(.ui-state-disabled)","#"+t+"_2").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});l();b("#cData","#"+t+"_2").click(function(G){hideModal("#"+k.themodal,{gb:"#gbox_"+s,jqm:d.jqModal,onClose:d.onClose});return false});b("#nData","#"+t+"_2").click(function(G){b("#FormError","#"+t).hide();var H=j();H[0]=parseInt(H[0]);if(H[0]!=-1&&H[1][H[0]+1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("next",b("#"+B),H[1][H[0]])}n(H[1][H[0]+1],y);b(y).jqGrid("setSelection",H[1][H[0]+1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("next",b("#"+B),H[1][H[0]+1])}p(H[0]+1,H[1].length-1)}l();return false});b("#pData","#"+t+"_2").click(function(H){b("#FormError","#"+t).hide();var G=j();if(G[0]!=-1&&G[1][G[0]-1]){if(b.isFunction(d.onclickPgButtons)){d.onclickPgButtons("prev",b("#"+B),G[1][G[0]])}n(G[1][G[0]-1],y);b(y).jqGrid("setSelection",G[1][G[0]-1]);if(b.isFunction(d.afterclickPgButtons)){d.afterclickPgButtons("prev",b("#"+B),G[1][G[0]-1])}p(G[0]-1,G[1].length-1)}l();return false})}function l(){if(d.closeOnEscape===true||d.navkeys[0]===true){setTimeout(function(){b(".ui-jqdialog-titlebar-close","#"+k.modalhead).focus()},0)}}var q=j();p(q[0],q[1].length-1);function p(H,I,G){if(H==0){b("#pData","#"+t+"_2").addClass("ui-state-disabled")}else{b("#pData","#"+t+"_2").removeClass("ui-state-disabled")}if(H==I){b("#nData","#"+t+"_2").addClass("ui-state-disabled")}else{b("#nData","#"+t+"_2").removeClass("ui-state-disabled")}}function j(){var H=b(y).jqGrid("getDataIDs"),G=b("#id_g","#"+t).val(),I=b.inArray(G,H);return[I,H]}function o(M,S,Q,Y){var I,L,T,ab,G,W=0,aa,ac,Z=[],R=false,O="<td class='CaptionTD ui-widget-content' width='"+d.labelswidth+"'>&nbsp;</td><td class='DataTD ui-helper-reset ui-widget-content' style='white-space:pre;'>&nbsp;</td>",P="",J="<td class='CaptionTD ui-widget-content'>&nbsp;</td><td class='DataTD ui-widget-content' style='white-space:pre;'>&nbsp;</td>",N=["integer","number","currency"],V=0,U=0,K,H;for(var X=1;X<=Y;X++){P+=X==1?O:J}b(S.p.colModel).each(function(ae){if(this.editrules&&this.editrules.edithidden===true){L=false}else{L=this.hidden===true?true:false}if(!L&&this.align==="right"){if(this.formatter&&b.inArray(this.formatter,N)!==-1){V=Math.max(V,parseInt(this.width,10))}else{U=Math.max(U,parseInt(this.width,10))}}});K=V!==0?V:U!==0?U:0;R=b(S).jqGrid("getInd",M);b(S.p.colModel).each(function(af){I=this.name;H=false;if(this.editrules&&this.editrules.edithidden===true){L=false}else{L=this.hidden===true?true:false}ac=L?"style='display:none'":"";if(I!=="cb"&&I!=="subgrid"&&I!=="rn"){if(R===false){aa=""}else{if(I==S.p.ExpandColumn&&S.p.treeGrid===true){aa=b("td:eq("+af+")",S.rows[R]).text()}else{aa=b("td:eq("+af+")",S.rows[R]).html()}}H=this.align==="right"&&K!==0?true:false;var ae=b.extend({},this.editoptions||{},{id:I,name:I}),aj=b.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),ag=parseInt(aj.rowpos)||W+1,ai=parseInt((parseInt(aj.colpos)||1)*2);if(aj.rowabove){var ah=b("<tr><td class='contentinfo' colspan='"+(Y*2)+"'>"+aj.rowcontent+"</td></tr>");b(Q).append(ah);ah[0].rp=ag}T=b(Q).find("tr[rowpos="+ag+"]");if(T.length==0){T=b("<tr "+ac+" rowpos='"+ag+"'></tr>").addClass("FormData").attr("id","trv_"+I);b(T).append(P);b(Q).append(T);T[0].rp=ag}b("td:eq("+(ai-2)+")",T[0]).html("<b>"+(typeof aj.label==="undefined"?S.p.colNames[af]:aj.label)+"</b>");b("td:eq("+(ai-1)+")",T[0]).append("<span>"+aa+"</span>").attr("id","v_"+I);if(H){b("td:eq("+(ai-1)+") span",T[0]).css({"text-align":"right",width:K+"px"})}Z[W]=af;W++}});if(W>0){var ad=b("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(Y*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+M+"'/></td></tr>");ad[0].rp=W+99;b(Q).append(ad)}return Z}function n(K,M){var G,N,J=0,I,H,L;L=b(M).jqGrid("getInd",K,true);if(!L){return}b("td",L).each(function(O){G=M.p.colModel[O].name;if(M.p.colModel[O].editrules&&M.p.colModel[O].editrules.edithidden===true){N=false}else{N=M.p.colModel[O].hidden===true?true:false}if(G!=="cb"&&G!=="subgrid"&&G!=="rn"){if(G==M.p.ExpandColumn&&M.p.treeGrid===true){I=b(this).text()}else{I=b(this).html()}H=b.extend({},M.p.colModel[O].editoptions||{});G=b.jgrid.jqID("v_"+G);b("#"+G+" span","#"+t).html(I);if(N){b("#"+G,"#"+t).parents("tr:first").hide()}J++}});if(J>0){b("#id_g","#"+t).val(K)}}})},delGridRow:function(c,d){d=b.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:{},serializeDelData:null},b.jgrid.del,d||{});a=d;return this.each(function(){var m=this;if(!m.grid){return}if(!c){return}var n=typeof d.beforeShowForm==="function"?true:false,g=typeof d.afterShowForm==="function"?true:false,e=m.p.id,f={},k="DelTbl_"+e,h={themodal:"delmod"+e,modalhead:"delhd"+e,modalcontent:"delcnt"+e,scrollelm:k};if(isArray(c)){c=c.join()}if(b("#"+h.themodal).html()!=null){b("#DelData>td","#"+k).text(c);b("#DelError","#"+k).hide();if(d.processing===true){d.processing=false;b("#dData","#"+k).removeClass("ui-state-active")}if(n){d.beforeShowForm(b("#"+k))}viewModal("#"+h.themodal,{gbox:"#gbox_"+e,jqm:d.jqModal,jqM:false,modal:d.modal});if(g){d.afterShowForm(b("#"+k))}}else{var o=isNaN(d.dataheight)?d.dataheight:d.dataheight+"px";var l="<div id='"+k+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+o+";'>";l+="<table class='DelTable'><tbody>";l+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";l+="<tr id='DelData' style='display:none'><td >"+c+"</td></tr>";l+='<tr><td class="delmsg" style="white-space:pre;">'+d.msg+"</td></tr><tr><td >&nbsp;</td></tr>";l+="</tbody></table></div>";var j="<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+d.bSubmit+"</a>",p="<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+d.bCancel+"</a>";l+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+k+"_2'><tbody><tr><td class='DataTD ui-widget-content'></td></tr><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DelButton EditButton'>"+j+"&nbsp;"+p+"</td></tr></tbody></table>";d.gbox="#gbox_"+e;createModal(h,l,d,"#gview_"+m.p.id,b("#gview_"+m.p.id)[0]);b(".fm-button","#"+k+"_2").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});d.delicon=b.extend([true,"left","ui-icon-scissors"],d.delicon);d.cancelicon=b.extend([true,"left","ui-icon-cancel"],d.cancelicon);if(d.delicon[0]==true){b("#dData","#"+k+"_2").addClass(d.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.delicon[2]+"'></span>")}if(d.cancelicon[0]==true){b("#eData","#"+k+"_2").addClass(d.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+d.cancelicon[2]+"'></span>")}b("#dData","#"+k+"_2").click(function(t){var r=[true,""];f={};var s=b("#DelData>td","#"+k).text();if(typeof d.onclickSubmit==="function"){f=d.onclickSubmit(a)||{}}if(typeof d.beforeSubmit==="function"){r=d.beforeSubmit(s)}if(r[0]){var q=a.url?a.url:b(m).jqGrid("getGridParam","editurl");if(!q){r[0]=false;r[1]+=" "+b.jgrid.errors.nourl}}if(r[0]===false){b("#DelError>td","#"+k).html(r[1]);b("#DelError","#"+k).show()}else{if(!d.processing){d.processing=true;b(this).addClass("ui-state-active");var u=b.extend({oper:"del",id:s},a.delData,f);b.ajax(b.extend({url:q,type:d.mtype,data:b.isFunction(d.serializeDelData)?d.serializeDelData(u):u,complete:function(y,w){if(w!="success"){r[0]=false;if(b.isFunction(a.errorTextFormat)){r[1]=a.errorTextFormat(y)}else{r[1]=w+" Status: '"+y.statusText+"'. Error code: "+y.status}}else{if(typeof a.afterSubmit==="function"){r=a.afterSubmit(y,s)}}if(r[0]===false){b("#DelError>td","#"+k).html(r[1]);b("#DelError","#"+k).show()}else{if(a.reloadAfterSubmit){if(m.p.treeGrid){b(m).jqGrid("setGridParam",{treeANode:0,datatype:m.p.treedatatype})}b(m).trigger("reloadGrid")}else{var v=[];v=s.split(",");if(m.p.treeGrid===true){try{b(m).jqGrid("delTreeNode",v[0])}catch(z){}}else{for(var x=0;x<v.length;x++){b(m).jqGrid("delRowData",v[x])}}m.p.selrow=null;m.p.selarrrow=[]}if(b.isFunction(a.afterComplete)){setTimeout(function(){a.afterComplete(y,s)},500)}}d.processing=false;b("#dData","#"+k+"_2").removeClass("ui-state-active");if(r[0]){hideModal("#"+h.themodal,{gb:"#gbox_"+e,jqm:d.jqModal,onClose:a.onClose})}},error:function(x,v,w){b("#DelError>td","#"+k).html(v+" : "+w);b("#DelError","#"+k).show();d.processing=false;b("#dData","#"+k+"_2").removeClass("ui-state-active")}},b.jgrid.ajaxOptions,d.ajaxDelOptions))}}return false});b("#eData","#"+k+"_2").click(function(q){hideModal("#"+h.themodal,{gb:"#gbox_"+e,jqm:d.jqModal,onClose:a.onClose});return false});if(n){d.beforeShowForm(b("#"+k))}viewModal("#"+h.themodal,{gbox:"#gbox_"+e,jqm:d.jqModal,modal:d.modal});if(g){d.afterShowForm(b("#"+k))}}if(d.closeOnEscape===true){setTimeout(function(){b(".ui-jqdialog-titlebar-close","#"+h.modalhead).focus()},0)}})},navGrid:function(f,h,e,g,d,c,j){h=b.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,afterRefresh:null},b.jgrid.nav,h||{});return this.each(function(){var k={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},o=this,n,t,p,l;if(!o.grid){return}if(b("#"+k.themodal).html()==null){if(typeof window.innerWidth!="undefined"){n=window.innerWidth,t=window.innerHeight}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){n=document.documentElement.clientWidth,t=document.documentElement.clientHeight}else{n=1024;t=768}}createModal(k,"<div>"+h.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+o.p.id,jqModal:true,drag:true,resize:true,caption:h.alertcap,top:t/2-25,left:n/2-100,width:200,height:"auto",closeOnEscape:h.closeOnEscape},"","",true)}var q,r=b("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),s="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",m=b(o.p.pager).attr("id")||"pager";if(o.p.direction=="rtl"){b(r).attr("dir","rtl").css("float","right")}if(h.add){g=g||{};q=b("<td class='ui-pg-button ui-corner-all'></td>");b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.addicon+"'></span>"+h.addtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.addtitle||"",id:g.id||"add_"+o.p.id}).click(function(){if(typeof h.addfunc=="function"){h.addfunc()}else{b(o).jqGrid("editGridRow","new",g)}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.edit){q=b("<td class='ui-pg-button ui-corner-all'></td>");e=e||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.editicon+"'></span>"+h.edittext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.edittitle||"",id:e.id||"edit_"+o.p.id}).click(function(){var u=o.p.selrow;if(u){if(typeof h.editfunc=="function"){h.editfunc(u)}else{b(o).jqGrid("editGridRow",u,e)}}else{viewModal("#"+k.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});b("#jqg_alrt").focus()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.view){q=b("<td class='ui-pg-button ui-corner-all'></td>");j=j||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.viewicon+"'></span>"+h.viewtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.viewtitle||"",id:j.id||"view_"+o.p.id}).click(function(){var u=o.p.selrow;if(u){b(o).jqGrid("viewGridRow",u,j)}else{viewModal("#"+k.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});b("#jqg_alrt").focus()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.del){q=b("<td class='ui-pg-button ui-corner-all'></td>");d=d||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.delicon+"'></span>"+h.deltext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.deltitle||"",id:d.id||"del_"+o.p.id}).click(function(){var u;if(o.p.multiselect){u=o.p.selarrrow;if(u.length==0){u=null}}else{u=o.p.selrow}if(u){b(o).jqGrid("delGridRow",u,d)}else{viewModal("#"+k.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});b("#jqg_alrt").focus()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.add||h.edit||h.del||h.view){b("tr",r).append(s)}if(h.search){q=b("<td class='ui-pg-button ui-corner-all'></td>");c=c||{};b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.searchicon+"'></span>"+h.searchtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.searchtitle||"",id:c.id||"search_"+o.p.id}).click(function(){b(o).jqGrid("searchGrid",c);return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}if(h.refresh){q=b("<td class='ui-pg-button ui-corner-all'></td>");b(q).append("<div class='ui-pg-div'><span class='ui-icon "+h.refreshicon+"'></span>"+h.refreshtext+"</div>");b("tr",r).append(q);b(q,r).attr({title:h.refreshtitle||"",id:"refresh_"+o.p.id}).click(function(){o.p.search=false;try{var u=o.p.id;b("#fbox_"+u).searchFilter().reset()}catch(v){}switch(h.refreshstate){case"firstpage":b(o).trigger("reloadGrid",[{page:1}]);break;case"current":b(o).trigger("reloadGrid",[{current:true}]);break}if(b.isFunction(h.afterRefresh)){h.afterRefresh()}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});q=null}l=b(".ui-jqgrid").css("font-size")||"11px";b("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+l+";visibility:hidden;' ></div>");p=b(r).clone().appendTo("#testpg2").width();b("#testpg2").remove();b("#"+m+"_"+h.position,"#"+m).append(r);if(o.p._nvtd){if(p>o.p._nvtd[0]){b("#"+m+"_"+h.position,"#"+m).width(p);o.p._nvtd[0]=p}o.p._nvtd[1]=p}})},navButtonAdd:function(c,d){d=b.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},d||{});return this.each(function(){if(!this.grid){return}if(c.indexOf("#")!=0){c="#"+c}var e=b(".navtable",c)[0],g=this;if(e){var f=b("<td></td>");b(f).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+d.buttonicon+"'></span>"+d.caption+"</div>");if(d.id){b(f).attr("id",d.id)}if(d.position=="first"){if(e.rows[0].cells.length===0){b("tr",e).append(f)}else{b("tr td:eq(0)",e).before(f)}}else{b("tr",e).append(f)}b(f,e).attr("title",d.title||"").click(function(h){if(b.isFunction(d.onClickButton)){d.onClickButton.call(g,h)}return false}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")}).css("cursor",d.cursor?d.cursor:"normal")}})},navSeparatorAdd:function(c,d){d=b.extend({sepclass:"ui-separator",sepcontent:""},d||{});return this.each(function(){if(!this.grid){return}if(c.indexOf("#")!=0){c="#"+c}var f=b(".navtable",c)[0];if(f){var e="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+d.sepclass+"'></span>"+d.sepcontent+"</td>";b("tr",f).append(e)}})},GridToForm:function(c,d){return this.each(function(){var g=this;if(!g.grid){return}var f=b(g).jqGrid("getRowData",c);if(f){for(var e in f){if(b("[name="+e+"]",d).is("input:radio")||b("[name="+e+"]",d).is("input:checkbox")){b("[name="+e+"]",d).each(function(){if(b(this).val()==f[e]){b(this).attr("checked","checked")}else{b(this).attr("checked","")}})}else{b("[name="+e+"]",d).val(f[e])}}}})},FormToGrid:function(d,e,f,c){return this.each(function(){var j=this;if(!j.grid){return}if(!f){f="set"}if(!c){c="first"}var g=b(e).serializeArray();var h={};b.each(g,function(k,l){h[l.name]=l.value});if(f=="add"){b(j).jqGrid("addRowData",d,h,c)}else{if(f=="set"){b(j).jqGrid("setRowData",d,h)}}})}})})(jQuery);(function(a){a.jgrid.extend({jqGridImport:function(b){b=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"}},b||{});return this.each(function(){var f=this;var d=function(h,n){var g=a(n.xmlGrid.config,h)[0];var m=a(n.xmlGrid.data,h)[0];if(xmlJsonClass.xml2json&&a.jgrid.parse){var p=xmlJsonClass.xml2json(g," ");var p=a.jgrid.parse(p);for(var j in p){var k=p[j]}if(m){var l=p.grid.datatype;p.grid.datatype="xmlstring";p.grid.datastr=h;a(f).jqGrid(k).jqGrid("setGridParam",{datatype:l})}else{a(f).jqGrid(k)}p=null;k=null}else{alert("xml2json or parse are not present")}};var e=function(h,l){if(h&&typeof h=="string"){var g=a.jgrid.parse(h);var m=g[l.jsonGrid.config];var j=g[l.jsonGrid.data];if(j){var k=m.datatype;m.datatype="jsonstring";m.datastr=j;a(f).jqGrid(m).jqGrid("setGridParam",{datatype:k})}else{a(f).jqGrid(m)}}};switch(b.imptype){case"xml":a.ajax({url:b.impurl,type:b.mtype,data:b.impData,dataType:"xml",complete:function(g,h){if(h=="success"){d(g.responseXML,b);if(a.isFunction(b.importComplete)){b.importComplete(g)}}g=null}});break;case"xmlstring":if(b.impstring&&typeof b.impstring=="string"){var c=a.jgrid.stringToDoc(b.impstring);if(c){d(c,b);if(a.isFunction(b.importComplete)){b.importComplete(c)}b.impstring=null}c=null}break;case"json":a.ajax({url:b.impurl,type:b.mtype,data:b.impData,dataType:"json",complete:function(g,h){if(h=="success"){e(g.responseText,b);if(a.isFunction(b.importComplete)){b.importComplete(g)}}g=null}});break;case"jsonstring":if(b.impstring&&typeof b.impstring=="string"){e(b.impstring,b);if(a.isFunction(b.importComplete)){b.importComplete(b.impstring)}b.impstring=null}break}})},jqGridExport:function(c){c=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},c||{});var b=null;this.each(function(){if(!this.grid){return}var e=a(this).jqGrid("getGridParam");if(e.rownumbers){e.colNames.splice(0);e.colModel.splice(0)}if(e.multiselect){e.colNames.splice(0);e.colModel.splice(0)}if(e.subgrid){e.colNames.splice(0);e.colModel.splice(0)}if(e.treeGrid){for(var d in e.treeReader){e.colNames.splice(e.colNames.length-1);e.colModel.splice(e.colModel.length-1)}}switch(c.exptype){case"xmlstring":b="<"+c.root+">"+xmlJsonClass.json2xml(e,c.ident)+"</"+c.root+">";break;case"jsonstring":b="{"+xmlJsonClass.toJson(e,c.root,c.ident)+"}";break}});return b}})})(jQuery);(function(a){a.jgrid.extend({editRow:function(c,j,h,k,b,e,d,f,g){return this.each(function(){var o=this,t,p,m,n=0,s=null,r={},l,q;if(!o.grid){return}l=a(o).jqGrid("getInd",c,true);if(l==false){return}m=a(l).attr("editable")||"0";if(m=="0"&&!a(l).hasClass("not-editable-row")){q=o.p.colModel;a("td",l).each(function(x){t=q[x].name;var w=o.p.treeGrid===true&&t==o.p.ExpandColumn;if(w){p=a("span:first",this).html()}else{try{p=a.unformat(this,{colModel:q[x]},x)}catch(u){p=a(this).html()}}if(t!="cb"&&t!="subgrid"&&t!="rn"){r[t]=p;if(q[x].editable===true){if(s===null){s=x}if(w){a("span:first",this).html("")}else{a(this).html("")}var v=a.extend({},q[x].editoptions||{},{id:c+"_"+t,name:t});if(!q[x].edittype){q[x].edittype="text"}var y=createEl(q[x].edittype,v,p,true,a.extend({},a.jgrid.ajaxOptions,o.p.ajaxSelectOptions||{}));a(y).addClass("editable");if(w){a("span:first",this).append(y)}else{a(this).append(y)}if(q[x].edittype=="select"&&q[x].editoptions.multiple===true&&a.browser.msie){a(y).width(a(y).width())}n++}}});if(n>0){r.id=c;o.p.savedRow.push(r);a(l).attr("editable","1");a("td:eq("+s+") input",l).focus();if(j===true){a(l).bind("keydown",function(u){if(u.keyCode===27){a(o).jqGrid("restoreRow",c,g)}if(u.keyCode===13){a(o).jqGrid("saveRow",c,k,b,e,d,f,g);return false}u.stopPropagation()})}if(a.isFunction(h)){h(c)}}}})},saveRow:function(h,g,e,f,d,c,b){return this.each(function(){var p=this,v,q={},m={},l,s,r,j;if(!p.grid){return}j=a(p).jqGrid("getInd",h,true);if(j==false){return}l=a(j).attr("editable");e=e?e:p.p.editurl;if(l==="1"&&e){var u;a("td",j).each(function(w){u=p.p.colModel[w];v=u.name;if(v!="cb"&&v!="subgrid"&&u.editable===true&&v!="rn"){switch(u.edittype){case"checkbox":var k=["Yes","No"];if(u.editoptions){k=u.editoptions.value.split(":")}q[v]=a("input",this).attr("checked")?k[0]:k[1];break;case"text":case"password":case"textarea":case"button":q[v]=!p.p.autoencode?a("input, textarea",this).val():a.jgrid.htmlEncode(a("input, textarea",this).val());break;case"select":if(!u.editoptions.multiple){q[v]=a("select>option:selected",this).val();m[v]=a("select>option:selected",this).text()}else{var x=a("select",this),z=[];q[v]=a(x).val();if(q[v]){q[v]=q[v].join(",")}else{q[v]=""}a("select > option:selected",this).each(function(A,B){z[A]=a(B).text()});m[v]=z.join(",")}if(u.formatter&&u.formatter=="select"){m={}}break;case"custom":try{if(u.editoptions&&a.isFunction(u.editoptions.custom_value)){q[v]=u.editoptions.custom_value(a(".customelement",this));if(q[v]===undefined){throw"e2"}}else{throw"e1"}}catch(y){if(y=="e1"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose)}if(y=="e2"){info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose)}else{info_dialog(jQuery.jgrid.errors.errcap,y.message,jQuery.jgrid.edit.bClose)}}break}r=checkValues(q[v],w,p);if(r[0]===false){r[1]=q[v]+" "+r[1];return false}}});if(r[0]===false){try{info_dialog(a.jgrid.errors.errcap,r[1],a.jgrid.edit.bClose)}catch(t){alert(r[1])}return}if(q){q.id=h;if(f){q=a.extend({},q,f)}}if(!p.grid.hDiv.loading){p.grid.hDiv.loading=true;a("div.loading",p.grid.hDiv).fadeIn("fast");if(e=="clientArray"){q=a.extend({},q,m);var o=a(p).jqGrid("setRowData",h,q);a(j).attr("editable","0");for(var n=0;n<p.p.savedRow.length;n++){if(p.p.savedRow[n].id==h){s=n;break}}if(s>=0){p.p.savedRow.splice(s,1)}if(a.isFunction(d)){d(h,o)}}else{a.ajax(a.extend({url:e,data:a.isFunction(p.p.serializeRowData)?p.p.serializeRowData(q):q,type:"POST",complete:function(y,z){if(z==="success"){var x;if(a.isFunction(g)){x=g(y)}else{x=true}if(x===true){q=a.extend({},q,m);a(p).jqGrid("setRowData",h,q);a(j).attr("editable","0");for(var w=0;w<p.p.savedRow.length;w++){if(p.p.savedRow[w].id==h){s=w;break}}if(s>=0){p.p.savedRow.splice(s,1)}if(a.isFunction(d)){d(h,y)}}else{a(p).jqGrid("restoreRow",h,b)}}},error:function(k,w){if(a.isFunction(c)){c(h,k,w)}else{alert("Error Row: "+h+" Result: "+k.status+":"+k.statusText+" Status: "+w)}}},a.jgrid.ajaxOptions,p.p.ajaxRowOptions||{}))}p.grid.hDiv.loading=false;a("div.loading",p.grid.hDiv).fadeOut("fast");a(j).unbind("keydown")}}})},restoreRow:function(c,b){return this.each(function(){var j=this,d,g;if(!j.grid){return}g=a(j).jqGrid("getInd",c,true);if(g==false){return}for(var f=0;f<j.p.savedRow.length;f++){if(j.p.savedRow[f].id==c){d=f;break}}if(d>=0){if(a.isFunction(a.fn.datepicker)){try{a("input.hasDatepicker","#"+g.id).datepicker("hide")}catch(h){}}a(j).jqGrid("setRowData",c,j.p.savedRow[d]);a(g).attr("editable","0").unbind("keydown");j.p.savedRow.splice(d,1)}if(a.isFunction(b)){b(c)}})}})})(jQuery);(function($){if($.browser.msie&&$.browser.version==8){$.expr[":"].hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0||elem.style.display=="none"}}if($.ui&&$.ui.multiselect&&$.ui.multiselect.prototype._setSelected){var setSelected=$.ui.multiselect.prototype._setSelected;$.ui.multiselect.prototype._setSelected=function(item,selected){var ret=setSelected.call(this,item,selected);if(selected&&this.selectedList){var elt=this.element;this.selectedList.find("li").each(function(){if($(this).data("optionLink")){$(this).data("optionLink").remove().appendTo(elt)}})}return ret}}$.jgrid.extend({sortableColumns:function(tblrow){return this.each(function(){var ts=this;function start(){ts.p.disableClick=true}var sortable_opts={tolerance:"pointer",axis:"x",items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)",placeholder:{element:function(item){var el=$(document.createElement(item[0].nodeName)).addClass(item[0].className+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0];return el},update:function(self,p){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css("paddingTop")||0,10)-parseInt(self.currentItem.css("paddingBottom")||0,10));p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css("paddingLeft")||0,10)-parseInt(self.currentItem.css("paddingRight")||0,10))}},update:function(event,ui){var p=$(ui.item).parent();var th=$(">th",p);var colModel=ts.p.colModel;var cmMap={};$.each(colModel,function(i){cmMap[this.name]=i});var permutation=[];th.each(function(i){var id=$(">div",this).get(0).id.replace(/^jqgh_/,"");if(id in cmMap){permutation.push(cmMap[id])}});$(ts).jqGrid("remapColumns",permutation,true,true);if($.isFunction(ts.p.sortable.update)){ts.p.sortable.update(permutation)}setTimeout(function(){ts.p.disableClick=false},50)}};if(ts.p.sortable.options){$.extend(sortable_opts,ts.p.sortable.options)}else{if($.isFunction(ts.p.sortable)){ts.p.sortable={update:ts.p.sortable}}}if(sortable_opts.start){var s=sortable_opts.start;sortable_opts.start=function(e,ui){start();s.call(this,e,ui)}}else{sortable_opts.start=start}if(ts.p.sortable.exclude){sortable_opts.items+=":not("+ts.p.sortable.exclude+")"}tblrow.sortable(sortable_opts).data("sortable").floating=true})},columnChooser:function(opts){var self=this;var selector=$('<div style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');var select=$("select",selector);opts=$.extend({width:420,height:240,classname:null,done:function(perm){if(perm){self.jqGrid("remapColumns",perm,true)}},msel:"multiselect",dlog:"dialog",dlog_opts:function(opts){var buttons={};buttons[opts.bSubmit]=function(){opts.apply_perm();opts.cleanup(false)};buttons[opts.bCancel]=function(){opts.cleanup(true)};return{buttons:buttons,close:function(){opts.cleanup(true)},modal:false,resizable:false,width:opts.width+20}},apply_perm:function(){$("option",select).each(function(i){if(this.selected){self.jqGrid("showCol",colModel[this.value].name)}else{self.jqGrid("hideCol",colModel[this.value].name)}});var perm=fixedCols.slice(0);$("option[selected]",select).each(function(){perm.push(parseInt(this.value))});$.each(perm,function(){delete colMap[colModel[this].name]});$.each(colMap,function(){perm.push(parseInt(this))});if(opts.done){opts.done.call(self,perm)}},cleanup:function(calldone){call(opts.dlog,selector,"destroy");call(opts.msel,select,"destroy");selector.remove();if(calldone&&opts.done){opts.done.call(self)}}},$.jgrid.col,opts||{});if(opts.caption){selector.attr("title",opts.caption)}if(opts.classname){selector.addClass(classname);select.addClass(classname)}if(opts.width){$(">div",selector).css({width:opts.width,margin:"0 auto"});select.css("width",opts.width)}if(opts.height){$(">div",selector).css("height",opts.height);select.css("height",opts.height-10)}var colModel=self.jqGrid("getGridParam","colModel");var colNames=self.jqGrid("getGridParam","colNames");var colMap={},fixedCols=[];select.empty();$.each(colModel,function(i){colMap[this.name]=i;if(this.hidedlg){if(!this.hidden){fixedCols.push(i)}return}select.append("<option value='"+i+"' "+(this.hidden?"":"selected='selected'")+">"+colNames[i]+"</option>")});function call(fn,obj){if(!fn){return}if(typeof fn=="string"){if($.fn[fn]){$.fn[fn].apply(obj,$.makeArray(arguments).slice(2))}}else{if($.isFunction(fn)){fn.apply(obj,$.makeArray(arguments).slice(2))}}}var dopts=$.isFunction(opts.dlog_opts)?opts.dlog_opts.call(self,opts):opts.dlog_opts;call(opts.dlog,selector,dopts);var mopts=$.isFunction(opts.msel_opts)?opts.msel_opts.call(self,opts):opts.msel_opts;call(opts.msel,select,opts.msel_opts)},sortableRows:function(opts){return this.each(function(){var $t=this;if(!$t.grid){return}if($t.p.treeGrid){return}if($.fn.sortable){opts=$.extend({cursor:"move",axis:"y",items:".jqgrow"},opts||{});if(opts.start&&$.isFunction(opts.start)){opts._start_=opts.start;delete opts.start}else{opts._start_=false}if(opts.update&&$.isFunction(opts.update)){opts._update_=opts.update;delete opts.update}else{opts._update_=false}opts.start=function(ev,ui){$(ui.item).css("border-width","0px");$("td",ui.item).each(function(i){this.style.width=$t.grid.cols[i].style.width});if($t.p.subGrid){var subgid=$(ui.item).attr("id");try{$($t).jqGrid("collapseSubGridRow",subgid)}catch(e){}}if(opts._start_){opts._start_.apply(this,[ev,ui])}};opts.update=function(ev,ui){$(ui.item).css("border-width","");$t.updateColumns();if(opts._update_){opts._update_.apply(this,[ev,ui])}};$("tbody:first",$t).sortable(opts)}})},gridDnD:function(opts){return this.each(function(){var $t=this;if(!$t.grid){return}if($t.p.treeGrid){return}if(!$.fn.draggable||!$.fn.droppable){return}function updateDnD(){var datadnd=$.data($t,"dnd");$("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag)?datadnd.drag.call($($t),datadnd):datadnd.drag)}var appender="<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>";if($("#jqgrid_dnd").html()==null){$("body").append(appender)}if(typeof opts=="string"&&opts=="updateDnD"&&$t.p.jqgdnd==true){updateDnD();return}opts=$.extend({drag:function(opts){return $.extend({start:function(ev,ui){if($t.p.subGrid){var subgid=$(ui.helper).attr("id");try{$($t).jqGrid("collapseSubGridRow",subgid)}catch(e){}}for(var i=0;i<opts.connectWith.length;i++){if($(opts.connectWith[i]).jqGrid("getGridParam","reccount")=="0"){$(opts.connectWith[i]).jqGrid("addRowData","jqg_empty_row",{})}}ui.helper.addClass("ui-state-highlight");$("td",ui.helper).each(function(i){this.style.width=$t.grid.headers[i].width+"px"});if(opts.onstart&&$.isFunction(opts.onstart)){opts.onstart.call($($t),ev,ui)}},stop:function(ev,ui){if(ui.helper.dropped){var ids=$(ui.helper).attr("id");$($t).jqGrid("delRowData",ids)}for(var i=0;i<opts.connectWith.length;i++){$(opts.connectWith[i]).jqGrid("delRowData","jqg_empty_row")}if(opts.onstop&&$.isFunction(opts.onstop)){opts.onstop.call($($t),ev,ui)}}},opts.drag_opts||{})},drop:function(opts){return $.extend({accept:"#"+$t.id+" tr.jqgrow",drop:function(ev,ui){var accept=$(ui.draggable).attr("id");var getdata=$("#"+$t.id).jqGrid("getRowData",accept);if(!opts.dropbyname){var j=0,tmpdata={},dropname;var dropmodel=$("#"+this.id).jqGrid("getGridParam","colModel");try{for(key in getdata){if(dropmodel[j]){dropname=dropmodel[j].name;tmpdata[dropname]=getdata[key]}j++}getdata=tmpdata}catch(e){}}ui.helper.dropped=true;if(opts.beforedrop&&$.isFunction(opts.beforedrop)){var datatoinsert=opts.beforedrop.call(this,ev,ui,getdata,$("#"+$t.id),$(this));if(typeof datatoinsert!="undefined"&&datatoinsert!==null&&typeof datatoinsert=="object"){getdata=datatoinsert}}if(ui.helper.dropped){var grid;if(opts.autoid){if($.isFunction(opts.autoid)){grid=opts.autoid.call(this,getdata)}else{grid=Math.ceil(Math.random()*1000);grid=opts.autoidprefix+grid}}$("#"+this.id).jqGrid("addRowData",grid,getdata,opts.droppos)}if(opts.ondrop&&$.isFunction(opts.ondrop)){opts.ondrop.call(this,ev,ui,getdata)}}},opts.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5000},dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},opts||{});if(!opts.connectWith){return}opts.connectWith=opts.connectWith.split(",");opts.connectWith=$.map(opts.connectWith,function(n){return $.trim(n)});$.data($t,"dnd",opts);if($t.p.reccount!="0"&&!$t.p.jqgdnd){updateDnD()}$t.p.jqgdnd=true;for(var i=0;i<opts.connectWith.length;i++){var cn=opts.connectWith[i];$(cn).droppable($.isFunction(opts.drop)?opts.drop.call($($t),opts):opts.drop)}})},gridResize:function(opts){return this.each(function(){var $t=this;if(!$t.grid||!$.fn.resizable){return}opts=$.extend(opts||{});if(opts.alsoResize){opts._alsoResize_=opts.alsoResize;delete opts.alsoResize}else{opts._alsoResize_=false}if(opts.stop&&$.isFunction(opts.stop)){opts._stop_=opts.stop;delete opts.stop}else{opts._stop_=false}opts.stop=function(ev,ui){$($t).jqGrid("setGridParam",{height:$("#gview_"+$t.p.id+" .ui-jqgrid-bdiv").height()});$($t).jqGrid("setGridWidth",ui.size.width,opts.shrinkToFit);if(opts._stop_){opts._stop_.call($t,ev,ui)}};if(opts._alsoResize_){var optstest="{'#gview_"+$t.p.id+" .ui-jqgrid-bdiv':true,'"+opts._alsoResize_+"':true}";opts.alsoResize=eval("("+optstest+")")}else{opts.alsoResize=$(".ui-jqgrid-bdiv","#gview_"+$t.p.id)}delete opts._alsoResize_;$("#gbox_"+$t.p.id).resizable(opts)})}})})(jQuery);(function(a){a.jgrid.extend({getPostData:function(){var b=this[0];if(!b.grid){return}return b.p.postData},setPostData:function(b){var c=this[0];if(!c.grid){return}if(typeof(b)==="object"){c.p.postData=b}else{alert("Error: cannot add a non-object postData value. postData unchanged.")}},appendPostData:function(b){var c=this[0];if(!c.grid){return}if(typeof(b)==="object"){a.extend(c.p.postData,b)}else{alert("Error: cannot append a non-object postData value. postData unchanged.")}},setPostDataItem:function(b,c){var d=this[0];if(!d.grid){return}d.p.postData[b]=c},getPostDataItem:function(b){var c=this[0];if(!c.grid){return}return c.p.postData[b]},removePostDataItem:function(b){var c=this[0];if(!c.grid){return}delete c.p.postData[b]},getUserData:function(){var b=this[0];if(!b.grid){return}return b.p.userData},getUserDataItem:function(b){var c=this[0];if(!c.grid){return}return c.p.userData[b]}})})(jQuery);(function(a){a.jgrid.extend({setColumns:function(b){b=a.extend({top:0,left:0,width:200,height:"auto",dataheight:"auto",modal:false,drag:true,beforeShowForm:null,afterShowForm:null,afterSubmitForm:null,closeOnEscape:true,ShrinkToFit:false,jqModal:false,saveicon:[true,"left","ui-icon-disk"],closeicon:[true,"left","ui-icon-close"],onClose:null,colnameview:true,closeAfterSubmit:true,updateAfterCheck:false},a.jgrid.col,b||{});return this.each(function(){var j=this;if(!j.grid){return}var k=typeof b.beforeShowForm==="function"?true:false;var d=typeof b.afterShowForm==="function"?true:false;var e=typeof b.afterSubmitForm==="function"?true:false;var c=j.p.id,h="ColTbl_"+c,f={themodal:"colmod"+c,modalhead:"colhd"+c,modalcontent:"colcnt"+c,scrollelm:h};if(a("#"+f.themodal).html()!=null){if(k){b.beforeShowForm(a("#"+h))}viewModal("#"+f.themodal,{gbox:"#gbox_"+c,jqm:b.jqModal,jqM:false,modal:b.modal});if(d){b.afterShowForm(a("#"+h))}}else{var l=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px";var m="<div id='"+h+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+l+";'>";m+="<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>";for(i=0;i<this.p.colNames.length;i++){if(!j.p.colModel[i].hidedlg){m+="<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_"+this.p.colModel[i].name+"' class='cbox' value='T' "+((this.p.colModel[i].hidden===false)?"checked":"")+"/><label for='col_"+this.p.colModel[i].name+"'>"+this.p.colNames[i]+((b.colnameview)?" ("+this.p.colModel[i].name+")":"")+"</label></td></tr>"}}m+="</tbody></table></div>";var g=!b.updateAfterCheck?"<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>":"",n="<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>";m+="<table border='0' class='EditTable' id='"+h+"_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>"+g+"&nbsp;"+n+"</td></tr></tbody></table>";b.gbox="#gbox_"+c;createModal(f,m,b,"#gview_"+j.p.id,a("#gview_"+j.p.id)[0]);if(b.saveicon[0]==true){a("#dData","#"+h+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>")}if(b.closeicon[0]==true){a("#eData","#"+h+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>")}if(!b.updateAfterCheck){a("#dData","#"+h+"_2").click(function(p){for(i=0;i<j.p.colModel.length;i++){if(!j.p.colModel[i].hidedlg){var o=j.p.colModel[i].name.replace(".","\\.");if(a("#col_"+o,"#"+h).attr("checked")){a(j).jqGrid("showCol",j.p.colModel[i].name);a("#col_"+o,"#"+h).attr("defaultChecked",true)}else{a(j).jqGrid("hideCol",j.p.colModel[i].name);a("#col_"+o,"#"+h).attr("defaultChecked","")}}}if(b.ShrinkToFit===true){a(j).jqGrid("setGridWidth",j.grid.width-0.001,true)}if(b.closeAfterSubmit){hideModal("#"+f.themodal,{gb:"#gbox_"+c,jqm:b.jqModal,onClose:b.onClose})}if(e){b.afterSubmitForm(a("#"+h))}return false})}else{a(":input","#"+h).click(function(o){var p=this.id.substr(4);if(p){if(this.checked){a(j).jqGrid("showCol",p)}else{a(j).jqGrid("hideCol",p)}if(b.ShrinkToFit===true){a(j).jqGrid("setGridWidth",j.grid.width-0.001,true)}}return this})}a("#eData","#"+h+"_2").click(function(o){hideModal("#"+f.themodal,{gb:"#gbox_"+c,jqm:b.jqModal,onClose:b.onClose});return false});a("#dData, #eData","#"+h+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});if(k){b.beforeShowForm(a("#"+h))}viewModal("#"+f.themodal,{gbox:"#gbox_"+c,jqm:b.jqModal,jqM:true,modal:b.modal});if(d){b.afterShowForm(a("#"+h))}}})}})})(jQuery);(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var c=this,b;c.p.colNames.unshift("");c.p.colModel.unshift({name:"subgrid",width:a.browser.safari?c.p.subGridWidth+c.p.cellLayout:c.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false,fixed:true});b=c.p.subGridModel;if(b[0]){b[0].align=a.extend([],b[0].align||[]);for(i=0;i<b[0].name.length;i++){b[0].align[i]=b[0].align[i]||"left"}}})},addSubGridCell:function(e,c){var b="",d;this.each(function(){b=this.formatCol(e,c);d=this.p.gridview});if(d===false){return"<td role='grid' class='ui-sgcollapsed sgcollapsed' "+b+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>"}else{return"<td role='grid' "+b+"></td>"}},addSubGrid:function(b,c){return this.each(function(){var m=this;if(!m.grid){return}var n,o,p,j,k,g,h;a("td:eq("+c+")",b).click(function(q){if(a(this).hasClass("sgcollapsed")){p=m.p.id;n=a(this).parent();j=c>=1?"<td colspan='"+c+"'>&nbsp;</td>":"";o=a(n).attr("id");h=true;if(a.isFunction(m.p.subGridBeforeExpand)){h=m.p.subGridBeforeExpand(p+"_"+o,o)}if(h===false){return false}k=0;a.each(m.p.colModel,function(s,r){if(this.hidden===true||this.name=="rn"||this.name=="cb"){k++}});g="<tr role='row' class='ui-subgrid'>"+j+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='"+parseInt(m.p.colNames.length-1-k)+"' class='ui-widget-content subgrid-data'><div id="+p+"_"+o+" class='tablediv'>";a(this).parent().after(g+"</div></td></tr>");if(a.isFunction(m.p.subGridRowExpanded)){m.p.subGridRowExpanded(p+"_"+o,o)}else{l(n)}a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded")}else{if(a(this).hasClass("sgexpanded")){h=true;if(a.isFunction(m.p.subGridRowColapsed)){n=a(this).parent();o=a(n).attr("id");h=m.p.subGridRowColapsed(p+"_"+o,o)}if(h===false){return false}a(this).parent().next().remove(".ui-subgrid");a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}}return false});var l=function(u){var t,q,v,s,r;q=a(u).attr("id");v={id:q,nd_:(new Date().getTime())};if(!m.p.subGridModel[0]){return false}if(m.p.subGridModel[0].params){for(r=0;r<m.p.subGridModel[0].params.length;r++){for(s=0;s<m.p.colModel.length;s++){if(m.p.colModel[s].name==m.p.subGridModel[0].params[r]){v[m.p.colModel[s].name]=a("td:eq("+s+")",u).text().replace(/\&nbsp\;/ig,"")}}}}if(!m.grid.hDiv.loading){m.grid.hDiv.loading=true;a("#load_"+m.p.id).show();if(!m.p.subgridtype){m.p.subgridtype=m.p.datatype}m.p.subgridtype=m.p.subgridtype.toLowerCase();if(a.isFunction(m.p.subgridtype)){m.p.subgridtype(v)}switch(m.p.subgridtype){case"xml":case"json":a.ajax(a.extend({type:m.p.mtype,url:m.p.subGridUrl,dataType:m.p.subgridtype,data:a.isFunction(m.p.serializeSubGridData)?m.p.serializeSubGridData(v):v,complete:function(w){if(m.p.subgridtype=="xml"){d(w.responseXML,q)}else{f(a.jgrid.parse(w.responseText),q)}w=null}},a.jgrid.ajaxOptions,m.p.ajaxSubgridOptions||{}));break}}return false};var e=function(r,q,t){var s=a("<td align='"+m.p.subGridModel[0].align[t]+"'></td>").html(q);a(r).append(s)};var d=function(v,t){var x,u,w,q,s=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),r=a("<tr></tr>");for(u=0;u<m.p.subGridModel[0].name.length;u++){x=a("<th class='ui-state-default ui-th-column ui-th-"+m.p.direction+"'></th>");a(x).html(m.p.subGridModel[0].name[u]);a(x).width(m.p.subGridModel[0].width[u]);a(r).append(x)}a(s).append(r);if(v){q=m.p.xmlReader.subgrid;a(q.root+" "+q.row,v).each(function(){r=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(q.repeatitems===true){a(q.cell,this).each(function(A){e(r,a(this).text()||"&nbsp;",A)})}else{var z=m.p.subGridModel[0].mapping||m.p.subGridModel[0].name;if(z){for(u=0;u<z.length;u++){e(r,a(z[u],this).text()||"&nbsp;",u)}}}a(s).append(r)})}var y=a("table:first",m.grid.bDiv).attr("id")+"_";a("#"+y+t).append(s);m.grid.hDiv.loading=false;a("#load_"+m.p.id).hide();return false};var f=function(x,u){var z,B,v,y,q,s=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),r=a("<tr></tr>");for(v=0;v<m.p.subGridModel[0].name.length;v++){z=a("<th class='ui-state-default ui-th-column ui-th-"+m.p.direction+"'></th>");a(z).html(m.p.subGridModel[0].name[v]);a(z).width(m.p.subGridModel[0].width[v]);a(r).append(z)}a(s).append(r);if(x){q=m.p.jsonReader.subgrid;B=x[q.root];if(typeof B!=="undefined"){for(v=0;v<B.length;v++){y=B[v];r=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(q.repeatitems===true){if(q.cell){y=y[q.cell]}for(var t=0;t<y.length;t++){e(r,y[t]||"&nbsp;",t)}}else{var w=m.p.subGridModel[0].mapping||m.p.subGridModel[0].name;if(w.length){for(var t=0;t<w.length;t++){e(r,y[w[t]]||"&nbsp;",t)}}}a(s).append(r)}}}var A=a("table:first",m.grid.bDiv).attr("id")+"_";a("#"+A+u).append(s);m.grid.hDiv.loading=false;a("#load_"+m.p.id).hide();return false};m.subGridXml=function(r,q){d(r,q)};m.subGridJson=function(r,q){f(r,q)}})},expandSubGridRow:function(b){return this.each(function(){var e=this;if(!e.grid&&!b){return}if(e.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){var d=a("td.sgcollapsed",c)[0];if(d){a(d).trigger("click")}}}})},collapseSubGridRow:function(b){return this.each(function(){var e=this;if(!e.grid&&!b){return}if(e.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){var d=a("td.sgexpanded",c)[0];if(d){a(d).trigger("click")}}}})},toggleSubGridRow:function(b){return this.each(function(){var e=this;if(!e.grid&&!b){return}if(e.p.subGrid===true){var c=a(this).jqGrid("getInd",b,true);if(c){var d=a("td.sgcollapsed",c)[0];if(d){a(d).trigger("click")}else{d=a("td.sgexpanded",c)[0];if(d){a(d).trigger("click")}}}}})}})})(jQuery);function tableToGrid(a,b){$(a).each(function(){if(this.grid){return}$(this).width("99%");var o=$(this).width();var q=$("input[type=checkbox]:first",$(this));var h=$("input[type=radio]:first",$(this));var d=q.length>0;var g=!d&&h.length>0;var k=d||g;var j=q.attr("name")||h.attr("name");var m=[];var p=[];$("th",$(this)).each(function(){if(m.length==0&&k){m.push({name:"__selection__",index:"__selection__",width:0,hidden:true});p.push("__selection__")}else{m.push({name:$(this).attr("id")||$(this).html(),index:$(this).attr("id")||$(this).html(),width:$(this).width()||150});p.push($(this).html())}});var f=[];var e=[];var n=[];$("tbody > tr",$(this)).each(function(){var s={};var r=0;$("td",$(this)).each(function(){if(r==0&&k){var t=$("input",$(this));var u=t.attr("value");e.push(u||f.length);if(t.attr("checked")){n.push(u)}s[m[r].name]=t.attr("value")}else{s[m[r].name]=$(this).html()}r++});if(r>0){f.push(s)}});$(this).empty();$(this).addClass("scroll");$(this).jqGrid($.extend({datatype:"local",width:o,colNames:p,colModel:m,multiselect:d},b||{}));for(var l=0;l<f.length;l++){var c=null;if(e.length>0){c=e[l];if(c&&c.replace){c=encodeURIComponent(c).replace(/[.\-%]/g,"_")}}if(c==null){c=l+1}$(this).jqGrid("addRowData",c,f[l])}for(var l=0;l<n.length;l++){$(this).jqGrid("setSelection",n[l])}})}(function(a){a.jgrid.extend({setTreeNode:function(b,c){return this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}var k=g.p.expColInd;var j=g.p.treeReader.expanded_field;var f=g.p.treeReader.leaf_field;var e=g.p.treeReader.level_field;c.level=b[e];if(g.p.treeGridModel=="nested"){c.lft=b[g.p.treeReader.left_field];c.rgt=b[g.p.treeReader.right_field];if(!b[f]){b[f]=(parseInt(c.rgt,10)===parseInt(c.lft,10)+1)?"true":"false"}}else{c.parent_id=b[g.p.treeReader.parent_id_field]}var l=parseInt(c.level,10),h,m;if(g.p.tree_root_level===0){h=l+1;m=l}else{h=l;m=l-1}var d="<div class='tree-wrap tree-wrap-"+g.p.direction+"' style='width:"+(h*18)+"px;'>";d+="<div style='"+(g.p.direction=="rtl"?"right:":"left:")+(m*18)+"px;' class='ui-icon ";if(b[f]=="true"||b[f]==true){d+=g.p.treeIcons.leaf+" tree-leaf'";c.isLeaf=true}else{if(b[j]=="true"||b[j]==true){d+=g.p.treeIcons.minus+" tree-minus treeclick'";c.expanded=true}else{d+=g.p.treeIcons.plus+" tree-plus treeclick'";c.expanded=false}c.isLeaf=false}d+="</div></div>";if(parseInt(b[e],10)!==parseInt(g.p.tree_root_level,10)){if(!a(g).jqGrid("isVisibleNode",c)){a(c).css("display","none")}}a("td:eq("+k+")",c).wrapInner("<span></span>").prepend(d);a(".treeclick",c).bind("click",function(p){var o=p.target||p.srcElement;var n=a(o,g.rows).parents("tr.jqgrow")[0].rowIndex;if(!g.rows[n].isLeaf){if(g.rows[n].expanded){a(g).jqGrid("collapseRow",g.rows[n]);a(g).jqGrid("collapseNode",g.rows[n])}else{a(g).jqGrid("expandRow",g.rows[n]);a(g).jqGrid("expandNode",g.rows[n])}}return false});if(g.p.ExpandColClick===true){a("span",c).css("cursor","pointer").bind("click",function(p){var o=p.target||p.srcElement;var n=a(o,g.rows).parents("tr.jqgrow")[0].rowIndex;if(!g.rows[n].isLeaf){if(g.rows[n].expanded){a(g).jqGrid("collapseRow",g.rows[n]);a(g).jqGrid("collapseNode",g.rows[n])}else{a(g).jqGrid("expandRow",g.rows[n]);a(g).jqGrid("expandNode",g.rows[n])}}a(g).jqGrid("setSelection",g.rows[n].id);return false})}})},setTreeGrid:function(){return this.each(function(){var e=this,d=0,b;if(!e.p.treeGrid){return}if(!e.p.treedatatype){a.extend(e.p,{treedatatype:e.p.datatype})}e.p.subGrid=false;e.p.altRows=false;e.p.pgbuttons=false;e.p.pginput=false;e.p.multiselect=false;e.p.rowList=[];b="ui-icon-triangle-1-"+(e.p.direction=="rtl"?"w":"e");e.p.treeIcons=a.extend({plus:b,minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},e.p.treeIcons||{});if(e.p.treeGridModel=="nested"){e.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded"},e.p.treeReader)}else{if(e.p.treeGridModel=="adjacency"){e.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded"},e.p.treeReader)}}for(var c in e.p.colModel){if(e.p.colModel[c].name==e.p.ExpandColumn){e.p.expColInd=d;break}d++}if(!e.p.expColInd){e.p.expColInd=0}a.each(e.p.treeReader,function(f,g){if(g){e.p.colNames.push(g);e.p.colModel.push({name:g,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})})},expandRow:function(b){this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}var c=a(d).jqGrid("getNodeChildren",b);a(c).each(function(e){a(this).css("display","");if(this.expanded){a(d).jqGrid("expandRow",this)}})})},collapseRow:function(b){this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}var c=a(d).jqGrid("getNodeChildren",b);a(c).each(function(e){a(this).css("display","none");if(this.expanded){a(d).jqGrid("collapseRow",this)}})})},getRootNodes:function(){var b=[];this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}switch(d.p.treeGridModel){case"nested":var c=d.p.treeReader.level_field;a(d.rows).each(function(e){if(parseInt(this[c],10)===parseInt(d.p.tree_root_level,10)){b.push(this)}});break;case"adjacency":a(d.rows).each(function(e){if(this.parent_id==null||this.parent_id.toLowerCase()=="null"){b.push(this)}});break}});return b},getNodeDepth:function(c){var b=null;this.each(function(){var d=this;if(!this.grid||!this.p.treeGrid){return}switch(d.p.treeGridModel){case"nested":b=parseInt(c.level,10)-parseInt(this.p.tree_root_level,10);break;case"adjacency":b=a(d).jqGrid("getNodeAncestors",c).length;break}});return b},getNodeParent:function(c){var b=null;this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}switch(g.p.treeGridModel){case"nested":var e=parseInt(c.lft,10),d=parseInt(c.rgt,10),f=parseInt(c.level,10);a(this.rows).each(function(){if(parseInt(this.level,10)===f-1&&parseInt(this.lft)<e&&parseInt(this.rgt)>d){b=this;return false}});break;case"adjacency":a(this.rows).each(function(){if(this.id==c.parent_id){b=this;return false}});break}});return b},getNodeChildren:function(c){var b=[];this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}switch(g.p.treeGridModel){case"nested":var e=parseInt(c.lft,10),d=parseInt(c.rgt,10),f=parseInt(c.level,10);a(this.rows).each(function(h){if(parseInt(this.level,10)===f+1&&parseInt(this.lft,10)>e&&parseInt(this.rgt,10)<d){b.push(this)}});break;case"adjacency":a(this.rows).each(function(h){if(this.parent_id==c.id){b.push(this)}});break}});return b},getFullTreeNode:function(c){var b=[];this.each(function(){var g=this;if(!g.grid||!g.p.treeGrid){return}switch(g.p.treeGridModel){case"nested":var e=parseInt(c.lft,10),d=parseInt(c.rgt,10),f=parseInt(c.level,10);a(this.rows).each(function(h){if(parseInt(this.level,10)>=f&&parseInt(this.lft,10)>=e&&parseInt(this.lft,10)<=d){b.push(this)}});break;case"adjacency":b.push(c);a(this.rows).each(function(h){len=b.length;for(h=0;h<len;h++){if(b[h].id==this.parent_id){b.push(this);break}}});break}});return b},getNodeAncestors:function(c){var b=[];this.each(function(){if(!this.grid||!this.p.treeGrid){return}var d=a(this).jqGrid("getNodeParent",c);while(d){b.push(d);d=a(this).jqGrid("getNodeParent",d)}});return b},isVisibleNode:function(c){var b=true;this.each(function(){var e=this;if(!e.grid||!e.p.treeGrid){return}var d=a(e).jqGrid("getNodeAncestors",c);a(d).each(function(){b=b&&this.expanded;if(!b){return false}})});return b},isNodeLoaded:function(c){var b;this.each(function(){var d=this;if(!d.grid||!d.p.treeGrid){return}if(c.loaded!==undefined){b=c.loaded}else{if(c.isLeaf||a(d).jqGrid("getNodeChildren",c).length>0){b=true}else{b=false}}});return b},expandNode:function(b){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}if(!b.expanded){if(a(this).jqGrid("isNodeLoaded",b)){b.expanded=true;a("div.treeclick",b).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{b.expanded=true;a("div.treeclick",b).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=b.rowIndex;this.p.datatype=this.p.treedatatype;if(this.p.treeGridModel=="nested"){a(this).jqGrid("setGridParam",{postData:{nodeid:b.id,n_left:b.lft,n_right:b.rgt,n_level:b.level}})}else{a(this).jqGrid("setGridParam",{postData:{nodeid:b.id,parentid:b.parent_id,n_level:b.level}})}a(this).trigger("reloadGrid");if(this.p.treeGridModel=="nested"){a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}})}else{a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(b){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}if(b.expanded){b.expanded=false;a("div.treeclick",b).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},SortTree:function(b){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}var f,c,g,e=[],h=this,d=a(this).jqGrid("getRootNodes");d.sort(function(k,j){if(k.sortKey<j.sortKey){return -b}if(k.sortKey>j.sortKey){return b}return 0});if(d[0]){a("td",d[0]).each(function(j){a(this).css("width",h.grid.headers[j].width+"px")});h.grid.cols=d[0].cells}for(f=0,c=d.length;f<c;f++){g=d[f];e.push(g);a(this).jqGrid("collectChildrenSortTree",e,g,b)}a.each(e,function(j,k){a("tbody",h.grid.bDiv).append(k);k.sortKey=null})})},collectChildrenSortTree:function(b,d,c){return this.each(function(){if(!this.grid||!this.p.treeGrid){return}var g,e,h,f=a(this).jqGrid("getNodeChildren",d);f.sort(function(k,j){if(k.sortKey<j.sortKey){return -c}if(k.sortKey>j.sortKey){return c}return 0});for(g=0,e=f.length;g<e;g++){h=f[g];b.push(h);a(this).jqGrid("collectChildrenSortTree",b,h,c)}})},setTreeRow:function(c,d){var b,e=false;this.each(function(){var f=this;if(!f.grid||!f.p.treeGrid){return}e=a(f).jqGrid("setRowData",c,d)});return e},delTreeNode:function(b){return this.each(function(){var f=this;if(!f.grid||!f.p.treeGrid){return}var d=a(f).jqGrid("getInd",b,true);if(d){var e=a(f).jqGrid("getNodeChildren",d);if(e.length>0){for(var c=0;c<e.length;c++){a(f).jqGrid("delRowData",e[c].id)}}a(f).jqGrid("delRowData",d.id)}})}})})(jQuery);(function(g){g.fn.jqDrag=function(f){return c(this,f,"d")};g.fn.jqResize=function(j,f){return c(this,j,"r",f)};g.jqDnR={dnr:{},e:0,drag:function(f){if(h.k=="d"){e.css({left:h.X+f.pageX-h.pX,top:h.Y+f.pageY-h.pY})}else{e.css({width:Math.max(f.pageX-h.pX+h.W,0),height:Math.max(f.pageY-h.pY+h.H,0)});if(M1){a.css({width:Math.max(f.pageX-M1.pX+M1.W,0),height:Math.max(f.pageY-M1.pY+M1.H,0)})}}return false},stop:function(){g().unbind("mousemove",b.drag).unbind("mouseup",b.stop)}};var b=g.jqDnR,h=b.dnr,e=b.e,a,c=function(m,l,j,f){return m.each(function(){l=(l)?g(l,m):m;l.bind("mousedown",{e:m,k:j},function(k){var q=k.data,o={};e=q.e;a=f?g(f):false;if(e.css("position")!="relative"){try{e.position(o)}catch(n){}}h={X:o.left||d("left")||0,Y:o.top||d("top")||0,W:d("width")||e[0].scrollWidth||0,H:d("height")||e[0].scrollHeight||0,pX:k.pageX,pY:k.pageY,k:q.k};if(a&&q.k!="d"){M1={X:o.left||f1("left")||0,Y:o.top||f1("top")||0,W:a[0].offsetWidth||f1("width")||0,H:a[0].offsetHeight||f1("height")||0,pX:k.pageX,pY:k.pageY,k:q.k}}else{M1=false}g().mousemove(g.jqDnR.drag).mouseup(g.jqDnR.stop);return false})})},d=function(f){return parseInt(e.css(f))||false};f1=function(f){return parseInt(a.css(f))||false}})(jQuery);(function(d){d.fn.jqm=function(f){var e={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:n,ajaxText:"",target:n,modal:n,toTop:n,onShow:n,onHide:n,onLoad:n};return this.each(function(){if(this._jqm){return l[this._jqm].c=d.extend({},l[this._jqm].c,f)}o++;this._jqm=o;l[o]={c:d.extend(e,d.jqm.params,f),a:n,w:d(this).addClass("jqmID"+o),s:o};if(e.trigger){d(this).jqmAddTrigger(e.trigger)}})};d.fn.jqmAddClose=function(f){return k(this,f,"jqmHide")};d.fn.jqmAddTrigger=function(f){return k(this,f,"jqmShow")};d.fn.jqmShow=function(e){return this.each(function(){d.jqm.open(this._jqm,e)})};d.fn.jqmHide=function(e){return this.each(function(){d.jqm.close(this._jqm,e)})};d.jqm={hash:{},open:function(B,A){var p=l[B],q=p.c,m="."+q.closeClass,v=(parseInt(p.w.css("z-index")));v=(v>0)?v:3000;var f=d("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":v-1,opacity:q.overlay/100});if(p.a){return n}p.t=A;p.a=true;p.w.css("z-index",v);if(q.modal){if(!a[0]){setTimeout(function(){j("bind")},1)}a.push(B)}else{if(q.overlay>0){if(q.closeoverlay){p.w.jqmAddClose(f)}}else{f=n}}p.o=(f)?f.addClass(q.overlayClass).prependTo("body"):n;if(c){d("html,body").css({height:"100%",width:"100%"});if(f){f=f.css({position:"absolute"})[0];for(var w in {Top:1,Left:1}){f.style.setExpression(w.toLowerCase(),"(_=(document.documentElement.scroll"+w+" || document.body.scroll"+w+"))+'px'")}}}if(q.ajax){var e=q.target||p.w,x=q.ajax;e=(typeof e=="string")?d(e,p.w):d(e);x=(x.substr(0,1)=="@")?d(A).attr(x.substring(1)):x;e.html(q.ajaxText).load(x,function(){if(q.onLoad){q.onLoad.call(this,p)}if(m){p.w.jqmAddClose(d(m,p.w))}h(p)})}else{if(m){p.w.jqmAddClose(d(m,p.w))}}if(q.toTop&&p.o){p.w.before('<span id="jqmP'+p.w[0]._jqm+'"></span>').insertAfter(p.o)}(q.onShow)?q.onShow(p):p.w.show();h(p);return n},close:function(f){var e=l[f];if(!e.a){return n}e.a=n;if(a[0]){a.pop();if(!a[0]){j("unbind")}}if(e.c.toTop&&e.o){d("#jqmP"+e.w[0]._jqm).after(e.w).remove()}if(e.c.onHide){e.c.onHide(e)}else{e.w.hide();if(e.o){e.o.remove()}}return n},params:{}};var o=0,l=d.jqm.hash,a=[],c=d.browser.msie&&(d.browser.version=="6.0"),n=false,h=function(f){var e=d('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(c){if(f.o){f.o.html('<p style="width:100%;height:100%"/>').prepend(e)}else{if(!d("iframe.jqm",f.w)[0]){f.w.prepend(e)}}}g(f)},g=function(f){try{d(":input:visible",f.w)[0].focus()}catch(e){}},j=function(e){d()[e]("keypress",b)[e]("keydown",b)[e]("mousedown",b)},b=function(p){var f=l[a[a.length-1]],m=(!d(p.target).parents(".jqmID"+f.s)[0]);if(m){g(f)}return !m},k=function(e,f,m){return e.each(function(){var p=this._jqm;d(f).each(function(){if(!this[m]){this[m]=[];d(this).click(function(){for(var q in {jqmShow:1,jqmHide:1}){for(var r in this[q]){if(l[this[q][r]]){l[this[q][r]].w[q](this)}}}return n})}this[m].push(p)})})}})(jQuery);(function(c){c.fmatter={};c.fn.fmatter=function(g,h,f,d,e){f=c.extend({},c.jgrid.formatter,f);return a(g,h,f,d,e)};c.fmatter.util={NumberFormat:function(f,d){if(!isNumber(f)){f*=1}if(isNumber(f)){var h=(f<0);var n=f+"";var k=(d.decimalSeparator)?d.decimalSeparator:".";var l;if(isNumber(d.decimalPlaces)){var m=d.decimalPlaces;var g=Math.pow(10,m);n=Math.round(f*g)/g+"";l=n.lastIndexOf(".");if(m>0){if(l<0){n+=k;l=n.length-1}else{if(k!=="."){n=n.replace(".",k)}}while((n.length-1-l)<m){n+="0"}}}if(d.thousandsSeparator){var p=d.thousandsSeparator;l=n.lastIndexOf(k);l=(l>-1)?l:n.length;var o=n.substring(l);var e=-1;for(var j=l;j>0;j--){e++;if((e%3===0)&&(j!==l)&&(!h||(j>1))){o=p+o}o=n.charAt(j-1)+o}n=o}n=(d.prefix)?d.prefix+n:n;n=(d.suffix)?n+d.suffix:n;return n}else{return f}},DateFormat:function(I,L,O,x){var m=/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,C=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,K=/[^-+\dA-Z]/g,J=function(k,j){k=String(k);j=parseInt(j)||2;while(k.length<j){k="0"+k}return k},d={m:1,d:1,y:1970,h:0,i:0,s:0},g=0,q,E,f,D=["i18n"];D.i18n={dayNames:x.dayNames,monthNames:x.monthNames};if(I in x.masks){I=x.masks[I]}L=L.split(/[\\\/:_;.\t\T\s-]/);I=I.split(/[\\\/:_;.\t\T\s-]/);for(E=0,f=I.length;E<f;E++){if(I[E]=="M"){q=c.inArray(L[E],D.i18n.monthNames);if(q!==-1&&q<12){L[E]=q+1}}if(I[E]=="F"){q=c.inArray(L[E],D.i18n.monthNames);if(q!==-1&&q>11){L[E]=q+1-12}}d[I[E].toLowerCase()]=parseInt(L[E],10)}d.m=parseInt(d.m)-1;var M=d.y;if(M>=70&&M<=99){d.y=1900+d.y}else{if(M>=0&&M<=69){d.y=2000+d.y}}g=new Date(d.y,d.m,d.d,d.h,d.i,d.s,0);if(O in x.masks){O=x.masks[O]}else{if(!O){O="Y-m-d"}}var t=g.getHours(),H=g.getMinutes(),F=g.getDate(),B=g.getMonth()+1,A=g.getTimezoneOffset(),y=g.getSeconds(),v=g.getMilliseconds(),r=g.getDay(),e=g.getFullYear(),l=(r+6)%7+1,p=(new Date(e,B-1,F)-new Date(e,0,1))/86400000,h={d:J(F),D:D.i18n.dayNames[r],j:F,l:D.i18n.dayNames[r+7],N:l,S:x.S(F),w:r,z:p,W:l<5?Math.floor((p+l-1)/7)+1:Math.floor((p+l-1)/7)||((new Date(e-1,0,1).getDay()+6)%7<4?53:52),F:D.i18n.monthNames[B-1+12],m:J(B),M:D.i18n.monthNames[B-1],n:B,t:"?",L:"?",o:"?",Y:e,y:String(e).substring(2),a:t<12?x.AmPm[0]:x.AmPm[1],A:t<12?x.AmPm[2]:x.AmPm[3],B:"?",g:t%12||12,G:t,h:J(t%12||12),H:J(t),i:J(H),s:J(y),u:v,e:"?",I:"?",O:(A>0?"-":"+")+J(Math.floor(Math.abs(A)/60)*100+Math.abs(A)%60,4),P:"?",T:(String(g).match(C)||[""]).pop().replace(K,""),Z:"?",c:"?",r:"?",U:Math.floor(g/1000)};return O.replace(m,function(j){return j in h?h[j]:j.substring(1)})}};c.fn.fmatter.defaultFormat=function(e,d){return(isValue(e)&&e!=="")?e:d.defaultValue?d.defaultValue:"&#160;"};c.fn.fmatter.email=function(e,d){if(!isEmpty(e)){return'<a href="mailto:'+e+'">'+e+"</a>"}else{return c.fn.fmatter.defaultFormat(e,d)}};c.fn.fmatter.checkbox=function(g,e){var h=c.extend({},e.checkbox),f;if(!isUndefined(e.colModel.formatoptions)){h=c.extend({},h,e.colModel.formatoptions)}if(h.disabled===true){f="disabled"}else{f=""}if(isEmpty(g)||isUndefined(g)){g=c.fn.fmatter.defaultFormat(g,h)}g=g+"";g=g.toLowerCase();var d=g.search(/(false|0|no|off)/i)<0?" checked='checked' ":"";return'<input type="checkbox" '+d+' value="'+g+'" offval="no" '+f+"/>"},c.fn.fmatter.link=function(f,d){var g={target:d.target};var e="";if(!isUndefined(d.colModel.formatoptions)){g=c.extend({},g,d.colModel.formatoptions)}if(g.target){e="target="+g.target}if(!isEmpty(f)){return"<a "+e+' href="'+f+'">'+f+"</a>"}else{return c.fn.fmatter.defaultFormat(f,d)}};c.fn.fmatter.showlink=function(f,d){var g={baseLinkUrl:d.baseLinkUrl,showAction:d.showAction,addParam:d.addParam||"",target:d.target,idName:d.idName},e="";if(!isUndefined(d.colModel.formatoptions)){g=c.extend({},g,d.colModel.formatoptions)}if(g.target){e="target="+g.target}idUrl=g.baseLinkUrl+g.showAction+"?"+g.idName+"="+d.rowId+g.addParam;if(isString(f)){return"<a "+e+' href="'+idUrl+'">'+f+"</a>"}else{return c.fn.fmatter.defaultFormat(f,d)}};c.fn.fmatter.integer=function(e,d){var f=c.extend({},d.integer);if(!isUndefined(d.colModel.formatoptions)){f=c.extend({},f,d.colModel.formatoptions)}if(isEmpty(e)){return f.defaultValue}return c.fmatter.util.NumberFormat(e,f)};c.fn.fmatter.number=function(e,d){var f=c.extend({},d.number);if(!isUndefined(d.colModel.formatoptions)){f=c.extend({},f,d.colModel.formatoptions)}if(isEmpty(e)){return f.defaultValue}return c.fmatter.util.NumberFormat(e,f)};c.fn.fmatter.currency=function(e,d){var f=c.extend({},d.currency);if(!isUndefined(d.colModel.formatoptions)){f=c.extend({},f,d.colModel.formatoptions)}if(isEmpty(e)){return f.defaultValue}return c.fmatter.util.NumberFormat(e,f)};c.fn.fmatter.date=function(f,e,d){var g=c.extend({},e.date);if(!isUndefined(e.colModel.formatoptions)){g=c.extend({},g,e.colModel.formatoptions)}if(!g.reformatAfterEdit&&d=="edit"){return c.fn.fmatter.defaultFormat(f,e)}else{if(!isEmpty(f)){return c.fmatter.util.DateFormat(g.srcformat,f,g.newformat,g)}else{return c.fn.fmatter.defaultFormat(f,e)}}};c.fn.fmatter.select=function(h,d,m){h=h+"";var f=false,l=[];if(!isUndefined(d.colModel.editoptions)){f=d.colModel.editoptions.value}if(f){var p=d.colModel.editoptions.multiple===true?true:false,n=[],o;if(p){n=h.split(",");n=c.map(n,function(j){return c.trim(j)})}if(isString(f)){var e=f.split(";"),g=0;for(var k=0;k<e.length;k++){o=e[k].split(":");if(p){if(jQuery.inArray(o[0],n)>-1){l[g]=o[1];g++}}else{if(c.trim(o[0])==c.trim(h)){l[0]=o[1];break}}}}else{if(isObject(f)){if(p){l=jQuery.map(n,function(q,j){return f[q]})}else{l[0]=f[h]||""}}}}h=l.join(", ");return h==""?c.fn.fmatter.defaultFormat(h,d):h};c.unformat=function(g,o,l,e){var k,h=o.colModel.formatter,j=o.colModel.formatoptions||{},p,n=/([\.\*\_\'\(\)\{\}\+\?\\])/g;unformatFunc=o.colModel.unformat||(c.fn.fmatter[h]&&c.fn.fmatter[h].unformat);if(typeof unformatFunc!=="undefined"&&isFunction(unformatFunc)){k=unformatFunc(c(g).text(),o,g)}else{if(typeof h!=="undefined"&&isString(h)){var d=c.jgrid.formatter||{},m;switch(h){case"integer":j=c.extend({},d.integer,j);p=j.thousandsSeparator.replace(n,"\\$1");m=new RegExp(p,"g");k=c(g).text().replace(m,"");break;case"number":j=c.extend({},d.number,j);p=j.thousandsSeparator.replace(n,"\\$1");m=new RegExp(p,"g");k=c(g).text().replace(m,"").replace(j.decimalSeparator,".");break;case"currency":j=c.extend({},d.currency,j);p=j.thousandsSeparator.replace(n,"\\$1");m=new RegExp(p,"g");k=c(g).text().replace(m,"").replace(j.decimalSeparator,".").replace(j.prefix,"").replace(j.suffix,"");break;case"checkbox":var f=(o.colModel.editoptions)?o.colModel.editoptions.value.split(":"):["Yes","No"];k=c("input",g).attr("checked")?f[0]:f[1];break;case"select":k=c.unformat.select(g,o,l,e);break;default:k=c(g).text();break}}}return k?k:e===true?c(g).text():c.jgrid.htmlDecode(c(g).html())};c.unformat.select=function(h,s,n,e){var m=[];var q=c(h).text();if(e==true){return q}var l=c.extend({},s.colModel.editoptions);if(l.value){var f=l.value,r=l.multiple===true?true:false,p=[],o;if(r){p=q.split(",");p=c.map(p,function(j){return c.trim(j)})}if(isString(f)){var d=f.split(";"),g=0;for(var k=0;k<d.length;k++){o=d[k].split(":");if(r){if(jQuery.inArray(o[1],p)>-1){m[g]=o[0];g++}}else{if(c.trim(o[1])==c.trim(q)){m[0]=o[0];break}}}}else{if(isObject(f)){if(!r){p[0]=q}m=jQuery.map(p,function(t){var j;c.each(f,function(u,v){if(v==t){j=u;return false}});if(j){return j}})}}return m.join(", ")}else{return q||""}};function a(h,j,g,d,e){h=h.toLowerCase();var f=j;if(c.fn.fmatter[h]){f=c.fn.fmatter[h](j,g,e)}return f}function b(d){if(window.console&&window.console.log){window.console.log(d)}}isValue=function(d){return(isObject(d)||isString(d)||isNumber(d)||isBoolean(d))};isBoolean=function(d){return typeof d==="boolean"};isNull=function(d){return d===null};isNumber=function(d){return typeof d==="number"&&isFinite(d)};isString=function(d){return typeof d==="string"};isEmpty=function(d){if(!isString(d)&&isValue(d)){return false}else{if(!isValue(d)){return true}}d=c.trim(d).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return d===""};isUndefined=function(d){return typeof d==="undefined"};isObject=function(d){return(d&&(typeof d==="object"||isFunction(d)))||false};isFunction=function(d){return typeof d==="function"}})(jQuery);jQuery.fn.searchFilter=function(a,c){function b(k,q,g){this.$=k;this.add=function(A){if(A==null){k.find(".ui-add-last").click()}else{k.find(".sf:eq("+A+") .ui-add").click()}return this};this.del=function(A){if(A==null){k.find(".sf:last .ui-del").click()}else{k.find(".sf:eq("+A+") .ui-del").click()}return this};this.search=function(A){k.find(".ui-search").click();return this};this.reset=function(A){k.find(".ui-reset").click();return this};this.close=function(){k.find(".ui-closer").click();return this};if(q!=null){function w(){jQuery(this).toggleClass("ui-state-hover");return false}function j(A){jQuery(this).toggleClass("ui-state-active",(A.type=="mousedown"));return false}function e(A,B){return"<option value='"+A+"'>"+B+"</option>"}function t(C,A,B){return"<select class='"+C+"'"+(B?" style='display:none;'":"")+">"+A+"</select>"}function x(A,C){var B=k.find("tr.sf td.data "+A);if(B[0]!=null){C(B)}}function r(A,C){var B=k.find("tr.sf td.data "+A);if(B[0]!=null){jQuery.each(C,function(){if(this.data!=null){B.bind(this.type,this.data,this.fn)}else{B.bind(this.type,this.fn)}})}}var o=jQuery.extend({},jQuery.fn.searchFilter.defaults,g);var z=-1;var y="";jQuery.each(o.groupOps,function(){y+=e(this.op,this.text)});y="<select name='groupOp'>"+y+"</select>";k.html("").addClass("ui-searchFilter").append("<div class='ui-widget-overlay' style='z-index: -1'>&nbsp;</div><table class='ui-widget-content ui-corner-all'><thead><tr><td colspan='5' class='ui-widget-header ui-corner-all' style='line-height: 18px;'><div class='ui-closer ui-state-default ui-corner-all ui-helper-clearfix' style='float: right;'><span class='ui-icon ui-icon-close'></span></div>"+o.windowTitle+"</td></tr></thead><tbody><tr class='sf'><td class='fields'></td><td class='ops'></td><td class='data'></td><td><div class='ui-del ui-state-default ui-corner-all'><span class='ui-icon ui-icon-minus'></span></div></td><td><div class='ui-add ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plus'></span></div></td></tr><tr><td colspan='5' class='divider'><div>&nbsp;</div></td></tr></tbody><tfoot><tr><td colspan='3'><span class='ui-reset ui-state-default ui-corner-all' style='display: inline-block; float: left;'><span class='ui-icon ui-icon-arrowreturnthick-1-w' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>"+o.resetText+"</span></span><span class='ui-search ui-state-default ui-corner-all' style='display: inline-block; float: right;'><span class='ui-icon ui-icon-search' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>"+o.searchText+"</span></span><span class='matchText'>"+o.matchText+"</span> "+y+" <span class='rulesText'>"+o.rulesText+"</span></td><td>&nbsp;</td><td><div class='ui-add-last ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plusthick'></span></div></td></tr></tfoot></table>");var l=k.find("tr.sf");var h=l.find("td.fields");var f=l.find("td.ops");var p=l.find("td.data");var s="";jQuery.each(o.operators,function(){s+=e(this.op,this.text)});s=t("default",s,true);f.append(s);var m="<input type='text' class='default' style='display:none;' />";p.append(m);var v="";var u=false;var d=false;jQuery.each(q,function(D){var C=D;v+=e(this.value,this.text);if(this.ops!=null){u=true;var A="";jQuery.each(this.ops,function(){A+=e(this.op,this.text)});A=t("field"+C,A,true);f.append(A)}if(this.dataUrl!=null){if(D>z){z=D}d=true;var G=this.dataEvents;var E=this.dataInit;var B=this.buildSelect;jQuery.ajax(jQuery.extend({url:this.dataUrl,complete:function(I){var H;if(B!=null){H=jQuery("<div />").append(B(I))}else{H=jQuery("<div />").append(I.responseText)}H.find("select").addClass("field"+C).hide();p.append(H.html());if(E){x(".field"+D,E)}if(G){r(".field"+D,G)}if(D==z){k.find("tr.sf td.fields select[name='field']").change()}}},o.ajaxSelectOptions))}else{if(this.dataValues!=null){d=true;var F="";jQuery.each(this.dataValues,function(){F+=e(this.value,this.text)});F=t("field"+C,F,true);p.append(F)}else{if(this.dataEvents!=null||this.dataInit!=null){d=true;var F="<input type='text' class='field"+C+"' />";p.append(F)}}}if(this.dataInit!=null&&D!=z){x(".field"+D,this.dataInit)}if(this.dataEvents!=null&&D!=z){r(".field"+D,this.dataEvents)}});v="<select name='field'>"+v+"</select>";h.append(v);var n=h.find("select[name='field']");if(u){n.change(function(C){var B=C.target.selectedIndex;var D=jQuery(C.target).parents("tr.sf").find("td.ops");D.find("select").removeAttr("name").hide();var A=D.find(".field"+B);if(A[0]==null){A=D.find(".default")}A.attr("name","op").show()})}else{f.find(".default").attr("name","op").show()}if(d){n.change(function(C){var B=C.target.selectedIndex;var D=jQuery(C.target).parents("tr.sf").find("td.data");D.find("select,input").removeClass("vdata").hide();var A=D.find(".field"+B);if(A[0]==null){A=D.find(".default")}A.show().addClass("vdata")})}else{p.find(".default").show().addClass("vdata")}if(u||d){n.change()}k.find(".ui-state-default").hover(w,w).mousedown(j).mouseup(j);k.find(".ui-closer").click(function(A){o.onClose(jQuery(k.selector));return false});k.find(".ui-del").click(function(A){var B=jQuery(A.target).parents(".sf");if(B.siblings(".sf").length>0){if(o.datepickerFix===true&&jQuery.fn.datepicker!==undefined){B.find(".hasDatepicker").datepicker("destroy")}B.remove()}else{B.find("select[name='field']")[0].selectedIndex=0;B.find("select[name='op']")[0].selectedIndex=0;B.find(".data input").val("");B.find(".data select").each(function(){this.selectedIndex=0});B.find("select[name='field']").change()}return false});k.find(".ui-add").click(function(D){var E=jQuery(D.target).parents(".sf");var C=E.clone(true).insertAfter(E);C.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");if(o.clone){C.find("select[name='field']")[0].selectedIndex=E.find("select[name='field']")[0].selectedIndex;var B=(C.find("select[name='op']")[0]==null);if(!B){C.find("select[name='op']").focus()[0].selectedIndex=E.find("select[name='op']")[0].selectedIndex}var A=C.find("select.vdata");if(A[0]!=null){A[0].selectedIndex=E.find("select.vdata")[0].selectedIndex}}else{C.find(".data input").val("");C.find("select[name='field']").focus()}if(o.datepickerFix===true&&jQuery.fn.datepicker!==undefined){E.find(".hasDatepicker").each(function(){var F=jQuery.data(this,"datepicker").settings;C.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(F)})}C.find("select[name='field']").change();return false});k.find(".ui-search").click(function(D){var C=jQuery(k.selector);var A;var B=C.find("select[name='groupOp'] :selected").val();if(!o.stringResult){A={groupOp:B,rules:[]}}else{A='{"groupOp":"'+B+'","rules":['}C.find(".sf").each(function(E){var H=jQuery(this).find("select[name='field'] :selected").val();var G=jQuery(this).find("select[name='op'] :selected").val();var F=jQuery(this).find("input.vdata,select.vdata :selected").val();if(!o.stringResult){A.rules.push({field:H,op:G,data:F})}else{if(E>0){A+=","}A+='{"field":"'+H+'",';A+='"op":"'+G+'",';A+='"data":"'+F+'"}'}});if(o.stringResult){A+="]}"}o.onSearch(A);return false});k.find(".ui-reset").click(function(B){var A=jQuery(k.selector);A.find(".ui-del").click();A.find("select[name='groupOp']")[0].selectedIndex=0;o.onReset();return false});k.find(".ui-add-last").click(function(){var B=jQuery(k.selector+" .sf:last");var A=B.clone(true).insertAfter(B);A.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");A.find(".data input").val("");A.find("select[name='field']").focus();if(o.datepickerFix===true&&jQuery.fn.datepicker!==undefined){B.find(".hasDatepicker").each(function(){var C=jQuery.data(this,"datepicker").settings;A.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(C)})}A.find("select[name='field']").change();return false})}}return new b(this,a,c)};jQuery.fn.searchFilter.version="1.2.9";jQuery.fn.searchFilter.defaults={clone:true,datepickerFix:true,onReset:function(a){alert("Reset Clicked. Data Returned: "+a)},onSearch:function(a){alert("Search Clicked. Data Returned: "+a)},onClose:function(a){a.hide()},groupOps:[{op:"AND",text:"all"},{op:"OR",text:"any"}],operators:[{op:"eq",text:"is equal to"},{op:"ne",text:"is not equal to"},{op:"lt",text:"is less than"},{op:"le",text:"is less or equal to"},{op:"gt",text:"is greater than"},{op:"ge",text:"is greater or equal to"},{op:"in",text:"is in"},{op:"ni",text:"is not in"},{op:"bw",text:"begins with"},{op:"bn",text:"does not begin with"},{op:"ew",text:"ends with"},{op:"en",text:"does not end with"},{op:"cn",text:"contains"},{op:"nc",text:"does not contain"}],matchText:"match",rulesText:"rules",resetText:"Reset",searchText:"Search",stringResult:true,windowTitle:"Search Rules",ajaxSelectOptions:{}};var xmlJsonClass={xml2json:function(b,d){if(b.nodeType===9){b=b.documentElement}var a=this.removeWhite(b);var e=this.toObj(a);var c=this.toJson(e,b.nodeName,"\t");return"{\n"+d+(d?c.replace(/\t/g,d):c.replace(/\t|\n/g,""))+"\n}"},json2xml:function(d,c){var e=function(q,f,h){var o="";var l,g;if(q instanceof Array){if(q.length===0){o+=h+"<"+f+">__EMPTY_ARRAY_</"+f+">\n"}else{for(l=0,g=q.length;l<g;l+=1){var p=h+e(q[l],f,h+"\t")+"\n";o+=p}}}else{if(typeof(q)==="object"){var k=false;o+=h+"<"+f;var j;for(j in q){if(q.hasOwnProperty(j)){if(j.charAt(0)==="@"){o+=" "+j.substr(1)+'="'+q[j].toString()+'"'}else{k=true}}}o+=k?">":"/>";if(k){for(j in q){if(q.hasOwnProperty(j)){if(j==="#text"){o+=q[j]}else{if(j==="#cdata"){o+="<![CDATA["+q[j]+"]]>"}else{if(j.charAt(0)!=="@"){o+=e(q[j],j,h+"\t")}}}}}o+=(o.charAt(o.length-1)==="\n"?h:"")+"</"+f+">"}}else{if(typeof(q)==="function"){o+=h+"<"+f+"><![CDATA["+q+"]]></"+f+">"}else{if(q.toString()==='""'||q.toString().length===0){o+=h+"<"+f+">__EMPTY_STRING_</"+f+">"}else{o+=h+"<"+f+">"+q.toString()+"</"+f+">"}}}}return o};var b="";var a;for(a in d){if(d.hasOwnProperty(a)){b+=e(d[a],a,"")}}return c?b.replace(/\t/g,c):b.replace(/\t|\n/g,"")},toObj:function(b){var g={};var f=/function/i;if(b.nodeType===1){if(b.attributes.length){var e;for(e=0;e<b.attributes.length;e+=1){g["@"+b.attributes[e].nodeName]=(b.attributes[e].nodeValue||"").toString()}}if(b.firstChild){var a=0,d=0,c=false;var h;for(h=b.firstChild;h;h=h.nextSibling){if(h.nodeType===1){c=true}else{if(h.nodeType===3&&h.nodeValue.match(/[^ \f\n\r\t\v]/)){a+=1}else{if(h.nodeType===4){d+=1}}}}if(c){if(a<2&&d<2){this.removeWhite(b);for(h=b.firstChild;h;h=h.nextSibling){if(h.nodeType===3){g["#text"]=this.escape(h.nodeValue)}else{if(h.nodeType===4){if(f.test(h.nodeValue)){g[h.nodeName]=[g[h.nodeName],h.nodeValue]}else{g["#cdata"]=this.escape(h.nodeValue)}}else{if(g[h.nodeName]){if(g[h.nodeName] instanceof Array){g[h.nodeName][g[h.nodeName].length]=this.toObj(h)}else{g[h.nodeName]=[g[h.nodeName],this.toObj(h)]}}else{g[h.nodeName]=this.toObj(h)}}}}}else{if(!b.attributes.length){g=this.escape(this.innerXml(b))}else{g["#text"]=this.escape(this.innerXml(b))}}}else{if(a){if(!b.attributes.length){g=this.escape(this.innerXml(b));if(g==="__EMPTY_ARRAY_"){g="[]"}else{if(g==="__EMPTY_STRING_"){g=""}}}else{g["#text"]=this.escape(this.innerXml(b))}}else{if(d){if(d>1){g=this.escape(this.innerXml(b))}else{for(h=b.firstChild;h;h=h.nextSibling){if(f.test(b.firstChild.nodeValue)){g=b.firstChild.nodeValue;break}else{g["#cdata"]=this.escape(h.nodeValue)}}}}}}}if(!b.attributes.length&&!b.firstChild){g=null}}else{if(b.nodeType===9){g=this.toObj(b.documentElement)}else{alert("unhandled node type: "+b.nodeType)}}return g},toJson:function(b,a,d){var l=a?('"'+a+'"'):"";if(b==="[]"){l+=(a?":[]":"[]")}else{if(b instanceof Array){var c,h,f=[];for(h=0,c=b.length;h<c;h+=1){f[h]=this.toJson(b[h],"",d+"\t")}l+=(a?":[":"[")+(f.length>1?("\n"+d+"\t"+f.join(",\n"+d+"\t")+"\n"+d):f.join(""))+"]"}else{if(b===null){l+=(a&&":")+"null"}else{if(typeof(b)==="object"){var j=[];var e;for(e in b){if(b.hasOwnProperty(e)){j[j.length]=this.toJson(b[e],e,d+"\t")}}l+=(a?":{":"{")+(j.length>1?("\n"+d+"\t"+j.join(",\n"+d+"\t")+"\n"+d):j.join(""))+"}"}else{if(typeof(b)==="string"){var k=/(^-?\d+\.?\d*$)/;var p=/function/i;var g=b.toString();if(k.test(g)||p.test(g)||g==="false"||g==="true"){l+=(a&&":")+g}else{l+=(a&&":")+'"'+b+'"'}}else{l+=(a&&":")+b.toString()}}}}}return l},innerXml:function(d){var b="";if("innerHTML" in d){b=d.innerHTML}else{var a=function(j){var g="",f;if(j.nodeType===1){g+="<"+j.nodeName;for(f=0;f<j.attributes.length;f+=1){g+=" "+j.attributes[f].nodeName+'="'+(j.attributes[f].nodeValue||"").toString()+'"'}if(j.firstChild){g+=">";for(var h=j.firstChild;h;h=h.nextSibling){g+=a(h)}g+="</"+j.nodeName+">"}else{g+="/>"}}else{if(j.nodeType===3){g+=j.nodeValue}else{if(j.nodeType===4){g+="<![CDATA["+j.nodeValue+"]]>"}}}return g};for(var e=d.firstChild;e;e=e.nextSibling){b+=a(e)}}return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(b){b.normalize();var c;for(c=b.firstChild;c;){if(c.nodeType===3){if(!c.nodeValue.match(/[^ \f\n\r\t\v]/)){var a=c.nextSibling;b.removeChild(c);c=a}else{c=c.nextSibling}}else{if(c.nodeType===1){this.removeWhite(c);c=c.nextSibling}else{c=c.nextSibling}}}return b}};(function(f){var a,k,c,h,e,b;var d={menuStyle:{listStyle:"none",padding:"1px",margin:"0px",backgroundColor:"#fff",border:"1px solid #999",width:"100px"},itemStyle:{margin:"0px",color:"#000",display:"block",cursor:"default",padding:"3px",border:"1px solid #fff",backgroundColor:"transparent"},itemHoverStyle:{border:"1px solid #0a246a",backgroundColor:"#b6bdd2"},eventPosX:"pageX",eventPosY:"pageY",shadow:true,onContextMenu:null,onShowMenu:null};f.fn.contextMenu=function(n,m){if(!a){a=f('<div id="jqContextMenu"></div>').hide().css({position:"absolute",zIndex:"500"}).appendTo("body").bind("click",function(o){o.stopPropagation()})}if(!k){k=f("<div></div>").css({backgroundColor:"#000",position:"absolute",opacity:0.2,zIndex:499}).appendTo("body").hide()}e=e||[];e.push({id:n,menuStyle:f.extend({},d.menuStyle,m.menuStyle||{}),itemStyle:f.extend({},d.itemStyle,m.itemStyle||{}),itemHoverStyle:f.extend({},d.itemHoverStyle,m.itemHoverStyle||{}),bindings:m.bindings||{},shadow:m.shadow||m.shadow===false?m.shadow:d.shadow,onContextMenu:m.onContextMenu||d.onContextMenu,onShowMenu:m.onShowMenu||d.onShowMenu,eventPosX:m.eventPosX||d.eventPosX,eventPosY:m.eventPosY||d.eventPosY});var l=e.length-1;f(this).bind("contextmenu",function(p){var o=(!!e[l].onContextMenu)?e[l].onContextMenu(p):true;if(o){j(l,this,p,m)}return false});return this};function j(n,m,o,l){var p=e[n];h=f("#"+p.id).find("ul:first").clone(true);h.css(p.menuStyle).find("li").css(p.itemStyle).hover(function(){f(this).css(p.itemHoverStyle)},function(){f(this).css(p.itemStyle)}).find("img").css({verticalAlign:"middle",paddingRight:"2px"});a.html(h);if(!!p.onShowMenu){a=p.onShowMenu(o,a)}f.each(p.bindings,function(r,q){f("#"+r,a).bind("click",function(s){g();q(m,b)})});a.css({left:o[p.eventPosX],top:o[p.eventPosY]}).show();if(p.shadow){k.css({width:a.width(),height:a.height(),left:o.pageX+2,top:o.pageY+2}).show()}f(document).one("click",g)}function g(){a.hide();k.hide()}f.contextMenu={defaults:function(l){f.each(l,function(m,n){if(typeof n=="object"&&d[m]){f.extend(d[m],n)}else{d[m]=n}})}}})(jQuery);$(function(){$("div.contextMenu").hide()});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(c){var b=c.tableDnDConfig;if(c.tableDnDConfig.dragHandle){var a=jQuery("td."+c.tableDnDConfig.dragHandle,c);a.each(function(){jQuery(this).mousedown(function(e){jQuery.tableDnD.dragObject=this.parentNode;jQuery.tableDnD.currentTable=c;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,e);if(b.onDragStart){b.onDragStart(c,this)}return false})})}else{var d=jQuery("tr",c);d.each(function(){var e=jQuery(this);if(!e.hasClass("nodrag")){e.mousedown(function(f){if(f.target.tagName=="TD"){jQuery.tableDnD.dragObject=this;jQuery.tableDnD.currentTable=c;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,f);if(b.onDragStart){b.onDragStart(c,this)}return false}}).css("cursor","move")}})}},updateTables:function(){this.each(function(){if(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(d,c){c=c||window.event;var b=this.getPosition(d);var a=this.mouseCoords(c);return{x:a.x-b.x,y:a.y-b.y}},getPosition:function(c){var b=0;var a=0;if(c.offsetHeight==0){c=c.firstChild}if(c&&c.offsetParent){while(c.offsetParent){b+=c.offsetLeft;a+=c.offsetTop;c=c.offsetParent}b+=c.offsetLeft;a+=c.offsetTop}return{x:b,y:a}},mousemove:function(g){if(jQuery.tableDnD.dragObject==null){return}var d=jQuery(jQuery.tableDnD.dragObject);var b=jQuery.tableDnD.currentTable.tableDnDConfig;var j=jQuery.tableDnD.mouseCoords(g);var f=j.y-jQuery.tableDnD.mouseOffset.y;var c=window.pageYOffset;if(document.all){if(typeof document.compatMode!="undefined"&&document.compatMode!="BackCompat"){c=document.documentElement.scrollTop}else{if(typeof document.body!="undefined"){c=document.body.scrollTop}}}if(j.y-c<b.scrollAmount){window.scrollBy(0,-b.scrollAmount)}else{var a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;if(a-(j.y-c)<b.scrollAmount){window.scrollBy(0,b.scrollAmount)}}if(f!=jQuery.tableDnD.oldY){var e=f>jQuery.tableDnD.oldY;jQuery.tableDnD.oldY=f;if(b.onDragClass){d.addClass(b.onDragClass)}else{d.css(b.onDragStyle)}var h=jQuery.tableDnD.findDropTargetRow(d,f);if(h){if(e&&jQuery.tableDnD.dragObject!=h){jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,h.nextSibling)}else{if(!e&&jQuery.tableDnD.dragObject!=h){jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,h)}}}}return false},findDropTargetRow:function(f,g){var j=jQuery.tableDnD.currentTable.rows;for(var e=0;e<j.length;e++){var h=j[e];var b=this.getPosition(h).y;var a=parseInt(h.offsetHeight)/2;if(h.offsetHeight==0){b=this.getPosition(h.firstChild).y;a=parseInt(h.firstChild.offsetHeight)/2}if((g>b-a)&&(g<(b+a))){if(h==f){return null}var c=jQuery.tableDnD.currentTable.tableDnDConfig;if(c.onAllowDrop){if(c.onAllowDrop(f,h)){return h}else{return null}}else{var d=jQuery(h).hasClass("nodrop");if(!d){return h}else{return null}}return h}}return null},mouseup:function(c){if(jQuery.tableDnD.currentTable&&jQuery.tableDnD.dragObject){var b=jQuery.tableDnD.dragObject;var a=jQuery.tableDnD.currentTable.tableDnDConfig;if(a.onDragClass){jQuery(b).removeClass(a.onDragClass)}else{jQuery(b).css(a.onDropStyle)}jQuery.tableDnD.dragObject=null;if(a.onDrop){a.onDrop(jQuery.tableDnD.currentTable,b)}jQuery.tableDnD.currentTable=null}},serialize:function(){if(jQuery.tableDnD.currentTable){return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable)}else{return"Error: No Table id set, you need to set an id on your table and every row"}},serializeTable:function(d){var a="";var c=d.id;var e=d.rows;for(var b=0;b<e.length;b++){if(a.length>0){a+="&"}var f=e[b].id;if(f&&f&&d.tableDnDConfig&&d.tableDnDConfig.serializeRegexp){f=f.match(d.tableDnDConfig.serializeRegexp)[0]}a+=c+"[]="+f}return a},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('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);this.count=0;this.selectedContainer=a('<div class="selected"></div>').appendTo(this.container);this.availableContainer=a('<div class="available"></div>').appendTo(this.container);this.selectedActions=a('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+a.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+a.ui.multiselect.locale.removeAll+"</a></div>").appendTo(this.selectedContainer);this.availableActions=a('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+a.ui.multiselect.locale.addAll+"</a></div>").appendTo(this.availableContainer);this.selectedList=a('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return false}).appendTo(this.selectedContainer);this.availableList=a('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return false}).appendTo(this.availableContainer);var b=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"));if(this.options.sortable){a("ul.selected").sortable({placeholder:"ui-state-highlight",axis:"y",update:function(c,d){b.selectedList.find("li").each(function(){if(a(this).data("optionLink")){a(this).data("optionLink").remove().appendTo(b.element)}})},receive:function(c,d){d.item.data("optionLink").attr("selected",true);b.count+=1;b._updateCount();b.selectedList.children(".ui-draggable").each(function(){a(this).removeClass("ui-draggable");a(this).data("optionLink",d.item.data("optionLink"));a(this).data("idx",d.item.data("idx"));b._applyItemState(a(this),true)});setTimeout(function(){d.item.remove()},1)}})}if(this.options.searchable){this._registerSearchEvents(this.availableContainer.find("input.search"))}else{a(".search").hide()}a(".remove-all").click(function(){b._populateLists(b.element.find("option").removeAttr("selected"));return false});a(".add-all").click(function(){b._populateLists(b.element.find("option").attr("selected","selected"));return false})},destroy:function(){this.element.show();this.container.remove();a.widget.prototype.destroy.apply(this,arguments)},_populateLists:function(c){this.selectedList.children(".ui-element").remove();this.availableList.children(".ui-element").remove();this.count=0;var d=this;var b=a(c.map(function(e){var f=d._getOptionNode(this).appendTo(this.selected?d.selectedList:d.availableList).show();if(this.selected){d.count+=1}d._applyItemState(f,this.selected);f.data("idx",e);return f[0]}));this._updateCount()},_updateCount:function(){this.selectedContainer.find("span.count").text(this.count+" "+a.ui.multiselect.locale.itemsCount)},_getOptionNode:function(b){b=a(b);var c=a('<li class="ui-state-default ui-element" title="'+b.text()+'"><span class="ui-icon"/>'+b.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();c.data("optionLink",b);return c},_cloneWithData:function(c){var b=c.clone();b.data("optionLink",c.data("optionLink"));b.data("idx",c.data("idx"));return b},_setSelected:function(k,e){k.data("optionLink").attr("selected",e);if(e){var d=this._cloneWithData(k);k[this.options.hide](this.options.animated,function(){a(this).remove()});d.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);this._applyItemState(d,true);return d}else{var g=this.availableList.find("li"),b=this.options.nodeComparator;var h=null,f=k.data("idx"),j=b(k,a(g[f]));if(j){while(f>=0&&f<g.length){j>0?f++:f--;if(j!=b(k,a(g[f]))){h=g[j>0?f:f+1];break}}}else{h=g[f]}var c=this._cloneWithData(k);h?c.insertBefore(a(h)):c.appendTo(this.availableList);k[this.options.hide](this.options.animated,function(){a(this).remove()});c.hide()[this.options.show](this.options.animated);this._applyItemState(c,false);return c}},_applyItemState:function(c,b){if(b){if(this.options.sortable){c.children("span").addClass("ui-icon-arrowthick-2-n-s").removeClass("ui-helper-hidden").addClass("ui-icon")}else{c.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon")}c.find("a.action span").addClass("ui-icon-minus").removeClass("ui-icon-plus");this._registerRemoveEvents(c.find("a.action"))}else{c.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon");c.find("a.action span").addClass("ui-icon-plus").removeClass("ui-icon-minus");this._registerAddEvents(c.find("a.action"))}this._registerHoverEvents(c)},_filter:function(f){var c=a(this);var e=f.children("li"),b=e.map(function(){return a(this).text().toLowerCase()});var d=a.trim(c.val().toLowerCase()),g=[];if(!d){e.show()}else{e.hide();b.each(function(h){if(this.indexOf(d)>-1){g.push(h)}});a.each(g,function(){a(e[this]).show()})}},_registerHoverEvents:function(b){b.removeClass("ui-state-hover");b.mouseover(function(){a(this).addClass("ui-state-hover")});b.mouseout(function(){a(this).removeClass("ui-state-hover")})},_registerAddEvents:function(c){var b=this;c.click(function(){var d=b._setSelected(a(this).parent(),true);b.count+=1;b._updateCount();return false}).each(function(){a(this).parent().draggable({connectToSortable:"ul.selected",helper:function(){var d=b._cloneWithData(a(this)).width(a(this).width()-50);d.width(a(this).width());return d},appendTo:".ui-multiselect",containment:".ui-multiselect",revert:"invalid"})})},_registerRemoveEvents:function(c){var b=this;c.click(function(){b._setSelected(a(this).parent(),false);b.count-=1;b._updateCount();return false})},_registerSearchEvents:function(b){var c=this;b.focus(function(){a(this).addClass("ui-state-active")}).blur(function(){a(this).removeClass("ui-state-active")}).keypress(function(d){if(d.keyCode==13){return false}}).keyup(function(){c._filter.apply(this,[c.availableList])})}});a.extend(a.ui.multiselect,{defaults:{sortable:true,searchable:true,animated:"fast",show:"slideDown",hide:"slideUp",dividerLocation:0.6,nodeComparator:function(c,b){var e=c.text(),d=b.text();return e==d?0:(e<d?-1:1)}},locale:{addAll:"Add all",removeAll:"Remove all",itemsCount:"items selected"}})})(jQuery);
@@ -1,580 +1,745 @@
1
- // Generated by compass-jquery-plugin/gem-tasks/jqgrid.rake
2
-
3
- .ui-jqgrid
4
- position: relative
5
- font-size: 11px
6
-
7
- .ui-jqgrid-view
8
- position: relative
9
- left: 0px
10
- top: 0px
11
- padding: .0em
12
-
13
- .ui-jqgrid-titlebar
14
- padding: .3em .2em .2em .3em
15
- position: relative
16
- border-left: 0px none
17
- border-right: 0px none
18
- border-top: 0px none
19
-
20
- .ui-jqgrid-title
21
- float: left
22
- margin: .1em 0 .2em
23
-
24
- .ui-jqgrid-titlebar-close
25
- position: absolute
26
- right: .3em
27
- top: 50%
28
- width: 19px
29
- margin: -10px 0 0 0
30
- padding: 1px
31
- height: 18px
32
-
33
- span
34
- display: block
35
- margin: 1px
36
-
37
- &:hover
38
- padding: 0
39
-
40
- .ui-jqgrid-hdiv
41
- position: relative
42
- margin: 0em
43
- padding: 0em
44
- overflow: hidden
45
- border-left: 0px none !important
46
- border-top: 0px none !important
47
- border-right: 0px none !important
48
-
49
- .ui-jqgrid-hbox
50
- float: left
51
- padding-right: 20px
52
-
53
- .ui-jqgrid-htable
54
- table-layout: fixed
55
- margin: 0em
56
-
57
- th
58
- height: 22px
59
- padding: 0 2px 0 2px
60
-
61
- div
62
- overflow: hidden
63
- position: relative
64
- height: 16px
65
-
66
-
67
- .ui-th-column
68
- overflow: hidden
69
- white-space: nowrap
70
- text-align: center
71
- border-top: 0px none
72
- border-left: 0px none
73
- border-bottom: 0px none
74
-
75
-
76
- .ui-jqgrid
77
- .ui-jqgrid-htable th.ui-th-column
78
- overflow: hidden
79
- white-space: nowrap
80
- text-align: center
81
- border-top: 0px none
82
- border-left: 0px none
83
- border-bottom: 0px none
84
-
85
- .ui-th-div-ie
86
- white-space: nowrap
87
- zoom: 1
88
- height: 17px
89
-
90
- .ui-jqgrid-resize
91
- height: 20px !important
92
- position: relative
93
- cursor: e-resize
94
- cursor: col-resize
95
- float: right
96
- display: inline
97
- margin: -2px -2px -2px 0px
98
- overflow: hidden
99
-
100
- .ui-grid-ico-sort
101
- float: right
102
- overflow: hidden
103
- position: absolute
104
- display: inline
105
- cursor: pointer !important
106
-
107
- .ui-icon-asc
108
- margin-top: -3px
109
- height: 12px
110
-
111
- .ui-icon-desc
112
- margin-top: 3px
113
- height: 12px
114
-
115
- .ui-i-asc
116
- margin-top: 0px
117
- height: 16px
118
-
119
- .ui-i-desc
120
- margin-top: 0px
121
- margin-left: 13px
122
- height: 16px
123
-
124
- .ui-jqgrid-sortable
125
- cursor: pointer
126
-
127
- tr.ui-search-toolbar th
128
- border-top-width: 1px !important
129
- border-top-color: inherit !important
130
- border-top-style: ridge !important
131
-
132
-
133
- tr.ui-search-toolbar
134
- input, select
135
- margin: 1px 0px 0px 0px
136
-
137
-
138
- .ui-jqgrid
139
- .ui-jqgrid-bdiv
140
- position: relative
141
- margin: 0em
142
- padding: 0
143
- overflow: auto
144
-
145
- .ui-jqgrid-btable
146
- table-layout: fixed
147
- margin: 0em
148
-
149
- tr.jqgrow td
150
- border-right-width: 1px
151
- border-right-color: inherit
152
- border-right-style: solid
153
- border-bottom-width: 1px
154
- border-bottom-color: inherit
155
- border-bottom-style: solid
156
- font-weight: normal
157
- overflow: hidden
158
- text-align: left
159
- white-space: pre
160
- height: 22px
161
- padding: 0 2px 0 2px
162
-
163
- td.jqgrid-rownum
164
- padding: 0 2px 0 2px
165
- margin: 0px
166
- border: 0px none
167
-
168
- .ui-jqgrid-resize-mark
169
- width: 2px
170
- left: 0
171
- background-color: #777
172
- cursor: e-resize
173
- cursor: col-resize
174
- position: absolute
175
- top: 0
176
- height: 100px
177
- overflow: hidden
178
- display: none
179
- border: 0 none
180
-
181
- .ui-jqgrid-sdiv
182
- position: relative
183
- margin: 0em
184
- padding: 0em
185
- overflow: hidden
186
- border-left: 0px none !important
187
- border-top: 0px none !important
188
- border-right: 0px none !important
189
-
190
- .ui-jqgrid-ftable
191
- table-layout: fixed
192
- margin-bottom: 0em
193
-
194
- tr.footrow td
195
- border-right-width: 1px
196
- border-right-color: inherit
197
- border-right-style: solid
198
- border-top-width: 1px
199
- border-top-color: inherit
200
- border-top-style: solid
201
- font-weight: bold
202
- overflow: hidden
203
- text-align: left
204
- white-space: nowrap
205
- height: 21px
206
- padding: 0 2px 0 2px
207
-
208
- .ui-jqgrid-pager
209
- border-left: 0px none !important
210
- border-right: 0px none !important
211
- border-bottom: 0px none !important
212
- margin: 0px !important
213
- padding: 0px !important
214
- position: relative
215
- height: 25px
216
- white-space: nowrap
217
- overflow: hidden
218
-
219
- .ui-pager-control
220
- position: relative
221
-
222
- .ui-pg-table
223
- position: relative
224
- padding-bottom: 2px
225
- width: auto
226
- margin: 0em
227
-
228
- td
229
- font-weight: normal
230
- vertical-align: middle
231
- padding: 1px
232
- overflow: hidden
233
-
234
- .ui-pg-button
235
- height: 19px !important
236
-
237
- span
238
- display: block
239
- margin: 1px
240
- float: left
241
-
242
- &:hover
243
- padding: 0px
244
-
245
- .ui-state-disabled:hover
246
- padding: 1px
247
-
248
- .ui-pg-input
249
- height: 13px
250
- font-size: .8em
251
- margin: 0em
252
-
253
- .ui-pg-selbox
254
- font-size: .8em
255
- line-height: 18px
256
- display: block
257
- height: 18px
258
- margin: 0em
259
-
260
- .ui-separator
261
- height: 18px
262
- border-left: 1px solid #ccc
263
- border-right: 1px solid #ccc
264
- margin: 1px
265
- float: right
266
-
267
- .ui-paging-info
268
- font-weight: normal
269
- height: 19px
270
- margin-top: 3px
271
- margin-right: 4px
272
-
273
- .ui-jqgrid-pager .ui-pg-div
274
- padding: 1px 0
275
- cursor: pointer
276
- float: left
277
- list-style-image: none
278
- list-style-position: outside
279
- list-style-type: none
280
- position: relative
281
-
282
- span.ui-icon
283
- float: left
284
- margin: 0 2px
285
-
286
- td
287
- input, select .ui-jqgrid td textarea
288
- margin: 0em
289
-
290
- textarea
291
- width: auto
292
- height: auto
293
-
294
- .ui-jqgrid-btable .ui-sgcollapsed span
295
- display: block
296
-
297
- .ui-subgrid
298
- margin: 0em
299
- padding: 0em
300
- width: 100%
301
-
302
- table
303
- table-layout: fixed
304
-
305
- tr.ui-subtblcell td
306
- height: 18px
307
- border-right-width: 1px
308
- border-right-color: inherit
309
- border-right-style: solid
310
- border-bottom-width: 1px
311
- border-bottom-color: inherit
312
- border-bottom-style: solid
313
-
314
- td.subgrid-data
315
- border-top: 0px none !important
316
-
317
- .loading
318
- position: absolute
319
- top: 45%
320
- left: 45%
321
- width: auto
322
- z-index: 101
323
- padding: 6px
324
- margin: 5px
325
- text-align: center
326
- font-weight: bold
327
- display: none
328
- border-width: 2px !important
329
-
330
- .jqgrid-overlay
331
- display: none
332
- z-index: 100
333
-
334
-
335
- *
336
- html .jqgrid-overlay
337
- width: expression(this.parentNode.offsetWidth+'px')
338
- height: expression(this.parentNode.offsetHeight+'px')
339
-
340
- .jqgrid-overlay iframe
341
- position: absolute
342
- top: 0
343
- left: 0
344
- z-index: -1
345
- width: expression(this.parentNode.offsetWidth+'px')
346
- height: expression(this.parentNode.offsetHeight+'px')
347
-
348
-
349
- .ui-jqgrid .ui-userdata
350
- border-left: 0px none
351
- border-right: 0px none
352
- height: 21px
353
- overflow: hidden
354
-
355
-
356
- .ui-jqdialog
357
- display: none
358
- width: 300px
359
- position: absolute
360
- padding: .2em
361
- font-size: 11px
362
- overflow: visible
363
-
364
- .ui-jqdialog-titlebar
365
- padding: .3em .2em
366
- position: relative
367
-
368
- .ui-jqdialog-title
369
- float: left
370
- margin: .1em 0 .2em
371
-
372
- .ui-jqdialog-titlebar-close
373
- position: absolute
374
- right: .3em
375
- top: 50%
376
- width: 19px
377
- margin: -10px 0 0 0
378
- padding: 1px
379
- height: 18px
380
-
381
- span
382
- display: block
383
- margin: 1px
384
-
385
- &:hover, &:focus
386
- padding: 0
387
-
388
-
389
- .ui-jqdialog-content
390
- border: 0
391
- padding: .3em .2em
392
- background: none
393
- height: auto
394
-
395
-
396
- .ui-jqdialog
397
- .ui-jqdialog-content
398
- border: 0
399
- padding: .3em .2em
400
- background: none
401
- height: auto
402
-
403
- .ui-jqconfirm
404
- padding: .4em 1em
405
- border-width: 3px
406
- position: absolute
407
- bottom: 10px
408
- right: 10px
409
- overflow: visible
410
- display: none
411
- height: 80px
412
- width: 220px
413
- text-align: center
414
-
415
-
416
- .ui-jqdialog-content
417
- .FormGrid
418
- margin: 0px
419
-
420
- .EditTable, .DelTable
421
- width: 100%
422
- margin-bottom: 0em
423
-
424
-
425
- .EditTable td
426
- input, select
427
- margin: 0em
428
-
429
- textarea
430
- margin: 0em
431
- width: auto
432
- height: auto
433
-
434
-
435
- .ui-jqdialog-content
436
- td
437
- &.EditButton
438
- text-align: right
439
- border-width: 1px 0 0 0
440
- background-image: none
441
- padding-bottom: 5px
442
- padding-top: 5px
443
-
444
- &.navButton
445
- text-align: center
446
- border-width: 1px 0 0 0
447
- background-image: none
448
- padding-bottom: 5px
449
- padding-top: 5px
450
-
451
- .CaptionTD
452
- text-align: left
453
- vertical-align: top
454
- border-left: 0px none
455
- border-right: 0px none
456
- border-bottom: 0px none
457
- padding: 1px
458
- white-space: nowrap
459
-
460
- .DataTD
461
- padding: 1px
462
- border-left: 0px none
463
- border-right: 0px none
464
- border-bottom: 0px none
465
- vertical-align: top
466
-
467
-
468
- .fm-button
469
- margin: 0 4px 0 0
470
- padding: .4em .5em
471
- text-decoration: none !important
472
- cursor: pointer
473
- position: relative
474
- text-align: center
475
- zoom: 1
476
-
477
-
478
- .fm-button-icon-left
479
- padding-left: 1.9em
480
-
481
-
482
- .fm-button-icon-right
483
- padding-right: 1.9em
484
-
485
-
486
- .fm-button-icon-left .ui-icon
487
- right: auto
488
- left: .2em
489
- margin-left: 0
490
- position: absolute
491
- top: 50%
492
- margin-top: -8px
493
-
494
-
495
- .fm-button-icon-right .ui-icon
496
- left: auto
497
- right: .2em
498
- margin-left: 0
499
- position: absolute
500
- top: 50%
501
- margin-top: -8px
502
-
503
-
504
- #nData, #pData
505
- float: left
506
- margin: 3px
507
- padding: 0
508
- display: block
509
- width: 15px
510
-
511
-
512
- .ui-jqgrid
513
- .selected-row
514
- font-style: normal
515
- border: 0px none
516
-
517
- td
518
- font-style: normal
519
- border: 0px none
520
-
521
- .tree-wrap
522
- float: left
523
- position: relative
524
- height: 18px
525
- white-space: nowrap
526
- overflow: hidden
527
-
528
- .tree-minus, .tree-plus, .tree-leaf
529
- position: absolute
530
- height: 18px
531
- width: 18px
532
- overflow: hidden
533
-
534
- .treeclick
535
- cursor: pointer
536
-
537
-
538
- .jqmOverlay
539
- background-color: #000
540
-
541
-
542
- * iframe.jqm
543
- position: absolute
544
- top: 0
545
- left: 0
546
- z-index: -1
547
- width: expression(this.parentNode.offsetWidth+'px')
548
- height: expression(this.parentNode.offsetHeight+'px')
549
-
550
-
551
- .ui-searchFilter
552
- display: none
553
- position: absolute
554
- z-index: 100
555
- width: 1px
556
- overflow: visible
557
-
558
-
559
- .ui-searchFilter
560
- table
561
- position: relative
562
- margin: 0em
563
- width: 100%
564
-
565
- td
566
- margin: 0em
567
- padding: 1px
568
-
569
- input, select
570
- margin: 0.1em
571
-
572
- .ui-state-default
573
- cursor: pointer
574
-
575
- .divider
576
- height: 1px
577
-
578
- div
579
- background-color: black
580
- height: 1px
1
+ // Generated by compass-jquery-plugin/gem-tasks/jqgrid.rake
2
+
3
+ .ui-jqgrid
4
+ position: relative
5
+ font-size: 11px
6
+
7
+ .ui-jqgrid-view
8
+ position: relative
9
+ left: 0px
10
+ top: 0px
11
+ padding: .0em
12
+
13
+ .ui-jqgrid-titlebar
14
+ padding: .3em .2em .2em .3em
15
+ position: relative
16
+ border-left: 0px none
17
+ border-right: 0px none
18
+ border-top: 0px none
19
+
20
+ .ui-jqgrid-title
21
+ float: left
22
+ margin: .1em 0 .2em
23
+
24
+ .ui-jqgrid-titlebar-close
25
+ position: absolute
26
+ top: 50%
27
+ width: 19px
28
+ margin: -10px 0 0 0
29
+ padding: 1px
30
+ height: 18px
31
+
32
+ span
33
+ display: block
34
+ margin: 1px
35
+
36
+ &:hover
37
+ padding: 0
38
+
39
+ .ui-jqgrid-hdiv
40
+ position: relative
41
+ margin: 0em
42
+ padding: 0em
43
+ overflow: hidden
44
+ border-left: 0px none !important
45
+ border-top: 0px none !important
46
+ border-right: 0px none !important
47
+
48
+ .ui-jqgrid-hbox
49
+ float: left
50
+ padding-right: 20px
51
+
52
+ .ui-jqgrid-htable
53
+ table-layout: fixed
54
+ margin: 0em
55
+
56
+ th
57
+ height: 22px
58
+ padding: 0 2px 0 2px
59
+
60
+ div
61
+ overflow: hidden
62
+ position: relative
63
+ height: 17px
64
+
65
+
66
+ .ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column
67
+ overflow: hidden
68
+ white-space: nowrap
69
+ text-align: center
70
+ border-top: 0px none
71
+ border-bottom: 0px none
72
+
73
+
74
+ .ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr
75
+ border-left: 0px none
76
+
77
+
78
+ .ui-th-rtl
79
+ border-right: 0px none
80
+
81
+
82
+ .ui-jqgrid
83
+ .ui-jqgrid-htable th.ui-th-rtl
84
+ border-right: 0px none
85
+
86
+ .ui-th-div-ie
87
+ white-space: nowrap
88
+ zoom: 1
89
+ height: 17px
90
+
91
+ .ui-jqgrid-resize
92
+ height: 20px !important
93
+ position: relative
94
+ cursor: e-resize
95
+ display: inline
96
+ overflow: hidden
97
+
98
+ .ui-grid-ico-sort
99
+ overflow: hidden
100
+ position: absolute
101
+ display: inline
102
+ cursor: pointer !important
103
+
104
+ .ui-icon-asc
105
+ margin-top: -3px
106
+ height: 12px
107
+
108
+ .ui-icon-desc
109
+ margin-top: 3px
110
+ height: 12px
111
+
112
+ .ui-i-asc
113
+ margin-top: 0px
114
+ height: 16px
115
+
116
+ .ui-i-desc
117
+ margin-top: 0px
118
+ margin-left: 13px
119
+ height: 16px
120
+
121
+ .ui-jqgrid-sortable
122
+ cursor: pointer
123
+
124
+ tr.ui-search-toolbar th
125
+ border-top-width: 1px !important
126
+ border-top-color: inherit !important
127
+ border-top-style: ridge !important
128
+
129
+
130
+ tr.ui-search-toolbar
131
+ input, select
132
+ margin: 1px 0px 0px 0px
133
+
134
+
135
+ .ui-jqgrid
136
+ .ui-jqgrid-bdiv
137
+ position: relative
138
+ margin: 0em
139
+ padding: 0
140
+ overflow: auto
141
+
142
+ .ui-jqgrid-btable
143
+ table-layout: fixed
144
+ margin: 0em
145
+
146
+ tr
147
+ &.jqgrow td
148
+ font-weight: normal
149
+ overflow: hidden
150
+ white-space: pre
151
+ height: 22px
152
+ padding: 0 2px 0 2px
153
+ border-bottom-width: 1px
154
+ border-bottom-color: inherit
155
+ border-bottom-style: solid
156
+
157
+ &.ui-row-ltr td
158
+ text-align: left
159
+ border-right-width: 1px
160
+ border-right-color: inherit
161
+ border-right-style: solid
162
+
163
+ &.ui-row-rtl td
164
+ text-align: right
165
+ border-left-width: 1px
166
+ border-left-color: inherit
167
+ border-left-style: solid
168
+
169
+ td.jqgrid-rownum
170
+ padding: 0 2px 0 2px
171
+ margin: 0px
172
+ border: 0px none
173
+
174
+ .ui-jqgrid-resize-mark
175
+ width: 2px
176
+ left: 0
177
+ background-color: #777
178
+ cursor: e-resize
179
+ cursor: col-resize
180
+ position: absolute
181
+ top: 0
182
+ height: 100px
183
+ overflow: hidden
184
+ display: none
185
+ border: 0 none
186
+
187
+ .ui-jqgrid-sdiv
188
+ position: relative
189
+ margin: 0em
190
+ padding: 0em
191
+ overflow: hidden
192
+ border-left: 0px none !important
193
+ border-top: 0px none !important
194
+ border-right: 0px none !important
195
+
196
+ .ui-jqgrid-ftable
197
+ table-layout: fixed
198
+ margin-bottom: 0em
199
+
200
+ tr
201
+ &.footrow td
202
+ font-weight: bold
203
+ overflow: hidden
204
+ white-space: nowrap
205
+ height: 21px
206
+ padding: 0 2px 0 2px
207
+ border-top-width: 1px
208
+ border-top-color: inherit
209
+ border-top-style: solid
210
+
211
+ &.footrow-ltr td
212
+ text-align: left
213
+ border-right-width: 1px
214
+ border-right-color: inherit
215
+ border-right-style: solid
216
+
217
+ &.footrow-rtl td
218
+ text-align: right
219
+ border-left-width: 1px
220
+ border-left-color: inherit
221
+ border-left-style: solid
222
+
223
+ .ui-jqgrid-pager
224
+ border-left: 0px none !important
225
+ border-right: 0px none !important
226
+ border-bottom: 0px none !important
227
+ margin: 0px !important
228
+ padding: 0px !important
229
+ position: relative
230
+ height: 25px
231
+ white-space: nowrap
232
+ overflow: hidden
233
+
234
+ .ui-pager-control
235
+ position: relative
236
+
237
+ .ui-pg-table
238
+ position: relative
239
+ padding-bottom: 2px
240
+ width: auto
241
+ margin: 0em
242
+
243
+ td
244
+ font-weight: normal
245
+ vertical-align: middle
246
+ padding: 1px
247
+
248
+ .ui-pg-button
249
+ height: 19px !important
250
+
251
+ span
252
+ display: block
253
+ margin: 1px
254
+ float: left
255
+
256
+ &:hover
257
+ padding: 0px
258
+
259
+ .ui-state-disabled:hover
260
+ padding: 1px
261
+
262
+ .ui-pg-input
263
+ height: 13px
264
+ font-size: .8em
265
+ margin: 0em
266
+
267
+ .ui-pg-selbox
268
+ font-size: .8em
269
+ line-height: 18px
270
+ display: block
271
+ height: 18px
272
+ margin: 0em
273
+
274
+ .ui-separator
275
+ height: 18px
276
+ border-left: 1px solid #ccc
277
+ border-right: 1px solid #ccc
278
+ margin: 1px
279
+ float: right
280
+
281
+ .ui-paging-info
282
+ font-weight: normal
283
+ height: 19px
284
+ margin-top: 3px
285
+ margin-right: 4px
286
+
287
+ .ui-jqgrid-pager .ui-pg-div
288
+ padding: 1px 0
289
+ cursor: pointer
290
+ float: left
291
+ list-style-image: none
292
+ list-style-position: outside
293
+ list-style-type: none
294
+ position: relative
295
+
296
+ span.ui-icon
297
+ float: left
298
+ margin: 0 2px
299
+
300
+ td
301
+ input, select .ui-jqgrid td textarea
302
+ margin: 0em
303
+
304
+ textarea
305
+ width: auto
306
+ height: auto
307
+
308
+ .ui-jqgrid-btable .ui-sgcollapsed span
309
+ display: block
310
+
311
+ .ui-subgrid
312
+ margin: 0em
313
+ padding: 0em
314
+ width: 100%
315
+
316
+ table
317
+ table-layout: fixed
318
+
319
+ tr.ui-subtblcell td
320
+ height: 18px
321
+ border-right-width: 1px
322
+ border-right-color: inherit
323
+ border-right-style: solid
324
+ border-bottom-width: 1px
325
+ border-bottom-color: inherit
326
+ border-bottom-style: solid
327
+
328
+ td
329
+ &.subgrid-data
330
+ border-top: 0px none !important
331
+
332
+ &.subgrid-cell
333
+ border-width: 0px 0px 1px 0px
334
+
335
+ .loading
336
+ position: absolute
337
+ top: 45%
338
+ left: 45%
339
+ width: auto
340
+ z-index: 101
341
+ padding: 6px
342
+ margin: 5px
343
+ text-align: center
344
+ font-weight: bold
345
+ display: none
346
+ border-width: 2px !important
347
+
348
+ .jqgrid-overlay
349
+ display: none
350
+ z-index: 100
351
+
352
+
353
+ *
354
+ html .jqgrid-overlay
355
+ width: expression(this.parentNode.offsetWidth+'px')
356
+ height: expression(this.parentNode.offsetHeight+'px')
357
+
358
+ .jqgrid-overlay iframe
359
+ position: absolute
360
+ top: 0
361
+ left: 0
362
+ z-index: -1
363
+ width: expression(this.parentNode.offsetWidth+'px')
364
+ height: expression(this.parentNode.offsetHeight+'px')
365
+
366
+
367
+ .ui-jqgrid .ui-userdata
368
+ border-left: 0px none
369
+ border-right: 0px none
370
+ height: 21px
371
+ overflow: hidden
372
+
373
+
374
+ .ui-jqdialog
375
+ display: none
376
+ width: 300px
377
+ position: absolute
378
+ padding: .2em
379
+ font-size: 11px
380
+ overflow: visible
381
+
382
+ .ui-jqdialog-titlebar
383
+ padding: .3em .2em
384
+ position: relative
385
+
386
+ .ui-jqdialog-title
387
+ margin: .1em 0 .2em
388
+
389
+ .ui-jqdialog-titlebar-close
390
+ position: absolute
391
+ top: 50%
392
+ width: 19px
393
+ margin: -10px 0 0 0
394
+ padding: 1px
395
+ height: 18px
396
+
397
+ span
398
+ display: block
399
+ margin: 1px
400
+
401
+ &:hover, &:focus
402
+ padding: 0
403
+
404
+
405
+ .ui-jqdialog-content
406
+ border: 0
407
+ padding: .3em .2em
408
+ background: none
409
+ height: auto
410
+
411
+
412
+ .ui-jqdialog
413
+ .ui-jqdialog-content
414
+ border: 0
415
+ padding: .3em .2em
416
+ background: none
417
+ height: auto
418
+
419
+ .ui-jqconfirm
420
+ padding: .4em 1em
421
+ border-width: 3px
422
+ position: absolute
423
+ bottom: 10px
424
+ right: 10px
425
+ overflow: visible
426
+ display: none
427
+ height: 80px
428
+ width: 220px
429
+ text-align: center
430
+
431
+
432
+ .ui-jqdialog-content
433
+ .FormGrid
434
+ margin: 0px
435
+
436
+ .EditTable, .DelTable
437
+ width: 100%
438
+ margin-bottom: 0em
439
+
440
+
441
+ .EditTable td
442
+ input, select
443
+ margin: 0em
444
+
445
+ textarea
446
+ margin: 0em
447
+ width: auto
448
+ height: auto
449
+
450
+
451
+ .ui-jqdialog-content
452
+ td
453
+ &.EditButton
454
+ text-align: right
455
+ border-top: 0px none
456
+ border-left: 0px none
457
+ border-right: 0px none
458
+ padding-bottom: 5px
459
+ padding-top: 5px
460
+
461
+ &.navButton
462
+ text-align: center
463
+ border-left: 0px none
464
+ border-top: 0px none
465
+ border-right: 0px none
466
+ padding-bottom: 5px
467
+ padding-top: 5px
468
+
469
+ .CaptionTD
470
+ text-align: left
471
+ vertical-align: top
472
+ border-left: 0px none
473
+ border-right: 0px none
474
+ border-bottom: 0px none
475
+ padding: 1px
476
+ white-space: nowrap
477
+
478
+ .DataTD
479
+ padding: 1px
480
+ border-left: 0px none
481
+ border-right: 0px none
482
+ border-bottom: 0px none
483
+ vertical-align: top
484
+
485
+
486
+ .fm-button
487
+ display: inline-block
488
+ margin: 0 4px 0 0
489
+ padding: .4em .5em
490
+ text-decoration: none !important
491
+ cursor: pointer
492
+ position: relative
493
+ text-align: center
494
+ zoom: 1
495
+
496
+
497
+ .fm-button-icon-left
498
+ padding-left: 1.9em
499
+
500
+
501
+ .fm-button-icon-right
502
+ padding-right: 1.9em
503
+
504
+
505
+ .fm-button-icon-left .ui-icon
506
+ right: auto
507
+ left: .2em
508
+ margin-left: 0
509
+ position: absolute
510
+ top: 50%
511
+ margin-top: -8px
512
+
513
+
514
+ .fm-button-icon-right .ui-icon
515
+ left: auto
516
+ right: .2em
517
+ margin-left: 0
518
+ position: absolute
519
+ top: 50%
520
+ margin-top: -8px
521
+
522
+
523
+ #nData, #pData
524
+ float: left
525
+ margin: 3px
526
+ padding: 0
527
+ width: 15px
528
+
529
+
530
+ .ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td
531
+ font-style: normal
532
+ border-left: 0px none
533
+
534
+
535
+ .ui-jqgrid
536
+ .tree-wrap
537
+ float: left
538
+ position: relative
539
+ height: 18px
540
+ white-space: nowrap
541
+ overflow: hidden
542
+
543
+ .tree-minus, .tree-plus, .tree-leaf
544
+ position: absolute
545
+ height: 18px
546
+ width: 18px
547
+ overflow: hidden
548
+
549
+ .treeclick
550
+ cursor: pointer
551
+
552
+
553
+ .jqmOverlay
554
+ background-color: #000
555
+
556
+
557
+ * iframe.jqm
558
+ position: absolute
559
+ top: 0
560
+ left: 0
561
+ z-index: -1
562
+ width: expression(this.parentNode.offsetWidth+'px')
563
+ height: expression(this.parentNode.offsetHeight+'px')
564
+
565
+
566
+ .ui-jqgrid-dnd tr td
567
+ border-right-width: 1px
568
+ border-right-color: inherit
569
+ border-right-style: solid
570
+ height: 20px
571
+
572
+
573
+ .ui-jqgrid
574
+ .ui-jqgrid-title-rtl
575
+ float: right
576
+ margin: .1em 0 .2em
577
+
578
+ .ui-jqgrid-hbox-rtl
579
+ float: right
580
+ padding-left: 20px
581
+
582
+ .ui-jqgrid-resize-ltr
583
+ float: right
584
+ margin: -2px -2px -2px 0px
585
+
586
+ .ui-jqgrid-resize-rtl
587
+ float: left
588
+ margin: -2px 0px -1px -3px
589
+
590
+ .ui-sort-rtl
591
+ left: 0px
592
+
593
+ .tree-wrap-ltr
594
+ float: left
595
+
596
+ .tree-wrap-rtl
597
+ float: right
598
+
599
+ .ui-ellipsis
600
+ text-overflow: ellipsis
601
+ -moz-binding: url('ellipsis-xbl.xml#ellipsis')
602
+
603
+
604
+ .ui-searchFilter
605
+ display: none
606
+ position: absolute
607
+ z-index: 770
608
+ overflow: visible
609
+
610
+
611
+ .ui-searchFilter
612
+ table
613
+ position: relative
614
+ margin: 0em
615
+ width: auto
616
+
617
+ td
618
+ margin: 0em
619
+ padding: 1px
620
+
621
+ input, select
622
+ margin: 0.1em
623
+
624
+ .ui-state-default
625
+ cursor: pointer
626
+
627
+ .divider
628
+ height: 1px
629
+
630
+ div
631
+ background-color: black
632
+ height: 1px
633
+
634
+
635
+ .ui-multiselect
636
+ border: solid 1px
637
+ font-size: 0.8em
638
+
639
+ ul
640
+ -moz-user-select: none
641
+
642
+ li
643
+ margin: 0
644
+ padding: 0
645
+ cursor: default
646
+ line-height: 20px
647
+ height: 20px
648
+ font-size: 11px
649
+ list-style: none
650
+
651
+ a
652
+ color: #999
653
+ text-decoration: none
654
+ padding: 0
655
+ display: block
656
+ float: left
657
+ cursor: pointer
658
+
659
+ &.ui-draggable-dragging
660
+ padding-left: 10px
661
+
662
+ div.selected
663
+ position: relative
664
+ padding: 0
665
+ margin: 0
666
+ border: 0
667
+ float: left
668
+
669
+ ul.selected
670
+ position: relative
671
+ padding: 0
672
+ overflow: auto
673
+ overflow-x: hidden
674
+ background: #fff
675
+ margin: 0
676
+ list-style: none
677
+ border: 0
678
+ position: relative
679
+ width: 100%
680
+
681
+ li
682
+ div.available
683
+ position: relative
684
+ padding: 0
685
+ margin: 0
686
+ border: 0
687
+ float: left
688
+ border-left: 1px solid
689
+
690
+ ul.available
691
+ position: relative
692
+ padding: 0
693
+ overflow: auto
694
+ overflow-x: hidden
695
+ background: #fff
696
+ margin: 0
697
+ list-style: none
698
+ border: 0
699
+ width: 100%
700
+
701
+ li
702
+ padding-left: 10px
703
+
704
+ .ui-state-default
705
+ border: none
706
+ margin-bottom: 1px
707
+ position: relative
708
+ padding-left: 20px
709
+
710
+ .ui-state-hover
711
+ border: none
712
+
713
+ .ui-widget-header
714
+ border: none
715
+ font-size: 11px
716
+ margin-bottom: 1px
717
+
718
+ .add-all, .remove-all
719
+ float: right
720
+ padding: 7px
721
+
722
+ .search
723
+ float: left
724
+ padding: 4px
725
+
726
+ .count
727
+ float: left
728
+ padding: 7px
729
+
730
+ li
731
+ span.ui-icon-arrowthick-2-n-s
732
+ position: absolute
733
+ left: 2px
734
+
735
+ a.action
736
+ position: absolute
737
+ right: 2px
738
+ top: 2px
739
+
740
+ input.search
741
+ height: 14px
742
+ padding: 1px
743
+ opacity: 0.5
744
+ margin: 4px
745
+ width: 100px