Rewrote captionPosition() function

Rewrote captionPosition() to be written in JavaScript instead of jQuery and wrote it so it can run on multiple captions on a single page.