made it a jQuery plugin

Little arrangments and now it is a jQuey plugin.