Should probably add these two pieces of Javascript with `drupal_add_js()`, instead of appending to the body like this. ...  Not sure where the call would go... Possibly in the theme, if that's where the div we're attaching to it created?