function doCalc() {
	/* values used in calculations which user does not input */
	DaysPerMonth = 21;
	MonthsPerYear = 12;
	MaterialCost = 1; /* dollars */
	LaborTime = 15; /* number of minutes of labor req'd, incl. scan/design time & finish time */
	
	/* read user input */
	ScannerCost = document.getElementById('ScannerCost').value;
	SavingsPerCoping = document.getElementById('SavingsPerCoping').value;
	CopingsPerDay = document.getElementById('CopingsPerDay').value;
		CopingsPerMonth = CopingsPerDay * DaysPerMonth;
		CopingsPerYear = CopingsPerMonth * MonthsPerYear;
	HourlyLaborCost = document.getElementById('LaborCost').value;
	
	/* check user input */
	if (!ScannerCost > 0) {
		alert("Please enter a valid scanner cost.");
		document.getElementById('ScannerCost').focus();
		return 0;
	}
	if (!SavingsPerCoping > 0) {
		alert("Please enter a valid figure for cost savings per coping.");
		document.getElementById('SavingsPerCoping').focus();
		return 0;
	}
	if (!CopingsPerDay > 0) {
		alert("Please enter a valid number of copings/units per day.");
		document.getElementById('CopingsPerDay').focus();
		return 0;
	}
	if (!HourlyLaborCost > 0) {
		alert("Please enter a valid hourly labor cost.");
		document.getElementById('LaborCost').focus();
		return 0;
	}
	
	/* do calcs & display result */
	LaborCost = (HourlyLaborCost * LaborTime) / 60;
	
	TimeInDays = roundNumber(ScannerCost / ((SavingsPerCoping - LaborCost - MaterialCost) * CopingsPerDay));
	TimeInMonths = roundNumber(ScannerCost / ((SavingsPerCoping - LaborCost - MaterialCost) * CopingsPerMonth));
	TimeInYears = roundNumber(ScannerCost / ((SavingsPerCoping - LaborCost - MaterialCost) * CopingsPerYear));
	
	output = "The scanner will pay for itself in " + TimeInDays + " days. That's " + TimeInMonths + " months or " + TimeInYears + " years. This includes typical costs associated with the design and finishing work at your facility.";
	document.getElementById('calcResults').innerHTML = output;
}

function roundNumber(num, dec) {
	if (!dec) { dec = 1; }
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

