<!--
hausName = new Array();
hausName[1] = "Casa unifamiliare, nuova costruzione";
hausName[2] = "Casa unifamiliare, vecchia costruzione";
hausName[3] = "Casa plurifamiliare, nuova costruzione";
hausName[4] = "Casa plurifamiliare, vecchia costruzione";
hausName[5] = "Casa unifamiliare o plurifamiliare, standard Minergie";

hausValue = new Array(0,97,135,100,150,42);
fmin = new Array(0,100,100,500,500,100);
fmax = new Array(0,500,500,3000,3000,3000);


function doCalculation() {
	var s = true;
	var f = document.kilowattform.flaeche.value;
	if(isNaN(f) || f == "") {
		document.getElementById('showResult').innerHTML = "<br /><b>Errore:</b><br />la superficie deve essere un valore numerico!";
		s = false;
	} else {	
		for (var i=0; i < document.kilowattform.haustyp.length; i++) {
   			if (document.kilowattform.haustyp[i].checked) {
				var key = document.kilowattform.haustyp[i].value;
				if(fmin[key] <= f && f <= fmax[key]) {
      				var h = hausValue[key];
					var t = hausName[key]+", " + f + " m&sup2;";
				} else {
					document.getElementById('showResult').innerHTML = "<br /><b>Valore al di fuori del campo ragionevole.</b><br />Digitare un valore compreso tra  " + fmin[key] + " e " + fmax[key] + " m&sup2;.";
					s = false;
				}
    		}
   		}
	}
	if(s) {
		kwh = f*h;
		kw = Math.round((kwh*0.65)/180);
		kw2 = kw/10;
		document.getElementById('showResult').innerHTML = "<br /><b>Risultato:</b><br />" + t + "<br />Fabbisogno termico annuo in kWh: " + kwh + "<br />Potenza richiesta del generatore di calore in kW: " + kw2;
	}
}
//-->
