function swapImages(){
  var $active = $('#slave_img_rotate .active');
  var $next = ($('#slave_img_rotate .active').next().length > 0) ? $('#slave_img_rotate .active').next() : $('#slave_img_rotate img:first');
  $active.fadeOut(function(){
    $active.removeClass('active');
    $next.fadeIn().addClass('active');
  });
}

$(document).ready(function(){
      // Run our swapImages() function every 5secs
      setInterval('swapImages()', 5000);
});
