

    // JavaScript function to open a new rectangular window, best used for confirmation or
    // for entering one line of text.
    // Used by cptuSideMenu
    function OpenSmallWindow(strURL)
    {
       strXLocation = String((screen.width - 450) / 2);
	     strYLocation = String((screen.height - 175) / 2);
	     var win = OpenNewWindow(strURL,'PUWEBDIALOG','status=no,toolbar=no,location=no,menu=no,width=450,left='+strXLocation+',height=200,top='+strYLocation);
	     win.focus();
    }
    // JavaScript function for opening a help window
    // Used by cptuSideMenu
    function OpenAdminHelp(strHelpURL) {
      var strXLocation = String((screen.width - 800) / 2);
	    var strYLocation = String((screen.height - 800) / 2);
	    var winHelp = OpenNewWindow(strHelpURL,'help','status=yes,toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,location=yes,width=640,left='+strXLocation+',height=500,top='+strYLocation);
	    winHelp.focus();
    }
    // Used by frmwrk.objlister to open popup for the selection tree window.
    function OpenSelectionTreeWindow(urlToOpen)
    {
      var strXLocation = String((screen.width - 400) / 2);
      var strYLocation = String((screen.height - 400) / 2);

      window.open(urlToOpen,"TREE", "STATUS=no,TOOLBAR=no,LOCATION=no,MENU=no,WIDTH=400,LEFT="+strXLocation+",HEIGHT=400,TOP="+strYLocation);

    }

		var arrSubWindows = new Array();		// An array of subwindows opened by the pages of this editor
		bCloseSubWindowsOnExit = true;

        function OpenPreviewWindow(strURL)
        {
            OpenNewWindow(strURL, "Preview", "status=no,toolbar=yes,menubar=no,resizable=yes,scrollbars=yes,location=no,width=650,height=400");
        }
        
        function OpenLargePreviewWindow(strURL)
        {
            OpenNewWindow(strURL, "Preview", "status=no,toolbar=yes,menubar=no,resizable=yes,scrollbars=yes,location=no,width=800,height=600");
        }
        
        function OpenWideGadgetPreviewWindow(strURL)
        {
            OpenNewWindow(strURL, "Preview", "status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,location=no,width=500,height=500");
        }
        
        function OpenNarrowGadgetPreviewWindow(strURL)
        {
            OpenNewWindow(strURL, "Preview", "status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes,location=no,width=350,height=500");
        }

		function OpenNewWindow(strURL, strName, strParams)
		{
			var strQueryString = "";
			var arrstrCookies = document.cookie.split(';');
			for (var i = 0; i < arrstrCookies.length; i++)
			{
				var arrstrParsedCookie = arrstrCookies[i].split('=');
				if ("ASPSESSIONID" == TrimLeft(arrstrParsedCookie[0]).substr(0, 12))
				{
					strQueryString += "CookieName=" + TrimLeft(arrstrParsedCookie[0]);
					strQueryString += "&CookieValue=" + arrstrParsedCookie[1];
					strQueryString += "&RedirectURL=" + escape(strURL);
					break;
				}
			}

		    var winOpenedWindow = window.open(strURL, strName , strParams);
                    winOpenedWindow.focus();
		    AddToSubWindowsList(winOpenedWindow);
		    return winOpenedWindow;

		}

		function TrimLeft(strInput)
		{
			var i = 0;
			// trims spaces off the left edge of a string -sra.
			while (i < strInput.length && strInput.charAt(i) == ' ') i++;
			return strInput.substring(i, strInput.length);
		}

		function AddToSubWindowsList(win)
		{
			arrSubWindows[arrSubWindows.length] = win;
		}

		function CloseSubWindowsOnExit(bClose)
		{
			bCloseSubWindowsOnExit = bClose;
		}

		// Close all the sub windows that this window might have opened by looking at
		// the arrSubWindows array.
		function CloseSubWindows()
		{
			var intSubWindowsCount = arrSubWindows.length
			var i
			for (i = 0; i < intSubWindowsCount; i++)
			{
				// Check to make sure the subwindow exists and is not already closed
				if (arrSubWindows[i] != null && arrSubWindows[i].closed != true)
					arrSubWindows[i].close();
			}
		}