var Video = {
	init: function(){
		var overlay = document.createElement('div');
		overlay.id = 'overlay';
		overlay.onclick = function(){ Video.stop() };
		
		Object.extend(overlay.style, {
			position: 'absolute',
			top: 0,
			left: 0,
			zIndex: 4,
			width: '100%',
			backgroundColor: '#000',
			display: 'none'
		});
		
		document.body.insertBefore(overlay,$('bgcontainer'));
		
		var videocontainer = document.createElement('div');
		videocontainer.id = 'videocontainer';
		
		Object.extend(videocontainer.style, {
			display: 'none'
		});
		
		videocontainer.innerHTML = '<a href="javascript:;" onclick="Video.stop()" id="videoclosebutton">[x]</a><div id="videostream"></div><h3 id="videoheadline"></h3>';
		document.body.insertBefore(videocontainer,$('bgcontainer'));
	},
	
	play: function(swf,title,trans_close){
		var so = new SWFObject(swf, "fl_videostream", "425", "349", "8", "#000");
		so.addParam("allowFullScreen", "true");
		so.addParam("wmode", "transparent");
		so.write("videostream");
		var h = $('contentcontainer').getHeight()+'px';
		$('overlay').setStyle({
			height: h,
			opacity: 0
		});
		new Effect.Opacity('overlay',{
			duration: 0.3, 
			transition: Effect.Transitions.linear,
			from: 0,
			to: 0.5
		});
		$('videocontainer').show();
		$('videoheadline').innerHTML = title;
		$('overlay').show();
		if(trans_close) $("videoclosebutton").innerHTML = trans_close + ' [x]';
	},
	
	stop: function(){
		$("videostream").innerHTML = '';
		$("videocontainer").hide();
		$('overlay').hide();
	}
}
