﻿$(function() {
    var scrollDiv = document.createElement('div');
    $(scrollDiv).attr('id', 'gotoTop').html('^ Back to Top').appendTo('body');
    $(window).scroll(function() {
        if (jQuery(this).scrollTop() != 0) {
            jQuery('#gotoTop').fadeIn();
        } else {
            jQuery('#gotoTop').fadeOut();
        }
    });
    $('#gotoTop').click(function() {
        $('body, html').animate({
            scrollTop: 0
        },
			        800);
    });
});
