// FilterBox Plugin
(function($){  
 $.fn.filterBox = function(options) {  
  
  var defaults = {  
   width: 461,  
   height: 190,
   thumbnails: 0
  };  

  var options = $.extend(defaults, options);  
      
  return this.each(function() {  
    var obj = $(this);
    var queryInput = $('.queryInput', obj);
    var categorySelect = $('.categorySelect', obj);
    
    queryInput.keyup(function () {
      var filter = $(this).val();
      $('.items', obj).children().each(function () {
          if ($(this).text().search(new RegExp(filter, 'i')) < 0) {
              $(this).fadeOut(100);
          } else {
              $(this).fadeIn(100);
          }
      });
    });

    categorySelect.change(function () {
      var filter = $(this).val();
      if ($(this).val() != 'All Categories') {
          $('.categoryName', obj).each(function () {
              if ($(this).text().search(new RegExp(filter, 'i')) < 0) {
                  $(this).parent().fadeOut(100);
              } else {
                  $(this).parent().fadeIn(100);
              }
          });
      } else {
          $('.categoryName', obj).parent().fadeIn();
      }
    });
    
    // Disable Link
    $('.itemTitle', obj).click(function() {return false;});
    


  });  

 };  
})(jQuery); 