var pop = "";

function setPop(roll)
{
	pop = roll;
}

function OpenFoto(img)
{
	foto = new Image();
	
	if(pop == "")
	{
		foto.src = (img);
		ControlFoto(img);
	}
	else
	{
		foto.src = (pop);
		ControlFoto(pop);
	}
}

function ControlFoto(img)
{
	if((foto.width != 0) && (foto.height != 0))
	{
		ViewFoto(img);
	}
	else
	{
		interval_a = "ControlFoto('"+img+"')";
		interval_b = setTimeout(interval_a,20);
	}
}

function ViewFoto(img)
{
	width = foto.width + 20;
	height = foto.height + 24;

	try
	{
		if (output.closed == false)
			throw "offen";
	}
	catch (e)
	{
		if (e=="offen")
		{
			output.close();
		}
	}
	output = window.open("","output","left=40,top=40,width="+width+",height="+height+",location=no,toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,directories=no");
	output.document.writeln("<body style=\"background-color:#000000\"><a href=\"javascript:self.close()\"><img src=\""+img+"\" width=\""+foto.width+"\" height=\""+foto.height+"\" alt=\"Click here to close\" border=\"0\"></a></body>");
	output.focus();
}
