/*
 * STP.com FlowPlayer Video Parameters
 * Video: See The Difference Advert Video 2009	
 * Updated: 5/10/2010
 * 
 */

$(document).ready(function(){

	$('a#videoPlayerSeeTheDifference').flowplayer('/swf/flowplayer.commercial-3.0.7.swf',  { 
	
	<!-- Licences: Needed to remove Flowplayer logo from player  -->
		 key: '@24c187ea413bc1230eb', 	<!-- stp.com Licence. Comment out when testing in Staging -->
		<!-- key: '#@24c187ea413bc1230eb',  -->		//<!--staging.stp.com Licence. Comment out when going Live -->
			
		clip:{ 
			autoPlay: true,
			
			// track start event for this clip
			onStart: function(clip) {
				pageTracker._trackEvent("videoplayback", "Play", clip.url);
			},
			// track pause event for this clip. time (in seconds) is also tracked
			onPause: function(clip) {
				pageTracker._trackEvent("videoplayback", "Pause", clip.url, parseInt(this.getTime()));
			},
			// track stop event for this clip. time is also tracked
			onStop: function(clip) {
				pageTracker._trackEvent("videoplayback", "Stop", clip.url, parseInt(this.getTime()));
			},
			// track finish event for this clip
			onFinish: function(clip) {
				pageTracker._trackEvent("videoplayback", "Finish", clip.url);
			} 			  
		},											
	
		canvas: {backgroundColor: '#ffffff'},
					
		plugins: {
			controls: {
				timeColor: '#cf0c1f',
				buttonOverColor: '#728B94',
				bufferColor: '#b6bdce',
				backgroundColor: '#000a61',
				buttonColor: '#7980be',
				sliderColor: '#9bb4fd',
				durationColor: '#cc0f22',
				borderRadius: '23',
				progressGradient: 'medium',
				backgroundGradient: [0.6,0.3,0,0,0],
				sliderGradient: 'none',
				bufferGradient: 'none',
				progressColor: '#d7d8ee',
				fullscreen: false,
				opacity:1.0
			}
		}		 			 

	});

	$('.playHomeVideo').overlay({
		target: 'div#videoSeeTheDifference',
		left: 150,
	
		// IE6/7 fix: in order to make video play and then stop playing inside
		// of an overlay in IE, we need to manually play & stop the flowplayer
		// using the onLoad & onClose handlers

		onLoad: function(content) {
			if (jQuery.browser.msie)
				$f('videoPlayerSeeTheDifference').play();
		},
		
		onClose: function(content) {
			if (jQuery.browser.msie)
				$f('videoPlayerSeeTheDifference').stop();
		}
	});
	$('.playSideVideo').overlay({
		target: 'div#videoSeeTheDifference',
	
		// IE6/7 fix: in order to make video play and then stop playing inside
		// of an overlay in IE, we need to manually play & stop the flowplayer
		// using the onLoad & onClose handlers

		onLoad: function(content) {
			if (jQuery.browser.msie)
				$f('videoPlayerSeeTheDifference').play();
		},
		
		onClose: function(content) {
			if (jQuery.browser.msie)
				$f('videoPlayerSeeTheDifference').stop();
		}
	});
	
});
