+
+function drawPager(max, hits)
+{
+ var firstOnPage = currentPage * currentResultsPerPage + 1;
+ var lastOnPage = (firstOnPage + currentResultsPerPage - 1) < max ? (firstOnPage + currentResultsPerPage - 1) : max;
+
+ var results = $('div.showing');
+ results.empty();
+ results.append('Displaying: <b>'+firstOnPage+'</b> to <b>'+lastOnPage+
+ '</b> of <b>'+max+'</b>'); //(total hits: '+hits+')');
+ var pager = $('div.pages');
+ pager.empty();
+
+ if ( currentPage > 0 ){
+ $('<a class="previous_active">Previous</a>').click(function() { my_paz.showPrev(1); currentPage--; }).appendTo(pager.eq(0));
+ $('<a class="previous_active">Previous</a>').click(function() { my_paz.showPrev(1); currentPage--; }).appendTo(pager.eq(1));
+ }
+ else
+ pager.append('<a class="previous_inactive">Previous</a>');
+
+ var numPages = Math.ceil(max / currentResultsPerPage);
+
+ for(var i = 1; i <= numPages; i++)
+ {
+ if( i == (currentPage + 1) ){
+ $('<a class="select">'+i+'</a>').appendTo(pager);
+ continue;
+ }
+ var pageLink = $('<a class="page">'+i+'</a>');
+ var plClone = pageLink.clone();
+
+ pageLink.click(function() {
+ my_paz.showPage(this.firstChild.nodeValue - 1);
+ currentPage = (this.firstChild.nodeValue - 1);
+ });
+
+ plClone.click(function() {
+ my_paz.showPage(this.firstChild.nodeValue - 1);
+ currentPage = (this.firstChild.nodeValue - 1);
+ });
+
+ //nasty hack
+ pager.eq(0).append(pageLink);
+ pager.eq(1).append(plClone);
+ }
+
+ if ( currentPage < (numPages-1) ){
+ $('<a class="next_active">Next</a>').click(function() { my_paz.showNext(1); currentPage++; }).appendTo(pager.eq(0));
+ $('<a class="next_active">Next</a>').click(function() { my_paz.showNext(1); currentPage++; }).appendTo(pager.eq(1));
+ }
+ else
+ pager.append('<a class="next_inactive">Next</a>');
+}