adding logic to replace main image and toggle active thumbnail