original_width = 0;
original_height = 0;

function display_forum()
{
    if( xGetElementById('forums-div') )
    {
        frame_div = xGetElementById('forums-div');

        var source = xGetElementById('server-path').value+"/phpbb2/index.php";

        if( xGetElementById('forum-id').value != "" )
        {
            source = xGetElementById('server-path').value + "/phpbb2/viewforum.php?f="+xGetElementById('forum-id').value;
        }

        if( xGetElementById('article-id').value != "" )
        {
            source = xGetElementById('server-path').value + "/phpbb2/viewtopic.php?t="+xGetElementById('article-id').value;
        }

        innerHTML = "<iframe id='forums-iframe' src='"+source+"' frameborder='no'></iframe>";

        frame_div.innerHTML = innerHTML;

        frame = xGetElementById('forums-iframe');

        frame_main = xGetElementById('main-right');
        
        w_diff = (xWidth(frame_main) - xWidth(frame_div));
        h_diff = parseInt(xHeight(frame_main)) - parseInt(xHeight(frame_div));
                    
        xTop(frame,xPageY(frame_main));
        xLeft(frame,xPageX(frame_main));
        xWidth(frame,813);
        xHeight(frame,540);
    }
}

function resize_iframe()
{
    frame_main = xGetElementById('main-right');
    frame_div = xGetElementById('forums-div');
    frame = xGetElementById('forums-iframe');

    if( original_width != xClientWidth() )
    {
        adjust_width = original_width - xClientWidth();
        xWidth(frame,xWidth(frame)-adjust_width);
        original_width = xClientWidth();
    }

    if( original_height != xClientHeight() )
    {
        adjust_height = original_height - xClientHeight();

        xHeight(frame,xHeight(frame)-adjust_height);

        original_height = xClientHeight();
    }
}

function init_window()
{
    //xAddEventListener(window,'resize',resize_iframe,false);
    original_width = xClientWidth();
    original_height = xClientHeight();
    setTimeout("display_forum()",300);
}

xAddEventListener(window,'load',init_window,false);