			
function altezza_content() {
	var altezza = window.innerHeight - 300;
	document.getElementById("scroll_height").style.height = altezza + "px";
}

$(document).ready(function() {

	//ALTEZZA CONTAINER
	document.getElementById("container").style.height='100%';
	
	//FUNZIOBNE ALTEZZA CONT
	altezza_content();	
	
	//ANIMAZIONE APERTURA CONTAINER
	setTimeout( function() {
		jQuery('#container').animate({right: "+=500px"});
	}, 1000 );
		
	//SCROLLING CONTENUTI		
	$(function()
	{
		$('.scroll-pane').each(
			function()
			{
				$(this).jScrollPane(
					{
						showArrows: $(this).is('.arrow')
					}
				);
				var api = $(this).data('jsp');
				var throttleTimeout;
				$(window).bind(
					'resize',
					function()
					{
						if ($.browser.msie) {
							if (!throttleTimeout) {
								throttleTimeout = setTimeout(
									function()
									{
										api.reinitialise();
										throttleTimeout = null;
									},
									50
								);
							}
						} else {
							api.reinitialise();
						}
					}
				);
			}
		)

	});

	//PULSANTE GALLERIA FOTOGRAFICA MENU
	$("#mainMenu li.gallery").hover(function(){
		$("#mainMenu li.gallery img").stop().animate({left:"-60px"},{queue:false,duration:300});
		}, function() {
		$("#mainMenu li.gallery img").stop().animate({left:"0px"},{queue:false,duration:300});
	});
	
	$("#mainMenu li.gallery").hover(function(){
		$("#mainMenu li.gallery div").stop().animate({left:"0px"},{queue:false,duration:300});
		}, function() {
		$("#mainMenu li.gallery div").stop().animate({left:"-200px"},{queue:false,duration:300});
	});
	
	//MAPPA
	$(".mappa").hover(function(){
		$(".mappa .more").stop().animate({top:"0px"},{queue:false,duration:300});
		}, function() {
		$(".mappa .more").stop().animate({top:"138px"},{queue:false,duration:300});
	});

	//CONTAINER CLOSE
	$(".container-close").click(function () { 
		$("#container").animate({
		right: '-=500',
			}, 300, function() {
		});
		$(".container-open").animate({
		right: '+=110',
			}, 300, function() {
		});
	});
	//CONTAINER OPEN
	$(".container-open").click(function () { 
		$("#container").animate({
		right: '+=500',
			}, 300, function() {
		});
		$(".container-open").animate({
		right: '-=110',
			}, 300, function() {
		});
	});
	
	//FADE PULSANTI OPEN CLOSE
	$(".container-close span, .container-open span").fadeTo("fast", 0.5);
		$(".container-close span, .container-open span").hover(function(){
		$(this).fadeTo("fast", 1.0);
		},function(){
		$(this).fadeTo("fast", 0.5);
	});

	//FANCYBOX MAPPA GOOGLE
	$(".mappa-open").fancybox({
		maxWidth	: 800,
		maxHeight	: 600,
		fitToView	: false,
		width		: '70%',
		height		: '70%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none'
	});
	
});
