
// Tracks the current dialog box opened from this page.
var dialogWin = new Object();
// Contains a refererence to the currently-open dialog.
var wnd;


/**********************************************************************
Generates a dialog. Parameters:
    url -- URL of the page/frameset to be loaded into dialog
    width -- pixel width of the dialog
    height -- pixel height of the dialog
**********************************************************************/

function openWindow(url, width, height)
{
	if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed))
	{
		// Initialize the properties of the modal dialog object.
		dialogWin.url = url;
		dialogWin.width = width;
		dialogWin.height = height;
		// Keep the name unique so Navigator doesn't overwrite an existing dialog.
		dialogWin.name = (new Date()).getSeconds().toString();
	

		dialogWin.left = (screen.width - dialogWin.width) / 2;
		dialogWin.top = (screen.height - dialogWin.height) / 2;
                   
		var attr = "left=" + dialogWin.left + ",top=" + 
			dialogWin.top + ",resizable=yes,scrollbars=yes,width=" + 
			dialogWin.width + ",height=" + dialogWin.height;
           
		// Generate the dialog and make sure it has focus.
		dialogWin.win = window.open(dialogWin.url, dialogWin.name, attr);
		wnd = dialogWin.win;
		dialogWin.win.focus();
	}
	else
		dialogWin.win.focus();
}
