// WPS Player Javascript Framework
var player;
var videoInfo;
var videoList;
var catList;

function setComponentID(type, id) {
	if(type == "player") {
		player = id;
	}
	else if (type == "videoInfo") {
		videoInfo = id;
	}
	else if (type == "videoList") {
		videoList = id;
	}
}

function callToComponent(component, data) {
	setTimeout(function() {
		if (component == "player") {
			if (typeof(thisMovie(player)) != "undefined" && typeof (thisMovie(player).callIn) != "undefined") {
				thisMovie(player).callIn(data);
			}
		}
		if (component == "videoInfo") {
			if (typeof (thisMovie(videoInfo)) != "undefined" && typeof (thisMovie(videoInfo).callIn) != "undefined" && typeof (data.data) != "undefined") {
				thisMovie(videoInfo).callIn(data);
			}
		}
		if (component == "videoList") {
			if (typeof (thisMovie(videoList)) != "undefined" && typeof (thisMovie(videoList).callIn) != "undefined")
				thisMovie(videoList).callIn(data);
		}
	}, 0);
}

// METHOD TO PROPERLY ADDRESS FLASH MOVIE IN FIREFOX AND IE // 
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return $(movieName);
	}
	else {
		return document[movieName]
		}
}
