// Init jcarousel with jquery...
	jQuery(function() {
		jQuery(".videoCarousel").jCarouselLite({
			btnNext: "#panerightbutton",
			btnPrev: "#paneleftbutton",
			visible: 4,
			circular: false,
			speed: 200
		});
	});



// Custom video funcitons
	
	currentVideoId = null;
	currentVideoCaption = null;
	defaultCaption = null;
	currentVideoLinkReference = null;
	
	function setCaption(caption)
	{
		document.getElementById('caption').innerHTML = ''+ caption;
	}
	// mover = highlight video
	function mover(o,caption)
	{
		o.className = 'linkOn';
		o.caption = caption;
		setCaption(o.caption);
	}
	// mout = de-highlight video
	function mout(o)
	{
		if (o.id!=currentVideoLinkReference.id)
		{
			document.getElementById(o.id).className = 'linkOff';
		}
		setCaption(defaultCaption);
	}
	// mclick = activate new video
	function mclick(o)
	{
		var previousVideoReference = currentVideoLinkReference;
		currentVideoLinkReference = o;
		defaultCaption = o.caption;
		currentVideoId = o.id;
		loadNewVideo(o.id);
		if (previousVideoReference)
		{
			mout(previousVideoReference);
		}

	}
	function embedVideo(videoId,videoCaption)
	{
		// Highlight video chooser (link) items
		var initVid = document.getElementById(videoId);
		mover(initVid,videoCaption);
		mclick(initVid);
		currentVideoLinkReference = initVid;
		
		// Set up swf object...
		var params = { allowScriptAccess: "always", bgcolor: "#212125", wmode:'transparent',showinfo:'0' };
		var atts = { id: "youtubePlayer" };
		swfobject.embedSWF("http://www.youtube.com/v/" + videoId + "?enablejsapi=1&playerapiid=ytplayer&rel=0&hd=1","videoplayer", "641", "387", "8", null, null, params, atts);
	}
	




// Youtube API
function loadNewVideo(id) {
	ytplayer = document.getElementById("youtubePlayer");
	if (ytplayer) {
		ytplayer.loadVideoById(id);
	}
}
function cueNewVideo(id, startSeconds) {
	ytplayer = document.getElementById("youtubePlayer");
	if (ytplayer) {
		ytplayer.cueVideoById(id, startSeconds);
	}
}


