jQuery(document).ready(function() {
    // Hide all testimonials and start the fader
    jQuery('.single-article').hide();
    jQuery('.single-article:first').show().addClass('active-article');
    jQuery('#next').click(function() {
        next();
    });
    jQuery('#previous').click(function() {
        previous();
    });
});

function next()
{
	current = jQuery('.active-article');
    current.fadeOut(500, function() {
        current.removeClass('active-article');
        var next = current.next();
        if (!next.size()) {
            next = jQuery('.single-article:first');
        }
        next.fadeIn(500, function() {
            next.addClass('active-article');
        });
    });
}

function previous()
{
	current = jQuery('.active-article');
    current.fadeOut(500, function() {
        current.removeClass('active-article');
        var previous = current.prev();
        if (!previous.size()) {
        	previous = jQuery('.single-article:last');
        }
        previous.fadeIn(500, function() {
        	previous.addClass('active-article');
        });
    });
}