title: By clicking on box1 change value from box2
body: <p>I need your help, I'm looking for a solution of:
  There is a form with several checkboxes, but only 4 of them are important. Here the html code from this 4:</p>
  
  <pre><code>&lt;input name="opt[pool]" id="opt_pool" type="checkbox" class="searchval" value="1" onclick="submit_search()"&gt;Pool
  &lt;input name="opt[ppool]" id="opt_ppool" type="checkbox" class="searchval" value="1" onclick="submit_search()"&gt;PPool
  
  &lt;input name="opt[internet]" id="opt_internet" type="checkbox" class="searchval" value="1" onclick="submit_search()"&gt;Internet
  &lt;input name="opt[internetw]" id="opt_internetw" type="checkbox" class="searchval" value="1" onclick="submit_search()"&gt;InternetW
  </code></pre>
  
  <p>Here is the jQuery code:</p>
  
  <pre><code>function build_search(skip){
      var sparam = ''; 
      var fields = {};
      $('.searchval').each(function(index){          
          if($(this).attr('name')==skip) {}
          else if($(this).attr('type')=='checkbox'||$(this).attr('type')=='radio'){
              if($(this).prop("checked")){
                  sparam+=$(this).attr('name')+"="+$(this).attr('value')+"&amp;";
                  fields[$(this).attr('name')] = $(this).attr('value');
              }
          }
          else if($(this).val()!=undefined&amp;&amp;$(this).val()!=''){
              sparam+=$(this).attr('name')+"="+$(this).val()+"&amp;";
              fields[$(this).attr('name')] = $(this).val();
          }
      });
  }
  </code></pre>
  
  <p>Now I would like to intervene - when clicked on pool, this checked with val=1 and ppool unchecked with val=0. And reverse when click on ppool htis checked with val=1 and pool unchecked with val=0.
  This works with my code:</p>
  
  <pre><code>var boxesP = $('#opt_pool,#opt_ppool').click(function(){
      boxesP.not(this).prop('checked', false);
      $("#opt_pool").val( $("#opt_pool")[0].checked ? "0" : "1" );
      $("#opt_ppool").val( $("#opt_ppool")[0].checked ? "0" : "1" );
  });
  </code></pre>
  
  <p>But the problem is when i click to other checkboxes, the checked pool with val=1, remains checked but the val=0.
  Where is my mistake? Thanks.</p>