function popwin(winurl, winname, width, height, features, xoffset, yoffset)
{
	var max_width = 640;
	var max_height = 480;
	if (screen)
	{
		if (screen.availWidth && screen.availHeight)
		{
			max_width = screen.availWidth;
			max_height = screen.availHeight;
		}
	}

	if (features == null)
		var f = 'channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0';
	else
		var f = features;
	var shrink2fit = (f.indexOf('resizable=1') > -1);

	var w = width;
	var h = height;

	if (w == null  ||  w <= 0  ||  (shrink2fit == 1  &&  w > max_width))
	{
		x = 10;
		w = max_width - 10 - (x*2);
	}
	else
	{
		x = (max_width - w)/2;
	}
	if (h == null  ||  h <= 0  ||  (shrink2fit == 1  && h > max_height))
	{
		y = 30;
		h = max_height - 50 - (y*2) - 40*(f.indexOf('toolbar=1') > -1);
	}
	else
	{
		y = (max_height - h)/2;
	}

	if (xoffset != null)
		x += xoffset;
	if (yoffset != null)
		y += yoffset;

	if (x < 0  ||  x >= max_width - 25)
		x = 0;
	if (y < 0  ||  y >= max_height - 30)
		y = 0;

	var nw = window.open(winurl,winname,'width='+w+',height='+h+',screenX='+x+',screenY='+y+',top='+y+',left='+x+','+f);
	if (! nw.opener)
		nw.opener = self;
	if (nw && nw.focus)
		nw.focus();
	return nw;
}
function myvoid()
{
	;	// do nothing
}
function popwin2(winurl, winname, width, height, features, xoffset, yoffset)
{
	return popwin(winurl, winname, width, height, 'channelmode=0,dependent=1,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=1,toolbar=0', xoffset, yoffset);
}

