$("document").ready(function() {

  if ($(window).height() < Math.max($("html").height(), $("body").height())) {
    $("body").append("<div id='scrollArrow'></div>");
  }

  $("#scrollArrow").click(function() {
    var height=Math.max($("html").height(), $("body").height());
    $("body, html").animate({scrollTop: height - $(window).height()}, 2000);
  });

  $(window).scroll(function() {
    var height=Math.max($("html").height(), $("body").height());
    var scroll=Math.max($("html").scrollTop(), $("body").scrollTop());

    if (height - scroll <= $(window).height()) {
      $("#scrollArrow").animate({opacity: 0}, "slow");
    }
  });
});

