YAHOO.util.Event.onDOMReady(function () {
	// LIBMENU
	var aItemData = [
		"Libraries:",
		{	text: "Bothell", url:"http://library.uwb.edu/" },
		{	text: "Tacoma", url:"http://www.tacoma.washington.edu/library/" },
		{	text: "Health Sciences", url:"http://healthlinks.washington.edu/" },
		{	text: "<span class=\"menutoggle\">All</span>",   
			submenu: {  
				id: "liballmenu",
				itemdata: [		
					{ text: "Art", url: "http://www.lib.washington.edu/art/"},
					{ text: "Built Environments", url: "http://www.lib.washington.edu/be/"},
					{ text: "Drama", url: "http://www.lib.washington.edu/drama/"},
					{ text: "East Asia", url: "http://www.lib.washington.edu/east-asia/"},
					{ text: "Engineering", url: "http://www.lib.washington.edu/engineering/"},
					{ text: "Foster Business", url: "http://www.lib.washington.edu/business/"},
					{ text: "Friday Harbor", url: "http://www.lib.washington.edu/fhl/"},
					{ text: "Gallagher Law", url: "http://lib.law.washington.edu"},
					{ text: "Health Sciences", url: "http://healthlinks.washington.edu/"},
					{ text: "K. K. Sherwood (Harborview)", url: "http://healthlinks.washington.edu/hsl/kks/"},
					{ text: "Mathematics Research", url: "http://www.lib.washington.edu/math/"},
					{ text: "Miller Horticultural", url: "http://depts.washington.edu/hortlib/"},
					{ text: "Music &amp; Listening Center", url: "http://www.lib.washington.edu/music/"},
					{ text: "Odegaard Undergraduate", url: "http://www.lib.washington.edu/ougl/"},
					{ text: "Physics-Astronomy", url: "http://www.lib.washington.edu/physics/"},
					{ text: "Social Work", url: "http://healthlinks.washington.edu/hsl/swl/"},
					{ text: "Suzzallo &amp; Allen", url: "http://www.lib.washington.edu/suzzallo/"},
					{ text: "UW Bothell", url: "http://library.uwb.edu/"},
					{ text: "UW Tacoma", url: "http://www.tacoma.washington.edu/library/"},
					{ text: "**ALL LIBRARIES AND UNITS**", url: "http://www.lib.washington.edu/about/hours/"}
				] 
			}
		}
	];
	var oMenuBar = new YAHOO.widget.MenuBar("mymenubar", { 
												lazyload: true, 
												itemdata: aItemData,
												zindex: 1001
												});

	oMenuBar.render(document.getElementById("xmenu"));
	
	
	// NAVMENU
	var aItemData2 = [
		{	text: "<span class=\"menutoggle\">Find It</span>",
			submenu: {  
				id: "finditmenu", 
				itemdata: [
					{ text: "UW-only Catalog", url: "http://catalog.lib.washington.edu"},
					{ text: "Articles &amp; Research Databases", url: "http://www.lib.washington.edu/types/databases/"},
					{ text: "Course Reserves &amp; Guides", url: "http://www.lib.washington.edu/services/course/"},
					{ text: "E-Journals", url: "http://www.lib.washington.edu/types/ejournals/"},
					{ text: "E-Newspapers", url: "http://www.lib.washington.edu/types/enewspapers/"},
					{ text: "Subject Guides", url: "http://guides.lib.washington.edu"},					
					{ text: "<span class=\"more\">more &gt;</span>", url: "http://www.lib.washington.edu/types/"}
				] 
			}
		},
		{	text: "<span class=\"menutoggle\">Using the Libraries</span>",
			submenu: {  
				id: "usingmenu", 
				itemdata: [
					{ text: "Your Library Account", url: "http://catalog.lib.washington.edu/screens/Linkuwnetid.html"},
					{ text: "Pay Fines", url: "http://www.lib.washington.edu/services/borrow/fines/"},
					{ text: "Reserve a Study Room", url: "http://www.lib.washington.edu/services/facilities/studyRooms/"},
					{ text: "Connect from Off-Campus", url: "http://www.lib.washington.edu/help/connect.html"},
					{ text: "Interlibrary Loan", url: "http://www.lib.washington.edu/ILL/"},
					{ text: "<span class=\"more\">more &gt;</span>", url: "http://www.lib.washington.edu/services/"}
				] 
			}
		},
		{	text: "<span class=\"menutoggle\">About</span>",
			submenu: {  
				id: "aboutmenu", 
				itemdata: [
					{ text: "Libraries &amp; Hours", url: "http://www.lib.washington.edu/about/hours/"},
					{ text: "Staff Directory", url: "http://db.lib.washington.edu/staffdir/"},
					{ text: "Employment", url: "http://www.lib.washington.edu/about/employment/"},
					{ text: "Calendar", url: "http://myuw.washington.edu/cal/setView.do?viewType=todayView&calendar=libcal"},
					{ text: "News", url: "http://www.lib.washington.edu/about/news/"},					
					{ text: "Support the Libraries", url: "http://www.lib.washington.edu/support/"},
					{ text: "Vision 2010", url: "http://www.lib.washington.edu/about/vision2010/"},
					{ text: "<span class=\"more\">more &gt;</span>", url: "http://www.lib.washington.edu/about/"}
				] 
			}
		},
		{	text: "<span class=\"menutoggle\">How Do I...?</span>", 
			submenu: {  
				id: "reshelpmenu", 
				itemdata: [
					{ text: "Meet your Librarian", url: "http://www.lib.washington.edu/subject/librarians/"},
					{ text: "How Do I... Tutorials and Guides", url: "http://guides.lib.washington.edu/howdoi/"},
					{ text: "Library Tools &amp; Widgets", url: "http://www.lib.washington.edu/tools/"},	
					{ text: "Research 101", url: "http://www.lib.washington.edu/uwill/research101/"},
					{ text: "Schedule a Workshop for your Class", url: "http://www.lib.washington.edu/help/instruction/faculty.html"},
					{ text: "Subject Guides", url: "http://guides.lib.washington.edu"},					
					{ text: "<span class=\"more\">more &gt;</span>", url: "http://guides.lib.washington.edu/howdoi/"}
				] 
			}
		}
	];
	var oMenuBar2 = new YAHOO.widget.MenuBar("mynavbar", { 
												lazyload: true, 
												itemdata: aItemData2,
												zindex: 2001
												});
	oMenuBar2.render(document.getElementById("navmenu"));
	
	function onSubmenuShow() {

		var oIFrame,
			oElement,
			nOffsetWidth;
		if (this.id == "yahoo") {					
			YAHOO.util.Dom.setX(this.element, 0);
			oIFrame = this.iframe;            
			if (oIFrame) {				
				YAHOO.util.Dom.setX(oIFrame, 0);
			}						
			this.cfg.setProperty("x", 0, true);
		}
		if ((this.id == "finditmenu" || this.id == "usingmenu" || this.id == "aboutmenu" || this.id == "reshelpmenu") && YAHOO.env.ua.ie) {
			oElement = this.element;
			nOffsetWidth = oElement.offsetWidth;
			oElement.style.width = nOffsetWidth + "px";
			oElement.style.width = (nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + "px";                    
		}
	}
});