function foldCompute() {
	var theForm = document.forms["foldingCalculator"];

	/* ENERGY CONSUMPTION */
	var distance = parseFloat(theForm["lightyears"].value);
	var mass = parseFloat(theForm["mass_tonnes"].value);
	var energy = mass * (distance*distance);
	theForm["energy"].value = energy;

	/* ACCURACY DETERMINATION */
	var fold_ratio = parseFloat(theForm["ratio"].value);
	var distanceOff = Math.pow(mass,3) * Math.pow(fold_ratio,2) * Math.pow(distance,3) * Math.random();
	var maxOff = Math.pow(mass,3) * Math.pow(fold_ratio,2) * Math.pow(distance,3);
	distanceOff /= 149598000;/* Convert to Astronomical Units */
	maxOff /= 149598000;/* Convert to Astronomical Units */
	if (distanceOff >= 10000) {
		distanceOff /= 63239;/* Convert from AU to Lightyears */
		distanceOff = Math.round(distanceOff*1000)/1000;
		distanceOff += " ly";
	} else if (distanceOff >= 0.1) {
		distanceOff = Math.round(distanceOff*1000)/1000;
		distanceOff += " AU";
	} else {
		distanceOff = Math.round(distanceOff*149598000000)/1000;
		distanceOff += " km";
	}
	if (maxOff >= 10000) {
		maxOff /= 63239;/* Convert from AU to Lightyears */
		maxOff = Math.round(maxOff*1000)/1000;
		maxOff += " ly";
	} else if (maxOff >= 0.1) {
		maxOff = Math.round(maxOff*1000)/1000;
		maxOff += " AU";
	} else {
		maxOff = Math.round(maxOff*149598000000)/1000;
		maxOff += " km";
	}
	theForm["distance_off"].value = distanceOff;
	theForm["distance_max"].value = maxOff;
}
