// ***************************************** // menu.js : dynamic hierarchical menu system // // (c) by E.F. de Moor (Creagraphy) ernst@creagraphy.nl // // date: april 8th 2002 // // // Following function are used for interfacing // // my_menu_sel(id) : called when the user clicks a menu item in our own frame. // This function must call menu_sel in all frames! // my_menu_over(id) : called when the mouse moves over a menu item of our own frame. // This function must call menu_over in all frames! // my_menu_out(id) : called when the mouse moves out a menu item of our own frame. // This function must call menu_out in all frames! // // menu_sel(id) : called when the user clicks a menu item in any frame. // menu_over(id) : called when the mouse moves over a menu item in any frame. // menu_out(id) : called when the mouse moves out a menu item in any frame. // set_page_info(sel, info) : called by the content frame, if the content changes. // // cms_onload(sel) : called once when this frame is loaded // // // Note about the my_menu... functions: // These functions are implemented in ../menu.inc. // // Note about the menu_sel, menu_over and menu_out functions: // Any frame is allowed to implement these (not just menu frames). This can be used // To give helpinformation (e.g. popup notes, textual explanations) in other frames // Whenever something happens with a menu button or whenever a new page is loaded // in the content frame. // // Note: Also new is that the content frame is now allowed to have a menu itself. This is // Handy to have a popup menu to appear over the content itself. // First get a pointer to the menu tree and set_states function of the main frame if(typeof(menu_tree) == "undefined" && typeof(parent.menu_tree) != "undefined") { menu_tree = parent.menu_tree; } if(typeof(menu_tree) == "undefined" && typeof(top.menu_tree) != "undefined") { menu_tree = top.menu_tree; } menu_tree_parms = new Array(); if(typeof(menu_tree) != "undefined") for(var i=0; i= 0) sel_index = id; var i; for(i=0; i menu_tree[i].level ) menu_tree[i].parent = true; else menu_tree[i].parent = false; // is it selected? if(i == sel_index) { cur_level = menu_tree[i].level; menu_tree[i].selected = true; if(menu_tree[i].parent) menu_tree[i].expanded = true; } else menu_tree[i].selected = false; } // Set all parents to expanded for(i=sel_index; i>=0; i--) { // is it expanded? if(menu_tree[i].level < cur_level) { menu_tree[i].expanded = true; cur_level = menu_tree[i].level; } } check_visible(0,0); } function check_visible(level, idx) { for(var i=idx; i0) { for (var i=0; i"+menu_tree[i].text+""; } IdTest = "/"+menu_tree[i].ref+"$"; if (sel.match(new RegExp(IdTest))) { sel_found = true; break; } } // Construct a string out of the levels we've just found, if any... if (sel_found==true && level_path.length>0) { for(var i=0; i