window.onload = function () {
    resizeBox();
}
window.onresize = function () {
    resizeBox();
}
resizeBox = function () {
    if (document.getElementById('box_right')) {
        // check if styleNode already added, only once needed ;-)
        var boxRightStyleBox = document.getElementById('box_right_style');

        if (boxRightStyleBox == null) {
            var siteWidth = window.innerWidth || document.body.clientWidth;
            var siteHeight = window.innerHeight || document.body.clientHeight;

            var boxLeft = 805; //900 + (siteWidth-1200)/2;
            var boxWidth = siteWidth - boxLeft;

            /* modified Points 05.08.2010 for Printing capability */

            // create new style node
            var styleNode = document.createElement('style');
            styleNode.setAttribute('type', 'text/css');
            styleNode.setAttribute('id', 'box_right_style');

            // create css
            var boxStyle = '@media screen {';
            boxStyle += ' #box_right {';
            boxStyle += '  width: ' + boxWidth + 'px;';
            boxStyle += '  height: 98%;';
            boxStyle += '  left:' + boxLeft + 'px;';
            boxStyle += '  top: 0px;';
            boxStyle += '  display: block;';
            boxStyle += ' }';
            boxStyle += '}';
            boxStyle += '@media print {';
            boxStyle += ' #box_right {';
            boxStyle += '  display: none;';
            boxStyle += ' }';
            boxStyle += '}';

            if (styleNode.styleSheet) {
                // IE does it this way
                styleNode.styleSheet.cssText = boxStyle
            } else {
                // everyone else does it this way
                // create text node from css
                var textNode = document.createTextNode(boxStyle);
                // add textnode as child of stylenode
                styleNode.appendChild(textNode);
            }

            // get headnode
            var head = document.getElementsByTagName("head")[0];
            // add stylenode as child of headnode
            head.appendChild(styleNode);
        }
    }
    // document.getElementById('box_left').style.display='none'; // there is no box_left element 
}
