    var currentPhoto = null;
    
    Event.observe(window, 'load', function(){
      $$('#foto-album li').each(function(element){
        element.hide();
        emChild = element.immediateDescendants().last();
        if($$('#foto-album li').size() > 1)
        {
          emChild.update('<a href="#" class="prev-photo"><img src="../img/arrow_left.gif" alt="" /></a>&nbsp;<a href="#" class="next-photo"><img src="../img/arrow_right.gif" alt="" /></a>');
        }
      });
    
      currentPhoto = $('foto-album').immediateDescendants().first();
      currentPhoto.show();
    
      $$('#foto-album a.next-photo').each(function(element){
        element.observe('click', function(){
          currentPhoto.hide();
          if(currentPhoto.next() != undefined){
            currentPhoto = currentPhoto.next();
          } else {
            currentPhoto = currentPhoto.parentNode.immediateDescendants().first();
          }
          currentPhoto.show();
        });
      });
      
      $$('#foto-album a.prev-photo').each(function(element){
        element.observe('click', function(){
          currentPhoto.hide();
          if(currentPhoto.previous() != undefined){
            currentPhoto = currentPhoto.previous();
          } else {
            currentPhoto = currentPhoto.parentNode.immediateDescendants().last();
          }
          currentPhoto.show();
        });
      }); 
    });
