function calcFrmA() {
	var theFrm = document.forms["frmA"];
	var ctlStockPrice = theFrm.elements["stockPrice"];
	var ctlCallPremium = theFrm.elements["callPremium"];
	var ctlStrikePrice = theFrm.elements["strikePrice"];
	var ctlNetCost = theFrm.elements["netCost"];
	var ctlProfit = theFrm.elements["profit"];
	var ctlPercent = theFrm.elements["percent"];

	var stockPrice = ctlStockPrice.value*1;
	var callPremium = ctlCallPremium.value*1;
	var strikePrice = ctlStrikePrice.value*1;

	// Calc Net Cost

	var netCost = formatCurrency(stockPrice - callPremium);
	ctlNetCost.value = netCost;
	document.forms["frmC"].elements["origNetCost"].value = ctlNetCost.value;
	document.forms["frmD"].elements["netCost"].value = ctlNetCost.value;
	document.forms["frmE"].elements["origNetCost"].value = ctlNetCost.value;
	document.forms["frmF"].elements["origNetCost"].value = ctlNetCost.value;

	// Calc Profit
	var profit = formatCurrency(strikePrice - netCost);
	ctlProfit.value = profit;

	// Calc percent
	var percent = profit / netCost;

	ctlPercent.value = Math.round(percent*10000)/100 + '%';
}

function calcFrmB() {
	var theFrm = document.forms["frmB"];
	var ctlStockPrice = theFrm.elements["currentStockPrice"];
	var ctlOrigNetCost = theFrm.elements["origNetCost"];
	var ctlAskPrice = theFrm.elements["askPrice"];
	var ctlNetCost = theFrm.elements["netCost"];
	var ctlProfit = theFrm.elements["profit"];
	var ctlPercent = theFrm.elements["percent"];

	var currentStockPrice = ctlStockPrice.value * 1;
	var askPrice = ctlAskPrice.value * 1;
	var origNetCost = ctlOrigNetCost.value * 1;

	// Calc Net Cost

	var netCost = formatCurrency((origNetCost*1) + (askPrice*1));
	ctlNetCost.value = netCost;

	// Calc Profit
	var profit = formatCurrency(currentStockPrice - netCost);
	ctlProfit.value = profit;

	// Calc percent
	var percent = profit / netCost;

	ctlPercent.value = Math.round(percent*10000)/100 + '%';
}

function calcFrmC() {
	var theFrm = document.forms["frmC"];
	var ctlStrikePrice = theFrm.elements["strikePrice"];
	var ctlOrigNetCost = theFrm.elements["origNetCost"];
	var ctlAskPrice = theFrm.elements["askPrice"];
	var ctlNetCost = theFrm.elements["netCost"];
	var ctlProfit = theFrm.elements["profit"];
	var ctlPercent = theFrm.elements["percent"];

	var strikePrice = ctlStrikePrice.value * 1;
	var askPrice = ctlAskPrice.value * 1;
	var origNetCost = ctlOrigNetCost.value * 1;

	var netCost = formatCurrency(origNetCost + askPrice);
	ctlNetCost.value = netCost;

	// Calc Profit
	var profit = formatCurrency(strikePrice - netCost);
	ctlProfit.value = profit;

	// Calc percent
	var percent = profit / netCost;

	ctlPercent.value = Math.round(percent*10000)/100 + '%';
}

function calcFrmD() {
	var theFrm = document.forms["frmD"];
	var ctlStrikePrice = theFrm.elements["strikePrice"];
	var ctlNetCost = theFrm.elements["netCost"];
	var ctlProfit = theFrm.elements["profit"];
	var ctlPercent = theFrm.elements["percent"];

	var strikePrice = ctlStrikePrice.value * 1;
	var netCost = ctlNetCost.value * 1;

	// Calc Profit
	var profit = formatCurrency(strikePrice - netCost);
	ctlProfit.value = profit;

	// Calc percent
	var percent = profit / netCost;

	ctlPercent.value = Math.round(percent*10000)/100 + '%';
}

function calcFrmE() {
	var theFrm = document.forms["frmE"];
	var ctlStockPrice = theFrm.elements["stockPrice"];
	var ctlOrigNetCost = theFrm.elements["origNetCost"];
	var ctlAskPrice = theFrm.elements["askPrice"];
	var ctlNetCost = theFrm.elements["netCost"];
	var ctlLoss = theFrm.elements["loss"];
	var ctlPercent = theFrm.elements["percent"];

	var origNetCost = ctlOrigNetCost.value * 1;
	var stockPrice = ctlStockPrice.value * 1;
	var askPrice = ctlAskPrice.value * 1;

	// Calc Net Cost
	var netCost = formatCurrency((origNetCost*1) + (askPrice*1));
	ctlNetCost.value = netCost;

	// Calc Profit
	var loss = formatCurrency((stockPrice - netCost));
	ctlLoss.value = loss;

	// Calc percent
	var percent = loss / origNetCost;

	ctlPercent.value = Math.round(percent*10000)/100 + '%';
}

function calcFrmF() {
	var theFrm = document.forms["frmF"];
	var ctlStrikePrice = theFrm.elements["strikePrice"];
	var ctlOrigNetCost = theFrm.elements["origNetCost"];
	var ctlAskPrice = theFrm.elements["askPrice"];
	var ctlPremium = theFrm.elements["premium"];
	var ctlNetCost = theFrm.elements["netCost"];
	var ctlProfit = theFrm.elements["profit"];
	var ctlPercent = theFrm.elements["percent"];

	var askPrice = ctlAskPrice.value * 1;
	var strikePrice = ctlStrikePrice.value * 1;
	var premium = ctlPremium.value * 1;
	var origNetCost = ctlOrigNetCost.value * 1;

	var netCost = formatCurrency(origNetCost + askPrice - premium);
	ctlNetCost.value = netCost;

	// Calc Profit
	var profit = formatCurrency(strikePrice - netCost);
	ctlProfit.value = profit;

	// Calc percent
	percent = profit / netCost;

	ctlPercent.value = Math.round(percent*10000)/100 + '%';
}

function resetAll() {
	frmA.reset();
	// frmB.reset();
	frmC.reset();
	frmD.reset();
	frmE.reset();
	frmF.reset();
}

function formatCurrency(number) {
	var numTest = new NumberFormat(number);
	numTest.setCurrency(false);
	numTest.setCommas(false);
	numTest.setPlaces(2);
	numTest.setCurrencyPrefix('$');
	return(numTest.toFormatted());
}
