var displayTime = 7000;		// Duration of each slide in milliseconds; 1000 milliseconds = 1 second.
var transTime = 1000;		// Duration of transition in milliseconds; 1000 milliseconds = 1 second.


// Don't mess with anything below this point unless you
// intend to modify the functionality of the script.

$(function()
{
	// Get all the slides in #slideBox.
	var slides = $('#slideBox img');
	
	// fadeOut all slides except the first one.
	for (i = 1; i < slides.length; i++)
	{
		$(slides[i]).fadeOut(0);
	}
	
	// This function is called in the variable "int" below.
	function slideShow()
	{
		if(slides.length > 1){
			// If we haven't reached the last slide,
			if (j < slides.length)
			{
				// then fadeIn the next slide,
				$(slides[j]).fadeIn(transTime);
				
				// and increase the counter for the next go-round.
				j++;
			}
			
			// If we have reached the last slide,
			else
			{
				// then get all of the slides EXCEPT the first and last ones,
				for (k = 1; k < slides.length-1; k++)
				{
					// and fade them out.
					$(slides[k]).fadeOut(0);
				}
				
				// Then fadeOut the last slide, revealing the first slide underneath.
				$(slides[slides.length-1]).fadeOut(transTime);
				
				// Reset the counter.
				j = 1;
			}
		}
	}
	
	// Set the initial counter value for slideShow() function.
	var j = 1;
	
	// Call slideShow() at the interval set in displayTime.
	var int = setInterval(slideShow, displayTime);
	
/*
	// Bind the goTo() function to links with the class "goTo".
	$('a.goTo').click(function goTo(event)
	{
		// The desired slide number is stored in the "href" attribute.
		var l = $(this).attr('title');

		// Make all slides invisible.
		for (m = 0; m < slides.length; m++)
		{
			$(slides[m]).fadeOut(0);
		}
		
		// Make the desired slide visible.
		$(slides[l]).fadeIn(0);
		
		// Stop hyperlink from executing.
		event.preventDefault();
		
		// Stop the setInterval() of slideShow().
		clearInterval(int);
	});
*/

});








