function accessible_menus(listId) {
	function accessible_menus_ie() {

		/*
		based on http://www.htmldog.com/articles/suckerfish/dropdowns/
		see also http://www.htmldog.com/ptg/archives/000050.php#comment131
		lines added to workaround for IE not correctly interpreting multiple css classes.
		Conditional comments added to prevent IE<7 showing the select through the menu.
		*/



		/*@cc_on
		/*@if (@ie7 != true)
			var shim = document.createElement('iframe');
			shim.setAttribute('id', 'shim');
			shim.setAttribute('frameBorder','0');
			shim.setAttribute('scrolling','no');
			shim.setAttribute('src','javascript:;');
			//shim.style.display = 'none'; 
			//shim.style.border = '3px solid #f00';
			shim.style.width = '0';
			shim.style.height = '0';
			shim.style.left = '0';
			shim.style.top = '0'; 
			shim.style.zIndex = '90'; 
			shim.style.position = 'absolute'; 
			shim.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
			document.getElementById(listId).appendChild(shim);

			function addPopupClasses(element) {
				element.className+=(element.className.length>0? " ": "") + "sfhover";
				element.parentNode.className+=(element.parentNode.className.length>0? " ": "") + "sfhover";
				element.className=element.className.replace(new RegExp("( ?|^)sub_menu\\b"), "sub_mnu_sfhvr");		
			}

			function removePopupClasses(element) {
				element.className=element.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				element.parentNode.className=element.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				element.className=element.className.replace(new RegExp("( ?|^)sub_mnu_sfhvr\\b"), "sub_menu");
			}

			function positionShim(element) {
				var targetElement = null;

				if (element.tagName == "LI" && element.lastChild.tagName == "UL") {
					// LI with nested list, for hover condition
					targetElement = element.lastChild;
				} else if (element.tagName == "A") {
					if (element.parentNode.lastChild.tagName == "UL") {
						// A of a LI with nested list, i.e. keyboard to a top-level link.
						targetElement = element.parentNode.lastChild;
					} else {
						// Sub-nav A, keyboard to a sub-link
						if (element.parentNode.parentNode.getAttribute("id") != listId ) {
							targetElement = element.parentNode.parentNode.parentNode.lastChild;
						}
						
					}
				}

				if (targetElement) {
					shim.style.width	= targetElement.offsetWidth+"px";
					shim.style.height	= targetElement.offsetHeight+"px";
					shim.style.left		= targetElement.offsetLeft + "px";
					shim.style.top		= targetElement.offsetTop + "px";
					shim.style.display 	= 'block';
				}
			}

			function hideShim(element) {			
				var hideShim = false;

				if (element.tagName == "LI" && element.lastChild.tagName == "UL") {
					// LI with nested list
					hideShim = true;
				} else if (element.tagName == "A") {
					if (element.parentNode.lastChild.tagName == "UL") {
						// A of a LI with nested list
						hideShim = true;
					} else {
						// Sub-nav A
						hideShim = true;
					}
				}

				if (hideShim) {
					shim.style.display='none';
				}
			}

			var sfEls = document.getElementById(listId).getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
					sfEls[i].onmouseover=function() {
						addPopupClasses(this);
						positionShim(this); // add iframe if needed.
					}

					sfEls[i].onmouseout=function() {
						removePopupClasses(this);
						hideShim(this); // hide iframe if needed.
					}


			}				
		/*@end			
		@*/

		var mcEls = document.getElementById(listId).getElementsByTagName("A");
		for (var i=0; i<mcEls.length; i++) {
			mcEls[i].onfocus=function() {

				this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
				this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sffocusparent"; //li < a:focus
				this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sub_menu\\b"), "sub_mnu_sffcsprnt"); //li < a:focus
				this.parentNode.parentNode.className+=(this.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //ul < li < a:focus
				if(this.parentNode.parentNode.parentNode.nodeName == "LI") { //li < ul < li < a:focus
					this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //li < ul < li < a:focus
					this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sub_menu\\b"), "sub_mnu_sffcsprnt"); //li < ul < li < a:focus
					this.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //ul < li < ul < li < a:focus
					if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {  //li < ul < li < ul < li < a:focus
						this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //li < ul < li < ul < li < a:focus
						this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //#top-nav < li < ul < li < ul < li < a:focus
					}
				}
				/*@cc_on
				/*@if (@ie7 != true)
				addPopupClasses(this);
				positionShim(this); // add iframe if needed.	
				/*@end			
				@*/
			}
			mcEls[i].onblur=function() {

				this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
				this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
				this.parentNode.parentNode.className=this.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
				this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sub_mnu_sffcsprnt\\b"), "sub_menu");
				if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
					this.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
					this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sub_mnu_sffcsprnt\\b"), "sub_menu");
					if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
						this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
						this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
					}
				}
				/*@cc_on
				/*@if (@ie7 != true)
				removePopupClasses(this);
				hideShim(this); // hide iframe if needed.
				/*@end			
				@*/
			}
		}
	}

	function accessible_menus_non_ie() {
		var mcEls = document.getElementById(listId).getElementsByTagName("A");
		for (var i=0; i<mcEls.length; i++) {
			mcEls[i].onfocus=function() {
				this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
				this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sffocusparent"; //li < a:focus
				this.parentNode.parentNode.className+=(this.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //ul < li < a:focus
				if(this.parentNode.parentNode.parentNode.nodeName == "LI") { //li < ul < li < a:focus
					this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //li < ul < li < a:focus
					this.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //ul < li < ul < li < a:focus
					if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {  //li < ul < li < ul < li < a:focus
						this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //li < ul < li < ul < li < a:focus
						this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sffocusparent"; //#top-nav < li < ul < li < ul < li < a:focus
					}

				}

			}

			mcEls[i].onblur=function() {
				this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
				this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
				this.parentNode.parentNode.className=this.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
				if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
					this.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
					if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
						this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
						this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sffocusparent\\b"), "");
					}
				}
			}
		}
	}


	// only ie needs the sfHover script. all need the accessibility script...
	// thanks http://www.brothercake.com/site/resources/scripts/onload/
	if(window.addEventListener) {
		 // gecko, safari, konqueror and standard
		 window.addEventListener('load', accessible_menus_non_ie, false);
	} else if(document.addEventListener) {
		 // opera 7
		document.addEventListener('load', accessible_menus_non_ie, false);
	} else if(window.attachEvent) {
		 // win/ie
		window.attachEvent('onload', accessible_menus_ie);
	} else {
		// mac/ie5
		if(typeof window.onload == 'function') {
			var existing = onload;
			window.onload = function() {
				existing();
				accessible_menus_ie();
			}

		} else {
			window.onload = accessible_menus_ie;
		}

	}	

}


accessible_menus("top-nav");