--- /dev/null
+/*=====================================================================*
+|| ###################################################################
+|| # Blue Static ISSO Framework
+|| # Copyright (c)2005-2008 Blue Static
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version 2 of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+function nav_init(openSectionID, selectedItemID)
+{
+ var nav = document.getElementById("nav");
+ var openSection = document.getElementById(_name(openSectionID));
+ var selectedItem = document.getElementById(_name(selectedItemID));
+
+ // open the proper nav section
+ if (openSection)
+ {
+ openSection.className = "expand";
+ _adjacent_ul(openSection).style.display = "block";
+ }
+
+ // bold the selected link
+ if (selectedItem)
+ selectedItem.className = "selected";
+
+ // register the nav sections
+ var sections = nav.getElementsByTagName("ul");
+ sections = sections[0].childNodes;
+ for (var i = 0; i < sections.length; i++)
+ {
+ // grab only <li> elements that do not have an <ul> in them
+ if (sections[i].nodeName.toLowerCase() == "li" && sections[i].childNodes.length == 1)
+ sections[i].onclick = nav_toggle;
+ }
+}
+
+function nav_toggle()
+{
+ // we have a class name, so we need to hide
+ if (this.className)
+ {
+ this.className = "";
+ _adjacent_ul(this).style.display = "none";
+ }
+ // show the block
+ else
+ {
+ this.className = "expand";
+ _adjacent_ul(this).style.display = "block";
+ }
+}
+
+function _name(str)
+{
+ return "nav_" + str;
+}
+
+function _adjacent_ul(elm)
+{
+ // <li> + #text + <li> > #text == <ul>
+ return elm.nextSibling.nextSibling.firstChild.nextSibling;
+}
<head>
<title>Decorator Test</title>
<link rel="stylesheet" href="../Decorator.css.php" type="text/css" media="screen" charset="utf-8" />
+ <script type="text/javascript" charset="utf-8" src="../Decorator.js"></script>
</head>
<body>
</h2>
<ul>
- <li class="expand">Options</li>
+ <li id="nav_options" class="expand">Options</li>
<li>
<ul>
- <li class="selected"><a href="#">Bugdar Settings</a></li>
- <li><a href="#">Languages</a></li>
- <li><a href="#">User Help Items</a></li>
+ <li id="nav_options_settings"><a href="#">Bugdar Settings</a></li>
+ <li id="nav_options_languages"><a href="#">Languages</a></li>
+ <li id="nav_options_user_help"><a href="#">User Help Items</a></li>
</ul>
</li>
- <li>Products</li>
- <li>Fields</li>
- <li>Users & Permissions</li>
+ <li id="nav_products">Products</li>
+ <li id="nav_fields">Fields</li>
+ <li id="nav_users">Users & Permissions</li>
</ul>
</div>
</div>
+<script type="text/javascript" charset="utf-8">
+//<![CDATA[//
+
+ nav_init("options", "options_settings");
+
+//]]>
+</script>
+
</body>
</html>
\ No newline at end of file