//hide and view
function getElemById(doc, id)
{
    try
    {
        if (typeof doc.all != "undefined")
            return doc.all(id);
        else
            return doc.getElementById(id);
    }
    catch(e)
    {
    }
    return null;
}

function d2hie()
{
    if (isOpera() || isNN() || isMozilla())
        return false;
    else
        return isIE();
}

function d2hpopup(evt, url)
{
    evt = (evt) ? evt : ((window.event) ? event : null);
    if (_d2hInlinePopup != null)
    {
        var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
        if (elem == null || !d2hElementInContainer(elem, _d2hInlinePopup))
        {
            d2hHideInline(_d2hInlinePopup);
            _d2hInlinePopup = null;
        }
    }

    d2hClosePopupMenu(evt);
    // use dhtml if we can
    dhtml_popup(evt, url);
    return false;
}

function d2hHideInline(elem)
{
    if (elem != null)
    {
        elem.style.position = "absolute";
        elem.style.visibility = "hidden";
        if (typeof elem.style.display != "undefined")
            elem.style.display = "none";
    }
}

function d2hShowInline(elem)
{
    if (elem != null)
    {
        elem.style.position = "";
        elem.style.visibility = "visible";
        if (typeof elem.style.display != "undefined")
            elem.style.display = "";
    }
}

function d2hInitInlineDropdown(elemId)
{
    var elem = getElemById(document, elemId);
    d2hHideInline(elem);
}

function d2hInitInlineExpand(elemId)
{
    var elem = getElemById(document, elemId);
    d2hHideInline(elem);
}

function d2hInitInlinePopup(elemId)
{
    var elem = getElemById(document, elemId);
    if (elem != null)
    {
        d2hHideInline(elem);
        elem.style.backgroundColor = POPUP_COLOR;
        elem.style.backgroundImage = "url('" + d2hGetRelativePath(document, POPUP_IMAGE) + "')";
        elem.style.backgroundRepeat = POPUP_REPEAT;
        elem.style.border = "1px solid #cccccc";
    }
}

function d2hInlineExpand(evt, elemId)
{
    var elem = getElemById(document, elemId);
    if (elem != null)
    {
        if (elem.style.visibility == "hidden")
            d2hShowInline(elem);
        else
            d2hHideInline(elem);
    }
    return false;
}

function d2hInlineDropdown(evt, elemId)
{
    var elem = getElemById(document, elemId);
    if (elem != null)
    {
        if (elem.style.visibility == "hidden")
            d2hShowInline(elem);
        else
            d2hHideInline(elem);
    }
    return false;
}

