var flowplayerControls = {
	backgroundGradient: 'none',
	tooltipTextColor: '#ffffff',
	sliderGradient: 'none',
	tooltipColor: '#ff0000',
	borderRadius: '0px',
	volumeSliderGradient: 'none',
	volumeSliderColor: '#cccccc',
	buttonOverColor: '#cccccc',
	timeColor: '#ffffff',
	buttonColor: '#000000',
	backgroundColor: '#000000',
	progressColor: '#ffffff',
	bufferColor: '#aaaaaa',
	sliderColor: '#ffffff',
	timeBgColor: '#555555',
	bufferGradient: 'none',
	progressGradient: 'none',
	durationColor: '#000000',
	height: 22,
	opacity: 1.0
};
var flowplayerCanvas = {
	backgroundColor: "#000000",
	backgroundGradient: 'none'
};

var p = {
	openPlayer : function(root, video)
	{
		this.root = root;
		this.video = video;
		$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
		d = new Element('div', {'id':'blockbg'}).setStyle({
			position : 'fixed',
			top : 0,
			left : 0,
			width : '100%',
			height : '100%',
			zIndex : '110',
			background : '#000000',
			opacity : '0.5',
			filter : 'alpha(opacity=50)'
		});
		this.blockbg = $(document.body.appendChild(d));
		var d = new Element('div', {'id':'player'}).insert(
			new Element('img', {'id':'player-close','src':this.root+'images/close-button.png'})
		);
		d.insert(
			new Element('div', {'id':'embedded-vzc4myDLDH', 'class':'embedded-player'})
		);
		this.player = $(document.body.appendChild(d));
		$('player-close').observe('click', this.closePlayer.bind(this));
		$('blockbg').observe('click', this.closePlayer.bind(this));
		flowplayer("embedded-vzc4myDLDH", this.root+"lib/swf/flowplayer.swf", {
			clip: {
				url: this.root+"video/"+this.video,
				autoPlay: true,
				scaling: "orig"
			},
			canvas: (window.flowplayerCanvas || {}),
			screen: (window.flowplayerScreen || {}),
			plugins: {
				controls: (window.flowplayerControls || {})
			}
		});
	},
	closePlayer: function()
	{
		document.body.removeChild(this.player);
		document.body.removeChild(this.blockbg);
		$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
	}

};
