videoMsgPlayer = {
	_webServiceUrl : g.videoHubDomain + "/services/service.asmx?wsdl",
	_mnDataUrl : g.videoHubDomain + "/services/micronav.ashx?channel=All", // micronav
	_playerDataUrl : g.videoHubDomain + "/services/playerdata.ashx",
	_assetsBaseUrl : "http://images.video.msg.com/",
	_errorVideoMissing : "This video is no longer available.",
	_numberOfVideosBeforeAds : "2",
	_numberOfSecondsBeforeAdsRefresh : "60",
	_adReportUrl : g.videoHubDomain + "/services/adshown.ashx",
	_errorReportUrl : g.videoHubDomain + "/services/playervideoerror.ashx",
	_sendToFriendUrl : g.videoHubDomain + "/services/sendtofriend.ashx",
	_videoViewedReportUrl : g.videoHubDomain + "/services/videoviewed.ashx",
	_currentChannel : "All",
	_currentChannelUrl : "All",
	_playerWidth : "620",
	_playerHeight : "349",

	clipId: null,
	containerId: null,

	playVideo : function(clipId, containerId) {
		this.clipId = clipId;
		this.containerId = containerId;

		this._playerWidth = '620';
		this._playerHeight = '349';

		if (typeof videodl != 'undefined' && videodl != null) {
			videodl.stopSlideshow();
		}

		this.stopVideo(containerId);

		setTimeout(this.playVideoGlobal, 1);
	},

	playVideoSized : function(clipId, containerId, width, height) {
		this.clipId = clipId;
		this.containerId = containerId;

		this._playerWidth = width;
		this._playerHeight = height;

		if (typeof videodl != 'undefined' && videodl != null) {
			videodl.stopSlideshow();
		}

		this.stopVideo(containerId);

		setTimeout(this.playVideoGlobal, 1);
	},

	playVideo : function(clipId, containerId, width, height) {
		this.clipId = clipId;
		this.containerId = containerId;

		this._playerWidth = width;
		this._playerHeight = height;

		if (videodl) {
			videodl.stopSlideshow();
		}

		this.stopVideo(containerId);

		setTimeout(this.playVideoGlobal, 1);
	},

	stopVideo: function(containerId) {
		var vp = $("#" + containerId);

		if(vp) {
			try {
				vp.closeSession();
				vp.sendEvent('LOAD', null);
			} catch(err){}
		}
	},

	playVideoGlobal : function() {
		videoMsgPlayer.doPlayVideo();
	},

	doPlayVideo : function() {
		var container = $("#" + this.containerId);

		if (container) {

			var flashvars = {
				pid : this.clipId,
				isnormal : "true",
				autostart: "true",
				channelurl : this._currentChannelUrl,
				channel : this._currentChannelUrl,
				wsdl : this._webServiceUrl,
				serviceurl : this._playerDataUrl,
				adreporturl : this._adReportUrl,
				errorreporturl : this._errorReportUrl,
				errormes : this._errorVideoMissing,
				videoreporturl : this._videoViewedReportUrl,
				emailurl : this._sendToFriendUrl,
				adurl: dart.getUrl("1000x1000", this.clipId)
			};
			var params = {
				allowfullscreen : "true",
				allowscriptaccess : "always",
				allownetworking : "all",
				wmode : "transparent",
				menu : "false"
			};

			var attributes = {}

			$("#videodl-image_"+ this.containerId).hide();
			$("#" + this.containerId).parent().show();
			swfobject.embedSWF(g.videoHubDomain + "/flash/player.swf",
					this.containerId, videoMsgPlayer._playerWidth, videoMsgPlayer._playerHeight, "9.0.0.0", "", flashvars,
					params, attributes);
		}
	}
}
