﻿// JScript File
//REQUIRES: libPagRef.js

var intScroll = null; 

function scrollingDetector() {  
    try{
    var y_final = (posTop() - objTop('divRel'));
    
    if (y_final > 0)
        moveObjToY('divScroll',(y_final + 10) + 'px');
    else //y_final <= 0
        moveObjToY('divScroll', 0 + 'px');
    }
    catch(err){}
}

//Alert to confirm the result of the operations
function OnClientClose(oWnd)
{
    var arg = oWnd.argument;
    if (arg){
        radalert(arg.return_msg,300, 100,arg.sender_aspx);    
    }
    
    //I cleanup...
    //NOTE: I remove the event and argument cause they accumulate. 
    //If I didn't then those events and args would apply for the next requests
    //for the oWnd
    if(oWnd){
        oWnd.argument = null;
        oWnd.setUrl("about:blank"); // Sets url to blank 
        oWnd.remove_close(OnClientClose); 
    }   
}


function showWhiteBG(divID){
    var div = new getObj(divID).obj; 
    if (div)
        div.style.background = '#FFFFFF';
}

function showLYellowBG(divID){
    var div = new getObj(divID).obj; 
    if (div)
        div.style.background = '#FFFFCC';
}

window.onscroll = scrollingDetector;