﻿$(document).ready(function() {
	setInterval("startSlideshow()", 8000);
	
});

function startSlideshow() {
	var current = $("ul#images-left li:visible");
	var next = current.next();

	if (next.length == 0) {
		next = $("ul#images-left li:first");
	}

	current.fadeOut(2000, function() {
		$(this).css("display", "none");
		next.fadeIn(2000, function() {
			next.css("display", "block");

			$("#slideshowHeaderText").text(next.find("img").attr("alt"));
		});
	});
	setTimeout("startRightSlideshow()", 4000);
}

function startRightSlideshow() {
	var current = $("ul#images-right li:visible");
	var next = current.next();

	if (next.length == 0) {
		next = $("ul#images-right li:first");
	}

	current.fadeOut(2000, function() {
		$(this).css("display", "none");
		next.fadeIn(2000, function() {
			next.css("display", "block");

			$("#slideshowHeaderText").text(next.find("img").attr("alt"));
		});
	});
}
