﻿
function storeScrollPosition(id) { 
    var top = 0; var left = 0;
    try {
    
        top = document.body.scrollTop;  
        if (top == 0) {
            if (window.pageYOffset)  
                top = window.pageYOffset;  
            else  
                top = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0; 
        }        
        left = document.body.scrollLeft;  
        if (left == 0) {
            if (window.pageXOffset)  
                left = window.pageXOffset;  
            else  
                left = (document.body.parentElement) ? document.body.parentElement.scrollLeft : 0; 
        }        
    } catch(e) {}    
    if (document.getElementById(id))
        document.getElementById(id).value = left + "&" + top;
}

function getScrollPositionLeft(id){
    try {
        var coords = document.getElementById(id).value.split("&");
        if (coords.length > 1)
            return coords[0];
    }catch(e){}
    return 0;
}

function getScrollPositionTop(id){
    try {
        var coords = document.getElementById(id).value.split("&");
        if (coords.length > 1)
            return coords[1];
    }catch(e){}
    return 0;
}
