Well, this looks like the problem:
document.body.appendChild(img);
You keep adding new images. It looks like you are somehow copying over the class names, as well, so objs.length
keeps getting bigger, and your loop is infinite. Do this instead:
var starting_length = objs.length;
for (var i = 0; i < starting_length; i++) {
....