Merge branch 'libs/jetty/sni_clean'
[gigi.git] / static / menu.js
1 (function() {
2         function explodeMenu(e) {
3                 if (document.getElementById(e).className == 'menu hidden') {
4                         document.getElementById(e).className = 'menu';
5                 } else {
6                         document.getElementById(e).className = 'menu hidden';
7                 }
8         }
9
10         function initMenu() {
11                 var Nodes = document.getElementsByTagName('ul');
12                 var max = Nodes.length;
13                 for (var i = 0; i < max; i++) {
14                         var nodeObj = Nodes.item(i);
15                         if (nodeObj.className.indexOf("menu") > -1 && nodeObj.id != "recom") {
16                                 nodeObj.previousSibling.previousSibling.onclick = (function(nid) {
17                                         return function() {
18                                                 explodeMenu(nid);
19                                         };
20                                 })(nodeObj.id);
21                         }
22                 }
23         }
24         (function(oldLoad) {
25                 if (oldLoad == undefined) {
26                         window.onload = initMenu;
27                 } else {
28                         window.onload = function() {
29                                 initMenu();
30                                 oldLoad();
31                         }
32                 }
33         })(window.onload);
34
35 })();