TT.SWF =
{
	options :
	{
		swf        : null,
		id         : null,
		width      : null,
		height     : null,
		version    :'9.0.0',
		express    : 'false',
		vars       : { },
		params     : { menu : 'false' , quality : 'high' , wmode : 'opaque' , allowscriptaccess : 'always' , allowfullscreen : 'true' },
		attributes : { }
	},
	
	play : function ( options )
	{
		swfobject.embedSWF.apply ( swfobject , Object.toArray ( Object.merge ( this.options , options ) ) );
	},
	
	stop : function ( )
	{
		return null;
	}
};

TT.SWF.HDVideo =
{
	player : null,
	
	overlay : null,
	
	observers :
	{
		stop : function ( element , event )
		{
			event.stop ( );
		},
		
		close : function ( element , event )
		{
			TT.DOM.setStyle ( TT.SWF.HDVideo.overlay , 'display' , 'none' );
		}
	},
	
	options :
	{
		swf        : 'swf/videoPlayerHD.swf',
		id         : 'swf-hdv-movie',
		width      : 480,
		height     : 272,
		version    :'9.0.0',
		express    : 'false',
		vars       : { },
		params     : { menu : 'false' , quality : 'high' , wmode : 'opaque' , allowscriptaccess : 'always' , allowfullscreen : 'true' },
		attributes : { }
	},
	
	construct : function ( )
	{
		if ( this.player === null )
		{
			var overlay = document.createElement ( 'div' );	 
			overlay.id = 'swf-hdv-overlay';
			TT.Event.observe ( overlay , 'click' , TT.SWF.HDVideo.observers.close );
			
			var player = document.createElement ( 'div' );
			player.id = 'swf-hdv-player';
			
			var close = document.createElement ( 'div' );
			close.id = 'swf-hdv-close';
			TT.Event.observe ( close , 'click' , TT.SWF.HDVideo.observers.close );
			
			var video = document.createElement ( 'div' );
			video.id = 'swf-hdv-video';
			TT.Event.observe ( video , 'click' , TT.SWF.HDVideo.observers.stop );
			
			var movie = document.createElement ( 'div' );
			movie.id = 'swf-hdv-movie';
						
			document.body.appendChild ( overlay );			
			overlay.appendChild ( player );
			player.appendChild ( close );
			close.appendChild ( document.createTextNode ( 'close' ) );
			player.appendChild ( video );
			video.appendChild ( movie );
			
			this.overlay = overlay;
			this.player = player;
		}
	},
		
	play : function ( options )
	{
		this.construct ( );
		
		TT.SWF.play ( Object.merge ( this.options , options ) );
		TT.DOM.setStyle ( this.overlay , 'display' , 'block' );
		TT.DOM.setStyle ( this.player , 'top' , document.body.scrollTop + document.documentElement.scrollTop + 'px' );
	}
};
