

function slideShow() {
	
	//Set the opacity of all images to 0
	$('#photo a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#photo a:first').css({opacity: 1.0});
	
	//Set the caption background to semi-transparent
	$('#photo .caption').css({opacity: 0.6});

	//Resize the width of the caption according to the image width
	$('#photo .caption').css({width: $('#photo a').find('img').css('width')});
	
	//Get the caption of the first image from REL attribute and display it
	$('#photo .content').html(text[0])
	.animate({opacity: 1.0}, 400);
	$('#photo .content').css({opacity: 1.0});

		
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('photo()',4000);
}



function photo() {
	//if no IMGs have the show class, grab the first image
	
	if (i==true) {
	var current = ($('#photo a.show')?  $('#photo a.show') : $('#photo a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#photo a:first') :current.next()) : $('#photo a:first'));	
	//menu
	var currentm = $('#carus-box .title-box a.actcarus');
	
	//Get next image caption
	var index = $("#carus-box .title-box a").index(currentm);
	
	//$('#carus-box .title-box a').addClass('active');
	//Set the fade in effect for the next image, show class has higher z-index
	
	
	
	currentm.removeClass('actcarus');
	if (currentm.next().hasClass('last')==true) {
		$('#carus-box .title-box a:first').addClass('actcarus');
	} else {
	currentm.next().addClass('actcarus');
	};
	//currentm.removeClass('active');
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	
	
	//Set the opacity to 0 and height to 1px
	$('#photo .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	$('#photo .caption').animate({opacity: 0.6},100 ).animate({height: '76px'},500 );
	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Display the content
	if (index==3)
	{ var caption = text[0]; } else {
	var caption = text[index+1];
	};
	$('#photo .content').html(caption);
	};
};


