$(document).ready(function(){

	$('a.gallery').fancybox({
		'titleShow': false
	});
	$('a.facebox').fancybox();

    // Liste fancybox
    $(".fancybox-list").fancyboxList();
				
    // Liste fancybox
    $("a.fancybox").fancybox();
	
	
    // Link fancybox
    $("a.fancybox-iframe").fancybox({
        'zoomSpeedIn': 500,
        'zoomSpeedOut': 500,
        'speedIn': 600,
        'speedOut': 200,
        'autoScale': false,
        'type': 'iframe',
        'width': 980,
        'height': $(window).height()*0.85
    });

	$('.slideshow').accessNews({
		speed : "normal",
		slideBy : 1
	});


	if(_STILE == 'normale'){
	    var cover = $('<div></div>');
	    cover.css({
		    'width': '100%',
		    'height': $('body').height()+'px',
		    'position': 'absolute',
		    'top': '0px',
		    'left': '0px',
		    'opacity': '.01',
		    'filter': 'alpha(opacity=1)',
		    'z-index': '100',
		    'display': 'none'
	    });
	    $('body').prepend(cover);

	    $('#styles ul').css({
		    'display': 'none',
		    'z-index': '101'
	    });
	    $('#langs ul').css({
		    'display': 'none',
		    'z-index': '101'
	    });

	    $('#styles').click(function(){
		    $('#styles ul').toggle('normal', function(){
			    cover.css('display', $('#styles ul').css('display'))
		    });
	    });

	    $('#langs').click(function(){
		    $('#langs ul').toggle('normal', function(){
			    cover.css('display', $('#langs ul').css('display'))
		    });
	    });
	}

	cover.click(function(){
		$('#styles ul').hide('normal');
		$('#langs ul').hide('normal');
		$(this).hide();
	});

});






// -- Plugin Liste Fancybox ------------------------------------------------- //

(function($){
    $.fn.fancyboxList = function(config) {
        var counter = 0;
        return this.each(function() {
            counter++;
            $(this).find('a').each(function(){
                $(this).attr('rel', 'fancybox-list-'+counter);
                $(this).fancybox(config);
            });
        });
    };
})(jQuery);


