//global variable to allow console inspection of tree: var tree; //anonymous function wraps the remainder of the logic: (function() { //function to initialize the tree: function treeInit2() { buildRandomTextNodeTree(); } //Function creates the tree and //builds between 3 and 7 children of the root node: function buildRandomTextNodeTree() { // indentifica a node e manda abrir o menu var num2 = location.href.indexOf("="); num2++; //instantiate the tree: tree = new YAHOO.widget.TreeView("treeDiv2"); var root = tree.getRoot(); // pega 2 números var num3 = location.href.charAt(num2); num2++; num3 += location.href.charAt(num2); if(num3 == '100'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Home',href:'index.php?topicid=6', id: 'nn', style: estilo}; var inst10 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '100'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Notícias',href:'pages.php?recid=41&start=0&top=grad', id: 'nn', style: estilo}; var inst53 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '24'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Secretaria Virtual',href:'pages.php?recid=24', id: 'nn', style: estilo}; var inst54 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '13'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Material Complementar',href:'pages.php?recid=13', id: 'nn', style: estilo}; var inst55 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '100'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Veris Carreiras',href:'', id: 'nn', style: estilo}; var inst56 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '14'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Serviços',href:'pages.php?recid=14', id: 'nn', style: estilo}; var inst78 = new YAHOO.widget.TextNode(myobj, inst56, false); if(num3 == '73'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Procedimentos para estágio',href:'pages.php?recid=73', id: 'nn', style: estilo}; var inst79 = new YAHOO.widget.TextNode(myobj, inst56, false); if(num3 == '11'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Benefícios',href:'pages.php?recid=11', id: 'nn', style: estilo}; var inst65 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '100'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Biblioteca',href:'', id: 'nn', style: estilo}; var inst66 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '81'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Acervo',href:'pages.php?recid=81', id: 'nn', style: estilo}; var inst57 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '99'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Serviços',href:'pages.php?recid=99', id: 'nn', style: estilo}; var inst59 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '91'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Missão',href:'pages.php?recid=91', id: 'nn', style: estilo}; var inst64 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '83'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'BIBLIOTECA ON-LINE',href:'pages.php?recid=83', id: 'nn', style: estilo}; var inst71 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '87'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'HORÁRIO',href:'pages.php?recid=87', id: 'nn', style: estilo}; var inst72 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '89'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'INFRAESTRUTURA',href:'pages.php?recid=89', id: 'nn', style: estilo}; var inst73 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '93'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'PERIÓDICOS ON-LINE',href:'pages.php?recid=93', id: 'nn', style: estilo}; var inst74 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '95'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'POLÍTICA DE AQUISIÇÃO DE COLEÇÃO',href:'pages.php?recid=95', id: 'nn', style: estilo}; var inst75 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '97'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'REGULAMENTO',href:'pages.php?recid=97', id: 'nn', style: estilo}; var inst76 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '85'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'FALE CONOSCO',href:'pages.php?recid=85', id: 'nn', style: estilo}; var inst77 = new YAHOO.widget.TextNode(myobj, inst66, false); if(num3 == '12'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'Outras Informações',href:'pages.php?recid=12', id: 'nn', style: estilo}; var inst67 = new YAHOO.widget.TextNode(myobj, root, false); if(num3 == '62'){estilo = 'grad1s';}else{estilo = 'grad1f';} myobj = { label: 'TELEFONES ÚTEIS',href:'pages.php?recid=62', id: 'nn', style: estilo}; var inst69 = new YAHOO.widget.TextNode(myobj, root, false); //The tree is not created in the DOM until this method is called: tree.draw(); } /////////////////////////////// // carregamento das bibliotecas /////////////////////////////// function init_menu() { //Carregamento dinâmico das bibliotecas do YAHOO var loader = new YAHOO.util.YUILoader({ require: ['treeview','yahoo','event'], loadOptional: true, onSuccess: function() { treeInit2(); } }); loader.insert(); } //Add an onDOMReady handler to build the tree when the document is ready YAHOO.util.Event.onDOMReady(init_menu); })();