  function HFMenu(triggerId, menuId, mouseMargin, slideTime, openEvent){
 var isOpen = false;
 var trg = xGetElementById(triggerId);
 var mnu = xGetElementById(menuId);
 if (trg && mnu) {
  xHide(mnu);
  xAddEventListener(trg, openEvent, onOpen, false);
 }
 function onOpen()   {
  if (!isOpen) {
   xMoveTo(mnu, xPageX(trg), xPageY(trg));
   xShow(mnu);
   xSlideTo(mnu, xPageX(trg), xPageY(trg) + xHeight(trg), slideTime);
   xAddEventListener(document, 'mousemove', onMousemove, false);
   isOpen = true;
  }
 }
 function onMousemove(ev){
  var e = new xEvent(ev);
  if (!xHasPoint(mnu, e.pageX, e.pageY, -mouseMargin) && !xHasPoint(trg, e.pageX, e.pageY, -mouseMargin)){
   xRemoveEventListener(document, 'mousemove', onMousemove, false);
   xSlideTo(mnu, xPageX(trg), xPageY(trg), slideTime);
   setTimeout("xHide('" + menuId + "')", slideTime);
   isOpen = false;
  }
 }
} 

//write out the DHTML menu style in the head
document.write ('<style> '+
                '.trigger { ' +
                '  position:relative;' +
                '  cursor:pointer;' +
                '  z-index:2;' +
                '} ' +
                'a.trigger{' +
                '  color: #003399;' +
                '}' +
                '.menu {' +
                '  position:absolute;' +
                '  visibility:hidden;' +
                '  overflow:hidden;  ' +
                '  z-index:1;  ' +
                '  margin:0;  ' +
                '  margin-top:1px;  ' +
                '  padding:0;  ' +
                '  background:#E9E6D2;  ' +
                '  border-top: 1px solid #E9E6D2;  ' +
                '  border-left: 1px solid #3B639E;  ' +
                '  border-right:1px solid #3B639E;  ' +
                '  border-bottom: 1px solid #3B639E;' +
                '}' +
                '.menu p {  ' +
                '  font-family:verdana,tahoma,arial;  ' +
                '  font-weight:bold;  ' +
                '  font-size:11px;  ' +
                '  color:#3B639E;  ' +
                '  margin:0;  ' +
                '  padding:1px 3px 1px 2px;  ' +
                '  border-bottom: 1px solid #3B639E;  ' +
                '  width:175px;' +
                '}  ' +
                '.menu a {  ' +
                '  color:#3B639E;  ' +
                '  text-decoration:none;' +
                '}  ' +
                '</style>');

 