/**
 * Rivet Software Inc.
 *
 * @copyright Copyright � 2006-2007 Rivet Software, Inc. All rights reserved.
 *
 */

/**
 * Allows a screen object (div, iframe, etc.) to be sized based on the
 * viewable screen height. This version applies to an id.
 * 
 * Attach to the body 'onload' and 'onresize' events 
 * 
 * @param {Object} objId
 * @param {Object} adjustment in pixels (usually negative)
 */
function setObjectHeight(objId, adjustment) {
    
    var objEl = document.getElementById(objId);

    if(objEl) {
        objEl.style.height = "auto"; // Helps resize (for some) if new doc shorter than previous
        var h = getWindowSize();
        var new_h = (h + adjustment);
        objEl.style.height = new_h + "px";
    }
}

/**
 * Returns the true viewable height of the current window
 */
function getWindowSize() {
    
    var myHeight = 0;

    if(typeof(window.innerWidth) == 'number') {
        // Non-IE
        myHeight = window.innerHeight;
    } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        // IE 6+ in 'standards compliant mode'
        myHeight = document.documentElement.clientHeight;
    } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
        // IE 4 compatible
        myHeight = document.body.clientHeight;
    }
    //alert('Height = '+myHeight); // Echo window height setting - for debug

    return myHeight;
}

/** $Author:$ * $Date:$ * $Rev:$ **/
