﻿function filter() {

  // Hide all items
  $("#results .item").css("display","none");
  
  // Find items that have the right fund and show them
  $("#results .item .links ."+$("#fundfilter").val()).each(function(){
    $(this).parent().parent().css("display","block");
  });
  
  if($("#fundfilter").val() == 'All'){
    $("#results .item").css("display","block");
  }

  // Find items that have the begin with right letter and show them
  if($("#letterfilter").val() != 'All'){
    $("#results .item h4").each(function(){
      if($(this).html().substring(0,1) != $("#letterfilter").val()){
        $(this).parent().css("display","none");
      }
    });
  }
}