/*
 * Glad.com FlowPlayer Video Parameters
 * Video: Glad pop up	
 * Updated: 1/3/2012
 * 
 */

$(document).ready(function(){

	$('a#video-player').flowplayer('/swf/flowplayer.commercial-3.0.7.swf',  { 
	
	<!-- Licences: Needed to remove Flowplayer logo from player  -->
		 key: '@28c47177b3291c9b4d4', 	<!-- glad.com Licence. Comment out when testing in Staging -->
		<!-- key: '#@28c47177b3291c9b4d4',  -->		//<!--staging.glad.com Licence. Comment out when going Live -->
			
		clip:{ 
			autoPlay: true,
			
			// track start event for this clip
			onStart: function(clip) {
				_gaq.push(['_trackEvent', 'videoplayback', 'Play', clip.url]);
			},
			// track pause event for this clip. time (in seconds) is also tracked
			onPause: function(clip) {
				_gaq.push(['_trackEvent', 'videoplayback', 'Pause', clip.url, parseInt(this.getTime())]);
			},
			// track stop event for this clip. time is also tracked
			onStop: function(clip) {
				_gaq.push(['_trackEvent', 'videoplayback', 'Stop', clip.url, parseInt(this.getTime())]);
			},
			// track finish event for this clip
			onFinish: function(clip) {
				_gaq.push(['_trackEvent', 'videoplayback', 'Finish', clip.url]);
			} 			  
		},											
	
		canvas: {backgroundColor: '#ffffff'},
					
		plugins: {
			controls: {
				timeColor: '#ffffff',
				buttonOverColor: '#ff290a',
				bufferColor: '#b54440',
				backgroundColor: '#c9b659',
				buttonColor: '#d84922',
				sliderColor: '#d84922',
				durationColor: '#ffffff',
				progressGradient: 'medium',
				backgroundGradient: [0.6,0.3,0,0,0],
				sliderGradient: 'none',
				bufferGradient: 'none',
				progressColor: '#b54440',
				volumeColor: '#ac342f',
				volumeSliderColor: '#d07571',
				fullscreen: false,
				opacity:1.0
			}
		}		 			 

	});

	$('.videobanner').overlay({
		target: 'div#video',
		left: 350,
		top: 50,	
		
		// IE6/7 fix: in order to fix z-index issue
		onBeforeLoad:  function() {
          this.getOverlay().appendTo('body');
          },
		
		// 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('video-player').play();
		},
		
		onClose: function(content) {
			if (jQuery.browser.msie)
				$f('video-player').stop();
		}
	});
	
});
