var name = "#side_link";
var menuYloc = null;
var h_size;

function getBrowserHeight(){
  if(document.all){
    return document.documentElement.clientHeight;
  }else if(document.layers || document.getElementById){
    return innerHeight;
  }
}
function fn_resize(){
  h_size = getBrowserHeight() * 0.0;
  h_size = 0;
  offset = h_size+menuYloc+$(document).scrollTop()+"px";
  $(name).animate({top:offset},{duration:500,queue:false});
}
$(document).ready(function(){
  fn_resize();
});
$(window).scroll(function(){
  offset = h_size+menuYloc+$(document).scrollTop()+"px";
  $(name).animate({top:offset},{duration:500,queue:false});
});
window.onresize = function(){
  fn_resize();
}

jQuery.easing.quart = function (x, t, b, c, d) {
  return -c * ((t=t/d-1)*t*t*t - 1) + b;
};
$(document).ready(function(){
  $('a[href^=#]').click(function(){
    var target;
    target = $( $(this).attr('href') );
    if (target.length == 0) {
      return;
    }
    $('html, body').animate({scrollTop: target.offset().top}, 1000, 'quart');
    return false;
  });
});

