// JavaScript Document

$(document).ready(function(){
	
	// Gestione iframe Wikipedia
	$(".wikipedia").colorbox({width:"80%", height:"80%", iframe:true});

	// Gestione VT index.html
	$(".benvenuti_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".pergolato_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".reception_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".sala_legnaia_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".sala_camino_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".soppalco_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".sala_spassaca_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".sala_suler_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_ranuncolo_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_lavanda_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_nasturzio_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_fiordaliso_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_primula_vt").colorbox({width:"660", height:"380", iframe:true});
	$(".suite_sambuco_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_cicoria_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_gerbera_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_papavero_vt").colorbox({width:"600", height:"380", iframe:true});
	$(".suite_brionia_vt").colorbox({width:"600", height:"380", iframe:true});
	
	// Itinerari
	$(".itinerari_meteo").colorbox({width:"492px", height:"400px", iframe:true});
	
	// Gestione gallery slideshow
	$("a[rel='esterni_interni']").colorbox({slideshow:true});
	$("a[rel='sale_pranzo']").colorbox({slideshow:true});
	$("a[rel='sale_meeting']").colorbox({slideshow:true});
	$("a[rel='suite_ranuncolo']").colorbox({slideshow:true});
	$("a[rel='suite_lavanda']").colorbox({slideshow:true});
	$("a[rel='suite_nasturzio']").colorbox({slideshow:true});
	$("a[rel='suite_fiordaliso']").colorbox({slideshow:true});
	$("a[rel='suite_primula']").colorbox({slideshow:true});
	$("a[rel='suite_sambuco']").colorbox({slideshow:true});
	$("a[rel='suite_cicoria']").colorbox({slideshow:true});
	$("a[rel='suite_gerbera']").colorbox({slideshow:true});
	$("a[rel='suite_papavero']").colorbox({slideshow:true});
	$("a[rel='suite_brionia']").colorbox({slideshow:true});
	$("a[rel='animali']").colorbox({slideshow:true});
	$("a[rel='varie']").colorbox({slideshow:true});
	
	// Dove siamo
	$(".dove_siamo").colorbox({width:"90%", height:"90%", iframe:true});
	
	// Animazione menù drop down
	$("#menu li").hover(
		function () { $("ul", this).slideDown(100); }, 
		function () { $("ul", this).slideUp(100); }
	
		//function () { $("ul", this).animate({ visibility: "visible"}, "fast"); }, 
		//function () { $("ul", this).animate({ visibility: "hidden"}, "fast"); }
	);
	
	// Animazione over su pulsanti slider - solo per browser diversi da IE
	var browser = $.browser;
	if(!browser.msie){
		$("#wrapper_hg_button .prev").hover(
			function () { $("#wrapper_hg_button .prev a img").animate({ opacity: "0.7"}, "fast"); },
			function () { $("#wrapper_hg_button .prev a img").animate({ opacity: "1.0"}, "fast"); }
		);
			
		$("#wrapper_hg_button .next").hover(
			function () { $("#wrapper_hg_button .next a img").animate({ opacity: "0.7"}, "fast"); },
			function () { $("#wrapper_hg_button .next a img").animate({ opacity: "1.0"}, "fast"); }
		);
	}
	
	
	// Animazione bandiere cambio lingua
	$("#box_lang_ita").hover(
		function () { $("#box_lang_ita").animate({ marginTop: "8px"}, "fast"); },
    	function () { $("#box_lang_ita").animate({ marginTop: "0px"}, "slow"); }
	);
		
	$("#box_lang_eng").hover(
		function () { $("#box_lang_eng").animate({ marginTop: "8px"}, "fast"); },
    	function () { $("#box_lang_eng").animate({ marginTop: "0px"}, "slow"); }
	);	
	
	
	// Anomazione cambio opacità thumb gallery mouse hover
	 $(".thumb_gallery").each(function() {
		$(this).hover(
			function() { $(this).stop().animate({ opacity: 1.0 }, 200);},
           	function() { $(this).stop().animate({ opacity: 0.6 }, 200);
		});
	});
	
	
	$(".submit_btn").each(function() {
		$(this).hover(
			function() { $(this).stop().animate({ opacity: 1.0 }, 200);},
           	function() { $(this).stop().animate({ opacity: 0.6 }, 200);
		});
	});


	// Google Analitycs
	var _gaq = _gaq || [];
  	_gaq.push(['_setAccount', 'UA-7288521-5']);
  	_gaq.push(['_trackPageview']);
  	(function() {
    	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 	 })();

});
