/*
Initialize and render the MenuBar when its elements are ready 
to be scripted.
*/

YAHOO.util.Event.onContentReady("globalNaviArea", function () {

/*
Instantiate a MenuBar:  The first argument passed to the 
constructor is the id of the element in the page 
representing the MenuBar; the second is an object literal 
of configuration properties.
*/

var oMenuBar = new YAHOO.widget.MenuBar("globalNaviArea", { 
autosubmenudisplay: true, 
hidedelay: 750, 
lazyload: true });

/*
Define an array of object literals, each containing 
the data necessary to create a submenu.
*/

var aSubmenuData = [

{
id: "home", 
itemdata: [
]    
},

{
id: "corporate", 
itemdata: [
{ text: "Management Plan  (&#8220;Grand Design&#8221;)", url: "/corporate/management/index.htm" },
{ text: "Corporate Overview", url: "/corporate/overview/index.htm" },
{ text: "Corporate Publication", url: "/corporate/publication/index.htm" },
{ text: "R&amp;D and Technology", url: "/corporate/rd/index.htm" },
{ text: "Subsidiaries &amp; Affiliates in Asia Pacific region", url: "/corporate/oversea/index.htm" }
] 
},

{
id: "service", 
itemdata: [
]    
},

{
id: "news", 
itemdata: [
]    
},

{
id: "careers", 
itemdata: [
{ text: "Why Mitsui", url: "/careers/working/index.htm" },
{ text: "Rewards &amp; Benefits", url: "/careers/benefit/index.htm" },
{ text: "Job Opportunities", url: "/careers/jobsearch/index.htm" },
{ text: "Location", url: "/careers/location/index.htm" },
{ text: "Scholarship Program", url: "/careers/scholarship/index.htm" },
{ text: "Internship Program", url: "/careers/internship/index.htm" }
]
},


{
id: "investor",
itemdata: [

{ text: "Management Plan（&#8220;Grand Design&#8221;）", url: "http://www.mitsuichem.com/corporate/management/index.htm" },
{ text: "Financial Results", url: "http://www.mitsuichem.com/ir/library/index.htm" },
{ text: "Fact Book", url: "http://www.mitsuichem.com/ir/fact_book/index.htm" },
{ text: "IR Calendar", url: "http://www.mitsuichem.com/ir/index.htm"},
{ text: "Stock Information", url: "http://www.mitsuichem.com/ir/info/index.htm" },
{ text: "IR News", url: "http://www.mitsuichem.com/ir/information.htm"}
]
},
];


/*
Subscribe to the "beforerender" event, adding a submenu 
to each of the items in the MenuBar instance.
*/

oMenuBar.subscribe("beforeRender", function () {

if (this.getRoot() == this) {

//this.getItem(0).cfg.setProperty("submenu", aSubmenuData[0]);
this.getItem(1).cfg.setProperty("submenu", aSubmenuData[1]);
this.getItem(2).cfg.setProperty("submenu", aSubmenuData[2]);
//this.getItem(3).cfg.setProperty("submenu", aSubmenuData[3]);
this.getItem(4).cfg.setProperty("submenu", aSubmenuData[4]);
this.getItem(5).cfg.setProperty("submenu", aSubmenuData[5]);
}

});


/*
Call the "render" method with no arguments since the 
markup for this MenuBar instance is already exists in 
the page.
*/

oMenuBar.render();

});
