var stoping = false;
function slideSwitch() {
	if (stoping) return;
	
    var $active = $('#slideshow .active');
 
    if ( $active.length == 0 ) 
	{
		$active = $('#slideshow .picinfo:last');
		$('#slideshow .thumbnails li:last').addClass('current');
	}
	
	if ($('#slideshow .picinfo').length < 2) return false;
 
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next('.picinfo').length ? $active.next()
        : $('#slideshow .picinfo: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');
			$('#slideshow .thumbnails li').removeClass('current');
			var id = parseInt($next.attr('id').replace('slide', ''));
			$('#slideshow .thumbnails li').eq(id-1).addClass('current');
        });
}
function slideto(id)
{
	stoping = true;
    // use this to pull the images in the order they appear in the markup
    var $active = $('#slideshow .active');
    var $next =  $('#slide'+id);
 
    // 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');
        });
}
