/*  
Originally created by Juxtaprose, (c) copyright 2009
http://juxtaprose.com/
*/

$(document).ready(function() {

/* videos overlay-popup */	
	$('body').append('<div class="overlay" id="video"><div class="owrap"></div></div>');

	$('a[rel="#video"]').overlay({
		expose: '#575757',
		onBeforeLoad: function() {
			var owrap = this.getContent().find('div.owrap');
			owrap.empty();
		},	
		onLoad: function() {
			var owrap = this.getContent().find('div.owrap');
			$(owrap).append('<iframe src="'+this.getTrigger().attr("href")+'" frameborder="0" scrolling="no" />');
/* intentionally fails on all except IE6 			
			try { 
				supersleight.limitTo(false);
				supersleight.run();
			} catch (r) {}		*/
		},
	   finish: {
	    	top: 10,
			left: 'center',
			absolute: false
		} 
	});	
/* video player */

	var GLFavplayer = '/scripts/flowplayer-3.1.2.swf';	
	$.each($('#player'), function() {	
		var h = $(this).attr('href');
		$(this).text('');
		$f(this, GLFavplayer,
			{clip: {
				url: h,
				scaling: 'fit',
				time: '00:00',
				autoPlay: true,
				autoBuffer: true
			},
			plugins: { 
				controls: { 
					playlist: true,
					fullscreen: false, 					
					height: 25,
					backgroundColor: '#575757',
					backgroundGradient: [0,0,0],
					fontColor: '#ffffff',      
					timeColor: '#ffffff',
					buttonColor: '#111111',
					buttonOverColor: '#8a3d27',        		
					bufferColor: '#8a3d27',
					bufferGradient: 0,
					progressColor: '#dddddd'
				} 
			},
			canvas: { 
				backgroundColor: '#dddddd', 
				backgroundGradient: [0,0,0]		
			}}
		);
	});
});
