                            for(n=0; n<=ilosc; n++) {
                                        var margin = 4;
                                        var position = 0;
                                        if(n>0) for(m=0; m<n; m++) {
                                                position += margin+photosy[m][1];
                                        }
                                        document.write("<div id=\""+photosy[n][0]+"\"");
                                        document.write(" style=\"width:"+photosy[n][1]+"px; height:"+h+"px; position:absolute; left:"+position+"px; top:44px;");
                                        document.write(" background-image:url(gfx/"+photosy[n][0]+".jpg);");
                                        if(n>0&&n<ilosc)document.write(" cursor:pointer; ");
                                        document.write("\">");
                                        if(n>0&&n<ilosc){
                                            document.write("<div class=\"opisRysunkuPole\" style=\"width:"+(photosy[n][1]-20)+"px; \">");
                                            if(typeof(opis)!='undefined'){ document.write("<span class=\"opisRysunkuTxt\">"+opis[n]+"</span>"); }
                                            document.write("<\/div>");
                                         }
                                        document.write("<div id=\""+photosy[n][0]+"_button\"");
                                        document.write(" style=\"position:absolute; left:0px; top:0px; width:100%; height:100%;\"");
                                        if(n>0&&n<ilosc)document.write("onclick=\"wyborFotki("+n+"); \"");
                                        document.write(">");
                                        document.write("<\/div>");
                                        document.write("<\/div>");
                                }
                                var current_gallery_element='1';
                                galeria_center(photosy[current_gallery_element][0],"index"+current_gallery_element);

              var index=1;
              var przes=1;
              var mojSlideShow = galeriaSlideShow();
              var odczekaj;

              function galeriaSlideShow(){
                    return setInterval("if(ilosc>1){ if( (index==1)&&(przes==-1)){ przes=1;} index+=(przes); } if(index==ilosc){index--;} changeImg(index); if((index+1==ilosc)||(index==1)) { przes=-(przes); }", 1500);
              }

              function wyborFotki(aktualny){
                  index=aktualny;
                  current_gallery_element=aktualny;
                  clearInterval(mojSlideShow);
                  clearTimeout(odczekaj);
                  galeria_center(photosy[aktualny][0],"index"+aktualny);

                  odczekaj=window.setTimeout("mojSlideShow=galeriaSlideShow()", 5000);
              }

            function changeImg(n){
                galeria_center(photosy[n][0],"index"+n);
                current_gallery_element=n;
            }
