function calculateSafeHarbor() {
var hourlyWage = parseFloat(document.getElementById("hourlyWage").value);
var minimumWage = document.getElementById("minimumWage").value;
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (isNaN(hourlyWage) || hourlyWage <= 0) {
resultDiv.innerHTML = "Please enter a valid employee's regular hourly rate of pay.";
return;
}
if (isNaN(minimumWage) || minimumWage = safeHarborThreshold) {
message = "
Safe Harbor Met: Your employee's regular hourly rate of pay (" + hourlyWage.toFixed(2) + ") is at least twice the applicable minimum wage (" + minimumWage.toFixed(2) + " * 2 = " + safeHarborThreshold.toFixed(2) + ").";
} else {
message = "
Safe Harbor Not Met: Your employee's regular hourly rate of pay (" + hourlyWage.toFixed(2) + ") is less than twice the applicable minimum wage (" + minimumWage.toFixed(2) + " * 2 = " + safeHarborThreshold.toFixed(2) + "). Additional considerations for overtime may apply.";
}
resultDiv.innerHTML = message;
}
.calculator-container {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 500px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-form h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.form-group input[type="number"] {
width: calc(100% – 20px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.calculator-container button {
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.calculator-container button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #eee;
background-color: #fff;
border-radius: 4px;
text-align: center;
}
.calculator-result p {
margin: 0;
font-size: 1.1em;
}