var doc_images = [];
var current_img;

$(document).ready(function() {
	// preload images
	$('ul.thumbnails a').each(function(i,n) {
		var img = new Image();
		img.src = $(this).attr('href');
		doc_images.push(img);
	});
	
	$('ul.thumbnails a').click(function(e) {
		e.preventDefault();
		$(this).blur();
		
		current_img = $(this);
		
		$('.photo-description').fadeOut('fast');
		$('#large-photo img').fadeOut('fast', function() {
			$('#large-photo').empty().append('<img src="'+ current_img.attr('href') +'" alt="'+current_img.attr('title')+'" style="display:none" />');
			$('.photo-description').empty().append(current_img.attr('title')).fadeIn();
			$('#large-photo img').fadeIn();
		});
	});
});