text: /*!
   * ParamQuery Pro v2.1.0
   *
   * Copyright (c) 2012-2016 Paramvir Dhindsa (http://paramquery.com)
   * Released under GPL v3 license
   * http://paramquery.com/license
   *
   */
  (function(h){h.paramquery=h.paramquery||{};h.paramquery.pqgrid=h.paramquery.pqgrid||{};h.paramquery.xmlToArray=function(c,f){var p=f.itemParent,m=f.itemNames,d=[];h(c).find(p).each(function(c,f){var p=h(f),a=[];h(m).each(function(b,e){a.push(p.find(e).text())});d.push(a)});return d};h.paramquery.xmlToJson=function(c,f){var p=f.itemParent,m=f.itemNames,d=[];h(c).find(p).each(function(c,f){for(var p=h(f),a={},b=0,e=m.length;b<e;b++){var g=m[b];a[g]=p.find(g).text()}d.push(a)});return d};h.paramquery.tableToArray=
  function(c){c=h(c);var f=[],p=[],m=c.find("tr:first"),d=c.find("tr:eq(1)");m.find("th,td").each(function(c,m){var p=h(m),a=p.html(),p=p.width(),b="string",e=d.find("td:eq("+c+")"),g=e.text(),e=e.attr("align"),g=g.replace(/,/g,"");parseInt(g)==g&&(parseInt(g)+"").length==g.length?b="integer":parseFloat(g)==g&&(b="float");f.push({title:a,width:p,dataType:b,align:e,dataIndx:c})});c.find("tr").each(function(d,c){if(0!=d){var f=[];h(c).find("td").each(function(a,b){f.push(h.trim(h(b).html()))});p.push(f)}});
  return{data:p,colModel:f}};h.paramquery.formatCurrency=function(c){c=Math.round(10*c)/10;c+="";-1==c.indexOf(".")&&(c+=".0");var f=c.length,h=c.substring(0,f-2);c=c.substring(f-2,f);for(var h=h.match(/\d/g).reverse(),f=[],m=0;m<h.length;m++)0<m&&0==m%3&&f.push(","),f.push(h[m]);f=f.reverse();h=f.join("");return h+c};h.paramquery.validation={is:function(c,f){if("string"==c||!c)return!0;c=c.substring(0,1).toUpperCase()+c.substring(1,c.length);return this["is"+c](f)},isFloat:function(c){var f=parseFloat(c);
  return isNaN(f)||f!=c?!1:!0},isInteger:function(c){var f=parseInt(c);return isNaN(f)||f!=c?!1:!0},isDate:function(c){c=Date.parse(c);return isNaN(c)?!1:!0}}})(jQuery);
  (function(h){var c={options:{curPage:0,totalPages:0,totalRecords:0,msg:"",rPPOptions:[10,20,30,40,50,100],rPP:20},_regional:{strDisplay:"Displaying {0} to {1} of {2} items.",strFirstPage:"First Page",strLastPage:"Last Page",strNextPage:"Next Page",strPage:"Page {0} of {1}",strPrevPage:"Previous Page",strRefresh:"Refresh",strRpp:"Records per page:{0}"}};h.extend(c.options,c._regional);c._create=function(){var c=this,p=this.options;this.element.addClass("pq-pager");this.first=h("<button type='button' title='"+
  p.strFirstPage+"'></button>",{}).appendTo(this.element).button({icons:{primary:"ui-icon-seek-first"},text:!1}).bind("click.paramquery",function(m){1<c.options.curPage&&!1!==c._trigger("change",m,{curPage:1})&&c.option({curPage:1})});this.prev=h("<button type='button' title='"+p.strPrevPage+"'></button>").appendTo(this.element).button({icons:{primary:"ui-icon-seek-prev"},text:!1}).bind("click",function(m){if(1<c.options.curPage){var d=c.options.curPage-1;!1!==c._trigger("change",m,{curPage:d})&&c.option({curPage:d})}});
  h("<span class='pq-separator'></span>").appendTo(this.element);this.pageHolder=h("<span class='pq-page-placeholder'></span>").appendTo(this.element);h("<span class='pq-separator'></span>").appendTo(this.element);this.next=h("<button type='button' title='"+this.options.strNextPage+"'></button>").appendTo(this.element).button({icons:{primary:"ui-icon-seek-next"},text:!1}).bind("click",function(m){var d=c.options.curPage+1;!1!==c._trigger("change",m,{curPage:d})&&c.option({curPage:d})});this.last=h("<button type='button' title='"+
  this.options.strLastPage+"'></button>").appendTo(this.element).button({icons:{primary:"ui-icon-seek-end"},text:!1}).bind("click",function(m){var d=c.options.totalPages;!1!==c._trigger("change",m,{curPage:d})&&c.option({curPage:d})});h("<span class='pq-separator'></span>").appendTo(this.element);this.rPPHolder=h("<span class='pq-page-placeholder'></span>").appendTo(this.element);this.$refresh=h("<button type='button' title='"+this.options.strRefresh+"'></button>").appendTo(this.element).button({icons:{primary:"ui-icon-refresh"},
  text:!1}).bind("click",function(m){c._trigger("refresh",m)});h("<span class='pq-separator'></span>").appendTo(this.element);this.$msg=h("<span class='pq-pager-msg'></span>").appendTo(this.element);this._refresh()};c._refreshPage=function(){var c=this;this.pageHolder.empty();for(var p=this.options,m=p.strPage.split(" "),d=[],k=0,q=m.length;k<q;k++){var l=m[k];"{0}"==l?d.push("<input type='text' tabindex='0' class='ui-corner-all' />"):"{1}"==l?d.push("<span class='total'></span>"):d.push("<span>",l,
  "</span>")}m=d.join("");m=h(m).appendTo(this.pageHolder);this.page=m.filter("input").bind("change",function(a){var b=h(this),e=b.val();if(isNaN(e)||1>e)return b.val(p.curPage),!1;e=parseInt(e);if(e>p.totalPages||!1===c._trigger("change",a,{curPage:e}))return b.val(p.curPage),!1;c.option({curPage:e})});this.$total=m.filter("span.total")};c._refresh=function(){this._refreshPage();var c=this,p=this.options;this.first.attr("title",p.strFirstPage);this.prev.attr("title",p.strPrevPage);this.next.attr("title",
  p.strNextPage);this.last.attr("title",p.strLastPage);this.$refresh.attr("title",p.strRefresh);this.rPPHolder.empty();if(p.strRpp){var m=p.rPPOptions,d=p.strRpp;if(-1!=d.indexOf("{0}")){for(var k=["<select class='ui-corner-all'>"],q=0,l=m.length;q<l;q++){var a=m[q];k.push('<option value="',a,'">',a,"</option>")}k.push("</select>");m=k.join("");d=d.replace("{0}","</span>"+m);d="<span>"+d+"<span class='pq-separator'></span>"}else d="<span>"+d+"</span><span class='pq-separator'></span>";this.$rPP=h(d).appendTo(this.rPPHolder).filter("select").val(p.rPP).change(function(b){var a=
  h(this).val();if(!1!==c._trigger("change",b,{rPP:a}))return c.options.rPP=a,!1})}p.curPage>=p.totalPages?(this.next.button({disabled:!0}),this.last.button({disabled:!0})):(this.next.button({disabled:!1}),this.last.button({disabled:!1}));1>=p.curPage?(this.first.button({disabled:!0}),this.prev.button({disabled:!0})):(this.first.button({disabled:!1}),this.prev.button({disabled:!1}));this.page.val(p.curPage);this.$total.text(p.totalPages);0<this.options.totalRecords?(d=p.rPP,m=p.curPage,k=p.totalRecords,
  q=m*d,q>k&&(q=k),p=p.strDisplay,p=p.replace("{0}",(m-1)*d+1),p=p.replace("{1}",q),p=p.replace("{2}",k),this.$msg.html(p)):this.$msg.html("")};c._destroy=function(){this.element.empty().removeClass("pq-pager").enableSelection()};c._setOption=function(c,h){if("curPage"==c||"totalPages"==c)h=parseInt(h);this._super.call(this,c,h)};c._setOptions=function(){this._super.apply(this,arguments);this._refresh()};h.widget("paramquery.pqPager",c);h.paramquery.pqPager.regional={};h.paramquery.pqPager.regional.en=
  c._regional})(jQuery);
  (function(h){h.widget("paramquery.pqScrollBar",{options:{length:200,num_eles:3,cur_pos:0,ratio:0,timeout:350,pace:"optimum",direction:"vertical",theme:!1},_destroy:function(){this.element.removeClass("pq-sb-vert pq-sb-vert-t pq-sb-vert-wt").enableSelection().removeClass("pq-sb-horiz pq-sb-horiz-t pq-sb-horiz-wt").unbind("click.pq-scrollbar").empty();this.element.removeData()},_create:function(){this._createLayout()},_createLayout:function(){var c=this,f=this.options,p=f.direction,m=f.theme,d=this.element.empty();
  "vertical"==p?(d.removeClass("pq-sb-vert-t pq-sb-vert-wt").addClass("pq-sb-vert"),m?(d.addClass("pq-sb-vert-t"),d.html("<div class='top-btn pq-sb-btn ui-state-default ui-corner-top'><div class='ui-icon ui-icon-triangle-1-n'></div></div><div class='pq-sb-slider ui-corner-all ui-state-default'></div><div class='bottom-btn pq-sb-btn ui-state-default ui-corner-bottom'><div class='ui-icon ui-icon-triangle-1-s'></div></div>")):(d.addClass("pq-sb-vert-wt"),d.html("<div class='top-btn pq-sb-btn'></div><div class='pq-sb-slider'><div class='vert-slider-top'></div><div class='vert-slider-bg'></div><div class='vert-slider-center'></div><div class='vert-slider-bg'></div><div class='vert-slider-bottom'></div></div><div class='bottom-btn pq-sb-btn'></div>"))):
  (d.removeClass("pq-sb-horiz-t pq-sb-horiz-wt").addClass("pq-sb-horiz"),m?(d.addClass("pq-sb-horiz-t"),d.html("<div class='left-btn pq-sb-btn ui-state-default ui-corner-left'><div class='ui-icon ui-icon-triangle-1-w'></div></div><div class='pq-sb-slider pq-sb-slider-h ui-state-default ui-corner-all'></div><div class='right-btn pq-sb-btn ui-state-default ui-corner-right'><div class='ui-icon ui-icon-triangle-1-e'></div></div>")):(d.addClass("pq-sb-horiz-wt"),d.width(this.width),d.html("<div class='left-btn pq-sb-btn'></div><div class='pq-sb-slider pq-sb-slider-h'><span class='horiz-slider-left'></span><span class='horiz-slider-bg'></span><span class='horiz-slider-center'></span><span class='horiz-slider-bg'></span><span class='horiz-slider-right'></span></div><div class='right-btn pq-sb-btn'></div>")));
  d.disableSelection().unbind(".pq-scrollbar").on("mouseup.pq-scrollbar",function(d){c._mouseup(d)}).on("mousedown.pq-scrollbar",function(d){if(!f.disabled&&!c.$slider.is(":hidden"))if("vertical"==p){var h=d.pageY,m=c.element.offset().top,a=m+f.length,b=c.$slider,e=b.offset().top,g=b.height(),n=e+g;h<e&&h>m+17?c.mousedownInterval=window.setInterval(function(){h>=b.offset().top?(window.clearInterval(c.mousedownInterval),c.mousedownInterval=null):c._pageUp(d)},0):h>n&&h<a-17&&(c.mousedownInterval=window.setInterval(function(){h<=
  b.offset().top+g?(window.clearInterval(c.mousedownInterval),c.mousedownInterval=null):c._pageDown(d)},0))}else{var r=d.pageX,m=c.element.offset().left,a=m+f.length,e=c.$slider.offset().left,n=e+c.$slider.width();r<e&&r>m+17?(c.$slider.css("left",r-c.element.offset().left),c._updateCurPosAndTrigger(d)):r>n&&r<a-17&&(c.$slider.css("left",r-c.element.offset().left-c.$slider.width()),c._updateCurPosAndTrigger(d))}});d=this.$slider=h("div.pq-sb-slider",this.element);m&&d.attr("tabindex","0");this._bindSliderEvents(d);
  this.$top_btn=h("div.top-btn,div.left-btn",this.element).click(function(d){if(!c.options.disabled)return c.decr_cur_pos(d),d.preventDefault(),!1}).mousedown(function(d){c.options.disabled||(c.mousedownTimeout=window.setTimeout(function(){c.mousedownInterval=window.setInterval(function(){c.decr_cur_pos(d)},0)},c.options.timeout))}).bind("mouseup mouseout",function(d){c._mouseup(d)});this.$bottom_btn=h("div.bottom-btn,div.right-btn",this.element).click(function(d){if(!c.options.disabled)return c.incr_cur_pos(d),
  d.preventDefault(),!1}).mousedown(function(d){c.options.disabled||(c.mousedownTimeout=window.setTimeout(function(){c.mousedownInterval=window.setInterval(function(){c.incr_cur_pos(d)},0)},c.options.timeout))}).bind("mouseup mouseout",function(d){c._mouseup(d)});this._refresh()},_bindSliderEvents:function(c){var f=this,p="x";"vertical"==this.options.direction&&(p="y");c.draggable({axis:p,helper:function(c,d){f._setDragLimits();return this},start:function(c){f.topWhileDrag=null},drag:function(c){f.dragging=
  !0;var d=f.options.pace;"optimum"==d?f._setNormalPace(c):"fast"==d&&f._updateCurPosAndTrigger(c)},stop:function(c){f._updateCurPosAndTrigger(c);f.dragging=!1}}).on("keydown.pq-scrollbar",function(c){var d=c.keyCode,k=f.options,p=k.cur_pos,l=k.ratio,a=k.num_eles,b=h.ui.keyCode;null==f.keydownTimeout&&(f.keydownTimeout=window.setTimeout(function(){d==b.DOWN||d==b.RIGHT?f.incr_cur_pos(c):d==b.UP||d==b.LEFT?f.decr_cur_pos(c):d==b.HOME?k.steps?0<p&&(k.cur_pos=0,f.updateSliderPos(),f.scroll(c)):0<l&&(k.ratio=
  0,f.updateSliderPos(),f.drag(c)):d==b.END?k.steps?p<a&&(k.cur_pos=a,f.updateSliderPos(),f.scroll(c)):1>l&&(k.ratio=1,f.updateSliderPos(),f.drag(c)):"vertical"==k.direction&&(d==b.PAGE_DOWN?f._pageDown(c):d==b.PAGE_UP&&f._pageUp(c));f.keydownTimeout=null},0));if(d==b.DOWN||d==b.RIGHT||d==b.UP||d==b.LEFT||d==b.PAGE_DOWN||d==b.PAGE_UP||d==b.HOME||d==b.END)return c.preventDefault(),!1})},decr_cur_pos:function(c){var f=this.options;if(f.steps)0<f.cur_pos&&(f.cur_pos--,this.updateSliderPos(),this.scroll(c));
  else if(0<f.ratio){var h=f.ratio-1/(f.num_eles-1);0>h&&(h=0);f.ratio=h;this.updateSliderPos();this.drag(c)}},incr_cur_pos:function(c){var f=this.options;if(f.steps)f.cur_pos<f.num_eles-1&&f.cur_pos++,this.updateSliderPos(),this.scroll(c);else{if(1>f.ratio){var h=f.ratio+1/(f.num_eles-1);1<h&&(h=1);f.ratio=h}this.updateSliderPos();this.drag(c)}},_mouseup:function(c){this.options.disabled||(window.clearTimeout(this.mousedownTimeout),this.mousedownTimeout=null,window.clearInterval(this.mousedownInterval),
  this.mousedownInterval=null)},_setDragLimits:function(){var c=this.options;if("vertical"==c.direction){var f=this.element.offset().top+17,c=f+c.length-34-this.slider_length;this.$slider.draggable("option","containment",[0,f,0,c])}else f=this.element.offset().left+17,c=f+c.length-34-this.slider_length,this.$slider.draggable("option","containment",[f,0,c,0])},_refresh:function(){var c=this.options;1>=c.num_eles?this.element.css("display","none"):this.element.css("display","");this._validateCurPos();
  this.$slider.css("display","");"vertical"==c.direction?this.element.height(c.length):this.element.width(c.length);this._setSliderBgLength();this.scroll_space=c.length-34-this.slider_length;(4>this.scroll_space||1>=c.num_eles)&&this.$slider.css("display","none");this.updateSliderPos(c.cur_pos)},_setSliderBgLength:function(){var c=this.options,f=c.theme,p=c.length,p=Math.round(((p-34)*p/(40*c.num_eles+p)-14)/2);1>p&&(p=1);this.slider_length=14+2*p;"vertical"==c.direction?f?this.$slider.height(this.slider_length-
  2):(h("div.vert-slider-bg",this.element).height(p),this.$slider.height(this.slider_length)):f?this.$slider.width(this.slider_length-2):(h(".horiz-slider-bg",this.element).width(p),this.$slider.width(this.slider_length))},_updateCurPosAndTrigger:function(c,f){var h=this.options,m=h.direction,d=this.$slider;null==f&&(f="vertical"==m?parseInt(d[0].style.top,10):parseInt(d[0].style.left,10));m=(f-17)/(h.length-34-this.slider_length);if(h.steps){if(m*=h.num_eles-1,m=Math.round(m),h.cur_pos!=m){if(this.dragging){if(null!=
  this.topWhileDrag&&(this.topWhileDrag<f&&h.cur_pos>m||this.topWhileDrag>f&&h.cur_pos<m))return;this.topWhileDrag=f}this.options.cur_pos=m;this.scroll(c)}}else h.ratio=m,this.drag(c)},_setNormalPace:function(c){this.timer&&(window.clearInterval(this.timer),this.timer=null);var f=this,h=this.options.direction;f.timer=window.setInterval(function(){var m=f.$slider,m="vertical"==h?parseInt(m[0].style.top,10):parseInt(m[0].style.left,10);f.prev_top==m&&(f._updateCurPosAndTrigger(c,m),window.clearInterval(f.timer),
  f.timer=null);f.prev_top=m},20)},setNumEles:function(c){this.options.num_eles=c;this.updateSliderPos()},_validateCurPos:function(){var c=this.options;c.cur_pos>=c.num_eles&&(c.cur_pos=c.num_eles-1);0>c.cur_pos&&(c.cur_pos=0)},_updateSliderPosRatio:function(){var c=this.options,f=c.direction,h=c.ratio,m=this.$slider,c=c.length-34-this.slider_length;if(null==h)throw"ration N/A";h=h*c+17;"vertical"==f?m.css("top",h):m.css("left",h)},_updateSliderPosCurPos:function(){var c=this.options,f=this.scroll_space*
  c.cur_pos/(c.num_eles-1);"vertical"==c.direction?this.$slider.css("top",17+f):this.$slider.css("left",17+f)},updateSliderPos:function(){var c=this.options;if(void 0===c.steps)throw"assert failed. steps N/A";c.steps?this._updateSliderPosCurPos():this._updateSliderPosRatio()},scroll:function(c){var f=this.options;this._trigger("scroll",c,{cur_pos:f.cur_pos,num_eles:f.num_eles})},drag:function(c){this._trigger("drag",c,{ratio:this.options.ratio})},_pageDown:function(c){this._trigger("pageDown",c,null)},
  _pageUp:function(c){this._trigger("pageUp",c,null)},_setOption:function(c,f){"disabled"==c?(this._super.call(this,c,f),!0==f?this.$slider.draggable("disable"):this.$slider.draggable("enable")):"theme"==c?(this._super.call(this,c,f),this._createLayout()):"ratio"==c?0<=f&&1>=f&&this._super.call(this,c,f):this._super.call(this,c,f)},_setOptions:function(){this._super.apply(this,arguments);this._refresh()}})})(jQuery);
  (function(h){var c=function(){};c.prototype.belongs=function(a){if(a.target==this.that.element[0])return!0};h.paramquery.cClass=c;var f=function(a){this.that=a;this.hidearrHS1=[];this.options=a.options;this.offset=null};h.paramquery.cGenerateView=f;c=f.prototype;c.generateView=function(a){var b=this.that,e=b.options,g=e.freezeCols,n=b.colModel,r,t,d=b.initH,c=b.finalH,f=e.groupModel,k=b.pqpanes;if(a){var f=this._generateTables(null,null,a),m=a.$cont;m.empty();k.v?m.append(["<div class='pq-cont-inner'>",
  f,"</div><div class='pq-cont-inner'>",f,"</div>"].join("")):m.append("<div class='pq-cont-inner'>"+f+"</div>");var p=m.children("div"),f=p.children("table"),l=f[0].scrollHeight-1;m.height(l);if(k.v){var k=h(p[0]),m=f[0].scrollWidth,p=h(p[1]),v=h(f[1]),y=q.call(b,-1,g),g=q.call(b,g,d);k.css({width:y,zIndex:1});p.css({left:y-1,width:m,position:"absolute",height:l});v.css({left:-1*(g+y)})}b.tables||(b.tables=[]);g=-1;for(l=0;l<b.tables.length;l++)b.tables[l].cont==a.$cont[0]&&(g=l);-1==g?b.tables.push({$tbl:f,
  cont:a.$cont[0]}):b.tables[g].$tbl=f}else{b._bufferObj_calcInitFinal();r=b.initV;t=b.finalV;var x=f?b.dataGM:b.data,m=b.$cont;null!=e.editModel.indices&&b.blurEditor({force:!0});f=this._generateTables(r,t,a);m.empty();0===b.totalVisibleRows?m.append("<div class='pq-cont-inner pq-grid-norows' >"+e.strNoRows+"</div>"):k.h&&k.v?m.append(["<div class='pq-cont-inner'>",f,"</div><div class='pq-cont-inner'>",f,"</div><div class='pq-cont-inner'>",f,"</div><div class='pq-cont-inner'>",f,"</div>"].join("")):
  k.h||k.v?m.append(["<div class='pq-cont-inner'>",f,"</div><div class='pq-cont-inner'>",f,"</div>"].join("")):m.append("<div class='pq-cont-inner'>"+f+"</div>");b.$tbl=m.children("div").children("table");b._fixTableViewPort();b._trigger("afterTable",null,{dataModel:e.dataModel,colModel:n,pageData:x,initV:r,finalV:t,initH:d,finalH:c})}b._saveDims();this.scrollView();a||b._trigger("refresh",null,{dataModel:e.dataModel,colModel:n,pageData:x,initV:r,finalV:t,initH:d,finalH:c});b._saveDims();this.scrollView()};
  c.scrollView=function(){var a=this.that,b=this.options,e=b.virtualY;b.virtualX||a.$hscroll.pqScrollBar("drag");e||a.$vscroll.pqScrollBar("drag")};c.setPanes=function(){var a=this.that,b=a.pqpanes,e=a.$cont.children("div"),g=a.$tbl,n=parseInt(a.options.freezeCols),r=a.initH;if(g&&g.length){var t=g[0].scrollWidth;if(b.h&&b.v){var r=h(e[0]),b=h(e[1]),d=h(g[1]),c=h(e[2]),f=h(g[2]),e=h(e[3]),k=h(g[3]),g=q.call(a,-1,n),a=a.calcHeightFrozenRows();r.css({width:g,height:a,zIndex:2});b.css({left:g,width:t,
  height:a,position:"absolute"});d.css({left:-1*g});c.css({width:g,zIndex:1,top:a,position:"absolute"});f.css({top:-a});e.css({left:g,width:t,zIndex:1,top:a,position:"absolute"});k.css({top:-a,left:-1*g})}else b.v?(b=h(e[0]),e=h(e[1]),d=h(g[1]),g=q.call(a,-1,n),a=q.call(a,n,r),b.css({width:g,zIndex:1}),e.css({left:g,width:t,position:"absolute"}),d.css({left:-1*(a+g)})):b.h&&(n=h(e[0]),e=h(e[1]),g=h(g[1]),a=a.calcHeightFrozenRows(),n.css({height:a,zIndex:1}),e.css({width:t,top:a,position:"absolute"}),
  g.css({top:-1*a}))}};c._generateTables=function(a,b,e){var g=this.that,n=g.colModel,r=g.options,t=r.virtualX,d=g.initH,c=g.finalH,f=r.numberCell,k=r.columnBorders,h=r.rowBorders,m=r.wrap,q=r.groupModel,p=r.freezeCols,r=parseInt(r.freezeRows),l=!1,x=0,B=e?e.data.length-1:b,u=q?!0:!1,z=e&&e.data?e.data:u?g.dataGM:g.data,C=g.rowIndxOffset;if(e||null!=a&&null!=B){e||g._trigger("beforeTableView",null,{pageData:z,initV:a,finalV:b,initH:d,finalH:c,colModel:n});l="pq-grid-table ";k&&(l+="pq-td-border-right ");
  h&&(l+="pq-td-border-bottom ");k=["<table class='"+(m?l+"pq-wrap ":l+"pq-no-wrap ")+"' cellpadding=0 cellspacing=0 >"];this.hidearrHS1=[];k.push("<tr class='pq-row-hidden'>");f.show&&(x=f.width+1,k.push("<td style='width:"+x+"px;' ></td>"));for(l=0;l<=c;l++){if(l<d&&l>=p&&(t||e)&&(l=d,l>c))throw"initH>finalH";x=n[l];x.hidden||(x=x.outerWidth,k.push("<td style='width:",x,"px;' pq-col-indx='",l,"'></td>"))}k.push("</tr>");this.offsetRow=null;for(x=0;x<=B;x++)x<a&&x>=r&&(x=a),t=z[x],d=u?t.rowIndx-C:
  x,t&&t.pq_hidden||(l=g.lastFrozenRow===d,q&&t.groupTitle?this._generateTitleRow(q,t,k,l):q&&t.groupSummary?this._generateSummaryRow(t.data,n,k,l):(c=t.pq_detail&&t.pq_detail.show,this._generateRow(t,d,n,k,e,l,c),c&&this._generateDetailRow(t,d,n,k,e,l)));g.scrollMode=!1;k.push("</table>");return k.join("")}};c._renderCell=function(a,b){var e=this.options,g=a.rowData,n=a.column,r=n.type,n=n.dataIndx,t=g[n];if(g){void 0!=b?r=b:"checkBoxSelection"==r?r="<input type='checkbox' "+(t?"checked='checked'":
  "")+" />":"detail"==r?(r=e.detailModel,r="<div class='ui-icon "+(t&&t.show?r.expandIcon:r.collapseIcon)+"'></div>"):r=t;if(""===r||void 0==r)r="&nbsp;";var t="",d;a.tree&&(d=e.treeModel)&&d.labelIndx==n?(e=!g.pq_collapse,n=(g.pq_level+1)*d.indent,t="",t=g.pq_leaf?d.leafIcon:e?d.expandIcon+" pq-tree-expand-icon":d.collapseIcon+" pq-tree-expand-icon",g=["<div class='pq-tree-icon-container' style='width:",n,"px;'><div class='ui-icon ",t," pq-tree-icon' ></div></div>"].join(""),t="<div class='"+cls+"'>"+
  g+r+"</div>"):t=r;return t}};c.renderCell=function(a){var b=this.that,e=this.options,g=a.rowData,n=a.rowIndx,r=a.rowIndxPage,t=a.column,d=a.colIndx,c=t.dataIndx,f=e.freezeCols,k=e.columnBorders,h="pq-col-indx='"+d+"'",m=!1,l="pq-grid-cell ";"right"==t.align?l+=" pq-align-right":"center"==t.align&&(l+=" pq-align-center");d==f-1&&k&&(l+=" pq-last-freeze-col");(f=t.cls)&&(l=l+" "+f);(f=g.pq_cellselect)&&(m=f[c]);m&&(l+=" pq-cell-select ui-state-highlight");var q;t.render&&(q=t.render.call(b.element[0],
  {data:b.data,dataModel:e.dataModel,rowData:g,cellData:g[c],rowIndxPage:r,rowIndx:n,colIndx:d,column:t,dataIndx:c}));(b=g.pq_cellcls)&&(c=b[c])&&(l+=" "+c);return["<td class='",l,"' ",h," >",this._renderCell(a,q),"</td>"].join("")};c.refreshRow=function(a,b,e){var g=this.that,n=g.data[a];this._generateRow(n,a,b,e,null,g.lastFrozenRow===a,n.pq_detail&&n.pq_detail.show)};c._generateRow=function(a,b,e,g,n,r,t){var d="pq-grid-row";r&&(d+=" pq-last-freeze-row");t&&(d+=" pq-detail-master");var c=this.that,
  f=this.options;r=f.freezeCols;var k=f.numberCell;t=f.treeModel.labelIndx?!0:!1;var h=f.virtualX,m=c.initH,c=c.finalH,l=this.offset;f.stripeRows&&b/2==parseInt(b/2)&&(d+=" pq-grid-oddRow");a.pq_rowselect&&(d+=" pq-row-select ui-state-highlight");f=a.pq_rowcls;null!=f&&(d+=" "+f);g.push("<tr pq-row-indx='",b,"' class='",d,"' >");k.show&&g.push(["<td class='pq-grid-number-cell ui-state-default'>",n?"&nbsp;":b+1,"</td>"].join(""));a={rowIndx:b+l,rowIndxPage:b,rowData:a};for(b=0;b<=c;b++){if(b<m&&b>=r&&
  (h||n)&&(b=m,b>c))throw"initH>finalH";d=e[b];d.hidden||(a.column=d,a.colIndx=b,a.tree=t,g.push(this.renderCell(a)))}g.push("</tr>");return g};c={widgetEventPrefix:"pqgrid",options:{cancel:"input,textarea,button,select,option,.ui-resizable-handle,div[contenteditable],.pq-draggable",distance:3,collapsible:{on:!0,collapsed:!1,_collapsed:!1,refreshAfterExpand:!0},colModel:null,columnBorders:!0,dataModel:{cache:!1,dataType:"JSON",location:"local",sorting:"local",sortDir:"up",method:"GET"},direction:"",
  draggable:!1,editable:!0,editModel:{cellBorderWidth:0,clicksToEdit:1,filterKeys:!0,keyUpDown:!0,reInt:/^([\-]?[1-9][0-9]*|[\-]?[0-9]?)$/,reFloat:/^(([\-]?[1-9][0-9]*\.?[0-9]*)|([\-]?[0-9]\.[0-9]*)|([0-9]?))$/,onBlur:"validate",saveKey:""},editor:{select:!1,type:"textbox"},validation:{icon:"ui-icon-alert",cls:"ui-state-error"},flexHeight:!1,flexWidth:!1,freezeCols:0,freezeRows:0,getDataIndicesFromColIndices:!0,height:400,hoverMode:"null",_maxColWidth:"100%",_minColWidth:50,minWidth:100,numberCell:{width:30,
  title:"",resizable:!1,minWidth:30,show:!0},pageModel:{curPage:1,totalPages:0,rPP:10,rPPOptions:[10,20,50,100]},resizable:!1,roundCorners:!0,rowBorders:!0,scrollModel:{pace:"fast",horizontal:!0,autoFit:!1,theme:!1},selectionModel:{type:"row",mode:"range"},swipeModel:{on:!0,speed:50,ratio:.15,repeat:20},showBottom:!0,showHeader:!0,showTitle:!0,showToolbar:!0,showTop:!0,sortable:!0,sql:!1,stripeRows:!0,title:"&nbsp;",treeModel:null,virtualX:!1,virtualY:!1,width:"auto",wrap:!0,hwrap:!0},_regional:{strAdd:"Add",
  strDelete:"Delete",strEdit:"Edit",strLoading:"Loading",strNextResult:"Next Result",strNoRows:"No rows to display.",strNothingFound:"Nothing found",strPrevResult:"Previous Result",strSearch:"Search",strSelectedmatches:"Selected {0} of {1} match(es)"}};h.extend(c.options,c._regional);c._destroyResizable=function(){this.element.data("resizable")&&this.element.resizable("destroy")};c._disable=function(){null==this.$disable&&(this.$disable=h("<div class='pq-grid-disable'></div>").css("opacity",.2).appendTo(this.element))};
  c._enable=function(){this.$disable&&(this.element[0].removeChild(this.$disable[0]),this.$disable=null)};c._destroy=function(){this._destroyResizable();this._destroyDraggable();this._mouseDestroy();this.element.off(this.eventNamespace);h(window).unbind(this.eventNamespace);this.element.empty();this.element.css("height","");this.element.css("width","");this.element.removeClass("pq-grid ui-widget ui-widget-content ui-corner-all").removeData()};c.decidePanes=function(){var a=this.pqpanes={v:!1,h:!1},
  b=this.options,e=b.virtualX,g=b.virtualY,n=b.flexHeight,r=b.flexWidth,t=b.numberCell,d=b.freezeRows,b=b.freezeCols;!d||n||!b&&!t.show||r?d&&!n?g||(a.h=!0):!b&&!t.show||r||e||(a.v=!0):(g||(a.h=!0),e||(a.v=!0))};c.collapse=function(a){var b=this,e=this.element,g=this.options.collapsible,n=g.$collapsible.children("span"),r=function(){n.addClass("ui-icon-circle-triangle-s").removeClass("ui-icon-circle-triangle-n");e.hasClass("ui-resizable")&&e.resizable("destroy");b.$toolbar.pqToolbar("disable");g.collapsed=
  !0;g._collapsed=!0;g.animating=!1;b._trigger("collapse")};a=a?a:{};if(g._collapsed)return!1;g.htCapture=e.height();!1===a.animate?(e.height(23),r()):(g.animating=!0,e.animate({height:"23px"},function(){r()}))};c.expand=function(a){var b=this,e=this.element,g=this.options.collapsible,n=g.htCapture,r=g.$collapsible.children("span"),t=function(){g._collapsed=!1;g.collapsed=!1;g.refreshAfterExpand?b.refresh():b._refreshResizable();r.addClass("ui-icon-circle-triangle-n").removeClass("ui-icon-circle-triangle-s");
  b.$toolbar.pqToolbar("enable");g.animating=!1;b._trigger("expand")};a=a?a:{};if(!1===g._collapsed)return!1;!1===a.animate?(e.height(n),t()):(g.animating=!0,e.animate({height:n},function(){t()}))};c._createCollapse=function(){var a=this,b=this.$top,e=this.options.collapsible;if(e.on&&!e.$collapsible){var g=h("<div class='pq-slider-icon' style='z-index:5;' ><span class='ui-icon ui-icon-circle-triangle-n'></span></div>").appendTo(b);e.$collapsible=g;g.mouseover(function(b){g.addClass("ui-state-hover")}).mouseout(function(b){g.removeClass("ui-state-hover")}).click(function(b){e.collapsed?
  a.expand():a.collapse()})}else!e.on&&e.$collapsible&&(e.$collapsible.remove(),delete e.$collapsible);e.collapsed&&!e._collapsed?a.collapse({animate:!1}):!e.collapsed&&e._collapsed&&a.expand({animate:!1})};c._create=function(){var a=this;this.decidePanes();this.setEditorPosTimer();this.iGenerateView=new f(this);this.iKeyNav=new d(this);this.iRefreshColumn=new l(this);this.rowHeight=22;this.hidearr=[];this.hidearrHS=[];this.tables=[];var a=this,b=this.options;this.$tbl=null;this._refreshGridWidthAndHeight();
  this._calcThisColModel();this.iSort=new h.paramquery.cSort(this);this.iSort._refreshSorters();this._initTypeColumns();var e=this.element;e.empty().addClass("pq-grid ui-widget ui-widget-content"+(b.roundCorners?" ui-corner-all":"")).append(["<div class='pq-grid-top ui-widget-header",b.roundCorners?" ui-corner-top":"","'><div class='pq-grid-title",b.roundCorners?" ui-corner-top":"","'>&nbsp;</div></div><div class='pq-grid-inner' ><div class='pq-header-outer ui-widget-header'></div><div class='pq-cont-right' ><div class='pq-cont'></div></div></div><div class='pq-grid-bottom ui-widget-header",
  b.roundCorners?" ui-corner-bottom":"","'><div class='pq-grid-footer'>&nbsp;</div></div>"].join(""));this._trigger("render",null,{dataModel:this.options.dataModel,colModel:this.colModel});this.$top=h("div.pq-grid-top",e);this.$title=h("div.pq-grid-title",e);b.showTitle||this.$title.css("display","none");this.$toolbar=h("div.pq-grid-toolbar",e);this.$grid_inner=h("div.pq-grid-inner",e);this.$header_o=h("div.pq-header-outer",this.$grid_inner);b.showTop||this.$top.css("display","none");this.$bottom=h("div.pq-grid-bottom",
  e);b.showBottom||this.$bottom.css("display","none");this.$footer=h("div.pq-grid-footer",e);this.$cont_o=h("div.pq-cont-right",this.$grid_inner);this.$cont_fixed=h("div.pq-cont-fixed",this.$grid_inner);e=this.$cont=h("div.pq-cont",this.$grid_inner);h(window).bind("resize"+a.eventNamespace,function(b){a._onWindowResize(b)});e.on("click","td.pq-grid-cell",function(b){if(!0!==h.data(b.target,a.widgetName+".preventClickEvent")&&h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onClickCell(b)});
  e.on("click","tr.pq-grid-row",function(b){if(!0!==h.data(b.target,a.widgetName+".preventClickEvent")&&h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onClickRow(b)});e.on("contextmenu","td.pq-grid-cell",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onRightClickCell(b)});e.on("contextmenu","tr.pq-grid-row",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onRightClickRow(b)});e.on("dblclick","td.pq-grid-cell",function(b){if(h(b.target).closest(".pq-grid")[0]==
  a.element[0])return a._onDblClickCell(b)});e.on("dblclick","tr.pq-grid-row",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onDblClickRow(b)});e.on("mousedown","td.pq-grid-cell",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onCellMouseDown(b)});e.on("mousedown","tr.pq-grid-row",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onRowMouseDown(b)});e.on("mousedown",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onContMouseDown(b)});
  e.on("mouseenter","td.pq-grid-cell",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onCellMouseEnter(b,h(this))});e.on("mouseenter","tr.pq-grid-row",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onRowMouseEnter(b,h(this))});e.on("mouseleave","td.pq-grid-cell",function(b){if(h(b.target).closest(".pq-grid")[0]==a.element[0])return a._onCellMouseLeave(b,h(this))});e.on("mouseleave","tr.pq-grid-row",function(b){if(h(b.target).closest(".pq-grid")[0]==
  a.element[0])return a._onRowMouseLeave(b,h(this))});e.bind("mousewheel DOMMouseScroll",function(b){return a._onMouseWheel(b)});this.$hvscroll=h("<div class='pq-hvscroll-square ui-widget-content'></div>").appendTo(this.$grid_inner);this.$vscroll=h("<div class='pq-vscroll'></div>").appendTo(this.$grid_inner);this.prevVScroll=0;e=b.scrollModel;void 0===e.lastColumn&&b.virtualX&&(e.lastColumn="auto");this.$vscroll.pqScrollBar({pace:e.pace,theme:e.theme,steps:b.virtualY,direction:"vertical",cur_pos:0,
  pageDown:function(b,e){a.iKeyNav.pageDown()},pageUp:function(b,e){a.iKeyNav.pageUp()},drag:function(e,n){b.virtualY||a._syncViewWithScrollBarVert(n.ratio)},scroll:function(e,n){b.virtualY&&(a.scrollMode=!0,a.setFlexWHCallback(function(){a.iGenerateView.generateView()}),1>=(e.originalEvent&&"drag"==e.originalEvent.type?a._setScrollVNumEles():a._setScrollVNumEles(!0))&&(a._setScrollHLength(),a._setScrollHVLength()))}});this.$hscroll=h("<div class='pq-hscroll'></div>").appendTo(this.$grid_inner);this.$hscroll.pqScrollBar({direction:"horizontal",
  pace:e.pace,theme:e.theme,steps:b.virtualX,cur_pos:0,drag:function(e,n){b.virtualX||a._syncViewWithScrollBarHor(n.ratio)},scroll:function(e,n){b.virtualX&&a.refresh()}});this.element.height("");this.disableSelection();window.opera?this.$grid_inner.bind("keypress.pq-grid",{that:this},function(b){h(b.target).closest(".pq-grid")[0]==a.element[0]&&a._onKeyPressDown(b)}):this.$grid_inner.bind("keydown.pq-grid",{that:this},function(b){h(b.target).closest(".pq-grid")[0]==a.element[0]&&a._onKeyPressDown(b)});
  this._refreshOptions();this._refreshTitle();this._refreshDataIndices();this.iRows=new h.paramquery.cRows(this);this.iCells=new h.paramquery.cCells(this);this.generateLoading();this._initPager();this._refreshResizable();this._refreshDraggable();this._mouseInit()};c._mouseCapture=function(a){var b=this.options;if(b.virtualX&&b.virtualY||!a.target)return!1;if(h(a.target).closest(".pq-grid")[0]==this.element[0]){if(b.flexHeight&&b.flexWidth)return!1;a=b.swipeModel;return!1==a.on||"touch"==a.on&&!h.support.touch?
  !1:!0}return!1};c._saveDims=function(){var a=this.$cont;a.data("offsetWidth",a[0].offsetWidth);a.data("offsetHeight",a[0].offsetHeight);var b=this.$tbl;if(b)for(a=0;a<b.length;a++){var e=b[a],g=h(e);g.data("offsetHeight",e.offsetHeight);g.data("scrollWidth",e.scrollWidth)}if(b=this.$tbl_header)for(a=0;a<b.length;a++)e=b[a],g=h(e).parent(),g.data("offsetHeight",e.offsetHeight),g.data("scrollWidth",e.scrollWidth)};c._mouseDown=function(a){this._saveDims();return this._super.call(this,a)};c._mouseStart=
  function(a){this.blurEditor({force:!0});return!0};c._mouseDrag=function(a){return!1==this._trigger("mouseDrag",a,null)?!1:!0};c._mouseStop=function(a){return!1==this._trigger("mouseStop",a,null)?!1:!0};c._refreshGridWidthAndHeight=function(){var a=this.options,b,e,g=-1<(a.width+"").indexOf("%")?!0:!1,n=-1<(a.height+"").indexOf("%")?!0:!1,r=this.element;if(g||n){var t=r.parent();if(!t.length)return;var d=t.width(),c=t[0]==document.body?h(document).height():t.height(),f=null,k=function(b){return(b=
  /(-|\+)([0-9]+)/.exec(b))&&3==b.length?parseInt(b[1]+b[2]):0},m=g?k(a.width):0,k=n?k(a.height):0;if(0==d){for(;"BODY"!=t[0].tagName.toUpperCase();){var l=t.parent();if(null==l[0]){f=t;break}else t=l}if(f){var l=f.css("position"),q=f.css("left"),p=f.css("top");f.css({position:"absolute",left:"-2000",top:"-2000"}).appendTo(h(document.body));t=r.parent();g&&(d=t.width());n&&(c=t.height());f.css({position:l,left:q,top:p})}}g&&(b=parseInt(a.width)*d/100+m);n&&(e=parseInt(a.height)*c/100+k)}g||(b=a.width);
  n||(e=a.height);"auto"!=b&&b<a.minWidth&&(b=a.minWidth);e<a.minHeight&&(e=a.minHeight);r.width(b);r.height(e)};var p,m;c._onWindowResize=function(a){a=this.options;var b=this.element.parent(),e,g;if(b.length&&(e=b.height(),g=b.width(),null==p||e!=p&&b.closest(".ui-resizable").length||g!=m)&&(p=e,m=g,!(h.support.touch&&a.editModel.indices&&h(document.activeElement).is(".pq-editor-focus")))){var n=this;a=a.autoSizeInterval;a=void 0===a?0:a;this.autoResizeTimeout&&(clearTimeout(this.autoResizeTimeout),
  delete this.autoResizeTimeout);this.autoResizeTimeout=window.setTimeout(function(){n._refreshAfterResize();delete n.autoResizeTimeout},a)}};c._onMouseWheel=function(a){this._saveDims();var b=this.options;if(b.flexHeight)return!0;var e=this.$vscroll,g=0;a=a.originalEvent;a.wheelDelta?g=a.wheelDelta/120:a.detail&&(g=-1*a.detail/3);var n=e.pqScrollBar("option");a=parseInt(n.cur_pos);var r=parseInt(n.num_eles),n=n.ratio,t=a-g;b.virtualY?0<=t&&(e.pqScrollBar("option","cur_pos",a-g),e.pqScrollBar("scroll")):
  (b=n-g/(r-1),1<b?b=1:0>b&&(b=0),e.pqScrollBar("option","ratio",b),e.pqScrollBar("drag"));return!1};c._onDblClickCell=function(a){var b=h(a.currentTarget),e=this.getCellIndices({$td:b}),g=e.rowIndxPage,n=g+this.rowIndxOffset,e=e.colIndx;if(null!=e){if(!1==this._trigger("cellDblClick",a,{$td:b,rowIndxPage:g,rowIndx:n,colIndx:e,column:this.colModel[e],rowData:this.data[g]}))return!1;1<this.options.editModel.clicksToEdit&&this.isEditableRow({rowIndx:n})&&this.isEditableCell({colIndx:e,rowIndx:n})&&this.editCell({rowIndxPage:g,
  colIndx:e})}};c._onClickCont=function(a){};c._onClickRow=function(a){var b=h(a.currentTarget),e=parseInt(b.attr("pq-row-indx")),g=e+this.rowIndxOffset;if(!isNaN(e)&&!1==this._trigger("rowClick",a,{$tr:b,rowIndxPage:e,rowIndx:g,rowData:this.data[e]}))return!1};c._onRightClickRow=function(a){var b=h(a.currentTarget),e=parseInt(b.attr("pq-row-indx")),g=e+this.rowIndxOffset;if(!isNaN(e)&&!1==this._trigger("rowRightClick",a,{$tr:b,rowIndxPage:e,rowIndx:g,rowData:this.data[e]}))return!1};c._onDblClickRow=
  function(a){var b=h(a.currentTarget),e=parseInt(b.attr("pq-row-indx")),g=this.getRowIndxOffset();if(!1==this._trigger("rowDblClick",a,{$tr:b,rowIndxPage:e,rowIndx:e+g,rowData:this.data[e]}))return!1};c._isValidCell=function(a){var b=a.rowData,e=h.trim(a.value),g=a.valueOrig,n=a.column,r=a.silent,t=n.dataIndx,d=this.options,c=d.validation,f=n.validations,k=document.activeElement;if(f&&0<f.length)for(var m=0;m<f.length;m++){var l=f[m],l=h.extend({},c,l),q=l.type,p=l.msg,p=p?p:"&nbsp;",y=l.icon,x=l.cls,
  x=x?x:"",B="padding:3px 10px;"+l.style,u=l.css,z=!0;a={valid:!1,msg:p,dataIndx:t};l=l.value;"minLen"==q&&e.length<l?z=!1:"maxLen"==q&&e.length>l?z=!1:"gt"==q&&e<=l?z=!1:"gte"==q&&e<l?z=!1:"lt"==q&&e>=l?z=!1:"lte"==q&&e>l?z=!1:"regexp"==q&&!1==(new RegExp(l)).test(e)?z=!1:"function"==typeof q&&(l={column:n,value:e,rowData:b,msg:p},!1==q.call(this.element[0],l)&&(z=!1,l.msg!=p&&(p=l.msg)));if(!z&&!0===r)return a;if(!z){b=this.getRowIndx({rowData:b}).rowIndx;if(void 0===g){if(null==b)throw"incorrect usage of isValid";
  this.goToPage({rowIndx:b});this.editCell({rowIndx:b,dataIndx:t})}else if(h(k).hasClass("pq-editor-focus")&&(e=d.editModel.indices)){g=e.rowIndx;e=e.dataIndx;if(null!=b&&b!=g)throw"incorrect usage of isValid rowIndx: "+b;if(t!=e)throw"incorrect usage of isValid dataIndx: "+t;this.editCell({rowIndx:g,dataIndx:t})}if((t=this.getEditCell())&&t.$cell){t=t.$cell;t.attr("title",p);try{t.tooltip("destroy")}catch(C){}t.tooltip({position:{my:"left center+5",at:"right center"},content:function(){h(this);return(""==
  y?"":"<span class='ui-icon "+y+" pq-tooltip-icon'></span>")+p},open:function(b,a){x&&a.tooltip.addClass(x);if(B){var e=a.tooltip.attr("style");a.tooltip.attr("style",e+";"+B)}u&&a.tooltip.css(u)}}).tooltip("open")}return a}}if(void 0!==g&&(t=this.getEditCell())&&t.$cell){t=t.$cell;t.removeAttr("title");try{t.tooltip("destroy")}catch(F){}}return{valid:!0}};c.isValid=function(a){var b=this.getRowData(a),e=a.dataIndx;if(null==e)for(var g=this.colModel,n=0,r=g.length;n<r;n++){var d=g[n];if(!d.hidden&&
  (e=d.dataIndx,e=b[e],d=this._isValidCell({rowData:b,value:e,column:d,silent:a.silent}),!d.valid))return d}else if(d=this.getColumn({dataIndx:e}),e=void 0===a.value?b[e]:a.value,d=this._isValidCell({rowData:b,value:e,valueOrig:a.value,column:d,silent:a.silent}),!d.valid)return d;return{valid:!0}};c.isEditableRow=function(a){var b=this.options,e=b.editable;return null!=e?"function"==typeof e?(a=a.rowIndx,e.call(this.element[0],{rowData:b.dataModel.data[a],rowIndx:a})):e:!0};c.isEditableCell=function(a){var b=
  a.colIndx,e=a.dataIndx,b=null==b?this.getColIndx({dataIndx:e}):b,b=this.colModel[b],e=null==e?b.dataIndx:e,g=b.editable;if(a.checkVisible&&b.hidden)return!1;if(null!=g){if("function"==typeof g){var n=a.rowIndx;a=this.getRowData(a);return g.call(this.element[0],{rowIndx:n,rowData:a,column:b,dataIndx:e})}return g}return!0};c._getRowPQData=function(a,b,e){return(e=null==e?this.data[a]:e)?e[b]:null};c._setRowPQData=function(a,b,e){if(e=null==e?this.data[a]:e)for(var g in b)e[g]=b[g]};c._onContMouseDown=
  function(a){this.blurEditor({blurIfFocus:!0});return!1===this._trigger("contMouseDown",a,{dataModel:this.options.dataModel})?!1:!0};c._onCellMouseDown=function(a){var b=h(a.currentTarget),e=this.getCellIndices({$td:b});e.$td=b;e.dataModel=this.options.dataModel;return!1==this._trigger("cellMouseDown",a,e)?!1:!0};c._onRowMouseDown=function(a){var b=h(a.currentTarget),e=this.getRowIndx({$tr:b});e.$tr=b;e.dataModel=this.options.dataModel;return!1==this._trigger("rowMouseDown",a,e)?!1:!0};c._onCellMouseEnter=
  function(a,b){var e=this.options,g=this.getCellIndices({$td:b});if(!1===this._trigger("cellMouseEnter",a,g))return!1;"cell"==e.hoverMode&&this.highlightCell(b);return!0};c._onRowMouseEnter=function(a,b){var e=this.options,g=this.getRowIndx({$tr:b}),n=g.rowIndxPage;if(!1===this._trigger("rowMouseEnter",a,g))return!1;"row"==e.hoverMode&&this.highlightRow(n);return!0};c._onCellMouseLeave=function(a,b){"cell"==this.options.hoverMode&&this.unHighlightCell(b);return!0};c._onRowMouseLeave=function(a,b){var e=
  this.getRowIndx({$tr:b}).rowIndxPage;"row"==this.options.hoverMode&&this.unHighlightRow(e);return!0};c._onCellMouseUp=function(a){var b=h(a.currentTarget),e=this.getCellIndices({$td:b});e.$td=b;e.dataModel=this.options.dataModel;return!1==this._trigger("cellMouseUp",a,e)?!1:!0};c._onRowMouseUp=function(a){var b=h(a.currentTarget),b=this.getRowIndx({$tr:b});return!1==this._trigger("rowMouseUp",a,b)?!1:!0};c._onClickCell=function(a){var b=this.colModel,e=this.options.editModel,g=h(a.currentTarget),
  n=this.getCellIndices({$td:g}),r=n.rowIndxPage,d=r+this.rowIndxOffset,c=n.colIndx;n.rowIndx=d;if(null!=c){var b=b[c],f=b.dataIndx;n.dataIndx=f;n.evt=a;if(!1==this._trigger("cellClick",a,{$td:g,rowIndxPage:r,rowIndx:d,colIndx:c,dataIndx:f,column:b,rowData:this.data[r]}))return!1;1==e.clicksToEdit&&this.isEditableRow({rowIndx:d})&&this.isEditableCell({colIndx:c,rowIndx:d})&&this.editCell(n)}};c._onRightClickCell=function(a){var b=h(a.currentTarget),e=this.getCellIndices({$td:b}),g=e.rowIndxPage,n=g+
  this.rowIndxOffset,e=e.colIndx,r=this.colModel;if(null!=e&&(r=r[e],!1==this._trigger("cellRightClick",a,{$td:b,rowIndxPage:g,rowIndx:n,colIndx:e,dataIndx:r.dataIndx,column:r,rowData:this.data[g]})))return!1};c.highlightCell=function(a){a.addClass("pq-grid-cell-hover ui-state-hover")};c.unHighlightCell=function(a){a.removeClass("pq-grid-cell-hover ui-state-hover")};c.highlightRow=function(a){isNaN(a)||(a=this.getRow({rowIndxPage:a}))&&a.addClass("pq-grid-row-hover ui-state-hover")};c.unHighlightRow=
  function(a){isNaN(a)||(a=this.getRow({rowIndxPage:a}))&&a.removeClass("pq-grid-row-hover ui-state-hover")};c._getCreateEventData=function(){return{dataModel:this.options.dataModel,data:this.data,colModel:this.options.colModel}};c._refreshOptions=function(){this._refreshDataOptions()};c._refreshDataOptions=function(){};c.enableSelection=function(){this.$cont.enableSelection()};c.disableSelection=function(){this.$cont.disableSelection();this.$header_o.find("tr.pq-grid-title-row").disableSelection()};
  c._findCellFromEvt=function(a){a=h(a.target).closest(".pq-grid-cell");if(null==a||0==a.length)return{rowIndxPage:null,colIndx:null,$td:null};var b=this.getCellIndices({$td:a});b.$td=a;return b};c._initPager=function(){var a=this,b={change:function(b,g){a.blurEditor({force:!0});var n=a.options.pageModel;void 0!=g.curPage&&(n.prevPage=n.curPage,n.curPage=g.curPage);void 0!=g.rPP&&(n.rPP=g.rPP);"remote"==n.type?a.remoteRequest({callback:function(){a._onDataAvailable({apply:!0})}}):a.refreshView()},refresh:function(b){a.refreshDataAndView()}};
  this.options.pageModel.type&&this.$footer.pqPager(b)};c._refreshHideArrHS=function(){for(var a=this.colModel,b=this.hidearrHS,e=this.initH,g=this.finalH,n=parseInt(this.options.freezeCols),r=0;r<n;r++)b[r]=!1;for(r=n;r<e;r++)b[r]=!0;for(r=e;r<=g;r++)b[r]=!1;r=g+1;for(a=a.length;r<a;r++)b[r]=!0};c.generateLoading=function(){this.$loading&&this.$loading.remove();this.$loading=h("<div class='pq-loading'></div>").appendTo(this.element);h(["<div class='pq-loading-bg'></div><div class='pq-loading-mask ui-state-highlight'><div>",
  this.options.strLoading,"...</div></div>"].join("")).appendTo(this.$loading);this.$loading.find("div.pq-loading-bg").css("opacity",.2)};c._refreshLoadingString=function(){this.$loading.find("div.pq-loading-mask").children("div").html(this.options.strLoading)};c.showLoading=function(){null==this.showLoadingCounter&&(this.showLoadingCounter=0);this.showLoadingCounter++;this.$loading.show()};c.hideLoading=function(){0<this.showLoadingCounter&&this.showLoadingCounter--;this.showLoadingCounter||this.$loading.hide()};
  c.refreshDataFromDataModel=function(){this._trigger("beforeRefreshData",null,{});var a=this.options,b=a.pageModel,a=a.dataModel.data,e=b.type;this.rowIndxOffset=0;if(null==a||0==a.length)e&&(b.curPage=0,b.totalPages=0,b.totalRecords=0),this.data=a;else{if(e&&"local"==e){b.totalRecords=a.length;b.totalPages=Math.ceil(a.length/b.rPP);b.curPage>b.totalPages&&(b.curPage=b.totalPages);1>b.curPage&&0<b.totalPages&&(b.curPage=1);var g=(b.curPage-1)*b.rPP,n=b.curPage*b.rPP;n>a.length&&(n=a.length);this.data=
  a.slice(g,n)}else"remote"==e?(g=Math.ceil(b.totalRecords/b.rPP),(b.totalPages=g)&&!b.curPage&&(b.curPage=1),n=b.rPP,n>a.length&&(n=a.length),this.data=a.slice(0,n)):this.data=a.slice(0);if("local"==e||"remote"==e)this.rowIndxOffset=b.rPP*(b.curPage-1)}};h.paramquery.filter=function(){var a={begin:{text:"Begins With",TR:!0,string:!0},between:{text:"Between",TR:!0,string:!0,date:!0,number:!0},notbegin:{text:"Does not begin with",TR:!0,string:!0},contain:{text:"Contains",TR:!0,string:!0},notcontain:{text:"Does not contain",
  TR:!0,string:!0},equal:{text:"Equal To",TR:!0,string:!0,bool:!0},notequal:{text:"Not Equal To",TR:!0,string:!0},empty:{text:"Empty",TR:!1,string:!0,bool:!0},notempty:{text:"Not Empty",TR:!1,string:!0,bool:!0},end:{text:"Ends With",TR:!0,string:!0},notend:{text:"Does not end with",TR:!0,string:!0},less:{text:"Less Than",TR:!0,number:!0,date:!0},lte:{text:"Less than or equal",TR:!0,number:!0,date:!0},range:{TR:!0,string:!0,number:!0,date:!0},regexp:{TR:!0,string:!0,number:!0,date:!0},great:{text:"Great Than",
  TR:!0,number:!0,date:!0},gte:{text:"Greater than or equal",TR:!0,number:!0,date:!0}};return{conditions:a,getAllConditions:function(){var b=[],e;for(e in a)b.push(e);return b}(),getConditions:function(b){var e=[],g;for(g in a)a[g][b]&&e.push(g);return e},getTRConditions:function(){var b=[],e;for(e in a)a[e].TR&&b.push(e);return b}(),getWTRConditions:function(){var b=[],e;for(e in a)a[e].TR||b.push(e);return b}()}}();h.paramquery.filter.rules={};h.paramquery.filter.rules.en={begin:"Begins With",between:"Between",
  notbegin:"Does not begin with",contain:"Contains",notcontain:"Does not contain",equal:"Equal To",notequal:"Not Equal To",empty:"Empty",notempty:"Not Empty",end:"Ends With",notend:"Does not end with",less:"Less Than",lte:"Less than or equal",great:"Great Than",gte:"Greater than or equal"};c.getQueryStringSort=function(){var a=this.iSort.sorters,b="",e=this.options,g=e.stringify;if(e.sql){for(e=0;e<a.length;e++)g=a[e],b+=(0<e?", ":"")+g.dataIndx+" "+("up"==g.dir?"asc":"desc");return b}return a.length?
  !1===g?a:JSON.stringify(a):""};c.getQueryStringCRUD=function(){return""};c.getQueryStringFilter=function(){var a=this.options,b=a.sql,e=a.stringify,g=a.filterModel,a=g.mode,n=this.getFilterData({CM:this.colModel,location:"remote"}),r="";if(g&&g.on&&n)if(b){r=[];for(e=0;e<n.length;e++){var d=n[e],b=d.condition,g=d.dataIndx,d=h.trim(d.value);"contain"===b?r.push(g+" like '%"+d+"%'"):"notcontain"===b?r.push(g+" not like '%"+d+"%'"):"begin"===b?r.push(g+" like '"+d+"%'"):"end"===b?r.push(g+" like '%"+
  d+"'"):"equal"===b?r.push(g+"='"+d+"'"):"notequal"===b?r.push(g+"!='"+d+"'"):"empty"===b?r.push("isnull("+g+",'')=''"):"notempty"===b?r.push("isnull("+g+",'')!=''"):"less"===b?r.push(g+"<'"+d+"'"):"great"===b&&r.push(g+">'"+d+"'")}r=r.join(" "+a+" ")}else n.length?(a={mode:a,data:n},r=!1===e?a:JSON.stringify(a)):r="";return r};c.remoteRequest=function(a){this.loading&&this.xhr.abort();var b=this,e="",g="",n=this.options,r=!1,d=this.colModel,c=n.dataModel,f=n.filterModel,k=n.pageModel;if("function"==
  typeof c.getUrl)(n=c.getUrl.call(this.element[0],{colModel:d,dataModel:c,groupModel:n.groupModel,pageModel:k,filterModel:f}))&&n.url&&(e=n.url),n&&n.data&&(g=n.data);else if("string"==typeof c.url){var e=c.url,g={},n={},m={};if("remote"==c.sorting){var l=this.getQueryStringSort();l&&(g={pq_sort:l})}"remote"==k.type&&(m={pq_curpage:k.curPage,pq_rpp:k.rPP});"local"!=f.type&&(l=this.getQueryStringFilter())&&(r=!0,n={pq_filter:l});var l=c.postData,q=c.postDataOnce;l&&"function"==typeof l&&(l=l.call(this.element[0],
  {colModel:d,dataModel:c}));g=h.extend({pq_datatype:c.dataType},n,m,g,l,q)}e&&(this.loading=!0,this.showLoading(),this.xhr=h.ajax({url:e,dataType:c.dataType,async:null==c.async?!0:c.async,cache:c.cache,contentType:c.contentType,type:c.method,data:g,beforeSend:function(a,e){if("function"==typeof c.beforeSend)return c.beforeSend.call(b.element[0],a,e)},success:function(e,g,n){"function"==typeof c.getData&&(e=c.getData.call(b.element[0],e,g,n));c.data=e.data;k.type&&"remote"==k.type&&(e.curPage&&(k.curPage=
  e.curPage),e.totalRecords&&(k.totalRecords=e.totalRecords));b.hideLoading();b.loading=!1;b._trigger("load",null,{dataModel:c,colModel:d});r&&b._trigger("filter",null,{type:"remote",dataModel:c,colModel:d,filterModel:f});a&&a.callback&&a.callback()},error:function(a,e,g){b.hideLoading();b.loading=!1;if("function"==typeof c.error)c.error.call(b.element[0],a,e,g);else if("abort"!=g)throw"Error : "+g;}}))};c._fixFireFoxContentEditableIssue=function(){};c.setFlexWHCallback=function(a){a.call(this);a=this.options;
  a.flexHeight&&this._setGridHeightFromTable();a.flexWidth&&this._setGridWidthFromTable()};c._refreshTitle=function(){this.$title.html(this.options.title)};c._destroyDraggable=function(){var a=this.element,b=a.parent(".pq-wrapper");b.length&&b.data("draggable")&&(b.draggable("destroy"),this.$title.removeClass("pq-draggable"),a.unwrap(".pq-wrapper"))};c._refreshDraggable=function(){var a=this.element,b=this.$title;this.options.draggable?(b.addClass("pq-draggable"),a.parent(".pq-wrapper").length||a.wrap("<div class='pq-wrapper' />"),
  a.parent(".pq-wrapper").draggable({handle:b})):this._destroyDraggable()};c._refreshResizable=function(){var a=this,b=this.element,e=this.options,g=-1<(e.width+"").indexOf("%"),n=-1<(e.height+"").indexOf("%"),r="auto"==e.width,d=e.flexWidth,c=e.flexHeight;if(!e.resizable||(c||n)&&(d||g||r))this._destroyResizable();else{var f="e,s,se";if(c||n)f="e";else if(d||g||r)f="s";d=!0;b.hasClass("ui-resizable")&&(c=b.resizable("option","handles"),f==c?d=!1:this._destroyResizable());d&&b.resizable({helper:"ui-state-default",
  handles:f,minWidth:e.minWidth,minHeight:e.minHeight?e.minHeight:100,delay:0,start:function(b,a){h(a.helper).css({opacity:.5,background:"#ccc",border:"1px solid steelblue"})},resize:function(b,a){},stop:function(b,d){n||(e.height=a.element.height());g||r||(e.width=a.element.width());a.refresh();a.element.css("position","relative");h(window).trigger("resize")}})}};c._refreshAfterResize=function(){var a=this.options,b=a.width,e=a.height,a=-1!=(b+"").indexOf("%")?!0:!1,b="auto"===b,e=-1!=(e+"").indexOf("%")?
  !0:!1;(a||b||e)&&this.refresh()};c.refresh=function(a){this._refresh(a)};c._refreshDataIndices=function(){if(!1!=this.options.getDataIndicesFromColIndices)for(var a=this.colModel,b=a.length,e=0;e<b;e++){var g=a[e];null==g.dataIndx&&(g.dataIndx=e)}};c.refreshView=function(a){null!=this.options.editModel.indices&&this.blurEditor({force:!0});this.refreshDataFromDataModel();this.refresh(a)};c._refresh=function(a){a=a||{};var b=a.header,e=a.table;a=this.element;if(a[0].offsetWidth){this.$grid_inner[0].scrollTop=
  0;var g=this.options;g.virtualX&&g.virtualY?this.pqpanes={v:!1,h:!1}:this.decidePanes();g.collapsible._collapsed=!1;var n=this;this._refreshGridWidthAndHeight();this._refreshDataIndices();this.iRefreshColumn.refreshColumnWidths();this._setScrollHNumEles();this._bufferObj_calcInitFinalH();this._refreshHideArrHS();!1!==b&&this._createHeader();this._refreshHeaderSortIcons();this._refreshPager();this._setInnerGridHeight();this._setRightGridHeight();a.height("");this.setFlexWHCallback(function(){!1!==
  e?n.iGenerateView.generateView():(n._saveDims(),n.iGenerateView.scrollView())});this._refreshScrollbars();this._refreshFreezeLine();this._createCollapse();g.dataModel.postDataOnce=void 0}};c._refreshScrollbars=function(a){this._setScrollHLength();this._setScrollVLength();this._setScrollVNumEles(!0);this._setScrollHLength();this._setScrollHVLength()};c._setScrollHVLength=function(){var a=this.options;(this.$hscroll.is(":hidden")||a.flexHeight||a.flexWidth)&&this.$hvscroll.css("visibility","hidden")};
  c._refreshPager=function(){var a=this.options,b=a.pageModel,e=this.$footer,g=b.rPP,n=b.totalRecords;b.type?(a=a.pageModel,!1==e.hasClass("pq-pager")&&this._initPager(),e.pqPager("option",a),n>g&&this.$bottom.css("display","")):(e.hasClass("pq-pager")&&e.pqPager("destroy"),a.showBottom?this.$bottom.css("display",""):this.$bottom.css("display","none"))};c.getThis=function(){return{that:this}};c._addRowsData=function(a){var b=a.data,e=this.options.dataModel.data;a=a.rowIndx;null==e&&(e=[]);if(null==
  a)for(var g=0,n=b.length;g<n;g++){var r=b[g];e.push(r)}else if(a<e.length)for(g=0,n=b.length;g<n;g++)r=b[g],e.splice(a,0,r),a++;else return!1;return!0};c.addRows=function(a){return this._addRowsData(a)?(this.refreshDataFromDataModel(),this.refresh(),!0):!1};c.refreshDataAndView=function(a){var b=this.options.dataModel;this.iSort._refreshSorters();if("remote"==b.location){var e=this;this.remoteRequest({callback:function(){e._onDataAvailable(a)}})}else this._onDataAvailable(a)};c.getColIndx=function(a){a=
  a.dataIndx;if(void 0===a)throw"dataIndx NA";for(var b=this.colModel,e=0,g=b.length;e<g;e++)if(b[e].dataIndx==a)return e};c.getColumn=function(a){if(void 0===a.dataIndx)throw"dataIndx N/A";a=a.dataIndx;for(var b=this.colModel,e=0,g=b.length;e<g;e++){var n=b[e];if(n.dataIndx==a)return n}return null};c._onDataAvailable=function(){};c._setOption=function(a,b){var e=this.options;if("height"==a)this._super.call(this,a,b);else if("width"==a)this._super.call(this,a,b);else if("title"==a)this._super.call(this,
  a,b),this._refreshTitle();else if("roundCorners"==a)this._super.call(this,a,b),b?(this.element.addClass("ui-corner-all"),this.$top.addClass("ui-corner-top"),this.$bottom.addClass("ui-corner-bottom")):(this.element.removeClass("ui-corner-all"),this.$top.removeClass("ui-corner-top"),this.$bottom.removeClass("ui-corner-bottom"));else if("freezeCols"==a)b=parseInt(b),!isNaN(b)&&0<=b&&b<=this.colModel.length-2&&this._super.call(this,a,b);else if("freezeRows"==a)b=parseInt(b),!isNaN(b)&&0<=b&&this._super.call(this,
  a,b);else if("resizable"==a)this._super.call(this,a,b),this._refreshResizable();else if("draggable"==a)this._super.call(this,a,b),this._refreshDraggable();else if("scrollModel"==a)this._super.call(this,a,b);else if("dataModel"==a)this._super.call(this,a,b);else if("pageModel"==a)this._super.call(this,a,b);else if("selectionModel"===a)this._super.call(this,a,b);else if("colModel"===a||"columnTemplate"==a)this._super.call(this,a,b),this._calcThisColModel();else if("disabled"===a)this._super.call(this,
  a,b),!0===b?this._disable():this._enable();else if("numberCell"===a)this._super.call(this,a,b),this.decidePanes();else if("strLoading"===a)this._super.call(this,a,b),this._refreshLoadingString();else if("showTop"===a)this._super.call(this,a,b),!0===b?this.$top.css("display",""):this.$top.css("display","none");else if("showTitle"===a)this._super.call(this,a,b),!0===b?this.$title.css("display",""):this.$title.css("display","none");else if("showToolbar"===a)this._super.call(this,a,b),!0===b?this.$toolbar.css("display",
  ""):this.$toolbar.css("display","none");else if("toolbar"==a)this._super.call(this,a,b),this.$toolbar.remove(),this._super.call(this,a,b),this._createToolbar();else if("collapsible"===a)this._super.call(this,a,b),this._createCollapse();else if("showBottom"===a)this._super.call(this,a,b),!0===b?this.$bottom.css("display",""):this.$bottom.css("display","none");else if("flexHeight"===a){this._super.call(this,a,b);var g=this.$vscroll;b&&g&&g.hasClass("pq-sb-vert")&&(e.virtualY?g.pqScrollBar("option",
  "cur_pos",0):g.pqScrollBar("option","ratio",0))}else"flexWidth"===a?(this._super.call(this,a,b),g=this.$hscroll,b&&g&&g.hasClass("pq-sb-horiz")&&(e.virtualX?g.pqScrollBar("option","cur_pos",0):g.pqScrollBar("option","ratio",0))):this._super.call(this,a,b)};c._setOptions=function(){this._super.apply(this,arguments)};c._generateCellRowOutline=function(){var a=this.options,b=a.editModel;if(this.$div_focus){if(a.debug)throw"this.$div_focus already present assert failed";}else a=this.element,b.inline&&
  (a=this.getCell(b.indices),a.css("padding",0).empty()),this.$div_focus=h("<div class='pq-editor-outer'><div class='pq-editor-inner'></div></div>").appendTo(a),b=h.extend({all:!0},b.indices),b=this.getCell(b),b.css("height",b.height()),b.empty(),this.refreshEditorPos()};c._removeCellRowOutline=function(a){if(this.$div_focus){a=this.$div_focus.find(".pq-editor-focus");a.hasClass("hasDatepicker")&&a.datepicker("hide").datepicker("destroy");if(a[0]==document.activeElement){var b=this._blurEditMode;this._blurEditMode=
  !0;a.blur();this._blurEditMode=b}this.$div_focus.remove();delete this.$div_focus;a=this.options.editModel;b=h.extend({},a.indices);a.indices=null;this.refreshCell(b)}};c.refreshEditorPos=function(){var a=this.options.editModel,b=a.cellBorderWidth,e=this.$div_focus,g=this.getCell(a.indices),a=g[0].offsetWidth-(b?2*b:1),n=g[0].offsetHeight-(b?2*b:1),r=this.element.offset(),g=g.offset();e.css({height:n,width:a,borderWidth:b,left:g.left-r.left-1,top:g.top-r.top-1})};c.setEditorPosTimer=function(){var a=
  this,b=this.options;this._refreshEditorPosTimer&&(window.clearInterval(this._refreshEditorPosTimer),this._refreshEditorPosTimer=null);this._refreshEditorPosTimer=window.setInterval(function(){b.editModel.indices&&a.refreshEditorPos()},200)};c._onHeaderCellClick=function(a,b){var e=this.colModel[a],g=this.options,n=e.dataIndx;!1!==this._trigger("headerCellClick",b,{column:e,colIndx:a,dataIndx:n})&&g.sortable&&!1!=e.sortable&&this.sort({colIndx:a,column:e,dataIndx:n})};c._selectRow=function(a,b){this.selectRow(a,
  b)};c._findfirstUnhiddenColIndx=function(){for(var a=0;a<this.colModel.length;a++)if(!this.colModel[a].hidden)return a};c.selectRow=function(a){var b=a.evt;if(b&&("keydown"==b.type||"keypress"==b.type)){if(!1==this.iRows.replace(a))return!1}else if(!1==this.iRows.add(a))return!1;return!0};c.get$Tbl=function(a,b){var e=this.$tbl,g=[];if(e&&e.length){var n=this.pqpanes,r=this.options,d=r.freezeRows,r=r.freezeCols;n.h&&n.v?null==b?a>=d?g.push(e[2],e[3]):g.push(e[0],e[1]):g=b>=r&&a>=d?e[3]:b<r&&a>=d?
  e[2]:b>=r&&a<d?e[1]:e[0]:g=n.v?null==b?e:b>=r?e[1]:e[0]:n.h?a>=d?e[1]:e[0]:e[0];if(g)return h(g)}};c.scrollCell=function(a){this.scrollRow(a);this.scrollColumn(a)};c.scrollY=function(a){this.$vscroll.pqScrollBar("option","cur_pos",a).pqScrollBar("scroll")};c.scrollRow=function(a){this.options.virtualY?this._scrollRowVirtualY(a):this._scrollRowNonVirtualY(a)};c._scrollRowNonVirtualY=function(a){var b=this.options,e=a.rowIndxPage,g=this.iHierarchy?!0:!1,n=a.rowIndx;a=this.$cont.data("offsetHeight")-
  this._getScollBarHorizontalHeight();e=null==e?n-this.rowIndxOffset:e;b=parseInt(b.freezeRows);if(!(e<b)){var b=this.get$Tbl(e),r=this.getRow({rowIndxPage:e}),e=r[0],n=e.offsetTop+parseInt(b.css("marginTop")),d=e.offsetHeight;g&&(g=r.next("tr.pq-detail-child"))&&g.length&&(d+=g[0].offsetHeight);e.offsetTop<-1*b[0].offsetTop?(g=-1*e.offsetTop-parseInt(b.css("top")),b.css("marginTop",g),this._syncScrollBarVert()):n+d>=a&&(g=a-d-e.offsetTop,b.css("marginTop",g),this._syncScrollBarVert())}};c._scrollRowVirtualY=
  function(a){var b=this.options,e=a.rowIndxPage,g=this.iHierarchy?!0:!1,n=a.rowIndx;a=this.scrollCurPos;e=null==e?n-this.rowIndxOffset:e;n=parseInt(b.freezeRows);if(!(e<n)&&(b=this._calcCurPosFromRowIndxPage(e),null!=b)){b<a&&this.$vscroll.pqScrollBar("option","cur_pos",b).pqScrollBar("scroll");var d=this.get$Tbl(e),c=d.children("tbody").children("tr[pq-row-indx="+e+"]"),f=e=c.last();1<c.length&&(f=c.first());var k=e[0],c=parseInt(d.css("marginTop"));if(void 0==k)this.$vscroll.pqScrollBar("option",
  "cur_pos",b).pqScrollBar("scroll");else{var k=k.offsetTop+k.offsetHeight,h=this.$cont[0].offsetHeight,m=this._getScollBarHorizontalHeight(),f=f.prev("tr");if(!f.hasClass("pq-row-hidden")&&!f.hasClass("pq-last-freeze-row")&&k>h-m-c){f=k-(h-m-c);c=d.children().children("tr");k=d=0;n?(n=c.filter("tr.pq-last-freeze-row").last().next(),0==n.length&&(n=c.filter("tr.pq-row-hidden").next())):n=c.filter("tr.pq-row-hidden").next();do{d+=n[0].offsetHeight;if(n[0]==e[0])break;else if(g&&!1!=n.hasClass("pq-detail-child")||
  k++,d>=f)break;n=n.next()}while(1);g=a+k;g>b&&(g=b);a=this.$vscroll.pqScrollBar("option","num_eles");a<g+1&&(a=g+1);this.$vscroll.pqScrollBar("option",{num_eles:a,cur_pos:g}).pqScrollBar("scroll")}}}};c.getTableForVertScroll=function(){var a=this.pqpanes,b=this.$tbl;if(b&&b.length)return a.h&&a.v?b=h([b[2],b[3]]):a.v?b=h([b[0],b[1]]):a.h&&(b=h(b[1])),b};c.getTableForHorScroll=function(){var a=this.pqpanes,b=[],e=this.$tbl;if(e&&e.length)return a.h&&a.v?b.push(e[1],e[3]):a.v?b.push(e[1]):a.h?b.push(e[0],
  e[1]):b.push(e[0]),this.tables.length&&(e=this.tables[0].$tbl,a.v?b.push(e[1]):b.push(e[0])),h(b)};c.getTableHeaderForHorScroll=function(){var a=this.pqpanes,b=this.$tbl_header;if(b&&b.length)return b=a.v?h(b[1]):h(b[0]),b.parent()};c.blurEditor=function(a){if(this.$div_focus){var b=this.$div_focus.find(".pq-editor-focus");if(a&&a.blurIfFocus)document.activeElement==b[0]&&b.blur();else return b.triggerHandler("blur",a)}};c._syncViewWithScrollBarVert=function(a){if(null!=a){var b=this.getTableForVertScroll();
  if(b&&b.length){var e=this.options;e.editModel.indices&&this.blurEditor({force:!0});var g=b.data("offsetHeight"),n=this.$cont.data("offsetHeight")-this._getScollBarHorizontalHeight();a=-1*(g-n)*a-1;if((!g||!n)&&e.debug)throw"_syncViewWithScrollBarVert !tblHt || !contHt";-1<a&&(a=-1);b.css({marginTop:a})}}};c._syncViewWithScrollBarHor=function(a){if(null!=a){var b=this.getTableForHorScroll(),e=this.getTableHeaderForHorScroll();if(b||e){this.options.editModel.indices&&this.blurEditor({force:!0});var g=
  (b?b:e).data("scrollWidth"),n=this.$cont.data("offsetWidth")-this._getSBWidth();a*=-1*(g-n);g&&n&&(0<a&&(a=0),b&&b.css("marginLeft",a),e&&e.css("marginLeft",a))}}};c._syncScrollBarVert=function(){var a=this.getTableForVertScroll();if(a&&a.length){var b=a.data("offsetHeight"),e=this.$cont.data("offsetHeight")-this._getScollBarHorizontalHeight(),b=b-e,a=(-1*parseInt(a.css("marginTop"))-1)/(b-1);0<=a&&1>=a&&this.$vscroll.hasClass("pq-sb-vert")&&this.$vscroll.pqScrollBar("option","ratio",a)}};c._syncScrollBarHor=
  function(){var a=this.getTableForHorScroll(),b=this.getTableHeaderForHorScroll();if(a||b){var a=a?a:b,b=a.data("scrollWidth"),e=this.$cont.data("offsetWidth")-this._getSBWidth(),b=b-e,a=-1*parseInt(a.css("marginLeft"))/b;0<=a&&1>=a&&this.$hscroll.hasClass("pq-sb-horiz")&&this.$hscroll.pqScrollBar("option","ratio",a)}};c._scrollColumnNonVirtual=function(a){var b=a.colIndx,b=null==b?this.getColIndx({dataIndx:a.dataIndx}):b,e=this.options.freezeCols;if(!(b<e)){a=this._calcRightEdgeCol(b).width;var b=
  this._calcRightEdgeCol(b-1).width,e=this._calcRightEdgeCol(e-1).width,g=this._getSBWidth(),n=this.getTableForHorScroll(),d=this.getTableHeaderForHorScroll(),g=this.$cont[0].offsetWidth-g,c,f;if(n)c=parseInt(n.css("marginLeft")),f=n[0].offsetLeft;else if(d)c=parseInt(d.css("marginLeft")),f=d[0].offsetLeft-e;else return;a+c>g?(c=g-a,n&&n.css("marginLeft",c),d&&d.css("marginLeft",c),this._syncScrollBarHor()):b<-1*f&&(c=-1*b+e,n&&n.css("marginLeft",c),d&&d.css("marginLeft",c),this._syncScrollBarHor())}};
  c._scrollColumnVirtual=function(a){var b=a.colIndx,b=null==b?this.getColIndx({dataIndx:a.dataIndx}):b;a=this.options.freezeCols;var e=this._calcRightEdgeCol(b).width,g=this._getSBWidth(),n=this.$cont[0].offsetWidth;if(e>n-g){for(var e=q.call(this,-1,b+1)-(n-g),g=this.colModel,n=g.length,d=0,c=0,f=a;f<n;f++){var k=g[f];k.hidden||(d+=k.outerWidth);if(f==b){c=f-a-this._calcNumHiddenUnFrozens(f);break}else if(d>=e){c=f-a-this._calcNumHiddenUnFrozens(f)+1;break}}this.$hscroll.pqScrollBar("option","cur_pos",
  c).pqScrollBar("scroll");return!0}return this.hidearrHS[b]?(this.hidearrHS[b]=!1,b=b-a-this._calcNumHiddenUnFrozens(b),this.$hscroll.pqScrollBar("option","cur_pos",b).pqScrollBar("scroll"),!0):!1};c.scrollColumn=function(a){return this.options.virtualX?this._scrollColumnVirtual(a):this._scrollColumnNonVirtual(a)};c.selection=function(a){var b=a.method,e=a.type;if("row"==e)return this.iRows[b](a);if("cell"==e)return this.iCells[b](a)};c._bringPageIntoView=function(a){a=a.rowIndx;var b=this.options.pageModel;
  if("local"==b.type&&0<=a){var e=b.curPage,g=b.rPP;a>=(e-1)*g&&a<e*g||(b.curPage=Math.ceil((a+1)/g),this.refreshDataFromDataModel(),this.refresh())}};c.goToPage=function(a){var b=this.options.pageModel;if("local"==b.type||"remote"==b.type){var e=a.rowIndx,g=b.rPP;a=null==a.page?Math.ceil((e+1)/g):a.page;a!=b.curPage&&(b.curPage=a,"local"==b.type?(this.refreshDataFromDataModel(),this.refresh()):this.refreshDataAndView())}};c.setSelection=function(a){if(null==a)return this.iRows.removeAll({raiseEvent:!0}),
  this.iCells.removeAll({raiseEvent:!0}),!1;var b=this.data,e,g;if(a.rowData)e=this.getRowIndx(a).rowIndx;else{var n=this.rowIndxOffset;e=a.rowIndx;g=a.rowIndxPage;e=null==e?g+n:e}n=null==a.colIndx&&void 0!==a.dataIndx?this.getColIndx({dataIndx:a.dataIndx}):a.colIndx;if(0>e||0>n||n>=this.colModel.length||null==b||0==b.length)return!1;a.rowIndx=e;a.colIndx=n;this._bringPageIntoView(a);g=e-this.rowIndxOffset;a.rowIndxPage=g;this.scrollRow({rowIndxPage:g});if(null==n)return this._selectRow(a);this.scrollColumn({colIndx:n});
  return this.selectCell(a)};c.getColModel=function(){return this.colModel};c.saveEditCell=function(a){var b=this.options,e=b.editModel;if(!e.indices)return null;var g=h.extend({},e.indices),e=a?a.evt:null,n=g.rowIndxPage,d=n+this.rowIndxOffset,c=this.colModel[g.colIndx],g=c.dataIndx,f=this.data[n],k=b.dataModel,m;if(null==f)return null;m=f[g];if(null!=n){var l=this.getEditCellData();"<br>"==l&&(l="");null==m&&""===l&&(l=null);c={rowIndx:d,rowIndxPage:n,dataIndx:g,column:c,newVal:l,value:l,oldVal:m,
  rowData:f,dataModel:k};if(!1===this._trigger("cellBeforeSave",e,c))return!1;l!=m&&(f[g]=l,b.track&&(f=this.getRowData({rowIndx:d}),this.iUCData.update({rowData:f,dataIndx:g,oldVal:m,newVal:l})),this._trigger("cellSave",e,c),b.flexHeight?(this._setGridHeightFromTable(),this._fixIEFooterIssue()):a&&this.scrollRow({rowIndxPage:n}));return!0}};c._fixTableViewPort=function(){var a=this.element[0];a.scrollTop=0;a.scrollLeft=0;a=this.$header_o[0];a.scrollLeft=0;a.scrollTop=0;this.iGenerateView.setPanes()};
  c._fixIEFooterIssue=function(){h(".pq-grid-footer").css({position:"absolute"});h(".pq-grid-footer").css({position:"relative"})};c.refreshColumn=function(a){var b=this.colModel,e=a.colIndx,g=a.dataIndx,e=null==e?this.getColIndx({dataIndx:g}):e,g=null==g?b[e]:g,n=this.rowIndxOffset;a.colIndx=e;for(var d=this.initV,c=this.finalV,f=d;f<=c;f++){var k=f;a.rowIndx=k+n;a.rowIndxPage=k;a.colIndx=e;a.column=b[e];a.skip=!0;this.refreshCell(a)}this._fixTableViewPort();this._refreshScrollbars();this._trigger("refreshColumn",
  null,{dataModel:this.options.dataModel,colModel:b,initV:d,finalV:c,colIndx:e,dataIndx:g})};c.refreshCell=function(a){if(this.data){var b=this.rowIndxOffset,e=a.skip,g=a.rowIndx,n=a.rowIndxPage,g=a.rowIndx=null==g?n+b:g,n=a.rowIndxPage=null==n?g-b:n,b=a.dataIndx,d=a.colIndx,d=a.colIndx=null==d?this.getColIndx({dataIndx:b}):d,c=this.getCell({all:!0,rowIndxPage:n,colIndx:d}),f=a.column,k=this.colModel;a.column=f?f:k[d];var h=this.options.treeModel;if(f=this.data[n])a.tree=h.labelIndx?!0:!1,a.rowData=
  f,c&&0<c.length&&(a=this.iGenerateView.renderCell(a),c.replaceWith(a),e||(this._fixTableViewPort(),this._refreshScrollbars(),this._trigger("refreshCell",null,{dataModel:this.options.dataModel,colModel:k,rowData:f,rowIndx:g,rowIndxPage:n,colIndx:d,dataIndx:b})))}};c.refreshRow=function(a){if(this.data){var b=this.rowIndxOffset,e=a.rowIndx;a=a.rowIndxPage;e=null==e?a+b:e;a=null==a?e-b:a;var b=this.getRow({all:!0,rowIndxPage:a}),g=this.data[a];if(!g||!b||!b.length)return null;var n=[];this.iGenerateView.refreshRow(a,
  this.colModel,n);n=n.join("");b.replaceWith(n);this._fixTableViewPort();this._refreshScrollbars();this._trigger("refreshRow",null,{rowData:g,rowIndx:e,rowIndxPage:a});return!0}};c.quitEditMode=function(a){if(!this._quitEditMode){var b=!1,e=!1,g=!1,n=this.options.editModel,d=n.indices,c=void 0;this._quitEditMode=!0;a&&(b=a.old,e=a.silent,g=a.fireOnly,c=a.evt);d&&(e||b||this._trigger("editorEnd",c,d),g||(this._removeCellRowOutline(a),n.indices=null));this._quitEditMode=null}};c._fixIE=function(){var a=
  this.$cont[0];a.scrollLeft=0;a.scrollTop=0};c.getData=function(){return this.data};c.getViewPortRowsIndx=function(){return{beginIndx:this.initV,endIndx:this.finalV}};c.getViewPortIndx=function(){return{initV:this.initV,finalV:this.finalV,initH:this.initH,finalH:this.finalH}};c.getRowIndxOffset=function(){return this.rowIndxOffset};c.selectCell=function(a){var b=a.evt;if(b&&("keydown"==b.type||"keypress"==b.type)){if(!1==this.iCells.replace(a))return!1}else if(!1===this.iCells.add(a))return!1;return!0};
  c.getEditCell=function(){var a=this.options.editModel;if(a.indices){var a=this.getCell(a.indices),b=this.$div_focus.children(".pq-editor-inner"),e=b.find(".pq-editor-focus");return{$td:a,$cell:b,$editor:e}}return null};c.editCell=function(a){this.scrollRow(a);this.scrollColumn(a);return this._editCell(a)};c.getFirstEditableColIndx=function(a){if(null==a.rowIndx)throw"rowIndx NA";if(!this.isEditableRow(a))return-1;for(var b=this.colModel,e=0;e<b.length;e++)if(a.colIndx=e,this.isEditableCell(a)&&!b[e].hidden)return e;
  return-1};c.editFirstCellInRow=function(a){var b=this.rowIndxOffset,e=a.rowIndx;a=a.rowIndxPage;e=null==e?a+b:e;a=null==a?e-b:a;b=this.getFirstEditableColIndx({rowIndx:e});-1!=b&&this.editCell({rowIndxPage:a,colIndx:b})};c._editCell=function(a){var b=this,e=a.evt,g=this.rowIndxOffset,n=a.rowIndxPage,d=a.rowIndx,d=null==d?n+g:d,n=null==n?d-g:n,g=a.colIndx;a=a.dataIndx;var g=null==g?this.getColIndx({dataIndx:a}):g,c=this.colModel[g];a=c.dataIndx;var f=c.editor,k=this.options,m=k.editModel,k=k.editor,
  l=f?h.extend({},k,f):k,f=b.data[n],k=!1;if(m.indices){var q=m.indices;if(q.rowIndxPage==n&&q.colIndx==g){this.refreshEditorPos();var p=this.$div_focus.find(".pq-editor-focus");window.setTimeout(function(){p.focus()},0);return!1}if(!1===this.blurEditor({evt:e}))return!1;this.quitEditMode({evt:e})}m.indices={rowIndxPage:n,rowIndx:d,colIndx:g,column:c,dataIndx:a};this._generateCellRowOutline();q=this.$div_focus.children(".pq-editor-inner");"right"==c.align?q.addClass("pq-align-right"):"center"==c.align?
  q.addClass("pq-align-center"):q.addClass("pq-align-left");var s=f[a],v=l.type,y=l.select,x=l.init,B="pq-editor-focus "+(l.cls?l.cls:""),u=B+" pq-cell-editor ",z=l.attr?l.attr:"",C=l.style,F=(C=C?C:"")?"style='"+C+"'":"",D=q.width()-8,H="style='width:"+D+"px;"+C+"'",I=C?"style='"+C+"'":"",C={rowIndx:d,rowIndxPage:n,$cell:q,cellData:s,rowData:f,cls:B,dataIndx:a,column:c};"function"==typeof v?l=v.call(b.element[0],C):"checkbox"==v?(l=l.subtype,q.html("<input "+(s?"checked='checked'":"")+" class='"+u+
  "' "+z+" "+I+" type=checkbox name='"+a+"' />"),D=q.children("input"),"triple"==l&&(D.pqval({val:s}),q.click(function(b){h(this).children("input").pqval({incr:!0})}))):"textarea"==v||"select"==v||"textbox"==v?("textarea"==v?l="<textarea class='"+u+"' "+z+" "+H+" name='"+a+"' ></textarea>":"select"==v?(v=(v=l.options)?v:[],"function"===typeof v&&(v=v.call(b.element[0],{column:c,rowData:f})),u=[z," class='",u,"' ",H," name='",a,"'"].join(""),l=h.paramquery.select({options:v,attr:u,prepend:l.prepend,
  labelIndx:l.labelIndx,valueIndx:l.valueIndx,groupIndx:l.groupIndx})):l="<input class='"+u+"' "+z+" "+H+" type=text name='"+a+"' />",h(l).appendTo(q).width(D).val(s)):(q.html("<div contenteditable='true' tabindx='0' "+F+" "+z+" class='pq-editor-default "+B+"'></div>"),q.children().html(s),k=!0);"function"==typeof x&&x.call(b.element[0],C);var b=this,p=q.children(".pq-editor-focus"),J=m.filterKeys;(s=c.editModel)&&void 0!==s.filterKeys&&(J=s.filterKeys);var K={$cell:q,$editor:p,dataIndx:a,column:c,
  colIndx:g,rowIndx:d,rowIndxPage:n,rowData:f};m.indices=K;p.data({FK:J}).on("click",function(b){h(this).focus()}).on("keydown",function(a){b.iKeyNav._keyDownInEdit(a)}).on("keypress",function(a){return b.iKeyNav._keyPressInEdit(a,{FK:J})}).on("keyup",function(a){return b.iKeyNav._keyUpInEdit(a,{FK:J})}).on("blur",function(a,e){var g=b.options.editModel,n=g.onBlur,d="save"==n,c="validate"==n,r=g.cancelBlurCls,f=e?e.force:!1;if(!b._quitEditMode&&!b._blurEditMode&&g.indices){g=h(a.target);if(!f){if(!1===
  b._trigger("editorBlur",a,K)||!n||r&&g.hasClass(r))return;if(g.hasClass("hasDatepicker")){if(g.datepicker("widget").is(":visible"))return!1}else if(g.hasClass("ui-autocomplete-input")&&g.autocomplete("widget").is(":visible"))return}b._blurEditMode=!0;if(!b.saveEditCell({evt:a,silent:f||d||!c})&&!f&&c)return b._deleteBlurEditMode(),!1;b.quitEditMode({evt:a});b._deleteBlurEditMode()}}).on("focus",function(a){b._trigger("editorFocus",a,K)});b._trigger("editorBegin",e,K);p.focus();window.setTimeout(function(){!1===
  h(document.activeElement).hasClass("pq-editor-focus")&&b.element.find(".pq-editor-focus").focus()},0);b.element[0].scrollLeft=0;b.element[0].scrollTop=0;if(y)if(k)try{var M=p[0],O=document.createRange();O.selectNodeContents(M);var P=window.getSelection();P.removeAllRanges();P.addRange(O)}catch(Q){}else p.select()};c._deleteBlurEditMode=function(a){var b=this;a=a?a:{};b._blurEditMode&&(a.timer?window.setTimeout(function(){delete b._blurEditMode},0):delete b._blurEditMode)};c.getRow=function(a){var b=
  a.rowIndxPage,e=a.rowIndx,g=this.rowIndxOffset,b=null==b?e-g:b;a=a.all?this.$tbl:this.get$Tbl(b);var n;a&&a.length&&(e=a.children("tbody"),null!=b&&(n=e.children("tr[pq-row-indx="+b+"]"),n.length>a.length&&(n=n.filter(".pq-detail-master"))));return n};c.getCell=function(a){var b=a.rowIndxPage,e=a.rowIndx,b=null==b?e-this.rowIndxOffset:b,e=a.colIndx,g=a.dataIndx,e=null==e?this.getColIndx({dataIndx:g}):e;a=a.all?this.$tbl:this.get$Tbl(b,e);var n;return void 0!=a&&(n=a.children().children("tr[pq-row-indx="+
  b+"]").children("td[pq-col-indx="+e+"]"),0==n.length)?null:n};c.getCellHeader=function(a){var b=a.colIndx;a=a.dataIndx;b=null==b?this.getColIndx({dataIndx:a}):b;a=this.$tbl_header;var e,g=this.options.freezeCols;void 0!=a&&(1<a.length&&(a=b>=g?h(a[1]):h(a[0])),e=a.children().children("tr:last").children("td[pq-col-indx="+b+"]"));return 0==e.length||"hidden"==e[0].style.visibility?null:e};c.getEditorIndices=function(){var a=this.options.editModel.indices;return a?h.extend({},a):null};c.getEditCellData=
  function(){var a=this.options,b=a.editModel.indices;if(!b)return null;var e=b.rowIndxPage,g=b.rowIndx,b=this.colModel[b.colIndx],n=b.editor,a=a.editor,a=n?h.extend({},a,n):a,d=b.dataIndx,n=this.$div_focus.children(".pq-editor-inner"),c;"function"==typeof a.getData?c=a.getData.call(this.element[0],{$cell:n,dataIndx:d,rowIndx:g,rowIndxPage:e,column:b}):(e=a.type,"checkbox"==e?(c=n.children(),c="triple"==a.subtype?c.pqval():c.is(":checked")?!0:!1):"contenteditable"==e?c=n.children().html():(e=n.find('*[name="'+
  d+'"]'))&&e.length?c=e.val():(e=n.find(".pq-editor-focus"))&&e.length&&(c=e.val()));return c};c.getCellIndices=function(a){var b=a.$td;if(null==b||0==b.length||b.closest(".pq-grid")[0]!=this.element[0])return{rowIndxPage:null,colIndx:null};a=b.parent("tr").attr("pq-row-indx");var e;null!=a&&(a=parseInt(a),e=a+this.rowIndxOffset);var b=b.attr("pq-col-indx"),g;null!=b&&(b=parseInt(b),g=this.colModel[b].dataIndx);return{rowIndxPage:a,rowIndx:e,colIndx:b,dataIndx:g}};c.getRowsByClass=function(a){var b=
  this.options,e="remote"==b.pageModel.type?!0:!1,g=this.rowIndxOffset,b=b.dataModel.data,n=[];if(null==b)return n;for(var d=0,c=b.length;d<c;d++){var f=b[d];a.rowData=f;this.hasClass(a)&&(f={rowData:f},f.rowIndx=e?d+g:d,n.push(f))}return n};c.getCellsByClass=function(a){var b=this.options,e="remote"==b.pageModel.type?!0:!1,g=this.rowIndxOffset,b=b.dataModel.data,n=this.colModel,d=n.length,c=[];if(null==b)return c;for(var f=0,k=b.length;f<k;f++){var l=b[f];a.rowData=l;for(var h=0;h<d;h++){var m=n[h].dataIndx;
  a.dataIndx=m;this.hasClass(a)&&(m={rowData:l,dataIndx:m,colIndx:h},m.rowIndx=e?f+g:f,c.push(m))}}return c};c.addClass=function(a){var b=a.rowIndx,e=a.dataIndx,g=a.cls,n=this.rowIndxOffset,d=this.getRowData(a);if(d){null==b&&(b=this.getRowIndx({rowData:d}).rowIndx);for(var g=g.split(" "),c=0;c<g.length;c++){var f=g[c];if(null==e&&!1===this.hasClass({rowData:d,cls:f})){var k=d.pq_rowcls;d.pq_rowcls=k?h.trim(k)+" "+f:f;null!=b&&!1!==a.refresh&&(k=this.getRow({rowIndxPage:b-n}))&&k.addClass(f)}else if(!1===
  this.hasClass({rowData:d,dataIndx:e,cls:f})){if(k=d.pq_cellcls){var l=k[e];k[e]=l?h.trim(l)+" "+f:f}else k={},k[e]=f,d.pq_cellcls=k;null!=b&&!1!==a.refresh&&(k=this.getCell({rowIndxPage:b-n,dataIndx:e}))&&k.addClass(f)}}}};c.removeClass=function(a){var b=a.rowIndx,e=this.getRowData(a),g=a.dataIndx,n=a.cls,d=null!=g&&e?e.pq_cellcls:null,c=e?e.pq_rowcls:null;null!=e&&(null==b&&(b=this.getRowIndx({rowData:e}).rowIndx),null==g?(c&&(e.pq_rowcls=this._removeClass(c,n)),null!=b&&!1!==a.refresh&&(a=this.getRow({rowIndx:b}))&&
  a.removeClass(n)):d&&((d=d[g])&&(e.pq_cellcls[g]=this._removeClass(d,n)),null!=b&&!1!==a.refresh&&(a=this.getCell({rowIndx:b,dataIndx:g}))&&a.removeClass(n)))};c.hasClass=function(a){var b=a.dataIndx,e=a.cls;a=this.getRowData(a);e=new RegExp("\\b"+e+"\\b");return a?null==b?(b=a.pq_rowcls)&&e.test(b)?!0:!1:(a=a.pq_cellcls)&&a[b]&&e.test(a[b])?!0:!1:null};c._removeClass=function(a,b){if(a){for(var e=a.split(" "),g=b.split(" "),n=[],d=0,c=e.length;d<c;d++){for(var f=e[d],k=!1,l=0,h=g.length;l<h;l++)if(f===
  g[l]){k=!0;break}k||n.push(f)}return 1<n.length?n.join(" "):1===n.length?n[0]:null}};c.getRowIndx=function(a){var b=a.$tr;if(a=a.rowData){var e=this.options,b="remote"==e.pageModel.type?!0:!1,e=e.dataModel.data,g=!1;if(e)for(var n=0,d=e.length;n<d;n++)if(e[n]==a){g=!0;break}return g?(a=this.rowIndxOffset,{rowIndxPage:b?n:n-a,rowIndx:b?n+a:n}):{}}if(null==b||0==b.length)return{rowIndxPage:null};n=b.attr("pq-row-indx");if(null==n)return{rowIndxPage:null};n=parseInt(n);return{rowIndxPage:n,rowIndx:n+
  this.rowIndxOffset}};var d=function(a){this.options=a.options;this.that=a;var b=this,e=a.widgetEventPrefix.toLowerCase();a.element.on(e+"celleditkeyup"+a.eventNamespace,function(a,e){return b.filterKeys(a,e)})},k=d.prototype;k._incrRowIndx=function(a,b){var e=this.that,g=a;b=null==b?1:b;for(var e=e.data,n=0,d=a+1,c=e.length;d<c&&(e[d].pq_hidden||(n++,g=d,n!=b));d++);return g};k._decrRowIndx=function(a,b){var e=a,g=this.that.data;b=null==b?1:b;for(var n=0,d=a-1;0<=d&&(g[d].pq_hidden||(n++,e=d,n!=b));d--);
  return e};c.addColumn=function(a,b){var e=this.options,g=e.dataModel.data;e.colModel.push(a);this._calcThisColModel();for(e=0;e<g.length;e++)g[e].push("")};c.rowNextSelect=function(){var a=this.selection({type:"row",method:"getSelection"}),b,e=this.rowIndxOffset;a&&a[0]&&(a=a[0].rowIndx,b=this.iKeyNav._incrRowIndx(a-e));null!=b&&(this.setSelection(null),this._setSelection({rowIndxPage:b}));return b};c.rowPrevSelect=function(){var a=this.selection({type:"row",method:"getSelection"}),b,e=this.rowIndxOffset;
  a&&a[0]&&(a=a[0].rowIndx,b=this.iKeyNav._decrRowIndx(a-e));null!=b&&(this.setSelection(null),this.setSelection({rowIndxPage:b}));return b};k._incrIndx=function(a,b){var e=this.that,g=e._getLastVisibleRowIndxPage(e.data),e=e.colModel,n=e.length;if(null==b){if(a==g)return null;a=this._incrRowIndx(a);return{rowIndxPage:a}}var d;do{b++;if(b>=n){if(a==g)return null;a=this._incrRowIndx(a);b=0}d=e[b]}while(d&&d.hidden);return{rowIndxPage:a,colIndx:b}};k._decrIndx=function(a,b){var e=this.that,g=e.colModel,
  n=g.length,e=e._getFirstVisibleRowIndxPage(e.data);if(null==b){if(a==e)return null;a=this._decrRowIndx(a);return{rowIndxPage:a}}var d;do{b--;if(0>b){if(a==e)return null;a=this._decrRowIndx(a);b=n-1}d=g[b]}while(d&&d.hidden);return{rowIndxPage:a,colIndx:b}};k._incrEditIndx=function(a,b){var e=this.that,g=e.colModel,n=g.length,d,c=e.rowIndxOffset,f=e._getLastVisibleRowIndxPage(e.data);do{b++;if(b>=n){if(a==f)return null;do{a=this._incrRowIndx(a);var k=a+c;d=e.isEditableRow({rowIndx:k});if(a==f&&!1==
  d)return null}while(!1==d);b=0}d=g[b];k=a+c;k=e.isEditableCell({rowIndx:k,colIndx:b,checkVisible:!0})}while(d&&(d.hidden||!1==k));return{rowIndxPage:a,colIndx:b}};k._decrEditIndx=function(a,b){var e=this.that,g=e.colModel,n=g.length,d,c=e.rowIndxOffset,f=e._getFirstVisibleRowIndxPage(e.data);do{b--;if(0>b){if(a==f)return null;do{a=this._decrRowIndx(a);var k=a+c;d=e.isEditableRow({rowIndx:k});if(a==f&&!1==d)return null}while(!1==d);b=n-1}d=g[b];k=a+c;k=e.isEditableCell({rowIndx:k,colIndx:b,checkVisible:!0})}while(d&&
  (d.hidden||!1==k));return{rowIndxPage:a,colIndx:b}};k._incrEditRowIndx=function(a,b){var e=this.that,g=e.rowIndxOffset,n=e._getLastVisibleRowIndxPage(e.data);if(a==n)return null;do{a=this._incrRowIndx(a);var d=a+g,c=e.isEditableRow({rowIndx:d}),d=e.isEditableCell({rowIndx:d,colIndx:b}),c=c&&d;if(a==n&&!c)return null}while(!c);return{rowIndxPage:a,colIndx:b}};k._decrEditRowIndx=function(a,b){var e=this.that,g=e.rowIndxOffset,n=e._getFirstVisibleRowIndxPage(e.data);if(a==n)return null;do{a=this._decrRowIndx(a);
  var d=a+g,c=e.isEditableRow({rowIndx:d}),d=e.isEditableCell({rowIndx:d,colIndx:b}),c=c&&d;if(a==n&&!c)return null}while(!c);return{rowIndxPage:a,colIndx:b}};c._onKeyPressDown=function(a){if(0<h(a.target).closest(".pq-grid-header").length)return!1==this._trigger("headerKeyDown",a,{dataModel:this.options.dataModel})?!1:!0;if(!1===this.iKeyNav._bodyKeyPressDown(a)||!1==this._trigger("keyDown",a,{dataModel:this.options.dataModel}))return!1};k._saveAndMove=function(a,b){if(null==a)return b.preventDefault(),
  !1;var e=this.that,g=this.options.selectionModel,n=a.rowIndxPage,d=a.colIndx;e._blurEditMode=!0;if(!1===e.saveEditCell({evt:b}))return e._deleteBlurEditMode({timer:!0,msg:"_saveAndMove saveEditCell"}),b.preventDefault(),!1;e.quitEditMode(b);"row"==g.type?(e.setSelection(null),e.setSelection({rowIndxPage:n}),e.scrollColumn({colIndx:d})):"cell"==g.type?(e.setSelection(null),e.setSelection({rowIndxPage:n,colIndx:d})):(e.scrollRow({rowIndxPage:n}),e.scrollColumn({colIndx:d}));e._editCell({rowIndxPage:n,
  colIndx:d});e._deleteBlurEditMode({timer:!0,msg:"_saveAndMove"});b.preventDefault();return!1};k._keyPressInEdit=function(a,b){var e=this.that,g=e.options.editModel.indices;b=b?b:{};var n=b.FK,d=g.column.dataType;if(!1===e._trigger("editorKeyPress",a,h.extend({},g))||n&&("float"==d||"integer"==d)&&(e="float"==d?"0123456789.-":"0123456789-",g=(g=a.charCode)?g:a.keyCode,(g=String.fromCharCode(g))&&-1==e.indexOf(g)))return!1};k.getValText=function(a){a=a[0].nodeName.toLowerCase();var b="text";-1!=h.inArray(a,
  ["input","textarea","select"])&&(b="val");return b};k._keyUpInEdit=function(a,b){var e=this.that,g=e.options;b=b?b:{};var n=b.FK,g=g.editModel,d=g.indices;e._trigger("editorKeyUp",a,h.extend({},d));e=d.column.dataType;if(n&&("float"==e||"integer"==e)){var n=h(a.target),d="integer"==e?g.reInt:g.reFloat,g=this.getValText(n),c=n.data("oldVal"),f=n[g]();if(!1==d.test(f))if(d.test(c))n[g](c);else if(e="float"==e?parseFloat(c):parseInt(c),isNaN(e))n[g](0);else n[g](e)}};k._keyDownInEdit=function(a){var b=
  this.that,e=b.options,g=e.editModel.indices;if(g){var n=h(a.target),d=h.ui.keyCode,c=e.selectionModel,f=e.editModel,g=h.extend({},g),e=g.rowIndxPage,k=g.colIndx,l=g.column.editModel,f=l?h.extend({},f,l):f,l=this.getValText(n);n.data("oldVal",n[l]());if(!1==b._trigger("cellEditKeyDown",a,g)||!1==b._trigger("editorKeyDown",a,g))return!1;if(a.keyCode==d.TAB)return g=a.shiftKey?this._decrEditIndx(e,k):this._incrEditIndx(e,k),this._saveAndMove(g,a);if(a.keyCode==f.saveKey)return g=this._incrEditIndx(e,
  k),this._saveAndMove(g,a);if(a.keyCode==d.ESCAPE)return b.quitEditMode({evt:a}),"cell"==c.type?b.getCell({rowIndxPage:e,colIndx:k}).attr("tabindex",0).focus():"row"==c.type&&(b=b.getRow({rowIndxPage:e}),h(b[0]).attr("tabindex",0).focus()),a.preventDefault(),!1;if(a.keyCode==d.PAGE_UP||a.keyCode==d.PAGE_DOWN)return a.preventDefault(),!1;if(f.keyUpDown){if(a.keyCode==d.DOWN)return g=this._incrEditRowIndx(e,k),this._saveAndMove(g,a);if(a.keyCode==d.UP)return g=this._decrEditRowIndx(e,k),this._saveAndMove(g,
  a)}}};k.select=function(a){var b=this.that,e=a.rowIndx,g=a.colIndx,n=b.options.selectionModel;a=a.evt;a.shiftKey&&"single"!=n.mode?"row"==n.type?(b.scrollRow({rowIndx:e}),b.iRows.extendSelection({rowIndx:e,evt:a})):"cell"==n.type&&(b.scrollCell({rowIndx:e,colIndx:g}),b.iCells.extendSelection({rowIndx:e,colIndx:g,evt:a})):b.setSelection({rowIndx:e,colIndx:g,evt:a,setFirst:!0})};k._bodyKeyPressDown=function(a){var b=this.that,e,g,n=b.rowIndxOffset,d=this.options,c=b.colModel,f=d.selectionModel,k,l,
  m=h.ui.keyCode;if(d.editModel.indices)b.$div_focus.find(".pq-cell-focus").focus();else{if("row"==f.type){g=a.ctrlKey?b.iRows.getFocusSelection({old:!0}):b.iRows.getFocusSelection({old:!1});if(null==g)return;k=g.rowIndx;d=k-n;if(null==k)return;if(!1==b._trigger("rowKeyDown",a,{rowData:b.data[d],rowIndx:k,rowIndxPage:d}))return!1}else if("cell"==f.type){e=a.ctrlKey?b.iCells.getFocusSelection({old:!0}):b.iCells.getFocusSelection({old:!1});if(null==e)return;l=e;k=l.rowIndx;var d=k-n,q=l.dataIndx;l=b.getColIndx({dataIndx:q});
  if(null==k||null==l)return;if(!1==b._trigger("cellKeyDown",a,{rowData:b.data[d],rowIndx:k,rowIndxPage:d,colIndx:l,dataIndx:q,column:c[l]}))return!1;if(a.cancelBubble)return}else return;if(a.keyCode==m.LEFT){if(l=this._decrIndx(d,l))k=l.rowIndxPage+n,this.select({rowIndx:k,colIndx:l.colIndx,evt:a});a.preventDefault()}else if(a.keyCode==m.RIGHT){if(l=this._incrIndx(d,l))k=l.rowIndxPage+n,this.select({rowIndx:k,colIndx:l.colIndx,evt:a});a.preventDefault()}else if(a.keyCode==m.UP)d=this._decrRowIndx(d),
  null!=d&&this.select({rowIndx:d+n,colIndx:l,evt:a}),a.preventDefault();else if(a.keyCode==m.DOWN)d=this._incrRowIndx(d),null!=d&&this.select({rowIndx:d+n,colIndx:l,evt:a}),a.preventDefault();else if(a.keyCode==m.PAGE_DOWN||a.keyCode==m.SPACE){if(b=this.pageDown(d))d=b.rowIndxPage,null!=d&&this.select({rowIndx:d+n,colIndx:l,evt:a});a.preventDefault()}else if(a.keyCode==m.PAGE_UP){if(b=this.pageUp(d))d=b.rowIndxPage,null!=d&&this.select({rowIndx:d+n,colIndx:l,evt:a});a.preventDefault()}else a.keyCode==
  m.HOME?("row"==f.type||a.ctrlKey?(k=b._getFirstVisibleRowIndxPage(b.data)+n,this.select({rowIndx:k,colIndx:l,evt:a})):"cell"==f.type&&(l=b._getFirstVisibleColIndx(),this.select({rowIndx:k,colIndx:l,evt:a})),a.preventDefault()):a.keyCode==m.END?("row"==f.type||a.ctrlKey?(k=b._getLastVisibleRowIndxPage(b.data)+n,this.select({rowIndx:k,colIndx:l,evt:a})):"cell"==f.type&&(l=b._getLastVisibleColIndx(),this.select({rowIndx:k,colIndx:l,evt:a})),a.preventDefault()):a.keyCode==m.ENTER?("row"==f.type?null!=
  g&&b.editFirstCellInRow({rowIndx:d+n}):null!=e&&(e=b.getCell({rowIndxPage:d,colIndx:l}))&&0<e.length&&(k=d+n,n=b.isEditableRow({rowIndx:k}),e=b.isEditableCell({rowIndx:k,colIndx:l}),n&&e&&b.editCell({rowIndxPage:d,colIndx:l})),a.preventDefault()):a.ctrlKey&&"65"==a.keyCode&&("row"==f.type&&"single"!=f.mode?b.iRows.selectAll({all:f.all}):"cell"==f.type&&"single"!=f.mode&&b.iCells.selectAll({all:f.all}),a.preventDefault())}};k.incrPageSize=function(){for(var a=this.that,b=a.$tbl,e=b.children("tbody").children("tr.pq-grid-row").not(".pq-group-row,.pq-summary-row"),
  g=a.$cont[0].offsetHeight,b=parseInt(b.css("marginTop")),d=a._getScollBarHorizontalHeight(),g=g-d-b,b=e.length-1;0<=b;b--){var c=e[b];if(c.offsetTop<g)break}return{rowIndxPage:a.getRowIndx({$tr:h(c)}).rowIndxPage}};k.pageNonVirtual=function(a,b){var e=this.that,g=e.$cont[0].offsetHeight-e._getScollBarHorizontalHeight(),d=e.getRow({rowIndxPage:a}),c=0,f=0,k=h(d[0])[b]("tr.pq-grid-row"),l=k.length;if(0<l){do{d=k[f];c+=d.offsetHeight;if(c>=g)break;f++}while(f<l);f=0<f?f-1:f;do if(d=h(k[f]),a=e.getRowIndx({$tr:d}).rowIndxPage,
  null!=a)break;else f--;while(0<=f)}return a};k.pageDown=function(a){var b=this.that,e=b.options,g=b.$vscroll.pqScrollBar("option"),d=g.cur_pos,c=g.num_eles,g=g.ratio;if(e.virtualY){if(d<c-1){a=this.incrPageSize().rowIndxPage;var f=b._calcCurPosFromRowIndxPage(a);if(null==f)return;b.$vscroll.pqScrollBar("option","cur_pos",f).pqScrollBar("scroll")}}else null!=a?a=this.pageNonVirtual(a,"nextAll"):1>g&&(e=b.$cont.data("offsetHeight")-b._getScollBarHorizontalHeight(),b.iMouseSelection.updateTableY(-1*
  e),b._syncScrollBarVert());return{rowIndxPage:a,curPos:f}};k.pageUp=function(a){var b=this.that,e=b.options,g=b.$vscroll.pqScrollBar("option"),d=g.cur_pos,g=g.ratio;if(e.virtualY){if(0<d){a=this.decrPageSize().rowIndxPage;var c=b._calcCurPosFromRowIndxPage(a);if(null==c)return;b.$vscroll.pqScrollBar("option","cur_pos",c).pqScrollBar("scroll")}}else null!=a?a=this.pageNonVirtual(a,"prevAll"):0<g&&(e=b.$cont[0].offsetHeight-b._getScollBarHorizontalHeight(),b.iMouseSelection.updateTableY(e),b._syncScrollBarVert());
  return{rowIndxPage:a,curPos:c}};k.decrPageSize=function(){var a=this.that,b=a.$tbl.children("tbody").children("tr.pq-grid-row").not(".pq-group-row,.pq-summary-row"),e=a.options.freezeRows,g=0;if(b.length){var d;e?(d=b.filter("tr.pq-last-freeze-row"),d.length&&(d=d.next())):2<=b.length&&(d=h(b[1]));d&&d.length&&(g=a.getRowIndx({$tr:d}).rowIndxPage,g=g-a.pageSize+4,0>g&&(g=0))}return{rowIndxPage:g}};c._calcNumHiddenFrozens=function(){for(var a=0,b=this.options.freezeCols,e=0;e<b;e++)this.colModel[e].hidden&&
  a++;return a};c._calcNumHiddenUnFrozens=function(a){var b=0;a=null!=a?a:this.colModel.length;for(var e=this.options.freezeCols;e<a;e++)this.colModel[e].hidden&&b++;return b};c._setScrollHLength=function(){if(this.options.scrollModel.horizontal){this.$hscroll.css("visibility","");this.$hvscroll.css("visibility","");var a=this.$cont[0].offsetWidth,b=this._getSBWidth();0==b?this.$hscroll.css("right",0):this.$hscroll.css("right","");this.$hscroll.pqScrollBar("option","length",a-b)}else this.$hscroll.css("visibility",
  "hidden"),this.$hvscroll.css("visibility","hidden")};c._setScrollHNumEles=function(){var a=this.options,b=a.scrollModel,e=0;a.flexWidth||(e="fullScroll"==b.lastColumn?this.colModel.length-a.freezeCols-this._calcNumHiddenUnFrozens():this.calcColsOutsideCont(this.colModel)+1);this.$hscroll.pqScrollBar("option","num_eles",e)};c.calcColsOutsideCont=function(a){var b=this.options.numberCell,e=this.$tbl?this.$tbl[this.$tbl.length-1]:null,e=e?e.scrollWidth:0,g=this.options.freezeCols,d=this.$cont[0].offsetWidth-
  this._getSBWidth(),e=0;b.show&&(e+=b.outerWidth);for(b=0;b<a.length;b++){var c=a[b];c.hidden||(e+=c.outerWidth)}var f=0,k=0;e>d&&k++;for(b=g;b<a.length;b++)if(c=a[b],!c.hidden)if(f+=c.outerWidth,g=e-f,g>d)k++;else break;return k};c._getScollBarHorizontalHeight=function(){var a=17,b=this.$hscroll;if("hidden"==b.css("visibility")||!1==this.options.scrollModel.horizontal||"none"==b.css("display"))a=0;return a};c._getSBWidth=function(){var a=17,b=this.$vscroll;if(null==this.initV||"hidden"==b.css("visibility")||
  this.options.flexHeight||"none"==b.css("display"))a=0;return a};c._setScrollVNumEles=function(a){var b=this.iHierarchy?!0:!1,e=this.$vscroll.pqScrollBar("option"),g=parseInt(e.num_eles),d=parseInt(e.cur_pos),e=this.options,g=this._getScollBarHorizontalHeight(),g=this.$cont[0].offsetHeight-g+1,e=(e.groupModel?this.dataGM:this.data)?this.totalVisibleRows:0,c,f=0;this.$tbl&&0<this.$tbl.length&&(c=this.$tbl[this.$tbl.length-1],f=c.offsetHeight,c=h(c));if(0<f&&f>g){c=c.children().children("tr");for(var k=
  f=d=0;k<c.length;k++){var l=c[k],d=d+l.offsetHeight;if(d>=g){b&&h(l).hasClass("pq-detail-child")?(f--,f=1<f?f-1:1):f=1<f?f-1:0;break}else b?!1==h(l).hasClass("pq-detail-child")&&f++:f++}0==f&&(f=c.length-1);g=e-f+1}else g=d+1;g>e&&(g=e);a?this.$vscroll.pqScrollBar("option","num_eles",g):this.$vscroll.pqScrollBar("setNumEles",g);return g};c._getFirstVisibleRowIndxPage=function(a){for(var b=0,e=a.length;b<e;b++)if(!a[b].pq_hidden)return b};c._getLastVisibleRowIndxPage=function(a){for(var b=a.length-
  1;0<=b;b--)if(!a[b].pq_hidden)return b;return null};c._getFirstVisibleColIndx=function(){for(var a=this.colModel,b=a.length,e=0;e<b;e++)if(!a[e].hidden)return e;return null};c._getLastVisibleColIndx=function(){for(var a=this.colModel,b=a.length-1;0<=b;b--)if(!a[b].hidden)return b;return null};c.getTotalVisibleColumns=function(){for(var a=this.colModel,b=a.length,e=0,g=0;g<b;g++)a[g].hidden||e++;return e};c._getTotalVisibleRows=function(a,b,e,g){var d=0,c=g?g.length:0,f=b,k=0,l=0,h=null,m=!1,q=!1,
  p=this.iHierarchy?!0:!1,s=this.options.detailModel.offset,v=0,y=p?this.$cont[0].offsetHeight:void 0;if(null==g||0==c)return{initV:h,finalV:h,tvRows:d,lastFrozenRow:h};for(var x=0,B=c>b?b:c;x<B;x++){var u=g[x],z=u.pq_hidden;z||(h=x,d++,p&&((u=u.pq_detail)&&u.show?(u=u.height||0,u>s&&(u=s),v+=u+22):v+=22))}if(c<b)return{initV:h,finalV:h,tvRows:d,lastFrozenRow:h};e-=d;x=b;for(B=c;x<B;x++)u=g[x],z=u.pq_hidden,m?q||(z?k++:l==e?q=!0:(k++,l++)):z?f++:l==a?(m=!0,k=f,l=0):(f++,l++),z||(d++,p&&m&&((u=u.pq_detail)&&
  u.show?(u=u.height||0,u>s&&(u=s),v+=u+22):v+=22,v>y&&(q=!0)));f>=c&&(f=c-1);k<f&&(k=f);return{initV:f,finalV:k,tvRows:d,lastFrozenRow:h}};c._setScrollVLength=function(){var a=this.$cont.height(),b=this._getScollBarHorizontalHeight();this.$vscroll.css("bottom",b);this.$vscroll.pqScrollBar("option","length",a-b)};c._setInnerGridHeight=function(){var a=this.options;a.flexHeight||(a=this.element.height()-(a.showTop?this.$top[0].offsetHeight:0)-this.$bottom[0].offsetHeight,this.$grid_inner.height(a+"px"))};
  c._setRightGridHeight=function(){var a=this.options,b=this.$header,e=0;b?(e=b[0].offsetHeight,this.$header_o.height(e-2)):this.$header_o.height(0);a.flexHeight||(this.$vscroll.css("visibility",""),this.$tbl&&this.$tbl.css("marginBottom",0),a=this.element.height()-this.$header_o[0].offsetHeight-(a.showTop?this.$top[0].offsetHeight:0)-this.$bottom[0].offsetHeight,this.$cont.height(a-0+"px"))};c._setGridHeightFromTable=function(){var a=this._getScollBarHorizontalHeight(),b=this.$tbl;b&&b.length&&b.css("marginBottom",
  a);this.$cont.height("");this.element.height("");this.$grid_inner.height("");this.$vscroll.css("visibility","hidden")};c._setGridWidthFromTable=function(){var a,b=this._getSBWidth();this.$tbl&&this.$tbl[0]&&0<this.$tbl[0].scrollWidth?(a=this.$tbl[0].scrollWidth,this.element.width(a+b+"px")):(a=q.call(this,-1,this.colModel.length),this.element.width(a+"px"))};c._bufferObj_minRowsPerGrid=function(){return Math.ceil(this.$cont[0].offsetHeight/this.rowHeight)};c._calcCurPosFromRowIndxPage=function(a){var b=
  this.options,e=b.groupModel,g=e?this.dataGM:this.data,d=b.freezeRows;if(a<d)return 0;for(var b=0,c=d,f=g.length;d<f;d++){var k=g[d];if(!e||!k.groupSummary&&!k.groupTitle){if(c==a)break;c++}k.pq_hidden||b++}return b>=f?null:b};c._calcCurPosFromColIndx=function(a){var b=this.colModel,e=this.options.freezeCols;if(a<e)return 0;for(var g=0,d=e,c=b.length;e<c;e++){var f=b[e];if(d==a)break;d++;f.hidden||g++}return g>=c?null:g};c._bufferObj_calcInitFinal=function(){var a=this.options,b=a.virtualY,e=a.freezeRows,
  g=a.flexHeight,a=a.groupModel?this.dataGM:this.data;if(null==a||0==a.length)e=this._getTotalVisibleRows(d,e,c,a),this.totalVisibleRows=e.tvRows,this.initV=e.initV,this.finalV=e.finalV,this.lastFrozenRow=e.lastFrozenRow;else if(b){var b=this.$vscroll.pqScrollBar("option"),d=parseInt(b.cur_pos);if(isNaN(d)||0>d)throw"cur_pos NA";this.scrollCurPos=d;var c=this._bufferObj_minRowsPerGrid();this.pageSize=c;e=this._getTotalVisibleRows(d,e,c,a);this.totalVisibleRows=e.tvRows;this.initV=e.initV;this.lastFrozenRow=
  e.lastFrozenRow;this.finalV=g?a.length-1:e.finalV}else e=this._getTotalVisibleRows(0,e,c,a),this.lastFrozenRow=e.lastFrozenRow,this.totalVisibleRows=e.tvRows,this.initV=0,this.finalV=a.length-1};c._bufferObj_calcInitFinalH=function(){var a=this.options,b=a.virtualX,e=this.colModel,g=e.length;if(b){for(var d=parseInt(this.$hscroll.pqScrollBar("option","cur_pos")),c=parseInt(a.freezeCols),f=a.flexWidth,k=c,l=0,h=c;h<g;h++)if(e[h].hidden)k++;else if(l==d)break;else k++,l++;k>g-1&&(k=g-1);this.initH=
  k;if(f||!b)this.finalH=g-1;else{b=q.call(this,-1,c);d=this.$cont[0].offsetWidth-this._getSBWidth();for(h=k;h<g;h++)if(k=e[h],!k.hidden){k=k.outerWidth;if(!k&&a.debug)throw"outerwidth N/A";b+=k;if(b>d)break}a=h;a>g-1&&(a=g-1);this.finalH=a}}else this.initH=0,this.finalH=g-1};var q=function(a,b,e){var g=0,d=this.options,c=d.columnBorders?1:0,f=d.numberCell,d=this.colModel;-1==a&&(f.show&&(g=e?g+(parseInt(f.width)+1):g+f.outerWidth),a=0);if(e)for(;a<b;a++){if(e=d[a],!e.hidden){if(!e._width)throw"assert failed";
  g+=e._width+c}}else for(;a<b;a++)e=d[a],e.hidden||(g+=e.outerWidth);return g};h.paramquery.pqgrid.calcWidthCols=q;c.calcHeightFrozenRows=function(){var a=this.$tbl,b=0;a&&a.length&&((a=h(a[0]).find("tr.pq-last-freeze-row"))&&a.length?(a=a[0],b=a.offsetTop+a.offsetHeight):b=0);return b};c._calcRightEdgeCol=function(a){var b=0,e=0,g=this.colModel,d=this.hidearrHS,c=this.options.numberCell;c.show&&(b+=c.outerWidth,e++);for(c=0;c<=a;c++){var f=g[c];f.hidden||!1!=d[c]||(b+=f.outerWidth,e++)}return{width:b,
  cols:e}};c._refreshFreezeLine=function(){var a=this.options,b=a.numberCell,e=this.$cont_o,a=a.freezeCols;this.$freezeLine&&this.$freezeLine.remove();a&&(a=q.call(this,-1,a)-1,isNaN(a)||0==a||0<a&&b.show&&a==b.width||(this.$freezeLine=h("<div class='pq-grid-vert-freezeline' ></div>").appendTo(e),this.$freezeLine.css({height:e[0].offsetHeight,left:a})))};c._getDragHelper=function(a){var b=parseInt(this.options.freezeCols);a=h(a.currentTarget);this.$cl=h("<div class='pq-grid-drag-bar'></div>").appendTo(this.$grid_inner);
  this.$clleft=h("<div class='pq-grid-drag-bar'></div>").appendTo(this.$grid_inner);a=parseInt(a.attr("pq-grid-col-indx"));var e=this.$grid_inner.outerHeight();this.$cl.height(e);this.$clleft.height(e);var e=h("td[pq-grid-col-indx="+a+"]",this.$header)[0],g=e.offsetLeft;this.pqpanes.v?a>=b&&(g+=this.$header[1].offsetLeft):g+=this.$header[0].offsetLeft;this.$clleft.css({left:g});g+=e.offsetWidth;this.$cl.css({left:g})};c._setDragLimits=function(a){var b=this.colModel[a],e=this.options,g=e.numberCell,
  d=this.$header_left;a>=e.freezeCols&&this.pqpanes.v&&(d=this.$header_right);var c=d.find("td[pq-grid-col-indx='"+a+"']"),e=c.offset().left+b._minWidth;-1==a&&(e=c.offset().left+g.minWidth);b=e+b._maxWidth-b._minWidth;d.find("div.pq-grid-col-resize-handle[pq-grid-col-indx="+a+"]").draggable("option","containment",[e,0,b,0])};c.nestedCols=function(a,b,e){var g=a.length,d=[];null==b&&(b=1);for(var c=b,f=0,k=0,l=0;l<g;l++){var h=a[l];if(!0===e||!1===e)h.hidden=e;if(null!=h.colModel&&0<h.colModel.length){var m=
  this.nestedCols(h.colModel,b+1,h.hidden),d=d.concat(m.colModel);0<m.colSpan?(m.depth>c&&(c=m.depth),h.colSpan=m.colSpan,f+=m.colSpan):(h.colSpan=0,h.hidden=!0);h.childCount=m.childCount;k+=m.childCount}else h.hidden?h.colSpan=0:(h.colSpan=1,f++),h.childCount=0,k++,d.push(h)}return{depth:c,colModel:d,colSpan:f,width:0,childCount:k}};c.getHeadersCells=function(){for(var a=this.options.colModel,b=this.colModel.length,e=this.depth,g=[],d=0;d<e;d++){g[d]=[];for(var c=0,f=0,k=0;k<b;k++){var l;if(0==d)l=
  a[c];else{var h=g[d-1][k];l=h.colModel;if(null==l||0==l.length)l=h;else{for(var h=k-h.leftPos,m=0,q=0,p=0;p<l.length;p++)if(m+=0<l[p].childCount?l[p].childCount:1,h<m){q=p;break}l=l[q]}}h=l.childCount?l.childCount:1;k==f?(l.leftPos=k,g[d][k]=l,f+=h,a[c+1]&&c++):g[d][k]=g[d][k-1]}}return this.headerCells=g};c.getDataType=function(){var a=this.colModel;if(a&&a[0]){a=a[0].dataIndx;if("string"==typeof a)return"JSON";if("number"==typeof a)return"ARRAY"}throw"dataType unknown";};c.assignRowSpan=function(){for(var a=
  this.colModel.length,b=this.headerCells,e=this.depth,g=0;g<a;g++)for(var d=0;d<e;d++){var c=b[d][g];if(!(0<g&&c==b[d][g-1]||0<d&&c==b[d-1][g])){for(var f=1,k=d+1;k<e;k++)c==b[k][g]&&f++;c.rowSpan=f}}return b};c._calcThisColModel=function(){var a=this.options,b=a.columnTemplate,a=this.nestedCols(a.colModel);this.colModel=a.colModel;this.depth=a.depth;if(b)for(var a=this.colModel,e=0,g=a.length;e<g;e++)a[e]=h.extend({},b,a[e],!0);this.getHeadersCells();this.assignRowSpan()};var l=function(a){this.that=
  a},k=l.prototype;k._computeOuterWidths=function(){for(var a=this.that,b=a.options,e=b.columnBorders?1:0,b=b.numberCell,a=a.colModel,g=a.length,d=0;d<g;d++){var c=a[d];c.outerWidth=c._width+e}b.show&&(b.outerWidth=b.width+1)};k.autoFit=function(){var a=this.that,b=a.colModel,e=a.$cont,g=b.length,d=q.call(a,-1,g,!0),a=e[0].offsetWidth-a._getSBWidth();if(d!=a){for(var d=d-a,c,a=[],e=0;e<g;e++){var f=b[e],k=f._percent,l=f._resized;f.hidden||k||l||(0>d?(k=f._maxWidth-f._width)&&a.push({availWd:-1*k,colIndx:e}):
  (k=f._width-f._minWidth)&&a.push({availWd:k,colIndx:e}));l&&(c=f,delete f._resized)}a.sort(function(b,a){return b.availWd>a.availWd?1:b.availWd<a.availWd?-1:0});e=0;for(g=a.length;e<g;e++){var f=a[e],k=f.availWd,f=f.colIndx,l=Math.round(d/(g-e)),f=b[f],h;h=f._width;Math.abs(k)>Math.abs(l)?(h-=l,d-=l):(h-=k,d-=k);f.width=f._width=h}0!=d&&c&&(h=c._width-d,h>c._maxWidth?h=c._maxWidth:h<c._minWidth&&(h=c._minWidth),c.width=c._width=h)}};k.autoLastColumn=function(){var a=this.that,b=a.options,e=b.columnBorders?
  1:0,g=a.colModel,d=g.length,b=b.freezeCols,c=a.$cont[0].offsetWidth-a._getSBWidth(),f=q.call(a,-1,b,!0),c=c-f,f=!1,a=a._getLastVisibleColIndx();if(null!=a&&(a=g[a],!a._percent)){for(var k=a._width,l,h=a._minWidth,m=a._maxWidth,d=d-1;d>=b;d--){var p=g[d];if(!p.hidden&&(p=p._width+e,c-=p,0>c)){f=!0;l=k+c>=h?k+c:k+p+c;break}}f||(l=k+c);l>m?l=m:l<h&&(l=h);a.width=a._width=l}};k.numericVal=function(a,b){return-1<(a+"").indexOf("%")?parseInt(a)*b/100:parseInt(a)};k.refreshColumnWidths=function(){var a=
  this.that,b=a.options,e=b.numberCell,g=b.flexWidth,d=b.columnBorders?1:0,c=a.colModel,f=b.scrollModel,k=f.lastColumn,f=f.autoFit,l=a.$cont,h=c.length,m=a._getSBWidth(),q=b._minColWidth,p=b._maxColWidth;if(l&&l[0].offsetWidth){var s=l[0].offsetWidth,v=0;e.show&&(e.width<e.minWidth&&(e.width=e.minWidth),e.outerWidth=e.width+1,v=e.outerWidth);e=s-m-v;q=Math.floor(this.numericVal(q,e));p=Math.ceil(this.numericVal(p,e));m=0;if(5>e||isNaN(e)){if(b.debug)throw"availWidth N/A";}else{delete a.percentColumn;
  for(b=0;b<h;b++)if(s=c[b],!s.hidden){var y=s.width,v=-1<(y+"").indexOf("%")?!0:null,x=s.minWidth,B=s.maxWidth,x=x?this.numericVal(x,e):q,B=B?this.numericVal(B,e):p;B<x&&(B=x);if(void 0!=y){var u=0;!g&&v?(a.percentColumn=!0,s.resizable=!1,s._percent=!0,y=this.numericVal(y,e)-d,u=Math.floor(y),m+=y-u,1<=m&&(u+=1,m-=1)):y&&(u=parseInt(y));u<x?u=x:u>B&&(u=B);s._width=u}else s._width=x;v||(s.width=s._width);s._minWidth=x;s._maxWidth=B}l&&!1==g&&(f&&this.autoFit(),"auto"==k&&this.autoLastColumn());this._computeOuterWidths()}}};
  c._createHeader=function(){var a=this,b=this.options,e=b.hwrap,g=parseInt(b.freezeCols),d=b.numberCell,c=this.colModel,f=this.depth,k=b.virtualX,l=a.initH,m=a.finalH,p=this.headerCells,w=this.$header,A=this.$header_o;if(!1===b.showHeader)w&&w.empty(),this.$header_o.css("display","none");else{this.$header_o.css("display","");w="pq-grid-header-table ";w=["<table class='"+(e?w+"pq-wrap ":w+"pq-no-wrap ")+"' cellpadding=0 cellspacing=0 >"];if(1<=f){w.push("<tr>");d.show&&w.push("<td style='width:"+(d.width+
  1)+"px;' ></td>");for(b=0;b<=m;b++){if(b<l&&b>=g&&k&&(b=l,b>m))throw"initH>finalH";e=c[b];e.hidden||(e=e.outerWidth,w.push("<td style='width:"+e+"px;' pq-col-indx="+b+"></td>"))}w.push("</tr>")}for(e=0;e<f;e++){w.push("<tr class='pq-grid-title-row'>");0==e&&d.show&&w.push(["<td pq-grid-col-indx='-1' class='pq-grid-number-col' rowspan='",f,"'><div class='pq-td-div'>",d.title?d.title:"&nbsp;","</div></td>"].join(""));for(b=0;b<=m;b++){if(b<l&&b>=g&&k&&(b=l,b>m))throw"initH>finalH";this._createHeaderCell(e,
  b,p,w,"pq-grid-col ",g,l,f)}w.push("</tr>")}this.ovCreateHeader(w,"pq-grid-col ");w.push("</table>");d=w.join("");A.empty();this.pqpanes.v?A.append(["<span class='pq-grid-header pq-grid-header-left ui-state-default'>",d,"</span><span class='pq-grid-header ui-state-default'>",d,"</span>"].join("")):A.append(["<span class='pq-grid-header ui-state-default'>",d,"</span>"].join(""));w=this.$header=h(".pq-grid-header",A);this.$tbl_header=w.children("table");e=q.call(this,-1,g);d=this.$header_left=h(w[0]);
  this.pqpanes.v&&(d=this.$header_left=h(w[0]),A=this.$header_right=h(w[1]),d.css({width:e,zIndex:10}),g=q.call(this,g,l),A.css({left:-1*g+"px"}));w.click(function(b){if(!a.iDragColumns||"stop"==a.iDragColumns.status){var e=h(b.target),g=e.closest(".pq-g-ficon");if(g.length)return e=g.attr("pq-col-indx"),b.stopImmediatePropagation(),a.iHeaderIconSearch.createDOM(e,g,b);g=e.closest("td.pq-grid-col");if(g.length&&(b.stopImmediatePropagation(),e=g.attr("pq-grid-col-indx"),null!=e))return a._onHeaderCellClick(e,
  b)}});this._refreshResizeColumn(l,m,c);this._trigger("refreshHeader",null,null)}};c._createHeaderCell=function(a,b,e,g,d,c,f,k){var l=e[a][b],h=l.colSpan,m=l.halign,q=l.align,p=l.title;if(!(0<a&&l==e[a-1][b]||0<b&&l==e[a][b-1]||l.hidden)){e=d;null!=m?e+=" pq-align-"+m:null!=q&&(e+=" pq-align-"+q);b==c-1&&1==k&&(e+=" pq-last-freeze-col");b<=c-1?e+=" pq-left-col":b>=f&&(e+=" pq-right-col");(c=l.cls)&&(e=e+" "+c);c="";if(null==l.colModel||0==l.colModel.length)c="pq-grid-col-indx='"+b+"'";g.push(["<td ",
  c," ","pq-col-indx="+b," ","pq-row-indx="+a,"  class='",e,"' rowspan=",l.rowSpan," colspan=",h,"><div class='pq-td-div'>",p?p:"","<span class='pq-col-sort-icon'>&nbsp;</span></div></td>"].join(""))}};c.ovCreateHeader=function(){};c._refreshResizeColumn=function(a,b,e){var g=this,d=this.options,c=d.filterModel.ficon?!0:!1,f=d.numberCell,k=g.$header.height(),d=parseInt(d.freezeCols),l=[],m=[];if(f.show&&f.resizable){var q=g.$header_left.find("td.pq-grid-number-col")[0],q=parseInt(q.offsetLeft)+(q.offsetWidth-
  10);l.push("<div pq-grid-col-indx='-1' style='left:",q,"px;height:",k,"px;' class='pq-grid-col-resize-handle'>&nbsp;</div>")}for(f=0;f<=b;f++){if(f<a&&f>=d&&(f=a,f>b))throw"initH>finalH";var p=e[f];if(!p.hidden){var A=p.ficon,s=A||null==A&&c,A=l;if(!1!==p.resizable||s)q=g.$header_left,this.pqpanes.v&&f>=d&&(q=g.$header_right,A=m),q=q.find("td[pq-grid-col-indx="+f+"]")[0],s=parseInt(q.offsetLeft),q=s+(q.offsetWidth-5);!1!==p.resizable&&A.push("<div pq-grid-col-indx='",f,"' style='left:",q,"px;height:",
  k,"px;' class='pq-grid-col-resize-handle'>&nbsp;</div>")}}g.$header_left.append(l.join(""));m.length&&g.$header_right.append(m.join(""));var v,y,x;g.$header.find(".pq-grid-col-resize-handle").draggable({axis:"x",helper:function(b,a){var e=h(b.target),d=parseInt(e.attr("pq-grid-col-indx"));g._setDragLimits(d);g._getDragHelper(b,a);return e},start:function(b,a){v=a.position.left;x=parseInt(g.$cl[0].style.left)},drag:function(b,a){y=a.position.left;g.$cl[0].style.left=x+(y-v)+"px"},stop:function(b,a){return g._refreshResizeColumnStop(b,
  a,e,v)}})};c._refreshResizeColumnStop=function(a,b,e,g){var d=this.options.numberCell;this.$clleft.remove();this.$cl.remove();g=b.position.left-g;b=h(b.helper);b=parseInt(b.attr("pq-grid-col-indx"));if(-1==b){e=null;var c=parseInt(d.width);d.width=c+g}else e=e[b],c=parseInt(e.width),e.width=c+g,e._resized=!0;this.refresh();this._trigger("columnResize",a,{colIndx:b,column:e,dataIndx:e?e.dataIndx:null,oldWidth:c,newWidth:e?e.width:d.width})};c._refreshHeaderSortIcons=function(){var a=this.options.dataModel;
  if(void 0!=a.sortIndx){var b=this.$header;b.find(".pq-grid-col").removeClass("pq-col-sort-asc pq-col-sort-desc ui-state-active");b.find(".pq-col-sort-icon").removeClass("ui-icon ui-icon-triangle-1-n ui-icon-triangle-1-s");var e=this.getColIndx({dataIndx:a.sortIndx}),g="ui-state-active pq-col-sort-"+("up"==a.sortDir?"asc":"desc"),a="ui-icon ui-icon-triangle-1-"+("up"==a.sortDir?"n":"s");b.find(".pq-grid-col[pq-grid-col-indx="+e+"]").addClass(g);b.find(".pq-grid-col[pq-grid-col-indx="+e+"] .pq-col-sort-icon").addClass(a)}};
  c.createTable=function(a){this.iGenerateView.generateView(a)};h.widget("paramquery._pqGrid",h.ui.mouse,c);h.measureTime=function(a,b){(new Date).getTime();a();(new Date).getTime()}})(jQuery);
  (function(h){function c(b){var a=this;this.that=b;this.type="detail";this.refreshComplete=!0;this.detachView=!1;var g=b.widgetEventPrefix.toLowerCase(),d=b.eventNamespace;b.element.on(g+"cellclick"+d,function(b,d){if(a.belongs(b))return a.cellClick(b,d)});b.element.on(g+"cellkeydown"+d,function(b,d){if(a.belongs(b)&&b.keyCode==h.ui.keyCode.ENTER)return a.cellClick(b,d)});b.element.on(g+"aftertable"+d,function(b,d){if(a.belongs(b))return a.aftertable(b,d)});b.element.on(g+"beforetableview"+d,function(b,
  d){if(a.belongs(b))return a.beforeTableView(b,d)});b.element.on(g+"beforerefreshdata"+d,function(b,d){if(a.belongs(b))return a.beforeRefreshData(b,d)})}var f=h.paramquery.cClass,p={getFocusElement:function(){var b=document.activeElement;if(b){var b=h(b),a=b.closest(".pq-grid");if(a.length)return a[0]==this.element[0]?{$ae:b,$grid:a}:{$ae:b,$childGrid:a}}},inViewPort:function(b){var a=this.$cont[0],d=a.offsetHeight-this._getScollBarHorizontalHeight(),a=a.offsetWidth-this._getSBWidth()+1;b=b[0];var c=
  h(b.offsetParent),f=parseInt(c.css("marginTop")),c=parseInt(c.css("marginLeft"));if(d>=b.offsetTop+b.offsetHeight+f)if("TD"==b.nodeName.toUpperCase()){if(a>=b.offsetLeft+b.offsetWidth+c)return!0}else return!0}},m=c.prototype=new f;m.aftertable=function(b,a){var d=this.that,c=d.options.detailModel.init,f=d.data;if(this.refreshComplete){this.refreshComplete=!1;for(var k=d.$tbl.children("tbody").children("tr.pq-detail-child"),l=0;l<k.length;l++){var m=h(k[l]),q=m.attr("pq-row-indx"),p=f[q],q=p.pq_detail.child;
  q||"function"!=typeof c||(q=c.call(d.element[0],{rowData:p}),p.pq_detail.child=q);p=q.find(".pq-header-outer");m.children("td.pq-detail-child").append(q);if(0==p.height())try{q.pqGrid("refresh")}catch(w){}}this.refreshComplete=!0;this.detachView=!1}};m.beforeTableView=function(b,a){this.detachView||this.detachInitView(b,a)};m.beforeRefreshData=function(b,a){this.detachView||this.detachInitView(b,a)};m.detachInitView=function(b,a){var d=this.that,c=d.data;if(c&&c.length){for(var d=d.$tbl.children("tbody").children("tr.pq-grid-row"),
  f,k,l,m=0;m<d.length;m++){var q=h(d[m]);k=q.attr("pq-row-indx");var p=c[k];null!=k&&k!=f&&(f=k,p.pq_detail&&(k=null,l=0,p.pq_detail.child&&(q=q.next(),q.hasClass("pq-detail-child")&&(q=q.children("td.pq-detail-child").children(),q.length&&(l=q[0].offsetHeight,k=q.detach()))),k&&k.length&&(p.pq_detail.child=k,p.pq_detail.height=l)))}this.detachView=!0}};m.cellClick=function(b,a){var d=this.that,c=a.column,f=a.rowData,k=a.rowIndx,l=this.type;c&&c.type===l&&(null==f.pq_detail?d.rowExpand({rowIndx:k,
  scrollRow:!0}):!1===f.pq_detail.show?d.rowExpand({rowIndx:k,scrollRow:!0}):d.rowCollapse({rowIndx:k,scrollRow:!0}))};p.rowExpand=function(b){var a=this.getRowData(b),d=this.options.detailModel;null!=a&&(null==a.pq_detail?a.pq_detail={show:!0}:!1===a.pq_detail.show&&(a.pq_detail.show=!0),!d.cache&&(d=a.pq_detail.child)&&(d.remove(),a.pq_detail.child=null,a.pq_detail.height=0),this.refresh(),b.scrollRow&&this.scrollRow({rowIndx:b.rowIndx}))};p.rowInvalidate=function(b){b=this.getRowData(b);b.pq_detail.child.remove();
  b.pq_detail.child=null};p.rowCollapse=function(b){var a=this.getRowData(b),d=this.options.detailModel;null!=a&&null!=a.pq_detail&&!0===a.pq_detail.show&&(!d.cache&&(d=a.pq_detail.child)&&(d.remove(),a.pq_detail.child=null,a.pq_detail.height=0),a.pq_detail.show=!1,this.refresh(),b.scrollRow&&this.scrollRow({rowIndx:b.rowIndx}))};var d=function(b){function a(e,d,g){b.filter({data:[{dataIndx:e,value:d,value2:g}]})}this.that=b;var d=this;this.dataHS={};var c=b.widgetEventPrefix.toLowerCase(),f=b.eventNamespace;
  b.element.on(c+"headerkeydown"+f,function(b,a){if(d.belongs(b)){var e=h(b.originalEvent.target);return e.hasClass("pq-search-hd-field")?d.onKeyDown(b,a,e):!0}});b.element.on(c+"createheader"+f,function(b,a){if(d.belongs(b))return d._onCreateHeader()});this.changeListener={change:function(b,d){a(d.dataIndx,d.value,d.value2)}};this.keyupListener={keyup:function(b,d){a(d.dataIndx,d.value,d.value2)}};this.clickListener={click:function(b,d){a(d.dataIndx,d.value)}}},f=d.prototype=new f;f.get$Ele=function(b,
  a){var d=this.that,c=d.options.freezeCols,f=h(d.$tbl_header[0]),k=".pq-search-hd-field[name='"+a+"']",d=h(d.$tbl_header[2==d.$tbl_header.length?1:0]);return b>=c?d.find(k):f.find(k)};f.onKeyDown=function(b,a,d){a=this.that;if(b.keyCode===h.ui.keyCode.TAB){var c=d.attr("name"),f=a.getColIndx({dataIndx:c}),k=a.colModel,l,m=b.shiftKey,q=k[f];if("between"==q.filter.condition&&(a.scrollColumn({colIndx:f}),c=this.get$Ele(f,c),c[0]==d[0]?m||(l=c[1]):m&&(l=c[0]),l))return l.focus(),b.preventDefault(),!1;
  do{m?f--:f++;if(0>f||f>=k.length)break;q=k[f];d=q.filter;if(!q.hidden&&d){a.scrollColumn({colIndx:f});c=q.dataIndx;l=this.get$Ele(f,c);"between"==d.condition&&(l=m?h(l[1]):h(l[0]));if(l)return l.focus(),b.preventDefault(),!1;break}}while(1)}else return!0};f._bindFocus=function(){function b(b){d._fixTableViewPort();b=h(b.target).attr("name");if(d.scrollColumn({dataIndx:b})){var a=d.getColIndx({dataIndx:b});c.get$Ele(a,b).focus()}}function a(e){e.addEventListener?e.addEventListener("focus",b,!0):e.onfocusin=
  function(){var a=window.event;a.target=a.srcElement;b(a)}}for(var d=this.that,c=this,f=d.$header.find(".pq-grid-header-search"),k=0;k<f.length;k++)a(f[k])};f._onCreateHeader=function(){var b=this.that,a=b.options,d=a.columnBorders;if(a.filterModel.header){this._bindFocus();var c=b.colModel,f=b.initH,k=b.finalH,l=a.freezeCols,a=a.virtualX,m=b.$tbl_header,q=h(m[0]),p=h(m[1]),w="input,select";if(1<m.length){q.find(w).css("visibility","hidden");for(var A=0;A<l;A++){var s=c[A],w="*[name='"+s.dataIndx+
  "']";q.find(w).css("visibility","visible");p.find(w).css("visibility","hidden")}}for(A=0;A<=k;A++){if(A<f&&A>=l&&a&&(A=f,A>k))throw"initH>finalH";s=c[A];if(!s.hidden){var v=s.filter;if(v){var w=s.dataIndx,y=q;A>=l&&1<m.length&&(y=p);y=y.find("*[name='"+w+"']");if(0!=y.length){var x=v.type,B=v.value,u=v.value2;"checkbox"==x&&"triple"==v.subtype?y.pqval({val:B}):"select"==x&&(y.val(B),x=this.getWidth(s,d),y.css({width:x}));(x=v.init)&&x.call(y,{dataIndx:w,column:s});if(s=v.listeners)for(v=0;v<s.length;v++){x=
  s[v];"string"==typeof x&&(x=this[x+"Listener"]);for(var z in x)(function(a,e,d){a.bind(z,function(g){var c=b.getColumn({dataIndx:d}),f=c.filter;"checkbox"==f.type?B="triple"==f.subtype?a.pqval({incr:!0}):a.is(":checked")?!0:!1:"between"==f.condition?(B=h(a[0]).val(),u=h(a[1]).val()):B=a.val();return e.call(this,g,{column:c,dataIndx:d,value:B,value2:u})})})(y,x[z],w)}}}}}}};f.getWidth=function(b,a){var d=parseInt(b.width)+(a?1:0);return d-15};f.createDOM=function(b,a){var d=this.that,c=d.initH,f=d.finalH,
  k=d.options,l=k.freezeCols,m=k.virtualX,q=d.colModel,p=k.columnBorders,k=k.numberCell;b.push("<tr class='pq-grid-header-search'>");k.show&&b.push("<td pq-grid-col-indx='-1' class='pq-grid-number-col' rowspan='1'><div class='pq-grid-header-table-div'>&nbsp;</div></td>");for(k=0;k<=f;k++){if(k<c&&k>=l&&m&&(k=c,k>f))throw"initH>finalH";var w=q[k];if(!w.hidden){var A=a,s=w.halign;s||(s=w.align);"right"==s?A+=" pq-align-right":"center"==s&&(A+=" pq-align-center");(s=w.cls)&&(A=A+" "+s);if(s=w.filter){var v=
  w.dataIndx,y=s.type,x=s.value,B=s.condition,u=this.getWidth(w,p),z=s.cls,z="pq-search-hd-field "+(z?z:""),C=s.style,C=C?C:"",F=s.attr,F=F?F:"",D="",H;if("between"==B){var I=s.value2,I=null!=I?I:"";H=u/2-9}"textbox"===y?(x=x?x:"",z+=" ui-corner-all pq-search-txt","between"==B?(D=this._input(v,x,H,z+" pq-from",C,F),D+="-"+this._input(v,I,H,z+" pq-to",C,F)):D=this._input(v,x,u,z,C,F)):"textarea"===y?(x=x?x:"",z+=" ui-corner-all pq-search-txt","between"==B?(D=this._textarea(v,x,H,z,C,F),D+="-"+this._textarea(v,
  I,H,z,C,F)):D=this._textarea(v,x,u,z,C,F)):"select"===y?s.cache?D=s.cache:(y=s.options,"function"===typeof y&&(y=y.call(d.element[0],{column:w,value:x,dataIndx:v,cls:z,style:C,attr:F})),z+=" ui-corner-all",w=["name='",v,"' class='",z,"' style='width:",u,"px;",C,"' ",F].join(""),D=h.paramquery.select({options:y,attr:w,prepend:s.prepend,valueIndx:s.valueIndx,labelIndx:s.labelIndx,groupIndx:s.groupIndx}),s.cache=D):"checkbox"==y?D=["<input ",null==x||!1==x?"":"checked=checked"," name='",v,"' type=checkbox class='"+
  z+"' style='"+C+"' "+F+"/>"].join(""):"string"==typeof y?D=y:"function"==typeof y&&(D=y.call(d.element[0],{width:u,value:x,value2:I,column:w,dataIndx:v,cls:z,attr:F,style:C}));b.push(["<td class='",A,"'><div class='pq-grid-header-table-div' style='padding:0px 2px;' >",D,"</div></td>"].join(""))}else b.push(["<td class='",A,"'><div class='pq-grid-header-table-div' >&nbsp;</div></td>"].join(""))}}b.push("</tr>")};f._input=function(b,a,d,c,f,k){return['<input value="',a,"\" name='",b,"' type=text style='width:",
  d,"px;"+f+"' class='"+c+"' "+k+" />"].join("")};f._textarea=function(b,a,d,c,f,k){return["<textarea name='",b,"' style='width:",d,"px;"+f+"' class='"+c+"' "+k+" >",a,"</textarea>"].join("")};h.paramquery.select=function(b){var a=b.options,d=b.groupIndx,c=b.labelIndx,f=b.valueIndx,k=b.prepend,l,h;b=["<select ",b.attr," >"];if(k)for(l in k)b.push('<option value="',l,'">',k[l],"</option>");if(d){if(a&&a.length){for(var k=0,m=a.length;k<m;k++){var q=a[k],p=q[f];null!=p&&(l=q[d],h!=l&&(null!=h&&b.push("</optgroup>"),
  b.push('<optgroup label="',l,'">'),h=l),f!=c?(q=q[c],b.push('<option value="',p,'">',q,"</option>")):b.push("<option>",p,"</option>"))}b.push("</optgroup>")}}else if(a&&a.length)for(k=0,m=a.length;k<m;k++)if(q=a[k],null!=c&&null!=f)p=q[f],null!=p&&(c==f?b.push("<option>",p,"</option>"):(q=q[c],b.push('<option value="',p,'">',q,"</option>")));else if("object"==typeof q)for(l in q)b.push('<option value="',l,'">',q[l],"</option>");else b.push("<option>",q,"</option>");b.push("</select>");return b.join("")};
  h.fn.pqval=function(b){if(b){if(b.incr)return b=this.data("pq_value"),this.prop("indeterminate",!1),b?(b=!1,this.removeAttr("checked")):!1===b?(b=null,this.prop("indeterminate",!0),this.removeAttr("checked")):(b=!0,this.attr("checked","checked")),this.data("pq_value",b),b;b=b.val;this.data("pq_value",b);this.prop("indeterminate",!1);null==b?(this.prop("indeterminate",!0),this.removeAttr("checked")):b?this.attr("checked","checked"):this.removeAttr("checked");return this}return this.data("pq_value")};
  var k={_generateTitleRow:function(b,a,d,c){var f=this.that.options.numberCell,k=a.groupTitle,l=b.title,h=a.level,m=a.GMRowIndx;b=(b=(b=b.icon)?b[h]:null)&&b.length&&2==b.length&&"function"===typeof b.push?b:["ui-icon-minus","ui-icon-plus"];if(l&&null!=l[h]){if(!1===l[h])return;k=l[h].replace("{0}",k);k=k.replace("{1}",a.items)}else k=k+" - "+a.items+" item(s)";d.push(["<tr class='pq-group-row pq-grid-row",c?" pq-last-freeze-row":"","' title=\"",a.groupTitle,"\" level='",h,"' GMRowIndx='",m,"'>"].join(""));
  f.show&&d.push("<td class='pq-grid-number-cell ui-state-default'>&nbsp;</td>");c=b[0];a.collapsed&&(c=b[1]);d.push("<td class='pq-grid-cell' colSpan='100' >","<div class='pq-td-div' style='margin-left:",16*h,"px;'>","<span class='ui-icon ",c,"'></span>",k,"</div></td>");d.push("</tr>")},_generateSummaryRow:function(b,a,d,c){var f=this.that,k=f.options,l=k.virtualX,h=f.initH,f=f.finalH,m=k.freezeCols,q=k.numberCell,k=k.columnBorders;d.push("<tr class='pq-summary-row pq-grid-row"+(c?" pq-last-freeze-row":
  "")+"'>");q.show&&d.push("<td class='pq-grid-number-cell ui-state-default'>&nbsp;</td>");for(c=0;c<=f;c++){if(c<h&&c>=m&&l&&(c=h,c>f))throw"initH>finalH";var q=a[c],p=q.dataIndx;if(!q.hidden){var A="pq-grid-cell ";"right"==q.align?A+=" pq-align-right":"center"==q.align&&(A+=" pq-align-center");c==m-1&&k&&(A+=" pq-last-freeze-col");q.cls&&(A=A+" "+q.cls);q=["<td class='",A,"' style='' >",null==b[p]?"&nbsp;":b[p],"</td>"].join("");d.push(q)}}d.push("</tr>");return d},_generateDetailRow:function(b,a,
  d,c,f,k){d="pq-grid-row pq-detail-child";k&&(d+=" pq-last-freeze-row");var l=this.that.options;k=l.numberCell;var h="pq-grid-cell ";if(!l.wrap||f)h+="pq-wrap-text ";l.stripeRows&&a/2==parseInt(a/2)&&(d+=" pq-grid-oddRow");b.pq_rowselect&&(d+=" pq-row-select ui-state-highlight");b=b.pq_rowcls;null!=b&&(d+=" "+b);c.push("<tr pq-row-indx='"+a+"' class='"+d+"' >");k.show&&c.push("<td class='pq-grid-number-cell ui-state-default'>&nbsp;</td>");c.push("<td class='"+h+" pq-detail-child' colSpan='20'></td>");
  c.push("</tr>");return c}},q=function(b){this.that=b},f=q.prototype;f._refreshDataFromDataModel=function(){this._groupData();this.initcollapsed()};f.bindEvents=function(){var b=this;this.that.$cont.on("click","tr.pq-group-row",function(a){return b.onClickGroupRow(a)})};f.showHideRows=function(b,a,d){for(var c=[],f=this.that.dataGM,k=f.length;b<k;b++){var l=f[b],h=l;if(h.groupSummary)if(l.level<a)break;else l.pq_hidden=d;else if(h.groupTitle)if(l.collapsed&&c.push({indx:b,level:l.level}),l.level<=
  a)break;else l.pq_hidden=d;else l.pq_hidden=d}return c};f.onClickGroupRow=function(b){var a=h(b.currentTarget);b=this.that;var d=parseInt(a.attr("level")),a=parseInt(a.attr("GMRowIndx")),c=!0,c=b.dataGM[a];c=c.collapsed?c.collapsed=!1:c.collapsed=!0;if(c)this.showHideRows(a+1,d,!0);else for(a=this.showHideRows(a+1,d,!1),c=0;c<a.length;c++){var f=a[c].indx,d=a[c].level;this.showHideRows(f+1,d,!0)}b.refresh()};f.initcollapsed=function(){var b=this.that.dataGM;if(b)for(var a=0,d=b.length;a<d;a++){var c=
  b[a];if(void 0!==c.groupTitle){var f=c.level;c.collapsed&&this.showHideRows(a+1,f,!0)}}};f.max=function(b,a){var d;"integer"==a||"float"==a?(d=Math.max.apply(Math,b),"float"===a&&(d=d.toFixed(2))):(b="date"==a?b.sort(function(b,a){b=Date.parse(b);a=Date.parse(a);return b-a}):b.sort(),d=b[b.length-1]);return d};f.min=function(b,a){var d;"integer"==a||"float"==a?(d=Math.min.apply(Math,b),"float"===a&&(d=d.toFixed(2))):(b="date"==a?b.sort(function(b,a){b=Date.parse(b);a=Date.parse(a);return b-a}):b.sort(),
  d=b[0]);return d};f.count=function(b){return b.length};f.sum=function(b,a){var d=0,c;c="float"===a?parseFloat:"integer"===a?parseInt:function(b){return b};for(var f=0,k=b.length;f<k;f++)d+=c(b[f]);"float"===a&&(d=d.toFixed(2));return d};f._groupData=function(){for(var b=this.that,a=b.data,d=b.options,c=d.groupModel,f=d.pageModel,d=b.colModel,f=f.type?(f.curPage-1)*f.rPP:0,k=d.length,l=c.dataIndx,m=l.length,q=c.collapsed,p=[],w=0;w<m;w++){p[w]=!1;for(var A=0;A<k;A++){var s=d[A],v=s.summary;if(v){var y=
  v.type;if(y&&"function"==typeof y.push&&y[w]){p[w]=!0;break}}}}if(c&&a&&0<a.length){for(var c=[],A=[],x=[],B=[],u=[],w=0;w<m;w++)B[w]="",x[w]="",u[w]={};for(var z=0,C=a.length;z<=C;z++){for(var F=a[z],s=!1,D=null,w=0;w<m;w++)x[w]=z<C?h.trim(F[l[w]]):"",B[w]!=x[w]&&(s=!0),s&&null==D&&(D=w);if(s){for(s=0;s<m;s++)B[s]=x[s];if(0<z){for(w=m-1;w>=D;w--)if(p[w]){for(var H=[],I=0;I<k;I++)if(s=d[I],y=(v=s.summary)?v.type?v.type[w]:null:null){var J=s.dataIndx,K="",v=v.title?v.title[w]:null,M="{0}";"function"==
  typeof y?K=y(u[w][J],s.dataType):(M=y+": {0}",K=this[y](u[w][J],s.dataType));v&&(M=v);H[J]=M.replace("{0}",K)}c.push({groupSummary:!0,level:w,data:H})}for(s=D;s<m;s++)c[A[s]].items=u[s][d[0].dataIndx].length}if(z==C)break;for(w=m-1;w>=D;w--)for(y=0;y<k;y++)s=d[y],u[w][s.dataIndx]=[];for(s=D;s<m;s++)c.push({groupTitle:x[s],level:s,GMRowIndx:c.length,collapsed:q&&null!=q[s]?q[s]:!1}),A[s]=c.length-1}F.rowIndx=z+f;F.pq_hidden=!1;c.push(F);for(D=0;D<k;D++)for(s=d[D],J=s.dataIndx,w=0;w<m;w++)u[w][J].push(F[J])}b.dataGM=
  c}else b.dataGM=null};var l=function(b){this.that=b;this.$drag_helper=null;var a=b.options.dragColumns,d=a.topIcon,c=a.bottomIcon,f=this;this.status="stop";this.$arrowTop=h("<div class='pq-arrow-down ui-icon "+d+"'></div>").appendTo(b.element);this.$arrowBottom=h("<div class='pq-arrow-up ui-icon "+c+"' ></div>").appendTo(b.element);this.hideArrows();if(a&&a.enabled)b.$header_o.on("mousedown","td.pq-grid-col",function(b,a){if(!h(b.target).is("input,select,textarea")&&!b.pq_composed){f.setDraggables(b,
  a);b.pq_composed=!0;var e=h.Event("mousedown",b);h(b.target).trigger(e)}})},f=l.prototype;f.showFeedback=function(b,a){var d=this.that,c=b[0],f=c.offsetLeft+c.offsetParent.offsetParent.offsetLeft+(a?0:c.offsetWidth)-8,k=d.$grid_inner[0].offsetTop+d.$header[0].offsetHeight;this.$arrowTop.css({left:f,top:d.$grid_inner[0].offsetTop+c.offsetTop-16,display:""});this.$arrowBottom.css({left:f,top:k,display:""})};f.showArrows=function(){this.$arrowTop.show();this.$arrowBottom.show()};f.hideArrows=function(){this.$arrowTop.hide();
  this.$arrowBottom.hide()};f.updateDragHelper=function(b){var a=this.that.options.dragColumns,d=a.acceptIcon,a=a.rejectIcon,c=this.$drag_helper;c&&(b?(c.children("span.pq-drag-icon").addClass(d).removeClass(a),c.removeClass("ui-state-error")):(c.children("span.pq-drag-icon").removeClass(d).addClass(a),c.addClass("ui-state-error")))};f.setDraggables=function(b,a){var d=h(b.currentTarget),c=this.that,f=c.options.dragColumns.rejectIcon,k=this;d.hasClass("ui-draggable")||c.getHeaderColumnFromTD(d)&&d.draggable({distance:10,
  cursorAt:{top:-18,left:-10},helper:function(){var b=h(this);k.status="helper";k._setupDroppables(b);c.$header.find(".pq-grid-col-resize-handle").hide();var a=b.attr("pq-col-indx"),e=b.attr("pq-row-indx");b.droppable("destroy");b=h("<div class='pq-col-drag-helper ui-widget-content ui-corner-all' ><span class='pq-drag-icon ui-icon "+f+"'></span>"+c.headerCells[e][a].title+"</div>");k.$drag_helper=b;return b[0]},zIndex:"1000",appendTo:c.element,revert:"invalid",drag:function(b,a){k.status="drag";var e=
  h("td.pq-drop-hover",c.$header);if(0<e.length){k.showArrows();k.updateDragHelper(!0);var d=e.width();b.clientX-e.offset().left+h(document).scrollLeft()<d/2?(k.leftDrop=!0,k.showFeedback(e,!0)):(k.leftDrop=!1,k.showFeedback(e,!1))}else k.hideArrows(),c.$toolbar.hasClass("pq-drop-hover")?k.updateDragHelper(!0):k.updateDragHelper()},stop:function(b,a){k.status="stop";c.$header.find(".pq-grid-col-resize-handle").show();k.hideArrows()}})};f._columnIndexOf=function(b,a){for(var d=0,c=b.length;d<c;d++)if(b[d]==
  a)return d;return-1};f._setupDroppables=function(b){var a=this.that,d=this,c={hoverClass:"pq-drop-hover ui-state-highlight",tolerance:"pointer",drop:function(b,c){if(!a.dropPending){var f=parseInt(c.draggable.attr("pq-col-indx")),k=parseInt(c.draggable.attr("pq-row-indx")),l=parseInt(h(this).attr("pq-col-indx")),n=h(this).attr("pq-row-indx"),m=a.options.colModel,q=a.headerCells,p=q[k][f],f=0==k?m:q[k-1][f].colModel,m=0==n?m:q[n-1][l].colModel,l=q[n][l],p=d._columnIndexOf(f,p),p=f.splice(p,1)[0],l=
  d._columnIndexOf(m,l);m.splice(l+1-(d.leftDrop?1:0),0,p);a.dropPending=!0;window.setTimeout(function(){a._calcThisColModel();a.refresh();a.dropPending=!1},0)}}};b=a.$header_left.find("td.pq-left-col");var f=a.pqpanes.v?a.$header_right.find("td.pq-right-col"):a.$header_left.find("td.pq-right-col");b=b.add(f);b.each(function(b,a){var e=h(a);e.hasClass("ui-droppable")||e.droppable(c)})};p.options={detailModel:{cache:!0,offset:100,expandIcon:"ui-icon-triangle-1-se",collapseIcon:"ui-icon-triangle-1-e"},
  dragColumns:{enabled:!0,acceptIcon:"ui-icon-check",rejectIcon:"ui-icon-closethick",topIcon:"ui-icon-circle-arrow-s",bottomIcon:"ui-icon-circle-arrow-n"},track:!1,treeModel:{collapsed:!0,indent:15,leafIcon:"ui-icon-radio-off",expandIcon:"ui-icon-triangle-1-se",collapseIcon:"ui-icon-triangle-1-e"},filterModel:{on:!0,mode:"AND",header:!1}};p._create=function(){h.extend(h.paramquery.cGenerateView.prototype,k);var b=this;this.iGroupView=new q(this);this.iHeaderSearch=new d(this);this.iUCData=new h.paramquery.cUCData(this);
  this.iMouseSelection=new h.paramquery.cMouseSelection(this);this._super.apply(this);this.iGroupView.bindEvents();this.iDragColumns=new l(this);this._createToolbar();this.refreshHeader();this.refreshDataAndView({header:!1});this.refresh({table:!0});var a=b.widgetEventPrefix.toLowerCase();b.element.one(a+"load."+b.widgetName,function(a,e){b.refresh({header:!1})})};p._createToolbar=function(){var b=this.options,a=b.toolbar;if(a){var d=a.cls,c=a.style,f=a.attr,a=a.items,d=h("<div class='"+(d?d:"")+"' style='"+
  (c?c:"")+"' "+(f?f:"")+" ></div>").appendTo(h(".pq-grid-top",this.element));d.pqToolbar({items:a,gridInstance:this});b.showToolbar||d.css("display","none");this.$toolbar=d}};p.isLeftOrRight=function(b){return b>this.freezeCols?"right":"left"};p.ovCreateHeader=function(b,a){this.options.filterModel.header&&this.iHeaderSearch.createDOM(b,a)};p._createHeader=function(){this._super.apply(this);this.options.showHeader&&this._trigger("createHeader")};p.exportExcel=function(b){b.format="xml";return h.paramquery.pqgrid.exportToExcel.call(this,
  b)};p.exportCsv=function(b){b.format="csv";return h.paramquery.pqgrid.exportToExcel.call(this,b)};p.filter=function(b){var a=this,d=this.options,c=void 0===b.apply?!0:b.apply,f=void 0===b.sort?!0:b.sort,k=d.dataModel,d=d.filterModel;if(void 0!=b){var l="replace"==b.oper?!0:!1;b=b.data;for(var m=this.colModel,m=c?m:h.extend(!0,[],m),q=0,p=m.length,w=b.length,A=0;A<p;A++){for(var s=m[A],v=!1,y=0;y<w&&q!=w;y++){var x=b[y];if(x.dataIndx==s.dataIndx){v=!0;q++;var y=s.filter,B=x.condition,u=x.value;y?y.on=
  !0:y=s.filter={on:!0};B&&(y.condition=B);B=y.condition;y.value=u;if("between"==B)y.value2=x.value2;else if("range"==B){x=[];if(u)if("string"==typeof u){var B=y.options,z=u.indexOf('"'),C=u.lastIndexOf('"'),u=u.substr(z,C+1),u=JSON.parse("["+u+"]");if(B)for(z=0,C=B.length;z<C;z++){var F=B[z];-1!=h.inArray(F,u)&&x.push(F)}else x=u.split(",s*")}else"function"==typeof u.push&&(x=u);y.value=x}break}}l&&!v&&s.filter&&(s.filter.on=!1)}}var D={header:!1,apply:c,sort:f,CM:m};if("remote"==k.location&&"local"!=
  d.type)this.remoteRequest({apply:c,CM:m,callback:function(){return a._onDataAvailable(D)}});else return a._onDataAvailable(D)};p._initTypeColumns=function(){for(var b=this.colModel,a=0,d=b.length;a<d;a++){var f=b[a];"checkBoxSelection"===f.type?new h.paramquery.cCheckBoxColumn(this,f.dataIndx):"detail"===f.type&&(f.dataIndx="pq_detail",this.iHierarchy=new c(this))}};p.refreshHeader=function(){this._createHeader()};p.refreshDataFromDataModel=function(){this._super.apply(this);this.options.groupModel&&
  this.iGroupView._refreshDataFromDataModel()};f=(h.paramquery.cSort=function(b){this.that=b}).prototype;f._refreshSorters=function(b){var a=this.that.options,d=a.dataModel,c=d.sortIndx,f=h.isArray(c),k=a.groupModel,l=k?k.dataIndx:null,m=k?k.dir:null,q=-1,a=[];if(k)for(k=0;k<l.length;k++){var p=l[k];p==b&&(q=k);a.push({dataIndx:p,dir:m&&m[k]?m[k]:"up"})}-1!==q?(b="up"===a[q].dir?"down":"up",a[q].dir=b,m[q]=b):null!=b&&(f?(m=h.inArray(b,d.sortIndx),-1!=m?"up"==d.sortDir[m]?d.sortDir[m]="down":1==c.length?
  d.sortDir[m]="up":(d.sortIndx.splice(m,1),d.sortDir.splice(m,1)):(m=d.sortIndx.length,d.sortIndx[m]=b,d.sortDir[m]="up")):d.sortIndx==b?d.sortDir="up"==d.sortDir?"down":"up":(d.sortIndx=b,d.sortDir="up"));if(null!=d.sortIndx)if(f)for(k=0;k<c.length;k++)f=c[k],-1==this.inSorters(a,f)&&a.push({dataIndx:f,dir:d.sortDir[k]});else-1==this.inSorters(a,d.sortIndx)&&a.push({dataIndx:d.sortIndx,dir:d.sortDir});this.sorters=a};f.inSorters=function(a,d){for(var c=-1,f=0;f<a.length;f++)if(a[f].dataIndx==d){c=
  f;break}return c};f._sortLocalData=function(a){for(var d=this.that,c=d.colModel,f=this.sorters,k=0;k<f.length;k++){var l=f[k],m=d.getColIndx({dataIndx:l.dataIndx});l.dataType=c[m].dataType}return this.__sortLocalData(f,a)};f.__sortLocalData=function(a,d){function c(a,b,d,e){a=a[d];b=b[d];a=a?parseInt(a,10):0;b=b?parseInt(b,10):0;return(a-b)*e}function f(a,b,d,e){a=a[d];b=b[d];a=a?Date.parse(a):0;b=b?Date.parse(b):0;return(a-b)*e}function k(a,b,d,e){a=(a[d]+"").replace(/,/g,"");b=(b[d]+"").replace(/,/g,
  "");a=a?parseFloat(a):0;b=b?parseFloat(b):0;return(a-b)*e}function l(a,b,d,e){a=a[d];b=b[d];a=a?a:"";b=b?b:"";d=0;a>b?d=1:a<b&&(d=-1);return d*e}function m(a,b,d,e){a=a[d];b=b[d];a=a?a.toUpperCase():"";b=b?b.toUpperCase():"";d=0;a>b?d=1:a<b&&(d=-1);return d*e}function q(a,b,d,e){a=a[d];b=b[d];d=0;if(a&&!b||!1===a&&null===b)d=1;else if(b&&!a||!1===b&&null===a)d=-1;return d*e}function p(){for(var h=[],w=[],A=[],s=a.length,v=0;v<s;v++){var y=a[v],x="up"==y.dir?1:-1,B=y.dataType;w[v]=y.dataIndx;A[v]=
  x;h[v]="integer"==B?c:"float"==B?k:"function"==typeof B?function(a){return function(b,d,e,c){return a(b[e],d[e])*c}}(B):"date"==B?f:"stringi"==B?m:"bool"==B?q:l}d=d.sort(function(a,b){for(var d=0,e=0;e<s&&(d=h[e](a,b,w[e],A[e]),0==d);e++);return d})}if(null!=d&&0!=d.length){if(!a||!a.length)return d;h.measureTime(p,"innerSort");return d}};p._refreshHeaderSortIcons=function(){var a=this.iSort.sorters,d=this.$header;if(d){d.find(".pq-grid-col").removeClass("pq-col-sort-asc pq-col-sort-desc ui-state-active");
  d.find(".pq-col-sort-icon").removeClass("ui-icon ui-icon-triangle-1-n ui-icon-triangle-1-s");for(var c=0;c<a.length;c++){var f=a[c],k=this.getColIndx({dataIndx:f.dataIndx}),l=f.dir,f="ui-state-active pq-col-sort-"+("up"==l?"asc":"desc"),l="ui-icon ui-icon-triangle-1-"+("up"==l?"n":"s");d.find(".pq-grid-col[pq-grid-col-indx="+k+"]").addClass(f);d.find(".pq-grid-col[pq-grid-col-indx="+k+"] .pq-col-sort-icon").addClass(l)}}};p.getHeaderColumnFromTD=function(a){a=a.attr("pq-grid-col-indx");if(null!=a)return this.colModel[a]};
  p.getIndxInSorters=function(a){for(var d=this.sorters,c=0,f=d.length;c<f;c++)if(d[c].dataIndx==a)return c;return-1};p.getLargestRowCol=function(a){for(var d=0;d<a.length;d++);};p.bringCellToView=function(a){this._bringCellToView(a)};p._setUrl=function(a){this.options.dataModel.getUrl=function(){return{url:this.url+(null!=a?a:"")}}};p.getDataPage=function(){return this.data};p.getData=function(a){var d=a.dataIndx,c=d.length;a=a.data;var f=this.options.dataModel,k=f.data,f=f.dataUF,l=[],m=function(a){for(var b=
  0,f=a.length;b<f;b++){for(var k=a[b],m={},n=0;n<c;n++){var h=d[n];m[h]=k[h]}l.push(m)}};a?m(a):(k&&m(k),f&&m(f));a=[];for(k=0;k<c;k++)f=d[k],m=this.getColumn({dataIndx:f}),a.push({dataIndx:f,dir:"up",dataType:m.dataType});l=this.iSort.__sortLocalData(a,l);a=[];k=void 0;for(f=0;f<l.length;f++){var m=l[f],h=JSON.stringify(m);h!==k&&(a.push(m),k=h)}return a};p.getFilterData=function(b){var d=b.CM;if(!d)throw"CM N/A";var c=d.length,f=b.location;b=this.options.filterModel.multiple;for(var k=h.paramquery.filter.getAllConditions,
  l=h.paramquery.filter.getTRConditions,m=[],q=function(a,b,d){return"between"==a?null!=b&&""!==b||null!=d&&""!==d?!0:!1:-1!=h.inArray(a,k)?null!=b&&""!==b||-1==h.inArray(a,l)?!0:!1:!0},p=function(b,d){return"remote"==f?(null==b?"":b).toString():a.convert(b,d)},N=0;N<c;N++){var w=d[N],A=w.dataIndx,s=w.dataType,s=s&&"function"!=typeof s?s:"string",v=w.filter;if(b){if((v=w.filterModel)&&v.on){for(var y=[],x=v.mode,B=v.filters,w=0;w<B.length;w++){var v=B[w],u=v.value,z=v.condition;q(z,u)&&(u=p(u,s),y.push({value:u,
  condition:z}))}m.push({dataIndx:A,mode:x,dataType:s,filters:y})}}else if(v&&v.on&&(u=v.value,y=v.value2,z=v.condition,q(z,u,y))){if("between"==z)""===u||null==u?(z="lte",u=p(y,s)):""===y||null==y?(z="gte",u=p(u,s)):(u=p(u,s),y=p(y,s));else if("regexp"==z)if("remote"==f)u=u.toString();else{if("string"==typeof u)try{var C=v.modifiers,C=C?C:"gi",u=new RegExp(u,C)}catch(F){u=/.*/}}else if("range"==z)if(null==u)continue;else if("string"==typeof u)u=p(u,s),u=u.split(/\s*,\s*/);else{if(u&&"function"==typeof u.push){if(0==
  u.length)continue;u=u.slice();w=0;for(v=u.length;w<v;w++)u[w]=p(u[w],s)}}else u=p(u,s);m.push({dataIndx:A,value:u,value2:y,condition:z,dataType:s,cbFn:"remote"==f?"":a.conditions[z]})}}return m};var a=function(a){this.that=a},f=a.prototype;a.conditions={equal:function(a,d){if(a==d)return!0},contain:function(a,d){if(-1!=a.indexOf(d))return!0},notcontain:function(a,d){if(-1==a.indexOf(d))return!0},empty:function(a){if(0==a.length)return!0},notempty:function(a){if(0<a.length)return!0},begin:function(a,
  d){if(0==a.indexOf(d))return!0},notbegin:function(a,d){if(0!=a.indexOf(d))return!0},end:function(a,d){var c=a.lastIndexOf(d);if(-1!=c&&c+d.length==a.length)return!0},notend:function(a,d){var c=a.lastIndexOf(d);if(-1==c||c+d.length!=a.length)return!0},regexp:function(a,d){if(d.test(a))return d.lastIndex=0,!0},notequal:function(a,d){if(a!=d)return!0},great:function(a,d){if(a>d)return!0},gte:function(a,d){if(a>=d)return!0},between:function(a,d,c){if(a>=d&&a<=c)return!0},range:function(a,d){if(-1!=h.inArray(a,
  d))return!0},less:function(a,d){if(a<d)return!0},lte:function(a,d){if(a<=d)return!0}};a.convert=function(a,d){a=null==a?"":a;"string"==d?a=h.trim(a).toUpperCase():"date"==d?a=Date.parse(a):"integer"==d?a=parseInt(a):"float"==d?a=parseFloat(a):"bool"==d&&(a=String(a).toLowerCase());return a};f.isMatchCellSingle=function(b,d){var c=b.dataType,f=b.value,k=b.value2,l=b.cbFn,m=d[b.dataIndx],m="regexp"==b.condition?null==m?"":m:a.convert(m,c);return l(m,f,k)?!0:!1};f.isMatchCellMultiple=function(a,d){var c=
  a.dataIndx,f=a.dataType,k=a.mode,l=a.filters,m=l.length;if(0==m)return!0;for(var h=0;h<m;h++){var q=l[h],q=this.isMatchRule(d[c],q.condition,q.value,f);if("OR"==k&&q)return!0;if("AND"==k&&!q)return!1}if(1===m)return q;if("AND"==k)return!0;if("OR"==k)return!1};f.isMatchRow=function(a,d,c){if(0==d.length)return!0;for(var f=0;f<d.length;f++){var k=this.isMatchCell(d[f],a);if("OR"==c&&k)return!0;if("AND"==c&&!k)return!1}if("AND"==c)return!0;if("OR"==c)return!1};p.filterLocalData=function(b){b=b?b:{};
  var d=b.apply;b=!1===d?b.CM:this.colModel;var c=this.getFilterData({CM:b}),f=this.options,k=f.dataModel,l=k.data,m=k.dataUF,h=[],q=[],f=f.filterModel,p=f.multiple,w=f?f.mode:null,A=new a;A.isMatchCell=p?A.isMatchCellMultiple:A.isMatchCellSingle;if(f.on&&w){if(l)for(var p=0,s=l.length;p<s;p++){var v=l[p];A.isMatchRow(v,c,w)?h.push(v):q.push(v)}if(m)for(p=0,s=m.length;p<s;p++)v=m[p],A.isMatchRow(v,c,w)?h.push(v):q.push(v)}else{if(l)for(p=0,s=l.length;p<s;p++)v=l[p],h.push(v);if(m)for(p=0,s=m.length;p<
  s;p++)v=m[p],h.push(v)}d&&(k.data=h,k.dataUF=q,this._trigger("filter",null,{type:"local",dataModel:k,colModel:b,filterModel:f}));return{data:h,dataUF:q}};p._onDataAvailable=function(a){a=a?a:{};var d=this.options,c=a.apply,f=a.sort,k=[],k=d.filterModel,d=d.dataModel,l=d.location;!1!==c&&this._trigger("dataAvailable",a.evt,{dataModel:d});k=k&&k.on&&("local"==l&&"remote"!=k.type||"remote"==l&&"local"==k.type)?this.filterLocalData(a).data:d.data;d.sorting&&"local"==d.sorting&&!1!==f&&(k=this.iSort._sortLocalData(k));
  if(!1===c)return k;d.data=k;this.refreshView(a)};p.sort=function(a){var d=this,c=this.options,f=a.colIndx,k=c.editModel,l=a.dataIndx,m=a.evt,h=c.dataModel;if(null==f&&null==l&&(l=h.sortIndx,null==l))return;var f=null==f?this.getColIndx({dataIndx:l}):f,q=this.colModel[f],l=null==l?q.dataIndx:l;!1!=d._trigger("beforeSort",m,{dataModel:h,column:q,dataIndx:l})&&(k.indices&&d.blurEditor({force:!0}),this.iSort._refreshSorters(l),"local"==h.sorting?(this.iSort._sortLocalData(h.data),this.refreshView()):
  "remote"==h.sorting&&this.remoteRequest({callback:function(){d._trigger("sort",m,{dataModel:h,column:q,dataIndx:l});d._onDataAvailable()}}))};p._setScrollVLength=function(a){a=this.options.groupModel?this.dataGM:a;this._super.call(this,a)};h.widget("paramquery.pqGrid",h.paramquery._pqGrid,p);h.paramquery.pqGrid.regional={};h.paramquery.pqGrid.regional.en=p._regional})(jQuery);
  (function(h){h.paramquery=null==h.paramquery?{}:h.paramquery;h.paramquery.pqgrid=null==h.paramquery.pqgrid?{}:h.paramquery.pqgrid;h.paramquery.pqgrid.exportToExcel=function(c){var f=this,p=void 0===c.urlPost?c.url:c.urlPost,m=c.url,d=null==c.sheetName?"pqGrid":c.sheetName;c=c.format;var k=function(){for(var d=f.colModel,c=d.length,a=f.options.dataModel.data,b=a.length,e=[],k=[],m=[],h=0;h<c;h++){var p=d[h];p.hidden||(p=p.title.replace(/\"/g,'""'),k.push('"'+p+'"'))}e.push(k.join(","));for(h=0;h<b;h++){for(var k=
  a[h],E=0;E<c;E++)p=d[E],p.hidden||(p=k[p.dataIndx]+"",p=p.replace(/\"/g,'""'),m.push('"'+p+'"'));e.push(m.join(","));m=[]}return e.join("\n")},k="xml"==c?function(){for(var c=f.colModel,k=c.length,a=f.options.dataModel.data,b=a.length,e=[],g=[],m=0;m<k;m++){var h=c[m];h.hidden||g.push('<Column ss:AutoFitWidth="1"  ss:Width="'+h._width+'" />')}g.push("<Row>");for(m=0;m<k;m++)h=c[m],h.hidden||g.push('<Cell><Data ss:Type="String">'+h.title+"</Data></Cell>");g.push("</Row>");g=g.join("\n");for(m=0;m<
  b;m++){var p=a[m];e.push("<Row>");for(var E=0;E<k;E++)h=c[E],h.hidden||e.push('<Cell><Data ss:Type="String"><![CDATA['+p[h.dataIndx]+"]]\x3e</Data></Cell>");e.push("</Row>")}e=e.join("\n");return['<?xml version="1.0"?>\n<?mso-application progid="Excel.Sheet"?>\n<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\n xmlns:o="urn:schemas-microsoft-com:office:office"\n xmlns:x="urn:schemas-microsoft-com:office:excel"\n xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\n xmlns:html="http://www.w3.org/TR/REC-html40">\n<Worksheet ss:Name="',
  d,'">\n<Table>',g,e,"</Table>\n</Worksheet>\n</Workbook>"].join("\n")}():k();h.ajax({url:p,type:"POST",cache:!1,data:{extension:c,excel:k},success:function(d){d=m+((0<m.indexOf("?")?"&":"?")+"filename="+d);h(document.body).append("<iframe height='0' width='0' frameborder='0'  src="+d+"></iframe>")}})}})(jQuery);
  (function(h){var c=(h.paramquery.cUCData=function(c){this.that=c;this.udata=[];this.ddata=[];this.adata=[];var h=this,m=c.eventNamespace,d=c.widgetEventPrefix.toLowerCase();c.element.on(d+"dataavailable"+m,function(d,c){h.belongs(d)&&(h.udata=[],h.ddata=[],h.adata=[])})}).prototype=new h.paramquery.cClass;c.add=function(c){var h=this.adata;c=c.rowData;for(var m=this.that.getRecId({rowData:c}),d=0,k=h.length;d<k;d++){var q=h[d];if(null!=m&&q.recId==m)throw"primary key violation";if(q.rowData==c)throw"same data can't be added twice.";
  }c={recId:m,rowData:c};h.push(c)};c.update=function(c){var h=this.that,m=h.getRowData(c),d=h.getRecId({rowData:m}),k=c.dataIndx,q=c.oldVal;c=c.newVal;var l=this.udata,a=!1;if(null!=d){for(var b=0,e=l.length;b<e;b++){var g=l[b];if(g.rowData==m&&g.dataIndx==k){a=!0;g.oldVal==c?(l.splice(b,1),b={rowData:m,dataIndx:k,cls:"pq-cell-dirty"},h.removeClass(b)):g.newVal=c;break}}a||(b={rowData:m,recId:d,dataIndx:k,newVal:c,oldVal:q},l.push(b),b={rowData:m,dataIndx:k,cls:"pq-cell-dirty"},h.addClass(b))}};c["delete"]=
  function(c){var h=this.that,m=c.rowIndx,d=c.rowIndxPage,k=h.rowIndxOffset,m=null==m?d+k:m,m="remote"==h.options.pageModel.type?null==d?m-k:d:m,d=this.adata,k=this.ddata;c=h.getRowData(c);for(var h=0,q=d.length;h<q;h++)if(d[h].rowData==c){d.splice(h,1);return}k.push({indx:m,rowData:c})};c.isDirty=function(){var c=this.adata,h=this.ddata;return this.udata.length||c.length||h.length?!0:!1};c.getChangesValue=function(){for(var c=this.udata,p=this.adata,m=this.ddata,d={updateList:[],addList:[],deleteList:[]},
  k=[],q=[],l=[],a=[],b=[],e=0,g=m.length;e<g;e++){var n=m[e],n=n.rowData,r={};a.push(n);for(var t in n)0!=t.indexOf("pq_")&&(r[t]=n[t]);b.push(r)}for(e=0;e<c.length;e++)if(n=c[e],n=n.rowData,-1==h.inArray(n,a)&&-1==h.inArray(n,k)){r={};for(t in n)0!=t.indexOf("pq_")&&(r[t]=n[t]);k.push(n);q.push(r)}for(e=0;e<p.length;e++){n=p[e];n=n.rowData;r={};for(t in n)0!=t.indexOf("pq_")&&(r[t]=n[t]);l.push(r)}d.updateList=q;d.addList=l;d.deleteList=b;return d};c.getChanges=function(){for(var c=this.udata,p=this.adata,
  m=this.ddata,d={updateList:[],addList:[],deleteList:[]},k=[],q=[],l=[],a=0,b=m.length;a<b;a++){var e=m[a],e=e.rowData;l.push(e)}for(a=0;a<c.length;a++)e=c[a],e=e.rowData,-1==h.inArray(e,l)&&-1==h.inArray(e,k)&&k.push(e);for(a=0;a<p.length;a++)e=p[a],e=e.rowData,q.push(e);d.updateList=k;d.addList=q;d.deleteList=l;return d};c.getChangesRaw=function(){var c=this.adata,h=this.ddata,m={updateList:[],addList:[],deleteList:[]};m.updateList=this.udata;m.addList=c;m.deleteList=h;return m};c.getVal=function(c,
  h){"float"==h?c=null==c?null:parseFloat(c):"integer"==h?c=null==c?null:parseInt(c):"date"==h&&(c=null==c?null:Date.parse(c));return c};c.commitAdd=function(c,p){for(var m=this.that.colModel,d=m.length,k=this.adata,q=k.length,l=c.length,a=[],b=0;b<l;b++)for(var e=c[b],g=0;g<q;g++){for(var n=k[g].rowData,r=!0,t=0;t<d;t++){var E=m[t],G=E.dataType,L=E.dataIndx;if(!E.hidden&&L!=p&&(E=n[L],E=this.getVal(E,G),L=e[L],L=this.getVal(L,G),E!=L)){r=!1;break}}r&&(n[p]=e[p],a.push(n))}m=[];for(g=0;g<q;g++)n=k[g].rowData,
  -1==h.inArray(n,a)&&m.push(k[g]);this.adata=m};c.commitUpdate=function(c,p){for(var m=this.that,d=m.colModel,k=d.length,q=this.udata,l=q.length,a=c.length,b=[],e=0;e<l;e++){var g=q[e].rowData;if(-1==h.inArray(g,b))for(var n=0;n<a;n++){var r=c[n];if(g[p]==r[p]){b.push(g);for(var t=0;t<k;t++){var E=d[t].dataIndx;void 0!==r[E]&&(g[E]=r[E]);m.removeClass({rowData:g,dataIndx:E,cls:"pq-cell-dirty",refresh:!1})}}}}m=[];for(e=0;e<l;e++)g=q[e].rowData,-1==h.inArray(g,b)&&m.push(q[e]);this.udata=m};c.commitDelete=
  function(c,p){for(var m=this.ddata,d=m.length,k=c.length,q=[],l=0;l<d;l++)for(var a=m[l].rowData,b=0;b<k;b++)a[p]==c[b][p]&&q.push(a);k=[];for(l=0;l<d;l++)a=m[l].rowData,-1==h.inArray(a,q)&&k.push(m[l]);this.ddata=k};c.commitUpdateAll=function(){for(var c=this.that,h=this.udata,m=0,d=h.length;m<d;m++){var k=h[m];c.removeClass({rowData:k.rowData,dataIndx:k.dataIndx,cls:"pq-cell-dirty"})}this.udata=[]};c.commitAddAll=function(){this.adata=[]};c.commitDeleteAll=function(){this.ddata=[]};c.commit=function(c){var h=
  this.that,m=h.options.dataModel.recIndx;if(null==c)this.commitAddAll(),this.commitUpdateAll(),this.commitDeleteAll();else{var d=c.type;c=c.rows;"add"==d?c?this.commitAdd(c,m):this.commitAddAll():"update"==d?c?this.commitUpdate(c,m):this.commitUpdateAll():"delete"==d&&(c?this.commitDelete(c,m):this.commitDeleteAll())}h.refreshView()};c.rollbackAdd=function(c,h){for(var m=this.adata,d=c.type,k=0,q=m.length;k<q;k++)for(var l=m[k].rowData,a=0,b=h.length;a<b;a++)if(h[a]==l){(l=h.splice(a,1))&&l.length&&
  "remote"==d&&c.totalRecords--;break}this.adata=[]};c.rollbackDelete=function(c,h){for(var m=this.ddata,d=c.type,k=m.length-1;0<=k;k--){var q=m[k];h.splice(q.indx,0,q.rowData);"remote"==d&&c.totalRecords++}this.ddata=[]};c.rollbackUpdate=function(c,h){for(var m=this.that,d=this.udata,k=0,q=d.length;k<q;k++){var l=d[k],a=l.rowData,b=l.dataIndx;null!=l.recId&&(a[b]=l.oldVal,m.removeClass({rowData:a,dataIndx:b,cls:"pq-cell-dirty",refresh:!1}))}this.udata=[]};c.rollback=function(c){var h=this.that,m=h.options.pageModel,
  d=c&&null!=c.refresh?c.refresh:!0;c=c&&null!=c.type?c.type:null;var k=h.options.dataModel.data;null!=c&&"update"!=c||this.rollbackUpdate(m,k);null!=c&&"delete"!=c||this.rollbackDelete(m,k);null!=c&&"add"!=c||this.rollbackAdd(m,k);d&&h.refreshView()};c=h.paramquery.pqGrid.prototype;c.getChanges=function(c){this.blurEditor({force:!0});if(c&&(c=c.format)){if("byVal"==c)return this.iUCData.getChangesValue();if("raw"==c)return this.iUCData.getChangesRaw()}return this.iUCData.getChanges()};c.rollback=function(c){this.blurEditor({force:!0});
  this.iUCData.rollback(c)};c.isDirty=function(){return this.iUCData.isDirty()};c.commit=function(c){this.blurEditor({force:!0});this.iUCData.commit(c)};c._getRowIndx=function(){var c=this.selection({type:"row",method:"getSelection"});if(c&&0<c.length){var c=c[0].rowIndx,h=this.options.pageModel,m=c-this.rowIndxOffset,d=h.rPP;if(h.type){if(0<=m&&m<d)return c}else return c}else return null};c.updateRow=function(c){var h=this.options.track,h=null!=c.track?c.track:h,m=c.rowIndx;c=c.row;var d=!1,k=this.getRowData({rowIndx:m}),
  q={rowData:k},l;for(l in c){var a=k[l],b=c[l];b!==a&&(d=!0,h&&(q.dataIndx=l,q.oldVal=a,q.newVal=b,this.iUCData.update(q)),k[l]=b)}d&&this.refreshRow({rowIndx:m})};c._fillForm=function(c){var h=this.colModel,m=this.rowIndxOffset,d=null==c.rowIndxPage?c.rowIndx-m:c.rowIndxPage;c=null==c.rowIndx?d+m:c.rowIndx;this.rowData=d=this.options.dataModel.data["remote"==this.options.pageModel.type?d:c];this.$crudDialog.dialog("option","title","Edit Record ("+(c+1)+")");c=this.$crudForm;for(m=0;m<h.length;m++){var k=
  h[m].dataIndx,q=d[k];c.find("*[name='"+k+"']").val(q)}};c.getRecId=function(c){c.dataIndx=this.options.dataModel.recIndx;return this.getCellData(c)};c.getCellData=function(c){return this.getRowData(c)[c.dataIndx]};c.getRowData=function(c){var h=c.rowData;if(null!=h)return h;var m=this.options,h=m.dataModel,m=m.pageModel.type,d=h.recIndx,k=c.recId,h=h.data;if(null!=k)for(c=0,m=h.length;c<m;c++){var q=h[c];if(q[d]==k)return q}else return d=c.rowIndx,c=c.rowIndxPage,k=this.rowIndxOffset,d=null!=d?d:
  c+k,q=h["remote"==m?null!=c?c:d-k:d]};c.deleteRow=function(c){var h=this,m=c.rowIndx,d=c.effect,k=h.options,q=k.dataModel,l=k.pageModel,a=l.type;if(null!=m){var b="remote"==a?m-this.rowIndxOffset:m,e=q.data,k=k.track;if(k=null!=c.track?c.track:k)this.iUCData["delete"]({rowIndx:m});d?(h=this,(m=this.getRow({rowIndx:m}))&&m.effect("fade",null,350,function(){var d=c.complete;d&&"function"==typeof d&&d.call(h.element[0]);(d=e.splice(b,1))&&d.length&&"remote"==a&&l.totalRecords--;h.refreshView()})):((m=
  e.splice(b,1))&&m.length&&"remote"==a&&l.totalRecords--,this.refreshView())}};c.addRow=function(c){return this._addLocal(c)};c._addLocal=function(c){var h=c.rowData,m=c.rowIndx,d=c.rowIndxPage,k=this.options,q=k.dataModel,l=k.pageModel,a=l.type,b=k.track,b=null!=c.track?c.track:b,k=q.data;if(null==h)return null;null==k&&(q.data=[],k=q.data);b&&this.iUCData.add({rowData:h});null==m&&null==d?k.push(h):(q=this.rowIndxOffset,m=null==m?d+q:m,k.splice("remote"==a?null==d?m-q:d:m,0,h));"remote"==a&&l.totalRecords++;
  !1!==!c.refresh&&this.refreshView();return null==m?k.length-1:m};c._addRemote=function(c){c=c.rowData;c.pq_oper="add";this.options.dataModel.postDataOnce=c}})(jQuery);
  (function(h){h.widget("paramquery.pqToolbar",{options:{items:[],gridInstance:null},_create:function(){var c=this.options,f=c.gridInstance,p=f.colModel,m=c.items,d=this.element;d.closest(".pq-grid");d.addClass("pq-toolbar");for(var k=0,q=m.length;k<q;k++){var l=m[k],c=l.type,a=l.icon,b=l.label,e=l.listeners,g=l.cls,g="ui-corner-all "+(g?g:""),n=l.style,n=n?'style="'+n+'"':"",r=l.attr,r=r?r:"",t;"textbox"==c?t=h("<input type='text' class='"+g+"' "+r+" "+n+">").appendTo(d):"checkbox"==c?t=h("<input type='checkbox' class='"+
  g+"' "+r+" "+n+">").appendTo(d):"separator"==c?h("<span class='pq-separator '"+g+"' "+r+" "+n+"></span>").appendTo(d):"button"==c?t=h("<button type='button' class='"+g+"' "+r+" "+n+">"+b+"</button>").button({text:b?!0:!1,icons:{primary:a}}).appendTo(d):"select"==c?(c=l.options?l.options:[],"function"===typeof c&&(c=c.call(f.element[0],{colModel:p})),t=h.paramquery.select({options:c,attr:" class='"+g+"' "+r+" "+n,prepend:l.prepend,groupIndx:l.groupIndx,valueIndx:l.valueIndx,labelIndx:l.labelIndx}),
  t=h(t).appendTo(d)):"string"==typeof c?t=h(c).appendTo(d):"function"==typeof c&&(t=c.call(f.element[0],{colModel:p,cls:g}),t=h(t).appendTo(d));if(e)for(l=0;l<e.length;l++){var c=e[l],E;for(E in c)t.bind(E,c[E])}}},_destroy:function(){this.element.empty().removeClass("pq-toolbar").enableSelection()},_disable:function(){null==this.$disable&&(this.$disable=h("<div class='pq-grid-disable'></div>").css("opacity",.2).appendTo(this.element))},_enable:function(){this.$disable&&(this.element[0].removeChild(this.$disable[0]),
  this.$disable=null)},_setOption:function(c,f){"disabled"==c&&(!0==f?this._disable():this._enable())}})})(jQuery);
  (function(h){var c=function(){this.focusSelection=null},f=c.prototype;f.getOldRowSel=function(){var d=this.that,c;if((c=this.focusSelection)&&this.isSelected(c))return d=d.getRowIndx(c),d.rowData=c.rowData,d};f.getOldCellSel=function(){var d=this.that,c;if((c=this.focusSelection)&&this.isSelected(c)){var f=c.rowData,d=d.getRowIndx({rowData:f});d.rowData=f;d.dataIndx=c.dataIndx;return d}};f.getNewRowSel=function(){var d=this.that,c=document.activeElement?h(document.activeElement):null;if(c&&c.hasClass("pq-grid-row")&&
  c.closest(".pq-grid")[0]==d.element[0])return d=d.getRowIndx({$tr:c}),d.$tr=c,d};f.getNewCellSel=function(){var d=this.that,c=document.activeElement?h(document.activeElement):null;if(c&&c.hasClass("pq-grid-cell")&&c.closest(".pq-grid")[0]==d.element[0])return d=d.getCellIndices({$td:c}),d.$td=c,d};f.getFocusSelection=function(d){if(this instanceof p)return d&&!0===d.old?this.getOldRowSel():this.getNewRowSel();if(this instanceof m)return d&&!0===d.old?this.getOldCellSel():this.getNewCellSel()};f.getFirstSelection=
  function(){var d=this.firstSelection;if(d&&this.isSelected(d))return d;this.refresh();d=this.selection;if(d.length)return this.firstSelection=d[0],d[0]};f.getLastSelection=function(){var d=this.lastSelection;if(d){var c=d.rowData,f=this.that.getRowData({rowIndx:rowIndx});return c==f&&this.isSelected(d)?d:!1}return null};f.getLastSelectionCurPage=function(){var d=this.lastSelection;if(d&&this.isSelected(d)){var c=d.rowIndx,f=this.that.options.pageModel;if(f.type){var l=f.curPage;return Math.ceil((c+
  1)/f.rPP)==l?d:null}return d}return null};f.getSelection=function(){this.refresh();return this.selection};f.getSelectionCurPage=function(){var d=this.that,c=this.getSelection(),f=[],d=d.options,l=d.dataModel;if(d.pageModel.type){for(var d=l.curPage,l=l.rPP,a=0;a<c.length;a++){var b=c[a];Math.ceil((b.rowIndx+1)/l)==d&&f.push(b)}return f}return c};f.inViewRow=function(d){var c=this.that,f=this.options,l=c.rowIndxOffset,a=c.initV,b=c.finalV;if(d<f.freezeRows)return!0;if(f.groupModel){if((c=c.dataGM)&&
  c.length)for(;a<b;a++)if(f=c[a].rowIndx-l,null!=f&&f==d)return!0;return!1}return d>=a&&d<=b};f.setDirty=function(){};var p=function(d){this.that=d;this.options=d.options;this.selection=[]};h.paramquery.cRows=p;var m=function(d){this.options=d.options;this.that=d;this.selection=[]};h.paramquery.cCells=m;f=m.prototype=new c;c=p.prototype=new c;c.extendSelection=function(d){var c=this.that,f=d.rowIndx,l=c.options.selectionModel.mode;d=d.evt;var a=this.getFirstSelection();null==a?c.setSelection({rowIndx:f}):
  "single"!=l&&(l=c=a.rowIndx,a=f,c>f&&(l=f,a=c),this.selectRange({initRowIndx:l,finalRowIndx:a,evt:d}),this.add({rowIndx:f}))};c.refresh=function(){this.selection=[];var d=this.that,c=d.options,f="remote"==c.pageModel.type?!0:!1,d=d.rowIndxOffset;if(c=c.dataModel.data)for(var l=0,a=c.length;l<a;l++){var b=c[l];b.pq_rowselect&&this.selection.push({rowIndx:f?l+d:l,rowData:b})}};c.replace=function(d){var c=d.rowIndx,f=null==d.offset?this.that.getRowIndxOffset():d.offset;d.offset=f;d.rowIndxPage=c-f;this.removeAll({raiseEvent:!0});
  this.add(d)};c.indexOf=function(d){this.refresh();d=d.rowIndx;for(var c=this.selection,f=0;f<c.length;f++)if(c[f].rowIndx==d)return f;return-1};c.isSelected=function(d){return(d=this.that.getRowData(d))?null==d.pq_rowselect?!1:d.pq_rowselect:null};c._boundRow=function(d){var c=d.rowIndxPage,f=this.that;d=null==d.$tr?f.getRow({rowIndxPage:c}):d.$tr;if(null==d||0==d.length)return!1;d.addClass("pq-row-select ui-state-highlight");return d};c.selectRange=function(d){var c=d.initRowIndx;d=d.finalRowIndx;
  for(var f=this.getSelection().slice(0),l=0;l<f.length;l++){var a=f[l].rowIndx;(a<c||a>d)&&this.remove({rowIndx:a})}c>d&&(f=c,c=d,d=f);for(a=c;a<=d;a++)this.add({rowIndx:a,focus:!1})};f._addToData=function(d){var c=d.dataIndx;d=this.that.getRowData(d);d.pq_cellselect||(d.pq_cellselect={});d.pq_cellselect[c]=!0};f.extendSelection=function(d){var c=this.that,f=this.getFirstSelection(),l=d.rowIndx,a=d.colIndx,b=c.options.selectionModel.mode;d=d.evt;if(null==f)c.setSelection({rowIndx:l,colIndx:a});else{var e=
  f.rowIndx,c=c.getColIndx({dataIndx:f.dataIndx}),f=e,g=l,h=c,m=a;e>l&&(f=l,g=e);"range"==b?(e>l&&(h=a,m=c),l==e&&a<c&&(h=a,m=c),this.selectRange({initRowIndx:f,initColIndx:h,finalRowIndx:g,finalColIndx:m,evt:d}),this.add({rowIndx:l,colIndx:a})):"block"==b&&(c>a&&(h=a,m=c),this.selectBlock({initRowIndx:f,initColIndx:h,finalRowIndx:g,finalColIndx:m,evt:d}),this.add({rowIndx:l,colIndx:a}))}};f._removeFromData=function(d){var c=d.rowData;c&&c.pq_cellselect&&delete c.pq_cellselect[d.dataIndx]};f.removeAll=
  function(){this.refresh();var d=this.selection.slice(0);this.remove({cells:d});this.lastSelection=null};c.removeAll=function(d){var c=this.that,f=d?d.page:!1;this.refresh();d=this.selection.slice(0);if(f){for(var f=[],l=c.rowIndxOffset,c=(c=c.data)?c.length:0,a=0,b=d.length;a<b;a++){var e=d[a],g=e.rowIndx-l;if(0<=g)if(g<c)f.push(e);else break}this.remove({rows:f})}else this.remove({rows:d}),this.lastSelection=null};f.isSelected=function(d){var c=this.that,f=c.getRowData(d),l=d.dataIndx,l=null==l?
  c.colModel[d.colIndx].dataIndx:l;return null==f?null:f.pq_cellselect&&f.pq_cellselect[l]?!0:!1};f.refresh=function(){this.selection=[];var d=this.that,c=d.options.dataModel.data,f="remote"==d.options.pageModel.type?!0:!1,d=d.rowIndxOffset;if(c){for(var l=0,a=c.length;l<a;l++){var b=c[l],e=b.pq_cellselect;if(e){var g=f?l+d:l,h;for(h in e)e[h]&&this.selection.push({rowIndx:g,rowData:b,dataIndx:h})}}this.isDirty=!1}};f.replace=function(d){var c=d.rowIndx,f=null==d.offset?this.that.getRowIndxOffset():
  d.offset;d.rowIndxPage=c-f;d.offset=f;this.removeAll({raiseEvent:!0});this.add(d)};f.inViewCell=function(d,c){var f=this.that,l=this.options.freezeCols;return this.inViewRow(d)?c<l||c>=f.initH&&c<=f.finalH:!1};f._add=function(d){var c=this.that,f=d.rowIndx,l=d.rowIndxPage,a=d.rowData,b=c.rowIndxOffset,e,f=null==f?l+b:f,l=null==l?f-b:l,a=null==a?c.getRowData(d):a,b=d.colIndx,g=d.dataIndx,b=null==b?c.getColIndx({dataIndx:g}):b,h=c.colModel[b],g=null==g?h.dataIndx:g,m=d.evt,p=this.isSelected({rowData:a,
  dataIndx:g});if(null==p)return!1;var E=this.inViewCell(l,b);if(!1===p){if(E){var G=c.getCell({rowIndxPage:l,colIndx:b});G&&G.addClass("pq-cell-select ui-state-highlight")}this._addToData({rowData:a,dataIndx:g});!1!==d.trigger&&c._trigger("cellSelect",m,{rowIndx:f,rowIndxPage:l,colIndx:b,dataIndx:g,column:h,rowData:a});e=!0}this.lastSelection={rowIndx:f,dataIndx:g,rowData:a};!1!==d.focus&&E&&(G&&G.length||(G=c.getCell({rowIndxPage:l,dataIndx:g})),G&&G.length&&(G.attr("tabindex","0"),G.focus(),c._fixTableViewPort(),
  this.focusSelection={rowData:a,rowIndx:f,dataIndx:g}));d.setFirst&&(this.firstSelection={rowIndx:f,rowData:a,dataIndx:g});if(e)return{rowIndx:f,rowData:a,dataIndx:g,colIndx:b,column:h}};c._add=function(d){var c=this.that,f,l=d.rowIndx,a=d.rowIndxPage,b=c.rowIndxOffset,l=null==l?a+b:l,a=null==a?l-b:a,e=null==e?c.getRowData(d):e,b=d.$tr,g=d.evt,m=this.isSelected({rowData:e});d.rowIndxPage=a;if(null==m)return!1;var p=this.inViewRow(a);!1===m&&(p&&(b=this._boundRow(d)),e.pq_rowselect=!0,!1!==d.trigger&&
  c._trigger("rowSelect",g,{rowIndx:l,rowIndxPage:a,rowData:e,$tr:b}),f=!0);this.lastSelection={rowIndx:l,rowData:e};!1!==d.focus&&p&&(b&&b.length||(b=c.getRow({rowIndxPage:a})),b&&(b=h(b[0]),b.attr("tabindex","0"),b.focus(),c._fixTableViewPort(),this.focusSelection={rowData:e,rowIndx:l}));d.setFirst&&(this.firstSelection={rowIndx:l,rowData:e});if(f)return{rowIndx:l,rowData:e}};f.add=function(d){var c=this.that,f=d.evt,l=d.cells,a=[];if(l&&"function"==typeof l.push){d=0;for(var b=l.length;d<b;d++){var e=
  l[d];e.trigger=!1;(e=this._add(e))&&a.push(e)}a.length&&c._trigger("cellSelect",f,{cells:a})}else this._add(d);c._fixIE()};c.add=function(d){var c=this.that,f=d.evt,l=d.rows,a=[];if(l&&"function"==typeof l.push){d=0;for(var b=l.length;d<b;d++){var e=l[d];e.trigger=!1;(e=this._add(e))&&a.push(e)}a.length&&c._trigger("rowSelect",f,{rows:a})}else this._add(d)};f._remove=function(d){var c=this.that,f=d.rowIndx,l=d.rowIndxPage,a=c.rowIndxOffset,f=null==f?l+a:f,l=null==l?f-a:l,a=d.rowData,a=null==a?c.getRowData(d):
  a,b=d.colIndx,e=d.dataIndx,b=null==b?c.getColIndx({dataIndx:e}):b,g=c.colModel[b],e=null==e?g.dataIndx:e,h=d.evt;if(this.isSelected({rowData:a,dataIndx:e}))return this.inViewCell(l,b)&&(l=c.getCell({rowIndxPage:l,colIndx:b,all:!0}))&&(l.removeClass("pq-cell-select ui-state-highlight"),l.removeAttr("tabindex")),this._removeFromData({rowData:a,dataIndx:e}),!1!==d.trigger&&c._trigger("cellUnSelect",h,{rowIndx:f,colIndx:b,dataIndx:e,rowData:a}),{rowIndx:f,rowData:a,dataIndx:e,colIndx:b,column:g}};c._remove=
  function(d){var c=this.that,f=d.rowIndx,l=d.rowIndxPage,a=c.rowIndxOffset,f=null==f?l+a:f,l=null==l?f-a:l,a=d.rowData,a=null==a?c.getRowData(d):a,b=d.$tr,e=d.evt;if(this.isSelected({rowData:a}))return this.inViewRow(l)&&(b=c.getRow({rowIndxPage:l}))&&(b.removeClass("pq-row-select ui-state-highlight"),b.removeAttr("tabindex")),a.pq_rowselect=!1,!1!==d.trigger&&c._trigger("rowUnSelect",e,{rowIndx:f,rowData:a,$tr:b}),{rowIndx:f,rowData:a}};f.remove=function(d){var c=d.cells;if(c&&"function"==typeof c.push){for(var f=
  [],l=0,a=c.length;l<a;l++){var b=c[l];b.trigger=!1;(b=this._remove(b))&&f.push(b)}f.length&&this.that._trigger("cellUnSelect",d.evt,{cells:f})}else this._remove(d)};c.remove=function(d){var c=d.rows;if(c&&"function"==typeof c.push){for(var f=[],l=0,a=c.length;l<a;l++){var b=c[l];b.trigger=!1;(b=this._remove(b))&&f.push(b)}f.length&&this.that._trigger("rowUnSelect",d.evt,{rows:f})}else this._remove(d)};f.indexOf=function(d){this.refresh();var c=d.rowIndx,f=this.that,f=null==d.dataIndx?f.colModel[d.colIndx].dataIndx:
  d.dataIndx;d.dataIndx=f;d=this.selection;for(var l=0;l<d.length;l++){var a=d[l];if(a.rowIndx==c&&a.dataIndx==f)return l}return-1};f.selectAll=function(d){var c=this.that,f=d&&d.all?!0:!1;d=f?this.options.dataModel.data:c.data;var l=c.rowIndxOffset,a=c.colModel,b=a.length,e=[],c=function(d,c){for(var f=0;f<b;f++){var g=a[f];g.hidden||e.push({rowIndx:c,rowData:d,colIndx:f,dataIndx:g.dataIndx,focus:!1})}};if(d){for(var g=0,h=d.length;g<h;g++)var m=d[g];if(f)for(f="remote"==this.options.pageModel.type?
  !0:!1,g=0,h=d.length;g<h;g++){var m=d[g],p=g;f&&(p=g+l);c(m,p)}else for(g=0,h=d.length;g<h;g++)m=d[g],p=g+l,c(m,p);this.add({cells:e})}};c.selectAll=function(d){var c=this.that,f=d&&d.all?!0:!1,c=f?this.options.dataModel.data:c.data;d=[];if(c){if(f)for(var f="remote"==this.options.pageModel.type?!0:!1,l=0,a=c.length;l<a;l++){var b={rowData:c[l],focus:!1};f?b.rowIndxPage=l:b.rowIndx=l;d.push(b)}else for(l=0,a=c.length;l<a;l++)d.push({rowIndxPage:l,rowData:c[l],focus:!1});this.add({rows:d})}};f.selectRange=
  function(d){var c=this.that,f=d.initRowIndx,l=d.initColIndx,a=d.finalRowIndx;d=d.finalColIndx;for(var b=this.getSelection().slice(0),e=0;e<b.length;e++){var g=b[e],h=g.rowIndx,m=g.dataIndx,g=c.getColIndx({dataIndx:m});h<f||h>a?this.remove({rowIndx:h,colIndx:g,dataIndx:m}):h==f&&g<l?this.remove({rowIndx:h,colIndx:g,dataIndx:m}):h==a&&g>d&&this.remove({rowIndx:h,colIndx:g,dataIndx:m})}for(g=0;g<c.colModel.length;g++)if(b=c.colModel[g],!b.hidden){m=b.dataIndx;h=f;do{if(!(h==f&&g<l))if(h==a&&g>d)break;
  else this.add({rowIndx:h,colIndx:g,dataIndx:m,focus:!1});h++}while(h<=a)}};f.selectBlock=function(d){var c=this.that,f=d.initRowIndx,h=d.initColIndx,a=d.finalRowIndx;d=d.finalColIndx;for(var b=this.getSelection().slice(0),e=0;e<b.length;e++){var g=b[e],m=g.rowIndx,g=g.dataIndx,p=c.getColIndx({dataIndx:g});p<h||p>d?this.remove({rowIndx:m,dataIndx:g,colIndx:p}):(m<f||m>a)&&this.remove({rowIndx:m,dataIndx:g,colIndx:p})}b=[];c=c.colModel;for(p=h;p<=d;p++)if(h=c[p],g=h.dataIndx,!h.hidden){m=f;do b.push({rowIndx:m,
  colIndx:p,dataIndx:g,focus:!1}),m++;while(m<=a);this.add({cells:b})}}})(jQuery);
  (function(h){var c=(h.paramquery.cCheckBoxColumn=function(c,h){var m=this;this.that=c;this.options=c.options;this.type="checkBoxSelection";this.cbDataIndx=h;var d=c.widgetEventPrefix.toLowerCase(),k=c.element,q=c.eventNamespace;k.on(d+"dataavailable"+q,function(c,a){if(m.belongs(c))return m._onDataAvailable(c,a)});k.on(d+"cellclick"+q,function(c,a){if(m.belongs(c))return m.cellClick(c,a)});k.on(d+"rowselect"+q,function(c,a){if(m.belongs(c))return m.rowSelect(c,a)});k.on(d+"rowunselect"+q,function(c,
  a){if(m.belongs(c))return m.rowUnSelect(c,a)});k.on(d+"cellkeydown"+q,function(c,a){if(m.belongs(c))return m.cellKeyDown(c,a)});k.on(d+"refreshheader"+q,function(c,a){if(m.belongs(c))return m.refreshHeader(c,a)})}).prototype=new h.paramquery.cClass;c.hasHeaderChkBox=function(){return!1===this.options.selectionModel.cbHeader?!1:!0};c.setValCBox=function(){if(this.hasHeaderChkBox()){for(var c=this.that,h=this.options,c=h.selectionModel.cbAll?h.dataModel.data:c.data,h=null,m=0,d=0,k=0,q=c.length;k<q;k++)c[k].pq_rowselect?
  m++:d++;m==q?h=!0:d==q&&(h=!1);this.$inp.pqval({val:h})}};c.refreshHeader=function(c,p){if(this.hasHeaderChkBox()){var m=this.that;if(m.data){var d=this,m=m.getCellHeader({dataIndx:this.cbDataIndx});m.html("<input type='checkbox'/>");this.$inp=m.find("input").click(function(c){h(this).is(":checked")?d.selectAllRows():d.unSelectAllRows();c.stopPropagation()});this.setValCBox()}}};c.selectAllRows=function(){this.that.iRows.selectAll({all:this.options.selectionModel.cbAll})};c.unSelectAllRows=function(){var c=
  this.that;this.options.selectionModel.cbAll?c.iRows.removeAll():c.iRows.removeAll({page:!0})};c._onDataAvailable=function(){var c=this.options.dataModel.data,h=this._findSelectionIndx();if(null!=h&&c)for(var m=0,d=c.length;m<d;m++){var k=c[m];k[h]&&(k.pq_rowselect=!0)}};c._findSelectionIndx=function(){if(this.cbDataIndx)return this.cbDataIndx};c.cellClick=function(c,h){var m=this.that,d=h.rowIndx,k=h.rowData,q=h.column,l=this.type;if(q&&q.type===l)return k[q.dataIndx]?m.iRows.remove({rowIndx:d}):
  m.iRows.add({rowIndx:d}),c.stopPropagation(),!1};c.rowSelect=function(c,h){var m=this.that,d=h.rows,k=h.rowData,q=this._findSelectionIndx();if(d)for(var l=0,a=d.length;l<a;l++){var k=d[l],b=k.rowIndx,k=k.rowData;k[q]=!0;m.refreshCell({rowIndx:b,dataIndx:q})}else k&&(k[q]=!0,b=h.rowIndx,m.refreshCell({rowIndx:b,dataIndx:q}));this.setValCBox()};c.rowUnSelect=function(c,h){var m=this.that,d=h.rows,k=h.rowData,q=this._findSelectionIndx();if(d)for(var l=0,a=d.length;l<a;l++){var k=d[l],b=k.rowIndx,k=k.rowData;
  k[q]=!1;m.refreshCell({rowIndx:b,dataIndx:q})}else k&&(k[q]=!1,b=h.rowIndx,m.refreshCell({rowIndx:b,dataIndx:q}));this.setValCBox()};c.cellKeyDown=function(c,h){var m=this.that,d=h.rowIndx,d=h.column,k,q=this.type;if(d&&d.type===q&&(q=d.dataIndx,d=h.rowIndx,13==c.keyCode||32==c.keyCode))return k[q]?m.selection({type:"row",method:"remove",rowIndx:d}):m.selection({type:"row",method:"add",rowIndx:d}),c.stopPropagation(),c.preventDefault(),!1}})(jQuery);
  (function(h){function c(c){this.that=c;var h=this,m=c.element,d=c.widgetEventPrefix.toLowerCase();c=c.eventNamespace;m.on(d+"contmousedown"+c,function(c,d){if(h.belongs(c))return h._onContMouseDown(c,d)});m.on(d+"mousedrag"+c,function(c,d){if(h.belongs(c)&&h.swipedown)return h._onMouseDrag(c,d)});m.on(d+"mousestop"+c,function(c,d){return h._onMouseStop(c,d)});m.on(d+"rowmousedown"+c,function(c,d){if(h.belongs(c))return h._onRowMouseDown(c,d)});m.on(d+"cellmousedown"+c,function(c,d){if(h.belongs(c))return h._onCellMouseDown(c,
  d)});m.on(d+"beforetableview"+c,function(c,d){if(h.belongs(c))return h._beforeTableView(c,d)});m.on(d+"refresh"+c,function(c,d){if(h.belongs(c))return h._onRefresh(c,d)})}h.paramquery.cMouseSelection=c;h=c.prototype=new h.paramquery.cClass;h._beforeTableView=function(c,h){var m=this.that,d=m.getFocusElement();this.lastFocus=null;d&&d.$grid&&(d=d.$ae,d.hasClass("pq-grid-row")?this.lastFocus=m=m.getRowIndx({$tr:d}):d.hasClass("pq-grid-cell")&&(this.lastFocus=m=m.getCellIndices({$td:d})))};h._onRefresh=
  function(c,h){var m=this.that,d=this.lastFocus;d&&(d=null!=d.dataIndx?m.getCell(d):m.getRow(d))&&d.length&&m.inViewPort(d)&&d.attr("tabindex","0").focus()};h._onCellMouseDown=function(c,h){var m=this.that,d=h.rowIndx,k=h.colIndx,q=m.options.selectionModel,l=q.mode;if("cell"==q.type&&null!=k)return c.shiftKey?(m.iCells.extendSelection({rowIndx:d,colIndx:k,mode:l,evt:c}),c.preventDefault()):c.ctrlKey&&"single"!=l?m.iCells.isSelected({rowIndx:d,colIndx:k})?m.iCells.remove({rowIndx:d,colIndx:k}):m.setSelection({rowIndx:d,
  colIndx:k}):(this.mousedown={rowIndx:d,colIndx:k},m.setSelection(null),m.setSelection({rowIndx:d,colIndx:k,setFirst:!0})),!0};h._onRowMouseDown=function(c,h){var m=this.that,d=h.rowIndx,k=m.options.selectionModel,q=k.mode;if("row"==k.type&&null!=d)return c.shiftKey?(m.iRows.extendSelection({rowIndx:d,evt:c}),c.preventDefault()):c.ctrlKey&&"single"!=q?m.iRows.isSelected({rowIndx:d})?m.iRows.remove({rowIndx:d}):m.setSelection({rowIndx:d}):(this.mousedown={r1:d,y1:c.pageY,x1:c.pageX},m.setSelection(null),
  m.setSelection({rowIndx:d,setFirst:!0})),!0};h._onContMouseDown=function(c,h){this.that.options.swipeModel.on&&(this._stopSwipe(!0),this.swipedown={x:c.pageX,y:c.pageY});return!0};h._stopSwipe=function(c){c&&(this.swipedownPrev=this.swipedown=null);window.clearInterval(this.intID);this.intID=null};h._onMouseStop=function(c,h){var m=this,d=this.that;if(this.swipedownPrev){var k=d.options.swipeModel,d=this.swipedownPrev,q=d.ts,l=(new Date).getTime()-q,a=c.pageX,b=c.pageY,e=a-d.x,g=b-d.y;if(Math.sqrt(e*
  e+g*g)/l>k.ratio){var n=0,r=k.repeat;m._stopSwipe();m.intID=window.setInterval(function(){n+=k.speed;r--;0>=r&&m._stopSwipe(!0);m._onMouseDrag({pageX:a+n*e/l,pageY:b+n*g/l})},50)}else m.swipedown=null,m.swipedownPrev=null}};h._onMouseDrag=function(c,h){var m=this.that,d=m.options;if(this.swipedown){var k=this.swipedown,q=k.x,l=k.y,a=c.pageX,b=c.pageY;this.swipedownPrev={x:q,y:l,ts:(new Date).getTime()};m.$td_edit&&m.quitEditMode({silent:!0});d.virtualY||(this._scrollVertSmooth(l,b),m._syncScrollBarVert());
  d.virtualX||(this._scrollHorSmooth(q,a),m._syncScrollBarHor());k.x=a;k.y=b}return!0};h.updateTableY=function(c){if(0==c)return!1;var h=this.that,m=h.getTableForVertScroll(),d=h.$cont,h=h._getScollBarHorizontalHeight(),d=d.data("offsetHeight")-h;if(!m||!m.length)return!1;var h=m.data("offsetHeight"),k=parseInt(m.css("marginTop"))+c;0<=k?m.css({marginTop:-1}):0>c&&0<d-h-k?0<d-m[0].offsetHeight-k?(c=d-m[0].offsetHeight,0>c&&m.css({marginTop:c})):m.css({marginTop:k}):m.css({marginTop:k});return!0};h._scrollVertSmooth=
  function(c,h){c!=h&&this.updateTableY(h-c)};h._scrollHorSmooth=function(c,h){if(c!=h){var m=this.that,d=h-c,k=m.getTableForHorScroll(),q=m.getTableHeaderForHorScroll(),l=m.$cont,m=m._getSBWidth(),l=l.data("offsetWidth")-m;if(k||q){var a=k?k:q,m=a.data("scrollWidth"),d=parseInt(a.css("marginLeft"))+d;0<d?(k&&k.css({marginLeft:0}),q&&q.css({marginLeft:0})):0<l-m-d?0>=l-m&&(k&&k.css("marginLeft",l-m),q&&q.css("marginLeft",l-m)):(k&&k.css("marginLeft",d),q&&q.css("marginLeft",d))}}}})(jQuery);
  (function(h){var c=function(c,d){this.that=c;this.$ae=d},f=c.prototype;f.createClipBoard=function(){var c=this.$ae,d=h("textarea#pq-grid-excel");0==d.length&&(d=h("<textarea id='pq-grid-excel' />").appendTo(document.body));c=c.offset();d.css({position:"absolute",left:c.left,top:c.top,display:"",height:1,width:1,borderWidth:0});d.focus()};f.destroyClipBoard=function(){var c=h("textarea#pq-grid-excel");c.length&&(document.activeElement==c[0]&&this.$ae.focus(),c.css("display","none"))};f.clearClipBoard=
  function(){h("textarea#pq-grid-excel").val("")};f.copy=function(){for(var c=h("textarea#pq-grid-excel"),d=this.that,f=d.colModel,q=f.length,l=[],a=[],l=d.iRows.getSelection(),b=0,e=l.length;b<e;b++){for(var g=l[b],g=d.getRowData(g),n=[],p=0;p<q;p++){var t=f[p];t.hidden||n.push(g[t.dataIndx])}g=n.join("\t");a.push(g)}for(var l=d.iCells.getSelection(),E=null,p=null,n=[],b=0,e=l.length;b<e;b++)if(g=l[b],E=g.rowIndx,E!=p){g=d.getRowData(g);for(p=0;p<q;p++)t=f[p],t.hidden||(t=t.dataIndx,d.iCells.isSelected({rowData:g,
  dataIndx:t})&&n.push(g[t]));g=n.join("\t");n=[];a.push(g);p=E}c.val(a.join("\n"));c.select()};var p=null;h(window).unbind(".pqExcel").bind("keydown.pqExcel",function(f){if(f.ctrlKey){var d=h(document.activeElement);if(d.hasClass("pq-grid-row")||d.hasClass("pq-grid-cell")||d.is("textarea#pq-grid-excel")){var k=d.closest(".pq-grid");if(p||d.length&&k.length){if(!p){try{var q=k.pqGrid("getThis").that}catch(l){return!0}p=new c(q,d);p.createClipBoard()}"67"==f.keyCode||"99"==f.keyCode?p.copy():(d=h("textarea#pq-grid-excel"),
  d.length&&document.activeElement==d[0]&&p.that._onKeyPressDown(f))}}}}).bind("keyup.pqExcel",function(c){p&&!c.ctrlKey&&17==c.keyCode&&(p.destroyClipBoard(),p=null)})})(jQuery);
  (function(h){var c=h.ui.autocomplete.prototype,f=c._renderMenu,p=c._renderItem;c._renderMenu=function(c,d){f.call(this,c,d);var k=this.options.selectItem;if(k&&k.on){var k=k.cls,k=void 0===k?"ui-state-highlight":k,p=this.element.val();p&&k&&h("a",c).filter(function(){return h(this).text()===p}).addClass(k)}};c._renderItem=function(c,d){var f=p.call(this,c,d),h=this.options.highlightText;if(h&&h.on){var l=this.element.val();if(l){var l=new RegExp("("+l+")","i"),a=d.label;if(l.test(a)){var b=h.style,
  h=h.cls,a=a.replace(l,"<span style='"+(void 0===b?"font-weight:bold;":b)+"' class='"+(void 0===h?"":h)+"'>$1</span>");f.find("a").html(a)}}}return f}})(jQuery);
  