// Cybermuse - VERONESE History, Reconstruction script
// Developer: Dan Copeland - BV02, Ottawa ON

$(document).ready(function(){
	var firstRunReconRecon = true;
	var previousRecon;
	var reconstructionHeight1 = $('.reconstructionPage').height();
	var reconstructionHeight2;

	var resetReconstruction = function(){
		var detailIdRecon = 6;
		var thumbnailImg = 'thumb-' + detailIdRecon;
		$('.reconstructionPage .imageContainer').hide();
		$('.reconstructionPage #'+thumbnailImg).fadeIn('fast');
		showingPresentDay = false;
		reconstructionHeight2 = $('.reconstructionPage').height();
	};

	var showReconstruction = function(){
		firstRunRecon = false;
		var detailIdReconName = $(this).attr('id');
		var detailIdRecon = detailIdReconName.replace('recon-','');
		if(detailIdRecon != previousRecon){
			var detailsDiv = 'full-' + detailIdRecon;
			var thumbnailImg = 'thumb-' + detailIdRecon;
			$('.reconstructionPage .details_content').hide();
			if(!firstRunRecon){
				$('.reconstructionPage .imageContainer').hide();
				$('.reconstructionPage #'+thumbnailImg).fadeIn('fast');
			}
			$('.reconstructionPage #'+detailsDiv).fadeIn('slow');
			firstRunRecon = false;
			previousRecon = detailIdRecon;
			$('#historyWrapper').animate(
				{ height: reconstructionHeight1 },
				{
					easing: "easeInOutSine", 
					duration: 600, 
					complete: function(){}
				}
			);
		}
		return false;
	};
	$('a#presentDayBtn2').bind('click',function(){
			$('.reconstructionPage .details_content').hide();
			$('.reconstructionPage .imageContainer').hide();
			$('.reconstructionPage #full-7').fadeIn('slow');
			$('.reconstructionPage #thumb-7').fadeIn('fast');
			showingPresentDay2 = true;
			previousRecon = 7;
		return false;
	});
	$('a#presentDayBtn').bind('click',function(){
			$('.reconstructionPage .details_content').hide();
			$('.reconstructionPage .imageContainer').hide();
			$('.reconstructionPage #full-6').fadeIn('slow');
			$('.reconstructionPage #thumb-6').fadeIn('fast');
			showingPresentDay = true;
			previousRecon = 6;
		return false;
	});
	$('#reconstructionNav li').bind('click',showReconstruction);
	$('#reconstructionNav li').hoverIntent(
		function(){
			$(this).children('div').slideToggle('fast');
		},
		function(){
			$(this).children('div').slideToggle('fast');
		}
	);
});