$(function(){
/*
 * Galleria
 */
galleries = {};
galleriesIndex = 0;
Galleria.loadTheme('assets/js/galleria/themes/classic/galleria.classic.min.js');

Galleria.addTransition("fast",
            function(params, complete) {
Utils = Galleria.utils;
                $(params.next).css('opacity', 0);
                if (params.prev) {
                    Utils.animate( params.prev, {
                        opacity: 0
                    },{
                        duration: params.speed/100,
                        complete: function() {
                            Utils.animate( params.next, {
                                opacity:1
                            },{
                                duration: params.speed/3,
                                complete: complete
                            });
                        }
                    });
                } else {
                    Utils.animate( params.next, {
                        opacity: 1
                    },{
                        duration: params.speed,
                        complete: complete
                    });
                }
            });

$(".contentDia .slideshowContent").galleria({
   initialTransition: 'fast',
   transition: 'fade',
   transitionSpeed: 2000,
   imageCrop:  true,
   thumbnails: false,
   autoplay: 3000,
   showInfo: false,
   showCounter: false,
   showImagenav: false,
   width: 439,
   height: 445,
   dataSource: ".contentDia .slideshowContent",
   keepSource: false
});
$(".slideshowContent").css({'visibility' : 'visible'});
galleries[ 0 ] = galleriesIndex;
galleriesIndex = galleriesIndex + 1;

/*
 * jQuery Tools
 */
$("#language a[rel=#overlay]").overlay({
	mask: {
		color: '#EAEAEA',
		loadSpeed: 200,
		opacity: 0.5
	},
	onBeforeLoad: function() {
		var wrap = this.getOverlay().find(".overlayWrapper");
        	var src = this.getTrigger().attr("href");
                wrap.html('<iframe src="'+src+'" width="1010px" height="543px" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" />');
	},
	closeOnClick: false,
        top: "center"
});

$("#globalOverlay").overlay({
	top: '10%',
        fixed: false,
	mask: {
		color: '#fff',
		loadSpeed: 200,
		opacity: 0.5
	},
	closeOnClick: true,
	load: true
});
});
