function arvuta() {

	var p = parseFloat(document.getElementById("pp").value);
	var k = parseFloat(document.getElementById("kk").value);
	
	if(isNaN(p) == true)
		{
			p = 0;
		}	
		
	if(isNaN(k) == true)
		{
			k = 0;
		}	
	
	if(p>40 && k>10)
		{
				
				var ind = Math.round( (k / ((p * p)/10000))*10 ) / 10;
				
				document.getElementById("ind").value = ind;
				
				if(p<1)
					document.getElementById("pp").value = '';
				if(k<1)
					document.getElementById("kk").value = '';
				
					
				if (ind < 18.5)
					tt = "Alakaal";
				else if (ind < 25)
					tt = "Normaalkaal";
				else if (ind < 30)
					tt = "Väike ülekaal";
				else if (ind < 35)
					tt = "Ülekaal";
				else if (ind < 40)
					tt = "Oluline rasvumine";
				else if (ind >= 40)
					tt = "Tervisele ohtlik rasvumine";
					
					
				document.getElementById("kat").value = tt;
		}
	else
		{
		document.getElementById("ind").value = '';
		document.getElementById("kat").value = '';
		}
		
	return true;
}

