//swfobject.registerObject('global_video_player');

function FlashVideoCommunication () {

	this.collectionTitle 	= null;
	this.episodeType 		= null;
	this.episodeTitle 		= null;
	this.pageUrl 			= null;
	this.pathVideoPlayList	= null;
	this.playEndSlate 		= false;
	this.ranking			= null;

	this.segments			= new Array();
	
	this.swfIsReady			= false;
	this.t;	
}

FlashVideoCommunication.prototype.addSegment = function (p_duration, p_segmentId, p_thumbnailUrl){
		var segment = new Object();

		segment.duration 		= p_duration;
		segment.segmentId 		= p_segmentId;
		segment.thumbnailUrl 	= p_thumbnailUrl;

		this.segments.push(segment);
}

FlashVideoCommunication.prototype.playVideo = function (){

	var videoPlayer = getFlashMovie("global_video_player");
	var o = new Object();

	o.segments 			= this.segments;
	o.collectionTitle 	= this.collectionTitle;
	o.episodeType 		= this.episodeType;
	o.episodeTitle 		= this.episodeTitle;
	o.pageUrl 			= this.pageUrl;
	o.pathVideoPlayList = this.pathVideoPlayList;
	o.playEndSlate 		= this.playEndSlate;
	o.ranking 			= this.ranking;
	
	videoPlayer.videoRequested(o);

}

FlashVideoCommunication.prototype.sendEmail = function (p_url){

	var videoPlayer = getFlashMovie("global_video_player");
	videoPlayer.sendToFriend();	

}

function getFlashMovie(movieName){

	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];

}

FlashVideoCommunication.prototype.onVideoStateChange = function (val){

	this.videoPlayerState.value = val;

}

FlashVideoCommunication.prototype.onReady = function (){

	this.swfIsReady = true;

}

FlashVideoCommunication.prototype.onAlert = function (val){

	alert(val);

}

FlashVideoCommunication.prototype.onPauseVideo = function (){

	var videoPlayer = getFlashMovie("global_video_player");
	videoPlayer.onPauseVideo();	

}

FlashVideoCommunication.prototype.onResumeVideo = function (){

	var videoPlayer = getFlashMovie("global_video_player");
	videoPlayer.onResumeVideo();	

}

FlashVideoCommunication.prototype.onShowEndSlate = function (){

	var videoPlayer = getFlashMovie("global_video_player");
	videoPlayer.onShowEndSlate();	

}




