jquery.pagination.js code refactoring