function toDollar(x) {
	return x.toFixed(2);	
}

function calcCost(id) {
	
	var form = document.getElementById("formid_"+id);
	var sqList = form.sqft;
	var sq = sqList.options[sqList.selectedIndex].value ;
	// get first index
	sq = sq.split(",")[0];
	var thickList = form.thickness;
	var thick = thickList.options[thickList.selectedIndex].value;
	var sheetList = form.sheeting;
	var sheet = sheetList.options[sheetList.selectedIndex].value;	
	if (form.anti.checked)  {
		anti = true;
	} else {
		anti = false;
	}

	var total = 0;
	if (thick == "Face Only") {	
		total = sq * sheetingFaceOnly[sheet];
	} else {
		// thickness adjustment per sq ft
		total = (sq * sheeting[sheet]) + (sq * thickness[thick]);
	}
	if (anti && (sheet == "ENG" || sheet == "HI")) {
		total = total + sq * antig["enghi"];
	} 
	
	if (anti && (sheet != "ENG" && sheet != "HI")) {
		total = total +	sq * antig["other"];
	}

	total = toDollar(total)
	document.getElementById("item_"+id).innerHTML = "$ " + total;
}

function calcCostBlank(id) {
	
	var form = document.getElementById("formid_"+id);
	var sqList = form.sqft;
	var sq = sqList.options[sqList.selectedIndex].value ;
	// get first index
	sq = sq.split(",")[0];
	var thickList = form.thickness;
	var thick = thickList.options[thickList.selectedIndex].value;

	var total = sq * blanks[thick];
	total = toDollar(total)
	document.getElementById("item_"+id).innerHTML = "$ " + total;
}

function bracket(len,id) {
	var total = 5.25;
	if (len == "12") {
		total = 9.15;
	}
	document.getElementById(id).innerHTML = "$ " + total;
}