$(document).ready(function(){

	$('#thumbs img').click(
		function() {
			var currentBigImage = $('#bigpic img').attr('src');
			var newBigImage = $(this).attr('rel');
			switchImage(newBigImage, currentBigImage);
		}
	);

	
	function switchImage(imageHref, currentBigImage) {
		 
		var theBigImage = $('#bigpic img');
		if (imageHref != currentBigImage) {
		
			theBigImage.fadeOut("slow", function(){
				theBigImage.attr('src', imageHref).fadeIn("slow");
		});
			
	}
		
	}

});

