/*
	Smooth Scroll Functionality for jQuery by Riccardo Degni
	GNU GPL License
*/
jQuery.fn.extend({
  scrollTo : function(el, speed, easing) {
      var targetOffset = $(el).offset().top;
      $(this).animate({scrollTop: targetOffset}, speed, easing);
  }
});

// ready
$(document).ready(function() {
	$('a[href*=#]').click(function(event) {
		
		var to = $(this).attr('href').split('#')[1];
		
		// solo l'anchor 'termini_condizioni' del footer deve funzionare normalmente
		if($(this).attr('id') != 'to_termini') {
			event.preventDefault();
			var elTo = $('a[name=' + to + ']');
			$('html,body').scrollTo(elTo, 2000);
		}	
		
	});
});