var player    =  null;
var playlist  =  null;

function playerReady(obj) {
	player = document.getElementById(obj['id']);
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'350px'},{queue:false,duration:160});
		$(".cover").show();			
	}, function() {
		$(".cover").hide();			
		$(".cover", this).stop().animate({top:'4109px'},{queue:false,duration:160});
	});		
	addListeners();
};

function addListeners(){
	playlist = player.getPlaylist();
	if((playlist !== null) && (playlist !== undefined)){
	  player.addModelListener('STATE', 'stateMonitor');
	} else {
	  setTimeout("addListeners();", 100);
	}
};

function stateMonitor(obj){
	if(obj.newstate == 'COMPLETED'){
		$("#player_alt").hide();
		$("#pflow").show();	
	} 
};
onLoadFunctionList = new Array();
function performOnLoadFunctions(){
	for (var i in onLoadFunctionList){
		onLoadFunctionList[i]();
	}
}

if (top.location != location) { top.location.href = document.location.href; }	