function popUp(url, name, width, height, maximize, offsetWidth, offsetHeight, dialog)
{
	maxHeight = screen.availHeight - 50;
	maxWidth  = screen.availWidth  - 10;
	if (maximize == true) {
		height  = maxHeight;
		width   = maxWidth;
	}
	if (height > maxHeight) height  = maxHeight;
	if (width > maxWidth) width = maxWidth;

	if (isNaN(offsetHeight)) offsetHeight = 0;
	if (isNaN(offsetWidth)) offsetWidth = 0;
	if (offsetHeight > maxHeight - 100) offsetHeight  = maxHeight - 100;
	if (offsetWidth > maxWidth - 100) offsetWidth = maxWidth - 100;
	
	height = height - offsetHeight;
	width  = width  - offsetWidth;

  l = (maxWidth  - width) /2;
  t = (maxHeight - height) /2;

  if (name == "") {
  	var d = new Date();
  	name = "tmp" + d.valueOf();
  }
	
	if (dialog) {
		win = window.open (url, name,'location=no,titlebar=no,toolbar=no,scrollbars=no,menubar=no,status=no,resizable=no,left=' + l + ',top=' + t + ',height=' + height + ',width=' + width)
	} else {
		win = window.open (url, name,'location=no,titlebar=no,toolbar=no,scrollbars=yes,menubar=no,status=yes,resizable=yes,left=' + l + ',top=' + t + ',height=' + height + ',width=' + width)
	}
	
	if (win != undefined && win != null) {
		win.focus();
	}
//	return win;
}
