// Copyright (c) 2009-2010 Ryan Ours. www.ryanours.com
// Flowplayer video loading for "See the App" page on apps.musicaldna.com
$(document).ready(function() {
	
	$("a.user1-thumb, .user-thumb-1 a.title").click(function() {
	    if($('#right .active').length) {
			$('#right .active').removeClass('active');
		}
		$("a.user1-thumb, .user-thumb-1 a.title").addClass('active');
		if($('object#intro-video').length) {
			$('object#intro-video').remove();
		}
		if($('.video-wrapper').length) {
			$('.video-wrapper').remove();
		}
		$('#video-container').prepend('<div class="video-wrapper" style="display:block; width:320px; height:346px;"></div>');
		$f(".video-wrapper", {src: "flowplayer.commercial-3.1.5.swf", wmode: 'opaque'}, {
			key: '#$e05fbb7081656408e4c',
			canvas: { 
				backgroundColor: "#000000" 
			}, 
			onLoad: function() { 
			    // set volume to 80% 
			    this.setVolume(80); 
			  },
			clip: {
				scaling: "fit",
				url: 'lulla-bye.flv'
			},
			plugins: {
		          controls: { 

				        // location of the controlbar plugin 
				        url: 'flowplayer.controls-3.1.5.swf', 

				        // display properties such as size, location and opacity 
				        opacity: 0.95, 

				        // styling properties (will be applied to all plugins) 
				        background: '#114455', 
				        backgroundGradient: 'medium', 

				        // controlbar specific settings
						autoHide: 'never',
				        all: false,
				        play: true,
						volume: true,
						mute: true,
						time: true,
						fullscreen: false,
				        scrubber: true,
						timeColor:  	'#ffffff',
						durationColor: 	'#ffffff',
						progressColor: 	'#999999',
						progressGradient: 	'medium',
						bufferColor: 	'#333333',
						bufferGradient: 	'none',
						sliderColor: 	'#000000',
						sliderGradient: 	'none',
						buttonColor: 	'#333333',
						buttonOverColor: 	'#888888',
						volumeSliderColor: 	'#000000',
						volumeSliderGradient: 	'none',
						timeBgColor: 	'#333333',
						tooltipColor: '#333333',

				        // tooltips (since 3.1) 
				        tooltips: { 
				            buttons: false
				        }
				    }
				}
		});
		return false;
	});
	
	$("a.user2-thumb, .user-thumb-2 a.title").click(function() {
		if($('#right .active').length) {
			$('#right .active').removeClass('active');
		}
		$("a.user2-thumb, .user-thumb-2 a.title").addClass('active');
	    if($('object#intro-video').length) {
			$('object#intro-video').remove();
		}
		if($('.video-wrapper').length) {
			$('.video-wrapper').remove();
		}
		$('#video-container').prepend('<div class="video-wrapper" style="display:block; width:320px; height:346px;"></div>');
		$f(".video-wrapper", {src: "flowplayer.commercial-3.1.5.swf", wmode: 'opaque'}, {
			key: '#$e05fbb7081656408e4c',
			canvas: { 
				backgroundColor: "#000000" 
			}, 
			onLoad: function() { 
			    // set volume to 80% 
			    this.setVolume(80); 
			  },
			clip: {
				scaling: "fit",
				url: 'user-song-1.flv'
			},
			plugins: {
		          controls: { 

				        // location of the controlbar plugin 
				        url: 'flowplayer.controls-3.1.5.swf', 

				        // display properties such as size, location and opacity 
				        opacity: 0.95, 

				        // styling properties (will be applied to all plugins) 
				        background: '#114455', 
				        backgroundGradient: 'medium', 

				        // controlbar specific settings
						autoHide: 'never',
				        all: false,
				        play: true,
						volume: true,
						mute: true,
						time: true,
						fullscreen: false,
				        scrubber: true,
						timeColor:  	'#ffffff',
						durationColor: 	'#ffffff',
						progressColor: 	'#999999',
						progressGradient: 	'medium',
						bufferColor: 	'#333333',
						bufferGradient: 	'none',
						sliderColor: 	'#000000',
						sliderGradient: 	'none',
						buttonColor: 	'#333333',
						buttonOverColor: 	'#888888',
						volumeSliderColor: 	'#000000',
						volumeSliderGradient: 	'none',
						timeBgColor: 	'#333333',
						tooltipColor: '#333333',

				        // tooltips (since 3.1) 
				        tooltips: { 
				            buttons: false
				        }
				    }
				}
		});
		return false;
	});
	
	$("a.user3-thumb, .user-thumb-3 a.title").click(function() {
		if($('#right .active').length) {
			$('#right .active').removeClass('active');
		}
		$("a.user3-thumb, .user-thumb-3 a.title").addClass('active');
		if($('object#intro-video').length) {
			$('object#intro-video').remove();
		}
		if($('.video-wrapper').length) {
			$('.video-wrapper').remove();
		}
		$('#video-container').prepend('<div class="video-wrapper" style="display:block; width:320px; height:346px;"></div>');
	    $f(".video-wrapper", {src: "flowplayer.commercial-3.1.5.swf", wmode: 'opaque'}, {
			key: '#$e05fbb7081656408e4c',
			canvas: { 
				backgroundColor: "#000000" 
			}, 
			onLoad: function() { 
			    // set volume to 80% 
			    this.setVolume(80); 
			  },
			clip: {
				scaling: "fit",
				url: 'row-row-your-boat.flv'
			},
			plugins: {
		          controls: { 

				        // location of the controlbar plugin 
				        url: 'flowplayer.controls-3.1.5.swf', 

				        // display properties such as size, location and opacity 
				        opacity: 0.95, 

				        // styling properties (will be applied to all plugins) 
				        background: '#114455', 
				        backgroundGradient: 'medium', 

				        // controlbar specific settings
						autoHide: 'never',
				        all: false,
				        play: true,
						volume: true,
						mute: true,
						time: true,
						fullscreen: false,
				        scrubber: true,
						timeColor:  	'#ffffff',
						durationColor: 	'#ffffff',
						progressColor: 	'#999999',
						progressGradient: 	'medium',
						bufferColor: 	'#333333',
						bufferGradient: 	'none',
						sliderColor: 	'#000000',
						sliderGradient: 	'none',
						buttonColor: 	'#333333',
						buttonOverColor: 	'#888888',
						volumeSliderColor: 	'#000000',
						volumeSliderGradient: 	'none',
						timeBgColor: 	'#333333',
						tooltipColor: '#333333',

				        // tooltips (since 3.1) 
				        tooltips: { 
				            buttons: false
				        }
				    }
				}
		});
		return false;
	});
	
	$("a.user4-thumb, .user-thumb-4 a.title").click(function() {
		if($('#right .active').length) {
			$('#right .active').removeClass('active');
		}
		$("a.user4-thumb, .user-thumb-4 a.title").addClass('active');
	   	if($('object#intro-video').length) {
			$('object#intro-video').remove();
		}
		if($('.video-wrapper').length) {
			$('.video-wrapper').remove();
		}
		$('#video-container').prepend('<div class="video-wrapper" style="display:block; width:320px; height:346px;"></div>');
		$f(".video-wrapper", {src: "flowplayer.commercial-3.1.5.swf", wmode: 'opaque'}, {
			key: '#$e05fbb7081656408e4c',
			canvas: { 
				backgroundColor: "#000000" 
			}, 
			onLoad: function() { 
			    // set volume to 80% 
			    this.setVolume(80); 
			  },
			clip: {
				scaling: "fit",
				url: 'websitesong.flv'
			},
			plugins: {
		          controls: { 

				        // location of the controlbar plugin 
				        url: 'flowplayer.controls-3.1.5.swf', 

				        // display properties such as size, location and opacity 
				        opacity: 0.95, 

				        // styling properties (will be applied to all plugins) 
				        background: '#114455', 
				        backgroundGradient: 'medium', 

				        // controlbar specific settings
						autoHide: 'never',
				        all: false,
				        play: true,
						volume: true,
						mute: true,
						time: true,
						fullscreen: false,
				        scrubber: true,
						timeColor:  	'#ffffff',
						durationColor: 	'#ffffff',
						progressColor: 	'#999999',
						progressGradient: 	'medium',
						bufferColor: 	'#333333',
						bufferGradient: 	'none',
						sliderColor: 	'#000000',
						sliderGradient: 	'none',
						buttonColor: 	'#333333',
						buttonOverColor: 	'#888888',
						volumeSliderColor: 	'#000000',
						volumeSliderGradient: 	'none',
						timeBgColor: 	'#333333',
						tooltipColor: '#333333',

				        // tooltips (since 3.1) 
				        tooltips: { 
				            buttons: false
				        }
				    }
				}
		});
		return false;
	});

});
