		function popFaqWin(url)
			{
			w = window.open(url,'FAQ','width=600,height=400,resizable,scrollbars');
			w.focus();
			}

		function openDesignSidebar()
			{
			var elem = document.getElementById ("designSidebar");
			if (elem && elem.style.display == "none" && gParentDBID != "")
				{
				var spacer = document.getElementById ("dsbSpacer");
				
				elem.style.display = "";
				spacer.style.display = "";
				spacer.style.width = elem.offsetWidth - 1;
				document.cookie = "dbar=" + gParentDBID;
				}
			
			}


		function closeDesignSidebar()
			{
			var elem = document.getElementById ("designSidebar");
			if (elem && elem.style.display == "" && gParentDBID != "")
				{
				var spacer = document.getElementById ("dsbSpacer");
				
				elem.style.display = "none";
				spacer.style.display = "none";
				document.cookie = "dbar=0";
				}
			
			}


		function ShowNavMenu(clicked)
			{
			ShowMenu ("NavMenu", "NavButton", clicked, 1);
			}

		function ShowShareMenu(clicked)
			{
			ShowMenu ("ShareMenu", "ShareButton", clicked, 1);
			}

		function ShowCustomizeMenu(clicked)
			{
			ShowMenu ("CustomizeMenu", "CustomizeButton", clicked, 1);
			}

		function ShowViewsMenu(clicked)
			{
			ShowMenu ("ViewsMenu", "ViewsButton", clicked, 1);
			}

		function ShowFunctionsMenu(clicked)
			{
			ShowMenu ("FunctionsMenu", "FunctionsButton", clicked, 1);
			}

		function ShowIWantToMenu(clicked)
			{
			if (clicked)
				ShowMenu ("IWantToMenu", "IWantToButton", clicked, 3);
			}

		function ShowHelpMenu(clicked)
			{
			if (clicked)
				ShowMenu ("HelpMenu", "HelpButton", clicked, 3);
			}

		function ShowFind(clicked)
			{
			ShowMenu ("FindLayer", "FindButton", clicked, 1);
			
			var srchtxt = document.getElementById ("srchtxt");
			if (srchtxt)
				srchtxt.select();
			}

		function ShowTableMenu (which, clicked)
			{
			var menuID   = "table" + which + "Menu";
			var buttonID = "table" + which + "Button";
			
			ShowMenu (menuID, buttonID, clicked, 1);
			}

		function ShowFieldsMenu (dbid)
			{
			
			ShowMenu ("FieldsMenu_" + dbid, "fieldsButton_" + dbid, true, 2, "noFocus");
			}

		var pageLoadComplete = false;

		function StdLoadProc()
			{
			var elem = document.getElementById ("designSidebar");
			if (elem.style.display != "none")
				{
				var spacer = document.getElementById ("dsbSpacer");
				spacer.style.display = "";
				spacer.style.width = elem.offsetWidth - 1;
				}

			var footer = document.getElementById ("legalFooter");
			if (footer)
				{
				footer.style.position = "absolute";
				PositionX (footer, "right", 10);
				PositionY (footer, "bottomButNot", 10);
				
				footer.style.visibility = "visible";
				}

			var defItem = document.getElementById ("defFocus");
			if (defItem)
				defItem.focus();

			if ( hasCookie("DoQESPopup") && 
				 getCookieValue("DoQESPopup") == "1")
				{
				window.open ("/pgm/d/QESPopup.html","QESPopup",
							 "width=550, height=80, scrollbar");
				}

			if (msgBoxMsg != "")
				OpenMsgBox();

			if (autoFAQ != "")
				popFaqWin ('main?a=faq&faqid=' + autoFAQ);

			if (typeof InitializeDatePicker == 'function')
				InitializeDatePicker ();

			if (typeof LoadProc == 'function')
				LoadProc();

			pageLoadComplete = true;
			}

		function StdUnloadProc()
			{
			if (typeof UnloadProc == 'function')
				UnloadProc();
			}

		function StdClickProc(event)
			{
			if (!pageLoadComplete)
				return;

			var isDatePickerOpen = false;			

			if (typeof g_Calendar != "undefined" && g_Calendar.containerLayer)
				isDatePickerOpen = (g_Calendar.containerLayer.style.visibility == 'visible');

			var isInMenu = IsClickInOpenMenu(event)

			if (!isDatePickerOpen && ( !isInMenu || GetTargetTag(event) == "A" ))
				{
				HideMenus();
				}

			if (typeof DatePickerClick == 'function')
				DatePickerClick (event);

			CaptureSelectState();

			if (typeof ClickProc == 'function')
				ClickProc();

			}

		function StdKeyDownProc()
			{
			if (typeof ClickProc == 'function')
				KeyDownProc();
			}

		function CloseBox(which)
			{
			var popup = document.getElementById (which);
			if (popup)
				{
				popup.style.visibility = "hidden";
				popup.style.display = "none";
				}
			}

	//***********************************************
	//
	// Functions for the popup Table selector
	//

	var gAction;

	function popupTableSelector(action)
		{
		if (gSingleTableAppDBID != "")
			{
			location = gSingleTableAppDBID + "?a=" + action;
			return;
			}

		gAction = action;
		
		var popup = document.getElementById ("tableSelector");
		if (popup)
			{
			popup.style.display = "";
			Center (popup);
			popup.style.visibility = "visible";
			
			SetCurrentMenuElem (popup, 0);
			HideSelects(popup);
			}
		}

	//***********************************************
	//
	// Functions for the Message Box
	//

	function OpenMsgBox()
		{
		var popup = document.getElementById ("msgBox");
		if (popup)
			{
			popup.style.display = "";
			PositionX (popup, "center", 0);
			PositionY (popup, "top", 100);
			popup.style.visibility = "visible";
			
			SetCurrentMenuElem (popup, 0);
			HideSelects(popup);
			}
		}



	//***********************************************
	//
	// Functions for the More Intro Box
	//

	function OpenMoreIntro()
		{
		var popup = document.getElementById ("moreIntroBox");
		if (popup)
			{
			popup.style.display = "";
			PositionX (popup, "center", 0);
			PositionY (popup, "top", 100);
			popup.style.visibility = "visible";
			
			SetCurrentMenuElem (popup, 0);
			HideSelects(popup);
			}
		}


