//ccJs.js
var APIModules = {};
APIModules.EXPERIENCE = "experience";
APIModules.CONTENT = "content";
APIModules.VIDEO_PLAYER = "videoPlayer";
APIModules.SOCIAL = "social";
APIModules.SEARCH = "search";
APIModules.CUE_POINTS = "cuePoints";
APIModules.ADVERTISING = "advertising";
APIModules.MENU = "menu";
APIModules.EFFECTS = "effects";

if (MiomniMediaEvent == undefined) {
	var MiomniMediaEvent = {};
	MiomniMediaEvent.BEGIN = "mediaBegin";
	MiomniMediaEvent.BUFFER_BEGIN = "mediaBufferBegin";
	MiomniMediaEvent.BUFFER_COMPLETE = "mediaBufferComplete";
	MiomniMediaEvent.CHANGE = "mediaChange";
	MiomniMediaEvent.COMPLETE = "mediaComplete";
	MiomniMediaEvent.ERROR = "mediaError";
	MiomniMediaEvent.MUTE_CHANGE = "mediaMuteChange";
	MiomniMediaEvent.PLAY = "mediaPlay";
	MiomniMediaEvent.PROGRESS = "mediaProgress";
	MiomniMediaEvent.SEEK = "mediaSeek";
	MiomniMediaEvent.STOP = "mediaStop";
	MiomniMediaEvent.PAUSE = "mediaPause"; //added Nitin
	MiomniMediaEvent.REPLAY = "mediaReplay";//added Nitin
	MiomniMediaEvent.ITEM = "mediaItem";
	MiomniMediaEvent.VOLUME_CHANGE = "mediaVolumeChange";
	MiomniMediaEvent.ON_META_DATA = "onMetaData";
	MiomniMediaEvent.ON_VIDEO_END = "onVideoEnd";
	MiomniMediaEvent.ON_VIDEO_CHANGE = "onVideoChange";
	
}

var myMovie;
function miomni(){};


miomni.getExperience = function (pExperience) 
{
	var mov = new myFlashMovie(getFlashMovieObject(pExperience));
	return mov;
};


function myFlashMovie(instance)
{    
	this.instance = instance;
}

var pttp = myFlashMovie.prototype;

pttp.getModule = function(){
	//
	
}

pttp.addEventListener = function(pEvent,pHandler) 
{
	this.instance.registerEventsInFlashFromJavaScript(pEvent,pHandler);
}

pttp.seek = function(val)
{
	this.instance.seekVideo(val);
}
pttp.pause = function()
{
	this.instance.pauseVideo();
}
pttp.play = function()
{
	this.instance.playVideo();
	
}
pttp.replay = function()
{
	this.instance.replayVideo();
	
}
pttp.stop = function()
{
	this.instance.stopVideo();
	
}
pttp.item = function(id, res)
{
	
	this.instance.playItem(id,res);

}
function getFlashMovieObject(movieName)
{
	if (window.document[movieName]) 
	{
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
		if (document.embeds && document.embeds[movieName])
		return document.embeds[movieName]; 
	}
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById(movieName);
	}
}   

			
function embedVideo(source,destination,width,height,backgroundColor,vars)
{
		var flashvars = false;
		var params = {
			flashvars: vars,
			bgcolor:backgroundColor,
			allowScriptAccess:"always",
			allowFullScreen:"true"
		};
		var attributes = {
			id: "myExperience",
			name: "myExperience"
		};
		
		swfobject.embedSWF(
				source, 
				destination, 
				width, 
				height, 
				"10.0.0",
				"expressInstall.swf", 
				flashvars, 
				params, 
				attributes
			);	
}			

