if (document.getElementById || document.all) { // minimum dhtml support required
    document.write("<"+"script type='text/javascript' src='/__assets/scripts/xal_core.js'><"+"/script>");
}
function getWindowHeight() {
    var windowHeight = 0;
    if (typeof(window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}
function setContentSize(){
    var cHeight = document.getElementById('inhalt').offsetHeight;
    var lHeight = document.getElementById('bereichsmenu').offsetHeight;
    var rHeight = document.getElementById('rechtsinhalt').offsetHeight;
    var biggestHeight = Math.max(cHeight, Math.max(lHeight, rHeight));
    xHeight('inhalt', biggestHeight);
    xHeight('bereichsmenu', biggestHeight);
    xHeight('rechtsinhalt', biggestHeight);
    //alert(biggestHeight);
}


function setFooter() {
    xShow('fuss');
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {
            var contentHeight = document.getElementById('container').offsetHeight;
            var footerElement = document.getElementById('fuss');
            var footerHeight  = footerElement.offsetHeight;
            if (windowHeight - (contentHeight + footerHeight) >= 0) {
                footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
            }
            else {
                footerElement.style.top = '0px';
            }
        }
    }
}
function setRechtsInhaltPos(){
    var topOfContent = document.getElementById('kopf').offsetHeight;
    alert(topOfContent);
    xTop('rechtsinhalt',topOfContent);
}
function setRechtsExtension(){
    if (xClientWidth()>785){
        window.alert('The window is bigger than 785px.');
        var theWidth = xClientWidth();
        xWidth('kopf_top', theWidth);
        xWidth('hauptnav', theWidth);
        xWidth('kopf_bild', theWidth);
        xWidth('contentheaders', theWidth);
        xWidth('kopf_path', theWidth);
        xWidth('fuss', theWidth);
        xWidth('rititel', (theWidth-645));
    } else {
        window.alert('The window is smaller than 785px.');
        xWidth('kopf_top', 785);
        xWidth('hauptnav', 785);
        xWidth('kopf_bild', 785);
        xWidth('contentheaders', 785);
        xWidth('kopf_path', 785);
        xWidth('fuss', 785);
        xWidth('rititel', 140);
    }
}



//rechts länger alt inhalt
function setInhaltHei() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {
            //var inhaltHeight = document.getElementById('inhalt').offsetHeight;
            var inhaltElement = document.getElementById('inhalt');
            var inhaltHeight  = inhaltElement.offsetHeight;
            var rinhaltHeight = document.getElementById('rechtsinhalt').offsetHeight;
            if (inhaltHeight - rinhaltHeight <= 0) {
            //window.alert('Test11');
                //footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
                //inhaltElement.style.height = '1110px';
                inhaltElement.style.height = rinhaltHeight+20+'px';
            }
            else {
                //footerElement.style.top = '0px';
            }
        }
    }
}

// Inhalt zu klein
function setMinHei() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {
            //window.alert('Test MinHei');
            //var inhaltHeight = document.getElementById('inhalt').offsetHeight;
            var inhaltElement = document.getElementById('inhalt');
            var inhaltHeight  = inhaltElement.offsetHeight;
            var rinhaltHeight = document.getElementById('rechtsinhalt').offsetHeight;
            if (inhaltHeight<= 650) {
            //window.alert('Test MinHei02');
                //footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
                //inhaltElement.style.height = '1110px';
                //inhaltElement.style.height = '675px';
                inhaltElement.style.height = windowHeight-215+'px';
            }
            else {
                //footerElement.style.top = '0px';
            }
        }
    }
}

function Debug() {

window.alert(document.getElementById('inhalt').offsetHeight+'inhalt_Layer_vorhanden');
window.alert(document.getElementById('rechtsinhalt').offsetHeight+'rechtsinhalt_Layer_vorhanden');
}



window.onload = function() {
    //setContentSize();
    //setFooter();
    //setRechtsInhaltPos();
    //setRechtsExtension();
    setInhaltHei();
    setMinHei();
    //Debug();
}
window.onresize = function() {
    //SsetContentSize();
    //setFooter();
    //setRechtsInhaltPos();
    //setRechtsExtension();
    setInhaltHei();
    setMinHei();
}


