/*
	 Initialize and render the MenuBar when its elements are ready 
	 to be scripted.
*/

YAHOO.util.Event.onContentReady("productsandservices", 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("productsandservices", { 
												autosubmenudisplay: true, 
												hidedelay: 750, 
												lazyload: true });

	/*
		 Define an array of object literals, each containing 
		 the data necessary to create a submenu.
	*/

	var aSubmenuData = 
	[
	
		{
			id : "Company",
			itemdata:
			[
				{ text: "About TessArae", url: "../company.html" },
				{ text: "TessArae Blog", url: "../blog/index.php" }
		    ]
		},
			{
			id: "Technology", 
			itemdata: 
			[
				{ text: "RPM: How it Works", url: "../technology.html" },
				{ text: "RPM Protocol", url: "../technology2.html" },
				{ text: "Flu Vaccine Example", url: "../technology3.html" },
				{ text: "Publication List", url: "../publications.html" }
			]
		},

		{
			id: "Products", 
			itemdata: 
			[
				<!-- { text: "TessArray RM-Flu", url: "../h1n1flu/index.html" }, -->
				{ text: "RPM-Flu Array", url: "../products_flu.html" },
				{ text: "RPM-TEI Array", url: "../products_tei.html" },
				{ text: "RPM-HFV Array", url: "../products_hfv.html" }, 
				<!-- { text: "Custom Designs", url: "../services.html" } -->                                    
			]    
		},
		{
			id: "Applications", 
			itemdata: 
			[
			   { text: "Agriculture", url: "../applications_ag1.html" },
			   { text: "Human Genetics", url: "applications_genetics.html" },
			   { text: "Pharmaceutical Industry", url: "../applications_pharma.html" }                                  
			] 
		},
		{
			id: "Downloads", 
			itemdata: 
			[
				{ text: "Product Downloads", url: "../downloads/prod_downloads.aspx" },
				{ text: "Corporate Downloads", url: "../downloads/corp_downloads.aspx" }
						  
			] 
		},
		{
			id: "contact", 
			itemdata: [ 
				
			] 
		}
		
					
	];


	/*
		 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();         

});