clean up sort handling for browse-by-state
clean up sort handling for browse-by-state

We have to many ways of searching, and they all have different
problems and lots of duplicate code.

Fixes #38.

solarpermit/solarpermit,solarpermit/solarpermit