$(document).ready(function(){

	//ie6 doesn't like 100% height - so need to set this in px manually
	var pageHeight = $('.site-container').height();
	$('.overlay-container').height(pageHeight);

	aboutGallery();

});


function aboutGallery(){

	$('a.lastyear').click(function(){
		
		$('.overlay-container').show();
			$('.overlay').animate({'top':'50px'},'slow','swing');	
		return false;
	
	});

	$('.gallery-controls .close a').click(function(){
	
		$('.overlay').animate({'top':'-552px'},'slow','swing',function(){
			$('.overlay-container').hide();
		});	
		return false;
	
	});

	$('.gallery-controls .next a').click(function(){
		//alert(parseInt($('.gallery-content ul').css('left')));
		$('.gallery-content ul').stop(true,true);
		if(parseInt($('.gallery-content ul').css('left')) > -6426){
			$('.gallery-content ul').animate({'left':'-=714px'},'slow','swing');
			$('.gallery-content ul li.current').removeClass('current').next('li').addClass('current');
			var description = $('.gallery-content ul li.current img').attr('title');
			$('.overlay p.description').hide().text(description).fadeIn();
		}
		return false;
	});
	$('.gallery-controls .prev a').click(function(){
		//alert(parseInt($('.gallery-content ul').css('left')));
		$('.gallery-content ul').stop(true,true);
		if(parseInt($('.gallery-content ul').css('left')) < 0){
			$('.gallery-content ul').animate({'left':'+=714px'},'slow','swing');
			$('.gallery-content ul li.current').removeClass('current').prev('li').addClass('current');
			var description = $('.gallery-content ul li.current img').attr('title');
			$('.overlay p.description').hide().text(description).fadeIn();
		}
		return false;
	});

}
