/*	Note: if you would like to change the number of screenshots that are used, just change
	the following value and the script will adjust accordingly. */
var screenshotCount = 5;
/*	This is a relative link to where the slideshow images or stored on the server.
	This can also be changed and the script will adjust. */
var screenshotDirectory = "/images/";
/*	END SETTINGS */


var currentScreenshot = 0;
var language;

$(function() {
 	language = $('body').attr("class");
	initSlideshow();
	rotateScreenshots();
	window.setInterval("rotateScreenshots();", 2000);
});

function initSlideshow() {
	var screenshotList = $('<ul></ul>');
	for (var i = 1; i <= screenshotCount; i++) {
		$(screenshotList).append('<li id="screen' + i + '"><img src="' + screenshotDirectory + 'screenshot-' + i + '-' + language + '.jpg" alt="" /></li>');
	}
	$(screenshotList).appendTo('#slideshow');
}

function rotateScreenshots() {
	if (currentScreenshot != screenshotCount) {
		currentScreenshot++;
		$('#screen' + currentScreenshot).fadeIn("slow");	
	} else {
		currentScreenshot = 1;
		for (var i = 2; i < screenshotCount; i++) {
			$('#screen' + i).hide();
		}
		$('#screen' + screenshotCount).fadeOut("slow");
	}
}
