
// FLOWPLAYER

$(document).ready(function()
{

	var where = window.location.search;
	var begin = where.lastIndexOf("v=");
	var videoFile = where.slice(begin + 2);
	var secs = videoFile.lastIndexOf("__s");
	var seconds = videoFile.slice(secs + 3);
	var videoName = videoFile + '.flv';

	var folderPath = '/video';

	$("a[href*=.flv]").flowplayer("scripts/flowplayer-3.1.1.swf", {
		clip: {
			baseUrl: folderPath,
			url: videoName,
			autoPlay: true,
			autoBuffering: true,
			duration: seconds,
			scaling: 'scale',		// 'fit'
			metaData: false
		},
//		playlist: [
//			{ url: 'video/alexio__longinidis__s77.flv', duration: 77 },
//			{ url: 'video/bellegarde__shibata__s48.flv', duration: 48 }
//		],
		canvas: { backgroundColor: "transparent"},
		plugins: {
			controls: {
				url: 'scripts/flowplayer.controls-3.1.1.swf',
				backgroundColor: '#222222',
				timeColor: '#000000',
				durationColor: '#cccccc',
				progressColor: '#9f0f0f',
				bufferColor: '#333333',
				buttonColor: '#5F747C',
				buttonOverColor: '#728B94',
				backgroundGradient: [0.6,0.3,0,0,0],
				opacity: 0.8,
				all: false,
				volume: true,
				mute: true,
				playlist: false,
				play: true,
				scrubber: true,
				time: true,
				stop: true,
				fullscreen: false
			}
		},
//		onLoad: function() {
//			alert("Starting!");
//		}
	});
});
