function popup(url, id, w, h, x, y, resize, scrollbar, menubar, status, toolbar) {
  var opt = '';

  if (w != undefined) {
	opt += 'width=' + w + ',';
	if (x == undefined)
		x = (screen.width - w) / 2;
	opt += 'left=' + x  + ',';
  }

  if (h != undefined) {
	opt += 'height=' + h + ',';
	if (y == undefined)
		y = (screen.height - h) / 2;
	opt += 'top=' + y + ',';
  }

  if (resize != undefined)		opt += 'resizable=no,';
  if (scrollbar != undefined)	opt += 'scrollbars=' + scrollbar + ',';
  if (menubar != undefined)		opt += 'menubar=' + menubar + ',';
  if (status != undefined)		opt += 'status=' + status + ',';
  if (toolbar != undefined)		opt += 'toolbar=' + toolbar + ',';

  var win = window.open(url, id, opt);
  win.focus();
}
