Upgrade from JavaScript to iQuery