## Calculator - Urgent Help Required

I have a basic calculator that works out the savings when choosing a particular real estate company over any other real estate agent.

Its basically: Saving = Fee to Agent - Company Flat fee.
where; Fee to Agent = Property Value * Agent Commision / 100

I want to add another field (Advertising Fee) which will simply be added to the 'Fee for Agent' total.

I have added the field with all the options, but cannot get it to calculate. I am in desperate need of help, as my client requires it complete by the end of the week.

Here is the code: (With Advertising Fee added, but not doing anything)

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function RoundTo2dp(X)
{
return Math.round(X);
}

function calculateFees()
{

var form = document.calculator;

if (form.propValue.value < 250001)
{
flatFee = 1540;
}
else if (form.propValue.value > 250000 && form.propValue.value < 500001)
{
flatFee = 1540;
}
else if (form.propValue.value > 500000 && form.propValue.value < 1000001)
{
flatFee = 1540;
}
else if (form.propValue.value > 1000000)
{
flatFee = 1540;
}

propValue = form.propValue.options[form.propValue.selectedIndex].value;

perc = "0.0" + form.commission.options[form.commission.selectedIndex].value;

agentCost = propValue * eval(perc);

saving = 100 - ((flatFee/agentCost) * 100);

dollarSaving = agentCost - flatFee;

form.flatFeeBox.value = flatFee;
form.agentCostBox.value = agentCost;
form.savingBox.value = RoundTo2dp(saving);
form.dollarSavingBox.value = dollarSaving;
}
//-->
</SCRIPT>
</p>
<tr>
<td background="images/bg_grey.gif" bgcolor="#FFFFFF"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#FF9900" size="4">SellBuy
Yourself <font color="#000000">- Savings Calculator</font></font></strong></font></td>
</tr>
</table>
<form name="calculator">
<table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<td>
<tr>
<td align="right" background="images/bg_grey.gif">
<tr background="images/bg_grey.gif">
<td align="right"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Property
Value: </font></td>
<td>
<select name="propValue" size="1">
<option value="50000">\$50,000</option>
<option value="100000">\$100,000</option>
<option value="150000">\$150,000</option>
<option value="200000" selected>\$200,000</option>
<option value="250000">\$250,000</option>
<option value="300000">\$300,000</option>
<option value="350000">\$350,000</option>
<option value="400000">\$400,000</option>
<option value="450000">\$450,000</option>
<option value="500000">\$500,000</option>
<option value="550000">\$550,000</option>
<option value="600000">\$600,000</option>
<option value="650000">\$650,000</option>
<option value="700000">\$700,000</option>
<option value="750000">\$750,000</option>
<option value="800000">\$800,000</option>
<option value="850000">\$850,000</option>
<option value="900000">\$900,000</option>
<option value="950000">\$950,000</option>
<option value="1000000">\$1,000,000</option>
<option value="1100000">\$1,100,000</option>
<option value="1200500">\$1,200,500</option>
<option value="1300000">\$1,300,000</option>
<option value="1400000">\$1,400,000</option>
<option value="1500000">\$1,500,000</option>
</select></td>
<td align="right"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Agent
Commission:</font></td>
<td align="right">
<select name="commission" size="1">
<option value="2">2%</option>
<option value="25">2.5%</option>
<option value="3" selected>3%</option>
<option value="35">3.5%</option>
<option value="4">4%</option>
<option value="45">4.5%</option>
<option value="5">5%</option>
<option value="55">5.5%</option>
<option value="6">6%</option>
</select>
</td>
</tr>

<tr background="images/bg_grey.gif">
<td height="32" align="right"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
<td></td>
<td align="right"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Advertising Fee:</font></td>
<td align="right">
<option value="500">\$500</option>
<option value="750">\$750</option>
<option value="1000" selected>\$1,000</option>
<option value="1500">\$1,500</option>
<option value="2000">\$2,000</option>
<option value="2500">\$2,500</option>
<option value="3000">\$3,000</option>
<option value="3500">\$3,500</option>
<option value="4000">\$4,000</option>
<option value="4500">\$4,500</option>
<option value="5000">\$5,000</option>
</select></td></tr>

</table>

</td>
</tr>
<tr>
<td align="right" background="images/bg_grey.gif"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Your
fee to Agent: \$</font> <input type="text" name="agentCostBox" value="" size="15">
<font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><br>
</font>
</td>

</tr>
<tr>
<td align="right" bgcolor="#FFFFFF"><strong><font color="#FF9900" size="2" face="Verdana, Arial, Helvetica, sans-serif">The
<input type="text" name="flatFeeBox" value="" size="15"></td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF"><strong><font color="#FF9900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Your
Saving: \$</font></strong>
<input type="text" name="dollarSavingBox" value="" size="15"></td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF"> <font color="#FF9900" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Percentage
Saving: %</strong></font>
<input type="text" name="savingBox" value="" size="15">

<p> <input type="button" value="Calculate My Savings!" onClick="calculateFees();"></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>