function formValidate(form) {
	ret = true;

	if ( form.width.value == "" ) {
		alert("Square Footage Width is empty.  It is required for the calculation.");
		ret = false;
	}
	if ( form.length.value == "" ) {
		alert("Square Footage Length is empty.  It is required for the calculation.");
		ret = false;
	}
	if ( form.increase.value == "" ) {
		alert("Fahrenheit Increase field is empty.  It is required for the calculation.");
		ret = false;
	}
	if ( form.ceilheight.value == "" ) {
		alert("Ceiling Height field is empty.  It is required for the calculation.");
		ret = false;
	}
	return( ret );
}

function CalcBtu(form) {

	btu = "0";
	if ( formValidate(form) ) {
		// Q = h x a x delta_t
		// Q = BTU
		// h = heat loss coefficient
		// a = area of wall space
		// delta_t is the temperature rise
		sqftSides = parseInt(form.length.value) * 2 * parseInt(form.ceilheight.value);
		sqftEnds = parseInt(form.width.value) * 2 * parseInt(form.ceilheight.value);
		sqftCeiling = parseInt(form.width.value) * parseInt(form.length.value);
		sqftTotal = sqftSides + sqftEnds + sqftCeiling;
		increase = form.increase.value;
		loss = form.insulation.options[form.insulation.selectedIndex].value;

		btu = Math.floor(sqftTotal * loss * increase);
	}

	form.btuh.value = btu;
	btuhConvert(form);
	return;
}

function wattConvert(form) {
	var full = parseInt(form.watts.value);
	var calculated = (full / 0.29296875);
	form.btuh.value = Math.round(calculated);
}

function btuhConvert(form) {
	var full = parseInt(form.btuh.value);
	var calculated = (full * 0.29296875);
	form.watts.value = Math.round(calculated);
}