﻿if (!Prok) { var Prok = {}; }
if (!Prok.UIHelpers) { Prok.UIHelpers = {}; }
/// This object helps handling height for elements to the bottom of the page

Prok_UIHelpers_ScrollHelper = function () {

    let _elementCollection = {};

    $(document).ready(function () {
        $(window).on("resize", function () {
            _recalculateHeight();
        });
        _recalculateHeight();
    });

    _recalculateHeight = function () {
        for (let elementId in _elementCollection) {
            _setElementHeight(elementId, _elementCollection[elementId]);
        }
    }


    _setElementHeight = function(elementId, offset) {
        let elementHeight = window.innerHeight - offset; // $(elementId).offset().top;
        $(elementId).css("height", elementHeight + "px");
    }

    _setScrollElement = function (elementId, offset) {
        if (offset === undefined || offset === null || isNaN(offset)) {
            offset = 0;
        }
        _elementCollection[elementId] = offset;
        _recalculateHeight();
    }


    return {
        SetScrollElement: _setScrollElement
    }
}();

//let elementHeight = window.innerHeight - $("#controlesDigitalizacion table").offset().top;
//$("#controlesDigitalizacion table").css("height", elementHeight + "px");