function fobjOpenWindow(bstrWindowURL, bstrWindowName, bstrWindowFeatures)
{
  if (bstrWindowFeatures == "")
	{
    bstrWindowFeatures = "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=600";
	}
  window.open(bstrWindowURL, bstrWindowName, bstrWindowFeatures);
}

function fysnShowHideMenu(bobjSender, bstrElementInnerHTML)
{
  /* Code to put in page controls
     <h4 onclick="fysnShowHideMenu(this, this.innerHTML);" onmouseover="javascript:this.style.cursor = 'pointer';" onmouseout="javascript:this.style.cursor = 'auto';"><div class="DropDownNav_Expander">+ </div>Bibliography2</h4>
     <ul id="Bibliography2" class="DropDownNav">
  */
  // Strip out the expander button
  var bstrElementId = bstrElementInnerHTML.replace(/\<[^<>]*?\>[^<>]*?\<\/[^<>]*?\>/, "");
  // Strip out illegal characters from element id
  bstrElementId = bstrElementId.replace(/[^a-zA-Z0-9_]/g, "");
  // If the menu is visible (which also catches whether it is the first load since style won't be set yet),
  if (document.getElementById(bstrElementId).style.visibility == "visible")
  {
    // Make it invisible.
    document.getElementById(bstrElementId).style.visibility = "collapse";
    document.getElementById(bstrElementId).style.display = "none";
    // Switch expander
    bobjSender.innerHTML = bstrElementInnerHTML.replace("[&ndash;] ", "[+] ");
  }
  else // If the menu is not visible
  {
    // Make it visible.
    document.getElementById(bstrElementId).style.visibility = "visible";
    document.getElementById(bstrElementId).style.display = "inline";
    // Switch expander
    bobjSender.innerHTML = bstrElementInnerHTML.replace("[+] ", "[&ndash;] ");
  }
}

// Drop-down menu code

/* Code to put in page controls
   <h4 class="DropDownNav" onclick="fysnMenuClick(this, 'hide');" onmouseover="fysnMenuMouseOver(this, 'show');" onmouseout="fysnOpenTimerCancel(this);">A Region Defined</h4>
   <ul id="ARegionDefined" class="DropDownNav">
*/

var bintTimeoutOpen = 250;
var bintTimeoutClose = 500;
var baryTimerOpen = new Array();
var baryTimerClose = new Array();

function fysnMenuMouseOver(bobjSender, bstrOperation)
{
	var bstrElementId = fstrGetElementId(bobjSender.innerHTML);	
	fysnTimerStart(bstrElementId, bstrOperation);
}

function fysnMenuClick(bobjSender, bstrOperation)
{
	var bstrElementId = fstrGetElementId(bobjSender.innerHTML);
	fysnTimerStop(bstrElementId, bstrOperation);
	fysnShowHideElement(bstrElementId, bstrOperation);
}

function fysnTimerStart(bstrElementId, bstrOperation)
{
  // Initialize the placeholder variables
	var bintTimeout = null;
	var baryTimer = null;
	
	// If the operation is to show
	if (bstrOperation === "show")
	{
		// Set the timeout to the opener timeout
		bintTimeout = bintTimeoutOpen;
		baryTimer = baryTimerOpen;
	}
	else
	{
		// Set the timeout to the closer timeout
		bintTimeout = bintTimeoutClose;
		baryTimer = baryTimerClose;
	}
	
	// Start the timer
	baryTimer[bstrElementId] = window.setTimeout("fysnShowHideElement('" + bstrElementId + "', '" + bstrOperation + "')", bintTimeout);
}

function fysnTimerStop(bstrElementId, bstrOperation)
{
  // Initialize the placeholder variable
	var baryTimer = null;
	
	// If the operation is to show
	if (bstrOperation === "show")
	{
		// Set the timer holder to the opener array
		baryTimer = baryTimerOpen;
	}
	else
	{
		// Set the timer holder to the closer array
		baryTimer = baryTimerClose;
	}
	
	// Cancel the timer
	if(baryTimer[bstrElementId])
	{
		window.clearTimeout(baryTimer[bstrElementId]);
		baryTimer[bstrElementId] = null;
	}
}

function fstrGetElementId(bstrSenderInnerHTML)
{
	// Strip out everything but the text in the h4
	var bstrElementId = bstrSenderInnerHTML.replace(/.*?(?:\<h4[^<>]*?\>)?([\d\w\s]*)(?:\<\/h4\>[^\z]*)/, "$1");
	// Strip out the expander button
	bstrElementId = bstrElementId.replace(/\<[^<>]*?\>[^<>]*?\<\/[^<>]*?\>/, "");
	// Strip out illegal characters from element id
	bstrElementId = bstrElementId.replace(/[^a-zA-Z0-9_]/g, "");
	
	return bstrElementId;
}

function fysnShowHideElement(bstrElementId, bstrOperation)
{
	// Get the element into a variable
	bobjElement = document.getElementById(bstrElementId);
	// If there is no operation specified, do a toggle
	if ((bstrOperation === "toggle") || (bstrOperation === "hide") || (bstrOperation === "show"))
	{
		// If the menu is visible (which also catches whether it is the first load since style won't be set yet),
		if (((bstrOperation === "toggle") || (bstrOperation === "hide")) && (bobjElement.style.visibility === "visible"))
		{
			// Make it invisible.
			bobjElement.style.visibility = "collapse";
			bobjElement.style.display = "none";
		}
		else if (((bstrOperation === "toggle") || (bstrOperation === "show")) && (bobjElement.style.visibility !== "visible"))
		{
			// Make it visible.
			bobjElement.style.visibility = "visible";
			bobjElement.style.display = "inline";
		}
	}
}