window.onload = create_bmr_html;



function create_bmr_html(){

	document.getElementById("gastronomicus_bmr").innerHTML = '<div style="width:180px; border:0px solid #ff6600; padding:3px; font-size: 10px; font-weight: normal; color: ' + gastronomicus_font_color + '; font-family: Arial, Helvetica, sans-serif; background-color: ' + gastronomicus_bg + '"><h1 style="font-size:14px; font-weight:bold; color:#ff6600;">CALCULATOR DE CALORII</h1><form name="gastronomicus_bmr" method="post" action="#"><div><div style="float:left">Greutate(kg):</div><div style="float:right"><input type="text" onkeypress="javascript: calculeaza();" name="gastronomicus_greutate" id="gastronomicus_greutate" size=3 value="60"/></div><div style="clear:both; height:5px; overflow:hidden;"></div></div><div><div style="float:left">Inaltime(cm): </div><div style="float:right"><input type="text" onkeypress="javascript: calculeaza();" name="gastronomicus_inaltime" id="gastronomicus_inaltime" size=3 value="165"  /></div><div style="clear:both; height:5px; overflow:hidden;"></div></div><div><div style="float:left">Varsta(ani): </div><div style="float:right"><input type="text" onkeypress="javascript: calculeaza();" name="gastronomicus_varsta" id="gastronomicus_varsta" size=3 value="30" /></div><div style="clear:both; height:5px; overflow:hidden;"></div></div><div><b>Sex:</b><br/> <input type="radio" onclick="javascript: calculeaza();" name="gastronomicus_sex" id="gastronomicus_sex" value="b" checked>Barbat <input name="gastronomicus_sex" type="radio" onclick="javascript: calculeaza();" id="gastronomicus_sex" value="f">Femeie</div><div><b>Activitate:</b> <br/><input type="radio" onclick="javascript: calculeaza();" name="gastronomicus_activitate" id="gastronomicus_activitate" value="1.2" checked>Sedentar <input type="radio" onclick="javascript: calculeaza();" name="gastronomicus_activitate" id="gastronomicus_activitate" value="1.3">Activitati usoare <input type="radio" onclick="javascript: calculeaza();" name="gastronomicus_activitate" id="gastronomicus_activitate" value="1.4">Activitati moderate <input type="radio" onclick="javascript: calculeaza();" name="gastronomicus_activitate" id="gastronomicus_activitate" value="1.5">Foarte activ</div></form><div align="center"><div id="gastronomicus_rezultat" style="height:20px; font-weight:bold; color:#ff6600; width:100px; background-color:#f4e2b2; border:1px solid #ff6600; margin-top:3px; line-height:20px;">1992 kcal</div><div style="float:right;"><br /><div style="clear:both; height:3px; overflow:hidden;"></div><div style="width:180px;" align="center"><a href="http://www.taebospecial.ro/programepentruacasa.html" target="_blank" title="programe pentru acasa" style="color: #ff6600; font-weight:bold; background-color:#f4e2b2; padding: 3px; text-decoration: none;">programe pentru acasa</a></div>';

}



function calculeaza(){

	bmr=0;

	calorii=0;

	sex='b';

	for(i=0; i<document.gastronomicus_bmr.elements.length; i++){

		if (document.gastronomicus_bmr.elements[i].name=="gastronomicus_sex" && document.gastronomicus_bmr.elements[i].checked){

			sex = document.gastronomicus_bmr.elements[i].value;

		}

	}



	if (sex=='b'){

		bmr = 66 + (13.7 * document.getElementById("gastronomicus_greutate").value) + (5 * document.getElementById("gastronomicus_inaltime").value) - (6.8 * document.getElementById("gastronomicus_varsta").value);

	}

	else{

		bmr = 655 + (9.6 * document.getElementById("gastronomicus_greutate").value) + (1.7 * document.getElementById("gastronomicus_inaltime").value) - (4.7 * document.getElementById("gastronomicus_varsta").value);

	}

	activitate = 0;

	for(i=0; i<document.gastronomicus_bmr.elements.length; i++){

		if (document.gastronomicus_bmr.elements[i].name=="gastronomicus_activitate" && document.gastronomicus_bmr.elements[i].checked){

			activitate = document.gastronomicus_bmr.elements[i].value;

		}

	}

	calorii = bmr * activitate * 1.10;

	document.getElementById("gastronomicus_rezultat").innerHTML = Math.round(calorii) + " kcal";

}