$(function() {
var toPagetop = $('#pagetop');
toPagetop.hide();
$(window).scroll(function() {
if ($(this).scrollTop() > 80) {
toPagetop.fadeIn();
} else {
toPagetop.fadeOut();
}
});
toPagetop.click(function() {
$('body,html').animate({
scrollTop: 0
}, 500);
return false;
});
});