$(function(){
	/*
		TODO Add support for reading the hash here to show the correct summary
	*/
	// Hide all the summary tables except the 1st one and set the tab to be active...
	$('.summary-table .summary:not(.summary-table .summary:first)').hide();
	$('.summary-table .summary-title li:first a').addClass('active');
	$('.summary-table .summaries').height($('.summary-table .summary:first').innerHeight());
	
	// Handle clicks to the tabs...
	$('.summary-table .summary-title li a').click(function(){
		if( ! $(this).hasClass('active')){
			var target_summary = $(this).attr('href');
			
			// Switch over the summaries shown...
			var current_summary = $('.summary-table .summary:not(' + target_summary + ')');
			var new_summary = $('.summary-table .summary' + target_summary);
			
			current_summary.fadeOut(150, function(){
				$('.summary-table .summaries').animate({'height':new_summary.innerHeight()}, 250, function(){
					new_summary.fadeIn(150);
				});
			});
			// Checge the active tab
			$('.summary-table .summary-title li a').removeClass('active');
			$(this).addClass('active');
		}
		return false;
	});
	
});