

	function ViewImage(sImageName, iWidth, iHeight, sWinName)
	{
		iWidth += 30;
		iHeight += 60;
		
		if (iHeight > 600) iHeight = 600;
		if (iWidth > 800) iWidth = 800;
		
		sWinName = "window"+new Date().getTime();		
		window.open(sImageName,sWinName,GetWindowFeaturesScrollbars(iWidth,iHeight));
		
	}
	
	function GetWindowFeatures(winWidth, winHeight)
{
	var leftPosition,topPosition;
	
	leftPosition = (screen.width-winWidth)/2;
	if (leftPosition < 0) leftPosition = 0;
	topPosition  = (screen.height-winHeight)/2;
	if (topPosition < 0) topPosition = 0;
	
	sFeatures =  "width=" + winWidth + ",height=" + winHeight + ",top=" + topPosition + ",left=" + leftPosition;
	sFeatures += ",scrollbars=no,location=no,status=no,menubar=no,toolbar=no,resizable=yes";
	
	return sFeatures;
}
function GetWindowFeaturesScrollbars(winWidth, winHeight)
{
	var leftPosition,topPosition;
	
	leftPosition = (screen.width-winWidth)/2;
	if (leftPosition < 0) leftPosition = 0;
	topPosition  = (screen.height-winHeight)/2;
	if (topPosition < 0) topPosition = 0;
	
	sFeatures =  "width=" + winWidth + ",height=" + winHeight + ",top=" + topPosition + ",left=" + leftPosition;
	sFeatures += ",scrollbars=yes,location=no,status=no,menubar=no,toolbar=no,resizable=yes";
	
	return sFeatures;
}


