$(document).ready(function()
{
if($('#image_slider_content IMG').length>1) {

  setInterval(function() {
      var $active = $('#image_slider_content IMG.active');

      if ( $active.length == 0 ) $active = $('#image_slider_content IMG:last');

      // use this to pull the images in the order they appear in the markup
      var $next =  $active.next().length ? $active.next()
          : $('#image_slider_content IMG:first');

      $active.addClass('last-active');

	
	//alert("next: " + $next.prevAll().size() + " active: " + $active.prevAll().size());

      $next.css({opacity: 0.0})
          .addClass('active')
          .animate({opacity: 1.0}, 1500, function() {
              $active.removeClass('active last-active');
          });
  }, 6000);
}
});
