function writeMenuBox(x,y,mItems,mURLsVar,cnt,mName,liteColor,darkColor)
{
 y = y + 5;
 document.write("<div id=" + mName + " style='z-order: 1; position:absolute; " +
  "left:" + x + "; top:" + y + "; visibility: hidden;'><table border='0' cellspacing='0' " +
  "cellpadding='0' bgcolor='" + liteColor + "'><tr><td width='1' height='1'><img src='/common/dot.gif' " +
  " width='1' height='1' border='0'></td><td></td><td><img src='/common/dot.gif' " +
  " width='1' height='1' border='0'></td></tr>");
 for(i = 0; i < cnt; i++) {
  document.write("<tr><td></td><td class=mi onMouseOver='hilite(this,true)' " +
   "onMouseOut='hilite(this,false)' onClick='navigateTo(" + mURLsVar + "[" + i +
   "])'><a class='m2' href='" + eval(mURLsVar)[i] + "'><nobr>&nbsp;&nbsp;" +
   mItems[i] + "&nbsp;&nbsp;</nobr></a></td><td></td></tr><tr><td><img src='/common/dot.gif' border='0' " +
   "width='1' height='1'></td><td></td></tr>");
 }
 document.write("</table></div>")
}

function init()
{ 
 var menu_img = new Image();
 menu_img.src = "/common/mhi.gif";

 var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
 var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

 hidePhrase = "hidden";
 showPhrase = "visible";

 if (isIE || isOpera) {
  mouseX = "event.clientX";
  mouseY = "event.clientY";
  document.onmousemove = move;
 }
 else {
  mouseX = "e.pageX";
  mouseY = "e.pageY";
  window.captureEvents(Event.MOUSEMOVE);
  onmousemove = move;
 }
 menuLeft = 0;
 menuTop = 0;
 menuWidth = 100;
 menuHeight = 100;
 menuDropped = "menu2";
}

function hilite(obj, f)
{    
 obj.style.backgroundColor = f ? '#3399cc' : '#336699';
}

function navigateTo(url)
{
 document.location = url;
}

function move(e)
{
 if (menuDropped == "") return;

 menuLeft = parseInt(document.getElementById(menuDropped).style.left);
 menuTop  = parseInt(document.getElementById(menuDropped).style.top);

 menuWidth = 225;
 menuHeight = 270 - document.body.scrollTop;
 x = parseInt(eval(mouseX));
 y = parseInt(eval(mouseY));

 if (!((x > menuLeft) && (y > menuTop - 18 - document.body.scrollTop) &&
   (x < menuLeft + menuWidth) && (y < menuTop + menuHeight)))
 {
   showMenuBox(menuDropped, hidePhrase);
 }
}

function showMenuBox(mName, cmd)
{
 document.getElementById(menuDropped).style.visibility = hidePhrase;
 document.getElementById(mName).style.visibility = cmd;
 menuDropped = mName;
}

function ItemSelected(obj, num)
{
 obj.background = "/common/mhi.gif";
 if (num > 1) showMenuBox("menu"+num, showPhrase);
}

function ItemUnSelect(obj)
{
 obj.background = "/common/mlo.gif";
}
