Updated the script to work with latest version of jQuery (v1.9.1)