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

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

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



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

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

function slideSwitchPrev() {
    var $active = $('#slideshow IMG.active');


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



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

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

function navigateLeft() {
	//alert('navigateLeft');
	clearInterval(playSlideshow);
	slideSwitchPrev();
}

function navigateRight() {
	//alert('navigateLeft');
	clearInterval(playSlideshow);
	slideSwitch();
}

var playSlideshow = setInterval( "slideSwitch()", 3000 );

jQuery( function () {
$('#slideshow-nav-left img').click( navigateLeft);
$('#slideshow-nav-right img').click( navigateRight);}
);

jQuery(function() {
	slideSwitch();
	});

