<?php
$page_title = "Epoxy Coating Calculator | Epoxy.com";
$meta_description = "Epoxy coating calculator. Enter square footage to estimate gallons of Product #12 Primer or #899 Primer, coating, and optional anti-skid additive, plus rounded order quantities.";
include $_SERVER['DOCUMENT_ROOT'].'/includes/header.php';
?>

<!--
File: coatingcalc.aspx
Purpose:
  Replace the existing coating calculator without changing file name or location.

System assumptions:
  - Primer rate: 250 SF per gallon
  - Coating rate: 80 SF per gallon
  - Primer unit size: 3 gallons
  - Coating unit size: 3 gallons
  - Optional anti-skid additive: coating gallons / 8
  - Anti-skid order unit: 1 gallon

Important:
  - No waste factor included
  - Preserves the legacy calculator math, updated for current primer packaging
  - Primer estimate may be used for Product #12 Primer or #899 Primer where the same spread rate applies
-->

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebApplication",
  "name": "Epoxy Coating Calculator",
  "applicationCategory": "Calculator",
  "operatingSystem": "All",
  "publisher": {
    "@type": "Organization",
    "name": "Epoxy.com"
  }
}
</script>

<h1>Epoxy Coating Calculator</h1>

<p>
Enter your total floor area in square feet to estimate Product #12 Primer or #899 Primer, coating, and optional anti-skid additive.
This calculator does not include waste.
</p>

<div class="container" style="max-width:760px;">

  <div style="margin:1em 0;">
    <label for="squareFootage"><strong>Total Area</strong> (square feet)</label><br />
    <input type="number" id="squareFootage" min="0" step="0.01" style="max-width:220px;" />
  </div>

  <div style="margin:1.25em 0;">
    <button type="button" onclick="calculateCoating()">Calculate</button>
  </div>

  <div id="calcError" style="display:none; border:1px solid #f3c2c2; background:#fff5f5; padding:1em; border-radius:6px; color:#b00000;">
  </div>

  <div id="calcResults" style="display:none; border:1px solid #ccc; padding:1em; border-radius:6px; margin-top:1em;">
    <h2 style="margin-top:0;">Results</h2>

    <p><strong>Area:</strong> <span id="outArea"></span></p>

    <hr />

    <p>
      <strong>Gallons of Product #12 Primer or #899 Primer Required:</strong>
      <span id="primerRequired"></span>
    </p>

    <p>
      <strong>Order Product #12 Primer or #899 Primer:</strong>
      <span id="primerOrder"></span>
    </p>

    <hr />

    <p>
      <strong>Gallons of Coating Required:</strong>
      <span id="coatingRequired"></span>
    </p>

    <p>
      <strong>Order Coating:</strong>
      <span id="coatingOrder"></span>
    </p>

    <hr />

    <p>
      <strong>Optional Anti-Skid Required:</strong>
      <span id="antiSkidRequired"></span>
    </p>

    <p>
      <strong>Order Anti-Skid:</strong>
      <span id="antiSkidOrder"></span>
    </p>

    <p style="margin-top:1em;">
      <em>Note:</em> This does not include waste, porosity, rough surface profile, over-application, or mixing loss.
    </p>
  </div>

  <p style="font-size:0.95em; margin-top:1em;">
    This calculator is provided for estimating and double-checking your own calculations.
    While Epoxy.com believes the formulas used are accurate, this tool is provided "as is"
    without warranty or guarantee of accuracy. Quantities shown are based on theoretical
    coverage rates. Actual jobsite conditions, surface profile, porosity, mixing loss,
    and installer technique may require additional material.
  </p>

</div>

<script>
function formatNumber(value, decimals) {
  return Number(value).toFixed(decimals);
}

function ceilUnits(amountNeeded, unitSize) {
  var units = Math.ceil(amountNeeded / unitSize);
  if (units < 1) units = 1;
  return units;
}

function calculateCoating() {
  var sf = parseFloat(document.getElementById("squareFootage").value);

  var errorBox = document.getElementById("calcError");
  var resultsBox = document.getElementById("calcResults");

  errorBox.style.display = "none";
  errorBox.innerHTML = "";
  resultsBox.style.display = "none";

  if (isNaN(sf) || sf <= 0) {
    errorBox.innerHTML = "<strong>Error:</strong> Please enter a valid positive square footage.";
    errorBox.style.display = "block";
    return;
  }

  var primerRate = 250.0;
  var coatingRate = 80.0;
  var primerUnit = 3.0;
  var coatingUnit = 3.0;
  var antiSkidUnit = 1.0;

  var primer = sf / primerRate;
  var coating = sf / coatingRate;
  var antiSkid = coating / 8.0;

  var primerUnits = ceilUnits(primer, primerUnit);
  var coatingUnits = ceilUnits(coating, coatingUnit);
  var antiSkidUnits = ceilUnits(antiSkid, antiSkidUnit);

  var primerOrderGal = primerUnits * primerUnit;
  var coatingOrderGal = coatingUnits * coatingUnit;
  var antiSkidOrderGal = antiSkidUnits * antiSkidUnit;

  document.getElementById("outArea").textContent =
    formatNumber(sf, 2) + " SF";

  document.getElementById("primerRequired").textContent =
    formatNumber(primer, 2) + " gallons (unit size is 3 gallons)";

  document.getElementById("primerOrder").textContent =
    formatNumber(primerOrderGal, 2) + " gallons";

  document.getElementById("coatingRequired").textContent =
    formatNumber(coating, 2) + " gallons (unit size is 3 gallons)";

  document.getElementById("coatingOrder").textContent =
    formatNumber(coatingOrderGal, 2) + " gallons";

  document.getElementById("antiSkidRequired").textContent =
    formatNumber(antiSkid, 2) + " gallons (unit size is 1 gallon and 50 lb bags)";

  document.getElementById("antiSkidOrder").textContent =
    formatNumber(antiSkidOrderGal, 2) + " gallons";

  resultsBox.style.display = "block";
}
</script>

<?php include $_SERVER['DOCUMENT_ROOT'].'/includes/footer.php'; ?>