﻿$(document).ready(function() {
    var current = -1;
    var elems = new Array();
    var elems_i = 0;
    $('.items').each(function() {
        elems[elems_i++] = $(this);
    });
    var num_elems = elems_i - 1;
    var animate_out_delay = function() {
        setTimeout(animate_out, 6000);
    }
    var animate_in = function() {
        current = current < num_elems ? current + 1 : 0;
        elems[current].css('top', '50px').animate({ top: '0' }, 'fast', 'linear', animate_out_delay);
    }

    var animate_out = function() {
        elems[current].animate({ top: '-50px' }, 'fast', 'linear', animate_in);
    }
    animate_in();
});
