	// Grabs all elements by their classname, very handy!
	function getElementsByClassName(classname, node)  {
		if(!node) node = document.getElementsByTagName("body")[0];
		var a = [];
		var re = new RegExp('\\b' + classname + '\\b');
		var els = node.getElementsByTagName("*");
		for(var i=0,j=els.length; i<j; i++)
			if(re.test(els[i].className))a.push(els[i]);
		return a;
	}
	// Binds our DHTML events to the elements.
	function addEvent(obj, event, fn, i){
		// Mozilla / Gecko
		if (window.addEventListener){
			switch (event){
				case "onclick":
					obj.onclick = function(){eval(fn(obj,i));};
					break;
				case "onmouseover":
					obj.onmouseover = function(){eval(fn(obj,i));};
					break;
				case "onmouseout":
					obj.onmouseout = function(){eval(fn(obj,i));};
					break;
			}
		// IE / MS
		} else { 
			obj.attachEvent(event, function(){eval(fn(obj,i))});
		} 
	}
	/* For Home DHTML */
	var myDropLI;
	var currentMenu;
	var t, t2;
	// Set up our object array
	var myDropLink = document.getElementById("menu").getElementsByTagName("A");
	var myMenuLink = getElementsByClassName("drop"); // for the links with dropdowns
	var myNoDrop = getElementsByClassName("nodrop"); // for the links with dropdowns
	var myDropDownUL = getElementsByClassName("navddown"); // the actual dropdown menus - we have this so we can turn them all off quickly
	
	// Set up the event handlers to show all menus
	for(var i=0; i<myDropLink.length; i++){
		addEvent(myDropLink[i], 'onmouseover', menuShow, i);
		addEvent(myDropLink[i], 'onmouseout', menuHide, i);
	}
	
	// DIVS that have no drop down can hide all the other frames
	for(var i=0; i<myNoDrop.length; i++){
		if (!window.addEventListener){
			addEvent(myNoDrop[i], 'onmouseover', hideAllFrames, i);
		}
	}
	
	// Executes the menu function
	function menuShow(obj, i){
		showMenu(obj, i);
		obj.style.backgroundColor = '#9DC43B';
	}
	// Executes the hide function
	function menuHide(obj, i){
		setTime();
		obj.style.backgroundColor = '#44a924';
	}
	// Hides both frames
	function hideAllFrames(obj, i){
		var frm = document.getElementById("theframe");
		frm.style.display = "none";
		var frm = document.getElementById("theframe2");
		frm.style.display = "none";
	}
	
	// Hides the menu
	function hideMenu(){
		clearTimeout(t);
		clearTimeout(t2);
		for(var i=0; i<myMenuLink.length; i++){
			myMenuLink[i].style.background = '';
			myMenuLink[i].style.borderBottom = '1px #fff solid';
		}
		for(var i=0; i<myDropDownUL.length;i++){
			myDropDownUL[i].style.display = "none";
		}
	}
	var currentMenu;
	var parentMenu;
	var totalVisible = 0;
	function showMenu(obj,i){
	
		for(var i=0; i<myNoDrop.length; i++){
			myNoDrop[i].style.background = '#44a924';
		}
		//document.getElementById('navon').style.background = '#149aff';
	
	
		clearTimeout(t);
		clearTimeout(t2);
				
		// Turns off previous menu
		parentMenu = obj.parentNode.parentNode.id;
		if(parentMenu !== currentMenu){
			hideMenu();
			// IE6 render hack
			for(var i=0; i<myDropDownUL.length;i++){
				myDropDownUL[i].style.display = "block";
				myDropDownUL[i].style.display = "none";
			}	
			// On with the show
			if(obj.parentNode){
				if(obj.parentNode.parentNode){
					obj.parentNode.parentNode.style.display = "block";
					if(obj.parentNode.parentNode.previousSibling){
						if(obj.parentNode.parentNode.previousSibling.previousSibling){
							//obj.parentNode.parentNode.previousSibling.previousSibling.style.backgroundColor = '#267c12';
							//obj.parentNode.parentNode.previousSibling.previousSibling.style.borderBottom = '1px #9DC43B solid';
						}
					}
				}
			}
		}

		// Detects next menu
		if(obj.nextSibling){
			if(obj.nextSibling.nextSibling){
				currentMenu = obj.nextSibling.nextSibling.id;
				obj.nextSibling.nextSibling.style.left = 0;
				obj.nextSibling.nextSibling.style.display = "block";
				obj.style.backgroundColor = '#44A924';
				obj.style.borderBottom = '1px #9DC43B solid';
				// Counts how many menus are open
				totalVisible = 0;
				for(var i=0;i<myDropDownUL.length;i++){
					if(myDropDownUL[i].style.display == "block"){
						totalVisible++;
					}
				}
				// Puts the iFrame behind the menu to help our friend IE6.
				if(totalVisible === 1){
					var frm = "theframe";
					positionIFrame(currentMenu, frm);
					window.myOpenDiv = currentMenu;
				}else if(totalVisible === 2){
					var frm = "theframe2";
					positionIFrame(currentMenu, frm)
					window.myOpenDiv2 = currentMenu;
				}


			}
		}
		
	}

	// Attach a listener to the window so that we know it has resized...
	window.onresize = function(){
		// And if the popup is down
		if(document.getElementById("theframe").style.display == "block"){
			positionIFrame(window.myOpenDiv, "theframe");
		}
		if(document.getElementById("theframe2").style.display == "block"){
			positionIFrame(window.myOpenDiv2, "theframe2");
		}
		
	}


	function setTime(){
		t = setTimeout('hideMenu()',500);
		t2 = setTimeout('hideAllFrames()',500);
	}
	// Search event binding
	function searchEvent(s){
		var el = document.getElementById('search');
		if(s){
			if(el.value=='Search') el.value='';
		}else{
			if(el.value=='') el.value='Search';
		}
	}
	// Talk to flash
	function tellFlash(s){
		if(window.mymovie) window.document["mymovie"].SetVariable("sectionNumberUpdate", s);
		if(document.mymovie) document.mymovie.SetVariable("sectionNumberUpdate", s);
	}
	function positionIFrame(divid, frmid) { 
		//get reference to menu list and iframe
		
		if(divid) {
			var divmain = document.getElementById(divid); 
			var frm = document.getElementById(frmid); 
		
			//get the positions for the list
			var myarray = findPos(divmain); 
		
			//set the position of the iframe and zindex
			frm.style.left = myarray[0] + "px";
			frm.style.top = myarray[1] + "px";
			frm.style.height = divmain.offsetHeight; 
			frm.style.width = divmain.offsetWidth; 
			frm.style.zIndex = "2";
			frm.style.display = "block"; 
		}
	} 

	function findPos(obj) { 
		var curleft = curtop = 0;
		if (obj.offsetParent) { 
			do { curleft += obj.offsetLeft; 
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent); 
		}
		return [curleft,curtop]; 
	}
	
	//hack to get menu to align in firefox
	showMenu(myDropLink[0],1);
	// end