Added js to handle prev next nav buttons