$(document).ready(function() {
	
	$('#cloud li a').bind("mouseover", function(event){
		if (!$(this).hasClass('current')) {
			$(this).animate({
				fontSize: '14px',
				marginLeft: -3,
				// opacity: 1
			}, 500, function() {
				// Animation complete.
			});
		}
	});
	
	$('#cloud li a').bind("mouseout", function(event){
		$(this).animate({
			fontSize: '12px',
			// opacity: 0.75,
			marginLeft: 0
		}, 200, function() {
			// Animation complete.
		});
	});
	
	$('#controls img').bind("mouseover", function(event){
		$(this).css('opacity', 1);
	});
	
	$('#controls img').bind("mouseout", function(event){
		$(this).css('opacity', 0.5);
	});
	
	$('#pause').bind("click", function(event){
		$('#images').cycle('pause');
		$('#pause img').attr('src', '/share/image/pause_active.png');
	});

	$('#play').bind("click", function(event){
		$('#images').cycle('resume');
		$('#pause img').attr('src', '/share/image/pause.png');
	});
	
}); // document ready

function show_images() {
	$('#intro').fadeOut('slow');
	$('#text').css('opacity', '');
	$('#text').css('display', 'none');
	$('#text').removeAttr('class');
	$('#images').fadeIn(2000);
	$('#controls').fadeIn('slow');
	$('#images img:first').fadeIn(2000, function() {
		$('#images').cycle({
			fx: 'fadeout',
			prev: '#prev',
			next: '#next',
			cleartypeNoBg: true,
			startingSlide: 0,
			speed: 2000,
			timeout: 6000,
			before: clearCaption,
			after: showAlt,
		});
	});
}
function show_image() {
	$('#intro').fadeOut('slow');
	$('#text').css('opacity', '');
	$('#text').css('display', 'none');
	$('#text').removeAttr('class');
	$('#images').fadeIn(2000);
	$('#images img:first').fadeIn(2000, function() {
		$('#images').cycle({
			fx: 'fadeout',
			prev: '#prev',
			next: '#next',
			cleartypeNoBg: true,
			startingSlide: 0,
			speed: 2000,
			timeout: 6000,
			before: clearCaption,
			after: showAlt,
		});
	});
} // function show_image()

function showAlt() {
    if (this.alt != '') {
    	$('#caption').html(this.alt).fadeIn('slow');
    }
} // function showAlt

function clearCaption() {
	$('#caption').fadeOut('slow', function() {
		$('#caption').css('display', 'none');
		$('#caption').empty();
	});
} // function clearCaption

function show_hidden() {
	// alert('show_hidden');
	$('.hidden').fadeIn('slow', function() {
		$('.hidden').css('opacity', 1);
		$('#images img').fadeIn(1000);
		$('.hidden').removeClass('hidden');
	});
	
} // function show_hidden()

function show_intro() {
	$('#text').css('width', 370);
	$('#logo, .nav').fadeIn(1000);
	$('#text').delay(1000).fadeIn(1000);
	$('#cloud').delay(2000).fadeIn(1000);
} // function show_hidden()
