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 of Post-M.D. Trainees", url: siteRoot + "download_census_publications_en.php" },
			{ text: "Individual Specialty Tables and Overviews", url: siteRoot + "download_specialty_tables_overviews_publications_en.php" },	
			{ text: "Provincial and Territorial Reports", url: siteRoot + "download_provreport_publications_en.php" },
			{ text: "National IMG Database Reports", url: siteRoot + "download_IMGreport_publications_en.php" },	
			{ text: "CAPER Coding Manuals", url: siteRoot + "download_codingmanual_publications_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.8 MB)", url: siteRoot + "docs/pdf_2005_2009_img_dbase_report.pdf" },
			{ text: "National IMG Database Report 2005-2009 (25.5 MB)", url: siteRoot + "docs/pdf_2005_2009(1)_img_dbase_report.pdf" },
		]},{ 
		id: "nav_data", 
        itemdata: [
		    { text: "CAPER Census Book 2010-2011", url: siteRoot + "census_book_2011/toc_en.php" },
			{ 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 2010-2011", url: siteRoot + "docs/pdf_quickfacts_2010_2011.pdf" },
			{ 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();
            
});


