	popupWindow = null;
	
   /**
    * Produces a popup window, using the given title,
    * widht and height and showing the page with url
    * content.
    * A reference to the popup is stored in the global
    * variable popupWindow.
    */
	function Popup(content, title, width, height) {
	
		// if the popup is visible, then give it the focus
		if (popupWindow != null) {
			//popupWindow.focus();
			//return false;
		}
		
		var top = screen.height/2 - height/2;
		
		var left = screen.width/2 - width/2;
		
		var props = "toolbar=no";
			props += ",location=no";
			props += ",directories=no";
			props += ",status=no";
			props += ",menubar=no";
			props += ",scrollbars=no";
			props += ",scrollbars=0";
			props += ",resizable=no";
		
			props += ",left=" + left;
			props += ",top=" + top;
			props += ",width=" + width;
			props += ",height=" + height;
					
		popupWindow = window.open(content, title, props);
		popupWindow.focus();
	}

   /**
    * Function to close the popup.
    */
	function ClosePopup() {
		popupWindow.close();
		popupWindow = null;
	}

   /**
    * Reloads the url currently displayed in the window.
    */
	function Reload(window) {
		var url = window.location.href;
		//var pos = url.indexOf("?");
		//if (pos > -1) url = url.substring(0, pos);
		//url = url + "?reload=true";
		window.location.href=url;
	}
	
   /**
    * Reloads the url currently displayed in the window after
    * having waited for two seconds.
    */
	function ReloadDeferred(window) {
		start = (new Date()).getSeconds();
		while (((new Date()).getSeconds() - start) < 2) { ; }
		Reload(window);
	}
