//These functions currently only work with slideshow image thumbnails.
IL.Slideshow.next = function (activeId) {
    activeImage = $(activeId);
    nextImage = activeImage.next('ol.thumbs li');    

    current = $('num').innerHTML;
    
    if (typeof(nextImage) == 'undefined' || !nextImage.visible()) {
      IL.Slideshow.showImage(IL.Slideshow.images[0], activeId); 
      $('num').innerHTML = '1';
    }
    else {
      IL.Slideshow.showImage(nextImage, activeId);      
      $('num').innerHTML = parseInt(current) + 1;
    }
};

IL.Slideshow.previous = function (activeId) {
    activeImage = $(activeId);
    prevImage = activeImage.previous('ol.thumbs li');
    
    current = $('num').innerHTML;
    
    if (typeof(prevImage) == 'undefined') {
      IL.Slideshow.showImage(IL.Slideshow.images[IL.Slideshow.images.length-1], activeId); 
      $('num').innerHTML = IL.Slideshow.images.length;
    }
    else {
      IL.Slideshow.showImage(prevImage, activeId);    
      $('num').innerHTML = parseInt(current) - 1;
    }
};
