// Function to figure out how far the user has scrolled
function getScroll() {
   
   // Netscape
   if (window.pageYOffset) {
      return window.pageYOffset;
   }

   // Internet Explorer 6
   if (document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
      return document.documentElement.scrollTop;
   }

   // Firefox + Internet Explorer
   if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
      return document.body.scrollTop;
   }
}

window.onscroll = function() {
   // Find our pop-up box
   var box = document.getElementById("message");

   // Find out how far down the user has scrolled
   var scroll = parseInt(getScroll());
   if (scroll > 0) {
      // Place the box as far down as the user has scrolled.
      box.style.top = scroll + "px";
   }
}