2 * Drop down menu script
\r
4 var dd_hide_delay = 500; // Hide menu delay
\r
5 var dd_show_delay = 200; // Show menu delay
\r
6 var dd_options = new Array(); // Menu settings
\r
8 var dd_timer = new Number(0);
\r
10 function dd_getSubMenu(depth)
\r
12 var id = 'dd_sub_menu_' + depth;
\r
16 s = insertElement(getBody(), 'DIV', id);
\r
17 s.className = 'skin_pop_sub';
\r
18 s.style.zIndex = 100 + depth;
\r
19 s.style.visibility = "hidden";
\r
20 s.style.position = 'absolute';
\r
24 function dd_showSub(id, x, y)
\r
26 var l = id.split('_');
\r
27 var ls = eval(l[0]);
\r
28 for (var i=1;i<l.length;i++)
\r
33 dd_drawSubMenu(ls, id, dd_getSubMenu(i), x, y);
\r
35 function dd_hideSub(j)
\r
37 while(s = $('dd_sub_menu_' + j)){
\r
38 s.style.visibility = "hidden"; j++;
\r
41 function getSubMenuText(sub, pid)
\r
43 var l = pid.split('_'), o = dd_options[l[0]], text = '';
\r
48 + '<div class="' + o.row + '" id=' + pid + '_' + i + ' style="position: relative;" onmouseover="dd_Select(this);" onmouseout="dd_Unselect(this);">'
\r
49 + (r.link ? '<a href="' + r.link + '" ' + (r.target ? 'target="' + r.target + '"' : '') + '>' + r.text + '</a>' : r.text)
\r
50 + (r.sub ? '<div class="'+ o.arrow + '" style="position: absolute;">' + o.arrowtext + '</div>' : '')
\r
56 function dd_drawSubMenu(sub, name, s, x, y)
\r
58 s.innerHTML = getSubMenuText(sub, name);
\r
59 var p= getPageRect(),
\r
60 right = p.left + p.width - (s.offsetWidth || s.style.pixelWidth),
\r
61 bottom = p.height + p.top - (s.offsetHeight || s.style.pixelHeight);
\r
62 if (x >= right) x = right;
\r
63 if (y >= bottom) y = bottom;
\r
65 css.left = (x < p.left ? p.left : x) + 'px';
\r
66 css.top = (y < p.top ? p.top : y) + 'px';
\r
67 css.visibility = "visible";
\r
69 function dd_markRow(row, cname)
\r
74 s.className = cname;
\r
75 var p = id.lastIndexOf('_');
\r
76 id = id.substring(0, p);
\r
79 function dd_Select(row)
\r
81 var l = row.id.split('_');
\r
82 var o = dd_options[l[0]];
\r
83 dd_markRow(row, o.selrow);
\r
84 var b = getBounds(row);
\r
86 var p = o['mpos'+d] ? o['mpos'+d] : o.defpos;
\r
89 case 'tr': x=b.left+b.width+p.x; y=b.top+p.y;break;
\r
90 case 'bl': x=b.left+p.x; y=b.top+b.height+p.y;break;
\r
92 dd_timer.Timer('dd_showSub("'+row.id+'",'+x+','+y+')', dd_show_delay, true);
\r
94 function dd_Unselect(row)
\r
96 var l = row.id.split('_');
\r
97 var o = dd_options[l[0]];
\r
98 dd_markRow(row, o.row);
\r
99 dd_timer.Timer('dd_hideSub('+o.min+')', dd_hide_delay, true);
\r