function getCompStyle( elem, styleProp )
{
    if ( elem.currentStyle ) // IE
    {
        var parts = styleProp.split( "-" );
        var ieStyleProp = "";
        for ( var i = 0; i < parts.length; i++ )
        {
            if ( i == 0 )
            {
                ieStyleProp += parts[ i ];
            }
            else
            {
                ieStyleProp += parts[ i ].charAt( 0 ).toUpperCase();
                ieStyleProp += parts[ i ].substr( 1 );
            }
        }
        
        return( elem.currentStyle[ ieStyleProp ] );
    }
    else if ( window.getComputedStyle )
    {
        return( window.getComputedStyle( elem, null ).getPropertyValue( styleProp ) );
    }
    
    return( null );
}

function parseBorderWidth( bwStr )
{
    var bw = parseInt( bwStr, 10 );
    
    if ( isNaN( bw ) )
        bw = 0;
    
    return( bw );
}

function getBorderTopWidth( elem )
{
    return( parseBorderWidth( getCompStyle( elem, "border-top-width" ) ) );
}

function getAbsPositionY( tag )
{
    var elem = tag;
    var posY = 0;
    
    while ( elem.offsetParent )
    {
        posY += elem.offsetTop;
        
        if ( elem != tag )
        {
            posY += getBorderTopWidth( elem );
        }
        
        elem = elem.offsetParent;
        //posY -= elem.scrollTop;
    }
    
    //if ( !browser.isIE() )
    //    return( -window.scrollY + posY );
    
    return( posY );
}        

function setMinContentFrameHeight()
{
    var contentFrame = document.getElementById( "contentFrame2" );
    var sidebar = document.getElementById( "sidebar" );
    var teaser = document.getElementById( "teaserbox" );
    
    var minHeight = sidebar.offsetHeight;
    minHeight = Math.max( minHeight, getAbsPositionY( teaser ) - getAbsPositionY( contentFrame ) + teaser.offsetHeight );
    
    if ( contentFrame.clientHeight < minHeight )
    {
        contentFrame.style.height = minHeight + "px";
    }
}

function onBodyLoad()
{
    setMinContentFrameHeight();
}

