$(function() {

	$(".thumbLink").each(function() {
	    var newImg = $("<img />").attr('src', this.href);
	    $("#preloader").append(newImg);
	});

	$(".thumbLink").click(function(event) {
	    event.preventDefault();
	    var newImg = $("<img />").attr('src', this.href);
		var oldImg = $("img.myImage:first");
		newImg.addClass('myImage');
		$(oldImg).fadeOut(function(){
			$(this).remove();
		});
		$("#imgDisplay").prepend(newImg);
	});

});