jQuery.fn.extend({
  scrollTo : function(speed, easing) {
    <!-- hashの取得が出来なければ、処理を中断 -->
    if(!$(this)[0].hash || $(this)[0].hash == "#") {
      return false;
    }
    return this.each(function() {
      var targetOffset = $($(this)[0].hash).offset().top;
      $('html,body').animate({scrollTop: targetOffset}, speed, easing);
    });
  }
});

$(document).ready(function(){
  $('a[href*=#]').click(function() {
    $(this).scrollTo(500);
    return false;
  });
});
