
/* VideoPlayer Class using jquery.js and oop.js */

var videoPlayer =
{
	
	loadFlash : function()
	{
		var url = window.location.href;
	
		//----- Get the starting video ID from the URL
		var startingVideoId = '';
		var hashPos = url.indexOf('#');
		if (hashPos >= 0) { startingVideoId = url.substr(hashPos + 1) };
	
		//----- Get the console parameter from the URL
		var urlParams   = jQuery.string( url ).toQueryParams();
		var showConsole = (urlParams.showConsole == "true");
	
		var flashvars =
		{
			flashDir        : '../flash/media/tv-commercials/',
			startingVideoId : startingVideoId,
			useJavaScript   : 'true',
			showConsole     : '' + showConsole
		};
	
		var params =
		{
			menu    : 'false',
			wmode   : 'transparent',
			bgcolor : '#ffffff'
		};
	
		swfobject.embedSWF('../flash/media/tv-commercials/tv-commercials.swf', 'my_flashContent', '940', '620', '10.0.0', null, flashvars, params, null);
	},
	
	
	updateUrl : function(videoId)
	{
		window.location.href = '#' + videoId;
	},
	
	
	trackPath : function(path)
	{
		pageTracker._trackPageview('/media/tv-commercials/tracking/' + path);
	}

}; //----- End VideoPlayer Class

//----- These functions called from the Flash component
function updateUrl(videoId) { videoPlayer.updateUrl(videoId); }
function trackPath(path)    { videoPlayer.trackPath(path);    }


