﻿// JScript File

var myWidth = 0, myHeight = 0, maxHeight = 380, scroll = 0, marginHeightTop = 0, marginWidthLeft = 0;
var SiteHeight = 566;
var SiteWidth = 797;
var IsSetMaxHeight = true;
function Resize() {
    //alert('resizing');
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    //$("divBackGround").style.height = myHeight;
    //alert('myWidth  ' + myWidth);

    var background = document.getElementById('divBackGround');
    var page = document.getElementById('divPage');
    if (myWidth > SiteWidth) {
        var marginWidth = myWidth - SiteWidth;
        marginWidthLeft = marginWidth / 2;
        //  divMarginLeft
        //   alert('marginWidthLeft1  ' + marginWidthLeft);
        if (background) {
            background.style.width = myWidth;
        }
        if (document.getElementById('divMarginLeft')) {
            document.getElementById('divMarginLeft').style.width = marginWidthLeft + "px";
        }

        if (page) {
            //alert('hallo page.style.marginleft'+page.style.marginLeft );
            page.style.marginLeft = marginWidthLeft + "px";
        }
    }
    else {
        if (background) {
            background.style.width = SiteWidth;
        }
        if (document.getElementById('divMarginLeft')) {
            document.getElementById('divMarginLeft').style.width = "0px";
        }
    }
    var divBackGroundHeight = getElementHeight("divBackGround");
    var divPageHeight = getElementHeight("divPage");
    var divContentHeight = getElementHeight("divContent");
    var divContentMainHeight = getElementHeight("divContentMain");
    var divContentMarginHeight = getElementHeight("divContentMargin");
    //alert("divContentHeight = " + divContentHeight);
    //alert("divContentMainHeight = " + divContentMainHeight);
    //alert("divContentMarginHeight = " + divContentMarginHeight);
    var divHeaderHeight = getElementHeight("divHeader");
    var divFooterHeight = getElementHeight("divFooter");
    //alert('divBackGroundHeight  ' + divBackGroundHeight);
    //alert('divPageHeight  ' + divPageHeight);
    //alert('background.style.height  ' + document.getElementById('divBackGround').style.height);
    
    
    
    
    //SET BACKGROUND;
    if (divPageHeight > myHeight) {
        background.style.height = divPageHeight + 75 + "px";
        //alert('background.style.height  ' + background.style.height);
    }
    else {
        background.style.height = myHeight + "px";
    }
    
    //SET CONTENTHEIGHT IF ( divPageHeight < myHeight)

    var headerFooterHeight = divHeaderHeight + divFooterHeight + 75;
    var temp = headerFooterHeight + divContentMainHeight;
    if (temp < myHeight) 
    {
        //$("divContentMargin").style.height = myHeight - headerFooterHeight - divContentMainHeight + "px";
        if (myHeight < 800) {
            //alert('hier');
            $("divContentMargin").style.height = 800 - headerFooterHeight - divContentMainHeight + "px";
        }
        else {
            //alert('else');
            $("divContentMargin").style.height = myHeight - headerFooterHeight - divContentMainHeight + "px";
        }
    }
    
    
    
    var temp1 = getElementHeight("divContentMargin") + divContentMainHeight - 163;
    $("divMarginMenu").style.height = getElementHeight("divContentMargin") + divContentMainHeight - 163 + "px";
 


    $("divPage").style.zIndex = "1";
    $("divBackGround").style.zIndex = "0";

}

window.onload = Resize;
window.onresize = Resize;
//window.onrefresh = SetNotifysOnTrue()

function getElementHeight(Elem) {
    //	if (ns4) {
    //		var elem = getObjNN4(document, Elem);
    //		return elem.clip.height;
    //	} else {
    if (document.getElementById) {
        var elem = document.getElementById(Elem);
    } else if (document.all) {
        var elem = document.all[Elem];
    }
    //		if (op5) { 
    //			xPos = elem.style.pixelHeight;
    //		} else {
    xPos = elem.offsetHeight;
    //		}
    return xPos;
    //} 
}

function getElementWidth(Elem) {
    //	if (ns4) {
    //		var elem = getObjNN4(document, Elem);
    //		return elem.clip.width;
    //	} else {
    if (document.getElementById) {
        var elem = document.getElementById(Elem);
    } else if (document.all) {
        var elem = document.all[Elem];
    }
    //		if (op5) {
    //			xPos = elem.style.pixelWidth;
    //		} else {
    xPos = elem.offsetWidth;
    //	}
    return xPos;
    //}
}


