﻿
function RecalcLayout()
{
    EnableMaster();
    
    RecalcHeight();
    RecalcWidth();
}

function EnableMaster()
{
    var pane = document.getElementById("paneMaster");
    if (pane)
    {
        pane.style.visibility = 'visible';
    }
}

function RecalcHeight()
{
    var height1 = 500;
    
    if (window.innerHeight)
    {
        // netscape
        height1 = window.innerHeight;
    }
    else if (document.body && document.body.offsetHeight)
    {
        // z.B. IE 5
        height1 = document.body.offsetHeight;
    }
    else
    {
        // neuere browser
        height1 = document.documentElement.clientHeight;
    }
    
    var heightHeader = document.getElementById("m_header").offsetHeight;
    var heightFooter = document.getElementById("m_footer").offsetHeight;
    
    var o = document.getElementById("m_client");
    
    
    var height = (height1 - heightHeader - heightFooter - 0); 
    if (height < 50)
    {
        height = 50;
    }
    
    document.getElementById("m_navigationMenu").style.height = height + "px";
    document.getElementById("m_client").style.height = height-28 + "px";    // Ränder abziehen

}

function RecalcWidth()
{
    var width1 = 700;
    
     if (window.innerWidth)
    {
        // netscape
        width1 = window.innerWidth;
    }
    else if (document.body && document.body.offsetWidth)
    {
        // z.B. IE 5
        width1 = document.body.offsetWidth;
    }
    else
    {
        // neuere browser
        width1 = document.documentElement.clientWidth;
    }

    var main = document.documentElement;
    var widthNavigation = document.getElementById("m_navigationMenu").offsetWidth;
    
    var width = (width1 - widthNavigation - 0);
    if (width < 50)
    {
        width = 50;
    }

    width -= 14;    // Ränder abziehen
    var client = document.getElementById("m_client");
    var scrollbarWidth = 20;    //client.offsetWidth - client.clientWidth;
    if (scrollbarWidth < 0)
    {
        scrollbarWidth = 0;
    }
    
    var o = client.childNodes[0];
    if (o != null && o.style)
    {
        if (scrollbarWidth > 0)
            o.style.width = width-scrollbarWidth + "px";    // Platz für Scrollbar
    }
//    else
////    {
//        alert("bingo");
//    }
//    

    document.getElementById("m_client").style.width = width + "px";  
}
