﻿
function setContentHeight() {
    // verfügbare Höhe des Browsers ermitteln
    var browserheight = 0
    if (typeof(window.innerWidth) == 'number') {
        //Non-IE            
        browserheight = window.innerHeight;
    } else if(document.documentElement && document.documentElement.clientHeight) {
        //IE 6+ in 'standards compliant mode'            
        browserheight = document.documentElement.clientHeight;
    } else if(document.body && document.body.clientHeight) {
        //IE 4 compatible
        browserheight = document.body.clientHeight;
    }
    
    // verfügbaren platz ermitteln (- anderer Elemente, Header 375, Bottom 20 + 15)
    var availspace = browserheight - 395;

    // content-div ermitteln
    var tezmain = document.getElementById('tezmain');
    // prüfen ob tezmain ermittelt, bzw. benötigte Eingenschaften unterstützt werden, Höhe von 250 muss min. verfügbar sein
    if (tezmain && tezmain.clientHeight && tezmain.scrollHeight && tezmain.style.height && availspace > 250) {            
                
        //alert('scrollHeight: ' + tezmain.scrollHeight);
        //alert('clientHeight: ' + tezmain.clientHeight);
        //alert('availspace: ' + availspace);
        
        // prüfen ob Scrollbar angezeigt wird
        if (tezmain.scrollHeight > tezmain.clientHeight) {
            // prüfen ob genügend Platz zum Erweitern des divs vorhanden ist
            if (availspace > tezmain.clientHeight && availspace < tezmain.scrollHeight) {
                // max. verfügbare Höhe verwenden
                tezmain.style.height = availspace;
            } else if (availspace > tezmain.scrollHeight) {
                // Höhe lt. Inhalt anpassen
                tezmain.style.height = tezmain.scrollHeight;                    
            }
        }
    }
}
    
function setSkinCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function sizeText(size)
{
    var expire = new Date();
    var addyear = expire.getTime() + (365 * 24 * 60 * 60 * 1000);
    expire.setTime(addyear);

    setSkinCookie("TezSkinTextSize",size, expire,"/");
    location.reload();
}

