jQuery(document).ready(function(){
   jQuery(function () {
      var scrollDiv = document.createElement('div');
      jQuery(scrollDiv).attr('id', 'toTop').html('TOP').appendTo('body');    
      jQuery(window).scroll(function () {
         if (jQuery(this).scrollTop() != 0) {
            jQuery('#toTop').fadeIn();
         } else {
            jQuery('#toTop').fadeOut();
         }
      });
      jQuery('#toTop').click(function () {
         jQuery('body,html').animate({
            scrollTop: 0
         },
         800);
         });
      });
});
