function popup(b,gr_title)
{

for (var i=0; i<document.images.length; i++)
    if (document.images[i]==b) {break;}
a=document.images[i].src;
pic=new Image();
pic.src=a;
h=pic.height;
w=pic.width;

    t=(screen.height-h)/2;
    l=(screen.width-w)/2;

if (pic.width <= 0 || pic.height <= 0){
  setTimeout("popup_for_image('" + a + "');", 500);
//setTimeout("popup("+b+","+gr_title+");", 500);
}
else
{
var fenster2 = window.open('','','width='+w+',height='+h+',top='+t+',left='  +l+',location=no, statusbar=no, directories=no, resizable=no, menubar=no, toolbar=no, scrollbars=no');fenster2.focus();
if (gr_title="") gr_title="Bild";
fenster2.document.open();
fenster2.document.write("<html><head><title>"+gr_title+"</title></head><body leftmargin=0 topmargin=0 margindwidth=0 marginheight=0>");
fenster2.document.write("<img src="+a+">");
fenster2.document.write("</body></html>");
fenster2.document.close();
fenster2.focus();
}
}


function popup_for_image(a,gr_title)
{
pic=new Image();
pic.src=a;
h=pic.height;
w=pic.width;

    t=(screen.height-h)/2;
    l=(screen.width-w)/2;

if (pic.width <= 0 || pic.height <= 0){
  setTimeout("popup_for_image('" + a + "');", 500);
}
else
{
var fenster2 = window.open('','','width='+w+',height='+h+',top='+t+',left='  +l+',location=no, statusbar=no, directories=no, resizable=no, menubar=no, toolbar=no, scrollbars=no');fenster2.focus();
if (gr_title="") gr_title="Bild";
fenster2.document.open();
fenster2.document.write("<html><head><title>"+gr_title+"</title></head><body leftmargin=0 topmargin=0 margindwidth=0 marginheight=0>");
fenster2.document.write("<img src="+a+">");
fenster2.document.write("</body></html>");
fenster2.document.close();
fenster2.focus();
}
}