Build query strings, taking care of empty values.
Also, make buildQuery() and parseQuery() globally available.