Shop by Category

Information

SnorkellingbannerChristmas Kids Snorkeling Sale!banner
<div id="nitrox-requested-mix-calculator"> <p>This calculator enables you to work out the cost of a Nitrox fill based on your requested dive, mix and cylinder details, when starting with an empty cylinder. It also will give you the price for this fill at The Scuba Doctor.</p> <p class="error"><b>Maximum pressure for Nitrox fills up to 70% Oxygen is 240 bar.</b><br /> Maximum pressure for Nitrox fills above 70% Oxygen fills is 200 bar.</p> <form class="f-wrap-1" id="trimix" onsubmit="return false;"> <div class="req"><b>*</b> Indicates required field</div> <fieldset> <h3>Nitrox Requested Mix Calculator</h3> <h4>Dive Planning Details:</h4> <fieldset><label for="trimix_ppo2"><b><span class="req">*</span>PPO2</b> <input class="f-short" id="trimix_ppo2" maxlength="256" name="trimix_ppo2" size="10" tabindex="1" type="text" value="1.4" /> &nbsp;<small>bar. (Partial Pressure of Oxygen) Range 1.0&ndash;1.6</small></label></fieldset> <h4>Nitrox Mix Details:</h4> <fieldset><label for="trimix_oxygen"><b><span class="req">*</span>Oxygen</b> <input class="f-short" id="trimix_oxygen" maxlength="256" name="trimix_oxygen" size="10" tabindex="2" type="text" value="32" /> &nbsp;<small>per cent Oxygen. (Requested Mix) Range 22&ndash;100</small></label></fieldset> <h4>Cylinder Details:</h4> <fieldset><label for="trimix_cylinder"><b><span class="req">*</span>Cylinder size</b> <input class="f-short" id="trimix_cylinder" maxlength="256" name="trimix_cylinder" size="10" tabindex="3" type="text" value="12.2" /> &nbsp;<small>litres. (Double the single size for twins) Range .5&ndash;50</small></label><br /> <label for="trimix_pressure"><b><span class="req">*</span>Fill Pressure</b> <input class="f-short" id="trimix_pressure" maxlength="256" name="trimix_pressure" size="10" tabindex="4" type="text" value="240" /> &nbsp;<small>bar. Range 5&ndash;300</small></label></fieldset> <div class="f-submit-wrap"><button class="f-submit-button" onclick="calculateNitroxRequestedMix()" tabindex="5" type="button">Calculate</button></div> </fieldset> </form> <div id="nitrox-calc-errors" style="display:none; color: red; margin: 15px 0;">&nbsp;</div> <div id="nitrox-calc-results">&nbsp;</div> <hr /> <p><small><b>Please Note</b>: The above prices are subject to change without notice.<br /> <br /> <b>Disclaimer</b>: This calculator provides information about gas mixing. <b>UNDER NO CIRCUMSTANCES</b> is there any implication that any gas mixture is safe or even life supporting. If you have not received training in Gas Mixing, Nitrox, Trimix or Heliox you should not attempt to mix any gas. Improper use of gasses in diving can result in injury or <b>death</b>. The Scuba Doctor takes no responsibility for the information provided above.</small></p> </div> <script> (function() { // Configuration const CONFIG = { orgName: "The Scuba Doctor", oxygenCost: 5.0, // cents per litre (inc tax) airCost: 8.50, // dollars per fill (inc tax) blendingCost: 10.00 // dollars per fill (inc tax) }; // Format currency (Australian format) function formatCurrency(amount) { if (amount < 0) { return '-$' + Math.abs(amount).toFixed(2); } return '$' + amount.toFixed(2); } // Validate field function validateField(value, min, max, required) { if (required && (value === '' || value === null || value === undefined)) { return false; } const num = parseFloat(value); if (isNaN(num) || num < 0) { return false; } if (min !== undefined && num < min) { return false; } if (max !== undefined && num > max) { return false; } return true; } // Calculate nitrox requested mix window.calculateNitroxRequestedMix = function() { const errorsDiv = document.getElementById('nitrox-calc-errors'); const resultsDiv = document.getElementById('nitrox-calc-results'); errorsDiv.style.display = 'none'; errorsDiv.innerHTML = ''; // Get values const ppo2 = parseFloat(document.getElementById('trimix_ppo2').value); const oxygen = parseFloat(document.getElementById('trimix_oxygen').value); const cylinder = parseFloat(document.getElementById('trimix_cylinder').value); const pressure = parseFloat(document.getElementById('trimix_pressure').value); // Validate const errors = []; if (!validateField(ppo2, 1, 1.6, true)) { errors.push('Please provide a valid PPO2 value (Range 1.0–1.6)'); } if (!validateField(oxygen, 22, 100, true)) { errors.push('Please provide a valid Oxygen percentage value (Range 22–100)'); } if (!validateField(cylinder, 0.5, 50, true)) { errors.push('Please provide a valid Cylinder Size value (Range 0.5–50)'); } if (!validateField(pressure, 5, 300, true)) { errors.push('Please provide a valid Fill Pressure value (Range 5–300)'); } if (errors.length > 0) { errorsDiv.innerHTML = errors.join('<br />'); errorsDiv.style.display = 'block'; resultsDiv.innerHTML = ''; return; } // Perform calculations (same logic as PHP) const nitrogen = 1 - (oxygen / 100); const maxdepth = (ppo2 / (oxygen / 100) - 1) * 10; const ead = ((maxdepth / 10) + 1) * nitrogen * 10; const bar_o2 = (((oxygen / 100) - 0.209) / 0.791) * pressure; // Mix method - oxygen const oxygen_bars = bar_o2; const oxygen_bars_end = bar_o2; const oxygen_litres = cylinder * bar_o2; let oxygen_price = oxygen_litres * (CONFIG.oxygenCost / 100); oxygen_price = Math.round(oxygen_price * 100) / 100; // Mix method - air const air_bars = pressure - oxygen_bars; const air_bars_end = oxygen_bars_end + air_bars; const air_litres = cylinder * air_bars; const air_price = (oxygen < 100) ? Math.round(CONFIG.airCost * 100) / 100 : 0; const blending_price = Math.round(CONFIG.blendingCost * 100) / 100; // Totals const total_litres = oxygen_litres + air_litres; const total_bars = oxygen_bars + air_bars; const total_price_inc = Math.round((oxygen_price + air_price + blending_price) * 100) / 100; const total_price_ex = total_price_inc / 1.1; const gst = total_price_inc - total_price_ex; // Build results HTML let html = '<table class="table1" width="100%">'; html += '<thead><tr><th colspan="5">Nitrox Fill &amp; Price Details — Requested Mix</th></tr></thead>'; html += '<tbody>'; // Dive Planning and Requested Mix html += '<tr><th colspan="2" width="50%">Dive Planning</th><th colspan="3" width="50%">Requested Mix</th></tr>'; html += '<tr><td style="text-align:right;"><b>PPO2</b>:</td><td style="text-align:right;">' + ppo2.toFixed(2) + '</td>'; html += '<td colspan="2" style="text-align:right;"><b>Oxygen</b>:</td><td style="text-align:right;">' + Math.round(oxygen) + '%</td></tr>'; html += '<tr><td style="text-align:right;"><b>Max Depth</b>:</td><td style="text-align:right;">' + Math.round(maxdepth) + '</td>'; html += '<td colspan="2" style="text-align:right;"><b>Nitrogen</b>:</td><td style="text-align:right;">' + Math.round(100 - oxygen) + '%</td></tr>'; html += '<tr><td style="text-align:right;"><b>EAD</b>:</td><td style="text-align:right;">' + Math.round(ead) + '</td>'; html += '<td colspan="2" style="text-align:right;">&nbsp;</td><td style="text-align:right;">&nbsp;</td></tr>'; // Cylinder Details html += '<tr><th colspan="5">Cylinder Details</th></tr>'; html += '<tr><td style="text-align:right;"><b>Cylinder Size</b>:</td><td style="text-align:right;">' + cylinder.toFixed(2) + '</td>'; html += '<td colspan="3"> litres</td></tr>'; html += '<tr><td style="text-align:right;"><b>Fill Pressure</b>:</td><td style="text-align:right;">' + Math.round(pressure) + '</td>'; html += '<td colspan="3"> bars</td></tr>'; // Mix Method html += '<tr><th colspan="5">Mix Method</th></tr>'; html += '<tr><th class="sub" style="text-align:right;">Gas</th><th class="sub" style="text-align:right;">Litres</th>'; html += '<th class="sub" style="text-align:right;">Bar</th><th class="sub" style="text-align:right;">End Bar</th>'; html += '<th class="sub" style="text-align:right;">Price (inc GST)</th></tr>'; html += '<tr><td style="text-align:right;"><b>Start</b>:</td><td style="text-align:right;">0</td><td style="text-align:right;">0</td>'; html += '<td style="text-align:right;">&nbsp;</td><td style="text-align:right;">&nbsp;</td></tr>'; html += '<tr><td style="text-align:right;"><b>Add Oxygen</b>:</td><td style="text-align:right;">' + Math.round(oxygen_litres) + '</td>'; html += '<td style="text-align:right;">' + Math.round(oxygen_bars) + '</td><td style="text-align:right;">' + Math.round(oxygen_bars_end) + '</td>'; html += '<td style="text-align:right;">' + formatCurrency(oxygen_price) + '</td></tr>'; html += '<tr><td style="text-align:right;"><b>Add Air</b>:</td><td style="text-align:right;">' + Math.round(air_litres) + '</td>'; html += '<td style="text-align:right;">' + Math.round(air_bars) + '</td><td style="text-align:right;">' + Math.round(air_bars_end) + '</td>'; html += '<td style="text-align:right;">' + formatCurrency(air_price) + '</td></tr>'; html += '<tr><td style="text-align:right;"><b>Mix Totals</b>:</td><td style="text-align:right;">' + Math.round(total_litres) + '</td>'; html += '<td style="text-align:right;">' + Math.round(air_bars_end) + '</td><td style="text-align:right;">&nbsp;</td><td style="text-align:right;">&nbsp;</td></tr>'; html += '<tr><td style="text-align:right;"><b>Blending</b>:</td><td style="text-align:right;" colspan="4">' + formatCurrency(blending_price) + '</td></tr>'; // Price Summary html += '<tr><th colspan="5">Price from ' + CONFIG.orgName + '</th></tr>'; html += '<tr><td colspan="4" style="text-align:right;">Price (ex GST):</td><td style="text-align:right;">' + formatCurrency(total_price_ex) + '</td></tr>'; html += '<tr><td colspan="4" style="text-align:right;">GST:</td><td style="text-align:right;">' + formatCurrency(gst) + '</td></tr>'; html += '<tr><td colspan="4" style="text-align:right;"><b>Total Price</b> (inc GST):</td>'; html += '<td style="text-align:right;"><b>' + formatCurrency(total_price_inc) + '</b></td></tr>'; html += '</tbody></table>'; html += '<p>&nbsp;<br /><b>Nitrox Fill Prices:</b> (inc GST)<br />'; html += 'Oxygen: ' + CONFIG.oxygenCost.toFixed(1) + ' cents per litre<br />'; html += 'Air: ' + formatCurrency(air_price) + ' per fill for O2 less than 100%<br />'; html += 'Blending: ' + formatCurrency(blending_price) + ' per fill</p>'; resultsDiv.innerHTML = html; // Scroll to results resultsDiv.scrollIntoView({ behavior: 'smooth', block: 'start' }); }; // Calculate on page load with default values if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { calculateNitroxRequestedMix(); }); } else { calculateNitroxRequestedMix(); } // Recalculate on input change const inputs = ['trimix_ppo2', 'trimix_oxygen', 'trimix_cylinder', 'trimix_pressure']; inputs.forEach(function(id) { const input = document.getElementById(id); if (input) { input.addEventListener('input', calculateNitroxRequestedMix); input.addEventListener('change', calculateNitroxRequestedMix); } }); })(); </script>