function calculateCobraRate() {
var monthlyPremium = parseFloat(document.getElementById("monthlyPremium").value);
var adminFeePercentage = parseFloat(document.getElementById("adminFeePercentage").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(monthlyPremium) || isNaN(adminFeePercentage)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (monthlyPremium < 0 || adminFeePercentage < 0) {
resultDiv.innerHTML = "Values cannot be negative.";
return;
}
var adminFeeAmount = (monthlyPremium * adminFeePercentage) / 100;
var totalCobraRate = monthlyPremium + adminFeeAmount;
resultDiv.innerHTML = "
Estimated COBRA Rate
" +
"
Total Monthly Group Premium: $" + monthlyPremium.toFixed(2) + "" +
"
Maximum Administrative Fee: $" + adminFeeAmount.toFixed(2) + "" +
"
Your Estimated Monthly COBRA Premium: $" + totalCobraRate.toFixed(2) + "" +
"
Note: This is an estimate. Actual COBRA rates may vary based on your specific plan and state regulations.";
}
.cobra-calculator-wrapper {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 500px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-input-section h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.calculator-input-section p {
font-size: 0.95em;
color: #555;
margin-bottom: 20px;
line-height: 1.5;
}
.input-group {
margin-bottom: 15px;
}
.input-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.input-group input[type="number"] {
width: calc(100% – 20px); /* Adjust for padding */
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Include padding and border in the element's total width and height */
font-size: 1em;
}
.cobra-calculator-wrapper button {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1.1em;
width: 100%;
transition: background-color 0.3s ease;
}
.cobra-calculator-wrapper button:hover {
background-color: #45a049;
}
.calculator-result-section {
margin-top: 25px;
padding: 15px;
border: 1px solid #eee;
border-radius: 4px;
background-color: #fff;
}
.calculator-result-section h3 {
color: #333;
margin-bottom: 10px;
text-align: center;
}
.calculator-result-section p {
font-size: 1em;
color: #555;
margin-bottom: 8px;
line-height: 1.4;
}
.calculator-result-section span {
font-size: 1.2em;
}
.calculator-result-section small {
color: #777;
font-style: italic;
display: block;
margin-top: 10px;
text-align: center;
}