Added a pure javascript (jQuery) implementation so this can be used on non-wordpress sites.