function ShowFlash(showhide, url, title, position, id)
{
	if(showhide)
	{
		Centercontrol();
		document.getElementById("spantitle").innerHTML = title;
		AdjustTitleSize(title);
		document.getElementById("FlashObject").style.visibility = "visible";
		loadPlayer(url,id,'http://khilafat.dk/flv/stream.php',position);
	}
	else if(!showhide)	
	{
		document.getElementById("FlashObject").style.visibility = "hidden";
		var swfObject = new SWFObject('', "flvvideoplayer", "512px", "384px", "7", "#ffffff"); 
		swfObject.write("FlashRegion");
	}
	SetVideoDivHeight();
}

function AdjustTitleSize(title)
{
	var spantitle = document.getElementById('spantitle');
	
	if(title.length < 35)
	{
	 	spantitle.style.fontSize = 24;
	}
	else
	{
		spantitle.style.fontSize = 18;
	}
	
}
	
function Centercontrol()
{
	var topPos = document.body.scrollTop;
	var divTitle = document.getElementById('MovieTitle'); 
	var divCloseBtn = document.getElementById('CloseButton'); 
	var divFlashRegion = document.getElementById('FlashRegion'); 
	
	if (document.getElementById&&!document.all) 
	{
		divTitle.style.top = topPos + 50;
		divCloseBtn.style.top = topPos + 17;
		divFlashRegion.style.top = topPos + 100;
	}
	else
	{
		divTitle.style.posTop = topPos + 50;
		divCloseBtn.style.posTop = topPos + 17;
		divFlashRegion.style.posTop = topPos + 100;
	}
}

function loadPlayer(fil,id,str,stt) 
{
		var swfObject = new SWFObject('flv/flvplayer.swf', "flvvideoplayer", "512px", "384px", "7", "#ffffff"); 
		swfObject.addParam("allowfullscreen","true");
		swfObject.addVariable("file",fil);
		swfObject.addVariable("start",stt);
		swfObject.addVariable("autostart","true");
		swfObject.addParam("allowfullscreen","true");
		swfObject.useExpressInstall('flv/expressinstall.swf');
		//so.addVariable("logo","http://khilafat.dk/gfx/bismillah.gif");
		if(id != '')
		{ 
			swfObject.addVariable("id",id); 
		} 
		else 
		{
			swfObject.addVariable("type","flv");
		}
		if(str != '') 
		{ 
			swfObject.addVariable("streamscript",str); 
		}
		swfObject.write('FlashRegion');
}
 
function SetVideoDivHeight()
{
	document.getElementById("FlashObject").style.height = document.body.scrollHeight;
}
