$(document).ready( function(){	
	// LOAD PLAYER AND PLAYLIST 
	//setup player 
	var play = $f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.2.swf", {
	   /*clip:{
			onStart: function(clip) {
				$("#player_api").attr('wmode','transparent');
			}
		},	 */ 
       plugins: {
		viral: {
			// load the viral videos plugin
			url: 'flowplayer.viralvideos-3.2.1.swf',
			
			// define a video title used in sharing
			share: {
				description: 'Piccolo Chef - We like GOOD food' 
			}
		}
	}
			
	// playlist plugin  
	}).playlist("div.entries");
	//play first one (autoplay)
	play.play($("div.entries a:first").attr('href'));
	// init playlist carousel
	$("#pl").scrollable({ circular: true });			
	
	$("div.entries a.video-clip").click( function(){
		play.play($(this).attr('href'));
	});
	
	// ------------------------------------------------------------
	// SHOW CREDITS	
	$("a.lnk-show-credits").click( function(){
		
		$(".video-show-credits").hide();
		$(".video-show-credits").html("<span class='close'></span>");
		
		var pos = $(this).offset();
		var txt = $(this).next('.show-credits').text();
		$(".video-show-credits").append(txt);
		$(".video-show-credits").css('top',pos.top);
		$(".video-show-credits").css('left',pos.left);
		$(".video-show-credits").css('z-index','1000000000000000');
		$(".video-show-credits").show();
		
		$(".video-show-credits .close").click( function(){
			$(".video-show-credits").hide();
			$(".video-show-credits").html("<span class='close'></span>");
		});
	});
	
	$(".video-show-credits").hide();
});
