(function($) {
	$.fn.run_slideshow = function () {
		$(this).animate({opacity:"1.0"}, 5000, function() {
			$(".slideshow-item",$(this)).each(function(index) {
				if($(this).hasClass("show") !== false) {
					$(this).removeClass("show");
					if($(".slideshow-item:nth-child("+(index+2)+")").length) {
						$(".slideshow-item:nth-child("+(index+1)+")").fadeOut(400, function() {
							$("#slideshow ul li a").removeClass("selected");
							$("#slideshow ul li:nth-child("+(index+2)+") a").addClass("selected");																								
						});
						$(".slideshow-item:nth-child("+(index+2)+")").addClass("show").fadeIn(1000);
					} else {
						$(".slideshow-item:nth-child("+(index+1)+")").fadeOut(400, function() {
							$("#slideshow ul li a").removeClass("selected");
							$("#slideshow ul li:nth-child(1) a").addClass("selected");																									
						});
						$(".slideshow-item:nth-child(1)").addClass("show").fadeIn(1000);
					}
					return false;
				}
			});
			$(this).run_slideshow();
			return $(this);
		});
	}
})(jQuery);
$(document).ready(function() {
	$("#rotation").run_slideshow();
	$("#slideshow ul li").live("click",function() {
		var position = $(this).index()+1;
		$("#rotation").stop(true).run_slideshow();
		$("#slideshow ul li a").removeClass("selected");
		$("a", $(this)).addClass("selected");
		$(".slideshow-item").fadeOut(400).removeClass("show");
		$(".slideshow-item:nth-child("+(position)+")").fadeIn(1000).addClass("show");
	});
	if($.browser.msie && $.browser.version*1 <= 6) {
		alert("This website is geared for Internet Explorer 7 and up. You are currently using Internet Explorer 6 or older, please use a more up to date browser for optimal viewing of the website.");
	}
});
