// JavaScript Document

$(document).ready(function() {
    var current = 0;
    var total = $('.testimonial').size();
    
    $('#arrow_right').click(function() {
        if(current == (total - 1))
            current = 0;
        else
            current++;
        showTestimonial(current, total, 1);                                                      
    });
    
    $('#arrow_left').click(function() {
        if(current != 0)
            current--;
            
        showTestimonial(current, total, 1);
    });

    showTestimonial(current, total, 0);
});

function showTestimonial(current, total, effect)
{
    $('.testimonial').hide();
    
    if(effect == 1)
        $('.testimonial:eq(' + current + ')').fadeIn(500);
    else
        $('.testimonial:eq(' + current + ')').show();
        
    $('div#control span').html((current + 1) + '/' + total);
    
    if(current > 0) 
        $('img#arrow_left').show();
    else
        $('img#arrow_left').hide();
        
    if((current + 1) == total)
        $('img#arrow_right').hide();
    else
        $('img#arrow_right').show();
}// JavaScript Document
