Pager loop JS