$(document).ready(function(){
													 
//set up for show													 
$(".image_list ul li:first").addClass('active');

$(".image_list ul li:last").addClass('last');

//main rotator function
$(".image_list ul li").click(function() {
	var imgAlt = $(this).find('img').attr("alt"); //get alt tag of image
	var imgTitle = $(this).find('a').attr("href"); //get image url
	var imgDesc = $(this).find('.block').html(); //get text
	
	if ($(this).is("active")) {
		return false;
	} else {
		//animate
		$(".main_image img").animate({ opacity: .25}, 800);
		$(".main_image .block").animate({opacity: 0}, 800, function() {
		$(".main_image img").attr({'src': imgTitle, 'alt': imgAlt}).animate({ opacity: 1}, 600);
		$(".main_image .block").html(imgDesc).animate({ opacity: 1}, 600);
		});
	}
	
	$(".image_list ul li").removeClass('active');
	$(this).addClass('active');
	return false;
});
													 
//define next photo
var clickNext = function() {
	var $next_li = $("li.active").next("li");
	if($("li.active").hasClass("last")) {
		$(".image_list ul li:first").trigger("click");
	} else {
		$next_li.trigger("click");
	}
}
													 
var slideTimer = setInterval(clickNext, 5000);												 
													 
});

