function loadPic(url, w_sm, h_sm, w_big, h_big, kom)
      {
        var pic = new Object();
        pic.url   = url;
        pic.w_sm  = w_sm;
        pic.h_sm  = h_sm;
        pic.w_big = w_big;
        pic.h_big = h_big;
        pic.kom   = kom;
        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) -(65/2);/*Odečet hlavičky-65*/
        if (winW() != 0) picW = (winW() / 2) - (photo_list[i].w_big / 2) -(200/2);/*Odečet levého menu -200*/
        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'>";
        if (i == 0) sipky = sipky + a +(i+1)+");'>"+s+" >></span></a>";
        if ((i > 0) & (i < photo_list.length - 1)) sipky = a +(i-1)+");'>"+s+"<< </span></a>" + sipky + a +(i+1)+");'>"+s+" >></span></a>";
        if (i == photo_list.length - 1) sipky = a +(i-1)+");'>"+s+"<< </span></a>" + sipky;

        obj = document.getElementById('bigphoto');
        obj.innerHTML = "<span style='position: absolute; left: " + picW + "px; top: " + picH + "px'>"+
                        "<table width='10' class='big' cellspacing='0' cellpadding='0'>"+
                        "<tr><td class='titulek'>"+sipky+"</td></tr><tr><td class='titulek'>"+photo_list[i].kom+"</td></tr><tr><td class='titulek'>"+
                        "<a href='#' onclick='return closePhoto();'><img src='foto/"
                        +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 = 'block';

        activePic = i;
       }

      function showView(col, table)
      {
        var wPic, column;
        if (photo_list[0].w_sm > photo_list[0].h_sm)
          wPic = photo_list[0].w_sm;
        else
          wPic = photo_list[0].h_sm;
        /*if (winW() != 0)
          column = Math.round((winW()) / (wPic + 15 ));
        else*/
          column = col;
        c = table + "<tr>";
        for(i=0;i<photo_list.length;i++)
        {
          if(i % column == 0) c += "</tr><tr>";
          c += "<td align='center'><a href='#' onclick='showPhotoBig("+i+"); return false;'>"+
               "<img src='foto/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>"+
			   "<DIV id=KomPic>"+photo_list[i].kom+"</DIV></td>";
        }
        c += "</tr></table>";
        obj = document.getElementById('view');
        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);
          }
        }
      }
