videoUp = false;

$(document).ready(function()
{
	$("#slideshow_control_bar_colored").animate({opacity: ".75"}, 1);
	
	$("li").hover(
	function()
	{
		$(this).find("a").addClass("activeSlide");
	},
	function()
	{
		$(this).find("a").removeClass("activeSlide");
	}
	);

	function onBefore (currSlideElement, nextSlideElement, options, forwardFlag)
	{
		$('#slideshow_slide_title').html($(this).attr("title"));
	}
	
	function onAfter (currSlideElement, nextSlideElement, options, forwardFlag) 
	{
	}
	
	function prevNext (isNext, index, element)
	{
	}

	$('.map').mouseover(function()
	{
		if(!videoUp)
		{
			$('#slideshow').cycle('pause');
		}
	});
	
	$('.map').mouseout(function()
	{
		if(!videoUp)
		{
			$('#slideshow').cycle('resume');
		}
	});
	
	
	$('#slideshow').cycle(
	{ 
		fx: 'scrollHorz',
		timeout: 5000,
		next: '#slideshow_next',
		prev: '#slideshow_previous',
		before: onBefore,
		after: onAfter,
		pager: '#slideshow_pager',
		prevNextClick: prevNext,
		nowrap: 0,
		pause: 1,
		pagerAnchorBuilder: function(idx, slide)
		{ 
			return '#slideshow_pager li:eq(' + idx + ') a';
		}
	});
	
	$(".slideshow_play_snapshot").click(function()
	{
		$("#slideshow_snapshot_slidedown").animate(
			{		
				top: "0px"
			}
			, 1000, 
			function()
			{
				$("#slideshow_snapshot_video").html("");
				$("#slideshow_snapshot_video").css("display", "block");
				$("#slideshow_snapshot_video").flash({src: $(".slideshow_play_snapshot").attr("videosrc"), width: 375, height: 235, allowfullscreen: true});
			}
		);
		$('#slideshow').cycle('pause');
		videoUp = true;
	});
	
	$(".slideshow_snapshot_back").click(function()
	{
		$("#slideshow_snapshot_video").css("display", "none");
		$("#slideshow_snapshot_slidedown").animate(
			{		
				top: "-383px"
			}
			, 1000, 
			function()
			{
			}
		);
		$('#slideshow').cycle('resume');
		videoUp = false;
	});

});

