var active_dialog = null;

function showBlock(block, visible)
{
    switch (visible)
    {
        case true:
            block.style.display = "block";
            return(true);
            
        case false:
            block.style.display = "none";
            return(false);
            
        default:
            if ((block.style.display == "none") || (block.style.display == ""))
            {
                block.style.display = "block";
                return(true);
            }
            else
            {
                block.style.display = "none";
                return(false);
            }
    }
}

function showViewportBlocker(visible)
{
    var vpb = document.getElementById("viewport_blocker");
    
    showBlock(vpb, visible);
    
    vp = new ViewPort();
    
    vpb.style.width = vp.getPixelWidth();
    vpb.style.height = vp.getPixelHeight();
    
    // IE-bugfix
    if (browser == 1)
        vpb.style.filter = "alpha(opacity = 40)";
}

function showDialog(dialog_id)
{
    var dialog = document.getElementById(dialog_id);
    
    if (showBlock(dialog))
    {
        active_dialog = dialog;
        showViewportBlocker(true);
    }
    else
    {
        active_dialog = null;
        showViewportBlocker(false);
    }
    
    vp = new ViewPort();
    
    dialog.style.left = (((vp.getWidth() / 2) - (dialog.clientWidth / 2)) + "px");
    dialog.style.top = (((vp.getHeight() / 2) - (dialog.clientHeight / 2)) + "px");
}

function onViewportBlockerClicked(vpb)
{
}
