function slideRight(id)
{

  //select current active image
  var $active = $(id + ' img.active');

  //select last active image if none active
  if ( $active.length == 0 ) $active = $(id + ' img:last');

  //select first image if no image next
  var $next = $active.next().length ? $active.next() : $(id + ' img:first');
  
  $active.addClass('last-active');
  
  $next.css({opacity:0.0})
    //add class to new active image
    .addClass('active')
    .animate({opacity:1.0},1000,function(){
      //remove class from old active image
      $active.removeClass('active last-active');
    });
}

function slideLeft(id)
{

    //select current active image
  var $active = $(id + ' img.active');
  
  //select last active image if none active
  if ( $active.length == 0 ) $active = $(id + ' img:first');

  //select first image if no image next
  var $prev = $active.prev().length ? $active.prev() : $(id + ' img:last');
  
  $active.addClass('last-active');
  
  $prev.css({opacity:0.0})
    //add class to new active image
    .addClass('active')
    .animate({opacity:1.0},1000,function(){
      //remove class from old active image
      $active.removeClass('active last-active');
    });
}
