YAHOO.util.Event.onContentReady("nav", function () {
    var siteRoot = "http://www.caper.ca/";
	
	var oMenu = new YAHOO.widget.Menu(
        "nav", {
            position: "static", 
            hidedelay: 500, 
            lazyload: true,
            effect: { 
                effect: YAHOO.widget.ContainerEffect.FADE,
                duration: 0.25
            } 
        }
    );
   
    var aSubmenuData = [{
        id: "nav_about", 
        itemdata: [ 
            { text: "About CAPER", url: siteRoot + "about_about_caper_en.php" },
            { text: "CAPER Policy Committee", url: siteRoot + "about_policy_committee_en.php" },
            { text: "CAPER Staff", url: siteRoot + "about_caper_staff_en.php" },
			{ text: "Contact CAPER", url: siteRoot + "about_contact_en.php" },
            { text: "Data Sharing Checklist", url: siteRoot + "about_sharing_checklist_en.php" },
			{ text: "Privacy Policy 2009", url: siteRoot + "about_privacy_policy_en.php" },
            { text: "Purchase Documents", url: siteRoot + "about_purchase_documents_en.php" },
			{ text: "Using the CAPER Database", url: siteRoot + "about_using_database_en.php" }
        ]},{ 
		id: "nav_publications", 
        itemdata: [
			{ text: "CAPER Annual Census 2009-10 (7.3 MB)", url: siteRoot + "docs/pdf_2009-10_CAPER_Census.pdf" },
			{ text: "CAPER Annual Census 2008-09 (10.3 MB)", url: siteRoot + "docs/pdf_2008-09_CAPER_Census.pdf" },
			{ text: "CAPER Annual Census 2007-08 (11.3 MB)", url: siteRoot + "docs/pdf_2007-08_CAPER_Census.pdf" },
			{ text: "CAPER Annual Census 2006-07 (3.7 MB)", url: siteRoot + "docs/pdf_2006-07_CAPER_Census.pdf" },
			{ text: "CAPER Annual Census 2005-06 (12.7 MB)", url: siteRoot + "docs/pdf_2005-06_CAPER_Census.pdf" },
			{ text: "CAPER Instruction Manual (0.5 MB)", url: siteRoot + "docs/pdf_InstructionManual_12thEdition.pdf" },
			{ text: "CAPER Medical School Codes (1.2 MB)", url: siteRoot + "docs/pdf_2009_Aug_Medical_School_Codes.pdf" },
			{ text: "Distributed Post M.D. Data Entry Program (0.28 MB)", url: siteRoot + "docs/zip_Distributed%20Post-M.D.%20Data%20Collection.zip" },
			{ text: "Individual Specialty Tables 2009-10 (1.7 MB)", url: siteRoot + "docs/pdf_2009-10_Individual_Specialty_Tables.pdf" },
			{ text: "Individual Specialty Tables 2008-09 (2.2 MB)", url: siteRoot + "docs/pdf_2008-09_Individual_Specialty_Tables.pdf" },
			{ text: "Individual Specialty Tables 2007-08 (1.04 MB)", url: siteRoot + "docs/pdf_2007-08_Individual_Specialty_Tables.pdf" },
			{ text: "Individual Specialty Tables 2006-07 (1.32 MB)", url: siteRoot + "docs/pdf_2006-07_Individual_Specialty_Tables.pdf" },
			{ text: "Individual Specialty Tables 2005-06 (7.78 MB)", url: siteRoot + "docs/pdf_2005-06_Individual_Specialty_Tables.pdf" },
			{ text: "National IMG Database Report 2005-2007 (31.83 MB)", url: siteRoot + "docs/pdf_2005_2009_img_dbase_report.pdf" },
			{ text: "Provincial Reports, 2009-10", url: siteRoot + "download_publications_provincial_reports_10_en.php" },
			{ text: "Provincial Reports, 2008-09", url: siteRoot + "download_publications_provincial_reports_09_en.php" },
			{ text: "Provincial Reports, 2007-08", url: siteRoot + "download_publications_provincial_reports_08_en.php" },
			{ text: "Provincial Reports, 2006-07", url: siteRoot + "download_publications_provincial_reports_07_en.php" },
			{ text: "Provincial Reports, 2005-06", url: siteRoot + "download_publications_provincial_reports_06_en.php" },
		]},{ 
		id: "nav_img", 
        itemdata: [
			{ text: "IMG Database Project Overview", url: siteRoot + "img_database_project_overview_en.php" },
			{ text: "IMG Links", url: siteRoot + "img_links_en.php" },
			{ text: "IMG Papers", url: siteRoot + "img_papers_en.php" },
			{ text: "IMG Data", url: siteRoot + "img_data_en.php" },
			{ text: "IMG Proceedings", url: siteRoot + "img_proceedings_en.php" },
			{ text: "IMG Brochure / Poster", url: siteRoot + "img_brochure_en.php" },
			{ text: "National IMG Database Report 2005-2007 (31.83 MB)", url: siteRoot + "docs/pdf_2005_2009_img_dbase_report.pdf" },
		]},{ 
		id: "nav_data", 
        itemdata: [
			{ text: "CAPER Census Book 2009-2010", url: siteRoot + "census_book_2010/toc_en.php" },
    		{ text: "CAPER Census Book 2008-2009", url: siteRoot + "census_book_2009/toc_en.php" },
			{ text: "CAPER Census Book 2007-2008", url: siteRoot + "census_book_2008/toc_en.php" },
			{ text: "CAPER Census Book 2006-2007", url: siteRoot + "census_book_2007/toc_en.php" },
			{ text: "CAPER Census Book 2005-2006", url: siteRoot + "census_book_2006/toc_en.php" },
			{ text: "CAPER Census Book 2004-2005", url: siteRoot + "census_book_2005/toc_en.php" },
			{ text: "Quick Facts 2009-2010", url: siteRoot + "docs/pdf_quickfacts_2009_2010.pdf" },
			{ text: "Quick Facts 2008-2009", url: siteRoot + "docs/pdf_quickfacts_2008_2009.pdf" },
			{ text: "Quick Facts 2007-2008", url: siteRoot + "docs/pdf_quickfacts_2007_2008.pdf" },
			{ text: "Quick Facts 2006-2007", url: siteRoot + "docs/pdf_quickfacts_2006_2007.pdf" },
			{ text: "Quick Facts 2005-2006", url: siteRoot + "docs/pdf_quickfacts_2005_2006.pdf" },
			{ text: "Quick Facts 2004-2005", url: siteRoot + "docs/pdf_quickfacts_2004_2005.pdf" },			
		]},{ 
		id: "nav_links", 
        itemdata: [
			{ text: "Participating Organizations", url: siteRoot + "links_participating_organizations_en.php" },
			{ text: "Other Important Organizations", url: siteRoot + "links_other_en.php" },
		]} 
    ];

    // Subscribe to the Menu instance's "beforeRender" event
	oMenu.subscribe("beforeRender", function () {
		if (this.getRoot() == this) {
			this.getItem(1).cfg.setProperty("submenu", aSubmenuData[0]);
			this.getItem(2).cfg.setProperty("submenu", aSubmenuData[1]);
			this.getItem(3).cfg.setProperty("submenu", aSubmenuData[2]);
			this.getItem(4).cfg.setProperty("submenu", aSubmenuData[3]);
			this.getItem(6).cfg.setProperty("submenu", aSubmenuData[4]);
		}
	});

    /* Call the "render" method with no arguments since the 
       markup for this Menu instance is already exists in the page. */
	oMenu.render();
            
});