$(document).ready(function()
{
	// Get the current length of the slideshow.
	var slideLength = ($("#slideshow .slide-image").length - 1);
	
	// start positions.
	var slideToShow = 1;
	var slideToHide = 0;
	
	// Start the slide show.
	setTimeout(function()
	{
		swapSlide();
	}, 5000);
	
	function swapSlide()
	{
		// Force the green background color.
		$("#main-nav").css("background-color", "#c1d732");
	
		// Fade out / fade in.
		$("#slide-"+slideToShow).fadeIn(4000);
		$("#slide-"+slideToHide).fadeOut(4000);
		
		// The next slide to hide is the slide that we have just shown.
		slideToHide++;
		
		// Update the slide to show var.
		slideToShow++;
		
		// Check if we haven't reached the max.
		if(slideToShow > slideLength) slideToShow = 0;
		if(slideToHide > slideLength) slideToHide = 0;
		
		setTimeout(function()
		{
			swapSlide();
		}, 5000);
		
	}
	
	// Hover effects for on the home page (list).
	$("#cats li").mouseover(function()
	{
		// Get the current class.
		currentClass = $(this).attr("class");
		
		// The currentClass + hover.
		currentClass = currentClass + "_hover";
		
		// Append the new class.
		$(this).attr("class", currentClass);
	});
	
	// Hover effects for on the home page (list).
	$("#cats li").mouseout(function()
	{
		// Get the current class.
		currentClass = $(this).attr("class");
		
		// Strip the _hover from the name.
		currentClass = currentClass.replace("_hover", "");
		
		// Append the new class.
		$(this).attr("class", currentClass);
	});
	
	$("a[rel^='prettyphoto']").prettyPhoto({overlay_gallery: false});
});
