

//window.onload = positionMenus;
//window.onresize = positionMenus;
//MENU_STATUS = "off"; // or 'on'  //original menu status when page loads


var iDelay = 600 // Delay to hide in milliseconds
var iNSWidth=100 // Default width for netscape
var sDisplayTimer = null, oLastItem

function getRealPos(i,which) {
  iPos = 0
  while (i!=null) {
    iPos += i["offset" + which]
    i = i.offsetParent
  }
  return iPos
}

function getWidth(i) {
  
  //get the width of the parent <TD>
  //while(i.tagName!="TD"  )
	
	while(i.id!="services" && i.id!="order" && i.id!="support")
	i=i.parentElement;
	
 // alert(i.id);
  return i.clientWidth
}

function showMenu(sDest,itop,ileft,iWidth,iright) {
  if (document.all!=null) {
    var i = window.event.srcElement
	stopTimer()
    dest = document.all[sDest]
    if ((oLastItem!=null) && (oLastItem!=dest))
      hideItem()
    if (dest) {      
	  // Netscape 
      if (i.offsetWidth==0) 
        if (iWidth)
          i.offsetWidth=iWidth
        else
          i.offsetWidth=iNSWidth;

	valStr = "L:" + getRealPos(i,"Left") + " W:" + getWidth(i) + " Offset:" + i.offsetWidth;
	//alert(valStr);
	
	if (ileft) 
	    dest.style.pixelLeft = ileft
    else  		 
	 dest.style.pixelLeft = getRealPos(i,"Left") - getWidth(i) + 5 //+ i.offsetWidth //+ 5  //ab fix - positions layer to LEFT of element + -20
    
	//dest.style.pixelLeft = getRealPos(i,"Left")   //- getRealPos(i,"Left") -0 //+ i.offsetWidth + 5  //ab fix - positions layer to LEFT of element + -20
	
	if (itop)
        dest.style.pixelTop = itop
      else
        dest.style.pixelTop = getRealPos(i,"Top") + 18 //ab positioned BOTTOM as opposed to TOP(for a sub-menu on the side)
      dest.style.visibility = "visible"
    }
  oLastItem = dest
  }
}


function startTimer(el) {
  if (!el.contains(event.toElement)) {
    stopTimer()
    sDisplayTimer = setTimeout("hideItem()",iDelay)
  }
}

function stopTimer() {
  clearTimeout(sDisplayTimer)
}

function hideItem() {
  if (oLastItem)
    oLastItem.style.visibility="hidden"
}

function checkOver() {
  if ((oLastItem) && (oLastItem.contains(event.srcElement)))
    stopTimer()
}

function checkOut() {
  if (oLastItem==event.srcElement)
    startTimer(event.srcElement)
}

document.onmouseover = checkOver
document.onmouseout = checkOut

// output style in the page so that netscape browser does not display the menus at the top of the page (in error)

if (document.all) 
 {
 	document.write('<style>');
 	document.write('.popupMenu {position: absolute; visibility: hidden; background:#005186; filter: Alpha(Opacity=92, FinishOpacity=92, Style=1 StartX=0, StartY=0, FinishX=200,FinishY=200);}')
 	document.write('</style>');
 }
else 
{
	document.write('<style>');
	document.write('.popupMenu {position: absolute; visibility: hidden; background:#005186;}');
	document.write('</style>');
}