Function calculates discount twice
<p>For the life of me I can't seem to figure out why this function won't calculate correctly. If I run this function the discount (<code>totalPrice</code>) is applied twice, for example: <code>20*1.05 == 21</code>, but when the function runs and it gives me <code>22.05</code>.</p>

<p>What am I doing wrong? Thanks for the help.</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function codeDiscount() {
        var totalCost = document.getElementById('total').value;
        var custCode = document.getElementById('coupon').value; 

        if (custCode == "ABCD" || custCode == "EFGH")
        {
            totalCost = document.getElementById('total').value; 
            var totalPrice = parseInt(totalCost) * 1.05;
            document.getElementById('total').value = totalPrice;
        }
    }
&lt;/script&gt;
</code></pre>
