/*** 
    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 :)
***/

function slideSwitch() {
    var $sel = $('#slideshow IMG.sel');

    if ( $sel.length == 0 ) $sel = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $sel.next().length ? $sel.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
     var $sibs  = $sel.siblings();
     var rndNum = Math.floor(Math.random() * $sibs.length );
     var $next  = $( $sibs[ rndNum ] );


    $sel.addClass('last-sel');

    $next.css({opacity: 0.0})
        .addClass('sel')
        .animate({opacity: 1.0}, 2000, function() {
            $sel.removeClass('sel last-sel');
        });
}

$(function() {
    setInterval( "slideSwitch()", 4000 );
});
