﻿function saveScroll() {
    var sScroll;
    if (document.documentElement && document.documentElement.scrollTop)
        sScroll = document.documentElement.scrollTop;
    else if (document.body)
        sScroll = document.body.scrollTop;
    else {
        sScroll = 0;
    }
    $get('ctl00___SAVESCROLL').value = sScroll;
}

function restoreScroll() {
    var sScroll = $get('ctl00___SAVESCROLL').value;
    if ($get('ctl00_skipJump').value != 'true')
        return;
    if (sScroll > 0) {
        if (document.documentElement && document.documentElement.scrollTop)
            document.documentElement.scrollTop = sScroll;
        else if (document.body) {
            if (window.navigator.appName == 'Netscape')
                window.scroll(0, sScroll);
            else
                document.body.scrollTop = sScroll;
        }
        else {
            window.scroll(0, sScroll);
        }
        // here is setting absolute positioning panel, if you need, set correct ID  and uncomment follow 2 lines (and add needed lines/setting for all your panels)
        //if (document.getElementById('pnlNewItem') != null )
        //document.getElementById('pnlNewItem').style.top = sScroll + 'px';
    }
}

//window.onload = restoreScroll;
//window.onscroll = saveScroll;
//window.onresize = saveScroll;
