jquery.fn.pagination=function(e,t){return t=jquery.extend({items_per_page:10,num_display_entries:10,current_page:0,num_edge_entries:0,link_to:"#",first_text:"first",prev_text:"prev",next_text:"next",end_text:"end",ellipse_text:"...",prev_show_always:!0,next_show_always:!0,first_show_always:!1,end_show_always:!1,callback:function(){return!1}},t||{}),this.each(function(){function n(){return math.ceil(e/t.items_per_page)}function r(){var e=math.ceil(t.num_display_entries/2),r=n(),i=r-t.num_display_entries,s=o>e?math.max(math.min(o-e,i),0):0,u=o>e?math.min(o+e,r):math.min(t.num_display_entries,r);return[s,u]}function i(e,n){o=e,s();var r=t.callback(e,u);return r||(n.stoppropagation?n.stoppropagation():n.cancelbubble=!0),r}function s(){u.empty();var s=r(),a=n(),f=function(e){return function(t){return i(e,t)}},l=function(e,n){e=e<0?0:e"+n.text+"");else var r=jquery(""+n.text+"").bind("click",f(e)).attr("href",t.link_to.replace(/__id__/,e));n.classes&&r.addclass(n.classes),u.append(r)};t.first_text&&t.first_show_always&&l(0,{text:t.first_text,classes:"prev"}),t.prev_text&&(o>0||t.prev_show_always)&&l(o-1,{text:t.prev_text,classes:"prev"});if(s[0]>0&&t.num_edge_entries>0){var c=math.min(t.num_edge_entries,s[0]);for(var h=0;h"+t.ellipse_text+"").appendto(u)}for(var h=s[0];h0){a-t.num_edge_entries>s[1]&&t.ellipse_text&&jquery(""+t.ellipse_text+"").appendto(u);var p=math.max(a-t.num_edge_entries,s[1]);for(var h=p;h0?(i(o-1),!0):!1},this.nextpage=function(){return o