﻿// Purpose: functions to display top menu
// PRECONDITION:  position_elements is declared first

//  *****************************
//  CONFIGURE THESE:
//  *****************************
var _absTopNum = 262;     //fixed height (pixels)
var _fixedWidth = 170;    //width of dropdowns - so we can put proper mouse-out action
var _relLeft= -8;          //adjust Y position 
var _relLeftFirstLink = 2; //adjust Y position (for first link only)

//customize height for diff browsers if needed
if (!document.all ) {
  //_absTopNum = _absTopNum-7;
}
if (PositionElementsBrowserDetect.browser == "Opera") {
  //_absTopNum = _absTopNum-7;
}




//  ********************************************************
//  ********************************************************
//  DO NOT CHANGE BELOW (normally):
//  ********************************************************

var _websiteUrl="";
var _absTop = _absTopNum + "px"; //recast as string

function SetWebsiteUrl(webUrl) {
   _websiteUrl=webUrl;
}

function DisplayDropdown(objId, txt, isFirstItem) {
        var posRightGhost = _fixedWidth + 15;        
        
        if (document.getElementById("menuDrop")) {
        if (txt!= "") {
        var _bottom = "<div style='display:block;width:100%;position:relative;z-index:500;'>"
           + "<a href='#' onmouseover='HideDropdown();'>"
           + "<img border='0' src='"+_websiteUrl+"/images/clear.gif' width='100%' height='20px' onmouseover='HideDropdown();' />"
           + "</a>"
           + "</div>";
        var _left = "<div style='display:block;width:10px;height:400px;position:relative;z-index:550;'>"
           + "<a href='#' onmouseover='HideDropdown();'>"
           + "<img border='0' src='"+_websiteUrl+"/images/clear.gif' width='10px' height='100%' onmouseover='HideDropdown();' />"
           + "</a>"
           + "</div>";

        if (document.getElementById && document.getElementById("menuDrop")) {
           document.getElementById("menuDrop").innerHTML=txt+_bottom;
        if (isFirstItem) {
            SetRelativePosition("menuDrop", objId,0,_relLeftFirstLink);
        } else {
            SetRelativePosition("menuDrop", objId,0,_relLeft);
        }
        document.getElementById("menuDrop").style.top = _absTop;
        }
            if (document.getElementById && document.getElementById("menuDropLeft")) {
                document.getElementById("menuDropLeft").innerHTML=_left;
                document.getElementById("menuDropRight").innerHTML=_left;
                SetRelativePosition("menuDropLeft", objId,0,_relLeft - 15);
                SetRelativePosition("menuDropRight", objId,0,_relLeft + posRightGhost);
                document.getElementById("menuDropLeft").style.top = _absTop;
                document.getElementById("menuDropRight").style.top = _absTop;
            }
            } else {
                HideDropdown();
            }
        }
}

function HideDropdown() {
    if ( document.getElementById("menuDrop")) {
        document.getElementById("menuDrop").innerHTML = "";
        document.getElementById("menuDrop").style.left="-1000px";
    }
    if (document.getElementById("menuDropLeft")) {
        document.getElementById("menuDropLeft").innerHTML = "";
        document.getElementById("menuDropLeft").style.left="-1000px";
    }
    if (document.getElementById("menuDropRight")) {
        document.getElementById("menuDropRight").innerHTML = "";
        document.getElementById("menuDropRight").style.left="-1000px";
    }
}

