﻿(function($) {
    var org_self;

    $.fn.keywordshow = function(opt) {
        org_self = $(this);
        var times = eval(opt) * 700;
        $(org_self).find('li').css({ opacity: 0.0 });
        $(org_self).find('li:first').css({ opacity: 1.0 });
        setInterval('$.fn.gallery2()', times);
    }

    $.fn.gallery2 = function() {

        if ($(org_self).find('li').hasClass('show')) {
            var current = $(org_self).find('li.show');
        } else {
            var current = $(org_self).find('li:first active');
        }

        if ($(current).next().length) {
            $(current).next().addClass('show active').animate({ opacity: 1.0 }, 1000);
        } else {
            $(org_self).find('li:first').addClass('show last-active').animate({ opacity: 1.0 }, 1000);
        }

        $(current).animate({ opacity: 0.0 }, 1000).removeClass('show active');
    }

})(jQuery);

