updated new if statements in the js for the second page