function check(){
var dato;
	if (document.frm_calorias.txt_objetivo.value == "0") {
		alert("Debes proponerte un objetivo de calorías");
		} else {
		sumatoria();
	}
}
function sumatoria(){
	var total,v_leches,v_verduras,v_frutas,v_harinas,v_granos,v_carnes,v_grasas,v_azucares,v_azucar,v_azucar2,v_mantequilla,v_objetivo,v_cant_leches,v_cant_verduras,v_cant_frutas,v_cant_harinas,v_cant_granos,v_cant_carnes,v_cant_azucares,v_cant_azucar,v_cant_mantequilla,v_total_leches,v_total_verduras,v_total_frutas,v_total_harinas,v_total_granos,v_total_carnes,v_total_grasas,v_total_azucares;
	v_azucar=0;
	v_azucar2=0;
	v_mantequilla=0;
	if(document.frm_calorias.chk_azucar.checked){
	v_azucar=parseInt(document.frm_calorias.chk_azucar.value);
	}
	if(document.frm_calorias.chk_azucar2.checked){
	v_azucar2=parseInt(document.frm_calorias.chk_azucar2.value);
	}
	if(document.frm_calorias.chk_mantequilla.checked){
	v_mantequilla=parseInt(document.frm_calorias.chk_mantequilla.value);
	}
	v_leches=parseInt(document.frm_calorias.lst_leches.value);
	v_cant_leches=parseInt(document.frm_calorias.lst_cant_leches.value);
	v_verduras=parseInt(document.frm_calorias.lst_verduras.value);
	v_cant_verduras=parseInt(document.frm_calorias.lst_cant_verduras.value);
	v_frutas=parseInt(document.frm_calorias.lst_frutas.value);
	v_cant_frutas=parseInt(document.frm_calorias.lst_cant_frutas.value);
	v_harinas=parseInt(document.frm_calorias.lst_harinas.value);
	v_cant_harinas=parseInt(document.frm_calorias.lst_cant_harinas.value);
	v_granos=parseInt(document.frm_calorias.lst_granos.value);
	v_cant_granos=parseInt(document.frm_calorias.lst_cant_granos.value);
	v_carnes=parseInt(document.frm_calorias.lst_carnes.value);
	v_cant_carnes=parseInt(document.frm_calorias.lst_cant_carnes.value);
	v_grasas=parseInt(document.frm_calorias.lst_grasas.value);
	v_cant_grasas=parseInt(document.frm_calorias.lst_cant_grasas.value);
	v_azucares=parseInt(document.frm_calorias.lst_azucares.value);
	v_cant_azucares=parseInt(document.frm_calorias.lst_cant_azucares.value);
	if (document.frm_calorias.lst_cant_leches.value == "0") {
		v_total_leches=v_leches;
		} else {
		v_total_leches=(v_leches+v_azucar)*v_cant_leches;
	}
	if (document.frm_calorias.lst_cant_verduras.value == "0") {
		v_total_verduras=v_verduras;
		} else {
		v_total_verduras=v_verduras*v_cant_verduras;
	}
	if (document.frm_calorias.lst_cant_frutas.value == "0") {
		v_total_frutas=v_frutas;
		} else {
		v_total_frutas=v_frutas*v_cant_frutas;
	}
	if (document.frm_calorias.lst_cant_harinas.value == "0") {
		v_total_harinas=v_harinas;
		} else {
		v_total_harinas=(v_harinas+v_mantequilla)*v_cant_harinas;
	}
	if (document.frm_calorias.lst_cant_granos.value == "0") {
		v_total_granos=v_granos;
		} else {
		v_total_granos=(v_granos+v_azucar2)*v_cant_granos;
	}
	if (document.frm_calorias.lst_cant_carnes.value == "0") {
		v_total_carnes=v_carnes;
		} else {
		v_total_carnes=v_carnes*v_cant_carnes;
	}
	if (document.frm_calorias.lst_cant_grasas.value == "0") {
		v_total_grasas=v_grasas;
		} else {
		v_total_grasas=v_grasas*v_cant_grasas;
	}
	if (document.frm_calorias.lst_cant_azucares.value == "0") {
		v_total_azucares=v_azucares;
		} else {
		v_total_azucares=v_azucares*v_cant_azucares;
	}
	total=v_total_leches+v_total_verduras+v_total_frutas+v_total_harinas+v_total_granos+v_total_carnes+v_total_grasas+v_total_azucares+v_azucar+v_azucar2+v_mantequilla;
	//alert(total+" CalorÃ­as");
	v_objetivo=parseInt(document.frm_calorias.txt_objetivo.value);
	if(total<=v_objetivo){
		document.frm_calorias.txt_msg.value="Felicitaciones!!";
		} else {
		document.frm_calorias.txt_msg.value=(total-v_objetivo)+" Kcal";
		}
		document.frm_calorias.txt_total.value=total+" KCal";
		v_azucar=0;
		v_azucar2=0;
		v_mantequilla=0;
}