$(document).ready(function() {		//Show Banner	$(".main-image .desc").show(); //Show Banner	$(".main-image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity	// set the first list item to be active	var activeElement = $(".image-thumb ul li:first");	// add the active class to the active element	activeElement.addClass('active');	// rotate function which will be used to rotate between the images	function rotate(elements) {			// define the next element variable		var nextElement = null;		// list of elements, so let's find the next active one		if(elements.length > 1) {			// grab the current "index" using the numbers from the a tags minus 1 (because			// the index starts at "0")			var currentIndex = activeElement.find('a').html();						// if the current list index is greater than the length of the list			// then start over, otherwise move to the next item 			nextElement = (currentIndex >= elements.length) ? elements[0] : elements[currentIndex];		} else {			// click event so just grab the element			nextElement = elements;		}				// set the active element		activeElement = $(nextElement);				//Set Variables		var imgAlt = $(nextElement).find('img').attr("alt"); //Get Alt Tag of Image		var imgTitle = $(nextElement).find('a').attr("href"); //Get Main Image URL		var imgDesc = $(nextElement).find('.block').html(); 	//Get HTML of block		var imgDescHeight = $(".main-image").find('.block').height();	//Calculate height of block					if (!$(nextElement).is(".active")) {  //If it's not already active			//Animate the Teaser					$(".main-image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {				$(".main-image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );				$(".main-image img").attr({ src: imgTitle , alt: imgAlt});			});		}				$(".image-thumb ul li").removeClass('active'); //Remove class of 'active' on all lists		$(nextElement).addClass('active');  //add class of 'active' on this list only				// set our timeout again so that we continue to auto rotate		timeout = setTimeout(function() { rotate($(".image-thumb ul li")); }, 5000);	}	// set our timeout which will auto-rotate the list	var timeout = setTimeout(function() { rotate($(".image-thumb ul li")); }, 5000);	//Click and Hover events for thumbnail list	$(".image-thumb ul li").click(function() {				// when a user clicks on one of the buttons we want to reset the timer		clearTimeout(timeout);				// call our rotate function		rotate(this);				// don't click through		return false;			}).hover(function(){		$(this).addClass('hover');	}, function() {		$(this).removeClass('hover');	});		$(".main-image").hover(function() {		// clear the timeout when we hover over the main image		clearTimeout(timeout);	}, function() {		// set our timeout again		timeout = setTimeout(function() { rotate($(".image-thumb ul li")); }, 5000);	});		//Toggle Teaser	$("a.collapse").click(function(){		$(".main-image .block").slideToggle();		$("a.collapse").toggleClass("show");	});	});//Close Function