fixed js if statement to add css class