window.addEvent('domready', function() {
	var bodytags = document.getElementsByTagName("body");
	var body = bodytags[0];
	var newdiv = document.createElement("div");
	newdiv.setAttribute("id","lightPlayerdiv");
	newdiv.style.position="absolute";
	newdiv.style.top="0px";
	newdiv.style.left="0px";
	newdiv.style.width="1px";
	newdiv.style.height="1px";
	newdiv.style.overflow="hidden";

	body.appendChild(newdiv);
	
	var so = new PowershiftSWFObject("flash/playerlight.swf", "lightPlayer", "536", "340", "8", "#000000");
	so.addParam("allowScriptAccess", "always");
	so.addParam("allowFullScreen", "true");
	so.addParam("swliveconnect", "true");
	so.addParam("wmode","transparent");
	so.write("lightPlayerdiv");
})

function showVideo(video,element)
{
	if(document.getElementById("lightPlayer")&&document.getElementById("lightPlayer").playVideo)
	{
		document.getElementById("lightPlayer").playVideo(video);
	}
	//alert("before pos");
	var temp=findPos(element);
	//alert(temp[0]+"x"+temp[1]);
	document.getElementById("lightPlayerdiv").style.top=(temp[1] - 325)+"px";
	document.getElementById("lightPlayerdiv").style.left=temp[0] -536 +"px";
	document.getElementById("lightPlayerdiv").style.width="536px";
	document.getElementById("lightPlayerdiv").style.height="340px";
	return false;
}
function findPos(obj) 
{
	var curleft = curtop = 0;
	if (obj.offsetParent)
	{
		do 
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}
function hideVideo()
{
	document.getElementById("lightPlayerdiv").style.height="1px";
	document.getElementById("lightPlayerdiv").style.width="1px";
}

