
//<![CDATA[

var scrollTimer = null;

$(window).scroll(function() {
 var viewportHeight = $(this).height(),
 scrollbarHeight = viewportHeight / $(document).height() * viewportHeight,
 progress = $(this).scrollTop() / ($(document).height() - viewportHeight),
 distance = progress * (viewportHeight - scrollbarHeight) + scrollbarHeight / 2 - $('#scrollbubble').height() / 2
 ;

 $('#scrollbubble')
 .css('top', distance)
 .text('content scrolled (' + Math.round(progress * 100) + '%)')
 .fadeIn(100)
 ;

 // Fade out the annotation after 1 second of no scrolling.
 if (scrollTimer !== null) {
 clearTimeout(scrollTimer);
 }
 scrollTimer = setTimeout(function() {
 $('#scrollbubble').fadeOut();
 }, 1500);//it was 1000
});
//]]>




