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

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

/*
		Instantiate a MenuBar:	The first argument passed to the constructor
		is the id for the Menu element to be created, the second is an 
		object literal of configuration properties.
*/

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

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

		var aSubmenuData = [
		
			{
				id: "Accueil"
			},

			{
				id: "Nicole", 
				itemdata: [
					{ text: "Parcours professionnel", url: "?section=nicole_parcours" },
					{ text: "Conseils et soins", url: "?section=nicole_conseils" },
					{ text: "Mes pr&eacute;parations", url: "?section=nicole_preparations" },
					{ text: "Liste des cours", url: "?section=cours_nicole_liste" },
					{ text: "Liste des conférences", url: "?section=conf_nicole_liste" }
				]		
			},

			{
				id: "Therapeutes", 
				itemdata: [
					[
	          { text: 'Permanents', URL: '/index.php?section=therapeutes.php&ext=0' },
	          { text: 'Intervenants externes', URL: '/index.php?section=therapeutes.php&ext=1' }
					]
/*
					{
						text: "PIM",
						submenu: { 
							id: "pim", 
							itemdata: [
								{ text: "Yahoo! Mail", url: "http://mail.yahoo.com" },
								{ text: "Yahoo! Address Book", url: "http://addressbook.yahoo.com" },
								{ text: "Yahoo! Calendar",	url: "http://calendar.yahoo.com" },
								{ text: "Yahoo! Notepad", url: "http://notepad.yahoo.com" }
							] 
						}
					}, 
*/
				]
			},

			{
				id: "mnuCours", 
				itemdata: [
					[
						{ text: "Liste des cours des intervenants externes", url: "?section=cours_ext_liste&style=as" },
						{ text: "Liste des conférences des intervenants externes", url: "?section=conf_ext_liste&style=as" }
					],
					[
						{ text: "Liste des cours organisés par des externes", url: "?section=cours_persext_liste&style=as" }
					]
				] 
			},

			{
				id: "mnuAgenda"
			},

			{
				id: "mnuBoutique"
/*
				itemdata: [
					[
						{ text: "L'aromathérapie", URL: "?section=aroma_histoire" },
						{ text: "Les huiles essentielles", URL: "?section=aroma_huiles" },
						{ text: "Les hydrolats", URL: "?section=aroma_hydrolats" },
						{ text: "Trousse de secours", URL: "?section=aroma_trousse" }
					],
					[
						{ text: "Horaires d'ouverture", URL: "?section=horaires&style=boutique" },
						{ text: "Liste de prix...", URL: "listeprix/liste_prix_HE.pdf", target: "_blank" }
					],
					[
						{ text: "Autres points de vente", URL: "?section=pdv&style=boutique" },
						{ text: "Partenaires", URL: "?section=partenaires&style=boutique" }
					]
				]
*/
			},

			{
				id: "mnuNewsletter",
				itemdata: [
					{ text: "Lire les newsletter", url: "?section=newsletter" },
					{ text: "S'abonner", url: "?section=newsletter_manage&action=subscribe" },
					{ text: "Se d&eacute;sabonner", url: "?section=newsletter_manage&action=unsubscribe" }
				]
			},
			
			{
				id: "mnuLiens"
			},
			
			{
				id: "mnuContacts",
				itemdata: [
					{ text : "Contacts", url: "?section=contacts" },
					{ text : "Situation", url: "?section=situation" }
				]
			}

		];


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

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

			var nSubmenus = aSubmenuData.length, i;

			if (this.getRoot() == this) {
				for (i = 0; i < nSubmenus; i++) {
					if (aSubmenuData[i].itemdata != null) {
						this.getItem(i).cfg.setProperty("submenu", aSubmenuData[i]);
					}
				}
			}
		});


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

		oMenuBar.render();				 

	});

