﻿function slideSwitch1(sectionId, effectMilliseconds) {
   var _sectionId = sectionId;
   sectionId = "#section-" + _sectionId + " ";

   var $active = $(sectionId + ".slideshow1 img.active");

   // Ricerca il successivo
   var _class = $active.attr("class");
   _class = _class.substr(0, _class.indexOf(" "));
   var pos = _class.substr(4);
   pos = parseInt(pos) + 1;
   var $next = $(sectionId + ".slideshow1 .pos-" + pos);

   if ($next.length == 0)
      $next = $(sectionId + ".slideshow1 img:first");

   $active.addClass("last-active").animate({ opacity: 0 }, effectMilliseconds);

   $next.css({ opacity: 0 })
            .addClass("active")
            .animate({ opacity: 1 }, effectMilliseconds, function() {
               $active.removeClass("active last-active");
            }
         );


}
