function top_now(id){
    //var br=document.getElementById(id).getBoundingClientRect();
    var br=document.getElementById('point').getBoundingClientRect();
    var dive = document.getElementById(id);
    var point = document.getElementById('point');
    var maxx = document.getElementById('right_panel').clientHeight-91;
    if(br.top <= 0){
        dive.style.position = 'fixed';
        dive.style.top = ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) )+'px';
        dive.style.top = '0px';
    }
    
    if(br.top > 0 && dive.clientHeight-br.top < maxx){
        dive.style.position = '';
        dive.style.top = '91px';
    }
    
    document.getElementById('data').innerHTML = dive.clientHeight-br.top+' > '+maxx+' | Div.Top = '+dive.style.top;
    if(dive.clientHeight-br.top > maxx){
        if(dive.style.position == 'fixed'){
            dive.style.position = 'absolute';
            dive.style.top = (-br.top)+'px';
            alert(-br.top+'px');
        }
    }

}

var timerOnce = window.setInterval("top_now('ads')", 10);
