function changeToRight(){
  if(currentFoto + 1 < pic.length){
    currentFoto++;
    swapImage(currentFoto);
  }
}

function changeToLeft(){
  if(currentFoto > 1){
    currentFoto--;
    swapImage(currentFoto);
  }
}

function changeToFirst(){
  currentFoto = 1;
  swapImage(currentFoto);
}

function changeToLast(){
  currentFoto = pic.length - 1;
  swapImage(currentFoto);
}

function swapImage(index, showText){
   img = document.getElementById('picdiv');
   img.src = pic[index];


   txtDiv = document.getElementById('descriptiondiv');
   txt = descs[index];
   if(txt.length == 0){
      txt = '&nbsp;';
   }
   txtDiv.innerHTML = txt;

   txtDiv = document.getElementById('positiondiv');
   txt = nazevFoto + " <b>" + index + "</b> " + zFoto + ' ' + (pic.length - 1);
   txtDiv.innerHTML = txt;

}

function changeHref(){
  var leftA = document.getElementById('leftKlik');
  var rightA = document.getElementById('rightKlik');
  var firstA = document.getElementById('firstKlik');
  var lastA  = document.getElementById('lastKlik');
  leftA.href = 'javascript:changeToLeft()';
  rightA.href = 'javascript:changeToRight()';
  firstA.href = 'javascript:changeToFirst()';
  lastA.href = 'javascript:changeToLast()';
}
