      var foto;
      function BildAnz(URL)  {    
        foto = new Image();    
        foto.onload = BildAnz1;    
        foto.src = URL;
        }
        
      function BildAnz1()  {  
        var BB = foto.width; //Bildbreite    
        var BH = foto.height //Bildhöhe        
        //alert(BB+":"+BH);        //ab hier weiter wie gehabt mit newwin...  }

        var AH = screen.availHeight;		//Auflösung Höhe
        var AB = screen.availWidth;		  //Auflösung Breite
        var RA = 30;							      //Rand um Fenster
        var RF = 20;							      //Rand um Bild
        var Fakt = 30;                  //Faktor für Zusatzrand mit Textlink
            
        if (BB != 0 && BH != 0)
          {          
          if(BH > BB)
            {
        	  if((BH + RF + Fakt) < (AH - RA))
        	    {
        	    FB = BB + RF;
        	    FH = BH + RF + Fakt;
        	    BHn = BH;
        	    BBn = BB;
        	    }
            else
        	    {
        	    FH = AH - RA;
        	    BHn = FH - RF - Fakt;
        	    BBn = BB * (BHn/BH);
        	    FB = BBn + RF
        	    }
            }
            else
            {
        	  if((BH + RF + Fakt) < (AH - RA))
        	    {
        		   if((BB + RF) < (AB - RA))
        		    {
        		    BBn = BB;
        		    BHn = BH;
        		    FB = BB + RF;
        		    FH = BH + RF + Fakt;
        		    }
        		  else
        		    {
        		    FB = AB - RA;
        		    BBn = FB - RF;
        		    BHn = BH * (BBn / BB);
        		    FH = BHn + RF + Fakt;
        		  }
        	  }
        	  else
        	    {
        	    FH = AH - RA;
        	    BHn = FH - RF - Fakt;
        	    BBn = BB * (BHn /BH);
        	    FB = BBn + RF;
        	    }
		    } 
	NewWindow=window.open("", "", "top=0, left=0, height="+FH+", width="+FB+", toolbar=0, directories=0, menubar=0, status=0, resizable=1, scrollbars=0");
	NewWindow.document.write ("<html><head><title>Bildanzeige");
	NewWindow.document.write ("</title><style>A.Controls:link { color:#FF6600; text-decoration:none; font-family: Arial; font-size: 12pt; font-weight: bold; } A.Controls:visited { color:#FF6600; text-decoration:none; font-family: Arial; font-size:   12pt; font-weight: bold; } A.Controls:active { color:#FF6600; text-decoration:none; font-family: Arial; font-size: 12pt; font-weight: bold; } A.Controls:hover { color:#FF0066; text-decoration:none; font-family: Arial; font-size:   12pt; font-weight: bold; } </style></head>");
	NewWindow.document.write ("<body bgcolor='#CCFF99'>");
	NewWindow.document.write ("<table border='0' bgcolor='#CCFF99' cellpadding='0' cellspacing='1'>");

  NewWindow.document.write ("<tr><td align='center'><p style='margin-top: 0; margin-bottom: 4'><font face='Arial' color='#0F7500' size='2'><b>Das Bild kannst Du Dir hier &nbsp;</b></font><a class='Controls' href='javascript:window.print()'>| Ausdrucken |</a></td></tr>");

	NewWindow.document.write ("<tr><td align='center'><img src=");
	NewWindow.document.write (foto.src);
	NewWindow.document.write (" height="+BHn+" width="+BBn+" border='0'>");
	NewWindow.document.write ("</td></tr></table>");
	NewWindow.document.write ("</body></html>");
	NewWindow.document.close();
 }
}
