Patched to work with jQuery 1.9+

Replaced user agent detection with standard javascript