// JScript source code
var Kyf=new Object;
Kyf.apply=function(destEl,srcEl){
    if(typeof destEl!="object"||typeof srcEl!="object")return;
    for(var it in srcEl){
        destEl[it]=srcEl[it];
    }
}
Kyf.each=function(queue,callback){
    for(var i=0,item=null;item=queue[i];i++){
        if(typeof callback(item,i,queue)===false)return;
    }
}
Kyf.$=function(id){return typeof id=="string"?document.getElementById(id):id;}
Kyf.Timer=(function(){
    var thread=new Array,
        state="stop",
        duration=1,
        run=function(){
            if(state=="run")return;
            state="run";
            (function(){
                var arg=arguments;
                setTimeout(function(){
                    if(state!="pause"){
                        Kyf.each(thread,function(fn,index){
                            if(typeof fn()===false)thread=thread.slice(0,index-1).concat(thread.slice(index+1));
                        });
                    }
                    if(thread.length>0)arg.callee.call();
                },duration);
            })();
    };
    
    return {
        add:function(fn){
            if(fn.length){
                Kyf.each(fn,function(it){
                    Kyf.Timer.add(it);
                });
                return;
            }
            thread.push(fn);
            run();
        },
        stop:function(){
            state="pause";
        },
        restart:function(){
            state="run";
        }
    };
})();

var lastScrollY=0;
var fn1=function(){
    var style=Kyf.$("ad").style;

    var top=document.documentElement.scrollTop;
    if(lastScrollY!=top){
        var percent=.1*(top-lastScrollY);
        if(percent>0){
            percent=Math.ceil(percent);
        }else{
            percent=Math.floor(percent);
        }
        style.top=parseInt(style.top)+percent;
        lastScrollY+=percent;
    }
    
}

Kyf.Timer.add([fn1]);


