Maybe you should ask the people who created that light box whether it was ever intended that it would allow multiple light boxes on one page?
But there are clearly things wrong in your code.
You include the exact same ".js" setup file three times, one per group of 4 images.
How does it make sense to include the exact same file more than once?
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.