/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/
$bgslidshow = jQuery.noConflict();

function slideSwitch() {
    var $bgslidshowactive = $bgslidshow('#slideshow IMG.active');

    if ( $bgslidshowactive.length == 0 ) $bgslidshowactive = $bgslidshow('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $bgslidshownext =  $bgslidshowactive.next().length ? $bgslidshowactive.next()
        : $bgslidshow('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $bgslidshowsibs  = $bgslidshowactive.siblings();
    // var rndNum = Math.floor(Math.random() * $bgslidshowsibs.length );
    // var $bgslidshownext  = $bgslidshow( $bgslidshowsibs[ rndNum ] );


    $bgslidshowactive.addClass('last-active');

    $bgslidshownext.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $bgslidshowactive.removeClass('active last-active');
        });
}

$bgslidshow(function() {
    setInterval( "slideSwitch()", 5000 );
});

