
$('html').addClass('js-on');
$(function(){
	$('div.media-player').jmeControl();
});

$(function(){
	$('div.media-player')
		.jmeEmbedControls({
			timeSlider: {
				range: 'min'
			}
		})
		//useractive/userinactive event is provided by utils/useractivity.js plugin
		.bind('useractive', function(){
			$('div.controls-container', this).stop().animate({opacity: 1});
		})
		.bind('userinactive', function(){
			$('div.controls-container', this).stop().animate({opacity: 1});
		})
		//remove following lines if controls should be visible on start
		.find('div.controls-container')
		.css('opacity', 1)
	;
});

/*********** Initialize HTML5 Player with Flash backup ***********/

$(function(){ 	
	$(function(){
		$('video').jmeControl();
	});

	$('video, audio').jmeEmbed({ 
		jwPlayer: { 
			path: 'js/player.swf' 
		} 
	})
});



/*********** Switch to low bandwidth option ***********/
$('a.low-bandwidth').live('click', function() {
	$('video').pause();
	
	$('video') .loadSrc( [
	// The below video file paths need to be changed to the absolute paths
		'http://mydeo.vo.llnwd.net/o1/aspect/rebel/Rebel-website-video-cut02.mp4',
        'http://mydeo.vo.llnwd.net/o1/aspect/rebel/Rebel-website-video-cut02-LQ.ogg' 
    ] )
    .play();
	
	$(this).toggleClass('low-bandwidth').toggleClass('high-bandwidth');
	$(this).empty().append('High Bandwidth');

	return false;
});

/*********** Switch to high bandwidth option ***********/
$('a.high-bandwidth').live('click', function() {
	$('video').pause();
	
	$('video') .loadSrc( [
	// The below video file paths need to be changed to the absolute paths
        'http://mydeo.vo.llnwd.net/o1/aspect/rebel/Rebel-website-video-cut02.mp4',
        'http://mydeo.vo.llnwd.net/o1/aspect/rebel/Rebel-website-video-cut02.ogg'
    ] )
    .play();
	
	$(this).toggleClass('high-bandwidth').toggleClass('low-bandwidth');
	$(this).empty().append('Low Bandwidth');
	
	return false;
});


/*********** OnClick GA Tracking ***********/
$(document).ready(function () {

	$("div.content a").click(function () {
		var trackingString = ("Link: " + $(this).html());
			_gaq.push(['_trackPageview', trackingString]);
	});
	
	$("div.controls-container a").click(function () {
		var trackingString = ("Video controls: " + $(this).html());
			_gaq.push(['_trackPageview', trackingString]);
	});
	$("div.controls-container button").click(function () {
		var trackingString = ("Video controls: " + $(this).html());
			_gaq.push(['_trackPageview', trackingString]);
	});
	
});





