|
1 |
|
2 // otl_handler javascript functions |
|
3 |
|
4 |
|
5 var scroll = new Array(); |
|
6 var itemcount = 0; |
|
7 |
|
8 function init_page() |
|
9 { |
|
10 if (! document.getElementById ) return false; |
|
11 |
|
12 var spans = document.getElementsByTagName('span'); |
|
13 for (i = 0; i < spans.length; i++) { |
|
14 var id = spans[i].getAttribute('id'); |
|
15 if (id == null || id == "") continue; |
|
16 if (id.indexOf("itemtoplevel_") == -1) continue; |
|
17 |
|
18 // ie doesn't support negative substr positions :\ |
|
19 // var num = id.substr(-1, 1); |
|
20 var num = id.substr(13, 1); |
|
21 var itemtoplevel = spans[i]; |
|
22 var itemgroup = document.getElementById("itemgroup_" + num); |
|
23 if (! itemtoplevel || ! itemgroup) continue; |
|
24 |
|
25 itemcount++; |
|
26 |
|
27 itemgroup.style.display = 'none'; |
|
28 itemgroup.style.overflow = 'hidden'; |
|
29 itemtoplevel.onmouseover = function() { this.className = 'level0_over'; } |
|
30 itemtoplevel.onmouseout = function() { this.className = 'level0'; } |
|
31 itemtoplevel.onmouseup = function() { this.className = 'level0'; toggle(this); return false; } |
|
32 itemtoplevel.onselectstart = function() { return false; } |
|
33 |
|
34 } |
|
35 |
|
36 return; |
|
37 } |
|
38 |
|
39 |
|
40 function toggle(i) |
|
41 { |
|
42 var ig = document.getElementById( i.id.replace("toplevel", "group") ); |
|
43 if (! ig ) return; |
|
44 |
|
45 var num = ig.id.substr(10,1); |
|
46 |
|
47 // show |
|
48 if (ig.style.display == "" || |
|
49 ig.style.display == "none") { |
|
50 |
|
51 ig.style.height = "0pt"; |
|
52 ig.style.display = 'block'; |
|
53 grow(num); |
|
54 |
|
55 // hide others |
|
56 for (i = 0; i != itemcount; i++) { |
|
57 if (i != num) shrink(i); |
|
58 } |
|
59 |
|
60 } |
|
61 // hide |
|
62 else { |
|
63 shrink(num); |
|
64 } |
|
65 |
|
66 return; |
|
67 } |
|
68 |
|
69 function grow(num) |
|
70 { |
|
71 var ig = document.getElementById( "itemgroup_" + num ); |
|
72 if (! ig ) return; |
|
73 scroll[num] = 1; |
|
74 |
|
75 var curheight = parseInt(ig.style.height.replace("pt", "")); |
|
76 if (curheight >= 250) { |
|
77 ig.style.overflow = 'auto'; |
|
78 scroll[num] = 0; |
|
79 return; |
|
80 } |
|
81 |
|
82 var newheight = curheight + 25 + "pt"; |
|
83 ig.style.height = newheight; |
|
84 |
|
85 setTimeout("grow(" + num + ")", 30); |
|
86 return; |
|
87 } |
|
88 |
|
89 function shrink(num) |
|
90 { |
|
91 var ig = document.getElementById( "itemgroup_" + num ); |
|
92 if (! ig ) return; |
|
93 if (scroll[num] == 1) return; |
|
94 ig.style.overflow = 'hidden'; |
|
95 |
|
96 var curheight = parseInt(ig.style.height.replace("pt", "")); |
|
97 if (curheight == 0) { |
|
98 ig.style.display = 'none'; |
|
99 return; |
|
100 } |
|
101 |
|
102 var newheight = curheight - 50 + "pt"; |
|
103 ig.style.height = newheight; |
|
104 |
|
105 setTimeout("shrink(" + num + ")", 30); |
|
106 return; |
|
107 } |
|
108 |
|
109 |