        $(function() { 
            $.fn.slide = function(config) { 
 
                // 引数がない場合のデフォルト値の設定 
                config = $.extend({ 
                    loopSpeed: 5000, 
                    fadeInSpeed: 1000, 
                    fadeOutSpeed: 1000, 
                    firstPlayNo: 0, 
                    loopType: "normal" 
                }, config); 
 
                var _element = this; 
                var _numberOfElements = _element.size() - 1; 
                var _count = config.firstPlayNo; 
 
                $("#state_" + _count).css("background-position", "bottom left"); 
                _element.eq(_count).fadeIn(config.fadeInSpeed); 
 
                var timerId = setInterval(function() { 
                    if (config.loopType == "random") { 
                        do { 
                            var randomCount = Math.floor(Math.random() * (_numberOfElements + 1)); 
                        } while (randomCount == _count); 
                        _element.eq(_count).fadeOut(config.fadeOutSpeed); 
                        _element.eq(randomCount).fadeIn(config.fadeInSpeed); 
                        _count = randomCount; 
                    } else if (_count == _numberOfElements) { 
                        _count = 0; 
                        _element.eq(_numberOfElements).fadeOut(config.fadeOutSpeed); 
                        _element.eq(0).fadeIn(config.fadeInSpeed); 
                    } else { 
                        _element.eq(_count).fadeOut(config.fadeOutSpeed); 
                        _element.eq(_count + 1).fadeIn(config.fadeInSpeed); 
                        _count++; 
                    } 
                    $("#loop_state div").css("background-position", "top left"); 
                    $("#state_" + _count).css("background-position", "bottom left"); 
                }, config.loopSpeed); 
 
                $("#loop_state div").click(function() { 
                    clearInterval(timerId); 
                    var id = $(this).attr("id").replace("state_", ""); 
                    if (!$(_element).is(':animated') && (id != _count)) { 
                        _element.eq(_count).fadeOut(config.fadeOutSpeed); 
                        _element.eq(id).fadeIn(config.fadeInSpeed); 
                        _count = id; 
                        $("#loop_state div").css("background-position", "top left"); 
                        $("#state_" + _count).css("background-position", "bottom left"); 
                    } 
                }); 
            } 
        }); 
