$(window).load(function() {
	if($("div.player"))
		$.getScript("/flow/flowplayer-3.1.4.js", function() {
			$.getScript("/flow/flowplayer.controls-3.0.2.js", function() {
			});
			
			$("div.player div.info").prepend(
				'<img src="/flow/play.png" style="float: left; padding: 0px 10px 0px 0px !important; height: 36px;">'
			);
		
			$("div.player div.info").append(
				'<span>Click to play</span>'
			);
			
			// Load the Flow Player
			$("div.player").flowplayer(
			{
				src: "/flow/flowplayer-3.1.5.swf",
				version: [9,115], 
				onFail: function()  {
					$("#player").html( 
						"Cannot Play: Flash 9 or greater required."
					);
				}
			}, {
				clip: {
					autoPlay: true,
					autoBuffering: true,
					provider: 'h264streaming',
					scaling: 'fit',
					onStart: function(clip) {  
						var wrap = jQuery(this.getParent());
                        //alert(clip.metaData.width + "px x " + clip.metaData.height + "px");
						wrap.css({width: clip.metaData.width, height: clip.metaData.height});  
					}  
				},
				canvas: {
					background: '#000000', 
					backgroundGradient: 'none'
				},
				plugins: {
					h264streaming: {
						url: '/flow/flowplayer.pseudostreaming-3.1.3.swf'
					},
					controls: {
						url: '/flow/flowplayer.controls-3.1.5.swf',
						backgroundColor: 'transparent',
						
						progressGradient: 'none',
						bufferGradient: 'none',
						sliderGradient: 'none',
						backgroundGradient: 'none',
						volumeSliderGradient: 'none',
						
						buttonOverColor: '#5c9b2c',
						progressColor: '#5c9b2c',
						buttonColor: '#555555',
						sliderColor: '#555555',
						timeBgColor: '#555555',
						durationColor: '#B5B5B5',
						tooltipTextColor: '#ffffff',
						tooltipColor: '#555555',
						volumeSliderColor: '#000000',
						bufferColor: '#445566',
						timeColor: '#ffffff',
						
						borderRadius: '10',
						
						height: 26,
						opacity: 0.60,
						autoHide: 'never',
						hideDelay: 500,
						volume: false,
						mute: true,
						fullscreen: false
					}
				},
				onError: function(err) {
					$("#player").html("Error: " + err);
				}
			});
		});
});