var myRequestV = null;
var idToHandl;
function CreateXmlHttpReq(handler) 
{
	var xmlhttp = null;
	try 
	{
		xmlhttp = new XMLHttpRequest();
	} 
	catch(e) 
	{
		try 
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e) 
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	xmlhttp.onreadystatechange = handler;
	return xmlhttp;
}
function myHandlerV() 
{
	if (myRequestV.readyState == 4 && myRequestV.status == 200)
	{
		e = document.getElementById(idToHandl);
		if(myRequestV.responseText.length==0)
		{
			e.innerHTML = 'Oggetto non Trovaro';
		}
		else e.innerHTML = myRequestV.responseText;
	}
}
function GetMovie(id) 
{	
	e = document.getElementById(idToHandl);
	e.innerHTML = '<img src="Imm/lighr/ajax-loader.gif">';
    myRequestV = CreateXmlHttpReq(myHandlerV);
    myRequestV.open("GET","getmovie.php?id="+id);
    myRequestV.send(null);
	return false;
}

function closemovie()
{
	ScrollBanNO();
	var element = document.getElementById("boxeio");
	document.body.removeChild(element);
	element = document.getElementById("backbox");
	document.body.removeChild(element);
}
function getmovie(id)
{
	var parent = window.parent.document;
	var div = parent.createElement('div');
	div.id="backbox";
	
	if (document.body.scrollHeight) 
		docHt = sh = document.body.scrollHeight;
	if (document.body.offsetHeight) 
		docHt = oh = document.body.offsetHeight;
	if (sh && oh) 
		docHt = Math.max(sh, oh);
	if (document.body.scrollWidth) 
		docWt = sw = document.body.scrollWidth;
	if (document.body.offsetWidth) 
		docWt = ow= document.body.offsetWidth;
	if (sw && ow) 
		docWt = Math.min(sw,ow);
		

	div.style.height=docHt+50+"px";
	div.style.width=docWt+"px";
	div.style.position = "absolute";
	
	document.body.appendChild(div);
	
	setOpacity(20);
	
	div.onclick=closemovie;
	
	var box = parent.createElement('div');
	box.id="boxeio";
	box.innerHTML="<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"Imm/light/tl.png\" height=\"20\" width=\"20\"></td><td background=\"Imm/light/top.png\" height=\"20\"></td><td background=\"Imm/light/tr.png\" height=\"20\" width=\"20\"></td></tr><tr><td background=\"Imm/light/left.png\" width=\"20\"></td><td bgcolor=\"#ffffff\"  height=\"25\" valign=\"top\" align=\"left\"><a href=\"javascript:;\" onclick=\"closemovie()\"><img src=\"Imm/light/close.png\" border=\"0\"></a></td><td background=\"Imm/light/right.png\" width=\"20\"></td></tr><tr><td background=\"Imm/light/left.png\" width=\"20\"></td><td width=\"425\" height=\"344\"><div id=\"idisin\" style=\"background: url(Imm/center_videobox.JPG) top left repeat;\"></div></td><td background=\"Imm/light/right.png\" width=\"20\"></td></tr><tr><td background=\"Imm/light/bl.png\" height=\"20\" width=\"20\"></td><td background=\"Imm/light/bottom.png\" height=\"20\"></td><td background=\"Imm/light/br.png\" height=\"20\" width=\"20\"></td></tr></table>";
	idToHandl="idisin";
	document.body.appendChild(box);
	ScrollBanOK();
	
	GetMovie(id);
	
}
var SB;
function ScrollBanOK()
{
	document.getElementById("boxeio").style.position = "absolute";
	document.getElementById("boxeio").style.top = document.documentElement.scrollTop +"px";
	document.getElementById("boxeio").style.left = "0px";
	document.getElementById("boxeio").style.marginLeft = (screen.width/2 - 300) +"px";
	document.getElementById("boxeio").style.marginTop = "10px";
	SB = window.setTimeout("ScrollBanOK()", 1);
}
function ScrollBanNO()
{
	window.clearTimeout(SB);
}
function setOpacity(opacity)
{
	var element = document.getElementById("backbox");
	opacity=(opacity==100) ? 99.999 : opacity;
	element.style.filter = "alpha(opacity:"+opacity+")";
	element.style.KHTMLOpacity = opacity/100;
 	element.style.MozOpacity = opacity/100;
	element.style.opacity = opacity/100;
} 