function validateForm() {

	if 
	(
	(checkText(document.costsCalculator.price, "how much a pack costs you") == false) ||
	(checkNumeric(document.costsCalculator.price, "how much a pack costs you") == false) ||
	(checkText(document.costsCalculator.number_cigarettes, "how many cigarettes you smoke in a day") == false) ||
	(checkNumeric(document.costsCalculator.number_cigarettes, "how many cigarettes you smoke in a day") == false) ||
	(checkText(document.costsCalculator.years_smoking, "how many years you've smoked") == false) ||
	(checkNumeric(document.costsCalculator.years_smoking, "how many years you've smoked") == false)
	)
	{
		//do nothing
		//return false
	} else {
		calculateCosts();
	}
}

function calculateCosts() {

	var total = (document.costsCalculator.number_cigarettes.value / 20) * (document.costsCalculator.price.value * document.costsCalculator.years_smoking.value * 365);
	var total_yearly = (document.costsCalculator.number_cigarettes.value / 20) * (document.costsCalculator.price.value * 365);
	document.costsCalculator.total_today.value = total.toFixed(2);
	document.costsCalculator.total_yearly.value = total_yearly.toFixed(2);
	calculateSavings();
	
	obj=document.getElementById('results');
	obj.style.display="inline";
}

function calculateSavings() {

	var custom_years = document.costsCalculator.years.options[document.costsCalculator.years.selectedIndex].value;
	var total_custom = (document.costsCalculator.number_cigarettes.value / 20) * (document.costsCalculator.price.value * 365 * custom_years);
	document.costsCalculator.total_custom.value = total_custom.toFixed(2);
}