1 /*=====================================================================*
2 || ###################################################################
3 || # Blue Static ISSO Framework
4 || # Copyright (c)2005-2009 Blue Static
6 || # This program is free software; you can redistribute it and/or modify
7 || # it under the terms of the GNU General Public License as published by
8 || # the Free Software Foundation; version 2 of the License.
10 || # This program is distributed in the hope that it will be useful, but
11 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 || # You should have received a copy of the GNU General Public License along
16 || # with this program; if not, write to the Free Software Foundation, Inc.,
17 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18 || ###################################################################
19 \*=====================================================================*/
21 function nav_init(openSectionID
, selectedItemID
)
23 var nav
= document
.getElementById("nav");
24 var openSection
= document
.getElementById(_name(openSectionID
));
25 var selectedItem
= document
.getElementById(_name(selectedItemID
));
27 // open the proper nav section
30 openSection
.className
= "expand";
31 _adjacent_ul(openSection
).style
.display
= "block";
34 // bold the selected link
36 selectedItem
.className
= "selected";
38 // register the nav sections
39 var sections
= nav
.getElementsByTagName("ul");
40 sections
= sections
[0].childNodes
;
41 for (var i
= 0; i
< sections
.length
; i
++)
43 // grab only <li> elements that do not have an <ul> in them
44 if (sections
[i].nodeName
.toLowerCase() == "li" && sections
[i].childNodes
.length
== 1)
45 sections
[i].onclick
= nav_toggle
;
51 // we have a class name, so we need to hide
55 _adjacent_ul(this).style
.display
= "none";
60 this.className
= "expand";
61 _adjacent_ul(this).style
.display
= "block";
70 function _adjacent_ul(elm
)
72 // <li> + #text + <li> > #text == <ul>
73 return elm
.nextSibling
.nextSibling
.firstChild
.nextSibling
;