jQuery(document).ready( function($) {
  var rotate_images = function( $element ) {
    $next = $element.next();
    if ( $next.length < 1 ) {
      $next = $element.siblings(':first-child');
    }
    $element.fadeOut(1500);
    $next.fadeIn(1500, function() {
      setTimeout( function(){
        rotate_images($next);
      }, 5000 );
    });
  }
  if ( $('ul.rotating-images li').length > 1 ) {
    $('ul.rotating-images li:first-child').show();
    setTimeout( function(){
      rotate_images($('ul.rotating-images li:first-child'));
    }, 5000 );
  }
});