dt_comm_calculate = function()
{
	var mpg, miles, gas, park;

	try
	{
		miles = DT_F.getFormFloat( "dt_comm_miles", "Please enter the number of miles driven", "Please enter the miles driven as a number" );
		if ( miles <= 0 ) {
			throw("The number of miles driven must be > 0");
		}
		gas = DT_F.getFormFloat( "dt_comm_gas", "Please enter the cost of gas", "Please enter a valid cost of gas" );
		if ( gas <= 0 ) {
			throw("The cost of gas must be > 0");
		}
		mpg = DT_F.getFormFloat( "dt_comm_mpg", "Please enter your car's fuel efficiency", "Please enter your car's fuel efficiency as a number" );
		if ( mpg <= 0 ) {
			throw("Your fuel efficiency must be > 0");
		}
		park = DT_F.getFormFloat( "dt_comm_park", "Please enter the cost of parking", "Please enter a valid cost of parking" );
		if ( park < 0 ) {
			throw("The cost of parking must be >= 0");
		}
	}
	catch ( err )
	{
		alert(err);
		return;
	}

	var costDay = ( ( 2 * miles / mpg ) * gas) + park;
	var costWeek = 5 * (costDay);
	var costYear = 250 * (costDay);
	
	var html = [];
	html.push("In terms of gas and parking, your commute costs:");
	html.push( "<p>" + DT_F.formatDollarsCents(costDay) + " per day.</p>");
	html.push( "<p>" + DT_F.formatDollarsCents(costWeek) + " per week.</p>");
	html.push( "<p>" + DT_F.formatDollarsCents(costYear) + " per year.</p>");

	var x = document.getElementById("dt_comm_results");
	x.innerHTML = html.join('');
	x.style.display = "block";
};

