/// <reference path="jquery-vsdoc.js" />
var tInt,
    tTime = 10000;

function testimonial(x) {
    var c = "#co-testimonials blockquote",
        i = $(c).index($(c+":visible")[0]),
        n = (i + 1 == $(c).size()) ? 0 : i + 1,
        j = x ? x : n;

    if ($.browser.msie && ($.browser.version == 6)) {

        $(c+":eq("+i+")").hide();$(c+":eq("+j+")").show();
        $("#controls li").removeClass("active").eq(j).addClass("active");
        
    } else {

        $(c+":eq("+i+")").fadeOut(600, function(){
            $(c+":eq("+j+")").fadeIn();
            $("#controls li").removeClass("active").eq(j).addClass("active");
        });
    }
    
    if(x) {
        clearInterval(tInt);
        tInterval(tTime);
    }
}

function tInterval(x) {
    tInt = setInterval(function() {
        
        testimonial();
        
    }, x);
}

$(document).ready(function() {

    tInterval(tTime);
    
    $("#controls li a").click(function(e) {
        e.preventDefault();
        var i = $("#controls li a").index(this);
        testimonial(i);
    });
       
});
