<!-- Keynote Standard Pop-up -->
//-----------------------------------------------------------------------------
// @FUNCTION: OpenPopupWindowNoReturnValue()
// @PURPOSE : Wrapper for openPopupWindow() function with no return value so that
//			  it can be used as the argument to the HREF attribute of an <A/> tag
//			  allowing links to maintain their true state (new, visited, hover)
// @RETURNS : nothing
//-----------------------------------------------------------------------------
function OpenPopupWindowNoReturnValue(targetURL, popup, popupName, popupWidth, popupHeight, showToolbar, showCenter, showMaximized, showNoScrollBars, showStatus)
{
	openPopupWindow (targetURL, popup, popupName, popupWidth, popupHeight, showToolbar, showCenter, showMaximized, showNoScrollBars, showStatus);
}

function openPopupWindow(targetURL, popup, popupName, popupWidth, popupHeight, showToolbar, showCenter, showMaximized, showNoScrollBars, showStatus)
{
	if (!isNaN(popupWidth))
		var WinWidth = popupWidth;
	else
		var WinWidth = 484;
		
	if (!isNaN(popupHeight))
		var WinHeight = popupHeight;
	else
		var WinHeight = 400;

	var left = null;
	var top = null;
	var toolbar = ( showToolbar == true ? "yes" : "no");
	var status = ( showStatus == true ? "yes" : "no");
	if (showMaximized == true)
	{
		WinWidth = screen.availWidth;
		WinHeight = screen.availHeight;
	}
	if (showCenter == true)
	{
		left = (screen.availWidth/2 - WinWidth/2);
		top = (screen.availHeight/2 - WinHeight/2);
	}
	
	var scrollBars;
	
	if (showNoScrollBars)
		scrollBars = "no";
	else
		scrollBars = "yes";

    if (!popup || popup.closed)
    {
//		if (!popupName)
//			popupName = "standard";

		if (showMaximized == true)
		{
			// For some reason the popup is still a bit big if you only trust the window.open
			// sizes.  Thus, we use the window.resizeTo in order to fine-tune

			// Also, because of permissions across subsystems, we need to open the window
			// first, then resize, then assign the URL
			popup = window.open("/includes/library/javascript/dialogs/maximize.asp?url=" + escape(targetURL) ,popupName,
					"resizable=yes,scrollbars=yes,menubar=no,status=" + status + ",toolbar=" + toolbar + ",HEIGHT=" + WinHeight + ",WIDTH=" + WinWidth + ",left=" + left + ",top=" + top + "");
			// Removed the following lines because of security issues
			// when the domain is set in the caller window, then we cannot resize
			// the window.  So it will have to resize itself.
			// popup.window.resizeTo(screen.availWidth,screen.availHeight);
			// Also, we cannot just set the document.location here, because the code
			// in the maximize.asp file will not execute first
			// in order to resize properly, we have to pass the url into that window
			// popup.location = targetURL;
		}
		else
		{
			// Open the window the normal way
			popup = window.open(targetURL ,popupName,
					"resizable=yes,menubar=no,scrollbars=" + scrollBars + ",status=" + status + ",toolbar=" + toolbar + ",HEIGHT=" + WinHeight + ",WIDTH=" + WinWidth + (left!=null ? ",left=" + left : "") + (top!=null ? ",top=" + top : "") + "");
		}
		if (popup != null && !popup.opener)
			popup.opener = window;

    }
    else
    {
		popup.location = targetURL;
    }	
    if (popup)
		popup.focus();    
	return popup;
}