Temporarily remove access to execute function
<p>I'm working on a project where I on a website display content users can "interact" with using keypress W or P. Doing this, the site executes a function posting to a php writing to a mysql-database. However, if the key is pressed and HOLD or pressed multiple times in a row - I get multiple setTimeouts running and crap happens. <strong>How can I temporarily remove access to running (or disable) the keypress-functions when executed once?</strong></p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
    &lt;script language="javascript" type="text/javascript" src="jquery-1.6.4.min.js"&gt;&lt;/script&gt;
        &lt;script language="javascript" type="text/javascript" src="jquery.jkey-1.2.js"&gt;&lt;/script&gt;
        &lt;link rel="stylesheet" href="custom.css"&gt;
        &lt;script&gt;

$(function content(){
var reloading = function(data){
      $.ajax({                                      
      url: 'api.php',                        
      data: "",                      
      dataType: 'json',                     
      success: function(data)          
      {
        var id = data[0];              
          _id = id;
        var vname = data[1];           
        var message = data[2]; 
        var field1 = data[3]; 
        _field1 = field1;
        var field2 = data[4];
        _field2 = field2;
        var ans1 = data[5];
        _ans1 = ans1;
        var ans2 = data[6];
        _ans2 = ans2;
        var val1 = parseInt(ans1, 10) ;
        _val1 = val1;
        var val2 = parseInt(ans2, 10) ;
        _val2 = val2;

        $('#output').hide().html( message ).fadeIn("slow");   
         $('#username').hide().html( "@"+vname +":" ).fadeIn("slow");
         $('#valg1').hide().html( field1  ).fadeIn("slow");
         $('#valg2').hide().html( field2  ).fadeIn("slow");
     window["reload_timer"] =  setTimeout(reloading,6000);
 }
      });
  }
    reloading();

  $(document).jkey('p',function() {
     $.post("update.php", { "id": _id} )
      $('#output').hide().html( "&lt;i&gt;Thx!&lt;/i&gt;&lt; ).fadeIn("slow");
      $('#username').fadeOut("fast");
      $('#valg1').fadeOut("fast");
      $('#valg2').fadeOut("fast");
        clearTimeout(window["reload_timer"]);
         setTimeout(reloading,5000);
      });
        $(document).jkey('w',function() {
     $.post("update.php", { "id2": _id} )
      $('#output').hide().html( "&lt;i&gt;Thx!&lt;/i&gt;&lt; ).fadeIn("slow");
      $('#username').fadeOut("fast");
      $('#valg1').fadeOut("fast");
      $('#valg2').fadeOut("fast");
        clearTimeout(window["reload_timer"]);
         setTimeout(reloading,5000);
      });
      }); 
&lt;/script&gt;

&lt;/head&gt;
  &lt;body&gt;&lt;div id="container"&gt;
      &lt;div id="username"&gt;
&lt;/div&gt;
  &lt;div id="output"&gt;&lt;/div&gt;
  &lt;div id="posted"&gt;&lt;/div&gt;
     &lt;div id="field1"&gt;&lt;/div&gt;
&lt;div id="valg1"&gt;&lt;/div&gt;
       &lt;div id="valg2"&gt;&lt;/div&gt;
       &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;  
</code></pre>
