function resizeReqFloaty( usePageOffsets )
{
    var lightbox = $(".floaty");
    var nHeight = windowHeight();
    if ( document.body )
        if ( document.body.clientHeight > nHeight )
           nHeight = document.body.clientHeight;

    var nWidth = windowWidth();
    $('.floaty-background').width( nWidth ).height( nHeight );

    var nOffset_top  = 0;
    var nOffset_left = 0;
    if ( usePageOffsets ) 
    {
        var isPortrait = (window.orientation == 0);
        if ( g_isIE )
        {
            nOffset_top  = ! isPortrait ? document.documentElement.scrollTop : document.documentElement.scrollLeft;
            nOffset_left = ! isPortrait ? document.documentElement.scrollLeft : document.documentElement.scrollTop;
        }
        else
        {
            nOffset_top  = isPortrait ? window.pageYOffset : window.pageXOffset;
            nOffset_left = isPortrait ? window.pageXOffset : window.pageYOffset;
        }
    }

    var nTop = ~~( nOffset_top + (windowHeight() - lightbox.height() ) / 2 );
    var nLeft = ~~( nOffset_left + (windowWidth() - lightbox.width() ) / 2 );

    // console_log( "width = " + windowWidth() + ", height = " + nHeight );
    // console_log( "off left = " + nOffset_left + ", off top = " + nOffset_top );
    // console_log( "LB width = " + lightbox.width() + ", LB height = " + lightbox.height() );
    // console_log( "setting to top = " + nTop + ", left = " + nLeft );
    lightbox.css( { top: nTop, left: nLeft } );
}

function openReqFloaty()
{
    // lightboxes require a dark background div, which goes after the lightbox content (but has a lower z-index)
    // destroy any extant background div from any current lightboxes, and create a new one for us
    $(".floaty-background").remove();

    var lightbox = $(".floaty");
    lightbox.addClass( "reqfloaty" );
    lightbox.after( "<div class='floaty-background'></div>" );

    lightbox.addClass( "active" );
    $('.floaty-background').css( 'display', 'block' );
    resizeReqFloaty( true );
};

function closeReqFloaty()
{
    $(".floaty-background").remove();
    $(".floaty").removeClass( "active" );

    return true;
};


