This is what I was looking for, but if it slows down the page, I'll try to implement a formula first.
It should be possible.
If it has a P, it searches for pf, if it has u, it searches for uf, for pots, if it has a, b or c, it searches through the appropriate type. I think it's doable anyways...