var detect = navigator.userAgent.toLowerCase();
var browser,total,thestring;

function DetectBrowser() {
	if (checkIt('konqueror')) {
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser = "safari"
	else if (checkIt('opera')) browser = "opera"
	else if (checkIt('msie')) browser = "ie"
	else if (!checkIt('compatible')) {
		browser = "netscape"			
	}
	else browser = "unknown";
	
	return browser;
}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

window.onload = function sameHeight() {
	// get all the div wrapper
	var header = document.getElementById("header");
	var content = document.getElementById("contentwrap");
	var footer = document.getElementById("footerwrap");
		
	// Detect the browser, because ie and firefox have a different value
	var browser = DetectBrowser();

	// sum all content height
	var contentHeight = header.offsetHeight + content.offsetHeight + footer.offsetHeight;

	// get the body height.
	var bodyHeight = document.documentElement.clientHeight;
	if (browser == 'opera') {
		var bodyHeight = document.body.clientHeight;
	}

	if (contentHeight < bodyHeight) {
		var selisih;
		if (browser == 'ie') {
			selisih = selisih - 35;
		} else {
			selisih = selisih - 35;
		}
		selisih = bodyHeight - contentHeight;
		content.style.height = content.offsetHeight + selisih +"px";
	}
}