// JavaScript Document

var $j = jQuery.noConflict();

$j(document).ready(function() {		
	
	//Execute the slideShow, set 4 seconds for each images
	slideShow(6000);
	
});

function slideShow(speed) {
 
	//Set the opacity of all images to 0
	$j('#splash li').css({opacity: 0.0});
	
	//Show the images
	$j('#splash li').css({visibility:'visible'});
	
	//Get the first image and display it (set it to full opacity)
	$j('#splash li:first').css({opacity: 0.0})
	    .animate({opacity:1.0}, 1000);
	
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery()',speed);
	
};
 
function gallery() {
 
	//if no IMGs have the show class, grab the first image
	var current = $j('#splash li.show');
 
	//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() : goodbye();
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	    .addClass('show')
		.animate({opacity: 1.0}, 1000);
	 
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	    .removeClass('show');
 
};

function goodbye() {
	// i dont have a clue
};

