// configure path to "navbar.js".  It can be relative or absolute.  We set it
// as relative here so that the demo works on file:// protocol.
_NavBar_url = "navbar";

// this function constructs a label based on variable _NavBar_pageID which
// should be defined in the HTML file.
function L(label) {
	if (_NavBar_pageID.toLowerCase() == label.toLowerCase())
		label = "!" + label;
	return label;
}

// pass ID-s of some DIV-s as parameters:
//  - "content" is the DIV where the menu will be displayed
//  - "beforemenu" is a DIV that will appear in the nav. bar, before sections (optional)
//  - "aftermenu" is a DIV that will appear in the nav. bar but after the sections (optional)
var menu = new NavBar("content", "beforemenu", "aftermenu");

// adds top control buttons
menu.openMenu(true);

// DEFINITION OF MENU SECTIONS.

// first section
new NavSection(menu, // parent menubar
	       "Site Options", // section title

	       [ // array of menu items

		       // Item starting with "!" is the current one.
		       // It will gain an additional CSS class (item-disabled).
		       // It's best to only have _one_ item like this for the whole menu.

		       // order:
		       //    1: menu item label
		       //    2: url for this menu item
		       //    3: the "title" attribute (tooltip)
		       //    4: path to an icon for the menu item (null or "" for no icon)

		       // 1                        2                 3                                      4
		       // label                    url               tooltip                                icon
		       [  L("Home"),  "Default.aspx",     "Home page",                          "images/bullet.png" ],
		       [  L("Search"),  "search.aspx",     "Index page",                          "images/bullet.png" ],
		       [  L("Site map"), "sitemap.aspx",   "Site Map",  "images/bullet.png" ],
		       [  L("Contact Us"),      "contactus.aspx", "Contact Us",             "images/bullet.png" ],
		       [  L("Intranet Portal"),  "http://corporate.firststreetonline.com",   "Corporate Intranet",    "images/bullet.png" ]
		       ]
	);

new NavSection(menu, "Mission & Values", [
		       [ L("Mission & Values"), "mission_and_values.aspx", "Our Company Mission and Values" ]
		       ]);

new NavSection(menu, "Our Customers", [
		       [ L("Our Customers"), "our_customers.aspx", "Our Customers"]
		       ]);

new NavSection (menu, "Direct Response Marketing", [
	 [ L("Database Marketing"),        "database_marketing.aspx",           "Database Marketing",      null ],
	 [ L("Print Media Marketing"),   "media_advertising.aspx", "Print Media Marketing", null ],
	 [ L("Catalog Marketing"),      "catalog_advertising.aspx",           "Catalog Marketing",     null ],
	 [ L("Internet Marketing"),        "internet_advertising.aspx",           "Internet Marketing",      null ],
	 [ L("In-House Creative"),      "in_house_creative.aspx",           "In-House Creative",     null ]
	 ]);

// second section
new NavSection (menu, "Marketing Services", [
	 [ L("Market Research"), "market_research.aspx", "Market Research"],
	 [ L("Product Fulfillment"),   "product_fulfillment.aspx", "Product Fulfillment", null ],
	 [ L("Product Distribution"),      "product_distribution.aspx",           "Product Distribution",     null ],
	 [ L("-- Catalogs"),        "catalogs.aspx",           "Catalogs",      null ],
	 [ L("-- Targeted Retail Accounts"),   "targeted_retail_accounts.aspx", "Targeted Retail Accounts", null ],
	 [ L("-- Shopping Channels"),      "shopping_channels.aspx",           "Shopping Channels",     null ]
	 ]);

new NavSection (menu, "Our Performance",
 [
	 [ L("Top Selling Products"),        "top_selling_products.aspx",           "Top Selling Products",      null ],
	 [ L("Technology"),   "technology.aspx", "Technology", null ]
	 ]);

new NavSection (menu, "Corporate Governance",
 [
	 [ L("Board of Directors"),   "board_of_directors.aspx",                "Board of Directors", null ],
	 [ L("Management Team"),        "management_team.aspx",           "Management Team",      null ]
	 ]);

new NavSection (menu, "About Us",
 [
	 [ L("Company History"),   "company_history.aspx",                "Company History", null ],
	 [ L("Our People"),        "our_people.aspx",           "Our People",      null ],
	 [ L("Facility Tour"),   "facility_tour.aspx", "Facility Tour", null ]
	 ]);

// note, the last 4 links above open in a window with the name "_blank"--that is, a new window ;-)

//  label            url                                       tooltip                     icon

// call generate to create the menubar
menu.generate(true);
menu.sync(true);

// set current values in preferences panel

function comboSelectValue(c, val) {
	var ops = c.getElementsByTagName("option");
	for (var i = 0; i < ops.length; ++i) {
		var op = ops[i];
		op.selected = (op.value == val);
	}
};

//document.getElementById("autohide").checked = menu.prefs["auto-hide"];
//document.getElementById("monosection").checked = menu.prefs["mono-section"];
//document.getElementById("tooltips").checked = menu.prefs["tooltips"];
//comboSelectValue(document.getElementById("animation"), menu.prefs["animation"]);
