﻿/*** 
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 :)
***/

jQuery(function() {
    setInterval("slideSwitch()", 2500);
});


function slideSwitch() {
    var jQueryactive = jQuery('#slideshow img.active');

    if (jQueryactive.length == 0) jQueryactive = jQuery('#slideshow img:last');

    // use this to pull the images in the order they appear in the markup
    var jQuerynext = jQueryactive.next().length ? jQueryactive.next()
        : jQuery('#slideshow img:first');

    // uncomment the 3 lines below to pull the images in random order

    // var jQuerysibs  = jQueryactive.siblings();
    // var rndNum = Math.floor(Math.random() * jQuerysibs.length );
    // var jQuerynext  = jQuery( jQuerysibs[ rndNum ] );


    jQueryactive.addClass('last-active');

    jQuerynext.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function() {
            jQueryactive.removeClass('active last-active');
        });
}

