function fmtPrice(num){
result=Math.floor(num)+".";
var cents=100*(num-Math.floor(num))+0.5;
result += Math.floor(cents/10);
result += Math.floor(cents%10);
return result;
}
function Calc()
{
var cost=(document.forms['calc'].costPerPck.value);
var costPerPck=cost.replace(/[\$]/g, "");
var pcksPerDay=(document.forms['calc'].pcksPerDay.value);
var savings=0;
var pckCost = 2;
var origCost = 0;
var vapor = 60;
var newCost = 0;
var numDays = 0;
if (costPerPck > 0 && pcksPerDay > 0)
{
//origCost = costPerPck*pcksPerDay;
//newCost = pckCost*pcksPerDay;
//monthCost = costPerPck*pcksPerDay*30;
//monthnewCost = pckCost*pcksPerDay*30;
savings = ((costPerPck - pckCost)*pcksPerDay)*30;
//monthSavings = monthCost - monthnewCost;
//monthSavings = fmtPrice(monthSavings);
numDays = vapor / ((costPerPck - pckCost)*pcksPerDay);
// numDays = vapor / origCost;
numDays = Math.round(numDays);
//document.calc.totSavings.value = fmtPrice(savings);
alert("You can save up to $" + savings + " dollars per month using Pure Cigs and it will pay for itself in about " + numDays + " days ");
}
else
{
alert("Please enter the cost per pack and the number of packs per day!");
}
}

