/*** 
    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 :)
***/
var current_slide = 0;
var bFirstTime = true;
function slideSwitch() {
    if (bFirstTime == true)
    {
    	current_slide = $('.slideshowcontent').length-1;
    	bFirstTime = false;
    }
    var $active = $('#slideshow' + current_slide);
    var total = $('.slideshowcontent').length;

    current_slide++;
    if (current_slide >= total)
    	current_slide = 0;

    // use this to pull the images in the order they appear in the markup
    var $next =  $('#slideshow' + current_slide);

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


    $active.hide();
    $next.fadeIn("slow");
}

function SwitchSlide(iSlide)
{
    var $active = $('#slideshow' + current_slide);
    var $next =  $('#slideshow' + iSlide);
    current_slide = iSlide;
    $active.hide();
    $next.fadeIn("slow");
}

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