function set_gallery_picture(img, index) {
  var imgDiv = document.getElementById('galleryImg');
  imgDiv.src = img.src;
  imgDiv.title = img.title;
  
  var photoWindow = document.getElementById('photoWindow');
  var photoOuter = document.getElementById('photoOuter');
  photoWindow.style.display="block";
  photoOuter.style.visibility="visible";
  photoOuter.style.top=window.pageYOffset+"px";
}

function gallery_prev() {
  var imgDiv = document.getElementById('galleryImg');
  var index = imgDiv.title;
  var intIndex = parseInt(index);
  if(intIndex > 0) {
    var img = document.getElementById('prwImg'+(intIndex-1));
  }
  imgDiv.src = img.src;
  imgDiv.title = img.title;
}

function gallery_next() {
  var imgDiv = document.getElementById('galleryImg');
  var index = imgDiv.title;
  var intIndex = parseInt(index);
  var img = document.getElementById('prwImg'+(intIndex+1));
  if(img != null) {
    imgDiv.src = img.src;
    imgDiv.title = img.title; 
  }
}

function gallery_close() {
  var photoWindow = document.getElementById('photoWindow');
  var photoOuter = document.getElementById('photoOuter');
  photoOuter.style.visibility="hidden";
  photoWindow.style.display="none";
}
