function ridimensiona(){
	
	var screenWidth = $(window).width();
	var screenHeight = $(window).height();
	
	if(screenWidth<950){screenWidth=950;};
	if(screenHeight<600){screenHeight=600;};
	
	$('#container-index').hide();
	$('#container-index').css({'width':screenWidth,'height':screenHeight});
	$('#index #footer').css({'width':screenWidth});
	$('#container-index').show();

};

$(document).ready(function(){
	
	//nascondo il div container
	$('#container').hide();
	
	//mouseover sull'icona facebook
	$('#icona-facebook img').mouseover(function() {
		$(this).attr('src','img/icona-facebook-on.jpg');
	})
	$('#icona-facebook img').mouseout(function() {
		$(this).attr('src','img/icona-facebook.jpg');
	})
	//mouseover sull'icona twitter
	$('#icona-twitter img').mouseover(function() {
		$(this).attr('src','img/icona-twitter-on.jpg');
	})
	$('#icona-twitter img').mouseout(function() {
		$(this).attr('src','img/icona-twitter.jpg');
	})
	//mouseover sull'icona RSS
	$('#icona-rss img').mouseover(function() {
		$(this).attr('src','img/icona-rss-on.jpg');
	})
	$('#icona-rss img').mouseout(function() {
		$(this).attr('src','img/icona-rss.jpg');
	})
	
	//elementi nascosti
	$('.nasc').hide();
	
	//in base all'id del body
	if ($('#index').length > 0){
		//imposto condizione iniziale
		$("#scelta-ita, #scelta-eng, #scelta-d, #icone, #img1, #img2").hide();
		
		//ridimensionamento container
		ridimensiona();
		
		var delay = 120;
		setTimeout("$('#img2').fadeIn();",delay);
		setTimeout("$('#img1').fadeIn();",4*delay);
		setTimeout("$('#scelta-ita').fadeIn();",10*delay);
		setTimeout("$('#scelta-eng').fadeIn();",12*delay);
		setTimeout("$('#scelta-d').fadeIn();",14*delay);
		setTimeout("$('#icone').fadeIn();",16*delay);
		
	}//end if
	
	//in base all'id del body
	if ($('#home').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#storia').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
		//mouseover sulle frecce
		$('#freccia-sx').mouseover(function() {
			$(this).attr('src','img/freccia-sx-on.gif');
		})
		$('#freccia-sx').mouseout(function() {
			$(this).attr('src','img/freccia-sx.gif');
		})
		$('#freccia-dx').mouseover(function() {
			$(this).attr('src','img/freccia-dx-on.gif');
		})
		$('#freccia-dx').mouseout(function() {
			$(this).attr('src','img/freccia-dx.gif');
		})
		
		//slide dei contenuti con pił di 2 slide
		var countSlide=1;
		$('#freccia-sx').hide();
		$('#tratteggio-sx').hide();
		$('#freccia-dx').click(function() {
			$('#slide').animate({'margin-left':'-=864px'},800);
			countSlide++;
			if (countSlide == 2) {
				$('#freccia-sx').fadeIn();
				$('#tratteggio-sx').fadeIn();
			}
			if (countSlide == 3) {
				$('#freccia-dx').fadeOut();
				$('#tratteggio-dx').fadeOut();
				$('#linea-orizontale').animate({'width':'576px'},800);
			}
		})
		$('#freccia-sx').click(function() {
			$('#slide').animate({'margin-left':'+=864px'},800);
			countSlide--;
			if (countSlide == 2) {
				$('#freccia-dx').fadeIn();
				$('#tratteggio-dx').fadeIn();
				$('#linea-orizontale').animate({'width':'864px'},800);
			}
			if (countSlide == 1) {
				$('#freccia-sx').fadeOut();
				$('#tratteggio-sx').fadeOut();
			}
		})
		
	}//end if
	
	//in base all'id del body
	if ($('#famiglia').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#mission').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#arte').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#distillerie').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#bassano').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#monastier').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#prodotti').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
		//mouseover sulle bottiglie
		$('#pre-scheda li span').hide();
		
		$('#pre-scheda li a').mouseover(function() {
			$('img', this).addClass('porta-su');
			$('img', this).animate({width:'40px', height:'122px', bottom:'-10px', left:'-4px'},200);
			$('span', this).fadeIn(200);
		})
		$('#pre-scheda li a').mouseout(function() {
			$('img', this).removeClass('porta-su');
			$('img', this).animate({width:'30px', height:'92px', bottom:'0px', left:'0px'},200);
			$('span', this).hide();
		})
		
		//visualizzazione scheda
		$('#scheda').hide();
		
		$('#vedi-scheda').click(function() {
			$('#pre-scheda').fadeOut(600);
			setTimeout("$('h2').animate({top:'0px'},600)",600);
			setTimeout("$('#scheda').fadeIn(600)",1200);
		})
		//chiudi scheda
		$('#chiudi-scheda').click(function() {
			$('#scheda').fadeOut(600);
			setTimeout("$('h2').animate({top:'80px'},600)",600);
			setTimeout("$('#pre-scheda').fadeIn(600)",1200);
			$('#scheda').hide();
		})
		
	}//end if
	
	//in base all'id del body
	if ($('#ricette').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
		//mouseover sulle frecce
		$('#freccia-sx').mouseover(function() {
			$(this).attr('src','img/freccia-sx-on.gif');
		})
		$('#freccia-sx').mouseout(function() {
			$(this).attr('src','img/freccia-sx.gif');
		})
		$('#freccia-dx').mouseover(function() {
			$(this).attr('src','img/freccia-dx-on.gif');
		})
		$('#freccia-dx').mouseout(function() {
			$(this).attr('src','img/freccia-dx.gif');
		})
		
		//slide dei contenuti con pił di 2 slide
		var countSlide=1;
		$('#freccia-sx').hide();
		$('#tratteggio-sx').hide();
		$('#freccia-dx').click(function() {
			$('#slide').animate({'margin-left':'-=864px'},800);
			countSlide++;
			if (countSlide == 2) {
				$('#freccia-sx').fadeIn();
				$('#tratteggio-sx').fadeIn();
			}
			if (countSlide == 4) {
				$('#freccia-dx').fadeOut();
				$('#tratteggio-dx').fadeOut();
			}
		})
		$('#freccia-sx').click(function() {
			$('#slide').animate({'margin-left':'+=864px'},800);
			countSlide--;
			if (countSlide == 3) {
				$('#freccia-dx').fadeIn();
				$('#tratteggio-dx').fadeIn();
			}
			if (countSlide == 1) {
				$('#freccia-sx').fadeOut();
				$('#tratteggio-sx').fadeOut();
			}
		})
		
	}//end if
	
	//in base all'id del body
	if ($('#bolle').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#eventi').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#visite-bolle').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#grapperia').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#visite-grapperia').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#gallery').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
		//gallery
		var nameImg2 = $('#content').find('.sel').attr('alt');
		$('#content .sel').attr('src','img/gallery/' + nameImg2 + '-on.jpg');
		$('#content ul a').mouseover(function() {
			var classImg = $(this).find('img').attr('class');
			var nameImg = $(this).find('img').attr('alt');
			if (classImg != 'sel') {
				$('img', this).attr('src','img/gallery/' + nameImg + '-on.jpg');
			}
		})
		$('#content ul a').mouseout(function() {
			var classImg = $(this).find('img').attr('class');
			var nameImg = $(this).find('img').attr('alt');
			if (classImg != 'sel') {
				$('img', this).attr('src','img/gallery/' + nameImg + '.jpg');
			}
		})
		$('#content ul a').click(function() {
			var classImg = $(this).find('img').attr('class');
			var nameImg = $(this).find('img').attr('alt');
			if (classImg != 'sel') {
				var nameImg3 = $('#content').find('.sel').attr('alt');
				$('#content .sel').attr('src','img/gallery/' + nameImg3 + '.jpg');
				$('#content ul a img').removeClass('sel');
				$('img', this).addClass('sel');
				$('#img-grande').attr('src','img/gallery/' + nameImg + 'g.jpg');
			}
		})
		
	}//end if
	
	//in base all'id del body
	if ($('#press').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#contatti').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	
	//in base all'id del body
	if ($('#mappa').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
		//nascondo div #indirizzi
		$('#indirizzi').hide();
		//faccio apparire con mouseover link
		$('#mostra-indirizzi').mouseover(function() {
			$('#indirizzi').fadeIn(400);
		})
		$('#mostra-indirizzi').mouseout(function() {
			$('#indirizzi').fadeOut(400);
		})
		
	}//end if
	
	//in base all'id del body
	if ($('#mondo').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
	//in base all'id del body
	if ($('#privacy').length > 0){
		
		//fadeIn iniziale
		$('#container').fadeIn(600);
		
	}//end if
	
});

//quando ridimensione il browser
$(window).resize(function() {
	//in base all'id del body
	if ($('#index').length > 0){
		
		//ridimensionamento container
		ridimensiona();
		
	}//end if
});