Perpage controls javascript