Pure JS code for Image gallery