/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license
***/

function slideSwitch() {
    var $active = $('#home_slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#home_slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#home_slideshow 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 slideSwitch2() {
    var $active = $('#home_slideshow2 IMG.active');

    if ( $active.length == 0 ) $active = $('#home_slideshow2 IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#home_slideshow2 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 slideSwitch3() {
    var $active = $('#home_slideshow3 IMG.active');

    if ( $active.length == 0 ) $active = $('#home_slideshow3 IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#home_slideshow3 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 slideSwitch4() {
    var $active = $('#home_slideshow4 IMG.active');

    if ( $active.length == 0 ) $active = $('#home_slideshow4 IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#home_slideshow4 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()", 3000 );
	setInterval( "slideSwitch2()", 3000 );
	setInterval( "slideSwitch3()", 3000 );
	setInterval( "slideSwitch4()", 3000 );
});
