// JavaScript Document

function doPopup( url, name, h, w, attr, formId )
{
	var props = "scrollbars,menubar,resizable,status,titlebar,toolbar";

	switch ( attr )
	{
	case "dialog":
		props = "scrollbars,resizable,status";
		break;
	case "modal":
		props = "scrollbars";
		break;
	default:
		break;
	}
	
	if ( h != undefined )
	{
		// allow for taskbar, chrome
		var y = ( window.screen.height - 32 )/2 - ( h + 50 )/2;
		props += ",height=" + h + ",top=" + y + ",screenY=" + y
	}
	
	if ( w != undefined )
	{
		var x = window.screen.width/2 - w/2;
		props += ",width=" + w + ",left=" + x + ",screenX=" + x
	}

	var nw = window.open( url, name, props );
	if ( nw == null )
	{
		alert( "Could not open new window.  If you have a popup blocker, try disabling it for this site" )
		return false;
	}
	
	nw.openerFormId = formId;
	
	if ( window.focus ) { nw.focus(); }
	return false;
}
