function getPos(el)
{
    var lx=0, ly=0;
    
    if(el)
    {
        while(el!=null)
        {
            lx+=el.offsetLeft;
            ly+=el.offsetTop; // alert("EL:"+el.tagName+" - OFF:"+el.offsetTop);
            el=el.offsetParent;
        }
        
        return new Array(lx, ly);
    }
    return false;
}

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, winname)
{
    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, winname, 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';
}

function setFooter()
{
    var elmH = 50;
    var winH = getWinHeight();
    var docH = document.getElementById('container').scrollHeight-get_foff();

    if(winH > docH)
    {
        document.getElementById('cmsfooter').style.top = (docH - elmH);
    }
    else
    {
        document.getElementById('cmsfooter').style.top = (winH - elmH);
    }
}

function get_foff()
{
    if(navigator.userAgent.toLowerCase().indexOf("msie") == -1) { return(10); } else { return(0); }
}

function getScrollY()
{
    scrOfY = 0;
    
    if( typeof( window.pageYOffset ) == 'number' )
    {
        scrOfY = window.pageYOffset;
    }
    else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
    {
        scrOfY = document.body.scrollTop;
    }
    else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
    {
        scrOfY = document.documentElement.scrollTop;
    }
    
    return(scrOfY);
}

function getWinHeight()
{
         if(typeof window.innerWidth                    == 'number') { return(window.innerHeight);                    }
    else if(typeof document.body.clientWidth            == 'number') { return(document.body.clientHeight);            }
    else if(typeof document.documentElement.clientWidth == 'number') { return(document.documentElement.clientHeight); }
    
    return(-1);
}

