YAHOO.namespace("Menu");
YAHOO.Menu.onMenuBarReady = function() {
	function onMenuBarBeforeRender(p_sType, p_sArgs, p_oMenu) {
		var oSubmenuData = {
		
"Home": [ ],
"About nie": [
		{ text: "What is nie?", url: "/nie/about/story/12482.html" },
		{ text: "Contact Us", url: "/nie/about/story/12784.html" },
		{ text: "Ordering Papers", url: "/nie/about/story/12785.html" },
		{ text: "Measuring Success", url: "/nie/about/story/12786.html" } ],
"Order Online": [
        { text: "Register", url: "http://nie.newsobserver.com/signup" },
        { text: "Teacher Login", url: "http://nie.newsobserver.com/login" },
		{ text: "Student/E-Edition Login", url: "http://activepaper.olivesoftware.com/Daily/client.asp?skin=NewsAndObserver" },	
        { text: "Forgot password?", url: "http://nie.newsobserver.com/forgot_password" },
	    ],
"Resources": [
        { text: "Online Teacher Courses", url: "/nie/resources/story/12783.html" },
        { text: "Schools to Careers", url: "/nie/resources/story/12811.html" },
	    ],
"Sponsorships": [
		{ text: "Become a Sponsor", url: "/nie/about/story/12788.html" },
		{ text: "Our Sponsors", url: "/nie/about/story/12789.html" } ]

		};

		var menuId, i = 0;
		for (menuId in oSubmenuData) {
			if (oSubmenuData[menuId].length > 0) {
				this.getItem(i).cfg.setProperty("submenu", { id:'MENU-' + menuId, itemdata: oSubmenuData[menuId] });
			}
			i++;
		}

	} // end onMenuBarBeforeRender()

	// Instantiate and render the menu bar
	var oMenuBar = new YAHOO.widget.MenuBar("MENU",
		{
			constraintoviewport: true,
			autosubmenudisplay: true,
			hidedelay: 250,
			showdelay: 0,
			lazyload: true,
			visible:false
		}
	);

	// Subscribe to the "beforerender" event
	oMenuBar.beforeRenderEvent.subscribe(onMenuBarBeforeRender, oMenuBar, true);

	// Render the menu bar
	oMenuBar.render();
	};


// Initialize and render the menu bar when it is available in the DOM
if (YAHOO.Browser.browser == 'Explorer') {
	YAHOO.util.Event.addListener(window, "load", YAHOO.Menu.onMenuBarReady);
}
else {
	YAHOO.util.Event.onContentReady('MENU', YAHOO.Menu.onMenuBarReady);
}
