function page_tree_init ( ) { var tree = $('page_tree'); var elems = document.getElementsByClassName('child', tree); elems.each(hook_page_tree);}function hook_page_tree ( obj ) { var parent = obj.parentNode; // when you click this LI element, toggle the display of its children parent.onclick = function ( ) { obj.toggle(); }}// add our load event, which will find all our parent items and add // javascript events ot them for on-click that will expand their childrenwindow.onload = function ( ) { page_tree_init(); }