<?php
$page_title = "Epoxy Cove Material Calculator | Epoxy.com";
$meta_description = "Epoxy cove material calculator. Enter lineal feet and choose quartz or solid color/chip floor to estimate primer, cove gel, cove powder, and aggregate requirements.";
include $_SERVER['DOCUMENT_ROOT'].'/includes/header.php';
?>

<!--
File: Epoxy_Cove_Material_Calculator.aspx
Purpose:
  Replace the existing epoxy cove material calculator without changing file name or location.

Legacy formula preserved from code-behind:

Products and yields:
  - Primer: Epoxy.com Product #899 Primer
    Yield: 333.33333334 lineal feet per gallon

  - Cove gel: Epoxy.com Product #720 Cove Gel
    Quartz cove yield: 40 lineal feet per gallon
    Solid color / chip floor cove yield: 80 lineal feet per gallon

  - Cove powder: Epoxy.com Product #60 Cove Powder
    Yield: 200 lineal feet per gallon

  - Quartz cove aggregate:
    Colored quartz, 50 lb bags
    Yield: 33.3333334 lineal feet per bag

  - Solid color / chip floor aggregate:
    Epoxy.com Product #82 Mortar Blend Aggregate, 50 lb bags
    Yield: 50 lineal feet per bag

Important:
  - Logic intentionally follows the old VB calculator closely
  - Existing URL and file name are preserved
  - Outputs are rounded up using the legacy rounding method
-->

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

<h1>Epoxy Cove Material Calculator</h1>

<p>
Enter the total lineal feet of cove and choose the cove type to estimate primer,
cove gel, cove powder, and aggregate requirements.
</p>

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

  <div style="margin:1em 0;">
    <label for="linealFeet"><strong>Lineal Feet of Cove</strong></label><br />
    <input type="number" id="linealFeet" min="0" step="0.01" style="max-width:220px;" />
  </div>

  <div style="margin:1em 0;">
    <label for="coveType"><strong>Cove Type</strong></label><br />
    <select id="coveType" style="max-width:320px;">
      <option value="">Please Select a Cove Type</option>
      <option value="quartz">Quartz</option>
      <option value="solid">Solid Color or Chip Floor</option>
    </select>
  </div>

  <div style="margin:1.25em 0;">
    <button type="button" onclick="calculateCoveMaterials()">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>You will need:</strong></p>

    <div id="resultsList"></div>

    <p style="margin-top:1em;">
      <em>Note:</em> This calculator follows the legacy Epoxy.com formula and does not include waste.
    </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, mixing loss, and installer
    technique may require additional material.
  </p>

</div>

<script>
function roundUp(number) {
  var temp1 = Math.floor(number);
  if (temp1 < number) {
    temp1 = temp1 + 1;
  }
  return temp1;
}

function legacyRound(number, decimalPlaces) {
  var power = 1;
  for (var i = 1; i <= decimalPlaces; i++) {
    power = power * 10;
  }

  var temp1 = number * power;
  return roundUp(temp1) / power;
}

function calculateCoveMaterials() {
  var primerName = "Epoxy.com Product #899 Primer";
  var pasteName = "Epoxy.com Product #720 Cove Gel";
  var mortarAggName = "Epoxy.com Product #82 Mortar Blend Aggregate";
  var covePowderName = "Epoxy.com Product #60 Cove Powder";

  var primerGalYield = 333.33333334;
  var pasteUTQuartzYieldGal = 40;
  var pasteUTGalSolidYield = 80;
  var quartzAggYield = 33.3333334;
  var mortarAggYield = 50;
  var covePowderYield = 200;

  var lf = parseFloat(document.getElementById("linealFeet").value);
  var coveType = document.getElementById("coveType").value;

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

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

  if (isNaN(lf) || lf <= 0) {
    errorBox.innerHTML = "<p><strong>You must enter your lineal feet of cove.</strong></p>";
    errorBox.style.display = "block";
    return;
  }

  if (coveType === "") {
    errorBox.innerHTML = "<p><strong>You must pick a cove type.</strong></p>";
    errorBox.style.display = "block";
    return;
  }

  var primerNeeded = lf / primerGalYield;
  var covePowderNeeded = lf / covePowderYield;

  var html = "";

  if (coveType === "quartz") {
    var pasteNeededQuartz = lf / pasteUTQuartzYieldGal;
    var quartzNeeded = lf / quartzAggYield;

    html += "<p>" + legacyRound(primerNeeded, 2) + " Gallons of " + primerName + "</p>";
    html += "<p>" + legacyRound(pasteNeededQuartz, 2) + " Gallon Units of " + pasteName + "</p>";
    html += "<p>" + legacyRound(covePowderNeeded, 2) + " Gallons of " + covePowderName + "</p>";
    html += "<p>" + legacyRound(quartzNeeded, 2) + " Each 50 lb Bags of Colored Quartz</p>";
  }

  if (coveType === "solid") {
    var pasteNeededSolid = lf / pasteUTGalSolidYield;
    var mortarAggNeeded = lf / mortarAggYield;

    html += "<p>" + legacyRound(primerNeeded, 2) + " Gallons of " + primerName + "</p>";
    html += "<p>" + legacyRound(pasteNeededSolid, 2) + " Gallons of " + pasteName + "</p>";
    html += "<p>" + legacyRound(covePowderNeeded, 2) + " Gallons of " + covePowderName + "</p>";
    html += "<p>" + legacyRound(mortarAggNeeded, 2) + " Each 50 lb Bags of " + mortarAggName + "</p>";
  }

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

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