Javascript - choose your own adventure