/*
 * File           : $Header: //depot/projects/hallingdolen/hallingdolen-publication/src/main/webapp/template/version/javascript/slideshow.js#1 $
 * Last edited by : $Author: shaon $ $Date: 2008/03/12 $
 * Version        : $Revision: #1 $
 *
 * Copyright (C) 2007 Escenic AS.
 * All Rights Reserved.  No use, copying or distribution of this
 * work may be made except in accordance with a valid license
 * agreement from Escenic AS.  This notice must be included on
 * all copies, modifications and derivatives of this work.
 */

var current = 1;

function nextPicture(slideDivIdPrefix, slideCountDivId, totalNumberOfImages) {
   var first = 1;
   var last = totalNumberOfImages;

   // Hide current picture
   var slideDiv = document.getElementById(slideDivIdPrefix + current);
   slideDiv.style.display = 'none';

   // Show next picture, if last, loop back to front
   if (current == last) {
     current = 1;
   }
   else {
     current++
   }

  slideDiv = document.getElementById(slideDivIdPrefix + current);
  slideDiv.style.display = 'block';

  var slideCountDiv = document.getElementById(slideCountDivId);
  slideCountDiv.innerHTML = 'Bilde '+ current +' av '+totalNumberOfImages;
}

function previousPicture(slideDivIdPrefix, slideCountDivId, totalNumberOfImages) {
   var first = 1;
   var last = totalNumberOfImages;

   // Hide current picture
   var slideDiv = document.getElementById(slideDivIdPrefix + current);
   slideDiv.style.display = 'none';

   if (current == first) {
     current = last;
   }
   else {
     current--;
   }

  slideDiv = document.getElementById(slideDivIdPrefix + current);
  slideDiv.style.display = 'block';

  var slideCountDiv = document.getElementById(slideCountDivId);
  slideCountDiv.innerHTML = 'Bilde '+ current +' av '+totalNumberOfImages;
}


