function slideSwitch(i)
{
    var $active = $("#slides_" + i + " IMG.active");

    if ( $active.length == 0 ) $active = $("#slides_" + i + " IMG:last");

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

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

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

$(function()
{
    setInterval( "slideSwitch(1)", 4000 );
    setInterval( "slideSwitch(3)", 4000 );
    setInterval( "slideSwitch(6)", 4000 );
    setInterval( "slideSwitch(8)", 4000 );
    
    setInterval( "slideSwitch(2)", 7000 );
    setInterval( "slideSwitch(4)", 7000 );
    setInterval( "slideSwitch(5)", 7000 );
    setInterval( "slideSwitch(7)", 7000 );
});
