
var solvatio = new (function() {

	/* An sich koennte man dieses Mapping direkt ueber Attribute im HTML
	 * loesen, allerdings loescht Wordpress diese direkt wieder -.-
	 */
	var video_configuration = {
		'http://82.212.219.110/download/trailer/solvatio-vhigh.flv': {
			'width':	'1920',
			'height':	'1080'
		},
		'http://82.212.219.110/download/trailer/solvatio-high.flv': {
			'width':	'800',
			'height':	'450'
		},
		'http://82.212.219.110/download/trailer/solvatio-low.flv': {
			'width':	'400',
			'height':	'125'
		}
	};



	/* Wird vom onclick-Handler bei Links auf flv-Dateien aufgerufen
	 *
	 * @param video URL des anzuzeigenden Videos
	 * @param flv_base Pfad unter welchem der flvplayer installiert ist
	 *
	 * @warning Benoetigt flvplayer/swfobject.js
	 */
	this.show_video = function(video, flv_base) {
		var configuration = video_configuration[video];

		/* flv player parameters
		 */
		var flashvars = {
			'playerpath':		'',
			'contentpath':		'', /*flv_base +'content',*/

			'video':		video,
			'preview':		flv_base +'preview-'+ configuration.width +'-'+ configuration.height +'.jpg',

			'skin':			'defaultskin.swf',
			'skincolor':		'0x2c8cbd',
			'skinscalemaximum':	'1'
		};
					
		var params = {
			'scale':		'noscale',
			'allowfullscreen':	'true',
			'salign':		'tl',
   		 	'base':			flv_base
		};
		
		var attributes = {
			'align':		'left'
		};

		swfobject.embedSWF(
			flv_base +'flvplayer.swf',
			'video-player',
			configuration.width, configuration.height,
			'9.0.28',
			flv_base +'expressInstall.swf',
			flashvars,
			params,
			attributes
		);

		var lightbox = {
			'width':	42,
			'height':	42,

			'offset_x':	0,
			'offset_y':	20
		};

		$('#video-player-inner-wrapper').css({
			'position':	'relative',
			'top':		''+ (($(window).height() - parseInt(configuration.height)) / 2) +'px',
			'left':		''+ (($(window).width() - parseInt(configuration.width)) / 2) +'px'
		});
		$('.lightbox-close').css({
			'position':	'relative',
			'top':		'-'+ (lightbox.height - lightbox.offset_y) +'px',
			'left':		''+ (parseInt(configuration.width) + lightbox.width + lightbox.offset_x) +'px'
		});

		$('#video-player-outer-wrapper').click(function(event) {
			if ('OBJECT' == event.target.nodeName) {
				return;
			}

			$(this).fadeOut('slow', function() {
				$(this).html('<div id="video-player-inner-wrapper"><div class="lightbox-close"></div><div id="video-player"></div></div>');
			});
		});
		$('#video-player-outer-wrapper').fadeIn('slow');

		return false;
	};

	$('#video-player').click(function() {
		return false;
	});

})(jQuery);


