>
var amountScrolledForTop = 500;
var amountScrolledForBottom = 1500;
$(window).scroll(function() {
    if ( $(window).scrollTop() > amountScrolledForTop ) {
        $('a.back-to-top').fadeIn('slow');
    } else {
        $('a.back-to-top').fadeOut('slow');
    }

    if ( $(window).scrollTop() > amountScrolledForBottom ) {
        $('a.back-to-bottom').fadeIn('slow');
    } else {
        $('a.back-to-bottom').fadeOut('slow');
    }
});


$('a.back-to-top').click(function() {
    $('html, body').animate({
