$(document).ready(function(){
	
	
	$('.video_link').click(function(){
		var video = ($(this).attr('rel'));
		getFlashMovie("vid_player").playVideo(video, true, true);
		return false;
	});
	
	$('#video_home_thumbs').jScrollPane();

	revolveTweets();
	// $('a[@rel$='external']').click(function(){
	//   this.target = "_blank";
	// });
});



function playerReady(vidstring){
	setTimeout("loadFirstMovie(vidstring)",1500);
}

function loadFirstMovie(vidstring){
		getFlashMovie("vid_player").playVideo(vidstring, false, true);
}

// function videoFinished(path){	
// 		getFlashMovie("vid_player").playVideo("http://www.youtube.com/v/--t6CPpHPxU", true, true);
// }

	
function getFlashMovie(movieName) {
	movieName = swfobject.getObjectById(movieName);
	return movieName;
}


// Function to revolve throught a list of tweets.
function revolveTweets(){
	// First fade out the active_tweet div.
	$('.active_tweet').show();
	$('.active_tweet').animate({opacity: 1.0}, 5000).fadeOut('slow', function() {
		$(this).removeClass('active_tweet');		
		// Now check if there is a next div. If there isn't add the active_tweet class to the first div in the list.
		if ($(this).next('div').size() > 0) {
			$(this).next('div').addClass('active_tweet');
		} else {
			$('.div_tweet:first').addClass('active_tweet');
		}		
		revolveTweets();
	});
};