var menuData = { // construction du menu en notation JSON menuObject : [ { id:'12505', label:"Investidor particular",url_href:'',children: [ { id:'12700', label:"Introdução",url_href:'/landing/investorIndividual-12700-PT.html',children: [ ]}, { id:'1925', label:"My Euronext",url_href:'',children: [ { id:'3040', label:"Registo",url_href:'/myEuronext/users/registration-22267-PT.html',children : [ ]}, { id:'2203', label:"Utilizadores",url_href:'',children : [ { id:'3039', label:"Login",url_href:'/myEuronext/login/login-3039-PT.html', children: []}, { id:'3041', label:"Perfil",url_href:'/myEuronext/profile/profile-3041-PT.html', children: []} ]}, { id:'2200', label:"Minha carteira",url_href:'/myEuronext/portfolio/listPortfolio-2200-PT.html',children : [ ]}, { id:'2201', label:"Minhas cotações",url_href:'/myEuronext/portfolio/listPortfolio-2201-PT.html',children : [ ]}, { id:'2202', label:"Alertas",url_href:'/myEuronext/alerts/listAlerts-2202-PT.html',children : [ ]}, { id:'45218', label:"Single Order Book",url_href:'/editorial/wide/editorial-45218-PT.html',children : [ ]} ]}, { id:'21773', label:"Holanda",url_href:'',children: [ { id:'18814', label:"Introdução",url_href:'/landing/landingGeneral-18814-PT.html',children : [ ]} ]}, { id:'1750', label:"Bélgica",url_href:'',children: [ { id:'21515', label:"Introdução",url_href:'/landing/homeBrussels-21515-PT.html',children : [ ]}, { id:'39574', label:"My Euronext Brussels",url_href:'/editorial/wide/editorial-39574-PT.html',children : [ ]} ]}, { id:'21513', label:"Reino Unido",url_href:'',children: [ { id:'21514', label:"Introdução",url_href:'/landing/landingGeneral-21514-PT.html',children : [ ]}, { id:'39420', label:"Trading Simulation game",url_href:'http://usftradinggame.euronext.if5.com/',children : [ ]} ]}, { id:'1754', label:"França",url_href:'',children: [ { id:'21516', label:"Introdução",url_href:'/landing/landingGeneral-21516-PT.html',children : [ ]} ]}, { id:'33118', label:"Portugal",url_href:'',children: [ { id:'33119', label:"Introdução",url_href:'/landing/landingGeneral-33119-PT.html',children : [ ]}, { id:'33120', label:"Cotações",url_href:'/editorial/wide/editorial-33120-PT.html',children : [ ]}, { id:'33121', label:"Formação",url_href:'/editorial/wide/editorial-33121-PT.html',children : [ ]}, { id:'33122', label:"Publicações",url_href:'/editorial/wide/editorial-33122-PT.html',children : [ ]}, { id:'58421', label:"Simulação de negociação",url_href:'/editorial/wide/editorial-58421-PT.html',children : [ ]} ]}, { id:'12753', label:"Formação",url_href:'',children: [ { id:'1747', label:"A bolsa",url_href:'',children : [ { id:'1786', label:"Sobre a Nyse Euronext",url_href:'/editorial/wide/editorial-1786-PT.html', children: []}, { id:'1785', label:"Organizações financeiras",url_href:'/editorial/wide/editorial-1785-PT.html', children: []} ]}, { id:'1748', label:"Produtos",url_href:'',children : [ { id:'1789', label:"Acções",url_href:'/editorial/wide/editorial-2284-PT.html', children: []}, { id:'1793', label:"Warrants & certificados",url_href:'/editorial/wide/editorial-2304-PT.html', children: []}, { id:'1794', label:"ETF/Trackers",url_href:'/editorial/wide/editorial-2308-PT.html', children: []}, { id:'1795', label:"Opções",url_href:'/editorial/wide/editorial-2316-PT.html', children: []}, { id:'1790', label:"Futuros",url_href:'/editorial/wide/editorial-2321-PT.html', children: []}, { id:'1797', label:"Índices globais",url_href:'/editorial/wide/editorial-2329-PT.html', children: []}, { id:'1791', label:"Índices nacionais",url_href:'/editorial/wide/editorial-2331-PT.html', children: []}, { id:'1796', label:"Obrigações",url_href:'/editorial/wide/editorial-2337-PT.html', children: []}, { id:'1792', label:"Fundos investimento holandeses",url_href:'/editorial/wide/editorial-2340-PT.html', children: []} ]}, { id:'1654', label:"Clubes de investimento",url_href:'',children : [ { id:'2150', label:"Amesterdão",url_href:'/editorial/wide/editorial-2150-PT.html', children: []}, { id:'2152', label:"Bruxelas",url_href:'/editorial/wide/editorial-2152-PT.html', children: []}, { id:'2151', label:"Paris",url_href:'/editorial/wide/editorial-2151-PT.html', children: []} ]}, { id:'2147', label:"Perguntas",url_href:'/editorial/wide/faq-2147-PT.html',children : [ ]}, { id:'2149', label:"Glossário",url_href:'/common/glossary/glossary-2149-PT.html',children : [ ]}, { id:'13167', label:"Eventos",url_href:'',children : [ { id:'13168', label:"Próximos eventos",url_href:'/news/generaleventscurrent/comingEvents-13168-PT.html', children: []}, { id:'13169', label:"Histórico",url_href:'/news/generaleventscurrent/comingEvents-13169-PT.html', children: []} ]} ]}, { id:'1657', label:"Publicações",url_href:'',children: [ { id:'1766', label:"Documentação geral",url_href:'/tools/documentation/wide/documents-1766-PT.html',children : [ ]}, { id:'1765', label:"Boletins",url_href:'/news/newsletters/wide/newsletters-1765-PT.html',children : [ ]}, { id:'1767', label:"Livros recomendados",url_href:'/editorial/wide/editorial-1767-PT.html',children : [ ]} ]} ]} ], // méthodes de construction du menu en HTML referenceChannel : undefined, anchorElement : undefined, focusedElement : undefined, channelIDSelected : undefined, hasVisibleNodeChildren : false, buildMenu : function(elt, visibleNode) { menuData.anchorElement = elt; menuData.channelIDSelected = visibleNode ; menuData.buildSubMenu(elt, menuData.menuObject, 1); menuData.anchorElement.select("li.extensible").each(function(item) { item.addClassName("collapsed"); item.addClassName("collapsed-level"+item.level); }); var referenceChannel=$(visibleNode); menuData.focusedElement = $(visibleNode) ; if (referenceChannel != undefined && referenceChannel != null) { level = referenceChannel.level ; if ( ! menuData.hasVisibleNodeChildren && (level == 2 || level == 3 || level == 4)) referenceChannel.addClassName("focusedLevel"+level) ; else if (level == 1) referenceChannel.addClassName("focused"); if (!referenceChannel.hasClassName("extensible")) referenceChannel = referenceChannel.up("li.extensible"); if (referenceChannel != undefined) { referenceChannel.expandMenu(); menuData.referenceChannel = referenceChannel; } } menuData.anchorElement.observe("click", menuClickObserver); $(document).observe("mouseover", menuOverObserver); }, buildSubMenu : function(elt, children, level) { var ul = new Element("ul"); children.each(function(item) { var li = new Element("li", {id : item.id}); li.level=level; if (item.children.length > 0) { if (item.id == menuData.channelIDSelected) menuData.hasVisibleNodeChildren = true ; li.update("
"+item.label+"
"); li.addClassName("extensible"); li.collapseMenu=menuFct.collapseMenu; li.expandMenu=menuFct.expandMenu; var subUl = menuData.buildSubMenu(li, item.children, level+1); subUl.hide(); } else li.update("
"+item.label+"
"); ul.insert(li); }); elt.insert(ul); return ul; } }; var menuFct = { collapseMenu : function () { var elt = $(this); if (elt.hasClassName("collapsed")) return; elt.removeClassName("expanded"); elt.removeClassName("expanded-level"+elt.level); elt.addClassName("collapsed"); elt.addClassName("collapsed-level"+elt.level); var toHide = elt.childElements()[1]; Effect.BlindUp(toHide, { duration: 0.2 }); // collapse children recursively elt.select('li.expanded').each(function(child) { child.collapseMenu() ; }) ; }, expandMenu : function () { var elt = $(this); // expand if not done yet if (!elt.hasClassName("expanded")) { elt.addClassName("expanded"); elt.addClassName("expanded-level"+elt.level); elt.removeClassName("collapsed"); elt.removeClassName("collapsed-level"+elt.level); var toShow = elt.childElements()[1]; Effect.BlindDown(toShow, { duration: 0.3 }); } // collapse sibblings elt.siblings().each(function(sib) { if (sib.match("li.extensible", "expanded")) sib.collapseMenu(); }); // expand father recursively var fatherToExpand = elt.up('.extensible'); if (fatherToExpand != undefined) fatherToExpand.expandMenu(); } }; var backToRefID = null; function menuOverObserver(e) { var element = Event.element(e); if (element.descendantOf(menuData.anchorElement)) // Over menu { // Just entered -> Cancel the back to reference channel callback if (backToRefID != null) { clearTimeout(backToRefID); backToRefID = null; } } // Not over menu and trigger not set yet else if (backToRefID == null) { // Trigger the back to reference channel callback backToRefID = setTimeout(function() { // open the reference node if (menuData.referenceChannel != undefined) { menuData.referenceChannel.expandMenu(); // collpase the children of the reference element menuData.referenceChannel.select('.expanded').each(function(child) { child.collapseMenu() ; }) ; } // collapse the brothers of the active element if (menuData.focusedElement != undefined) { menuData.focusedElement.siblings().each(function(sib) { if (sib.match("li.extensible", "expanded")) sib.collapseMenu() ; }) ; } }, 5000); } } function menuClickObserver(e) { var elt = Event.element(e); // Skip links if (elt.match("a div")||elt.match("a")) return; // Get the first extensible parent var extensibleParent = elt.match("li.extensible")?elt:elt.up("li.extensible"); // If not found, we're not in the menu if (extensibleParent == undefined) return; if (extensibleParent.expandMenu != undefined) // If found { if (extensibleParent.hasClassName("expanded")) extensibleParent.collapseMenu(); else extensibleParent.expandMenu(); e.stop(); } }