Update version.php to 3.3.0
[isso.git] / Decorator.js
1 /*=====================================================================*
2 || ###################################################################
3 || # Blue Static ISSO Framework
4 || # Copyright (c)2005-2009 Blue Static
5 || #
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.
9 || #
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
13 || # more details.
14 || #
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 \*=====================================================================*/
20
21 function nav_init(openSectionID, selectedItemID)
22 {
23 var nav = document.getElementById("nav");
24 var openSection = document.getElementById(_name(openSectionID));
25 var selectedItem = document.getElementById(_name(selectedItemID));
26
27 // open the proper nav section
28 if (openSection)
29 {
30 openSection.className = "expand";
31 _adjacent_ul(openSection).style.display = "block";
32 }
33
34 // bold the selected link
35 if (selectedItem)
36 selectedItem.className = "selected";
37
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++)
42 {
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;
46 }
47 }
48
49 function nav_toggle()
50 {
51 // we have a class name, so we need to hide
52 if (this.className)
53 {
54 this.className = "";
55 _adjacent_ul(this).style.display = "none";
56 }
57 // show the block
58 else
59 {
60 this.className = "expand";
61 _adjacent_ul(this).style.display = "block";
62 }
63 }
64
65 function _name(str)
66 {
67 return "nav_" + str;
68 }
69
70 function _adjacent_ul(elm)
71 {
72 // <li> + #text + <li> > #text == <ul>
73 return elm.nextSibling.nextSibling.firstChild.nextSibling;
74 }