/*$(document).ready(function () {
	if ($('#videos').length != 0) {
		
		var videoList = $('.video-list li');
		var videoListTotal = $(videoList).length;
		
		if (videoListTotal == 2) $('a.next, a.back').hide(); 
		
		var divider = parseInt(videoListTotal / 2);
		
		$('.video-list ul').css('width', ($(videoList).width() * videoListTotal) + ((parseInt($('.video-list li').css('margin-left')) * 2) * (videoListTotal * 2)) +'px');
		
		var videoListPaneWidth = $('.video-list').width();
		var videoListContainerWidth = $('.video-list ul').width();
		
		var stopScroll = '';
		
		$('a.next').click(function (e) {
			var scrollAmount;
			var scrollMax;
			var scrollPos = parseInt($('.video-list ul').css('margin-left'));
			var scrollMargin = videoListPaneWidth * (divider - 1);
			
			if (videoListTotal - (divider * 2) == 0) {
				scrollMax = 0 - scrollMargin;
				scrollAmount = '-='+videoListPaneWidth+'px';
			} else {
				scrollMax = 0 - ( (videoListPaneWidth * divider) - (videoListPaneWidth / 2) );
				scrollLimit = 0 - scrollMargin;
				if (scrollPos == scrollLimit) {
					scrollAmount = '-='+(videoListContainerWidth / videoListTotal)+'px';
				} else {
					scrollAmount = '-='+videoListPaneWidth+'px';
				}
			}
			
			if (scrollPos != scrollMax && stopScroll != true) {
				$('.video-list ul').animate( 
					{ marginLeft:  scrollAmount} ,
					{ duration: 1000 ,
					  complete: function () {
						  stopScroll = false;
					  } }
				);
				stopScroll = true;
			}
			e.preventDefault();
			e.stopPropagation();
		});
		
		$('a.back').click(function (e) {
			var scrollAmount;
			var scrollMax;
			var scrollPos = parseInt($('.video-list ul').css('margin-left'));
			var scrollMargin = videoListPaneWidth * (divider - 1);
			
			if (videoListTotal - (divider * 2) == 0) {
				scrollMax = scrollMargin;
				scrollAmount = '+='+videoListPaneWidth+'px';
			} else {
				scrollMax = ( (videoListPaneWidth * divider) - (videoListPaneWidth / 2) );
				scrollLimit = 0 - (videoListContainerWidth / videoListTotal);
				if (scrollPos == scrollLimit) {
					scrollAmount = '+='+(videoListContainerWidth / videoListTotal)+'px';
				} else {
					scrollAmount = '+='+videoListPaneWidth+'px';
				}
			}
			
			if (scrollPos != 0 && stopScroll != true) {
				$('.video-list ul').animate( 
					{ marginLeft:  scrollAmount} ,
					{ duration: 1000 ,
					  complete: function () {
						  stopScroll = false;
					  } }
				);
				stopScroll = true;
			}
			e.preventDefault();
			e.stopPropagation();
		});
		
		$('.video-list a').click(function (e) {
			if ($('.video-list li').hasClass('active')) $('.video-list li').removeClass('active');
			$(this).parent().addClass('active');
			
			var videoFile = $(this).attr('href');
			var captionFile = $(this).attr('rel');
			
			jwplayer('mediaplayer').setup({
			  'flashplayer': '../jwplayer/player.swf',
			  'id': 'playerID',
			  'width': '550',
			  'height': '440',
			  'file': videoFile,
			  'plugins': {
				 'captions-2': {
					 'file': captionFile
				 }
			  }
			});
			
			e.preventDefault();
			e.stopPropagation();
		});
		
		
		function initMediaPlayer () {
			
			var defaultVideo = $(videoList[0]).find('a').attr('href');
			var defaultCaption = $(videoList[0]).find('a').attr('ref');
			
			jwplayer('mediaplayer').setup({
			  'flashplayer': '../jwplayer/player.swf',
			  'id': 'playerID',
			  'width': '550',
			  'height': '440',
			  'file': defaultVideo,
			  'plugins': {
				 'captions-2': {
					 'file': defaultCaption
				 }
			  }
			});
		}
		
		initMediaPlayer();
	}
});*/
