converted to jQuery plugin - resolves #1