﻿function include(filename)
{
	var head=document.getElementsByTagName('head')[0];
	
	script=document.createElement('script');
	script.src=filename;
	script.type='text/javascript';
	head.appendChild(script)
}

function hideObject(ID)
{
	var element;
	if (element=document.getElementById(ID))
		element.style.display="none";
}

function deleteObject(ID)
{
	var element;
	if (element=document.getElementById(ID))
		element.parentNode.removeChild(element);
}

function showObject(ID)
{
	var element;
	if (element=document.getElementById(ID))
		element.style.display="block";
}

function displayVideo()
{
	var Popup,Pane,swf;
	if (!(Pane=document.getElementById('VideoPopup')))
	{
		Pane=document.createElement('div');
		Pane.setAttribute('id','Shade');
		Pane.style.display='none';
		Pane.style.backgroundColor='white';
		Pane.style.opacity='0.5';
		Pane.style.MozOpacity='0.5';
		Pane.style.filter='alpha(opacity=50)';
		Pane.style.position='absolute';
		Pane.style.top='0';
		Pane.style.left='0';
		Pane.style.width='100%';
		Pane.style.height='100%';
		Pane.style.zIndex='100';
		document.body.appendChild(Pane);
		Popup=document.createElement("div");
		Popup.setAttribute("id","VideoPopup");
		Popup.style.display='none';
		Popup.style.backgroundColor='#333';
		Popup.style.padding='10px';
		Popup.style.position='absolute';
		Popup.style.top='190px';
		Popup.style.left='280px';
		Popup.style.width='662px';
		Popup.style.height='420px';
		Popup.style.zIndex='200';
		document.body.appendChild(Popup);
		Pane=document.createElement("div");
		Pane.setAttribute("id","VideoPane");
		Pane.style.display='none';
		Popup.appendChild(Pane);
		Anchor=document.createElement('a');
		Anchor.id='Close';
		Anchor.setAttribute('href','#');
		Anchor.onclick=function() { hideVideo(); return false; };
		Anchor.innerHTML='Close X';
		Anchor.style.position='relative';
		Anchor.style.cssFloat='right';
		Anchor.style.styleFloat='right';
		Anchor.style.top='5px';
		Popup.appendChild(Anchor);
		swf=new SWFObject('/flash/player.swf','player','662','400','9','#ffffff');
		swf.addParam('allowfullscreen','true');
		swf.addParam('flashvars','file=plooijer&provider=rtmp&streamer=rtmp://ultrablue.fms.nxs.nl/vod/&autostart=true&bufferlength=2');
		swf.write('VideoPane');
	}
	showObject('Shade');
	showObject('VideoPopup');
	showObject('VideoPane');
}

function hideVideo()
{
	deleteObject('VideoPopup');
	deleteObject('Shade');
}

include('/javascript/swfobject.js');
