$(document).ready(function(){
  $('a[href*=#]').click(function() {
	//alert(location.pathname.replace(/^\//,'') + "\n" + this.pathname.replace(/^\//,'') + "\n" + location.hostname+ "\n"+this.hostname);
	// && location.hostname == this.hostname) //in chrome the post was being included in this.hostname
 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,''))
 	{
		   var $target = $(this.hash);
		   $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
		   
		   if ($target.length) {
		   	
				  var targetOffset = $target.offset().top;
				  $('html,body').animate({scrollTop: targetOffset}, 1000);
				  return false;
		   }
 	}
  });
});
