function popup(url, name, width, height, weight, scrollbars)
{
	var left, top, args;

	if(screen.width < width)
	{
		left = 0;
	}
	else
		left = (screen.width - width) / 2;

	if((screen.height - 30) < height)
	{
		top = 0;
		scrollbars = 1;
		height = height - 100;
	}
	else
		top = ((screen.height * weight) - height) / 2;

	args  =  'top=' + top + ',';
	args += 'left=' + left + ',';
	args += 'width=' + width + ',';
	args += 'height=' + height + ',';
	args += 'scrollbars=' + scrollbars + ',';

	win = window.open(url, '_blank', args);
	win.focus();
}
