Pagination javascript class