function cent(amount) {
// returns the amount in the .99 format
    return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

function update(form) {

    var subtotal = (form.quantity.value - 0) * (7799 - 0)
    subtotal = Math.floor(subtotal * 1000)/1000;
    form.subtotal.value = '$' + cent(subtotal);

    var enginetotal = (form.quantity.value - 0)  * (form.engine.value - 0);
    enginetotal = Math.floor(enginetotal * 1000)/1000;
    form.enginetotal.value = '$' + cent(enginetotal);

	var colortotal = (0);
    if (form.color.value == 'none') {
    form.colortotal.value = '$' + cent(0); }
    else {
	colortotal = (699);
    form.colortotal.value = '$' + cent(699); }

	var trailertotal = (form.quantity.value - 0) * (form.trailer.value - 0);
    trailertotal = Math.floor(trailertotal * 1000)/1000;
    form.trailertotal.value = '$' + cent(trailertotal);

    total = subtotal + enginetotal + colortotal + trailertotal;
    total = Math.floor(total * 1000)/1000;
    form.total.value = '$' + cent(total);
}