<!-- Paste this code into an external JavaScript file named: wwCalc.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Webmilhouse :: http://www.webmilhouse.com/ */

function calculate() {
 	var doc = document.pointCalc;
 	var points = 0;
 	var fiber = doc.fiber.value;
    if(fiber > 4) fiber = 4;
 	var fat = doc.fat.value;
 	var calories = doc.calories.value;

 	points = (calories / 50) + (fat / 12) - (fiber / 5);
 	doc.result.value = Math.round(points);
}