Slideshow = {};
Slideshow.position = 1;
Slideshow.length = 0;
Slideshow.images = [];
Slideshow.duration = 7000;
Slideshow.interval = 0;

Slideshow.Preload = function (slideshow_array) {
	$(slideshow_array).each(function (){
		$('<img src="' + this + '" />');
	});

};

Slideshow.Next = function () {
	Slideshow.position++;
	if (Slideshow.position >= Slideshow.length) {
		Slideshow.position = 0;
	}
	var next_url = Slideshow.images[Slideshow.position];
	var next = $('.satori-slideshow img.next');
	if (next.length == 0) {
		var image_html = "<img src='" + next_url + "' alt='Preschool, Elementary, and Middle School Education' class='next' />";
		$('.satori-slideshow img.active').after(image_html);
		next = $('.satori-slideshow img.next');
	}
	else {
		next.attr('src', next_url);
	}
	$('.satori-slideshow img.active').fadeOut('slow', function () {
		$(".satori-slideshow img.active").removeClass('active');
		next.addClass('active')
		next.removeClass('next');
		$(this).addClass('next');
		$(this).show();
	});
};

Slideshow.Init = function () {
	Slideshow.images = slideshow_photos;
	Slideshow.length = Slideshow.images.length;
	Slideshow.interval = setInterval("Slideshow.Next()", Slideshow.duration);
};

$(document).ready(function(){

	$(".menu ul li").hover(function(){
		$(this).addClass("hover");
	}, function(){
		$(this).removeClass("hover");
	});

	$(".menu ul li a, .submenu a").each ( function () {
		if ($(this).attr('href') == document.URL) {
			$(this).addClass('active-page');
		}
	} );

	$(".star-group").hover(function () {
		$(".stars .selected").removeClass('selected');
		$(this).children('img').addClass('selected');
		$(".star-group img:not(.selected)").toggle();
	}, function () {
		$(".stars img.selected").removeClass('selected');
		$(".stars img:not(.faded)").show();
		$(".stars img.faded").hide();
	});

	$(".star-group img").css('cursor', 'pointer');

	if ($('.satori-slideshow').length > 0) {
		Slideshow.Init();
	}

});

