function slideshow() {
    $("#slideshow-nav").show();
    $("#slideshow-nav a:first").addClass("active");

    var imageWidth = $("#slideshow").width();
    var imageSum = $("#slideshow-images img").size();
    var imageReelWidth = imageWidth * imageSum;

    $("#slideshow-images").css({'width' : imageReelWidth});

    rotate = function(){
        var triggerID = $active.attr("rel") - 1;
        var image_reelPosition = triggerID * imageWidth;

        $("#slideshow-nav a").removeClass('active');
        $active.addClass('active');

        $("#slideshow-images").animate({
            left: -image_reelPosition
        }, 800 );
    };

    rotateSwitch = function(){
        play = setInterval(function(){
            $active = $('#slideshow-nav a.active').parent().next().children("a");
            if ( $active.length === 0) {
                $active = $('#slideshow-nav a:first');
            }
            rotate();
        }, 7000);
    };

    rotateSwitch();

    $("#slideshow-images a").hover(function() {
        clearInterval(play);
    }, function() {
        rotateSwitch();
    });

    $("#slideshow-nav a").click(function() {
        $active = $(this);

        clearInterval(play);
        rotate();
        rotateSwitch();
        return false;
    });
}

