var menuController = {
	init: function( active ) {
		var mainLinks = ( getElementsByClassName( "mainnav", "topnavcell" ) );
		for( var i = 0; i < mainLinks.length; i++ ) {
			//if( typeof( mainLinks[i] ) == "object" ) { //idiot check for ie6

				mainLinks[i].onmouseover = function(){
					if( this.className.indexOf("hover") == -1 ) {
						this.className += " hover";
					}
				}

				mainLinks[i].onmouseout = function(e){
					if (!e) var e = window.event;
					var reltg = e.relatedTarget || e.toElement;
					if( !reltg ) return;
					while( reltg.id != this.id && reltg.nodeName != 'BODY' )
						reltg = reltg.parentNode;

					if( reltg.nodeName == "BODY" )
						this.className = this.className.replace(/ ?hover/gi, "" );

				}

				mainLinks[i].onclick = function(e) {
					if (!e) var e = window.event;
					var targ = e.target || e.srcElement;
					if( targ.id == this.id ) {
						var lnk = this.firstChild;
						lnk.style.color = "#fff";
						window.location = lnk.href;
						return false;
					}
				}

				var sn = $("sn"+mainLinks[i].id.match( /[0-9]+/ ));
				if( sn ) {
					sn.style.width = mainLinks[i].offsetWidth+"px";
					if( i == mainLinks.length-1 ) {
						if( sn.offsetWidth > mainLinks[i].offsetWidth ) {
							sn.style.marginLeft = (mainLinks[i].offsetWidth -
sn.offsetWidth) + "px";
						}
					}
				}
			//}
		}
		if( $("ml"+active) )
			$("ml"+active).className += " active";
	}
}