/*
Ein Script von Julian Hibbeln.
http://www.fun-fox.de/bilder-fokus.php
Version 1.1
*/
window.onload=function()
{
        var links=document.getElementsByTagName("a");
        for(var i=0; i<links.length; i++)
        {
                if(links[i].getAttribute("rel") && links[i].getAttribute("rel")=="thumbnail")
                {
                        links[i].onclick=function()
                        {
                                imagePreloaded('"' + this.getAttribute("href") + '"');
                                return false;
                        }
                }
        }

}

function imagePreloaded(url)
{
        document.getElementById("show").innerHTML = "<img id=\"picture\" src="+url+" onclick=\"remove()\" onload=\"setPosition();\" alt=\"&nbsp;&nbsp;lade...&nbsp;&nbsp;\" /> ";
        setPosition();
}

function setPosition()
{
        var picture = document.getElementById("picture");

        var widthPicture = picture.offsetWidth;
        var heightPicture = picture.offsetHeight;

        var widthScreen = document.documentElement.clientWidth;
        var heightScreen = document.documentElement.clientHeight;

        if (window.innerWidth)
                var heightWindow = window.pageYOffset;
        else
                var heightWindow = document.documentElement.scrollTop;

        picture.style.position = "absolute";
        picture.style.top = Math.round(heightWindow + (heightScreen - heightPicture)/200) + "px";
        picture.style.left = Math.round((widthScreen - widthPicture)/200) + "px";

}

function remove()
{
        document.getElementById("show").innerHTML = "";
}