(function(c){function g(){var d=!1,c=!1;this.stopPropagation=function(){d=!0};this.isPropagationStopped=function(){return d};this.stopImmediatePropagation=function(){c=!0};this.isImmediatePropagationStopped=function(){return c}}function e(){this.__nonDataRow=!0}function i(){this.__group=!0;this.__updated=!1;this.count=0;this.title=this.value=null;this.collapsed=!1;this.totals=null}function j(){this.__groupTotals=!0;this.group=null}function h(){var d=null;this.isActive=function(c){return c?d===c:null!==
d};this.activate=function(c){if(c!==d){if(null!==d)throw"SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController";if(!c.commitCurrentEdit)throw"SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()";if(!c.cancelCurrentEdit)throw"SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()";d=c}};this.deactivate=function(c){if(d!==c)throw"SlickGrid.EditorLock.deactivate: specified editController is not the currently active one";
d=null};this.commitCurrentEdit=function(){return d?d.commitCurrentEdit():!0};this.cancelCurrentEdit=function(){return d?d.cancelCurrentEdit():!0}}c.extend(!0,window,{Slick:{Event:function(){var d=[];this.subscribe=function(c){d.push(c)};this.unsubscribe=function(c){for(var h=d.length-1;0<=h;h--)d[h]===c&&d.splice(h,1)};this.notify=function(c,h,e){for(var h=h||new g,e=e||this,j,i=0;i<d.length&&!h.isPropagationStopped()&&!h.isImmediatePropagationStopped();i++)j=d[i].call(e,h,c);return j}},EventData:g,
EventHandler:function(){var d=[];this.subscribe=function(c,h){d.push({event:c,handler:h});c.subscribe(h)};this.unsubscribe=function(c,h){for(var e=d.length;e--;)if(d[e].event===c&&d[e].handler===h){d.splice(e,1);c.unsubscribe(h);break}};this.unsubscribeAll=function(){for(var c=d.length;c--;)d[c].event.unsubscribe(d[c].handler);d=[]}},Range:function(d,c,h,e){void 0===h&&void 0===e&&(h=d,e=c);this.fromRow=Math.min(d,h);this.fromCell=Math.min(c,e);this.toRow=Math.max(d,h);this.toCell=Math.max(c,e);this.isSingleRow=
function(){return this.fromRow==this.toRow};this.isSingleCell=function(){return this.fromRow==this.toRow&&this.fromCell==this.toCell};this.contains=function(d,c){return d>=this.fromRow&&d<=this.toRow&&c>=this.fromCell&&c<=this.toCell};this.toString=function(){return this.isSingleCell()?"("+this.fromRow+":"+this.fromCell+")":"("+this.fromRow+":"+this.fromCell+" - "+this.toRow+":"+this.toCell+")"}},NonDataRow:e,Group:i,GroupTotals:j,EditorLock:h,GlobalEditorLock:new h}});i.prototype=new e;i.prototype.equals=
function(d){return this.value===d.value&&this.count===d.count&&this.collapsed===d.collapsed};j.prototype=new e})(jQuery);/*

 (c) 2009-2012 Michael Leibman
 michael{dot}leibman{at}gmail{dot}com
 http://github.com/mleibman/slickgrid

 Distributed under MIT license.
 All rights reserved.

 SlickGrid v2.0

 NOTES:
     Cell/row DOM manipulations are done directly bypassing jQuery's DOM manipulation methods.
     This increases the speed dramatically, but can only be done safely because there are no event handlers
     or data associated with any cell/row DOM nodes.  Cell editors must make sure they implement .destroy()
     and do proper cleanup.
*/
if("undefined"===typeof jQuery)throw"SlickGrid requires jquery module to be loaded";if(!jQuery.fn.drag)throw"SlickGrid requires jquery.event.drag module to be loaded";if("undefined"===typeof Slick)throw"slick.core.js not loaded";
(function(c){c.extend(!0,window,{Slick:{Grid:function(i,j,h,d){function ib(){if(!I){I=!0;V=parseFloat(c.css(r[0],"width",!0));var a,b=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];a=c("<div class='ui-state-default slick-header-column' style='visibility:hidden'>-</div>").appendTo(s);W=Ka=0;c.each(b,function(b,f){W+=parseFloat(a.css(f))||0});c.each(f,function(b,f){Ka+=parseFloat(a.css(f))||0});a.remove();var p=
c("<div class='slick-row' />").appendTo(C);a=c("<div class='slick-cell' id='' style='visibility:hidden'>-</div>").appendTo(p);ta=ua=0;c.each(b,function(b,f){ta+=parseFloat(a.css(f))||0});c.each(f,function(b,f){ua+=parseFloat(a.css(f))||0});p.remove();P=Math.max(W,ta);s&&s.jquery&&s.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1});d.enableTextSelectionOnCells||t.bind("selectstart.ui",function(a){return c(a.target).is("input,textarea")});kb();s.click(function(a){a.metaKey=
a.metaKey||a.ctrlKey;if(!c(a.target).hasClass("slick-resizable-handle")){var b=c(a.target).closest(".slick-header-column");if(b.length&&(b=h[La(b.data("fieldId"))],b.sortable&&u().commitCurrentEdit())){for(var f=null,p=0;p<y.length;p++)if(y[p].columnId==b.id){f=y[p];f.sortAsc=!f.sortAsc;break}if(a.metaKey&&d.multiColumnSort)f&&y.splice(p,1);else{if(!a.shiftKey&&!a.metaKey||!d.multiColumnSort)y=[];f?0==y.length&&y.push(f):(f={columnId:b.id,sortAsc:!0},y.push(f))}va(y);d.multiColumnSort?m(l.onSort,
{multiColumnSort:!0,sortCols:c.map(y,function(a){return{sortCol:h[J[a.columnId]],sortAsc:a.sortAsc}})},a):m(l.onSort,{multiColumnSort:!1,sortCol:b,sortAsc:f.sortAsc},a)}}});mb();L();for(b=C[0];(b=b.parentNode)!=document.body&&null!=b;)(b==t[0]||b.scrollWidth!=b.clientWidth||b.scrollHeight!=b.clientHeight)&&c(b).bind("scroll.slickgrid",nb);r.bind("resize.slickgrid",L);t.bind("scroll.slickgrid",ob);ca.bind("contextmenu.slickgrid",Wb).bind("click.slickgrid",Xb);Ma.bind("keydown.slickgrid",pb);C.bind("keydown.slickgrid",
pb).bind("click.slickgrid",Yb).bind("dblclick.slickgrid",Zb).bind("contextmenu.slickgrid",$b).bind("draginit",ac).bind("dragstart",bc).bind("drag",cc).bind("dragend",dc).delegate(".slick-cell","mouseenter",ec).delegate(".slick-cell","mouseleave",fc)}}function jb(a){for(var b=Q.length;0<=b;b--)if(Q[b]===a){Q[b].destroy&&Q[b].destroy();Q.splice(b,1);break}}function Ja(a){for(var b=R,f=na?V-g.width:V,p=0,c=h.length;c--;)p+=h[c].width||Na.width;R=d.fullWidthRows?Math.max(p,f):p;R!=b&&(C.width(R),da.width(R),
qb=R>V-g.width);(R!=b||a)&&Oa()}function kb(){function a(){c(this).addClass("ui-state-hover")}function b(){c(this).removeClass("ui-state-hover")}s.empty();da.empty();J={};for(var f=0;f<h.length;f++){var p=h[f]=c.extend({},Na,h[f]);J[p.id]=f;var e=c("<div class='ui-state-default slick-header-column' id='"+F+p.id+"' />").html("<span class='slick-column-name'>"+p.name+"</span>").width(p.width-W).attr("title",p.toolTip||p.name||"").data("fieldId",p.id).addClass(p.headerCssClass||"").appendTo(s);(d.enableColumnReorder||
p.sortable)&&e.hover(a,b);p.sortable&&e.append("<span class='slick-sort-indicator' />");d.showHeaderRow&&c("<div class='ui-state-default slick-headerrow-column l"+f+" r"+f+"'></div>").appendTo(da)}d.showHeaderRow&&c("<div style='display:block;height:1px;width:10000px;position:absolute;top:0;left:0;'></div>").appendTo(S);va(y);lb();d.enableColumnReorder&&s.sortable({containment:"parent",axis:"x",cursor:"default",tolerance:"intersection",helper:"clone",placeholder:"slick-sortable-placeholder ui-state-default slick-header-column",
forcePlaceholderSize:!0,start:function(a,b){c(b.helper).addClass("slick-header-column-active")},beforeStop:function(a,b){c(b.helper).removeClass("slick-header-column-active")},stop:function(a){if(u().commitCurrentEdit()){for(var b=s.sortable("toArray"),f=[],d=0;d<b.length;d++)f.push(h[La(b[d].replace(F,""))]);rb(f);m(l.onColumnsReordered,{});a.stopPropagation();lb()}else c(this).sortable("cancel")}})}function lb(){var a,b,f,p,e,j,i,g;p=s.children();p.find(".slick-resizable-handle").remove();p.each(function(a){h[a].resizable&&
(void 0===i&&(i=a),g=a)});void 0!==i&&p.each(function(k,n){k<i||d.forceFitColumns&&k>=g||(c(n),c("<div class='slick-resizable-handle' />").appendTo(n).bind("dragstart",function(i){if(!u().commitCurrentEdit())return!1;f=i.pageX;c(this).parent().addClass("slick-header-column-active");var g=i=null;p.each(function(a,b){h[a].previousWidth=c(b).outerWidth()});if(d.forceFitColumns){g=i=0;for(a=k+1;a<p.length;a++)b=h[a],b.resizable&&(null!==g&&(g=b.maxWidth?g+(b.maxWidth-b.previousWidth):null),i+=b.previousWidth-
Math.max(b.minWidth||0,P))}var oa=0,l=0;for(a=0;a<=k;a++)b=h[a],b.resizable&&(null!==l&&(l=b.maxWidth?l+(b.maxWidth-b.previousWidth):null),oa+=b.previousWidth-Math.max(b.minWidth||0,P));null===i&&(i=1E5);null===oa&&(oa=1E5);null===g&&(g=1E5);null===l&&(l=1E5);j=f+Math.min(i,l);e=f-Math.min(oa,g)}).bind("drag",function(c){var i=Math.min(j,Math.max(e,c.pageX))-f,g;if(0>i){g=i;for(a=k;0<=a;a--)b=h[a],b.resizable&&(c=Math.max(b.minWidth||0,P),g&&b.previousWidth+g<c?(g+=b.previousWidth-c,b.width=c):(b.width=
b.previousWidth+g,g=0));if(d.forceFitColumns){g=-i;for(a=k+1;a<p.length;a++)b=h[a],b.resizable&&(g&&b.maxWidth&&b.maxWidth-b.previousWidth<g?(g-=b.maxWidth-b.previousWidth,b.width=b.maxWidth):(b.width=b.previousWidth+g,g=0))}}else{g=i;for(a=k;0<=a;a--)b=h[a],b.resizable&&(g&&b.maxWidth&&b.maxWidth-b.previousWidth<g?(g-=b.maxWidth-b.previousWidth,b.width=b.maxWidth):(b.width=b.previousWidth+g,g=0));if(d.forceFitColumns){g=-i;for(a=k+1;a<p.length;a++)b=h[a],b.resizable&&(c=Math.max(b.minWidth||0,P),
g&&b.previousWidth+g<c?(g+=b.previousWidth-c,b.width=c):(b.width=b.previousWidth+g,g=0))}}sb();d.syncColumnCellResize&&Oa()}).bind("dragend",function(){var f;c(this).parent().removeClass("slick-header-column-active");for(a=0;a<p.length;a++)b=h[a],f=c(p[a]).outerWidth(),b.previousWidth!==f&&b.rerenderOnResize&&X();Ja(!0);K();m(l.onColumnsResized,{})}))})}function Pa(a){var b=0;c.each(["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],function(f,d){b+=parseFloat(a.css(d))||0});return b}
function mb(){Y=c("<style type='text/css' rel='stylesheet' />").appendTo(c("head"));for(var a=["."+F+" .slick-header-column { left: 1000px; }","."+F+" .slick-top-panel { height:"+d.topPanelHeight+"px; }","."+F+" .slick-headerrow-columns { height:"+d.headerRowHeight+"px; }","."+F+" .slick-cell { height:"+(d.rowHeight-ua)+"px; }","."+F+" .slick-row { height:"+d.rowHeight+"px; }"],b=0;b<h.length;b++)a.push("."+F+" .l"+b+" { }"),a.push("."+F+" .r"+b+" { }");Y[0].styleSheet?Y[0].styleSheet.cssText=a.join(" "):
Y[0].appendChild(document.createTextNode(a.join(" ")))}function m(a,b,f){f=f||new Slick.EventData;b=b||{};b.grid=l;return a.notify(b,f,l)}function u(){return d.editorLock}function La(a){return J[a]}function Qa(){var a,b,f=[],d=0,c=0,e,j=na?V-g.width:V;for(a=0;a<h.length;a++)b=h[a],f.push(b.width),c+=b.width,b.resizable&&(d+=b.width-Math.max(b.minWidth,P));for(e=c;c>j&&d;){var i=(c-j)/d;for(a=0;a<h.length&&c>j;a++){b=h[a];var k=f[a];if(b.resizable&&!(k<=b.minWidth||k<=P)){b=Math.max(b.minWidth,P);
var l=Math.floor(i*(k-b))||1,l=Math.min(l,k-b),c=c-l,d=d-l;f[a]-=l}}if(e==c)break;e=c}for(e=c;c<j;){d=j/c;for(a=0;a<h.length&&c<j;a++)b=h[a],b.resizable&&!(b.maxWidth<=b.width)&&(i=Math.min(Math.floor(d*b.width)-b.width,b.maxWidth-b.width||1E6)||1,c+=i,f[a]+=i);if(e==c)break;e=c}c=!1;for(a=0;a<h.length;a++)h[a].rerenderOnResize&&h[a].width!=f[a]&&(c=!0),h[a].width=f[a];sb();Ja(!0);c&&(X(),K())}function sb(){if(I)for(var a,b=0,f=s.children(),d=f.length;b<d;b++)a=c(f[b]),a.width()!==h[b].width-W&&a.width(h[b].width-
W)}function Oa(){for(var a,b,f=0,d,c=0;c<h.length;c++){d=h[c].width;b=c;if(!Z){var e=document.styleSheets;for(a=0;a<e.length;a++)if((e[a].ownerNode||e[a].owningElement)==Y[0]){Z=e[a];break}if(!Z)throw Error("Cannot find stylesheet.");Ra=[];Sa=[];var e=Z.cssRules||Z.rules,g=void 0,g=void 0;for(a=0;a<e.length;a++){var j=e[a].selectorText;if(g=/\.l\d+/.exec(j))g=parseInt(g[0].substr(2,g[0].length-2),10),Ra[g]=e[a];else if(g=/\.r\d+/.exec(j))g=parseInt(g[0].substr(2,g[0].length-2),10),Sa[g]=e[a]}}a=Ra[b];
b=Sa[b];a.style.left=f+"px";b.style.right=R-f-d+"px";f+=h[c].width}}function va(a){y=a;var b=s.children();b.removeClass("slick-header-column-sorted").find(".slick-sort-indicator").removeClass("slick-sort-indicator-asc slick-sort-indicator-desc");c.each(y,function(a,d){null==d.sortAsc&&(d.sortAsc=!0);var c=J[d.columnId];null!=c&&b.eq(c).addClass("slick-header-column-sorted").find(".slick-sort-indicator").addClass(d.sortAsc?"slick-sort-indicator-asc":"slick-sort-indicator-desc")})}function tb(a,b){Ta=
[];for(var f={},c=0;c<b.length;c++)for(var e=b[c].fromRow;e<=b[c].toRow;e++){f[e]||Ta.push(e);f[e]={};for(var g=b[c].fromCell;g<=b[c].toCell;g++)ub(e,g)&&(f[e][h[g].id]=d.selectedCellCssClass)}vb(d.selectedCellCssClass,f);m(l.onSelectedRowsChanged,{rows:wb()},a)}function rb(a){h=a;I&&(X(),kb(),Y.remove(),Z=null,mb(),L(),Oa(),ob())}function v(){return j.getLength?j.getLength():j.length}function D(a){return j.getItem?j.getItem(a):j[a]}function ea(a){var b=x;fa=Math.min(ga-1,Math.floor(a/ha));x=Math.round(fa*
wa);a-=x;if(x!=b){var f=xa(a);xb(f.top,f.bottom);for(var c in z)z[c].style.top=c*d.rowHeight-x+"px"}ia!=a&&($=ia+b<a+x?1:-1,t[0].scrollTop=Ua=A=ia=a,m(l.onViewportChanged,{}))}function ya(a,b){var f=j.getItemMetadata&&j.getItemMetadata(a),c=f&&f.columns&&(f.columns[b.id]||f.columns[J[b.id]]);return c&&c.formatter||f&&f.formatter||b.formatter||d.formatterFactory&&d.formatterFactory.getFormatter(b)||d.defaultFormatter}function yb(a,b){var f=h[b],c=j.getItemMetadata&&j.getItemMetadata(a);return(c=c&&
c.columns)&&c[f.id]&&void 0!==c[f.id].editor?c[f.id].editor:c&&c[b]&&void 0!==c[b].editor?c[b].editor:f.editor||d.editorFactory&&d.editorFactory.getEditor(f)}function za(a,b){return d.dataItemColumnValueExtractor?d.dataItemColumnValueExtractor(a,b):a[b.field]}function xb(a){for(var b in z)(b=parseInt(b,10))!==n&&(b<a.top||b>a.bottom)&&Aa(b)}function X(){k&&M();for(var a in z)Aa(a)}function Aa(a){var b=z[a];b&&(C[0].removeChild(b),delete z[a],delete Ba[a],Va--,zb++)}function Ab(a){var b,f;if(a&&a.length){b=
$=0;for(f=a.length;b<f;b++)k&&n===a[b]&&M(),z[a[b]]&&Aa(a[b])}}function Bb(a){Ab([a])}function Wa(a){if(z[a]){var b=0;c(z[a]).children().each(function(f){var c=h[b],d=D(a);a===n&&f===w&&k?k.loadValue(D(n)):this.innerHTML=d?ya(a,c)(a,b,za(d,c),c,D(a)):"";b+=aa(a,f)});Xa(a)}}function L(){I&&(B=d.autoHeight?d.rowHeight*(v()+(d.enableAddRow?1:0)+(d.leaveSpaceForNewRows?Ca-1:0)):parseFloat(c.css(r[0],"height",!0))-parseFloat(c.css(ca[0],"height"))-Pa(ca)-(d.showTopPanel?d.topPanelHeight+Pa(ba):0)-(d.showHeaderRow?
d.headerRowHeight+Pa(S):0),Ca=Math.ceil(B/d.rowHeight),V=parseFloat(c.css(r[0],"width",!0)),t.height(B),d.forceFitColumns&&Qa(),Da(),K())}function Da(){if(I){Ya=v()+(d.enableAddRow?1:0)+(d.leaveSpaceForNewRows?Ca-1:0);var a=na;na=!d.autoHeight&&Ya*d.rowHeight>B;var b=d.enableAddRow?v():v()-1,f;for(f in z)f>=b&&Aa(f);b=N;O=Math.max(d.rowHeight*Ya,B-g.height);O<e?(N=ha=O,ga=1,wa=0):(N=e,ha=N/100,ga=Math.floor(O/ha),wa=(O-N)/(ga-1));N!==b&&(C.css("height",N),A=t[0].scrollTop);f=A+x<=O-B;0==O||0==A?fa=
x=0:f?ea(A+x):ea(O-B);N!=b&&d.autoHeight&&L();d.forceFitColumns&&a!=na&&Qa();Ja(!1)}}function xa(a){null==a&&(a=A);return{top:Math.floor((a+x)/d.rowHeight),bottom:Math.ceil((a+x+B)/d.rowHeight)}}function Cb(a){var a=xa(a),b=Math.round(B/d.rowHeight);-1==$?(a.top-=b,a.bottom+=3):1==$?(a.top-=3,a.bottom+=b):(a.top-=3,a.bottom+=3);a.top=Math.max(0,a.top);a.bottom=Math.min(d.enableAddRow?v():v()-1,a.bottom);return a}function Db(){d.enableAsyncPostRender&&(clearTimeout(Za),Za=setTimeout(Eb,d.asyncPostRenderDelay))}
function Xa(a){delete Ba[a];ja=Math.min(ja,a);pa=Math.max(pa,a);Db()}function K(){if(I){var a=xa(),b=Cb();xb(b);var f,c,e=C[0];c=[];var g=[],i=!1;for(f=b.top;f<=b.bottom;f++)if(!z[f]){Va++;g.push(f);var l=c,k=f,m=D(k),r=void 0,r="slick-row "+(k<v()&&!m?" loading":"")+(1==k%2?" odd":" even"),t=j.getItemMetadata&&j.getItemMetadata(k);t&&t.cssClasses&&(r+=" "+t.cssClasses);l.push("<div class='ui-widget-content "+r+"' row='"+k+"' style='top:"+(d.rowHeight*k-x)+"px'>");for(var u=t=void 0,s=0,B=h.length;s<
B;s++){u=h[s];t=aa(k,s);r="slick-cell l"+s+" r"+Math.min(h.length-1,s+t-1)+(u.cssClass?" "+u.cssClass:"");k===n&&s===w&&(r+=" active");for(var y in E)E[y][k]&&E[y][k][u.id]&&(r+=" "+E[y][k][u.id]);l.push("<div class='"+r+"'>");m&&l.push(ya(k,u)(k,s,za(m,u),u,m));l.push("</div>");t&&(s+=t-1)}l.push("</div>");q&&n===f&&(i=!0);Fb++}if(g.length){b=document.createElement("div");b.innerHTML=c.join("");f=0;for(c=b.childNodes.length;f<c;f++)z[g[f]]=e.appendChild(b.firstChild);i&&(q=G(n,w))}ja=a.top;pa=Math.min(d.enableAddRow?
v():v()-1,a.bottom);Db();Ua=A;Ea=null}}function ob(){A=t[0].scrollTop;var a=t[0].scrollLeft,b=Math.abs(A-ia);a!==Gb&&(Gb=a,ca[0].scrollLeft=a,ba[0].scrollLeft=a,S[0].scrollLeft=a);b&&($=ia<A?1:-1,ia=A,b<B?ea(A+x):(b=x,fa=Math.min(ga-1,Math.floor(A*((O-B)/(N-B))*(1/ha))),x=Math.round(fa*wa),b!=x&&X()),Ea&&clearTimeout(Ea),Math.abs(Ua-A)<B?K():Ea=setTimeout(K,50),m(l.onViewportChanged,{}));m(l.onScroll,{scrollLeft:a,scrollTop:A})}function Eb(){for(;ja<=pa;){var a=0<=$?ja++:pa--,b=z[a];if(b&&!(Ba[a]||
a>=v())){for(var f=D(a),b=b.childNodes,c=0,e=0,g=h.length;c<g;++c){var j=h[c];j.asyncPostRender&&j.asyncPostRender(b[e],ja,f,j);++e}Ba[a]=!0;Za=setTimeout(Eb,d.asyncPostRenderDelay);break}}}function $a(a,b){var f,d,e,h,g;for(g in z){h=b&&b[g];e=a&&a[g];if(h)for(d in h)if(!e||h[d]!=e[d])(f=G(g,J[d]))&&c(f).removeClass(h[d]);if(e)for(d in e)if(!h||h[d]!=e[d])(f=G(g,J[d]))&&c(f).addClass(e[d])}}function vb(a,b){var f=E[a];E[a]=b;$a(b,f);m(l.onCellCssStylesChanged,{key:a,hash:b})}function ac(a,b){var f=
qa(a);if(!f||!ab(f.row,f.cell))return!1;retval=m(l.onDragInit,b,a);return a.isImmediatePropagationStopped()?retval:!1}function bc(a,b){var f=qa(a);if(!f||!ab(f.row,f.cell))return!1;f=m(l.onDragStart,b,a);return a.isImmediatePropagationStopped()?f:!1}function cc(a,b){return m(l.onDrag,b,a)}function dc(a,b){m(l.onDragEnd,b,a)}function pb(a){m(l.onKeyDown,{row:n,cell:w},a);if(!a.isImmediatePropagationStopped())if(!a.shiftKey&&!a.altKey&&!a.ctrlKey)if(27==a.which){if(!u().isActive())return;Hb()}else if(37==
a.which)Ib();else if(39==a.which)Jb();else if(38==a.which)Kb();else if(40==a.which)Fa();else if(9==a.which)Lb();else if(13==a.which)d.editable&&(k?n===v()?Fa():Mb():u().commitCurrentEdit()&&Ga());else return;else if(9==a.which&&a.shiftKey&&!a.ctrlKey&&!a.altKey)Nb();else return;a.stopPropagation();a.preventDefault();try{a.originalEvent.keyCode=0}catch(b){}}function Yb(a){k||T();var b=qa(a);if(b&&!(null!==k&&n==b.row&&w==b.cell)&&(m(l.onClick,{row:b.row,cell:b.cell},a),!a.isImmediatePropagationStopped()&&
U(b.row,b.cell)&&(!u().isActive()||u().commitCurrentEdit())))ra(b.row,!1),ka(G(b.row,b.cell),b.row===v()||d.autoEdit)}function $b(a){var b=c(a.target).closest(".slick-cell",C);0!==b.length&&(q===b[0]&&null!==k||m(l.onContextMenu,{},a))}function Zb(a){var b=qa(a);b&&!(null!==k&&n==b.row&&w==b.cell)&&(m(l.onDblClick,{row:b.row,cell:b.cell},a),a.isImmediatePropagationStopped()||d.editable&&Ob(b.row,b.cell,!0))}function Wb(a){var b=c(a.target).closest(".slick-header-column",".slick-header-columns"),b=
b&&h[l.getColumnIndex(b.data("fieldId"))];m(l.onHeaderContextMenu,{column:b},a)}function Xb(a){var b=c(a.target).closest(".slick-header-column",".slick-header-columns");(b=b&&h[l.getColumnIndex(b.data("fieldId"))])&&m(l.onHeaderClick,{column:b},a)}function ec(a){m(l.onMouseEnter,{},a)}function fc(a){m(l.onMouseLeave,{},a)}function ab(a,b){return!(0>a||a>=v()||0>b||b>=h.length)}function bb(a){var b=/l\d+/.exec(a.className);if(!b)throw"getCellFromNode: cannot get cell - "+a.className;return parseInt(b[0].substr(1,
b[0].length-1),10)}function qa(a){a=c(a.target).closest(".slick-cell",C);return!a.length?null:{row:a.parent().attr("row")|0,cell:bb(a[0])}}function T(){Ma[0].focus()}function ka(a,b){null!==q&&(M(),c(q).removeClass("active"));var f=q!==a;q=a;null!=q?(n=parseInt(c(q).parent().attr("row")),w=cb=bb(q),c(q).addClass("active"),d.editable&&b&&Pb(n,w)?(clearTimeout(db),d.asyncEditorLoading?db=setTimeout(function(){Ga()},d.asyncEditorLoadDelay):Ga()):T()):n=w=null;if(f){if(q){var f=c(q).position().left,e=
f+c(q).outerWidth(),h=t.scrollLeft(),g=h+t.width();f<h?t.scrollLeft(f):e>g&&t.scrollLeft(Math.min(f,e-t[0].clientWidth))}m(l.onActiveCellChanged,Qb())}}function Pb(a,b){return a<v()&&!D(a)||h[b].cannotTriggerInsert&&a>=v()||!yb(a,b)?!1:!0}function M(){if(k){m(l.onBeforeCellEditorDestroy,{editor:k});k.destroy();k=null;if(q){var a=D(n);c(q).removeClass("editable invalid");if(a){var b=h[w],f=ya(n,b);q.innerHTML=f(n,w,za(a,b),b,D(n));Xa(n)}}c.browser.msie&&(document.selection&&document.selection.empty?
document.selection.empty():window.getSelection&&(a=window.getSelection())&&a.removeAllRanges&&a.removeAllRanges());u().deactivate(Ha)}}function Ga(a){if(q){if(!d.editable)throw"Grid : makeActiveCellEditable : should never get called when options.editable is false";clearTimeout(db);if(Pb(n,w)){var b=h[w],f=D(n);!1===m(l.onBeforeEditCell,{row:n,cell:w,item:f,column:b})?T():(u().activate(Ha),c(q).addClass("editable"),a||(q.innerHTML=""),k=new (a||yb(n,w))({grid:l,gridPosition:Ia(r[0]),position:Ia(q),
container:q,column:b,item:f||{},commitChanges:Mb,cancelChanges:Hb}),f&&k.loadValue(f),Rb=k.serializeValue(),k.position&&nb())}}}function Mb(){u().commitCurrentEdit()&&(T(),d.autoEdit&&Fa())}function Hb(){u().cancelCurrentEdit()&&T()}function Ia(a){var b={top:a.offsetTop,left:a.offsetLeft,bottom:0,right:0,width:c(a).outerWidth(),height:c(a).outerHeight(),visible:!0};b.bottom=b.top+b.height;b.right=b.left+b.width;for(var f=a.offsetParent;(a=a.parentNode)!=document.body;)b.visible&&(a.scrollHeight!=
a.offsetHeight&&"visible"!=c(a).css("overflowY"))&&(b.visible=b.bottom>a.scrollTop&&b.top<a.scrollTop+a.clientHeight),b.visible&&(a.scrollWidth!=a.offsetWidth&&"visible"!=c(a).css("overflowX"))&&(b.visible=b.right>a.scrollLeft&&b.left<a.scrollLeft+a.clientWidth),b.left-=a.scrollLeft,b.top-=a.scrollTop,a===f&&(b.left+=a.offsetLeft,b.top+=a.offsetTop,f=a.offsetParent),b.bottom=b.top+b.height,b.right=b.left+b.width;return b}function Sb(){return Ia(q)}function nb(){if(q&&(m(l.onActiveCellPositionChanged,
{}),k)){var a=Sb();k.show&&k.hide&&(a.visible?k.show():k.hide());k.position&&k.position(a)}}function Qb(){return q?{row:n,cell:w}:null}function ra(a,b){var f=a*d.rowHeight,c=(a+1)*d.rowHeight-B+(qb?g.height:0);(a+1)*d.rowHeight>A+B+x?(ea(b?f:c),K()):a*d.rowHeight<A+x&&(ea(b?c:f),K())}function aa(a,b){var f=j.getItemMetadata&&j.getItemMetadata(a);if(!f||!f.columns)return 1;f=(f=f.columns[h[b].id]||f.columns[b])&&f.colspan;"*"===f&&(f=h.length-b);return f||1}function Tb(a){for(var b=0;b<h.length;){if(U(a,
b))return b;b+=aa(a,b)}return null}function eb(a,b){if(b>=h.length)return null;do b+=aa(a,b);while(b<h.length&&!U(a,b));return b<h.length?{row:a,cell:b,posX:b}:null}function Ub(a,b){if(0>=b)return null;var f=Tb(a);if(null===f||f>=b)return null;for(var f={row:a,cell:f,posX:f},c;;){c=eb(f.row,f.cell,f.posX);if(!c)return null;if(c.cell>=b)return f;f=c}}function gc(a,b,f){for(var c;;){if(++a>=v()+(d.enableAddRow?1:0))return null;for(c=b=0;b<=f;)c=b,b+=aa(a,b);if(U(a,c))return{row:a,cell:c,posX:f}}}function hc(a,
b,f){for(var c;;){if(0>--a)return null;for(c=b=0;b<=f;)c=b,b+=aa(a,b);if(U(a,c))return{row:a,cell:c,posX:f}}}function ic(a,b,c){if(b=eb(a,b,c))return b;for(b=null;++a<v()+(d.enableAddRow?1:0);)if(b=Tb(a),null!==b)return{row:a,cell:b,posX:b};return null}function jc(a,b,c){for(var d,e;!d&&!(d=Ub(a,b,c));){if(0>--a)return null;b=0;e=a;for(var g=0,j=null;g<h.length;)U(e,g)&&(j=g),g+=aa(e,g);e=j;null!==e&&(d={row:a,cell:e,posX:e})}return d}function Jb(){la("right")}function Ib(){la("left")}function Fa(){la("down")}
function Kb(){la("up")}function Lb(){la("next")}function Nb(){la("prev")}function la(a){if(q&&d.enableCellNavigation&&u().commitCurrentEdit())if(T(),a=(0,{up:hc,down:gc,left:Ub,right:eb,prev:jc,next:ic}[a])(n,w,cb)){var b=a.row==v();ra(a.row,!b);ka(G(a.row,a.cell),b||d.autoEdit);cb=a.posX}else ka(G(n,w),n==v()||d.autoEdit)}function G(a,b){if(z[a])for(var f=c(z[a]).children(),d,e=0;e<f.length;e++){d=bb(f[e]);if(d===b)return f[e];if(d>b)break}return null}function U(a,b){if(!d.enableCellNavigation||
a>=v()+(d.enableAddRow?1:0)||0>a||b>=h.length||0>b)return!1;var c=j.getItemMetadata&&j.getItemMetadata(a);return c&&"boolean"===typeof c.focusable?c.focusable:(c=c&&c.columns)&&c[h[b].id]&&"boolean"===typeof c[h[b].id].focusable?c[h[b].id].focusable:c&&c[b]&&"boolean"===typeof c[b].focusable?c[b].focusable:"boolean"===typeof h[b].focusable?h[b].focusable:!0}function ub(a,b){if(a>=v()||0>a||b>=h.length||0>b)return!1;var c=j.getItemMetadata&&j.getItemMetadata(a);return c&&"boolean"===typeof c.selectable?
c.selectable:(c=c&&c.columns&&(c.columns[h[b].id]||c.columns[b]))&&"boolean"===typeof c.selectable?c.selectable:"boolean"===typeof h[b].selectable?h[b].selectable:!0}function Ob(a,b,c){I&&(U(a,b)&&u().commitCurrentEdit())&&(ra(a,!1),b=G(a,b),ka(b,c||a===v()||d.autoEdit),k||T())}function kc(a){for(var b=[],c=h.length-1,d=0;d<a.length;d++)b.push(new Slick.Range(a[d],0,a[d],c));return b}function wb(){if(!H)throw"Selection model is not set";return Ta}var lc={explicitInitialization:!1,rowHeight:25,defaultColumnWidth:80,
enableAddRow:!1,leaveSpaceForNewRows:!1,editable:!1,autoEdit:!0,enableCellNavigation:!0,enableColumnReorder:!0,asyncEditorLoading:!1,asyncEditorLoadDelay:100,forceFitColumns:!1,enableAsyncPostRender:!1,asyncPostRenderDelay:60,autoHeight:!1,editorLock:Slick.GlobalEditorLock,showHeaderRow:!1,headerRowHeight:25,showTopPanel:!1,topPanelHeight:25,formatterFactory:null,editorFactory:null,cellFlashingCssClass:"flashing",selectedCellCssClass:"selected",multiSelect:!0,enableTextSelectionOnCells:!1,dataItemColumnValueExtractor:null,
fullWidthRows:!1,multiColumnSort:!1,defaultFormatter:function(a,b,c){return null==c?"":c.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}},Na={name:"",resizable:!0,sortable:!1,minWidth:30,rerenderOnResize:!1,headerCssClass:null},O,N,ha,ga,wa,fa=0,x=0,$=1,I=!1,r,F="slickgrid_"+Math.round(1E6*Math.random()),l=this,Ma,ca,s,da,S,ba,Vb,t,C,Y,Z,Ra,Sa,B,V,R,qb,na,W=0,Ka=0,ta=0,ua=0,P,Ya=0,cb,n,w,q=null,k=null,Rb,Ha,z={},Va=0,Ca,ia=0,A=0,Ua=0,Gb=0,H,Ta=[],Q=[],E={},J={},y=[],db=
null,Ea=null,Za=null,Ba={},pa=null,ja=null,Fb=0,zb=0;this.debug=function(){var a;a="\ncounter_rows_rendered:  "+Fb;a+="\ncounter_rows_removed:  "+zb;a+="\nrenderedRows:  "+Va;a+="\nnumVisibleRows:  "+Ca;a+="\nmaxSupportedCssHeight:  "+e;a+="\nn(umber of pages):  "+ga;a+="\n(current) page:  "+fa;a+="\npage height (ph):  "+ha;a+="\nscrollDir:  "+$;alert(a)};this.eval=function(a){return eval(a)};c.extend(this,{slickGridVersion:"2.0",onScroll:new Slick.Event,onSort:new Slick.Event,onHeaderContextMenu:new Slick.Event,
onHeaderClick:new Slick.Event,onMouseEnter:new Slick.Event,onMouseLeave:new Slick.Event,onClick:new Slick.Event,onDblClick:new Slick.Event,onContextMenu:new Slick.Event,onKeyDown:new Slick.Event,onAddNewRow:new Slick.Event,onValidationError:new Slick.Event,onViewportChanged:new Slick.Event,onColumnsReordered:new Slick.Event,onColumnsResized:new Slick.Event,onCellChange:new Slick.Event,onBeforeEditCell:new Slick.Event,onBeforeCellEditorDestroy:new Slick.Event,onBeforeDestroy:new Slick.Event,onActiveCellChanged:new Slick.Event,
onActiveCellPositionChanged:new Slick.Event,onDragInit:new Slick.Event,onDragStart:new Slick.Event,onDrag:new Slick.Event,onDragEnd:new Slick.Event,onSelectedRowsChanged:new Slick.Event,onCellCssStylesChanged:new Slick.Event,registerPlugin:function(a){Q.unshift(a);a.init(l)},unregisterPlugin:jb,getColumns:function(){return h},setColumns:rb,getColumnIndex:La,updateColumnHeader:function(a,b,c){if(I){var a=J[a],d=s.children().eq(a);d&&(h[a].name=b,h[a].toolTip=c,d.attr("title",c||b||"").children().eq(0).html(b))}},
setSortColumn:function(a,b){va([{columnId:a,sortAsc:b}])},setSortColumns:va,getSortColumns:function(){return y},autosizeColumns:Qa,getOptions:function(){return d},setOptions:function(a){u().commitCurrentEdit()&&(M(),d.enableAddRow!==a.enableAddRow&&Bb(v()),d=c.extend(d,a),t.css("overflow-y",d.autoHeight?"hidden":"auto"),K())},getData:function(){return j},getDataLength:v,getDataItem:D,setData:function(a,b){j=a;X();Da();b&&ea(0)},getSelectionModel:function(){return H},setSelectionModel:function(a){H&&
(H.onSelectedRangesChanged.unsubscribe(tb),H.destroy&&H.destroy());if(H=a)H.init(l),H.onSelectedRangesChanged.subscribe(tb)},getSelectedRows:wb,setSelectedRows:function(a){if(!H)throw"Selection model is not set";H.setSelectedRanges(kc(a))},render:K,invalidate:function(){Da();X();K()},invalidateRow:Bb,invalidateRows:Ab,invalidateAllRows:X,updateCell:function(a,b){var c=G(a,b);if(c){var d=h[b],e=D(a);k&&n===a&&w===b?k.loadValue(e):(c.innerHTML=e?ya(a,d)(a,b,za(e,d),d,e):"",Xa(a))}},updateRow:Wa,getViewport:xa,
getRenderedRange:Cb,resizeCanvas:L,updateRowCount:Da,scrollRowIntoView:ra,getCanvasNode:function(){return C[0]},focus:T,getCellFromPoint:function(a,b){for(var c=Math.floor((b+x)/d.rowHeight),e=0,g=0,j=0;j<h.length&&g<a;j++)g+=h[j].width,e++;0>e&&(e=0);return{row:c,cell:e-1}},getCellFromEvent:qa,getActiveCell:Qb,setActiveCell:function(a,b){if(I&&!(a>v()||0>a||b>=h.length||0>b)&&d.enableCellNavigation)ra(a,!1),ka(G(a,b),!1)},getActiveCellNode:function(){return q},getActiveCellPosition:Sb,resetActiveCell:function(){ka(null,
!1)},editActiveCell:Ga,getCellEditor:function(){return k},getCellNode:G,getCellNodeBox:function(a,b){if(!ab(a,b))return null;for(var c=a*d.rowHeight-x,e=c+d.rowHeight-1,g=0,j=0;j<b;j++)g+=h[j].width;return{top:c,left:g,bottom:e,right:g+h[b].width}},canCellBeSelected:ub,canCellBeActive:U,navigatePrev:Nb,navigateNext:Lb,navigateUp:Kb,navigateDown:Fa,navigateLeft:Ib,navigateRight:Jb,gotoCell:Ob,getTopPanel:function(){return Vb[0]},showTopPanel:function(){d.showTopPanel=!0;ba.slideDown("fast",L)},hideTopPanel:function(){d.showTopPanel=
!1;ba.slideUp("fast",L)},showHeaderRowColumns:function(){d.showHeaderRow=!0;S.slideDown("fast",L)},hideHeaderRowColumns:function(){d.showHeaderRow=!1;S.slideUp("fast",L)},getHeaderRow:function(){return da[0]},getHeaderRowColumn:function(a){a=J[a];return(a=da.children().eq(a))&&a[0]},getGridPosition:function(){return Ia(r[0])},flashCell:function(a,b,f){f=f||100;if(z[a]){var e=c(G(a,b)),h=function(a){a&&setTimeout(function(){e.queue(function(){e.toggleClass(d.cellFlashingCssClass).dequeue();h(a-1)})},
f)};h(4)}},addCellCssStyles:function(a,b){if(E[a])throw"addCellCssStyles: cell CSS hash with key '"+a+"' already exists.";E[a]=b;$a(b,null);m(l.onCellCssStylesChanged,{key:a,hash:b})},setCellCssStyles:vb,removeCellCssStyles:function(a){E[a]&&($a(null,E[a]),delete E[a],m(l.onCellCssStylesChanged,{key:a,hash:null}))},getCellCssStyles:function(a){return E[a]},init:ib,destroy:function(){u().cancelCurrentEdit();m(l.onBeforeDestroy,{});for(var a=0;a<Q.length;a++)jb(Q[a]);d.enableColumnReorder&&s.sortable&&
s.sortable("destroy");C.parents().unbind("scroll.slickgrid");r.unbind(".slickgrid");Y.remove();Z=null;C.unbind("draginit dragstart dragend drag");r.empty().removeClass(F)},getEditorLock:u,getEditController:function(){return Ha}});r=c(i);if(1>r.length)throw Error("SlickGrid requires a valid container, "+i+" does not exist in the DOM.");var fb;if(!(fb=e)){for(var ma=1E6,mc=c.browser.mozilla?5E6:1E9,gb=c("<div style='display:none' />").appendTo(document.body);ma<=mc&&!(gb.css("height",ma+1E6),gb.height()!==
ma+1E6);)ma+=1E6;gb.remove();fb=ma}e=fb;var hb;if(!(hb=g)){var sa=c("<div style='position:absolute; top:-10000px; left:-10000px; width:100px; height:100px; overflow:scroll;'></div>").appendTo("body"),nc={width:sa.width()-sa[0].clientWidth,height:sa.height()-sa[0].clientHeight};sa.remove();hb=nc}g=hb;d=c.extend({},lc,d);Na.width=d.defaultColumnWidth;if(d.enableColumnReorder&&!c.fn.sortable)throw Error("SlickGrid's 'enableColumnReorder = true' option requires jquery-ui.sortable module to be loaded");
Ha={commitCurrentEdit:function(){var a=D(n),b=h[w];if(k){if(k.isValueChanged()){var f=k.validate();if(f.valid)return n<v()?(f={row:n,cell:w,editor:k,serializedValue:k.serializeValue(),prevSerializedValue:Rb,execute:function(){this.editor.applyValue(a,this.serializedValue);Wa(this.row)},undo:function(){this.editor.applyValue(a,this.prevSerializedValue);Wa(this.row)}},d.editCommandHandler?(M(),d.editCommandHandler(a,b,f)):(f.execute(),M()),m(l.onCellChange,{row:n,cell:w,item:a})):(f={},k.applyValue(f,
k.serializeValue()),M(),m(l.onAddNewRow,{item:f,column:b})),!u().isActive();c(q).addClass("invalid");c(q).stop(!0,!0).effect("highlight",{color:"red"},300);m(l.onValidationError,{editor:k,cellNode:q,validationResults:f,row:n,cell:w,column:b});k.focus();return!1}M()}return!0},cancelCurrentEdit:function(){M();return!0}};r.empty().css("overflow","hidden").css("outline",0).addClass(F).addClass("ui-widget");/relative|absolute|fixed/.test(r.css("position"))||r.css("position","relative");Ma=c("<div tabIndex='0' hideFocus style='position:fixed;width:0;height:0;top:0;left:0;outline:0;'></div>").appendTo(r);
ca=c("<div class='slick-header ui-state-default' style='overflow:hidden;position:relative;' />").appendTo(r);s=c("<div class='slick-header-columns' style='width:10000px; left:-1000px' />").appendTo(ca);S=c("<div class='slick-headerrow ui-state-default' style='overflow:hidden;position:relative;' />").appendTo(r);da=c("<div class='slick-headerrow-columns' />").appendTo(S);ba=c("<div class='slick-top-panel-scroller ui-state-default' style='overflow:hidden;position:relative;' />").appendTo(r);Vb=c("<div class='slick-top-panel' style='width:10000px' />").appendTo(ba);
d.showTopPanel||ba.hide();d.showHeaderRow||S.hide();t=c("<div class='slick-viewport' style='width:100%;overflow:auto;outline:0;position:relative;;'>").appendTo(r);t.css("overflow-y",d.autoHeight?"hidden":"auto");C=c("<div class='grid-canvas' />").appendTo(t);d.explicitInitialization||ib()}}});var g,e})(jQuery);(function(c){c.extend(!0,window,{Slick:{Editors:{Text:function(g){var e,i;this.init=function(){e=c("<INPUT type=text class='editor-text' />").appendTo(g.container).bind("keydown.nav",function(e){(e.keyCode===c.ui.keyCode.LEFT||e.keyCode===c.ui.keyCode.RIGHT)&&e.stopImmediatePropagation()}).focus().select()};this.destroy=function(){e.remove()};this.focus=function(){e.focus()};this.getValue=function(){return e.val()};this.setValue=function(c){e.val(c)};this.loadValue=function(c){i=c[g.column.field]||
"";e.val(i);e[0].defaultValue=i;e.select()};this.serializeValue=function(){return e.val()};this.applyValue=function(c,e){c[g.column.field]=e};this.isValueChanged=function(){return!(""==e.val()&&null==i)&&e.val()!=i};this.validate=function(){if(g.column.validator){var c=g.column.validator(e.val());if(!c.valid)return c}return{valid:!0,msg:null}};this.init()},Integer:function(g){var e,i;this.init=function(){e=c("<INPUT type=text class='editor-text' />");e.bind("keydown.nav",function(e){(e.keyCode===
c.ui.keyCode.LEFT||e.keyCode===c.ui.keyCode.RIGHT)&&e.stopImmediatePropagation()});e.appendTo(g.container);e.focus().select()};this.destroy=function(){e.remove()};this.focus=function(){e.focus()};this.loadValue=function(c){i=c[g.column.field];e.val(i);e[0].defaultValue=i;e.select()};this.serializeValue=function(){return parseInt(e.val(),10)||0};this.applyValue=function(c,e){c[g.column.field]=e};this.isValueChanged=function(){return!(""==e.val()&&null==i)&&e.val()!=i};this.validate=function(){return isNaN(e.val())?
{valid:!1,msg:"Please enter a valid integer"}:{valid:!0,msg:null}};this.init()},Date:function(g){var e,i,j=!1;this.init=function(){e=c("<INPUT type=text class='editor-text' />");e.appendTo(g.container);e.focus().select();e.datepicker({showOn:"button",buttonImageOnly:!0,buttonImage:"../images/calendar.gif",beforeShow:function(){j=!0},onClose:function(){j=!1}});e.width(e.width()-18)};this.destroy=function(){c.datepicker.dpDiv.stop(!0,!0);e.datepicker("hide");e.datepicker("destroy");e.remove()};this.show=
function(){j&&c.datepicker.dpDiv.stop(!0,!0).show()};this.hide=function(){j&&c.datepicker.dpDiv.stop(!0,!0).hide()};this.position=function(e){j&&c.datepicker.dpDiv.css("top",e.top+30).css("left",e.left)};this.focus=function(){e.focus()};this.loadValue=function(c){i=c[g.column.field];e.val(i);e[0].defaultValue=i;e.select()};this.serializeValue=function(){return e.val()};this.applyValue=function(c,d){c[g.column.field]=d};this.isValueChanged=function(){return!(""==e.val()&&null==i)&&e.val()!=i};this.validate=
function(){return{valid:!0,msg:null}};this.init()},YesNoSelect:function(g){var e,i;this.init=function(){e=c("<SELECT tabIndex='0' class='editor-yesno'><OPTION value='yes'>Yes</OPTION><OPTION value='no'>No</OPTION></SELECT>");e.appendTo(g.container);e.focus()};this.destroy=function(){e.remove()};this.focus=function(){e.focus()};this.loadValue=function(c){e.val((i=c[g.column.field])?"yes":"no");e.select()};this.serializeValue=function(){return"yes"==e.val()};this.applyValue=function(c,e){c[g.column.field]=
e};this.isValueChanged=function(){return e.val()!=i};this.validate=function(){return{valid:!0,msg:null}};this.init()},Checkbox:function(g){var e,i;this.init=function(){e=c("<INPUT type=checkbox value='true' class='editor-checkbox' hideFocus>");e.appendTo(g.container);e.focus()};this.destroy=function(){e.remove()};this.focus=function(){e.focus()};this.loadValue=function(c){(i=c[g.column.field])?e.attr("checked","checked"):e.removeAttr("checked")};this.serializeValue=function(){return e.attr("checked")};
this.applyValue=function(c,e){c[g.column.field]=e};this.isValueChanged=function(){return e.attr("checked")!=i};this.validate=function(){return{valid:!0,msg:null}};this.init()},PercentComplete:function(g){var e,i,j;this.init=function(){e=c("<INPUT type=text class='editor-percentcomplete' />");e.width(c(g.container).innerWidth()-25);e.appendTo(g.container);i=c("<div class='editor-percentcomplete-picker' />").appendTo(g.container);i.append("<div class='editor-percentcomplete-helper'><div class='editor-percentcomplete-wrapper'><div class='editor-percentcomplete-slider' /><div class='editor-percentcomplete-buttons' /></div></div>");
i.find(".editor-percentcomplete-buttons").append("<button val=0>Not started</button><br/><button val=50>In Progress</button><br/><button val=100>Complete</button>");e.focus().select();i.find(".editor-percentcomplete-slider").slider({orientation:"vertical",range:"min",value:j,slide:function(c,d){e.val(d.value)}});i.find(".editor-percentcomplete-buttons button").bind("click",function(){e.val(c(this).attr("val"));i.find(".editor-percentcomplete-slider").slider("value",c(this).attr("val"))})};this.destroy=
function(){e.remove();i.remove()};this.focus=function(){e.focus()};this.loadValue=function(c){e.val(j=c[g.column.field]);e.select()};this.serializeValue=function(){return parseInt(e.val(),10)||0};this.applyValue=function(c,d){c[g.column.field]=d};this.isValueChanged=function(){return!(""==e.val()&&null==j)&&(parseInt(e.val(),10)||0)!=j};this.validate=function(){return isNaN(parseInt(e.val(),10))?{valid:!1,msg:"Please enter a valid positive number"}:{valid:!0,msg:null}};this.init()},LongText:function(g){var e,
i,j,h=this;this.init=function(){var d=c("body");i=c("<DIV style='z-index:10000;position:absolute;background:white;padding:5px;border:3px solid gray; -moz-border-radius:10px; border-radius:10px;'/>").appendTo(d);e=c("<TEXTAREA hidefocus rows=5 style='backround:white;width:250px;height:80px;border:0;outline:0'>").appendTo(i);c("<DIV style='text-align:right'><BUTTON>Save</BUTTON><BUTTON>Cancel</BUTTON></DIV>").appendTo(i);i.find("button:first").bind("click",this.save);i.find("button:last").bind("click",
this.cancel);e.bind("keydown",this.handleKeyDown);h.position(g.position);e.focus().select()};this.handleKeyDown=function(d){d.which==c.ui.keyCode.ENTER&&d.ctrlKey?h.save():d.which==c.ui.keyCode.ESCAPE?(d.preventDefault(),h.cancel()):d.which==c.ui.keyCode.TAB&&d.shiftKey?(d.preventDefault(),grid.navigatePrev()):d.which==c.ui.keyCode.TAB&&(d.preventDefault(),grid.navigateNext())};this.save=function(){g.commitChanges()};this.cancel=function(){e.val(j);g.cancelChanges()};this.hide=function(){i.hide()};
this.show=function(){i.show()};this.position=function(c){i.css("top",c.top-5).css("left",c.left-5)};this.destroy=function(){i.remove()};this.focus=function(){e.focus()};this.loadValue=function(c){e.val(j=c[g.column.field]);e.select()};this.serializeValue=function(){return e.val()};this.applyValue=function(c,e){c[g.column.field]=e};this.isValueChanged=function(){return!(""==e.val()&&null==j)&&e.val()!=j};this.validate=function(){return{valid:!0,msg:null}};this.init()}}}})})(jQuery);
