(function($) {
	$(document).ready( function() {
		var b = $('#backToTop');
		b.css({opacity:0});

		$(window).scroll(function() {
			if ($(this).scrollTop() > 100) {
				b.stop().css({
					display: 'block'
				}).animate({
					opacity: 1
				}, 200);
			} else {
				b.stop().animate({
					opacity: 0
				}, 200, function() {
					$(this).css({
						display: 'none'
					});
				});
			}
		});

		b.click(function() {
			$('body,html').animate({
				scrollTop: 0
			}, 800);
			return false;
		});
	});
})(jQuery);
