<!-- This is copied from d6_navigation.js and modified slightly -->
function initNavigation() {
	var _navigation = document.getElementById("nav");
	var nodes = _navigation.getElementsByTagName("li");
	if(_navigation) {
		var _drops = document.getElementsByTagName("div");
		for (var i = 0; i < _drops.length; i++)
		{
			if (_drops[i].className.indexOf("drop")!=-1 && _drops[i].className.indexOf("sub")!=-1)
			{
				if(_drops[i].parentNode.parentNode == _navigation) {
					_drops[i].style.left = "134px";
					_drops[i].style.right = "auto";
				}
				
				var _droplevel = _drops[i];
				var _dropnav = _droplevel.getElementsByTagName("ul").item(0);
				var _dropitems = _dropnav.getElementsByTagName("li");

				if(_dropitems) {
					_droplevel.style.width = "500px";

					// collecting links
					var _curlinks = [];
					for (var j = 0; j < _dropitems.length; j++) {
						if(_dropitems[j].parentNode == _dropnav) {
							_curlinks.push(_dropitems[j]);
						}
					}

					// calc max width
					var _maxwidth = 0;
					for (var k = 0; k < _curlinks.length; k++) {
						var _curitem = _curlinks[k].getElementsByTagName("em").item(0);
						if(_curitem.offsetWidth > _maxwidth) _maxwidth = _curitem.offsetWidth;
					}
					
					// ie fix
					if(_maxwidth % 2 == 0) _maxwidth++;
					
					_droplevel.style.width = _maxwidth + 20 + "px";
					_droplevel.style.right = -_maxwidth-28+"px";
				}

			}
		}
		for (var i=0; i<nodes.length; i++){
			nodes[i].onmouseover = function(){
				this.className += "hover";
			}
			nodes[i].onmouseout = function(){
				this.className = this.className.replace("hover", "");
			}
		}
	}
}

if (window.addEventListener) window.addEventListener("load", initNavigation, false);
else if (window.attachEvent) window.attachEvent("onload", initNavigation);