📐 Product Estimator
Use this tool to estimate how much product you’ll need.
document.addEventListener("DOMContentLoaded", function () { const productSelect = document.getElementById("selectedProduct"); Object.keys(chartData).forEach(product => { const option = document.createElement("option"); option.value = product; option.textContent = product; productSelect.appendChild(option); });
document.getElementById("estimateBtn").addEventListener("click", function () { const area = parseFloat(document.getElementById("surfaceArea").value); const surface = document.getElementById("surfaceType").value; const curve = document.getElementById("curvature").value; const product = document.getElementById("selectedProduct").value; const result = document.getElementById("estimateResult");
if (!area || !product || !chartData) { result.textContent = "Please enter a surface area and select a product."; return; }
const curvatureFactor = { "flat": 1.00, "5-7": 1.08, "8-10": 1.14, "11-13": 1.18, "14-16": 1.22, "17-18": 1.26, "19-20": 1.30, "21-24": 1.33, "24+": 1.35 };
const range = chartData.coverage; if (!range.includes("-")) { result.textContent = `This product uses: ${range}`; return; }
const [minStr, maxStr] = range.split("-"); const min = parseInt(minStr); const max = parseInt(maxStr); let coverage; if (surface === "smooth") coverage = Math.round((max * 0.92) / 5) * 5; else if (surface === "medium") coverage = Math.round(((min + max) / 2) / 5) * 5; else coverage = Math.round(min / 5) * 5;
const curvedArea = area * (curvatureFactor[curve] || 1); const gallons = Math.ceil((curvedArea / coverage) * 100) / 100;
result.innerHTML = ` Calculation:
1) Coverage range: ${range}
2) Surface texture: ${surface}
3) Estimated Coverage: ${coverage} sq ft/gal
4) Base surface area: ${area} sq ft
5) Log size: ${curve} (adds ${(Math.round((curvatureFactor[curve] - 1) * 100))}% surface area)
6) Adjusted surface area: ${Math.round(curvedArea)} sq ft
7) Adjusted surface area / Estimated coverage = ${(curvedArea / coverage).toFixed(2)}
You will need approximately ${gallons.toFixed(2)} gallons of ${product}.`; }); });