// JavaScript Document
function thermsReq(sf){
	return (sf - 1000)*(227/500)+455;	
}
function BTUsReq(tr){
	return tr*99976;	
}
function tipicalSystemCost(tr, gc){
	return tr * (1/0.8) * gc;
}
function GRBSystemCost(tr, btu, gc, ec){
	return ((0.5*tr) * (1/0.9) * gc) + ((0.5*(btu/1000000)) * (1000000/10239) * ec);
}

function doCalc(sf, gc, ec){
	var tr = thermsReq(sf);
	var btu = BTUsReq(tr);
	var answers = new Array();
	answers[0] = tipicalSystemCost(tr, gc);
	answers[1] = GRBSystemCost(tr, btu, gc, ec);
	return answers;
}

function submitForm(){
	var sf = document.getElementById("txtSquareFootage").value;
	var gc = document.getElementById("txtGasCost").value;
	var ec = document.getElementById("txtElectrictyCost").value;
	var answers = doCalc(sf, gc, ec);
	document.getElementById("hiddenTipicalCost").value = answers[0];
	document.getElementById("hiddenGRBCost").value = answers[1];
	return true;
};
