Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function estweight(form){
- var bfactor = 0;
- var i = buttonchoice(form.fishclass);
- var b = buttonselect(form.fishbody);
- var decimals = 2;
- if (form.girth.value < 1){
- var girth_number = 0.58 * form.length.value;
- var girth1 = girth_number * Math.pow(10, decimals);
- var girth2 = perRound(girth1);
- form.girth.value = perRound(girth2 / Math.pow(10, decimals));
- form.MG.value = perRound((girth2 * 25.4)/ Math.pow(10, decimals));
- form.CG.value = perRound((girth2 * 2.54)/ Math.pow(10, decimals));
- }
- if (b == 0){bfactor = 1;}
- if (b == 1){bfactor = 1.05;}
- if (b == 2){bfactor = .95;}
- if (i == 0){var weight_number = eval(form.length.value * form.girth.value * form.girth.value / 900);} // OK
- if (i == 1){var weight_number = eval(form.length.value * form.girth.value * form.girth.value / 800);}
- if (i == 2){var weight_number = eval(form.length.value * form.length.value * form.girth.value / 1200);} // OK
- if (i == 3){var weight_number = eval(form.length.value * form.length.value * form.length.value / 1200); form.girth.value=0; form.MG.value=0; form.CG.value=0;}
- if (i == 4){var weight_number = eval(form.length.value * form.length.value * form.length.value / 3500); form.girth.value=0; form.MG.value=0; form.CG.value=0;} // OK
- if (i == 5){var weight_number = eval(form.length.value * form.length.value * form.length.value / 1600); form.girth.value=0; form.MG.value=0; form.CG.value=0;} // OK
- if (i == 6){var weight_number = eval(form.length.value * form.length.value * form.length.value / 2500); form.girth.value=0; form.MG.value=0; form.CG.value=0;}
- if (i == 7){var weight_number = eval(form.length.value * form.length.value * form.length.value / 5500); form.girth.value=0; form.MG.value=0; form.CG.value=0;} // OK
- if (i == 8){var weight_number = eval(form.length.value * form.length.value * form.length.value / 2800); form.girth.value=0; form.MG.value=0; form.CG.value=0;} // OK
- var weight1 = weight_number * Math.pow(10, decimals);
- var weight2 = perRound(weight1);
- form.weight.value = perRound(weight2 / Math.pow(10, decimals));
- form.G.value = perRound((weight2 * 453.592) / Math.pow(10, decimals));
- form.K.value = perRound((weight2 * .453592) / Math.pow(10, decimals));
- }
- function buttonchoice(buttonclass) {
- for (var i = 0; i < buttonclass.length; i++) {
- if (buttonclass[i].checked) {
- return i
- }
- }
- }
- function buttonselect(buttonselect) {
- for (var b = 0; b < buttonselect.length; b++) {
- if (buttonselect[b].checked) {
- return b
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement