Make Mercury compatible with jQuery 1.9 and jQuery-ui 1.10.0

This solves #327 and #313