kali - here is a way to accomplish the same thing in less code, and lets you call the images anything you want instead of having to use numbers. This is untested so there may be some slight errors, but the logic should be sound:
$(function() { var imageArray = ['foo', 'bar', 'baz']; $(imageArray).each(function (item, i) { $('#wrapper').append('<a href="photos.jsp?pn="' + item + '"><img class="thumbsBorder" src="images/' + item + '.jpg" alt="thumbnail' + i + '" width="80" height="80"/></a>'); }); $('img.thumbsBorder').hover(function () { $(this).toggleClass('dim').up().toggleClass('roll'); }); });