add images to image index with javascript