﻿//checks browser
function checkBrowserName(name) {
    var agent = navigator.userAgent.toLowerCase();

    if (agent.indexOf(name.toLowerCase()) > -1) {
        return true;
    }

    return false;
}

//this function calculates the height of the div
function getBottomHeight() {
    var topTillBottom;
    topTillBottom = document.getElementById("wrapper").offsetHeight;

    var totalHeight;

    var margin = 15; //height of the footer element itself and any other element which isn't in #content

    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        totalHeight = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        totalHeight = document.documentElement.clientHeight;
        //margin = 105;
        
        if (typeof (window.XMLHttpRequest) == 'object') {
						//IE7, IE8
						
        }
        else if (typeof (window.XMLHttpRequest) == 'undefined') {
            margin = 0; 
        }

    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        totalHeight = document.body.clientHeight;
    }

    var difference = totalHeight - topTillBottom - margin;
    //alert("DIV offsetHeight: "+topTillBottom+"\nhöhe fenster: "+totalHeight+"\nabstand: "+margin+" \n\n"+difference);
    return difference;
}

//this function assigns the height of the bottom spacer div
function setDivHeight(divId) {
    var mightyDivHeight;
    mightyDivHeight = getBottomHeight();
    if (!isNaN(mightyDivHeight) && mightyDivHeight > 0) {
        document.getElementById(divId).style.height = mightyDivHeight + "px";
    }
}