      var photo_list = new Array();
      var activePic = -1;

      function loadPic(url, adresar, w_sm, h_sm, w_big, h_big, kom, popis, druh)
      {
        var pic = new Object();
        pic.url   = url;
        pic.adrs = adresar;
        pic.w_sm  = w_sm;
        pic.h_sm  = h_sm;
        pic.w_big = w_big;
        pic.h_big = h_big;
        pic.kom   = kom;
        pic.popis = popis;
        pic.druh   = druh;
        
        photo_list[photo_list.length++] = pic;
      }

          
  function winH()
      {
        if (window.innerHeight)
          return window.innerHeight;
        else if (document.documentElement && document.documentElement.clientHeight)
          return document.documentElement.clientHeight;
        else if (document.body && document.body.clientHeight)
          return document.body.clientHeight;
        else
          return 0;
      }

      function winW()
      {
        if (window.innerWidth)
          return window.innerWidth;
        else if (document.documentElement && document.documentElement.clientWidth)
          return document.documentElement.clientWidth;
        else if (document.body && document.body.clientWidth)
          return document.body.clientWidth;
        else
          return 0;
      }

      function showPhotoBig(i)
      {
        var picW = 5;
        var picH = 5;
        if (winH() != 0) picH = (winH() / 2) - (photo_list[i].h_big / 2);
        if (winW() != 0) picW = (winW() / 2) - (photo_list[i].w_big / 2);
        if (winH() < photo_list[i].h_big) picH = 5;
        if (winW() < photo_list[i].w_big) picW = 5;
        picH += document.body.scrollTop;

        var sipky = i + 1 + "/" + photo_list.length;
        var a = "<a href='#' onclick='return closePhotoEx(";
        var s = "<span class='titulek'>";
        

        obj = document.getElementById('bigphoto');
        obj.innerHTML = "<span style='position: absolute; left: " + picW + "px; top: " + picH + "px; z-index:2000'>"+
                        "<table id='photo' width='10' cellspacing='0' cellpadding='0'>"+
                        "<tr><td style='font: 14px;' align='center'><b>"+photo_list[i].kom+"</b></td></tr><tr><td class='titulek'>"+
                        "<a href='#' onclick='return closePhoto();'><img src='"
                        +photo_list[i].adrs+photo_list[i].url+"' alt='zavøít' width='"+photo_list[i].w_big+"' height='"
                        +photo_list[i].h_big+"' border='0'></a></td></tr></table></span>";

        obj.style.display = '';

        activePic = i;
       }

      function showView(zobrazit)
      {
        var wPic, column;
        wPic = photo_list[0].w_sm;
        if (winW() != 0)
          column = Math.round(winW() / (wPic + 15 ));
        else
          column = 7;
        
        pocet=0;  
        c="<table border=0 cellspacing=0 cellpadding=0 width='90%'><tr align='center'>";
        for(i=0;i<photo_list.length;i++)
        {
          if (photo_list[i].druh==zobrazit)
          {
            pocet++;
            vysledek=pocet % 4;
            if (vysledek == 1) c+="</tr><tr>";
            c += "<td valign='top' align='center'><a href='#' onclick='showPhotoBig("+i+"); return false;'>"+
               "<img class='picref' src='"+photo_list[i].adrs+"sm_"+photo_list[i].url+"' alt='"+photo_list[i].kom+
               "' border='0' height='"+photo_list[i].h_sm+"' width='"+photo_list[i].w_sm+
               "'></a><br><p>"+photo_list[i].popis+"</p><br></td>";
          }
        }
        c +="</tr></table>";
        obj = document.getElementById(zobrazit);
        obj.innerHTML= c;
        obj.style.display = 'block';
      }

      function showMain(zobrazit)
      {
        var wPic, column;
        wPic = photo_list[0].w_sm;
        if (winW() != 0)
          column = Math.round(winW() / (wPic + 15 ));
        else
          column = 7;
        
        pocet=0;  
        c="<table border=0 cellspacing=0 cellpadding=0 width='90%'><tr align='center'>";
        for(i=0;i<photo_list.length;i++)
        {
          if (photo_list[i].druh==zobrazit)
          {
            pocet++;
            vysledek=pocet % 4;
            if (vysledek == 1) c+="</tr><tr>";
            c += "<td valign='top' align='right'><a href='#' onclick='showPhotoBig("+i+"); return false;'>"+
               "<img class='picref' src='"+photo_list[i].adrs+"sm_"+photo_list[i].url+"' alt='"+photo_list[i].kom+
               "' border='0' height='"+photo_list[i].h_sm+"' width='"+photo_list[i].w_sm+
               "'></a><br><p>"+photo_list[i].popis+"</p></td>";
          }
        }
        c +="</tr></table>";
        obj = document.getElementById(zobrazit);
        obj.innerHTML= c;
        obj.style.display = 'block';
      }


      function showNew(zobrazit)
      {
        var wPic, column;
        wPic = photo_list[0].w_sm;
        if (winW() != 0)
          column = Math.round(winW() / (wPic + 15 ));
        else
          column = 7;
        
        pocet=0;  
        c="<div align='center'><table border=0 cellspacing=0 cellpadding=0 width='90%'><tr align='center'>";
        for(i=0;i<photo_list.length;i++)
        {
          if (photo_list[i].druh==zobrazit)
          {
            pocet++;
            vysledek=pocet % 4;
            if (vysledek == 1) c+="</tr><tr>";
            c += "<td valign='top' align='center'><a href='#' onclick='showPhotoBig("+i+"); return false;'>"+
               "<img class='picref' src='"+photo_list[i].adrs+""+photo_list[i].url+"' alt='"+photo_list[i].kom+
               "' border='0' height='"+photo_list[i].h_sm+"' width='"+photo_list[i].w_sm+
               "'></a><p><Br>"+photo_list[i].popis+"</p><br></td>";
          }
        }
        c +="</tr></table></div>";
        obj = document.getElementById(zobrazit);
        obj.innerHTML= c;
        obj.style.display = 'block';
      }


      function closePhoto()
      {
        obj = document.getElementById('bigphoto');
        obj.style.display = 'none';
        activePic = -1;
        return false;
      }

      function closePhotoEx(i)
      {
        obj = document.getElementById('bigphoto');
        obj.style.display = 'none';
        showPhotoBig(i);
        return false;
      }

      function browse(event)
      {
        if (activePic != -1)
        {
          if ((event.keyCode == 37) & (activePic > 0))
          {
            closePhotoEx(activePic - 1);
          }

          if ((event.keyCode == 39) & (activePic < photo_list.length - 1))
          {
            closePhotoEx(activePic + 1);
          }
        }
      }


