function slideSwitch() {
        var $active = $('#images img.active');
        var $next = $active.next().length ? $active.next() : $('#images img:first'); // loop if last image
        $active.addClass('last-active');
        $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
    }
        $(document).ready(function() {
            var regexp = /_m\.jpg/g; 
            $.getJSON("http://api.flickr.com/services/feeds/photoset.gne?set=72157623273930980&nsid=46454852@N07&lang=en-us&format=json&jsoncallback=?", function(data){
                $.each(data.items, function(i,item){
                    $("<img/>").attr("src", item.media.m.replace(regexp,'_s.jpg')).appendTo("#thumbs");
                    $("<img/>").attr("src", item.media.m.replace(regexp,'.jpg')).appendTo("#images").addClass("bigimg bigimg" + i);
                }); //end each
                $("#images img:first").addClass("active");
                foo = setInterval("slideSwitch()", 5000 );
                $("#thumbs img").click(function() {
                    clearInterval(foo); //clears the slideswitch
                    var poi = $("#thumbs img").index(this); //finds the index of the thumb you've clicked
                    var imgclass = ".bigimg" + poi; //adds the number to a class
                    if(!$(imgclass).hasClass('active')) {
                        var $current = $("#images img.active"); //finds the current active slide
                        $current.addClass("last-active"); //gives the current slide a class of 'last-active'
                        $(imgclass).css({opacity: 0.0}).addClass("active").animate({opacity: 1.0}, 500, function() {
                            $current.removeClass('active last-active');
                        });
                    }
                });
            }); //end JSON
        }); //end doc ready