function calcolatore(b){var a=1;if(b.attivita[0].checked==true){a=1.3}if(b.attivita[1].checked==true){a=1.4}if(b.attivita[2].checked==true){a=1.6}if(b.attivita[3].checked==true){a=1.8}anni=b.anni.value;if(b.anni.value==""){alert("Attenzione, non ci hai detto quanti anni hai!")}else{if(anni<10){alert("Attenzione, questo calcolo non ? attendibile per soggetti di et? inferiore a 10 anni")}else{Maschi=(67+(13.69*b.peso.value)+(5*b.altezza.value)-(6.8*anni))*a;Femmine=(655+(9.59*b.peso.value)+(1.7*b.altezza.value)-(4.7*anni))*a;if(b.sesso[1].checked==true){kcal=Femmine}else{kcal=Maschi}if(b.dormire[0].checked==true){sonno=-100}if(b.dormire[1].checked==true){sonno=0}if(b.dormire[2].checked==true){sonno=70}if(b.dormire[3].checked==true){sonno=140}if(b.dormire[4].checked==true){sonno=210}kcal=(Math.round(kcal+sonno));b.calorie.value=kcal;b.carboidrati.value=(Math.round(kcal*0.15*100))/100;b.proteine.value=(Math.round(kcal*0.0375*100))/100;b.grassi.value=(Math.round(kcal*0.0278*100))/100}}}function resetta(a){a.anni.value="";a.peso.value="";a.altezza.value="";a.calorie.value="";a.carboidrati.value="";a.proteine.value="";a.grassi.value="";a.attivita[0].click();a.sesso[0].click();a.sonno[0].click()}function form_input_is_int(a){return !isNaN(a)&&parseInt(a)==a}function calc(a,b,b){IMC=(Math.round(a/(b*b)));return IMC}function calcolaimc(b){var a=b.peso.value;if(!form_input_is_int(a)){alert("Inserisci un numero intero per il peso");return false}var d=b.altezza.value;if(!form_input_is_int(d)){alert("Inserisci un numero intero per l'altezza");return false}d=d/100;var c=Math.round(a/(d*d));e=document.getElementById("fraseBMI");if(c<=18.5){e.innerHTML="Il tuo BMI rivela che sei probabilmente in condizione di <b>sottopeso</b>. Ti consigliamo di rivolgerti al tuo medico per poter studiare un piano alimentare che aiuti la tua forma fisica"}else{if(c>18.5&&c<=25){e.innerHTML="Con un BMI compreso tra 18.5 e 25 risulti essere <b>normopeso</b>!"}else{if(c>25&&c<=30){e.innerHTML="Secondo il calcolo del BMI, risulti essere <b>sovrappeso</b>. Per riottenere la forma fisica perfetta ti consigliamo di seguire una dieta equilibrata e fare sport almeno 3 volte a settimana"}else{if(c>30&&c<=40){e.innerHTML="Attenzione, il BMI rivela una situazione di <b>forte sovrappeso/obesit&agrave;</b>. Ti consigliamo di seguire una dieta equilibrata e giusta per il tuo organismo e di fare sana attivit&agrave; fisica almeno 3 volte a settimana."}else{if(c>40){e.innerHTML="Attenzione! Il calcolo del tuo BMI rivela una situazione di <b>obesit&agrave; grave</b>. Per evitare anche potenziali rischi alla salute, ti consigliamo di rivolgerti al tuo medico o a uno specialista in nutrizione, che potr&agrave; consigliarti il regime alimentare pi&ugrave; giusto per migliorare la tua forma fisica."}}}}}b.valore.value=c}function resettaimc(a){a.peso.value="";a.altezza.value="";a.valore.value=""}function compute(D){pesi=new Array(0,0.095,0.27,0.031,0.02,0.031,0.095,0.026,0.009,0.03,0.03,0.015,0.048,0.049,0.028,0.057,0.007,0.057,0.076,0.031,0.04,0.028,0.031);var d="tempo";var X="cal";var u=0;var x=D.peso.value;var W=D.tempo1.value;var C=Math.round(W*x*pesi[1]);D.cal1.value=C;var V=D.tempo2.value;var B=Math.round(V*x*pesi[2]);D.cal2.value=B;var U=D.tempo3.value;var A=Math.round(U*x*pesi[3]);D.cal3.value=A;var S=D.tempo4.value;var z=Math.round(S*x*pesi[4]);D.cal4.value=z;var Q=D.tempo5.value;var y=Math.round(Q*x*pesi[5]);D.cal5.value=y;var O=D.tempo6.value;var w=Math.round(O*x*pesi[6]);D.cal6.value=w;var M=D.tempo7.value;var v=Math.round(M*x*pesi[7]);D.cal7.value=v;var K=D.tempo8.value;var t=Math.round(K*x*pesi[8]);D.cal8.value=t;var I=D.tempo9.value;var s=Math.round(I*x*pesi[9]);D.cal9.value=s;var T=D.tempo10.value;var o=Math.round(T*x*pesi[10]);D.cal10.value=o;var R=D.tempo11.value;var n=Math.round(R*x*pesi[11]);D.cal11.value=n;var P=D.tempo12.value;var m=Math.round(P*x*pesi[12]);D.cal12.value=m;var N=D.tempo13.value;var l=Math.round(N*x*pesi[13]);D.cal13.value=l;var L=D.tempo14.value;var k=Math.round(L*x*pesi[14]);D.cal14.value=k;var J=D.tempo15.value;var j=Math.round(J*x*pesi[15]);D.cal15.value=j;var H=D.tempo16.value;var i=Math.round(H*x*pesi[16]);D.cal16.value=i;var G=D.tempo17.value;var h=Math.round(G*x*pesi[17]);D.cal17.value=h;var F=D.tempo18.value;var g=Math.round(F*x*pesi[18]);D.cal18.value=g;var E=D.tempo19.value;var f=Math.round(E*x*pesi[19]);D.cal19.value=f;var r=D.tempo20.value;var c=Math.round(r*x*pesi[20]);D.cal20.value=c;var q=D.tempo21.value;var b=Math.round(q*x*pesi[21]);D.cal21.value=b;var p=D.tempo22.value;var a=Math.round(p*x*pesi[22]);D.cal22.value=a;D.risultato.value=C+B+A+z+y+w+v+t+s+o+n+m+l+k+j+i+h+g+f+c+b+a}function calcsport(b,a,c){calories=(Math.round(b*a*c));return calories}function calcolasport(c){var b=c.peso.value;var a=c.minuti.value;c.aerobica1.value=Math.round(b*a*0.1);c.aerobica2.value=Math.round(b*a*0.13);c.alpinismo.value=Math.round(b*a*0.16);c.ballare1.value=Math.round(b*a*0.053);c.ballare2.value=Math.round(b*a*0.075);c.ballare3.value=Math.round(b*a*0.17);c.baseball.value=Math.round(b*a*0.06);c.boxe.value=Math.round(b*a*0.15);c.bowling.value=Math.round(b*a*0.01);c.calcio.value=Math.round(b*a*0.14);c.camminare1.value=Math.round(b*a*0.05);c.camminare2.value=Math.round(b*a*0.06);c.camminare3.value=Math.round(b*a*0.08);c.camminare4.value=Math.round(b*a*0.09);c.canoa1.value=Math.round(b*a*0.046);c.canoa2.value=Math.round(b*a*0.107);c.canottaggio.value=Math.round(b*a*0.19);c.ciclismo1.value=Math.round(b*a*0.067);c.ciclismo2.value=Math.round(b*a*0.105);c.ciclismo3.value=Math.round(b*a*0.177);c.cyclette1.value=Math.round(b*a*0.06);c.cyclette2.value=Math.round(b*a*0.1);c.corsa1.value=Math.round(b*a*0.22);c.corsa2.value=Math.round(b*a*0.14);c.equitazione1.value=Math.round(b*a*0.14);c.equitazione2.value=Math.round(b*a*0.04);c.equitazione3.value=Math.round(b*a*0.11);c.golf.value=Math.round(b*a*0.09);c.judo.value=Math.round(b*a*0.2);c.karate.value=Math.round(b*a*0.2);c.kendo.value=Math.round(b*a*0.2);c.marcia.value=Math.round(b*a*0.15);c.motociclismo.value=Math.round(b*a*0.14);c.nuoto1.value=Math.round(b*a*0.17);c.nuoto2.value=Math.round(b*a*0.16);c.nuoto3.value=Math.round(b*a*0.13);c.nuoto4.value=Math.round(b*a*0.162);c.nuoto5.value=Math.round(b*a*0.12);c.nuoto6.value=Math.round(b*a*0.17);c.nuoto7.value=Math.round(b*a*0.22);c.pallanuoto.value=Math.round(b*a*0.15);c.pallacanestro.value=Math.round(b*a*0.14);c.pallavolo.value=Math.round(b*a*0.11);c.pattinare.value=Math.round(b*a*0.1);c.pingpong.value=Math.round(b*a*0.07);c.remare1.value=Math.round(b*a*0.12);c.remare2.value=Math.round(b*a*0.1);c.salto1.value=Math.round(b*a*0.16);c.salto2.value=Math.round(b*a*0.2);c.scherma.value=Math.round(b*a*0.08);c.scifondo1.value=Math.round(b*a*0.12);c.scifondo2.value=Math.round(b*a*0.28);c.pesi.value=Math.round(b*a*0.08);c.squash.value=Math.round(b*a*0.14);c.tennis1.value=Math.round(b*a*0.15);c.tennis2.value=Math.round(b*a*0.11);c.arco.value=Math.round(b*a*0.07);c.windsurf.value=Math.round(b*a*0.08);c.yoga.value=Math.round(b*a*0.06)}function resettasport(a){a.peso.value="";a.minuti.value="";a.aerobica1.value="";a.aerobica2.value="";a.alpinismo.value="";a.ballare1.value="";a.ballare2.value="";a.ballare3.value="";a.baseball.value="";a.boxe.value="";a.bowling.value="";a.calcio.value="";a.camminare1.value="";a.camminare2.value="";a.camminare3.value="";a.camminare4.value="";a.canoa1.value="";a.canoa2.value="";a.canottaggio.value="";a.ciclismo1.value="";a.ciclismo2.value="";a.ciclismo3.value="";a.cyclette1.value="";a.cyclette2.value="";a.corsa1.value="";a.corsa2.value="";a.equitazione1.value="";a.equitazione2.value="";a.equitazione3.value="";a.golf.value="";a.judo.value="";a.karate.value="";a.kendo.value="";a.marcia.value="";a.motociclismo.value="";a.nuoto1.value="";a.nuoto2.value="";a.nuoto3.value="";a.nuoto4.value="";a.nuoto5.value="";a.nuoto6.value="";a.nuoto7.value="";a.pallanuoto.value="";a.pallacanestro.value="";a.pallavolo.value="";a.pattinare.value="";a.pingpong.value="";a.remare1.value="";a.remare2.value="";a.salto1.value="";a.salto2.value="";a.scherma.value="";a.scifondo1.value="";a.scifondo2.value="";a.pesi.value="";a.squash.value="";a.tennis1.value="";a.tennis2.value="";a.arco.value="";a.windsurf.value="";a.yoga.value=""};
