Fixed Dom ready bug

This plugin is self calling and was tested in the footer. When included in the head (before the dom had loaded) this script was not working right. Wrapped the self-calling section in a .ready function.