/* Requires: jquery, jquery.cycle.1.1+ */
/* Do all the following once the page is fully loaded */
$(document).ready(function() {
	/* Initialize the slideshow using the following slides: */
	var slides = new Array({
		filename:"collaboration.jpg",
		caption:"University Lake School - Libertas Veritate - Collaboration"
	},{
		filename:"confidence.jpg",
		caption:"University Lake School - Libertas Veritate - Confidence"
	},{
		filename:"creativity.jpg",
		caption:"University Lake School - Libertas Veritate - Creativity"
	},{
		filename:"curiosity.jpg",
		caption:"University Lake School - Libertas Veritate - Curiosity"
	},{
		filename:"exploration.jpg",
		caption:"University Lake School - Libertas Veritate - Exploration"
	},{
		filename:"guidance.jpg",
		caption:"University Lake School - Libertas Veritate - Guidance"
	},{
		filename:"independence.jpg",
		caption:"University Lake School - Libertas Veritate - Independence"
	},{
		filename:"individuality.jpg",
		caption:"University Lake School - Libertas Veritate - Individuality"
	},{
		filename:"leadership.jpg",
		caption:"University Lake School - Libertas Veritate - Leadership"
	},{
		filename:"stewardship.jpg",
		caption:"University Lake School - Libertas Veritate - Stewardship"
	},{
		filename:"tradition.jpg",
		caption:"University Lake School - Libertas Veritate - Tradition"
	},{
		filename:"wonder.jpg",
		caption:"University Lake School - Libertas Veritate - Wonder"
	});
	// Produce a random ordering of the indices (Fisher-Yates shuffle)
	var count = slides.length;
	var index = new Array();
	for (var i = 0; i < count; ++i) { index[i] = i; }
	for (var i = 0; i < count; ++i) {
		var j = Math.floor(Math.random() * i);
		var temp = index[i];
		index[i] = index[j];
		index[j] = temp;
	}
	// Repopulate the area and cycle through the images using that ordering
	$('#slideshow').empty();
	for (var i = 0; i < count; ++i) {
		$('#slideshow').append('<img src="DesignData/Images/slideshow/' + slides[index[i]].filename + '" alt="' + slides[index[i]].caption + '" title="' + slides[index[i]].caption + '" />');
	}
	$('#slideshow').cycle();

	/* Randomize the bench picture from among the following possibilities: */
	var bench_pics = new Array({
		filename:"student_community.png",
		caption:"University Lake School - Student Community"
	},{
		filename:"lower_school_activities.png",
		caption:"University Lake School - Lower School Activities"
	},{
		filename:"teaching_staff.png",
		caption:"University Lake School - Teaching Staff"
	},{
		filename:"class_reading.png",
		caption:"University Lake School - Class Reading"
	},{
		filename:"upper_school_students.png",
		caption:"University Lake School - Upper School Students"
	});
	var i = Math.floor(Math.random() * bench_pics.length);
	$('#bench img').attr('src', 'DesignData/Images/bench/' + bench_pics[i].filename).attr('alt', bench_pics[i].caption).attr('title', bench_pics[i].caption);
});

