/*!
 * Galleria Classic Theme
 * http://galleria.aino.se
 *
 * Copyright (c) 2010, Aino
 * Licensed under the MIT license.
 */

(function($) {

Galleria.themes.create({
    name: 'classic',
    author: 'Galleria',
    version: '1.2',
    css: 'galleria.classic.css',
    defaults: {
        transition: 'slide',
        show_caption: true
    },
    init: function(options) {
        this.$('loader').show().fadeTo(200, .4);
        this.$('counter').show().fadeTo(200, .4);
        
		this.$('thumbnails').children().hover(function() {
            $(this).not('.active').stop().fadeTo(200, 1.0);
        }, function() {
            $(this).not('.active').stop().fadeTo(400, 0.5);
        }).not('.active').fadeTo(1, .5);
		
		$('.galleria-image-nav-left, .galleria-image-nav-right').hover(
		function(){$(this).stop().fadeTo(200, 1.0);}, 
		function(){$(this).stop().fadeTo(400, 0.5);}
		);

		$('.galleria-thumb-nav-left, .galleria-thumb-nav-right').hover(
		function(){$(this).stop().fadeTo(200, 1.0);}, 
		function(){$(this).stop().fadeTo(400, 0.45);}
		);				
		
        var elms = this.$('info-link,info-close').click(function() {
            elms.toggle();
        });
        
        if (options.show_caption) {
            elms.trigger('click');
        }
        
        this.bind(Galleria.LOADSTART, function(e) {
            if (!e.cached) {this.$('loader').show().fadeTo(200, .4);}            
            $(e.thumbTarget).parent().addClass('active').siblings('.active').removeClass('active');
        });

        this.bind(Galleria.LOADFINISH, function(e) {
            this.$('loader').fadeOut(200);
        });
    }
});

})(jQuery);
