$(document).ready(function(){
	$("#thumbs div a").each(function(){
		$(this).attr({'rel': $(this).attr('href')}); // Set 'rel' to current 'href'
		$(this).attr({'href': 'javascript:void(0);'});
		//alert($(this).attr('rel'))
	});
	$("#photo_caption span").html( $("#thumbs div a").attr('title'));
});
$(document).ready(function(){
	var caption = $("#photo_caption");
	var frame = $("#frame");
	var photo = $("#photo");
	$("#thumbs div 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(){
	$("#thumbs h2 a").click(function(){
		$target = $(this).attr('rel');
		var tString = $target.toString();
		var targetDiv = "#" + tString
		$(targetDiv).toggle();
	});
	$("#thumbs h2 a").toggle(function(){
								$(this).css({'background': 'url(bpimages/arrow_down.gif) left no-repeat 6px'});
								
								}, function(){									
									$(this).css({'background': 'url(bpimages/arrow.gif) left no-repeat 3px'});
								});
});


	
