finished and turned into a jquery plugin