consolidated common code, added query_location field

consolidated common html code (headers, footers, table declarations)
that was shared among the 3 views.  added a query_location field in the
db for all new queries to populate
updated ruby script, added search locations to db

allows user to dynamically set what gets populated in the database by
using the settings page.