var lowerNavBar = new NavBar(0);
var tempMenu;



// IE has a bug so when a Javascripts "location.href" is called it doesn't send
// HTTP_REFERER environment variable.

var curPage = document.location;
var siteDN = document.domain;
var langLink = "http://" + siteDN +"/cgi-bin/cihr_lang.pl?" + curPage;  // absolute path to cihr_lang.pl


//***************************** U P P E R  M E N U *********************************


var upperNavBar = new NavBar(1);

upperNavBar.setSizes(1, 3, 0);
upperNavBar.setColors(umBorderColor, ummForeground, ummBackground, ummhForeground, ummhBackground, umiForeground, umiBackground, umihForeground, umihBackground);

 if (isMinNS4)
	upperNavBar.setFonts("Verdana, Arial", "plain", "bold", "8pt", "Verdana, Arial", "plain", "bold", "8pt");

 if (isMinIE4)
	upperNavBar.setFonts("Verdana, Arial", "plain", "bold", "7pt", "Verdana, Arial", "plain", "bold", "7pt");


/*

 To add new items, copy and paste the following line within "tempMenu = new..." and 
 " Upper/LowerNavBar.addMenu..." lines

		tempMenu.addItem(new NavBarMenuItem("TEXT", "URL"));

 Replace TEXT with the text you would like to show in the menu and replace URL with the absolute
 link to the file you would like this to link to.  (An absolute link starts at the root with a "/"
 and the climbs up the tree from there eg: "/whats_new/latest_info/newsmenu_e.shtml")
 
 If you are adding a top level item (a main menu item, not drop down) add two
 "&nbsp;" to either side of each line. eg:
 		"&nbsp;&nbsp; LINE1 &nbsp;&nbsp;<BR>&nbsp;&nbsp; LINE2 &nbsp;&nbsp;"

EXAMPLE:
 
line 1:		tempMenu = new NavBarMenu(0, 120);
line 2:		tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp; LINE1 &nbsp;&nbsp;<BR>&nbsp;&nbsp; LINE2 &nbsp;&nbsp;", "/index.html"));
line 3:		tempMenu.addItem(new NavBarMenuItem("About Us", "aboutus.html"));
line 4:		tempMenu.addItem(new NavBarMenuItem("Site Map", "sitemap.html"));
line 5:		upperNavBar.addMenu(tempMenu);	

 On line 1 a new navBarMenu is instantiated with two arguments the first is how much space you would
 like to put between it and the item to it's left in pixels.  The second is the width of the
 dropdown list again in pixels.  (Neither of the arguments can be left blank, insert a 0 (zero)
 if you don't want any spaces)
 
 Line 2 will instantiate a new NavBarMenuItem and add it to the NavBarMenu instantiated in
 line 1 "tempMenu".  There are two arguments passed to the NaveBareMenuItem, the first
 is the text you would like displayed for this item, and the second is the link you
 would like it to follow when clicked on.  (If you don't want a link, you need to put opening
 and closing double quotes "".)
 
 Line 3 and Line 4 are adding drop down items, you can add as many of these as you like.
 The same applies from Line 2 to these lines.
 
 Line 5 will add all the information in lines 1, 2 and 3 to the menu.

*/

// President

tempMenu = new NavBarMenu(0, 120);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;President&nbsp;&nbsp;", "/president/biography_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Biography", "/president/biography_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Message", "/president/message_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Archived Messages", "/president/archived_message_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Archived Speeches", "/president/speeches/archived_speeches_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Contact Dr. Bernstein", "/president/contact_pres_e.shtml"));
upperNavBar.addMenu(tempMenu);

// Governing Council

tempMenu = new NavBarMenu(0, 120);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Governing Council&nbsp;&nbsp;", "/governing_council/working_groups/wg_menu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("GC Members", "/governing_council/members/governing_council_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("GC Meetings", "/governing_council/meetings/meeting_menu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Working Groups", "/governing_council/working_groups/wg_menu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Committees", "/governing_council/committees/comm_menu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Special Advisors", "/governing_council/special_advisors/special_advisors_e.shtml"));

upperNavBar.addMenu(tempMenu);	

// Search

tempMenu = new NavBarMenu(0, 80);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Search&nbsp;&nbsp;", "http://search.hc-sc.gc.ca/cgi-bin/query?mss=cihr/english/simple"));
tempMenu.addItem(new NavBarMenuItem("Search", "http://search.hc-sc.gc.ca/cgi-bin/query?mss=cihr/english/simple"));
tempMenu.addItem(new NavBarMenuItem("Links", "/misc/links_e.shtml"));
upperNavBar.addMenu(tempMenu);

//Site Map

tempMenu = new NavBarMenu(0, 120);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Site&nbsp;Map&nbsp;&nbsp;", "/misc/sitemap_e.shtml"));
upperNavBar.addMenu(tempMenu);

// Contact Us

tempMenu = new NavBarMenu(0, 200);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Contact&nbsp;Us&nbsp;&nbsp;", "/about_cihr/staff_contacts/contact_us_e.shtml"));
upperNavBar.addMenu(tempMenu);

// Francais

tempMenu = new NavBarMenu(0, 200);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Fran&ccedil;ais&nbsp;&nbsp;", langLink));
upperNavBar.addMenu(tempMenu);


// Home

tempMenu = new NavBarMenu(0, 140);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Home&nbsp;&nbsp;", "/welcome_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;CIHR Home&nbsp;&nbsp;", "/welcome_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Health Canada Home&nbsp;&nbsp;", "http://www.hc-sc.gc.ca"));
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Canada Home&nbsp;&nbsp;", "http://canada.gc.ca"));
upperNavBar.addMenu(tempMenu);






/* // Useful Links

tempMenu = new NavBarMenu(0, 200);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;Links&nbsp;&nbsp;", "/misc/links_e.shtml"));
upperNavBar.addMenu(tempMenu);   */


//***************************** L O W E R  M E N U *********************************

var lowerNavBar = new NavBar(0);

lowerNavBar.setSizes(1, 3, 0);
lowerNavBar.setColors(lmBorderColor,
  lmmForeground, lmmBackground, lmmhForeground, lmmhBackground,
  lmiForeground, lmiBackground, lmihForeground, lmihBackground);

 if (isMinNS4)
	lowerNavBar.setFonts("Verdana, Arial", "plain", "bold", "8pt",
					   "Verdana, Arial", "plain", "bold", "8pt");
 if (isMinIE4)
	lowerNavBar.setFonts("Verdana, Arial", "plain", "bold", "7pt",
  					   "Verdana, Arial", "plain", "bold", "7pt");
// About CIHR

tempMenu = new NavBarMenu(0, 150);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;&nbsp;About&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;CIHR&nbsp;&nbsp;&nbsp;", "/about_cihr/who_we_are/fold_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Who we are", "/about_cihr/who_we_are/fold_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Mandate", "/about_cihr/about_logo/mandate_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("About the Logo", "/about_cihr/about_logo/logo_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("CIHR Act", "javascript:window.open('http://www.parl.gc.ca/36/2/parlbus/chambus/house/bills/government/C-13/C-13_4/C-13_cover-E.html');"));
tempMenu.addItem(new NavBarMenuItem("Staff Contacts", "/about_cihr/staff_contacts/direc_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Institute Contacts", "/institutes/institutes_contacts_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("University Delegates", "/about_cihr/university_delegates/university_delegates_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Ethics", "/about_cihr/ethics/ethics_menu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Interim Governing Council Report", "/about_cihr/interim_gc_report/final_report_e.shtml"));
lowerNavBar.addMenu(tempMenu);
highlightme = false;

// Institutes

tempMenu = new NavBarMenu(0, 200);
tempMenu.addItem(new NavBarMenuItem("<BR>&nbsp;&nbsp;Institutes&nbsp;&nbsp;", "/institutes/institutes_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("General Information", "/institutes/institutes_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Aboriginal Peoples' Health", "/institutes/iaph/iaph_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Cancer Research", "/institutes/icr/icr_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Circulatory and Respiratory Health", "/institutes/icrh/icrh_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Gender and Health", "/institutes/igh/igh_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Genetics", "/institutes/ig/ig_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Health Services and Policy Research", "/institutes/ihspr/ihspr_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Healthy Aging", "/institutes/iha/iha_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Human Development, Child and Youth Health", "/institutes/ihdcyh/ihdcyh_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Infection and Immunity", "/institutes/iii/iii_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Musculoskeletal Health and Arthritis", "/institutes/imha/imha_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Neurosciences, Mental Health and Addiction", "/institutes/inmha/inmha_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Nutrition, Metabolism and Diabetes", "/institutes/inmd/inmd_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Population and Public Health", "/institutes/ipph/ipph_e.shtml"));
lowerNavBar.addMenu(tempMenu);

// Funding Opportunities

tempMenu = new NavBarMenu(0, 150);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;&nbsp;Funding&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;Opportunities&nbsp;&nbsp;&nbsp;", "/funding_opportunities/application_forms/how_to_apply_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("How to Apply", "/funding_opportunities/application_forms/how_to_apply_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Application Forms", "/funding_opportunities/application_forms/about_pdf_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Grants and Awards Guides", "/funding_opportunities/guide_to_applicants/gag0001/gagmenu_e.shtml"));  // new
tempMenu.addItem(new NavBarMenuItem("Funding Opportunities Guide", "/funding_opportunities/application_deadlines/resp_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("CIHR Funding Opportunities", "/funding_opportunities/cihr_funding_pgms/req_for_proposal/rfpmenu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Other Funding Opportunities", "/funding_opportunities/other_cihr_funding_pgms/fundingpossibilities_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Peer Review Process", "/funding_opportunities/peer_review/ctteguide_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Other Forms", "/funding_opportunities/other_forms/other_forms_e.shtml"));
lowerNavBar.addMenu(tempMenu);

// Funding Decisions

tempMenu = new NavBarMenu(0, 150);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;&nbsp;Funding<BR>&nbsp;&nbsp;&nbsp;Decisions&nbsp;&nbsp;&nbsp;", "/funding_decisions/council_decisions/2001_comp_decision/decisions2001_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Year 2001 Decisions", "/funding_decisions/council_decisions/2001_comp_decision/decisions2001_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Year 2000 Decisions", "/funding_decisions/council_decisions/2000_comp_decision/decisions2000_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Archived Decisions", "/funding_decisions/council_decisions/archive/archived_decisions_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Archived NHRDP Results", "/funding_decisions/council_decisions/archive_nhrdp/archived_nhrdp_e.shtml"));
lowerNavBar.addMenu(tempMenu);

// Partnerships

tempMenu = new NavBarMenu(0, 150);
tempMenu.addItem(new NavBarMenuItem("<br>&nbsp;&nbsp;&nbsp;Partners&nbsp;&nbsp;&nbsp;", "/partnerships/partnerships_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("About Partnerships", "/partnerships/partnerships_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Health Research Partnership Fund", "/partnerships/hrpf_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Networks of Centres of Excellence", "/partnerships/nce_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("International Partnerships", "/partnerships/international/international_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Industry", "/partnerships/university_programs_e.shtml"));
lowerNavBar.addMenu(tempMenu);

// Resarch Database

tempMenu = new NavBarMenu(0, 150);
tempMenu.addItem(new NavBarMenuItem("<br>&nbsp;&nbsp;&nbsp;Databases&nbsp;&nbsp;&nbsp;", "/research_database/cihr_database/database_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("CIHR Database", "/research_database/cihr_database/database_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Researcher Profiles", "/research_database/researcher_profiles/research_progress/innovations_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Other Funding Databases", "/research_database/other_databases/other_databases_e.shtml"));
lowerNavBar.addMenu(tempMenu);

// Media Room

tempMenu = new NavBarMenu(0, 100);
tempMenu.addItem(new NavBarMenuItem("&nbsp;&nbsp;News&nbsp;and&nbsp;<BR>&nbsp;&nbsp;Forums&nbsp;&nbsp;", "/news/comm-direc_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("What's New", "/news/latest_info/newsmenu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("What's Happening Elsewhere", "/news/latest_info/elsewhere_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Careers", "/news/careers/jobs_e.shtml"));

tempMenu.addItem(new NavBarMenuItem("_____________", ""));
tempMenu.addItem(new NavBarMenuItem("Forums", "/news/forums/forum_menu_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("_____________", ""));

tempMenu.addItem(new NavBarMenuItem("Media Contacts", "/news/comm-direc_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Press Releases", "/news/press_releases/prtoc_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Publications", "/news/publications/publications/publications_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Facts and Figures", "/news/facts_figures/facts_figures_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Reports of Proceedings", "/news/reports_proceedings/report_e.shtml"));
tempMenu.addItem(new NavBarMenuItem("Advertising", "/news/advertising/adds_e.shtml"));
lowerNavBar.addMenu(tempMenu);








var sbWidth = 0;    // Guesstimate of scrollbar width, necessary for NS4.
if (isMinNS4)
  sbWidth = 16;

// the init function has to be called from the onload in the body tag
// eg <body ... onLoad=init()>

function init() {

  // Dimentions based on browser size
  lowerNavBar.resize(getWindowWidth() - sbWidth - 150);

  // Draw the lower menu
  lowerNavBar.create();

  // Position lower menu
  lowerNavBar.moveTo(149, 65);

  lowerNavBar.setzIndex(2);


  // Dimentions based on browser size
  upperNavBar.resize(getWindowWidth() - sbWidth - 150);

  // Draw the upper menu
  upperNavBar.create();

  // Position upper menu
  upperNavBar.moveTo(149, 43);

  upperNavBar.setzIndex(2);

  }
