function show_sub(id)
{
    // POSITION ERMITTELN UND SUBMENU ANZEIGEN
    var pos = getPos(document.getElementById("navlink"+id));
    var itm = document.getElementById("subnavi"+id);

    if(pos[0] && pos[1])
    {
        pos[0] -= 6; if(pos[0] < 0) { pos[0] = 0; }
        itm.style.left    = pos[0]+"px";
        itm.style.top     = (pos[1]+24)+"px";
        itm.style.display = "block";
    }
}

function hide_sub(id)
{
    document.getElementById("subnavi"+id).style.display = "none";
}

function getPos(el)
{
    var lx=0,ly=0;
    
    if(el)
    {
        while(el!=null)
        {
            lx+=el.offsetLeft;
            ly+=el.offsetTop;
            el=el.offsetParent;
        }
        
        return new Array(lx, ly);
    }
    return false;
}

function get_abs_xpos(obj)
{
    var xPos = 0;

    if(obj.offsetParent)
    {
        while(obj.offsetParent)
        {
            xPos += obj.offsetLeft
            obj   = obj.offsetParent;
        }
    }
    else if(obj.x)
    {
        xPos += obj.x;
    }
    
    return xPos;
}

function get_abs_ypos(obj)
{
    var yPos = 0;
    
    if(obj.offsetParent)
    {
        while(obj.offsetParent)
        {
            yPos += obj.offsetTop;
            obj   = obj.offsetParent;
        }
    }
    else if(obj.y)
    {
        yPos += obj.y;
    }
    
    return yPos;
} 

function show_image_info_icon(iid, xoff, yoff)
{
    var pos  = getPos(document.getElementById("img"+iid));
    var elem = document.getElementById("imginfo"+iid);

    elem.style.left = (pos[0] + xoff)+"px";
    elem.style.top  = (pos[1] + yoff)+"px";
    elem.style.display = "";
    elem.style.zIndex = "11";
}

function new_frame(location, width, height)
{
    sWidth = screen.width;
    sHeight = screen.height;

    xPos = (sWidth  - width)  / 2;
    yPos = (sHeight - height) / 2;
    yPos = 50;

    prob  = "left="+xPos+",";
    prob += "top="+yPos+",";
    prob += "screenX="+xPos+",";
    prob += "screenY="+yPos+",";
    prob += "width="+width+",";
    prob += "height="+height+",";
    prob += "menubar=0,";
    prob += "toolbar=0,";
    prob += "statusbar=0,";
    prob += "scrollbars=1,";
    prob += "resizable=1,";
    prob += "locationbar=0,";
    prob += "directories=0";

    win = window.open(location, "FRAME", prob);
    win.focus();
    
    return false;
}

function new_imgwin(location, width, height)
{
    sWidth = screen.width;   xPos = (sWidth  - width)  / 2;
    sHeight = screen.height; yPos = (sHeight - height) / 2; yPos -= 150; if(yPos < 30) { yPos = 30; }

    prob  = "left="+xPos+",";
    prob += "top="+yPos+",";
    prob += "screenX="+xPos+",";
    prob += "screenY="+yPos+",";
    prob += "width="+width+",";
    prob += "height="+height+",";
    prob += "menubar=0,";
    prob += "toolbar=0,";
    prob += "statusbar=0,";
    prob += "scrollbars=1,";
    prob += "resizable=1,";
    prob += "locationbar=0,";
    prob += "directories=0";

    win = window.open(location, "IMGVIEW", prob);
    win.focus();
    
    return false;
}

function bookmark(url, title)
{
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
    {
        window.external.AddFavorite(url, title);
    }
    else if (navigator.appName == "Netscape")
    {
        alert('Bitte drücken Sie zum Speichern der Seite die Tastenkombination STRG+D auf Ihrer Tastatur.');
    }
    else
    {
        alert('Bitte drücken Sie zum Speichern der Seite die Tastenkombination STRG+T auf Ihrer Tastatur.');
    }
}

function lowLight(item)
{
    if(item.className == 'hvr') { item.className = 'nrml'; }
}

function highLight(item)
{   
    if(item.className == 'nrml') { item.className = 'hvr'; }
}

function mkFocus(item)
{
    item.className = 'fcs';
}

function mkBlur(item)
{
    item.className = 'nrml';
}
