

/* This function is called when the document body is resized: */
function bodyResize() {
	/* Set webpage to at least full window height: */
	var sumComplementHeight = 164;

	if (window.innerHeight) {	// NS
		document.getElementById('id_td_left').height = window.innerHeight - sumComplementHeight;
	}
	else if (document.all.clientHeight) {	// IE before v7
		document.getElementById('id_td_left').height = document.body.clientHeight - sumComplementHeight;
	}
	else if (document.documentElement.clientHeight) {	// IE7
		document.getElementById('id_td_left').height = document.documentElement.clientHeight - sumComplementHeight;
	}
}


/* Compute BMI: */
function computeBMI(obj) {
	with(Math) {
		g=eval(obj.gewicht.value);
		l=eval(obj.lengte.value);
		
		if (g >= 200) { alert ("u weegt te veel"); obj.gewicht.focus();return false;}
		if (l >= 2.2) { alert ("Dat is wel erg lang, controleert u a.u.b. uw lengte bijvoorbeeld 1.76"); obj.lengte.focus(); }

		a1 = g * 1.0 / (l*l);

		qindex=(round(10*a1)) / 10.0;
		if (qindex<20) {waarde="Mager";}
		if (qindex>=20 && qindex<25) {waarde="Goed gewicht";}
		if (qindex>=25 && qindex<27) {waarde="Neiging tot overgewicht";}
		if (qindex>=27 && qindex<30) {waarde="Overgewicht";}
		if (qindex>=30) {waarde="Extreem overgewicht";}

		obj.QI.value = qindex;
		obj.w.value = waarde;
	}	
}


