title: Delete or reset javascript object
body: <p>OK I have a list of products that you can add and delete from using javascript.
  The problem is that I have this singleselect class that is used for highlighting selected products. whenever  I add or remove a product to the list I want to reset or recreate this singleselect object.
  I have searched and I think I understand why the object isn't reseted but I am not sure how to fix it.</p>
  
  <p>My javascript code, this code works but after I remove a product and select another product
  I get an error which shows that the old singleselect object still exists. </p>
  
  <pre><code>var single;
  
  document.addEvent('domready', function() {      
          setSingleSelect();  
  }       
  
    $('removeProduct').addEvent('click',function(e){
          e.stop();           
          $('productList').getElements('input[value="' + removeElement + '"], div[id="' + removeElement + '"]').destroy();
           single = null;
           setSingleSelect();
      });
  
  function setSingleSelect(){
      single = new SingleSelect(
      $('productList').getElements('div'),
      {onSelectChange : function(element) {       
          removeElement = element.id;                         
      }});    
  }
  </code></pre>