/* Hover Over Functions
**********************************************************************/

		function initMenu(containerDiv, tagName)
		{
		/* Check we are dealing with IE */
			if (document.all && document.getElementById)
			{
				/* Deal with the main navigation */
				var nav = document.getElementById(containerDiv);
				if (nav)
				{
					var navItems = nav.getElementsByTagName(tagName);
					for (i = 0; i < navItems.length; i++)
					{
						var navItem = navItems[i];
						initElementHover(navItem);
					}
				}
			}
		}

		function initTags(hoverArray)
		{
			/* Check we are dealing with IE */
			if (document.all && document.getElementById)
			{
				for (i = 0; i < hoverArray.length; i++)
				{
					var element = document.getElementById(hoverArray[i]);
					initElementHover(element);					
				}
			}
		}
		
/* Hover Core
**********************************************************************/

		function initElementHover(element)
		{
			if (element)
			{
				element.onmouseover = function() {
				
					/* If there are other classes applied to the tag, add a space. Otherwise
                         just set "hover" as the only class */
					 
					if ("" != this.className) {
						this.className += ' '; 
					}
					
					this.className += 'hover'; 
				}
				
				element.onmouseout = function() {
				
					/* Check to see if hover is the only class applied to the tag. If so
                        clear the whole class name. Otherwise search for " hover"
                        and remove it */
					 
					if ("hover" == this.className) {
						this.className = ''; 
					} else {
						this.className = this.className.replace(' hover', ''); 
					}
				}
			}
		}

/* Include this code after the menu in the html - replacing the container and tag-name as required */
/*
<script type="text/javascript">initMenu('main-nav', 'li');</script>
*/

/* Font Size Functions
*********************************************************************/

	function getElementsByClass(theNode, theClass)
	{
		var cArray = [];
		var cArrayLoc = 0;
		
		function doTree(theNode)
		{
			if (theNode.className && theNode.className == theClass)
			{
			  cArray[cArrayLoc] = theNode;
			  cArrayLoc++;
			}
			for (var i=0, len=theNode.childNodes.length; i<len; i++)
			{
			  doTree(theNode.childNodes[i]);
			}
		}
		doTree(theNode);
		return cArray;
	}
	
	var smallFont = true;
	function toggleFontSize()
	{
		var fontSizeToggle = getElementsByClass(document.getElementById("page_wrapper"), "font-size-toggle"
);
	
		if (!fontSizeToggle)
		{
			return;
		}
	
		if(smallFont)
		{
			for (var i = 0; i < fontSizeToggle.length; i++)
			{
				fontSizeToggle[i].style.fontSize = "18px";
				smallFont = false;
			}
		}
		else
		{
			for (var i = 0; i < fontSizeToggle.length; i++)
			{
				fontSizeToggle[i].style.fontSize = "1em";
				smallFont = true;
			}
		}
	}