﻿/**
 * jQuery slideShow plugin
 * @author ser
 */


(function($) {

    $.fn.slideShow = function(settings) {
        settings = jQuery.extend({
            interval: 5,
            showSpeed: 2
        }, settings);

        if ($.browser.msie && $.browser.version == 6) $(this).children('li').eq(0).css('display', 'block');

        var index = 1;
        var obj = $(this);
        function showAt(n) {
            setTimeout(function() {
                obj.children('li').eq(n - 1).fadeOut(settings.showSpeed * 500, function() {
                    if (index < obj.children('li').length) { index++; } else {
                        index = 1;
                    }
                    obj.children('li').eq(index - 1).fadeIn(settings.showSpeed * 500, function() {
                        showAt(index)
                    });
                });
            }, settings.interval * 1000);


        }
        showAt(index);
    };
})(jQuery);
