var hWndDisclaimer = null; //variable to contain handle of the window
var features_Disclaimer = "toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,height=390,width=300"; // window features
var nmWndDisclaimer = "window_Disc"; // name of the window (same as HTML target)
var functionClose = CloseDisclaimerWindow; //function name that closes the window for this script

// Initiates launch of the window.
// Any old window is closed before the new window is re-opened under the same name; this has been done for browser-compatibility purposes.
// Netscape runs this function once whereas IE runs this function twice. IE uses a two-step 
// process because it needs to pause after closing the old window (before opening the new
// window), otherwise the new window may never open.
// Maybe this happens in IE because maybe the old window's thread is still closing while the
// JavaScript may be allowed to continue (unsure). What is known is the pause allows enough 
// time that IE does not exhibit the weird behaviour after the pause is completed.
// Not all IEs suffer from this open/close window phenomena, but for brevity purposes I make
// all IEs go through the two-step process because all of them can without error. 
function LaunchDisclaimerWindow(url, iePart2) {
	CloseDisclaimerWindow();
	if (iePart2 || !document.all) //IE browser in second phase, or another browser in first/only phase
		hWndDisclaimer = window.open(url, nmWndDisclaimer, features_Disclaimer);
	else //Pause after IE phase 1 (closing window) before phase 2 (opending window again) ...
		setTimeout("LaunchDisclaimerWindow('" + url + "','Do_IE_Phase_2')", 250);
	return false;
}
// Only closes the window if it appears to be opened.
function CloseDisclaimerWindow() {
	if (hWndDisclaimer != null) {
		if (!hWndDisclaimer.closed) hWndDisclaimer.close();
		hWndDisclaimer = null;
	}
	return false;
}


//*** Implement a multi-close-action ability for all browsers when the window closes.
// For example, this can be used when the browser needs to close multiple popups upon exit.

// When called, Iterate through the multi-action array and perform all actions.
function MultiActionCloseFunction() {
	if (window.MultiActionCloseArray != null)
		for (var idx = 0; idx < window.MultiActionCloseArray.length; idx++)
			window.MultiActionCloseArray[idx]();
	return false;
}
// Attach the multi-action function to the window.onunload event.
if (!window.onunload)
	window.onunload = MultiActionCloseFunction;
// Define the multi-action array if it doesn't already exist.
if (!window.MultiActionCloseArray)
	window.MultiActionCloseArray = new Array();
// Add this script's close action to the multi-action array.
window.MultiActionCloseArray[window.MultiActionCloseArray.length] = functionClose;
