//MyPlayer = Player.getPlayerById("player0");

jQuery(document).ready(function(){ 
	jQuery("#fullTextLink").bind("click", function(){ EVERYZING.playerControls.openTranscript(); })
});

EVERYZING = EVERYZING || {};
EVERYZING.util = EVERYZING.util || {};
EVERYZING.playerControls = EVERYZING.playerControls || {};


EVERYZING.util.Logger = function (message){
  if(window.console) console.log(message)
  else alert(message);
}

EVERYZING.playerControls.jumpPlayerTo = function(time){
	playerInst0.seek(time);
}

// opens up full transcript in popup
EVERYZING.playerControls.openTranscript = function(){
	var pWidth = 520; // width of popup
	var pHeight = 520; // width of popup
	var leftPos = screen.width - pWidth - 100; // 100px from right of screen
	var topPos = (screen.height - pHeight)/2; // vertically centered
	var win = window.open(location.href.replace("/m/", "/transcript/"), "Transcript", "left=" + leftPos + ",top=" + topPos + ",width=" + pWidth + ",height=" + pHeight + ",resizable,scrollbars");
}

//Overriding default pathways to objects
// Called from Flash when new media loaded (e.g., continuous play, highlights reel)
function setEzMediaTitle(value){
	jQuery(".ez-mediaMain h1").attr("title", value);
	jQuery(".ez-mediaMain h1 .ez-media-info-title").text(value);
}
EVERYZING.metaPlayerRequest.setTitle = setEzMediaTitle;

function setEzMediaPubDate(value){
	jQuery(".ez-mediaMain p .featured-ep-pub-date").text(value);
}
EVERYZING.metaPlayerRequest.setPubDate = setEzMediaPubDate;

function setEzMediaDescription(value){
	jQuery(".ez-mediaMain p .ez-playerMod-episode-description").text(value);
}
EVERYZING.metaPlayerRequest.setDescription = setEzMediaDescription;

// When the "lander" video is finished, remove the full transcript because it's
// no longer relevant. (We may, in future, refresh the text via Ajax or whatever.)
function removeEzMediaTranscript() {
	jQuery("#fullTranscript").hide();
	jQuery("#fullTranscriptLink").hide();
}
EVERYZING.metaPlayerRequest.removeFullTextTranscript = removeEzMediaTranscript;