(function(e,t,undefined){function a(){var t=this;t.name="Footable Sortable",t.init=function(a){t.footable=a,a.options.sort===!0&&e(a.table).bind({footable_initialized:function(){var o,i,n=e(a.table),r=(n.find("> tbody"),a.options.classes.sort);if(n.data("sort")!==!1){n.find("> thead > tr:last-child > th, > thead > tr:last-child > td").each(function(){i=e(this),o=a.columns[i.index()],o.sort.ignore===!0||i.hasClass(r.sortable)||(i.addClass(r.sortable),e("").addClass(r.indicator).appendTo(i))}),n.find("> thead > tr:last-child > th."+r.sortable+", > thead > tr:last-child > td."+r.sortable).unbind("click.footable").bind("click.footable",function(a){a.preventDefault(),i=e(this);var o=!i.hasClass(r.sorted);return t.doSort(i.index(),o),!1});var l=!1;for(var d in a.columns)if(o=a.columns[d],o.sort.initial){var s="descending"!==o.sort.initial;t.doSort(o.index,s);break}l&&a.bindToggleSelectors()}},footable_redrawn:function(){var o=e(a.table),i=a.options.classes.sort;o.data("sorted")>=0&&o.find("> thead > tr:last-child > th").each(function(a){var o=e(this);return o.hasClass(i.sorted)||o.hasClass(i.descending)?(t.doSort(a),undefined):undefined})},footable_column_data:function(t){var a=e(t.column.th);t.column.data.sort=t.column.data.sort||{},t.column.data.sort.initial=a.data("sort-initial")||!1,t.column.data.sort.ignore=a.data("sort-ignore")||!1,t.column.data.sort.selector=a.data("sort-selector")||null;var o=a.data("sort-match")||0;o>=t.column.data.matches.length&&(o=0),t.column.data.sort.match=t.column.data.matches[o]}}).data("footable-sort",t)},t.doSort=function(a,o){var i=t.footable;if(e(i.table).data("sort")!==!1){var n=e(i.table),r=n.find("> tbody"),l=i.columns[a],d=n.find("> thead > tr:last-child > th:eq("+a+")"),s=i.options.classes.sort,u=i.options.events.sort;if(o=o===undefined?!d.hasClass(s.sorted):o,l.sort.ignore===!0)return!0;var f=i.raise(u.sorting,{column:l,direction:o?"ASC":"DESC"});f&&f.result===!1||(n.data("sorted",l.index),n.find("> thead > tr:last-child > th, > thead > tr:last-child > td").not(d).removeClass(s.sorted+" "+s.descending),o===undefined&&(o=d.hasClass(s.sorted)),o?d.removeClass(s.descending).addClass(s.sorted):d.removeClass(s.sorted).addClass(s.descending),t.sort(i,r,l,o),i.bindToggleSelectors(),i.raise(u.sorted,{column:l,direction:o?"ASC":"DESC"}))}},t.rows=function(t,a,o){var i=[];return a.find("> tr").each(function(){var a=e(this),n=null;if(a.hasClass(t.options.classes.detail))return!0;a.next().hasClass(t.options.classes.detail)&&(n=a.next().get(0));var r={row:a,detail:n};return o!==undefined&&(r.value=t.parse(this.cells[o.sort.match],o)),i.push(r),!0}).detach(),i},t.sort=function(e,a,o,i){var n=t.rows(e,a,o),r=e.options.sorters[o.type]||e.options.sorters.alpha;n.sort(function(e,t){return i?r(e.value,t.value):r(t.value,e.value)});for(var l=0;n.length>l;l++)a.append(n[l].row),null!==n[l].detail&&a.append(n[l].detail)}}if(t.footable===undefined||null===t.footable)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var o={sort:!0,sorters:{alpha:function(e,t){return e===t?0:t>e?-1:1},numeric:function(e,t){return e-t}},classes:{sort:{sortable:"footable-sortable",sorted:"footable-sorted",descending:"footable-sorted-desc",indicator:"footable-sort-indicator"}},events:{sort:{sorting:"footable_sorting",sorted:"footable_sorted"}}};t.footable.plugins.register(new a,o)})(jQuery,window);