diff --git a/recaptcha.js b/recaptcha.js
new file mode 100644
index 0000000..58fedee
--- /dev/null
+++ b/recaptcha.js
@@ -0,0 +1,5 @@
+Drupal.behaviors.recaptcha = function(context) {
+	
+	Recaptcha.create(Drupal.settings.recaptcha.public_key, Drupal.settings.recaptcha.container, {theme: Drupal.settings.recaptcha.theme});
+	
+}
\ No newline at end of file
diff --git a/recaptcha.module b/recaptcha.module
index dd9a66a..fb9c09f 100644
--- a/recaptcha.module
+++ b/recaptcha.module
@@ -155,8 +155,8 @@ function recaptcha_captcha() {
             '#type' => 'item',
             '#value' => '<div id="recaptcha_ajax_api_container">'. $html .'</div>',
           );
-          $js = "$(function() { Recaptcha.create('$recaptcha_public_key', 'recaptcha_ajax_api_container', {theme: '$recaptcha_theme'});});";
-          drupal_add_js($js, 'inline', 'header');
+		drupal_add_js(array("recaptcha" => array("public_key" => $recaptcha_public_key, "container" => 'recaptcha_ajax_api_container', "theme" => $recaptcha_theme)), "setting" );
+		drupal_add_js(drupal_get_path("module", "recaptcha")."/recaptcha.js");
           drupal_set_html_head('<script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>');
         }
       }

