var ddfilterHiddenElements = new Array();
(function($) {
  $.fn.ddfilter = function(select1) {
	return this.each(function() {
            if(!$(this).data('clone')){
              $(this).data('clone', $(this).clone());
            }

            $(this).empty(); 
            var val = $(select1).val();
            var that = this;
            $(this).data('clone').children().each(function(){
               if($(this).attr("rel") == val || $(this).attr("rel") == "*") $(that).append($(this).clone());
            });
        }); 
/*
	  $this = $(this);
	  var select = $this;
	  var rel = select1.options[select1.selectedIndex].value;
	  var inputname = $(this).attr("name");
	  
	  $this.children().each(function(){
      ddfilterHiddenElements.push({input:inputname, elem: $(this)});
	  });
	  $this.empty();
	  
	  $(ddfilterHiddenElements).each(function(i){
      if(this!=null && this.input==inputname && $(this.elem).attr('rel') == rel || $(this.elem).attr('rel') == "*"){
        select.append(this.elem);
        ddfilterHiddenElements[i]=null;
      }
	  });
	  select.get(0).selectedIndex=0;
    
	});
*/
  };

})(jQuery);

