jQuery.fn.imageSwitcher = function(timeoutStart, timeoutEnd) {
  var elemId = $(this).attr('id');

  setInterval(
    function() {
      //Get the first image
      var current = ($('#' + elemId + ' ul li.show')?  $('#' + elemId + ' ul li.show') : $('#' + elemId + ' ul li:first'));

      //Get next image, when it reaches the end, rotate it back to the first image
      var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('#' + elemId + ' ul li:first') :current.next()) : $('#' + elemId + ' ul li:first'));

      //Set the fade in effect for the next image, the show class has higher z-index
      next.css({opacity: 0.0})
      .addClass('show')
      .animate({opacity: 1.0});

      //Hide the current image
      current.animate({opacity: 0.0})
      .removeClass('show');
    },
    (Number(timeoutStart) + Number((Math.random() * (timeoutEnd - timeoutStart)).toFixed(0)))
  );
};
