function initAll() {
	$('.noScript').removeClass('noScript');
	$('.banner .slide').cycle();
	Shadowbox.init({
		skipSetup: true
	});
	initMenu();
	initGallery();
	initOutlet();
}

function initMenu() {
	// setta voce attuale del menu
	if (!page) return;
	$('.main-menu li a').each(function(){
				if ($(this).hasClass(page[0])) $(this).addClass('active');
			});
	// setta voce attuale del sotto menu
	$('.menu-sezione li a').each(function(){
				if ($(this).hasClass(page[1])) $(this).addClass('active');
			});
}

function initGallery() {
	if(!$('.gallery')[0]) return;
	
	Galleria.loadTheme('/inc/js/galleria/classic/galleria.classic.js');
	$('.gallery').galleria({
						   height: 400,
        extend: function() {
            this.bind(Galleria.IMAGE, function(e) {
                // bind a click event to the active image
                $(e.imageTarget).css('cursor','pointer').click(this.proxy(function() {
					Shadowbox.open({
							content:    e.imageTarget.src,
							player:     "img"
						});
					}));
				});
			}
	});
}

function initOutlet() {
	var gals = $('.outlet-block');
	var n = 0;
	gals.each(function() {
		$('.img a', $(this)).each(function(){
			Shadowbox.setup($(this), {
				gallery: "photo-gallery"+n
			});
		 });
		n++
	});
}

function initOutletold() {
	Shadowbox.setup($('.outlet-block a'), {
		player:			'img'
	});

}

$(document).ready(initAll);

