﻿$(document).ready(function () {
    $("div.cycleme").cycle(6000)
});

$.fn.cycle = function (timeout) {
    var $all_elem = $(this)

    show_cycle_elem = function (index) {
        if (index == $all_elem.length) index = 0;

        if (index != 0) {
            $all_elem.eq(index - 1).slideUp(500);
            $all_elem.eq(index - 1).hide();
            $all_elem.eq(index).slideDown(500)
        }
        else {
            $all_elem.hide().eq(index).slideDown(500);
        }
        setTimeout(function () { show_cycle_elem(++index) }, timeout);
    }
    show_cycle_elem(0);
};
