title: Subtraction becomes addition?
body: <p>I'm having a bizarre problem in what should be a very simple calculation. When the <code>addDomain</code> checkbox is clicked, the page fires an ajax request to the php backend, where the new subtotal is determined based on the parameters passed. When the checkbox is first checked, everything works as it should (ie, the new sum is returned). If the checkbox is subsequently unchecked, the request is fired again, but returns a sum from an addition somewhere instead of the product of a subtraction.</p>
  
  <p>Here is the code I'm using. It should be pretty straightforward as to what I'm trying to do.</p>
  
  <pre><code>case 'domainprices':
      $sub = request_var('s', 0.00);
      $checked = request_var('c', true);
      $price = (float) 10.99;
  
      if($checked){
          $sub = $sub + $price;
      }else{
          $sub = $sub - $price;
      }
      $res['res'] = $sub;
      echo json_encode($res);
  break;
  
  case 'hosting':
  $id = request_var('id', '');
  switch($id){
      case 'economy':
          $res['body'] = '&lt;div&gt;
              &lt;select name="duration"&gt;
                  &lt;option value="3"&gt;3 years @ $2.99/Mo&lt;/option&gt;
                  &lt;option value="2"&gt;2 years @ $3.99/Mo&lt;/option&gt;
                  &lt;option value="1"&gt;1 year @ $4.99/Mo&lt;/option&gt;
                  &lt;option value="0"&gt;1 month @ $5.99/Mo&lt;/option&gt;
              &lt;/select&gt;&lt;br /&gt;
              Add Domain Name: &lt;input type="checkbox" name="addDomain" /&gt;&lt;br /&gt;
              Subtotal: $&lt;span id="subtotal"&gt;107.64&lt;/span&gt;
          &lt;/div&gt;
          &lt;script&gt;
          $("select[name=duration]").change(function(){
              var duration = $(this).val();
              var checked;
              if($("input[name=addDomain]").is(":checked")){
                  checked = true;
              }else{
                  checked = false;
              }
              Funcs.ajaxCall("services", "mode=hostingprices&amp;d="+duration, function(data){
                  $("#subtotal").html(data.result);
              });
          });
          $("input[name=addDomain]").mousedown(function(){
              var subtotal = $("#subtotal").html();
              var checked;
              if($(this).is(":checked")){
                  checked = false;
              }else{
                  checked = true;
              }
              Funcs.ajaxCall("services", "mode=domainprices&amp;s="+subtotal+"&amp;c="+checked, function(data){
                  $("#subtotal").html(data.res);
              });
          });
          &lt;/script&gt;';
          $res['name'] = "Economy Hosting";
          echo json_encode($res);
      break;
  }
  break;
  </code></pre>