multiplying taxes and displaying in total text box
===

We dont always have to add taxes to order so i need a way that taxes will be bypassed by default unless specified!

so i have the following text box:

      <input  class="txt1" type="text" name="subtotal" value="" id="subtotal"
      size="16" tabindex="42" onChange="enableBeforeUnload();" 
      onKeyUp="enableBeforeUnload();">
I have this text box working correctly it sums the values 

i have two following text boxes that im trying to multiply by the tax and display the total.

     <input  class="txt1" type="text" name="tax" value="1" size="16" tabindex="42"
      onChange="enableBeforeUnload();" onKeyUp="enableBeforeUnload();">

     <input  class="txt2" type="text" name="total1" value="" id="total1" size="16" 
     tabindex="42" onChange="enableBeforeUnload();" onKeyUp="enableBeforeUnload();">

I tried using the following with no luck

     var tax = +$("#tax").val(),          // get tax and convert to a number
    total = tax ? sum * tax : sum;   // if tax is a non-zero number multiply
                                     // otherwise just take the sum as is     
and this

     totAmt.val(sum + sum*parseFloat(taxAmt.val()/100));

I could not implement either correctly.
Thanks!  

     