jQuery codes converted to jQuery plugin.