(function(a){a.mydbr_pager=function(c,e){var l={},f=this,b=a(c),u=b.find(".pager_first_d"),r=b.find(".pager_prev_d"),m=b.find('input[name="page"]'),d=b.find(".max"),t=b.find(".pager_next"),q=b.find(".pager_last"),j=b.find('input[name="length"]'),s=b.find('input[name="start"]'),n=b.find('input[name="end"]'),g=function(){var D=b.closest("table"),C=parseInt(m.val(),10),z=parseInt(s.val(),10),w=parseInt(n.val(),10),y=parseInt(j.val(),10),B=((C-1)*y)+1,A=(C*y),v,x;x=D.find("TBODY").children().length-D.find(".last_row").length;z=isNaN(z)?0:z;w=isNaN(w)?0:w;if(A>x&&x>0){A=x}for(v=z;v<=w;v+=1){D.find("tbody tr:nth-child("+v+")").hide()}for(v=B;v<=A;v+=1){D.find("tbody tr:nth-child("+v+")").show()}a('.pager_row input[name="page"]',D).val(C);a('.pager_row input[name="start"]',D).val(B);a('.pager_row input[name="end"]',D).val(A);if(parseInt(m.val(),10)<parseInt(d.text(),10)){a(".pager_row .pager_next",D).removeClass("pager_next_d").removeAttr("disabled");a(".pager_row .pager_last",D).removeClass("pager_last_d").removeAttr("disabled")}else{a(".pager_row .pager_next",D).addClass("pager_next_d").attr("disabled","disabled");a(".pager_row .pager_last",D).addClass("pager_last_d").attr("disabled","disabled")}if(parseInt(m.val(),10)>1){a(".pager_row .pager_prev",D).removeClass("pager_prev_d").removeAttr("disabled");a(".pager_row .pager_first",D).removeClass("pager_first_d").removeAttr("disabled")}else{a(".pager_row .pager_prev",D).addClass("pager_prev_d").attr("disabled","disabled");a(".pager_row .pager_first",D).addClass("pager_first_d").attr("disabled","disabled")}},i=function(){m.val(1);g()},o=function(){m.val(parseInt(m.val(),10)-1);g()},p=function(){m.val(parseInt(m.val(),10)+1);g()},k=function(){m.val(parseInt(d.text(),10));g()},h=function(){var v=parseInt(m.val(),10);if(isNaN(v)||v<1){m.val(1)}else{if(v>parseInt(d.val(),10)){m.val(d.val())}}g()};f.settings={};f.init=function(){f.settings=a.extend({},l,e);var w=b.closest("table"),x=j.val(),v;m.val(1);v=w.find("TBODY").children().length-w.find(".last_row").length;d.text(v>0?Math.ceil(v/x):1);u.on("click",function(){i()});r.on("click",function(){o()});t.on("click",function(){p()});q.on("click",function(){k()});m.on("change",function(){h()});g()};f.init()};a.fn.mydbr_pager=function(b){return this.each(function(){if(undefined===a(this).data("mydbr_pager")){var c=new a.mydbr_pager(this,b);a(this).data("mydbr_pager",c)}})}}(jQuery));