if(!($.browser.msie && $.browser.version == 6)) {
	$(document).ready(function() {
		$('.slideshow').cycle({ 
		    fx:     'scrollHorz', 
		    prev:   '#prev', 
		    next:   '#next', 
		    after:  onAfter,
		    speed:  600, 
		    timeout: 7000 
		})
		
		// calls function on load so images appear immediately
		onAfter();
		
		//allows thumbnail of next image to show, and at end of cycle it reads the first image. And vice versa.
		function onAfter(){
			$(".slideshow img").each(function() {
				//if($(this).css("display") == "block") {
				//if($(this).css("display") == "block" || $(this).css("display") == "inline") {
				if($(this).css("display") != "none") {
			  		$(this).addClass("active");
			    } else {
			  		$(this).removeClass("active");
			    }
			});	
			
			if($(".slideshow img.active").is(':last-child') ){	//if it's the last child, then show the first child
				var nextImageSrc = $(".slideshow img:first-child").attr("src").replace(".png", "-thumb.png");
			} else {											//else show the next child
				var nextImageSrc = $(".slideshow img.active").next().attr("src").replace(".png", "-thumb.png");
			}
			var nextImage = $("<img />");
			nextImage.attr("src", nextImageSrc).addClass("nextImage");
			$("#next .nextImage").remove();
			nextImage.appendTo("#next");
			
			if($(".slideshow img.active").is(':first-child') ){	//if it's the last child, then show the first child
				var prevImageSrc = $(".slideshow img:last-child").attr("src").replace(".png", "-thumb.png");
			} else {											//else show the next child
				var prevImageSrc = $(".slideshow img.active").prev().attr("src").replace(".png", "-thumb.png");
			}
			var prevImage = $("<img />");
			prevImage.attr("src", prevImageSrc).addClass("prevImage");
			$("#prev .prevImage").remove();
			prevImage.appendTo("#prev");
		}
	  
	  /*Slides previous thumb on mouseover*/
		$("#prev").mouseover(function(){
			$(".prevImage").animate({left: '+=20px'}, 200);
			});
			
			// slide animation back on mouseout
			$("#prev").mouseout(function(){
			$(".prevImage").animate({left: '-=20px'}, 400);
			//$(".prevImage").stop();
		});
		
	  /*slides next thumb on mouseover*/
		$("#next").mouseover(function(){
			$(".nextImage").animate({right: '+=20px'}, 200);
			});
			
			// slide animation back on mouseout
			$("#next").mouseout(function(){
				$(".nextImage").animate({right: '-=20px'}, 400);
			//$(".nextImage").stop();
		});
	});
}

if($.browser.msie && $.browser.version == 6) {
	$(document).ready(function() {
		$('.slideshow-ie6').cycle({ 
		    fx:     'scrollHorz', 
		    speed:  600, 
		    timeout: 7000 
		})
		
		$('.nav').hide();
		$('img.hero1').hide();
		$('img.hero2').hide();
		$('img.hero3').hide();
	});
}




