//Manuel Villanueva

function mer(form) {

if (form.D1.selectedIndex == 1) {
   
//calculates weight using kg
var answer = Math.pow(form.wt.value,0.75) * 132;
var lessactive = (Math.pow(form.wt.value,0.75) * 132) * .8;
var preglo = (Math.pow(form.wt.value,0.75) * 132) * 1.1;
var preghi = (Math.pow(form.wt.value,0.75) * 132) * 1.6;
var lomilk = (Math.pow(form.wt.value,0.75) * 132) * 2;
var himilk = (Math.pow(form.wt.value,0.75) * 132) * 4;
var pup80to100 = (Math.pow(form.wt.value,0.75) * 132) * 1.2;
var lotemp = (Math.pow(form.wt.value,0.75) * 132) * 1.25;
var modwork = (Math.pow(form.wt.value,0.75) * 132) * 1.4;
}

//calculates weight using lbs
else {
var answer = Math.pow(form.wt.value/2.2,0.75) * 132;
var lessactive = (Math.pow(form.wt.value/2.2,0.75) * 132) * .8;
var preglo = (Math.pow(form.wt.value/2.2,0.75) * 132) * 1.1;
var preghi = (Math.pow(form.wt.value/2.2,0.75) * 132) * 1.6;
var lomilk = (Math.pow(form.wt.value/2.2,0.75) * 132) * 2;
var himilk = (Math.pow(form.wt.value/2.2,0.75) * 132) * 4;
var pup80to100 = (Math.pow(form.wt.value/2.2,0.75) * 132) * 1.2;
var lotemp = (Math.pow(form.wt.value/2.2,0.75) * 132) * 1.25;
var modwork = (Math.pow(form.wt.value/2.2,0.75) * 132) * 1.4;
}

form.answer.value = Math.round(answer);   
form.lessactive.value = Math.round(lessactive);
form.preg1st5wks.value = Math.round(answer); 
form.preglo.value = Math.round(preglo);  
form.preghi.value = Math.round(preghi);  
form.lomilk.value = Math.round(lomilk); 
form.himilk.value = Math.round(himilk); 
form.logrowth.value = Math.round(lomilk);
form.higrowth.value = Math.round(himilk);
form.pup50to80.value = Math.round(preghi);
form.pup80to100.value = Math.round(pup80to100);
form.lotemp.value = Math.round(lotemp);
form.hitemp.value = Math.round(lomilk);
form.lowork.value = Math.round(preglo);
form.modwork.value = Math.round(modwork);
form.loheavywork.value = Math.round(lomilk);
form.hiheavywork.value = Math.round(himilk);

//if statements--
if((form.wt.value==null)||(form.wt.value=="")||(isNaN(form.wt.value))){
alert('Please enter a weight with numbers and or periods only. All other characters are not allowed');
form.wt.focus();
form.wt.select();
return false
}
}
