﻿$(document).ready(function () {

    function animateNextPortfolio(nextP) {

        //check if there is a next image, otherwise go back to first
        if (nextP.length == 1) {
            //$(nextP).fadeIn(500).delay(4000).fadeOut(500, function () {
            $(nextP).fadeIn(500).delay(10000).fadeOut(500, function () {
                animateNextPortfolio($(nextP).next('div'));
            });
        } else {
            //animateFirstPortfolio(1500);
            animateFirstPortfolio(10000);
        }
    }

    function animateFirstPortfolio(z) {
        $('#quotes').children('div:first').fadeIn(500).delay(z).fadeOut(500, function () {
            animateNextPortfolio($('#quotes').children('div:first').next('div'));
        });
    }
    animateFirstPortfolio(10000);
})
