// 2010-03-10, 2010-10-23
// change the position of a “div#x0648e” element.

var posY=300; // verticle position from the top of the page
var chasingFactor = .05; // the closing-in factor to desired position per update
var updateFrequency=50; //milisecond
var idleCheckFrequency=1 * 1000 ; //milisecond

var yMoveTo=0;
var ydiff=0;

var g=document.getElementById("x0648e");
g.style.position="absolute";
g.style.zIndex="2";
g.style.top="50%";
g.style.left="1ex";
g.style.fontSize="7ex";
g.style.color="red";

function ff(){
    // compute the distance user has scrolled the window
    if (navigator.appName == "Microsoft Internet Explorer") {
        ydiff = yMoveTo - document.documentElement.scrollTop;
    } else {
        ydiff = yMoveTo - window.pageYOffset;
    }
    if ( Math.abs(ydiff) > 9) {
        yMoveTo -= Math.round(ydiff*chasingFactor);
        g.style.top  = (yMoveTo+posY).toString() + "px" ;
        setTimeout("ff()", updateFrequency);
    } else {
        setTimeout("ff()", idleCheckFrequency);
    }
}

window.onload = ff;
