Misc improvements

Improved SQL WHERE clause generation. Added datepicker to date fields
(and added jquery UI resources to support it).  Improved storing
parameters in URL. Fixed bug with popstate event. Etc.