/**
     * Filter Klasse für service & leistungen 
     * filtert nach checkboxen die anzuzeigenden Elemente
     * @author Torsten Zander
     * @copyright wdv
     * @version prototype 1.6 >
     * 21.8.2008
     */
    
    var Filter = Class.create({
        /**
         * constructor
         * @param {Object} element Box in dem die behandelten Elemente sind
         */
      initialize : function (element) {
          this.element = element;
      },
      run: function() {
        var str = this.getCheckedAsString();
        this.addAttributes();
        this.hideAll();
        this.showFiltered(str);
      },
      /**
       * sammelt alle checked element und bastelt string
       * @return string
       */
      getCheckedAsString: function() {
            var str = '';
            var checkedBoxes = $$('input:checked');
            checkedBoxes.each(function(scope) {
                str = str+'_'+scope.getValue();
            });
            return str;
            
      },
      /**
       * versteckt alle li elemente
       */
      hideAll: function () {
          var toHide = $(this.element).select('li'); 
        toHide.invoke('hide');
      },
       /**
       * zeigt alle li elemente
       */
      showAll: function () {
          var toHide = $(this.element).select('li'); 
        toHide.invoke('show');
      },
      /**
       * zeigt alle Element die dem Suchstring entsprechen
       * @param string strFilter
       */
      showFiltered: function (strFilter) {
          if(strFilter == '') {
            this.showAll();
        }
          strings = strFilter.split('_');
        strings.each(function(scope) {
            if (scope != '') {
                var toShow = $(Filter.element).select('li[id*='+scope+']');
                toShow.invoke('show');
            }
        });
      },
      /**
       * fügt dem li Element eine id hinzu, diese wird aus den id der img's 
       * zusammengstellt
       */
      addAttributes: function () {
          var lists = $(this.element).select('li'); 
        
          lists.each(function(ListScope) {
            var images = ListScope.select('img');
            var str = '';
               images.each(function(imageScope) {
               
                   if(imageScope.id != 'undefined') {
                    str = str+'_'+imageScope.id;
                }
                
            });
            ListScope.writeAttribute('id', str);
          });
      }
    });
    
    // initialisert Filter Klasse
    var Filter = new Filter('reiterbox');
