(function () { var defaults = { preLoadPage: function () { }, postLoadPage: function () { }, generator: function () { }, itemsPerPage: 20, maxPages: 5 }; function P(items, opts) { this.items = items; this.opts = opts || {}; for(var k in defaults) if(!this.opts[k]) this.opts[k] = defaults[k]; this.paginator = $("
").addClass("pagination"); this.loadPage(0); } P.prototype.loadButtons = function (p) { var pages = parseInt(this.items.length / this.opts.itemsPerPage+0.5); var endcaps = pages > this.opts.maxPages; this.paginator.html(""); if(this.items.length < this.opts.itemsPerPage) return; var ul = $("