Adding values together

Adding values together

I have the code below and having a brain fart. Looking to add the values together in the txtgrandtotal if the dropdown is set to "yes"... Any help would be great thanks!!

 <body>

        <div id="onewindow">
            <label for="txtoneside" class="editor-label"><strong>1 Side </strong></label>
            <div align="right">
                <input type="text" name="txtoneside" id="txtoneside" value = "" />
                <select name="txtoneside_slider" id="txtoneside_slider" data-role="slider" data-mini="true" onChange="update()"/>
                    <option value="no">No</option>
                    <option value="yes">Yes</option>
                </select>
            </div>
            <div id="twowindow">
                <label for="txtoneside" class="editor-label"><strong>2 Side </strong></label>
                <div align="right">
            <input type = "text" name = "txttwoside" id="txttwoside" value = "" />
                    <select name="txttwoside_slider" id="txttwoside_slider" data-role="slider" data-mini="true" onChange="update()"/>
                        <option value="no">No</option>
                        <option value="yes">Yes</option>
                    </select>
                </div>
                <div id="grandtotal">
                    <label for="txtgrandtotal" class="editor-label"><strong>JOB TOTAL</strong></label>
                    <div align="right">
                        <input type = "text" name = "txtgrandtotal" id="txtgrandtotal" value = "0" />
                    </div>
                </div>
            </div>
        </div>
    <script>
            update = function(){
                var all_values = [],
                    sum = 0,
                    i = 0;
                $('input:not(#txtgrandtotal)').each(function(){
                    all_values.push(parseFloat($(this).attr('value'))); // store each value
                });
                $('select').each(function(){
                    var $option = $(this).find(':selected');
                    if($option.text()){
                        if($option.text()==="Yes")
                            sum+=all_values[i];  // sum only the ones that are selected
                    }
                    ++i;
                });
                $('#txtgrandtotal').attr('value', sum.toFixed(2));
                calculate(); // if that is required somewhere else in your code?
            }
    </script>

</body>