function slideShow() {
	$('#gallery img').css({opacity: 0.0});
	$('#gallery img:first').css({opacity: 1.0});
	$('#gallery .content').html($('#gallery span:first').text());
	
	var url = $('#gallery img:first').attr('longdesc');
	if (url != '') {
		$('#gallery').css({'cursor': 'pointer'});
		$('#gallery').click(function() {window.location.href=url});
	} else {
		$('#gallery').css({'cursor': 'default'});
		$('#gallery').click(function() {return false});
	}
	
	setTimeout(gallery, $('#gallery img:first').attr('rel'));
	setTimeout(text, $('#gallery span:first').attr('title'));	
}

function gallery() {
	var current = ($('#gallery img.show') ? $('#gallery img.show') : $('#gallery img:first'));
	var next = ((current.next('img').length) ? current.next('img') : $('#gallery img:first'));
	var url = next.attr('longdesc');
		
	if (url != '') {
		$('#gallery').css({'cursor': 'pointer'});
		$('#gallery').click(function() {window.location.href=url});
	} else {
		$('#gallery').css({'cursor': 'default'});
		$('#gallery').click(function() {return false});
	}
	
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	current.animate({opacity: 0.0}, 1000).removeClass('show');
	
	setTimeout(gallery, next.attr('rel'));	
}

function text() {
	var current = ($('#gallery span.show') ? $('#gallery span.show') : $('#gallery span:first'));
	var next = ((current.next('span').length) ? current.next('span') : $('#gallery span:first'));	
	
	next.addClass('show');
	current.removeClass('show');

	$('#gallery .content').html(next.text());
	setTimeout(text, next.attr('title'));	
}

