function openWindow(href,width,height)
{
    popup = window.open(href, "popupa", "width="+width+",height="+height+",left=500,top=200,scrollbars=yes,resizable=yes");
    popup.focus();
}

if (document.getElementById)
{
    document.write('<div id="mouseoverimage" style="position:absolute;z-index:5;left:-500px;"></div>');
}

function displaylayer(imagename, width, height)
{
    layerContent = '<div style="padding: 5px; background-color: #FFFFFF; border: 1px solid #888888; width: ' + width + '; height: ' + height + ';"><img src="' + imagename + '" border="0"></div>';
    
    document.getElementById("mouseoverimage").innerHTML = layerContent;
    document.getElementById("mouseoverimage").display = "inline";
}

function hidelayer()
{
    if(typeof(aktiv) == "number")
        clearTimeout(aktiv);
    document.getElementById("mouseoverimage").innerHTML = " ";
    document.getElementById("mouseoverimage").display = "none";
}
                    
function glueToMouse(el)
{
    var x = 15;
    var y = 15;
                    
    var width = document.all ? document.documentElement.scrollLeft+document.documentElement.clientWidth : pageXOffset + window.innerWidth - 15;
    var height = document.all ? Math.min(document.documentElement.scrollHeight, document.documentElement.clientHeight) : Math.min(window.innerHeight);
          
    if (typeof el != "undefined")
    {
        if (width - el.pageX < (imgwidth + 11 + x))
            x = el.pageX - (imgwidth) - 11 - x;
        else 
            x += el.pageX;
        
        yscrollamount = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
        y = el.pageY;
        
        if(height + yscrollamount - el.pageY  < (imgheight + 13))
            y = height - (imgheight + 13) + yscrollamount;
    } else if(typeof window.event != "undefined")
    {
        if (width - event.clientX < (imgwidth + 11 + x))
            x = event.clientX + document.documentElement.scrollLeft - (imgwidth) - 11 - x;
        else 
            x += document.documentElement.scrollLeft + event.clientX;
                        
        yscrollamount = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
        y = event.clientY + yscrollamount;
                
        if (height - event.clientY < (imgheight + 11))
            y = height + yscrollamount  - (imgheight + 11);   
    }

    var width = document.all ? document.documentElement.scrollLeft+document.documentElement.clientWidth : pageXOffset+window.innerWidth - 15
    var height = document.all ? Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
    
    document.getElementById("mouseoverimage").style.left = x + "px";
    document.getElementById("mouseoverimage").style.top = y + "px";
}

