(function ($) { $.fn.extend({ smartpaginator: function (options) { var settings = $.extend({ totalrecords: 0, recordsperpage: 0, length: 10, next: 'Next', prev: 'Prev', first: 'First', last: 'Last', go: 'Go', theme: 'green', display: 'double', initval: 1, datacontainer: '', //data container id dataelement: '', //children elements to be filtered e.g. tr or div onchange: null, controlsalways: false }, options); return this.each(function () { var currentPage = 0; var startPage = 0; var totalpages = parseInt(settings.totalrecords / settings.recordsperpage); if (settings.totalrecords % settings.recordsperpage > 0) totalpages++; var initialized = false; var container = $(this).addClass('pager').addClass(settings.theme); container.find('ul').remove(); container.find('div').remove(); container.find('span').remove(); var dataContainer; var dataElements; if (settings.datacontainer != '') { dataContainer = $('#' + settings.datacontainer); dataElements = $('' + settings.dataelement + '', dataContainer); } var list = $('