/* fuer den blauen Hintergrund im Container ads,
 * der durch den Container eintraegeAds generiert wird,
 * wenn eine kurze Seite aufgerufen wird und der Fuss trotzdem am Ende der Seite steht
 */ 

/* globale Variablen */
var origincontentHeight; // speichert die urspruengliche Hoehe ohne Suchmaske
var origtotalHeight; // speichert die urspruengliche komplette Hoehe, nur fuer IE

/*  contopen = Anzeige eines Containers im geoeffneten Zustand, der sich wieder schliessen laesst, z.B. Hinweise, optional */

function checkHeight(contopen) {
	var theDiff;
	var totalHeight;
	var theScrollHeight;
	var contentHeight;
	var suchmaskeHeight = document.getElementById("suchmaske").offsetHeight;
	var eintraegeAdsHeight = document.getElementById("eintraegeAds").offsetHeight;
	if (document.getElementById("bg_druckPdf")) {
		var druckPdfHeight = document.getElementById("bg_druckPdf").offsetHeight;
		if (contopen != "open") {
			origincontentHeight = eintraegeAdsHeight + druckPdfHeight + 35;
		} 
		contentHeight = suchmaskeHeight + eintraegeAdsHeight + druckPdfHeight + 35;
	} else {
		if (contopen != "open") {
			origincontentHeight = eintraegeAdsHeight;
		}
		contentHeight = suchmaskeHeight + eintraegeAdsHeight;
	}
	if (navigator.appName == "Microsoft Internet Explorer") {
		totalHeight = document.body.clientHeight;
		theScrollHeight = document.body.scrollHeight;
		if (contopen != "open") {
			origtotalHeight = totalHeight;
		}
	} else {
		totalHeight = window.innerHeight;
		theScrollHeight = window.document.height;
	}
	/* Abfragen, ob Scrollbars vorhanden sind
	if (theScrollHeight > totalHeight) {
		alert("hat Scrollbars");
	} else {
		alert("hat keine Scrollbars");
	} */
	if (totalHeight > contentHeight) {
		if (contopen == "open") {
			if (navigator.appName == "Microsoft Internet Explorer") {
				theDiff = origtotalHeight - (origincontentHeight + suchmaskeHeight) - 35;
				//alert("Total: " + origtotalHeight + " OrigHeight: " + origincontentHeight + " Suchmaske: " + suchmaskeHeight);
			} else {
				theDiff = totalHeight - (origincontentHeight + suchmaskeHeight) - 35;
			}
		} else {
			theDiff = totalHeight - contentHeight - 35;
		}
		/* weiterer IE6-Bug: Der Container muss einmal "bewegt" werden */
		if (navigator.appVersion.indexOf("MSIE 6")) {
			document.getElementById("eintraegeAds").style.paddingBottom = 10 + "px";
		}
		document.getElementById("eintraegeAds").style.paddingBottom = theDiff + "px";
	}
}

