/*
 * Clorox2.com FlowPlayer Video Parameters
 * Video: Clorox2 Advert Video 2009	
 * Updated: 09/28/2009
 * 
 */

$(document).ready(function() {

	// set first li to be selected
	$('#video-mostoutofeveryload_std').css('background-color', '#e7f3ff');
	$('#video-mostoutofeveryload_he').css('background-color', '#e7f3ff');
	$('#video_powerful_stain_removal').css('background-color', '#e7f3ff');
	$('#video-carson_brightside').css('background-color', '#e7f3ff');
	$('#video_be_inspired').css('background-color', '#e7f3ff');
	
	// play each video when the corresponding link is clicked
	$('li.playVideo').click(function() { 
	    videoname = $(this).children('a').attr('href');    
	    $('li.playVideo').css('background-color', '');
	    $(this).css('background-color', '#e7f3ff');
	    
	    // play the clip specified in href- attribute with the first visible Flowplayer 
	    $f("*").each(function() { 
			
			playerEl = this.getParent();

			// find the first visible player
			if ($(playerEl).is (':visible') && $(playerEl).parents (':hidden').length == 0) {
	    		this.play(videoname);
	    		return false;	// found one! stop trying to find a visible player
			}
		});
	         
	    // by returning false normal link behaviour is skipped 
	    return false; 
	});

	// stop the flowplayer if a tab is clicked. this is mainly needed for IE
	// as FireFox etc. stops the flowplayer automatically
	$('div.tabs ul.containerNav a').click(function () {
	    
	    if (jQuery.browser.msie) {
		    if ($('div#videoPlayerStandardWashers object').length > 0)
		            $f('videoPlayerStandardWashers').stop();
		
		    if ($('div#videoPlayerHEWashers object').length > 0)
		            $f('videoPlayerHEWashers').stop();
		
		    if ($('div#videoPlayerPS object').length > 0)
		            $f('videoPlayerPS').stop();
			  	
		    if ($('div#videoPlayerCarson object').length > 0)
		            $f('videoPlayerCarson').stop();
	    }

	});

	$('div#videoPlayerStandardWashers').flowplayer({src: '/swf/flowplayer.commercial-3.0.7.swf', wmode: 'opaque'},  { 
	
		<!-- Licences: Needed to remove Flowplayer logo from player  -->
		key: '@4884b0ffe5e0d12ae16',	<!-- clorox2.com Licence. Comment out when testing in Staging -->
		<!-- key: '#@4884b0ffe5e0d12ae16', -->  		//<!--staging.clorox2.com Licence. Comment out when going Live -->
	
		// default clip
		clip:{ 
			url: '/swf/most_out_of_every_load_std.flv',
			autoPlay: true,
			autoBuffering: true
		},											
		
		// canvas: { backgroundImage: 'url(/img/video.jpg)' },
		
		plugins: {
			controls: {
				timeColor: '#f28b07',
				buttonOverColor: '#728B94',
				bufferColor: '#6c9cbc',
				backgroundColor: '#0162da',
				buttonColor: '#0c50ac',
				sliderColor: '#2d378b',
				durationColor: '#f98e06',
				progressGradient: 'medium',
				backgroundGradient: [0.6,0.3,0,0,0],
				sliderGradient: 'none',
				bufferGradient: 'none',
				progressColor: '#0b1484',
				fullscreen: false,
				opacity:1.0
			}
		}
	});
	
	$('div#videoPlayerHEWashers').flowplayer({src: '/swf/flowplayer.commercial-3.0.7.swf', wmode: 'opaque'},  { 
	
		<!-- Licences: Needed to remove Flowplayer logo from player  -->
		key: '@4884b0ffe5e0d12ae16',	<!-- clorox2.com Licence. Comment out when testing in Staging -->
		<!-- key: '#@4884b0ffe5e0d12ae16', -->  		//<!--staging.clorox2.com Licence. Comment out when going Live -->
	
		// default clip
		clip:{ 
			url: '/swf/most_out_of_every_load_he.flv',
			autoPlay: true,
			autoBuffering: true
		},											
		
		// canvas: { backgroundImage: 'url(/img/video.jpg)' },
		
		plugins: {
			controls: {
				timeColor: '#f28b07',
				buttonOverColor: '#728B94',
				bufferColor: '#6c9cbc',
				backgroundColor: '#0162da',
				buttonColor: '#0c50ac',
				sliderColor: '#2d378b',
				durationColor: '#f98e06',
				progressGradient: 'medium',
				backgroundGradient: [0.6,0.3,0,0,0],
				sliderGradient: 'none',
				bufferGradient: 'none',
				progressColor: '#0b1484',
				fullscreen: false,
				opacity:1.0
			}
		}
	});	
	
	$('div#videoPlayerCarson').flowplayer({src: '/swf/flowplayer.commercial-3.0.7.swf', wmode: 'opaque'},  { 
	
		<!-- Licences: Needed to remove Flowplayer logo from player  -->
		key: '@4884b0ffe5e0d12ae16',	<!-- clorox2.com Licence. Comment out when testing in Staging -->
		<!-- key: '#@4884b0ffe5e0d12ae16', -->  		//<!--staging.clorox2.com Licence. Comment out when going Live -->
	
		// default clip
		clip:{ 
			url: '/swf/carson_brightside.flv',
			autoPlay: true,
			autoBuffering: true
		},											
		
		// canvas: { backgroundImage: 'url(/img/video.jpg)' },
		
		plugins: {
			controls: {
				timeColor: '#f28b07',
				buttonOverColor: '#728B94',
				bufferColor: '#6c9cbc',
				backgroundColor: '#0162da',
				buttonColor: '#0c50ac',
				sliderColor: '#2d378b',
				durationColor: '#f98e06',
				progressGradient: 'medium',
				backgroundGradient: [0.6,0.3,0,0,0],
				sliderGradient: 'none',
				bufferGradient: 'none',
				progressColor: '#0b1484',
				fullscreen: false,
				opacity:1.0
			}
		}
	});
	
	$('div#videoPlayerProducts').flowplayer({src: '/swf/flowplayer.commercial-3.0.7.swf', wmode: 'opaque'},  { 
	
		<!-- Licences: Needed to remove Flowplayer logo from player  -->
		key: '@4884b0ffe5e0d12ae16',	<!-- clorox2.com Licence. Comment out when testing in Staging -->
		<!-- key: '#@4884b0ffe5e0d12ae16', -->  		//<!--staging.clorox2.com Licence. Comment out when going Live -->
	
		// default clip
		clip:{ 
			url: '/swf/powerful_stain_removal.flv',
			autoPlay: true,
			autoBuffering: true
		},											
		
		// canvas: { backgroundImage: 'url(/img/video.jpg)' },
		
		plugins: {
			controls: {
				timeColor: '#f28b07',
				buttonOverColor: '#728B94',
				bufferColor: '#6c9cbc',
				backgroundColor: '#0162da',
				buttonColor: '#0c50ac',
				sliderColor: '#2d378b',
				durationColor: '#f98e06',
				progressGradient: 'medium',
				backgroundGradient: [0.6,0.3,0,0,0],
				sliderGradient: 'none',
				bufferGradient: 'none',
				progressColor: '#0b1484',
				fullscreen: false,
				opacity:1.0
			}
		}
	});
	
	$('div#videoPlayerPS').flowplayer({src: '/swf/flowplayer.commercial-3.0.7.swf', wmode: 'opaque'},  { 
	
		<!-- Licences: Needed to remove Flowplayer logo from player  -->
		key: '@4884b0ffe5e0d12ae16',	<!-- clorox2.com Licence. Comment out when testing in Staging -->
		<!-- key: '#@4884b0ffe5e0d12ae16', -->  		//<!--staging.clorox2.com Licence. Comment out when going Live -->
	
		// default clip
		clip:{ 
			url: '/swf/df-possibility-shop-about-courtney-480x270-16x9.flv',
			autoPlay: true,
			autoBuffering: true
		},											
		
		//canvas: { backgroundImage: 'url(/swf/ps_intro.jpg)' },
		
		plugins: {
			controls: {
				timeColor: '#f28b07',
				buttonOverColor: '#728B94',
				bufferColor: '#6c9cbc',
				backgroundColor: '#0162da',
				buttonColor: '#0c50ac',
				sliderColor: '#2d378b',
				durationColor: '#f98e06',
				progressGradient: 'medium',
				backgroundGradient: [0.6,0.3,0,0,0],
				sliderGradient: 'none',
				bufferGradient: 'none',
				progressColor: '#0b1484',
				fullscreen: false,
				opacity:1.0
			}
		}
	});
	

});

	
