AS3 pagination ported to JS to load specific items per page