Javascript html calculated form selections not working
<p>The form created below allows me to loop though four options &amp; each option will auto fill elements in an html form. I can then calculate the form ok once. After that part I'm lost. I think it needs a switch to call the other drop down data if selected. Or a loop. 
When I select another value after the calculation the form fills in with invalid.</p>

<p>Any help would be much appreciated I've been struggling with this for a few days now. Big Thanks.</p>

<pre><code>        &lt;form name="LED_savings"&gt;
        &lt;script language="JAVASCRIPT"&gt;

    &lt;!-- 

    //electricity_cost inc_watts led_watts led_cost bulbcount hoursday, compute savings_year and payback_in_years


    var led_watts = new Array();
    var led_life = new Array();
    var led_cost = new Array();

    led_watts[0] = "";
    led_life[0] = "";
    led_cost[0] = "";

    led_watts[1] = 60;
    led_life[1] = "50000";
    led_cost[1] = "19.99";

    led_watts[2] = 50;
    led_life[2] = "55000";
    led_cost[2] = "19.99";

    led_watts[3] = 40;
    led_life[3] = "55000";
    led_cost[3] = "19.99";

    led_watts[4] = 35;
    led_life[4] = "55000";
    led_cost[4] = "19.99";


           function Choice() {
               //x = document.getElementById("users");
               y = document.getElementById("wattage");

                 //x.value = y.options[y.selectedIndex].text;
                 document.getElementById("led_watts").value = led_watts[y.selectedIndex];
                 document.getElementById("led_life").value = led_life[y.selectedIndex];
                 document.getElementById("led_cost").value = led_cost[y.selectedIndex];
            }

    //resetform


    //calculations 

    function validateForm(form) {

        if ( form.electricity_cost.value == "" || parseFloat(form.electricity_cost.value)&lt;=0.0) { alert("Please enter the cost of your electricity."); return false; }

        if ( form.inc_watts.value=="" || parseInt(form.inc_watts.value)&lt;=0) {alert("Please enter the wattage of the existing lamp."); return false; }

        if ( form.led_watts.value=="" || parseInt(form.led_watts.value)&lt;=0) {alert("Please enter the wattage of the LED lamp."); return false; }

        if ( form.inc_life.value=="" || parseInt(form.inc_life.value)&lt;=0) {alert("Please enter the expected life in hours of the existing lamp."); return false; }

        if ( form.led_life.value=="" || parseInt(form.led_life.value)&lt;=0) {alert("Please enter the expected life in hours of the LED lamp."); return false; }

        if ( form.inc_cost.value=="" || parseFloat(form.inc_cost.value)&lt;0) {alert("Please enter the cost of the existing lamp."); return false; }

        if ( form.led_cost.value=="" || parseFloat(form.led_cost.value)&lt;0) {alert("Please enter the cost of the LED lamp."); return false; }

        if ( form.bulbcount.value=="" || parseInt(form.bulbcount.value)&lt;=0) {alert("Please enter the number of lamps being replaced."); return false; }

        if ( form.hoursday.value=="" || parseFloat(form.hoursday.value)&lt;=0) {alert("Please enter the hours per day the lamp is typically on."); return false; }

        return true;

    }

    function roundPennies(s) {

        var str=s.toString()+"0000";

        var indexdot = str.indexOf(".");

        var len=str.length;

        if (indexdot&gt;0 &amp;&amp; indexdot&lt;str.length+3) {

            s=str.substring(0,indexdot+3);

        }       

        return s;

    }

    function Calculate(form) {

        savings_year = "0.00";

        payback_in_years = "99.99";

        life_years = "99.99";

        savings_life = "0.00";

        result=validateForm(form);

        if ( result ) {

            electricity_cost=parseFloat(form.electricity_cost.value);

            inc_watts=parseInt(form.inc_watts.value);

            led_watts=parseInt(form.led_watts.value);

            led_cost=parseFloat(form.led_cost.value);

            inc_cost=parseFloat(form.inc_cost.value);

            led_life=parseInt(form.led_life.value);

            inc_life=parseInt(form.inc_life.value);

            bulb_count=parseInt(form.bulbcount.value);

            hours_day=parseFloat(form.hoursday.value);



            hours_year=hours_day*365;

            life_years = led_life / hours_year;


            // What's the LED energy cost per hour?

            led_cost_per_hour = led_watts * electricity_cost / 1000;

            inc_cost_per_hour = inc_watts * electricity_cost / 1000;



            // What's the replacement cost per hour of use?

            led_opcost_per_hour = led_cost / led_life;

            inc_opcost_per_hour = inc_cost / inc_life;


            // Total operating cost per hour

            led_cost_per_hour = led_cost_per_hour + led_opcost_per_hour;

            inc_cost_per_hour = inc_cost_per_hour + inc_opcost_per_hour;


            // Total cost per year

            led_cost_year = hours_year * led_cost_per_hour;

            inc_cost_year = hours_year * inc_cost_per_hour;

            // what is the life cost savings:

            saving_base = inc_cost_year - led_cost_year;

            savings_life = life_years * saving_base;
            savings_life *= bulb_count;


            // Savings per year and delta cost on purchase price

            savings_year = inc_cost_year - led_cost_year;

            delta_cost = led_cost - inc_cost;



            // Payback period

            payback_period = delta_cost / savings_year;



            // Savings / year should be multiplied by bulb count - but this

            // should not affect payback period.

            savings_year *= bulb_count;

        }

        savings_year=roundPennies(savings_year);

        payback_in_years=roundPennies(payback_period);

        life_years=roundPennies(life_years);

        savings_life=roundPennies(savings_life);

        form.savings_year.value = savings_year;

        form.payback_in_years.value = payback_in_years;

        form.life_years.value = life_years;

        form.savings_life.value = savings_life;


        return;

    }


    //end of code hiding --&gt;

    &lt;/script&gt;&lt;script language="JavaScript"&gt;focus()&lt;/script&gt;
            &lt;table class="calculator"&gt;
                &lt;tbody&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Wattage of current bulb&lt;/td&gt;
                        &lt;td style="margin-left: 20px"&gt;
                        &lt;select id="wattage" name="inc_watts" onchange="Choice();setAndReset(this);"&gt;
                        &lt;option&gt;Select Wattage&lt;/option&gt;
                        &lt;option value="1"&gt;60 Watts&lt;/option&gt;
                        &lt;option value="2"&gt;50 Watts&lt;/option&gt;
                        &lt;option value="3"&gt;40 Watts&lt;/option&gt;
                        &lt;option value="4"&gt;35 Watts&lt;/option&gt;
                        &lt;/select&gt;
                    &lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Number of lamps being replaced&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="bulbcount" size="10" type="text" value="1" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            My electricity cost, in pence per kwh *&lt;br /&gt;
                            &lt;sub&gt;(average rate is 15p/kwh)&lt;/sub&gt;&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="electricity_cost" size="10" type="text" value="0.15" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            FLUX LED BULB Equivalent Wattage&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input id="led_watts" name="led_watts" size="10" type="text" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            LED lamp life 25 Years (hours)&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input id="led_life" name="led_life" size="10" type="text" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Existing lamp life 25 Years (hours)&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="inc_life" size="10" type="text" value="1000" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Cost per LED replacement lamp £&lt;br /&gt;
                            &lt;sub&gt;(average price per bulb)&lt;/sub&gt;&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input id="led_cost" name="led_cost" size="10" type="text" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Cost per existing bulb £&lt;br /&gt;
                            &lt;sub&gt;(average price per bulb)&lt;/sub&gt;&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="inc_cost" size="10" type="text" value="6" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Number of hours/day bulb is in use&lt;br /&gt;
                            &lt;sub&gt;(average usage is 4 hours per day)&lt;/sub&gt;&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="hoursday" size="10" type="text" value="6" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            &amp;nbsp;&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input onclick="Calculate(this.form)" size="10" type="button" value="Calculate" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Savings per year&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="savings_year" size="10" type="text" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Usable Life of LEDs in Years&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="life_years" size="10" type="text" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Payback in years&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="payback_in_years" size="10" type="text" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            Savings OverLife of LED Bulbs&lt;/td&gt;
                        &lt;td&gt;
                            &lt;input name="savings_life" size="10" type="text" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/tbody&gt;
            &lt;/table&gt;
    &lt;/form&gt;
</code></pre>
