// Crossfade Multi v1.0
// Author: Christian Magill
// An expansion on Jonathan Snook's Simplest Jquery Slideshow
// The following features have been added:
// 1. Sequenced Multiple Crossfading Sets
// 2. No restrictions on child type. Slides can contain other elements.
// 3. Only top image is faded revealing next image. (Saves Processing)

$(function(){
    var totalFrames = $('div[id*=cf]').children().not(':first-child').hide().end().end().size();
    var currentFrame = 1;
    var fadeSpeed = 1500; // in milliseconds
    var fadePause = 10000; // in milliseconds
    setInterval(
        function(){
            $('#cf' + currentFrame + ' :nth-child(2)').show()
            .prev().fadeOut(fadeSpeed).appendTo('#cf' + currentFrame);
            currentFrame = (currentFrame == totalFrames) ? 1 : currentFrame + 1;
        }
    ,fadePause);
}); 
