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);
  if (win)
	win.focus();
  else
  	alert("Failed to open window: " + url + "\nID = " + id + "\nOpts = \n" + opt);
}

function fullscreen(w) {
  if (w == undefined)
    w = top.window;
  if (document.all) {
    w.resizeTo(screen.availWidth,screen.availHeight);
  } else if (document.layers||document.getElementById) {
    if (w.outerHeight < screen.availHeight || w.outerWidth < screen.availWidth) {
      w.outerHeight = screen.availHeight;
      w.outerWidth = screen.availWidth;
    }
  }
}
