function VM_Register_onSubmit(){VM.Register.submit()}function VM_Register_recaptcha(){VM.AccountModal.addRecaptcha()}var VM;if(typeof jQuery=="undefined")throw new Error("Bootstrap's JavaScript requires jQuery");+function(n){"use strict";var t=n.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||t[0]==1&&t[1]==9&&t[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher");}(jQuery);+function(n){"use strict";function i(i,r){return this.each(function(){var f=n(this),u=f.data("bs.modal"),e=n.extend({},t.DEFAULTS,f.data(),typeof i=="object"&&i);u||f.data("bs.modal",u=new t(this,e));typeof i=="string"?u[i](r):e.show&&u.show(r)})}var t=function(t,i){this.options=i;this.$body=n(document.body);this.$element=n(t);this.$dialog=this.$element.find(".modal-dialog");this.$backdrop=null;this.isShown=null;this.originalBodyPad=null;this.scrollbarWidth=0;this.ignoreBackdropClick=!1;this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,n.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))},r;t.VERSION="3.3.5";t.TRANSITION_DURATION=300;t.BACKDROP_TRANSITION_DURATION=150;t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0};t.prototype.toggle=function(n){return this.isShown?this.hide():this.show(n)};t.prototype.show=function(i){var r=this,u=n.Event("show.bs.modal",{relatedTarget:i});if(this.$element.trigger(u),!this.isShown&&!u.isDefaultPrevented()){this.isShown=!0;this.checkScrollbar();this.setScrollbar();this.$body.addClass("modal-open");this.escape();this.resize();this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',n.proxy(this.hide,this));this.$dialog.on("mousedown.dismiss.bs.modal",function(){r.$element.one("mouseup.dismiss.bs.modal",function(t){n(t.target).is(r.$element)&&(r.ignoreBackdropClick=!0)})});this.backdrop(function(){var f=n.support.transition&&r.$element.hasClass("fade"),u;r.$element.parent().length||r.$element.appendTo(r.$body);r.$element.show().scrollTop(0);r.adjustDialog();f&&r.$element[0].offsetWidth;r.$element.addClass("in");r.enforceFocus();u=n.Event("shown.bs.modal",{relatedTarget:i});f?r.$dialog.one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(u)}).emulateTransitionEnd(t.TRANSITION_DURATION):r.$element.trigger("focus").trigger(u)})}};t.prototype.hide=function(i){(i&&i.preventDefault(),i=n.Event("hide.bs.modal"),this.$element.trigger(i),this.isShown&&!i.isDefaultPrevented())&&(this.isShown=!1,this.escape(),this.resize(),n(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),n.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",n.proxy(this.hideModal,this)).emulateTransitionEnd(t.TRANSITION_DURATION):this.hideModal())};t.prototype.enforceFocus=function(){n(document).off("focusin.bs.modal").on("focusin.bs.modal",n.proxy(function(n){this.$element[0]===n.target||this.$element.has(n.target).length||this.$element.trigger("focus")},this))};t.prototype.escape=function(){if(this.isShown&&this.options.keyboard)this.$element.on("keydown.dismiss.bs.modal",n.proxy(function(n){n.which==27&&this.hide()},this));else this.isShown||this.$element.off("keydown.dismiss.bs.modal")};t.prototype.resize=function(){if(this.isShown)n(window).on("resize.bs.modal",n.proxy(this.handleUpdate,this));else n(window).off("resize.bs.modal")};t.prototype.hideModal=function(){var n=this;this.$element.hide();this.backdrop(function(){n.$body.removeClass("modal-open");n.resetAdjustments();n.resetScrollbar();n.$element.trigger("hidden.bs.modal")})};t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null};t.prototype.backdrop=function(i){var e=this,f=this.$element.hasClass("fade")?"fade":"",r,u;if(this.isShown&&this.options.backdrop){r=n.support.transition&&f;this.$backdrop=n(document.createElement("div")).addClass("modal-backdrop "+f).appendTo(this.$body);this.$element.on("click.dismiss.bs.modal",n.proxy(function(n){if(this.ignoreBackdropClick){this.ignoreBackdropClick=!1;return}n.target===n.currentTarget&&(this.options.backdrop=="static"?this.$element[0].focus():this.hide())},this));if(r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!i)return;r?this.$backdrop.one("bsTransitionEnd",i).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):i()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),u=function(){e.removeBackdrop();i&&i()},n.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",u).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):u()):i&&i()};t.prototype.handleUpdate=function(){this.adjustDialog()};t.prototype.adjustDialog=function(){var n=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&n?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!n?this.scrollbarWidth:""})};t.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})};t.prototype.checkScrollbar=function(){var n=window.innerWidth,t;n||(t=document.documentElement.getBoundingClientRect(),n=t.right-Math.abs(t.left));this.bodyIsOverflowing=document.body.clientWidth'+t+"<\/div>");r?this.$message.prependTo(n):this.$message.appendTo(n)},removeMessage:function(){this.$message&&(this.$message.remove(),this.$message=null)},setTitle:function(n){this.$title.text(n||this.defaultTitle)},setDesc:function(n){this.$desc.text(n||this.defaultDesc).removeClass("hidden")},setView:function(n){n&&this.$modal.find(".modal-toggles .btn").eq(n).click()},onTrigger:function(n){var t,i;n.preventDefault();t=VM.AccountModal;t.$trigger=$(this);t.setTitle(t.$trigger.data("modal-set-title"));t.setDesc(t.$trigger.data("modal-set-desc"));t.setView(t.$trigger.data("modal-set-view"));t.$modal.modal("show");i=VM.Ajax.getFunction(t.getFunctionName("modal-on-opened",t.$modal.data("opened")));typeof i=="function"&&i(t.$trigger);t.deferred&&(typeof grecaptcha=="undefined"?$.getScript("https://www.google.com/recaptcha/api.js",function(n,i,r){r.status===200&&(t.addRecaptcha(),VM.Register.$submitButton.prop("disabled",!1))}):(t.addRecaptcha(),VM.Register.$submitButton.prop("disabled",!1)))},onModalViewToggle:function(n){n.preventDefault();var t=$(this);VM.AccountModal.modalViewToggle(t)},modalViewToggle:function(n){var i=$(n.data("target")),t=i.removeClass("hidden"),r=t.index(".modal-body"),u=VM.AccountModal.$modal.find(".modal-toggles .btn").eq(r);t.siblings(".modal-body").addClass("hidden");u.removeClass("inactive").addClass("theme-colour").addClass("active").siblings().removeClass("active").removeClass("theme-colour").addClass("inactive");t.find(".form-control").first().focus()},addRecaptcha:function(){grecaptcha.ready(function(){VM.AccountModal.recaptcha==null&&(VM.AccountModal.recaptcha=grecaptcha.render("register-recaptcha"))})},getFunctionName:function(n,t){var i;return this.$trigger&&(i=this.$trigger.data(n)),i||t}};VM.Login={$form:null,$forgotForm:null,init:function(){this.$form=$("#account-login-form").on("click",".account-notfound",this.onAccountNotFound).on("click","#account-login-forgot",this.onForgotPassword).on("submit",this.onSubmit);this.$forgotForm=$("#account-forgot-form").on("click","#account-forgot-cancel",this.onForgotPasswordCancel).on("submit",this.onForgotPasswordSubmit);this.$submitButton=$("#account-login-submit")},onAccountNotFound:function(n){n.preventDefault();VM.Register.fillEmail($("#account-login-email").val());VM.Login.$form.find(".modal-toggle").click()},onSubmit:function(n){n.preventDefault();VM.Login.$form.valid()&&(VM.Login.$submitButton.prop("disabled",!0).addClass("loading"),VM.AccountModal.removeMessage(),$.ajax(VM.Login.$form.attr("action"),{method:"POST",data:VM.Login.$form.serialize()}).done(function(n){VM.Login.success(n)}).fail(function(){VM.AccountModal.addMessage(VM.Login.$form,"There was a problem signing in.")}).always(function(){VM.Login.$submitButton.prop("disabled",!1).removeClass("loading")}))},success:function(n){var r,t,i;if(n.ok)VM.AccountModal.$modal.modal("hide"),VM.Me.load(n.user),r=VM.Ajax.getFunction(VM.AccountModal.getFunctionName("modal-on-loggedin",VM.Login.$form.data("ajax-success"))),typeof r=="function"?VM.Login.resetAfTokens(function(){r(n.user,VM.AccountModal.$trigger)}):VM.Login.resetAfTokens();else{t="There was a problem signing in.";i="danger";switch(n.status){case"NotFound":t='That account was not found. Register<\/a>';i="warning";break;case"IncorrectPassword":t="Your sign in attempt failed. Did you forget your password?";break;case"DeletedAccount":t="That account has been removed. Please contact us for more information.";break;case"DisabledAccount":t=n.reasonCode||"That account has been disabled. Please contact us for more information.";break;case"DeclinedAccount":t=n.reasonCode||"That account registration was declined. Please contact us for more information.";break;case"NewAccount":case"RequiresVerification":t="That account still requires email verification. Please check your email and follow the instructions to verify your email address.";i="warning";break;case"PendingAccount":t="This account is verified but is currently being reviewed. We will contact you shortly.";i="warning";break;case"LockedOut":t="This account has been locked out for security reasons, please try again later."}VM.AccountModal.addMessage(VM.Login.$form,t,i);n.message=t}},resetAfTokens:function(n){$.ajax("/account/af",{method:"POST"}).done(function(t){VM.Me.updateAntiforgery(t);typeof n=="function"&&n()})},fillEmail:function(n){return $("#account-login-email").val(n)},onForgotPassword:function(n){n.preventDefault();VM.Login.$form.addClass("hidden");VM.Login.$forgotForm.removeClass("hidden");$("#account-forgot-email").val($("#account-login-email").val());VM.Login.$forgotForm.find(".account-returnurl").val(VM.Login.$form.find(".account-returnurl").val())},onForgotPasswordCancel:function(){VM.Login.$form.removeClass("hidden");VM.Login.$forgotForm.addClass("hidden")},onForgotPasswordSubmit:function(n){n.preventDefault();VM.Login.$forgotForm.valid()&&(VM.Ajax.onBegin.call(VM.Login.$forgotForm),VM.AccountModal.removeMessage(),$.ajax(VM.Login.$forgotForm.attr("action"),{method:"POST",data:VM.Login.$forgotForm.serialize()}).done(function(n){VM.Login.$forgotForm.hasClass("account-resetting")?VM.Login.processResetPasswordResult(n):VM.Login.processForgotPasswordResult(n)}).fail(function(){VM.AccountModal.addMessage(VM.Login.$forgotForm,"There was a problem sending your password reset verification code.")}).always(function(){VM.Ajax.onComplete.call(VM.Login.$forgotForm)}))},processForgotPasswordResult:function(n){var t="There was a problem sending your password reset code via email.",i="danger",r=!1;switch(n.result){case"NotFound":t='That account was not found. Register<\/a>';i="warning";break;case"DeletedAccount":t="That account has been removed. Please contact us for more information.";break;case"DisabledAccount":t=n.reasonCode||"That account has been disabled. Please contact us for more information.";break;case"DeclinedAccount":t=n.reasonCode||"That account registration was declined. Please contact us for more information.";break;case"NewAccount":t="That account still requires email verification. Please check your email and follow the instructions to verify your email address.";i="warning";break;case"PendingAccount":t="This account is verified but is currently being reviewed. We will contact you shortly.";i="warning";break;case"Found":t="An email has been sent that will include a verification code to reset your password. Copy and paste this into the verification code field below.";i="success";r=!0}VM.AccountModal.addMessage(VM.Login.$forgotForm,t,i,r);n.result==="Found"&&(this.$forgotForm.attr("action",this.$forgotForm.data("reset-action")).addClass("account-resetting"),$("#account-forgot-email").prop("readonly",!0),$("#account-forgot-resetsection").removeClass("hidden").find("input").prop("readonly",!1),$("#account-forgot-cancel").remove(),$("#account-forgot-message").remove(),$("#account-forgot-submit").text("Set Password"))},processResetPasswordResult:function(n){if(n.success){VM.AccountModal.$modal.modal("hide");VM.Me.load(n.user);VM.Ajax.toast("Your password was reset successfully. You are now signed in.","success",!0);var t=VM.Ajax.getFunction(VM.AccountModal.getFunctionName("modal-on-password-reset",VM.Login.$forgotForm.data("ajax-success")));typeof t=="function"?VM.Login.resetAfTokens(function(){t(n.user,VM.AccountModal.$trigger)}):VM.Login.resetAfTokens()}else n.userDisabled?VM.AccountModal.addMessage(VM.Login.$forgotForm,"Sorry, your password reset failed because your account is disabled."):n.userFound?VM.AccountModal.addMessage(VM.Login.$forgotForm,"Your password reset failed. Ensure that you copied and pasted your email verification code properly."):VM.AccountModal.addMessage(VM.Login.$forgotForm,"Sorry, your account could not be found. Ensure you have entered your email address correctly")}};VM.Register={$form:null,$confirmForm:null,$submitButton:null,submitClicked:!1,init:function(){this.$form=$("#quick-account-form").on("click",".account-email-exists",this.onEmailExists).on("submit",this.onSubmit);this.$confirmForm=$("#account-confirmemail-form").on("submit",this.onSubmitConfirm);this.$submitButton=$("#quick-account-form-submit").click(this.onValidate);VM.AccountModal.deferred&&this.$submitButton.prop("disabled",!0)},fillEmail:function(n){return $("#quick-account-email").val(n)},onEmailExists:function(n){n.preventDefault();var t=$(this).closest(".field-validation-error").removeClass("field-validation-error").addClass("field-validation-valid"),i=t.prev();t.children().remove();VM.Register.$form.validate().resetForm();VM.Login.fillEmail(i.val());i.val("");VM.Register.$form.find(".modal-toggle").click()},onValidate:function(n){n.preventDefault();VM.Register.$form.validate();VM.Register.$form.valid()?(VM.Register.submitClicked=!0,grecaptcha.execute(VM.AccountModal.recaptcha)):(VM.Register.submitClicked=!1,grecaptcha.reset(VM.AccountModal.recaptcha))},submit:function(){VM.Register.$submitButton.addClass("loading").prop("disabled",!0);VM.Register.$form.submit()},onSubmit:function(n){VM.Register.$submitButton.addClass("loading").prop("disabled",!0);VM.Register.$form.data("modal")&&(n.preventDefault(),VM.AccountModal.removeMessage(),$.ajax(VM.Register.$form.attr("action"),{method:"POST",data:VM.Register.$form.serialize()}).done(function(n){VM.Register.$form.addClass("hidden");VM.Register.$confirmForm.removeClass("hidden");VM.Register.$confirmForm.find(".account-confirmemail-user").val(n.user);VM.Register.submitClicked=!1}).fail(function(n){var t=VM.Ajax.getXhrError(n);VM.AccountModal.addMessage(VM.Register.$form,t)}).always(function(){VM.Register.$submitButton.removeClass("loading").prop("disabled",!1);grecaptcha.reset(VM.AccountModal.recaptcha)}))},onSubmitConfirm:function(n){n.preventDefault();VM.AccountModal.removeMessage();VM.Ajax.onBegin.call(VM.Register.$confirmForm);$.ajax(VM.Register.$confirmForm.attr("action"),{method:"POST",data:VM.Register.$confirmForm.serialize()}).done(function(n){if(VM.Register.$confirmForm.empty(),n.verificationType===1||n.verificationType===2)VM.Me.load(n.user),VM.AccountModal.addMessage(VM.Register.$confirmForm,"Thank you for confirming your email address. Your account is now ready to use","success"),VM.Login.resetAfTokens(function(){VM.Register.$confirmForm.append('