Hello,
I am in a touch of a pickle. I've done image swaps with javascript, but am still a javascript newb.
I need to write a product page with a main image and alt images. We want the user to be able to click on the alt image and it will change the main image to the selected image.
Some background:
We have the site located at an ecommerce company that only gives template access. They have it driven by smarty. So I can use their modified smarty, javascript and html. I don't have deeper access

I was brought in after everything had been set up years ago to make the site better and easier to maintain. So I am fixing half decent code in the middle, ugh

Anyway, it's just a tad limited but functions decently for now.
So here is what I have:
This is displaying the images:
I haven't written the script to swap the images yet. Therein lies my problem. Each product could have 0-5 alt images. So how do I account for an unknown number of images in the script? Every example I find has a static script and set image count and I don't know how to change that.
Thanks to all and anyone that can help!!!