migrated some remaining JS code from Prototype to jQuery