document.observe('dom:loaded', function() {
	
	var cacheBuster = '';
	if (Prototype.Browser.IE) {
		cacheBuster = '?r=' + (new Date()).getTime();
	}
	
	var controlSkin = {
		backgroundGradient:'none',
		backgroundColor:'#000000',
		buttonColor:'#666666',
		buttonOverColor:'#999999',
		sliderGradient:'none',
		sliderColor:'#000000',
		progressGradient:'none',
		progressColor:'#999999',
		bufferGradient:'none',
		bufferColor:'#666666',
		volumeSliderGradient:'none',
		volumeSliderColor:'#000000',
		tooltipColor:'#666666',
		tooltipTextColor:'#ffffff',
		borderRadius:10,
		timeColor:'#ffffff',
		timeBgColor:'#000000',
		durationColor:'#ffffff',
		height:32,
		opacity:0.75,
		bottom:10,
		left:10,
		width:($('ysMovieHolder').getWidth() - 20),
		fullscreen:false,
		autoHide:'always'
	};
	
	var ysPlayerOptions = {
		clip:{
			url:$('ysMovieHolder').getAttribute('rel'),
			autoPlay:false,
			scaling:'fit',
			provider:'akamai'
		},
		canvas:{
			backgroundColor:'#78778e',
			backgroundGradient:'none'
		},
		plugins:{
			controls: controlSkin,
			akamai: {
				url: baseUrl + 'javascript/flowplayer/AkamaiFlowPlugin.swf' + cacheBuster
			}
		}
	};
	
	// Observe clicks on the place holder image
	$('ysPlaceHolder').observe('click', function() {
		
		var ysPlayer = flowplayer(
			'ysMovieHolder',
			baseUrl + 'javascript/flowplayer/flowplayer-3.2.7.swf' + cacheBuster,
			ysPlayerOptions
		);
		
		// Fade out the place holder
		new Effect.Fade(this, {
			afterFinish:function() {
				// Play the video
				ysPlayer.play();
			}
		});
		
	});
	
});
