var menuVisible = false; Event.observe(window,'load', function () { $$('div.roundy').each(function (i) { var img = document.createElement('img'); if (i.id=='leftcolumn_blue') { img.src='img/cup_left_blue.png'; } if (i.id=='centercolumn_blue') { img.src='img/cup_center_blue.png'; } if (i.id=='leftcolumn_carrot') { img.src='img/cup_left_carrot.png'; } if (i.id=='centercolumn_carrot') { img.src='img/cup_center_carrot.png'; } if (i.id=='leftcolumn_honey') { img.src='img/cup_left_honey.png'; } if (i.id=='centercolumn_honey') { img.src='img/cup_center_honey.png'; } if (i.id=='leftcolumn_olive') { img.src='img/cup_left_olive.png'; } if (i.id=='centercolumn_olive') { img.src='img/cup_center_olive.png'; } if (i.id=='leftcolumn_pink') { img.src='img/cup_left_pink.png'; } if (i.id=='centercolumn_pink') { img.src='img/cup_center_pink.png'; } if (i.id=='leftcolumn_violet') { img.src='img/cup_left_violet.png'; } if (i.id=='centercolumn_violet') { img.src='img/cup_center_violet.png'; } if (i.id=='rightcolumn') { img.src='img/cup_right.png'; } if (i.id=='redbox') { img.src='img/cup_redbox.png'; } if (i.id=='bottomleft') { img.src='img/cup_bottom.png'; } if (i.id=='bottomtext') { img.src='img/cup_bottomtext.png'; } img.alt=''; i.insertBefore(img, i.down()); }); var subMenus = 0; $$('ul.submenu').each(function(i) { subMenus++; i.id='sub_'+subMenus; }); $$('#tabs a').each(function (i) { if (i.up(1).className!='submenu') { var mouseOn = function () { this.up().style.backgroundImage='url(img/tab_on.gif)'; if (this.next()) { var coords = this.up().cumulativeOffset(); this.next().style.top=coords[1]+49+'px'; this.next().style.left=coords[0]-41+'px'; var myId = this.next().id; this.next().onmouseout= function () { if (menuVisible) { var e = arguments[0] || window.event; var tg = (window.event) ? e.srcElement : e.target; var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement; if (reltg.nodeName!='LI' && reltg.nodeName!='A') { $(myId).hide(); this.up().style.backgroundImage='url(img/trans.gif)'; menuVisible=false; } } }; this.next().onmouseover= function () { menuVisible = true; this.up().style.backgroundImage='url(img/tab_on.gif)'; }; $$('ul.submenu').each(function(j) { if (j.id!=myId) { j.hide(); } }); $$('#'+myId+' li').each(function(k) { k.style.margin=0; k.style.padding=0; k.style.height='15px'; k.style.paddingTop='5px'; k.style.paddingBottom='5px'; }); this.next().show(); } } var mouseOff = function () { this.up().style.backgroundImage='url(img/trans.gif)'; } i.onmouseover = mouseOn; i.onmouseout = mouseOff; } }); });