function CaptchaDialog(){$.extend(this,{$form:$("#signup-form form"),$button:$("#user_create_submit"),dialog:null})}$.extend(CaptchaDialog.prototype,{doSubmit:function(A){return function(B){if($(".twttr-dialog:visible").length>0){scribe({event_name:"submit_captcha",experiment_name:"signup_captcha"},"www_ab_tests",{})}if($(".twttr-dialog:visible").length==0&&!A.$form.data("captchaValid")){B.preventDefault();A.$button.click();return false}}},ready:function(){var A=this;if(this.$form.find(".fieldWithErrors").length==0&&this.$form.find("#recaptcha_errors").length>0){this.showCaptchaDialog()}this.$button.click(function(){A.showCaptchaDialog()});this.$form.submit(A.doSubmit(A))},showCaptchaDialog:function(){var A=this;if(this.$form.data("captchaValid")){return }if(!this.dialog){this.dialog=new twttr.dialog({heading:$("<h2/>").text(_("Ętes-vous un humain ?")),content:$("#captcha_dialog"),modal:true,renderInline:true,width:"660px",closeButton:true});this.dialog.bind("close",function(){A.close()})}this.dialog.open();scribe({event_name:"show_captcha_popup",experiment_name:"signup_captcha"},"www_ab_tests",{});this.dialog.find("#recaptcha_response_field").focus()},close:function(){Recaptcha.reload()}});$(function(){new CaptchaDialog().ready()});