// JavaScript Document
function slideShow() {

	$('#gallery span').css({opacity: 0.0});

	$('#gallery span:first').css({opacity: 1.0});

	$('#gallery .caption').css({opacity:1.0});

	$('#gallery .caption').css({width: $('#gallery span').find('img').css('width')});

	$('#gallery .content').html($('#gallery span:first').find('img').attr('rel')).animate({opacity: 1.0}, 400);

	setInterval('gallery()',6000);
	
}

function gallery() {

	var current = ($('#gallery span.show')?  $('#gallery span.show') : $('#gallery span:first'));
	var next ;
	if(current.next().length > 0)
		next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery span:first') :current.next()) : $('#gallery span:first'));	

	var caption = next.find('img').attr('rel');	

	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');

	$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	

	$('#gallery .caption').animate({opacity: 1.0},100 ).animate({height: '37px'},500 );

	$('#gallery .content').html(caption);
	
	
}
