(function ($) {

    Galleria.addTheme({
        name: 'dots',
        author: 'Galleria',
        version: '1.1',
        css: 'galleria.dots.css',
        defaults: {
            transition: 'fadeslide',
            transition_speed: 500,
            thumbnails: 'empty',
            carousel: false,
            image_crop: false,
            autoplay: 3000
        },
        init: function (options) {
            this.$('thumbnails').find('.galleria-image').css('opacity', 0.5).hover(function () {
                $(this).fadeTo(200, 1);
            }, function () {
                $(this).not('.active').fadeTo(200, 0.5);
            });

            this.bind(Galleria.LOADSTART, function (e) {
                if (!e.cached) {
                    this.$('loader').show().fadeTo(200, 0.8);
                }
            });
            this.bind(Galleria.LOADFINISH, function (e) {
                this.$('loader').fadeOut(200);
                $(e.thumbTarget).parent().css('opacity', 1).siblings().css('opacity', 0.5)
            });
        }
    });

})(jQuery);
