ar currentFrozenTable;
    var oldLeftTableHandlerCleanup;
    var oldRightTableHandlerCleanup;
    var oldFrozenTableHandlerCleanup;
    var leftOffset;
    var rightOffset;
    var frozenOffset;

    function buildTable(tableElement, table) {
        //build a simple table in the dom after removing the old one
        while (tableElement.hasChildNodes()) {
            tableElement.removeChild(tableElement.lastChild);
        }
        var header = document.createElement('thead');
        var headerRow = d