function slideSwitch_1() {
    var $active = $('#slideshow_1 IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow_1 IMG:last');

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

    // 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.addClass('last-active');

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

$(function() {
	setInterval( "slideSwitch_1()", 6000 );
});

//////////////////////////////////////////////////
//////////////////////////////////////////////////


/* slideshow 2. used if you want to have 2 slideshows on the same page */
function slideSwitch_2() {
    var $active = $('#slideshow_2 IMG.active');

    if ( $active.length == 0 ) {
			$active = $('#slideshow_2 IMG:last');
		}

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next() : $('#slideshow_2 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 startSlideshow_2() {
	setInterval( "slideSwitch_2()", 6000 );	
}


/* used to pause the start of the 2nd slideshow so that it runs a little later than the 1st */
$(function() {
  setTimeout("startSlideshow_2()", 2000);  
});


//////////////////////////////////////////////////
//////////////////////////////////////////////////


/* slideshow 3. used if you want to have 3 slideshows on the same page */
function slideSwitch_3() {
    var $active = $('#slideshow_3 IMG.active');

    if ( $active.length == 0 ) {
			$active = $('#slideshow_3 IMG:last');
		}

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next() : $('#slideshow_3 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 startSlideshow_3() {
	setInterval( "slideSwitch_3()", 6000 );	
}


/* used to pause the start of the 3rd slideshow so that it runs a little later than the 1st */
$(function() {
  setTimeout("startSlideshow_3()", 4000);  
});
