// Nutzung:
// <a href="#" onClick="jkpopimage('images/Jackenschrank_172_230.jpg', 200, 300, 'Jackenschrank'); return false"><img width="86" height="115" src="images/Jackenschrank_86_115.jpg" alt="Jackenschrank" border="1" vspace="15"></a>

var popbackground="white"; //specify backcolor or background image for pop window
var windowtitle="Gro&szlig;ansicht";  //pop window title

function detectexist(obj){
        return (typeof obj !="undefined");
}

function jkpopimage(imgpath, popwidth, popheight, textdescription) {
        function getpos(){
                leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0;
                // variable Position führt dazu, dass das Bild zu tief erscheint
                // toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0;
                toppos=(detectexist(window.screenTop))? 200 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0;
                if (window.opera){
                        leftpos-=screenLeft;
                        toppos-=screenTop+15;
                }
        }

        getpos();
        var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos;
        var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"';
        if (typeof jkpopwin=="undefined" || jkpopwin.closed) {
                jkpopwin=window.open("","",winattributes);
        } else {
                jkpopwin.resizeTo(popwidth+10, popheight+30);
        }
        jkpopwin.document.open();
        jkpopwin.document.write('<html><title>'+windowtitle+'</title><LINK href="style.css"  type=text/css rel=stylesheet><body'+bodyattribute+'><img src="'+imgpath+'" style="margin-bottom:0.5em; margin-top:0.75em"><br><center><b>'+textdescription+'</b><br><a class="txt" href="javascript:self.close();">Fenster schlie&szlig;en</a></center></body></html>');
        jkpopwin.document.close();
        jkpopwin.focus();
}