/********************************************************************

	FOREX.COM - CAROUSEL
	
	=========================================
	Author: Chris Erwin (chris@teehanlax.com)
	Agency: teehan+lax
	=========================================
	
	Public Methods
	-------------------------------------------------------------
	init
		Arguments: none
		Returns: null
		
			
	
	Internal 'Private' Methods
	-------------------------------------------------------------
	loadImage 
		Description: loads the fullsize image and then calls the show image function when it's ready
		Arguments: none		
		Returns: null
	
	showImage
		Description: positions the fullsize image to match the thumbnail and then animates it to the calculated fullsize position (middle of the screen)
		Arguments: none		
		Returns: null
		
	showShadow
		Description: after the image animates to the fullsize position the shadow container and the black background fade in
		Arguments: none		
		Returns: null
		
	closeImage
		Description: the fullsize image animates to it's thumbnail position and size
		Arguments: none		
		Returns: null
	
	resetSize
		Desciption: once the fullsize image is no longer visible we return it to it's default size
		Arguments: none		
		Returns: null
	
	
	Dependencies
	-------------------------------------------------------------
	- MooTools 1.2
	
	
	HTML Markup Sample
	-------------------------------------------------------------
	_widget_samples/image_zoom.html
	
*********************************************************************/

var videoPop = {
	
	init : function() {
		videoPop.zoomShadow = $('ZoomShadow');
		videoPop.zoomFade = $('ZoomFade');
		videoPop.videoPlayer = $('video_player');
	},
	
	showVideo : function(flvFileName) {

		var containerElement = $$('body')[0];

		var windowSize = (Browser.Engine.trident4) ? containerElement.getSize() : window.getSize();
		var windowScrollPos = (Browser.Engine.trident4) ? containerElement.getScroll() : window.getScroll();
		
		
		var videoPositionX = (windowSize.x / 2) - 327;
		var videoPositionY = (windowSize.y / 2) - 199 + windowScrollPos.y;
		
		videoPop.zoomShadow.setStyles({
			'top': videoPositionY - 30,
			'left': videoPositionX,
			'visibility': 'visible'
		});
		
		videoPop.zoomFade.setStyles({
		'height': (Browser.Engine.trident4) ? containerElement.getScrollSize().y : window.getScrollSize().y,
			'width' : windowSize.x,
			'opacity': 0.6
		});	
		
		
		// MEDIA SPOTLIGHT VIDEO PLAYER
		var flashvars = {
			w: '600',
			h: '380',
			fn: flvFileName,	// relative to the folder that the MediaPlayer.swf is in
			fs: 'false'
		};
		var params = {
			wmode: 'opaque',
			menu: 'false',
			allowFullScreen: 'true',
			bgcolor: '#000000'
		};								
		var attributes = {};
		swfobject.embedSWF("/resources/swf/MediaPlayer.swf", "video_player", "600", "380", "9.0.115", "/resources/swf/expressInstall.swf", flashvars, params, attributes);
		
	},
	
	closeVideo : function() {
		videoPop.zoomShadow.setStyle('visibility','hidden');
		videoPop.zoomFade.setStyle('visibility', 'hidden');
		
		var videoPlayerClone = $('video_player_mold').clone();
		
		videoPlayerClone.replaces($('video_player'));
		videoPlayerClone.id = 'video_player';
	}
	
};
