.calculator-wrapper {
font-family: 'Arial', sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
background-color: #fff;
}
.calculator-form h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.calculator-form p {
color: #555;
line-height: 1.6;
margin-bottom: 20px;
text-align: justify;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #444;
}
.form-group input[type="number"],
.form-group select {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Important for consistent sizing */
}
.form-group .checkbox-group {
display: flex;
flex-direction: column;
gap: 8px;
}
.form-group .checkbox-group label {
font-weight: normal;
display: inline-block;
margin-left: 8px;
}
.form-group button {
background-color: #007bff;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
width: 100%;
transition: background-color 0.3s ease;
}
.form-group button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 25px;
padding: 15px;
border: 1px dashed #007bff;
border-radius: 4px;
background-color: #e7f3ff;
text-align: center;
font-size: 1.1em;
color: #333;
min-height: 50px; /* Ensure it has some height even when empty */
display: flex;
align-items: center;
justify-content: center;
}
.calculator-result span {
font-weight: bold;
color: #007bff;
}
function calculatePremium() {
var carValue = parseFloat(document.getElementById("carValue").value);
var carAge = parseInt(document.getElementById("carAge").value);
var engineCC = parseInt(document.getElementById("engineCC").value);
var fuelType = document.getElementById("fuelType").value;
var zone = document.getElementById("zone").value;
var basePremiumRate = 0; // Placeholder, actual rates are complex
var liabilityPremium = 0;
var ownDamagePremium = 0;
var fuelTypeMultiplier = 1;
var zoneMultiplier = 1;
var ageDepreciation = 0;
// — Simplified Base Premium Rate Calculation (Illustrative) —
// This is a highly simplified model. Real-world calculations involve complex tables and IRDAI guidelines.
if (carValue < 300000) {
basePremiumRate = 0.03; // 3% of IDV
} else if (carValue < 700000) {
basePremiumRate = 0.035; // 3.5% of IDV
} else {
basePremiumRate = 0.04; // 4% of IDV
}
// — Own Damage Premium (OD) —
ownDamagePremium = carValue * basePremiumRate;
// — Age Depreciation —
// This is a simplified annual depreciation. Actual tables are more granular.
if (carAge === 0) {
ageDepreciation = 0; // New car
} else if (carAge === 1) {
ageDepreciation = 0.05; // 5%
} else if (carAge === 2) {
ageDepreciation = 0.10; // 10%
} else if (carAge === 3) {
ageDepreciation = 0.15; // 15%
} else if (carAge 0.50) ageDepreciation = 0.50; // Max depreciation usually around 50%
}
ownDamagePremium -= ownDamagePremium * ageDepreciation;
// — Fuel Type Adjustment (Simplified) —
if (fuelType === "diesel") {
fuelTypeMultiplier = 1.10; // Diesel might have slightly higher OD premium
} else if (fuelType === "cng") {
fuelTypeMultiplier = 1.05; // CNG might have a slight increase
} else if (fuelType === "electric") {
// Electric vehicles might have different structures or discounts, simplified here
fuelTypeMultiplier = 0.95;
}
ownDamagePremium *= fuelTypeMultiplier;
// — Engine CC based adjustment for OD (Simplified) —
if (engineCC > 1500) {
ownDamagePremium *= 1.05; // Higher CC might slightly increase OD
}
// — Zone based adjustment for OD (Simplified) —
if (zone === "metro") {
zoneMultiplier = 1.05; // Metropolitan areas might have higher OD
}
ownDamagePremium *= zoneMultiplier;
// — Third-Party (Liability) Premium (Highly Simplified) —
// This is extremely simplified. Actual TP premiums are fixed by IRDAI based on vehicle type, CC, and load.
if (engineCC < 1000) {
liabilityPremium = 1500;
} else if (engineCC < 1500) {
liabilityPremium = 2500;
} else if (engineCC < 2000) {
liabilityPremium = 4000;
} else {
liabilityPremium = 6000;
}
// Fuel type influence on TP premium (Very simplified)
if (fuelType === "diesel") {
liabilityPremium *= 1.1;
} else if (fuelType === "electric") {
liabilityPremium *= 0.9;
}
// — Add-ons —
var addOnCosts = 0;
if (document.getElementById("zeroDepreciation").checked) {
addOnCosts += parseInt(document.getElementById("zeroDepreciation").value);
}
if (document.getElementById("engineProtector").checked) {
addOnCosts += parseInt(document.getElementById("engineProtector").value);
}
if (document.getElementById("roadsideAssistance").checked) {
addOnCosts += parseInt(document.getElementById("roadsideAssistance").value);
}
// — Total Premium —
// Basic OD Premium + Basic TP Premium + Add-on Costs + Taxes (simplified, GST is typically 18%)
var totalOwnDamage = ownDamagePremium;
var totalLiability = liabilityPremium;
var totalBasicPremium = totalOwnDamage + totalLiability;
// GST (Goods and Services Tax) – typically 18% on OD and TP premiums
var gstOnOD = totalOwnDamage * 0.18;
var gstOnTP = totalLiability * 0.18; // TP tax can vary, often 18%
var totalGst = gstOnOD + gstOnTP;
var finalPremium = totalBasicPremium + addOnCosts + totalGst;
// — Display Results —
var resultDiv = document.getElementById("result");
if (isNaN(carValue) || isNaN(carAge) || isNaN(engineCC) || carValue <= 0 || carAge < 0 || engineCC <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
} else {
resultDiv.innerHTML = "Estimated Annual Premium:
₹ " + finalPremium.toFixed(2) + "" +
"Own Damage Premium (OD): ₹ " + totalOwnDamage.toFixed(2) + "" +
"Third Party Premium (TP): ₹ " + totalLiability.toFixed(2) + "" +
"Add-ons: ₹ " + addOnCosts.toFixed(2) + "" +
"GST (18%): ₹ " + totalGst.toFixed(2);
}
}