// JavaScript Document

/*
                 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 for the Menu element to be created, the second is an 
					object literal of configuration properties.
                */

                var oMenuBar = new YAHOO.widget.MenuBar("productsandservices", { 
                                                            autosubmenudisplay: true, 
                                                            hidedelay: 750, 
                                                            lazyload: true });
														
				YAHOO.util.Dom.addClass(oMenuBar.element, "yuimenubarnav");


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

                var aSubmenuData = [
                
                    {
                        id: "Redovisning", 
                        itemdata: [ 
							{ text: "Redovisning / Revision", url: "redovisning_revision.php" },	   
                            { text: "Skatteärenden", url: "skattearende.php" },
                            { text: "Löneadministration", url: "loneadministration.php" },
							{ text: "Fakturaservice", url: "fakturaservice.php" },                            
                            /*{
                                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: "Affarjuridik", 
                        itemdata: [
                            { text: "Affärsjuridik", url: "affarjuridik.php" },
                            { text: "Bolagsärenden", url: "bolagsarende.php" }
                        ] 
                    },

                    {
                        id: "Fastighetsförvaltning", 
                        itemdata: [
                            { text: "Ekonomisk fastighetsförvaltning", url: "eko_fastighetsfor.php" },
							{ text: "Teknisk fastighetsförvaltning", url: "tek_fastighetsfor.php" } 
                        ]    
                    },      
					
					{
                        id: "ittjanster",
						itemdata: [
                            { text: "Hemsidor", url: "hemsidor.php" },
                            { text: "IT-system, installation, service och support", url: "natverkslosningar.php" },
                            
                        ]
                        
                    },
                    
					
					{
                        id: "finansarende",
						itemdata: [
                            { text: "Factoring / Fakturaköp", url: "factoring_fakturakop.php" }
                        ] 
                        
                    },
                               					
					{
                        id: "ovrigt",
                        itemdata: [
                            { text: "Förvärv", url: "forvarv.php" },
                            { text: "Lediga Arbeten", url: "ledigaarbeten.php" },
							{ text: "Businesscoaching", url: "businesscoaching.php" }
                        ]
                    } 
					
					
                ];


                /*
                     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++) {
                        	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();         
            
            });
