var current = 0;
var items;


$(window).load(function () {
    items = $(".tpc_review_review").not(".tpc_review_review:first");
    $(items).hide();
    $(items[0]).addClass("show").show();
    $('.tpc_widget').css("height", $(items[0]).height() + 175);
    rotateSwitch();

});

function shuffelElements(element) {
    var oldElement = $(".show:first");
    $(oldElement).removeClass("show").fadeOut(1000, function () {
        $(element).addClass("show").fadeIn(1000);
        $("#tp_widget").animate({
            height: $(element).height() + 185 + "px"
        }, 600);
    });
}

setcurrent = function () {
    if (current < (items.length - 1))
        current++;
    else
        current = 0;
};

rotate = function () {
    setcurrent();
    shuffelElements(items[current]);
};

rotateSwitch = function () {
    play = setInterval(function () { rotate(); }, 12000);
};  
