function ShowImg(url, x, y)
{
	SetScroll();
	Resize();
	onresize = Resize;

	try
	{
		document.getElementById("ImgHolder").src = url;
		document.getElementById("ImgHolder").width = x;
		document.getElementById("ImgHolder").height = y;
		document.getElementById("IMGWindowDiv").style.display = "block";

	}
	catch(e)
	{
		x+=30;
		y+=30;
		l = (screen.width-x)/2;
		t = 50;
		window.open(url,'w' + Math.round(Math.random()*1000),'status=yes,width=' + x + ',height=' + y + ',left=' + l + ',top=' + t + ',toolbar=no,menubar=no,location=no,scrollbars=no');
	}
}

function CloseImg()
{
	document.getElementById('IMGWindowDiv').style.display='none';
	onresize = null;
	document.getElementById("ImgHolder").src = "simg/pix.gif";
	document.getElementById("ImgHolder").width = 1;
	document.getElementById("ImgHolder").height = 1;
}

function Resize()
{

	sizer = document.getElementById("Sizer");
	imgWindowDiv = document.getElementById("IMGWindowDiv");
	imgWindowDiv.style.width=sizer.offsetWidth + "px";
	imgWindowDiv.style.height=sizer.offsetHeight + 200 + "px";
}


function SetScroll()
{
	try
	{

		ScrollPosition = document.documentElement.scrollTop;
	
		if(ScrollPosition == 0)
		{
			document.getElementById("IMGWindowPad").style.marginTop = "0px";
			scroll(0,0);
		}
		else
		{
			document.getElementById("IMGWindowPad").style.marginTop = ScrollPosition + "px";
		}
	}
	catch(e)
	{
		scroll(0,0);
	}
}

