function read()
{
	var mpm = document.getElementById('MPM').value;  //Miles Per Month input field
	var mpg = document.getElementById('MPG').value;  //Miles Per Gallon input field
	var cpm = document.getElementById('CPM').value;	 //Cost Per Mile input field
	var spg = document.getElementById('SPG').value;	 //Savings Per Gallon input field
	calculate(mpm, mpg, cpm, spg);
}

function calculate(mpm, mpg, cpm, spg)
{
// preventableOutofRouteMiles();
	var porm = (Math.round((mpm * 0.01) * 100)) / 100;
	document.getElementById('PORM').innerHTML = porm;

// monthlyOutOfRouteSavings();
	var mors = (Math.round((porm * cpm) * 100)) / 100;
	document.getElementById('MORS').innerHTML = mors;

// milesPerMonth2();
	document.getElementById('MPM2').innerHTML = mpm;

// monthlyFuelOptimizationSavings();
	var mfos = (Math.round((mpm / mpg * spg) * 100)) / 100;
	document.getElementById('MFOS').innerHTML = mfos;

// monthlyOutOfRouteSavings2();
	document.getElementById('MORS2').innerHTML = mors;

// monthlyFuelOptimizationSavings2();
	var mfos2 = (Math.round(((mpm / mpg) * spg) * 100)) / 100;
	document.getElementById('MFOS2').innerHTML = mfos2;

// estimatedMonthlySavings();
	var ems = (Math.round(((mors + mfos2) * 100))) / 100;
	document.getElementById('EMS').innerHTML = ems;

// estimatedAnnualSavings()
	var eas = (Math.round(((ems * 12) * 100))) / 100;
	document.getElementById('EAS').innerHTML = eas;
}


