$(function() {
	// Front Page Click thumb function
	$('#slideshow-thumb img').live('click', function () {
		var newImageSrc = $(this).attr('src');
		var newImageAlt = $(this).attr('alt');
		var newImageTitle = $(this).attr('title');
		$('#slideshow-thumb img.main').removeClass('main').css({ opacity : 0.7 });
		$(this).addClass('main');
		$('#slideshow-container-text').hide();
		$('#slideshow-container-caption').animate({
				height : '0px'
			},500, function() {
				$('#main-image img').animate({
					opacity : .2
				}, 100, function() {
					$('#main-image img').attr('src', newImageSrc);
					$('#main-image img').attr('alt', newImageAlt);
					$('#main-image img').attr('title', newImageTitle);
					$('#main-image img').animate({ opacity : 1},500, function(){
						showText(newImageTitle);
					});
				});
			});
	});
	
	$('#slideshow-thumb img.main').css({
		opacity: 1
	});
	$('#slideshow-thumb img').mouseenter(function(){
		$(this).stop().fadeTo('slow', 1);
	});
	$('#slideshow-thumb img:not(.main)').live('mouseleave', function(){
		$(this).stop().fadeTo('slow', 0.7);
	});
	

	
	showText($('.main').attr('title'));
	

	
	function showText(textAlt) {
		$('#slideshow-container-text').html(textAlt);
		$('#slideshow-container-caption').animate({
				height : '45px'
			},500, function() {
				$('#slideshow-container-text').show();
		});
	}
	
});
