$(document).ready(function(){
	if($("#content").height()<500){
		$("#content").height(500);
	}
	var globalTimer;
	var speed = 5000;
	var currentSlide = 0;
	var totalSlides = $("#headersList UL LI").length;
	nextSlide();
	if(totalSlides>1){
		globalTimer=setTimeout(nextSlide,speed);
	}

	//SET UP TIMER FOR SLIDESHOW
	function nextSlide(){
		clearTimeout(globalTimer);
		if(currentSlide>(totalSlides-2))
		{
			currentSlide = 0;	
		} else {
			currentSlide++
		}
		goTo(currentSlide);
		globalTimer=setTimeout(nextSlide,speed);	
	}
	
	function goTo(current){
		loadImg($("#headersList UL LI:eq("+current+")").html());
	}
	
	function loadImg(src){
		if($("#spotLightContainer img").length>1){
			$("#spotLightContainer img:eq(0)").remove();
		}
		var img = new Image();
		$(img).load(function(){
			$(this).hide();
			$("#spotLightContainer").append(this);
			$(this).fadeIn("slow");
		}).attr('src',src)
		return false;
	}
})
