function calculate(formObj) {
	var numMonths = parseFloat(formObj.custom6.value);
	if (numMonths < 1) { numMonths = 1 }
	if (numMonths > 6) { numMonths = 6 }
	var copyText = formObj.custom12.value;
	var copyLen = copyText.length;
	var lineBreaks = null;
	var centerText = null;
	var tempVar = null;

	for (x = 0; x < tradingpost.custom10.length; x++) {
		if (tradingpost.custom10[x].checked) {
			tempVar = tradingpost.custom10[x].value;
			if (tempVar == "Add up to 3 line breaks. $6.00 added") { lineBreaks = 1 }
		}
	}

	tempVar = null;

	for (i = 0; i < tradingpost.custom9.length; i++) {
		if (tradingpost.custom9[i].checked) {
			tempVar = tradingpost.custom9[i].value;
			if (tempVar == "Center the text. $2.00 added") { centerText = 1 }
		}
	}

	
	var roundNum = 0;
	var adPrice = 0;
		
	var numLines = copyLen / 75;
	if (numLines <= 4) { roundNum = 4 }
	if (numLines > 4) { roundNum = Math.ceil(numLines) }
	adPrice = roundNum * 10 * numMonths;
	if (lineBreaks == 1) { adPrice = adPrice + 6 }
	if (centerText == 1) { adPrice = adPrice + 2 }
		
	formObj.custom4.value = "$" + adPrice;
	formObj.custom6.value = numMonths
	return true;
}



function calculatefinal(formObj) {
	var isEmail = formObj.email.value;
	var lenEmail = isEmail.length;
	var numMonths = parseFloat(formObj.custom6.value);
	if (numMonths < 1) { numMonths = 1 }
	if (numMonths > 6) { numMonths = 6 }
	var copyText = formObj.custom12.value;
	var copyLen = copyText.length;
	var lineBreaks = null;
	var centerText = null;
	var tempVar = null;

	for (x = 0; x < tradingpost.custom10.length; x++) {
		if (tradingpost.custom10[x].checked) {
			tempVar = tradingpost.custom10[x].value;
			if (tempVar == "Add up to 3 line breaks. $6.00 added") { lineBreaks = 1 }
		}
	}

	tempVar = null;

	for (i = 0; i < tradingpost.custom9.length; i++) {
		if (tradingpost.custom9[i].checked) {
			tempVar = tradingpost.custom9[i].value;
			if (tempVar == "Center the text. $2.00 added") { centerText = 1 }
		}
	}

	
	var roundNum = 0;
	var adPrice = 0;
		
	var numLines = copyLen / 75;
	if (numLines <= 4) { roundNum = 4 }
	if (numLines > 4) { roundNum = Math.ceil(numLines) }
	adPrice = roundNum * 10 * numMonths;
	if (lineBreaks == 1) { adPrice = adPrice + 6 }
	if (centerText == 1) { adPrice = adPrice + 2 }
		
	formObj.custom4.value = "$" + adPrice;
	formObj.custom6.value = numMonths

	if (lenEmail > 0) {
		alert("We are unable to verify or validate the email address you entered. Please use your browser's BACK button and check to be sure you correctly typed your email address. If this problem persists, please notify webmaster@backwoodshome.com and include Error Code E304");
		return false;
	} else {
		return true;
	}
}


