﻿var currentQuote = 0;

$(document).ready(startRotation);

function startRotation() {
    $("#quotes span").fadeOut(0);
    doRotation();
}

function doRotation() {
    if ($("#quotes span").length <= currentQuote) {
        currentQuote = 0;
    }
    $("#quotes span").each(function(i, v) {
        var q = $(this);
        if (i == currentQuote) {
            q.fadeIn();
        } else {
            q.fadeOut();
        }
    });
    currentQuote++;
    setTimeout(doRotation, 5000);
}