various optimizations

setup apache gzip, use jQuery selectors instead of for loops, use
minified query, prevent php undefined notices (not sure if this
actually helps, but less warnings).