function calcSmokes(){

// GET VALUES FROM FORM, SET VALUE TO ONE IF THE VALUE IN THE FORM IS NOT A NUMBER


var smokes = (isNaN(document.wcbubba.smokes.value)) ? 1 : document.wcbubba.smokes.value;
var price = (isNaN(document.wcbubba.price.value)) ? 1 : document.wcbubba.price.value;

// DO CALCULATION OF NUMBER OF CIGARETTES SMOKED ROUNDED TO WHOLE NUMBER

var smoked = parseInt(1 * 365.25 * smokes);
var smokedfive = parseInt(5 * 365 * smokes);
var smokedten = parseInt(10 * 365 * smokes);

// CALCULATE TODAY'S VALUE OF ALL CIGS ROUNDED TO TWO DECIMAL PLACES

var expense = parseInt(((smoked/20) * price) *100) / 100;
var expensefive = parseInt((smokedfive/20) * price);
var expenseten = parseInt((smokedten/20) * price);

// CALCULATE WEIGHT OF TOBACCO IN GRAMS AND POUNDS TO TWO DECIMAL PLACES

var expout = 'In one year, you pay $' + expense + '  for cigarettes.<br>Over five years, you will pay $' + expensefive + '\, and over ten years, you will pay $' + expenseten + '. But if the price goes up, you will pay much more.';

document.getElementById('totals').innerHTML = expout;
}
