title: retrieving the correct "this" in javascript
body: <p>I have built my own object:</p>
  
  <pre><code>Main.utilities.pool = function (pool) {
      var counter=0;
      var $form = $(pool);
  
      return {
          add_pool_field: function(){
              $form.find('#practice_type').change(function() {
                  if($(this).find("option:selected").val()){
                      var time = new Date().getTime();
                      var regexp = new RegExp( $(this).find("option:selected").data('id'), 'g');
                      $("#items").append('&lt;li class="colorize"&gt;' + '&lt;h1&gt;' + this.increment_counter() + '&lt;/h1&gt;' + $(this).find("option:selected").data('fields').replace(regexp, time) + '&lt;/li&gt;');
                  }
              });
          },
          increment_counter: function(){
              return ++counter;
          },
          init: function() {
              this.add_pool_field();
          }
      }
  }
  </code></pre>
  
  <p>I call it as such:</p>
  
  <pre><code>var $profile_pool = Main.utilities.pool($('#new_form')).init();
  </code></pre>
  
  <p>The problem is in the change event, this refers to a select field. However, I want to access the increment_counter function of the actual anynomous object that was returned from the pool function. When I try this.increment_counter(), it thinks this is the html select field, and so it blows up. How can I gain access to that object within the context of the function passed to change?</p>