$(document).ready(function(){
    jQuery.easing.def = "easeOutQuad";
	$("a.ngg-gallery-thumbnail-box").fancybox();
	$(".slideshowlink a").fancybox();
    $("#kpg-pictures a").fancybox();
	
	$("#wp_myweather").cycle({
	    fx:     'scrollHorz',
	 	speed: 1,
	    timeout:  15000,
		easing: 'easeOutQuad', 
		after: function(a, b) {
			$(".cycler", a).cycle({ 
			    fx:     'scrollHorz',
				easing: 'easeOutQuad', 
				speed: 2000,
			    timeout:  3000
			}).cycle('pause');
			$(".cycler", b).cycle({ 
			    fx:     'scrollHorz',
				easing: 'easeOutQuad', 
				speed: 2000,
			    timeout:  3000
			}).cycle('resume');
		}
	});
	
	$("#upperbox #cycle").cycle({ 
	    fx:     'scrollHorz', 
		easing: 'easeOutQuad', 
	    timeout: 0, 
		speed: 3000,
		next:   '#upperbox .next', 
	    prev:   '#upperbox .prev',
		timeout: 9000
	});
	$("#upperbox #cycle").cycle('resume'); 
	$('#upperbox .next, #upperbox .prev').click(function() {
		$("#upperbox #cycle").cycle('stop'); 
	});
	$(document).pngFix();
});

google.setOnLoadCallback(
	function () {
		$(".weather_translate").each(function() {
			var self = this;
			google.language.translate($(self).html(), "en", "it", function(result) {
				if (result.translation) {
					$(self).html(result.translation);
				}
			});
		});
	}
);
