$(document).ready(function(){
	$("#thumbs").css({opacity: 0.25});
	$("#thumbs a").each(function(){
		$(this).attr({'rel': $(this).attr('href')}); // Set 'rel' to current 'href'
		$(this).attr({'href': 'javascript:void(0);'});
	});
	$("#photo_caption span").html( $("#thumbs a").attr('title'));
});
$(document).ready(function(){
	var caption = $("#photo_caption");
	var frame = $("#frame");
	var photo = $("#photo");
	$("#thumbs a").click(function(){
		$this = $(this); // Capture current anchor.
		$img = $(this).attr('rel'); // Capture current image href.
		$(this).addClass("visited");
		$("#photo_caption span").html( $this.attr('title') ); // Fade out caption and replace with next image's.
		$("#frame").css({ 'background-image': 'url(' + $img + ')' }); // Set next image as background.
		$("#photo").fadeOut('slow', function(){ 
			$("#photo").attr({'src': $this.attr('rel')}); // Fade in the image.
			$("#photo").fadeIn('slow');
		});
	});
});
$(document).ready(function(){
	$(window).load( function(){
		$("#loading").fadeOut();
		$("#thumbs").css({opacity: 1});
	});
});