var offsetTop = 36;
var timeAnimation = 1000;

function initSmoothScrolling(){
	$('.smooth-scrolling').click(function() {
		if (location.pathname.replace(/^\//,") == this.pathname.replace(/^\//,")
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target
			|| $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top - offsetTop;
				$('html,body')
				.animate({scrollTop: targetOffset}, timeAnimation);
				return false;
			}
		}
	});
	
	// click back to top
	$('#back-to-top').bind('click', function() {
		// smooth scroll to top
		$('html,body').animate({scrollTop: 0}, timeAnimation);
	});
	
}

