(function($){ Galleria.themes.create({
    name: 'wpgallery',
    author: 'wpgallery',
    version: '1.1',
    css: 'galleria.wpgallery.css',
    defaults: {
        transition: 'slide',
        thumbs_transition: 'fade',
        show_arrows: 1,
        show_thumbs: 1
    },
    init: function(options) {

        this.$('loader').show().fadeTo(200, .4);
        this.$('counter').hide();

        this.$('thumbnails').children().hover(function() {
            $(this).not('.active').fadeTo(200, 1);
        }, function() {
            $(this).not('.active').fadeTo(400, .4);
        }).not('.active').css('opacity',.4);
        

        this.$('container').hover(this.proxy(function() {
            if(options.show_arrows) this.$('image-nav-left,image-nav-right').fadeIn(200);
            if(options.show_thumbs)
            {
                if(options.thumbs_transition=='slide')
                    this.$('thumbnails-container').animate({bottom: 0}, {queue:false, duration: 200});
                else
                    this.$('thumbnails-container').fadeIn(200);
            }
        }), this.proxy(function() {
            if(options.show_arrows) this.$('image-nav-left,image-nav-right').fadeOut(500);
            if(options.show_thumbs)
            {
                if(options.thumbs_transition=='slide')
                    this.$('thumbnails-container').animate({bottom: -49}, {queue:false, duration: 400});
                else
                    this.$('thumbnails-container').fadeOut(400);
            }
        }));
        
        this.$('image-nav-left,image-nav-right,counter').hide();
        
        this.$('thumbnails-container').hide();
        if(options.show_thumbs)
        {
            if(options.thumbs_transition=='slide') {
                this.$('thumbnails-container').animate({bottom: -49}, {queue:false, duration: 100});
                this.$('thumbnails-container').show();
            }
        }

        this.bind(Galleria.LOADSTART, function(e) {
            if (!e.cached) {
                this.$('loader').show().fadeTo(200, .4);
            }
            if (this.hasInfo()) {
                this.$('info').show().fadeTo(200, .8);;
            } else {
                this.$('info').hide();
            }
            $(e.thumbTarget).parent().addClass('active').css('opacity',1)
                .siblings('.active').removeClass('active').fadeTo(400,.4);
        });

        this.bind(Galleria.LOADFINISH, function(e) {
            this.$('loader').fadeOut(200);
            $(e.thumbTarget).css('opacity',1)
        });
    }
});
})(jQuery);
