/*
	RegisterPopup.js
	
	Copyright (C) 2002 NextPage, Inc.  All rights reserved
	An include file for a standardized "open a new window" capability.  This file is really named poorly,
	for historical reasons.
	
	rka 7-30-02 - added scrollable parameter to showPopup function
	rbn 8-30-06 - modified showPopup to allow the window to regain focus when hyperlink is clicked
*/
function exists( obj) {
	return (typeof( obj) != "undefined");
}


// --------------------------------------------------------------
// showPopup()
//	URL and name are required - URL is the page to load in the popup window,
//		name is the name of the popup window; use this name to target the window
//		from other links
//	width and height are optional parameters.  
// --------------------------------------------------------------

//although only used by showPopup(), this variable needs to be outside the function definition so its value persists
var WindowObjectReference; //a reference to the popup window object
	
function showPopup(url, name, width, height, toolbar, scrollable)
{
	if ( !exists( width) || (width == null) ) width = 590; 
	if ( !exists( height) || (height == null) ) height = 470;
	if ( !exists( toolbar) || (toolbar == null) ) toolbar = "no";
	if ( !exists( scrollable) || (scrollable == null) )	scrollable = "yes";
	var x = (screen.availWidth / 2) - (width / 2);
	var y = (screen.availHeight / 2) - (height / 2);
	var options = 'WIDTH=' + width + ',HEIGHT=' + height + ',left=' + x + ', top=' + y + ', screenX=' + x + ', screenY=' + y 
		+ ',alwaysraised=yes,status=no,toolbar=' + toolbar + ',menubar=no,scrollbars='+scrollable+',location=no,resizable=no,modal=yes';

	if (WindowObjectReference == null || WindowObjectReference.closed)
	{
		WindowObjectReference = open(url, name, options);
	}
	else
	{
		WindowObjectReference.focus();
	}
	
	return true;
} // end showPopup()

// Used to open a window modally.
function openModalWindow(sURL, sName) 
{
	if (window.showModalDialog) 
	{
		return window.showModalDialog(sURL,sName,"dialogWidth:590px;dialogHeight:490px;status:no");
		//window.showModalDialog("Register2.asp","Registration","dialogWidth:590px;dialogHeight:470px");
	} 
	else 
	{
		window.open(sURL, sName, 'height=470,width=610,toolbar=no,directories=no,status=no,	menubar=no,scrollbars=no,resizable=no,modal=yes');
		//window.open('Register2.asp','Registration', 'height=470,width=590,toolbar=no,directories=no,status=no,	menubar=no,scrollbars=no,resizable=no,modal=yes');
	}
}