function formatSBP(contentwidth, tablecount) {
    var count = 1;
    var myWidth = 0,
        myHeight = 0;
    if (typeof(window.innerWidth) === 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    var bigMaxWidth = myWidth * 0.85;
    var bigMaxHeight = myHeight * 0.82;

    while (count < tablecount) {
        var bigTableWidth = document.getElementById('table_' + count + '_big').offsetWidth + 50;
        var bigTableHeight = document.getElementById('table_' + count + '_big').offsetHeight + 60;
        document.getElementById('table_' + count + '_big_div').style.display = 'none';
        var fs = 12;
        document.getElementById('table_' + count).style.fontSize = fs + 'px';

        while (document.getElementById('table_' + count).offsetWidth > contentwidth && fs > 2) {
            fs = fs - 1;
            document.getElementById('table_' + count).style.fontSize = fs + 'px';
        }
        fs = fs - 1;
        document.getElementById('table_' + count).style.fontSize = fs + 'px';
        if (fs < 10) {
            document.getElementById('table_' + count + '_mag').style.width = '111px';
            document.getElementById('table_' + count + '_mag').style.height = '15px';
        }
        if (bigTableWidth > bigMaxWidth) {
            bigTableWidth = bigMaxWidth;
        }
        if (bigTableHeight > bigMaxHeight) {
            bigTableHeight = bigMaxHeight;
        }
        document.getElementById('table_' + count + '_big_div').setAttribute('data-modal-width', bigTableWidth + 40);
        document.getElementById('table_' + count + '_big_div').setAttribute('data-modal-height', bigTableHeight + 50);
        count++;
    }
}

