	/***********************************************************************
	 * JavaScript Function File
	 *	 fToolbars.js
	 *
	 * Synopsis
	 *  This file is used to build the toplevel menu's for the site
	 *
	 ***********************************************************************/
 
	var bolBrowserCompat = false;
	var strTopMenuHTML = "";
	var strReplace = "<!-- MENU -->";
	var eCurrentTopMenu = "";
	
	//if (is.ie4up) // we have lift off
		bolBrowserCompat = true; 
	
	if (bolBrowserCompat)
	{
		strTopMenuHTML = "<div id=menuRow class=menuBack>" + strReplace; // begin menu string
		document.onmouseover = mouseOver; // assign function to mouseover calls
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   mouseOver()
	 * 
	 * SYNOPSIS
	 *   Function assigned to all mouseover calls, kicks into play when
	 *	 mouse moves over a menu element. Used to turn menu's on/off
	 ***********************************************************************/
	
	function mouseOver() {
		var eSource = window.event.srcElement;
		
		if (eSource.name == "topMenu") { // If current element is a menu topic
		
			// get current elements id,  replacing any occurence of "div" to ""
			var eMenu = document.all[eSource.id.replace("div", "")]
			// Get element width
			var intWidth = eSource.offsetWidth 
			
			// If there is already a menu on display and it doesnt belong to current menu
			if (eCurrentTopMenu && eCurrentTopMenu != eMenu) 
				hideTopMenu(eCurrentTopMenu); // hide it
						 
			if (eMenu) // If submenu exists
				showTopMenu(eMenu, intWidth)	// show it
		}
		// If a menu is visible, and it isnt contained in the current element and isnt a child of menuRow
		else if (eCurrentTopMenu && !eCurrentTopMenu.contains(eSource) && !menuRow.contains(eSource))
			hideTopMenu(eCurrentTopMenu); // hide it
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   showMenu(eSource, intMinWidth)
	 * 
	 * SYNOPSIS
	 *   Displays currently selected menu getting positional information
	 * 	 from the source element
	 ***********************************************************************/
	
	function showTopMenu(eSource, intMinWidth)
	{	
		// set x and y offset value for pull down menus
		x  = window.event.srcElement.offsetLeft + window.event.srcElement.offsetParent.offsetLeft ; // Don't ask, it just gets the left value
		y  = menuRow.offsetHeight + 0; // Go on, take a wild one
		
		// Set minimum menu width
		if (intMinWidth < 150)
			intMinWidth = 150 
		
		// Assign min width to menu if its smaller than minwidth
		if (eSource.style.width < intMinWidth)
			eSource.style.width = intMinWidth; 
		
		var intTemp = cleanUpNumber(eSource.style.width)
		intTemp = Number(x) + intTemp;
		
		var intDocWidth = document.body.clientWidth; // Get available client width
		
		// If the menu is going to stretch outside the page, shuffle inside the available width
		if(intTemp > intDocWidth) {
			var intDiff = intTemp - intDocWidth
			x = x - intDiff - 3;
		}
		
		eSource.style.left = x;		
		eSource.style.top = y;
		eSource.style.visibility = "visible";
		eSource.style.filter = "alpha(opacity=80)"; // If this filter is left on it leaves remnants of the menu behind
		eCurrentTopMenu = eSource;
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   hideMenu(eSource)
	 * 
	 * SYNOPSIS
	 *   Does what its says :-)
	 ***********************************************************************/
	
	function hideTopMenu(eSource)
	{
		eSource.style.filter = "none";
		eSource.style.visibility = "hidden";
		eCurrentTopMenu = "";
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   cleanUpNumber(strSource)
	 * 
	 * SYNOPSIS
	 *   Does what its says :-)
	 ***********************************************************************/
	
	function cleanUpNumber(strSource)
	{
		intTemp = parseInt(strSource);
		return Number(intTemp);
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   buildMenu()
	 * 
	 * SYNOPSIS
	 *   Adds closing tag to menu str and writes it to the document
	 ***********************************************************************/
	
	function buildTopMenu()
	{
		strTopMenuHTML += "</div>";
		document.write(strTopMenuHTML);	
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   addMenu(strMenuID, strMenuItem, strMenuURL)
	 * 
	 * SYNOPSIS
	 *   Adds a main element to the menu
	 ***********************************************************************/
	
	function addTopMenu(strMenuID, strMenuItem, strMenuURL)
	{
		var tempMenu
		
		if (strMenuURL == null) 
			tempMenu = "<span class=menuHeader id=div" + strMenuID + " name=topMenu>" + strMenuItem + "</span>&nbsp;&nbsp;&nbsp;&nbsp;"	
		else
			tempMenu = "<span><a class=menuHeader href=" + strMenuURL + " id=div" + strMenuID + " name=topMenu>" + strMenuItem + "</a></span>&nbsp;&nbsp;&nbsp;&nbsp;"
		tempMenu += strReplace
		
		strTopMenuHTML = strTopMenuHTML.replace(strReplace, tempMenu);
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   addSubMenu(strMenuID, strMenuItem, strMenuURL)
	 * 
	 * SYNOPSIS
	 *   Adds a sub element to a currently defined menu
	 ***********************************************************************/
	
	function addTopSubMenu(strMenuID, strMenuItem, strMenuURL)
	{
		var strMenuTag = "<!--" + strMenuID + "-->" // Find the replace tag in main menu
		intPosition = strTopMenuHTML.indexOf(strMenuTag)
		
		strMenuURL = "href=" + strMenuURL
		
		if (intPosition <= 0) // If there is no replace tag, start new submenu
			strTopMenuHTML += "<div class=subMenuBack style='visibility:hidden;position:absolute;z-index:10;left:0' id=" + strMenuID + ">"
			
		strTemp = "<a class=menuSub " + strMenuURL + ">" + strMenuItem + "</a><br>" + strMenuTag // add link and replace tag
			
		if (intPosition <= 0)
			strTopMenuHTML += strTemp + "</div>"
		else
			strTopMenuHTML = strTopMenuHTML.replace(strMenuTag, strTemp)
	}
	
	/***********************************************************************
	 * FUNCTION
	 *   addSeperator(strMenuID)
	 * 
	 * SYNOPSIS
	 *   Adds a seperator to a menu
	 ***********************************************************************/
	function addSeperator(strMenuID)
	{
		var strMenuTag = "<!--" + strMenuID + "-->" // Find the replace tag in main menu
		intPosition = strTopMenuHTML.indexOf(strMenuTag)
		
		if (intPosition <= 0)
			return;
			
		strTemp = "<hr style='width:150'>" + strMenuTag
			
		strTopMenuHTML = strTopMenuHTML.replace(strMenuTag, strTemp)
	}
