function oeffnen(datei, dir)
{
        picname = "includes/bild.inc.asp?datei=../katalog/" + dir + "/JPGs/" + datei + ".JPG";
        res = window.screen.width;
        pic = new Image();
        pic.src = picname;
        maxwidth = pic.width;
        maxheight = pic.height;
        if(res>=1152)
        {
                maxwidth = 1000;
                maxheight = 700;
                window.open(picname,"fname","toolbar=no,menubar=no,height=550, width=550");
        }
        else if(res>=1024)
        {
                maxwidth = 800;
                maxheight = 580;
                window.open(picname,"fname","toolbar=no,menubar=no,height=550, width=550");
        }
        else if(res>=800)
        {
                maxwidth = 720;
                maxheight = 410;
                window.open(picname,"fname","toolbar=no,menubar=no,height=410, width=550");
        }
        else
        {
                maxwidth = 580;
                maxheight = 285;
                window.open(picname,"fname","toolbar=no,menubar=no,height=285, width=550");
        }
}

function prev_oeffnen(datei, dir)
{
        picname = "includes/bild.inc.asp?datei=../katalog/" + dir + "/Vorschau/" + datei;
        res = window.screen.width;
        pic = new Image();
        pic.src = picname;
        maxwidth = pic.width;
        maxheight = pic.height;
        if(res>=1152)
        {
                maxwidth = 1000;
                maxheight = 700;
                window.open(picname,"fname","toolbar=no,menubar=no,height=550, width=550");
        }
        else if(res>=1024)
        {
                maxwidth = 800;
                maxheight = 580;
                window.open(picname,"fname","toolbar=no,menubar=no,height=550, width=550");
        }
        else if(res>=800)
        {
                maxwidth = 720;
                maxheight = 410;
                window.open(picname,"fname","toolbar=no,menubar=no,height=410, width=550");
        }
        else
        {
                maxwidth = 580;
                maxheight = 285;
                window.open(picname,"fname","toolbar=no,menubar=no,height=285, width=550");
        }
}

function OpenPic (bildname, bildtext)
{
    //bildtext=bildtext.replace(" ", "_");	
    //alert(bildtext);

    bild = new Image();
    bild.src = bildname;

    hoehe = bild.height + 60 -30;
    breite = bild.width + 25 -15;

    if(hoehe+60 > screen.height)
        hoehe = screen.height - 30;

    if(breite+15 > screen.width)
        breite = screen.width - 15;

    openstring = "width=" + (breite) + ", height=" + (hoehe) + ", status=no, menubar=no, locationbar=no, resizable=no, dependent=yes, hotkeys=no, scrollbars=no"
    F1 = window.open("leer.htm", "BildFenster", openstring);
    F1.focus();
    F1.resizeTo(breite, hoehe);

    F1.document.writeln("<html>");
    F1.document.writeln("<head>");
    F1.document.writeln("<title>Aktuelles Bild: '" + bildtext + "'</title>");

    F1.document.writeln("<script language=JavaScript>");
    F1.document.writeln("function machZu() {");
    F1.document.writeln("self.close();");
    F1.document.writeln("}</script>");

    F1.document.writeln("</head>");
    F1.document.writeln("<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>");

    F1.document.writeln('<a href="javascript:machZu()">');
    F1.document.writeln("<img src="+ bildname + " alt='" + bildtext + "' border=0>");
    F1.document.writeln("</a>");
    F1.document.writeln("</body>");
    F1.document.writeln("</html>");
    return;
}