$(document).ready(function() {

/*
	$('#albums .thumb').mouseover(function(){
		$('#albums .thumb').animate({opacity: 1}, 100);
		$(this).animate({opacity: 0.3}, 100);
		return false;
		
	});

	$('#albums .thumb').mouseout(function(){
		$('#albums .thumb').animate({opacity: 1}, 100);
		return false;
		
	});
*/



	var hash = window.location.hash.substr(1);
	var href = $('#thumbnails li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #bigpic';
			$('#bigpic').load(toLoad)
		}											
	});

	$('#thumbnails li a').click(function(){
								  
		var toLoad = $(this).attr('href')+' #image';
		
		$('#load').remove();
		$('#leftcol').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4);
		$('#bigpic').fadeOut('fast',loadContent);
		function loadContent() {
			$('#bigpic').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#bigpic').animate({opacity: 1.0}, 1000).fadeIn('slow',hideLoader());
		}
		$('#thumbnails li a').animate({opacity: 1}, 500);
		$(this).animate({opacity: 0.3}, 500);
		function hideLoader() {
			$('#load').fadeOut('slow');
		}
		return false;
		
	});

		


});