(function(n){function r(r,u){this.element=r;this.options=n.extend({},i,u);this._defaults=i;this._name=t;this._loader=null;this.init()}function u(){n[t]||(n.isLoading=function(t){n("body").isLoading(t)})}var t="isLoading",i={position:"right",text:"","class":"icon-refresh",tpl:'<span class="isloading-wrapper %wrapper%">%text%<i class="%class% icon-spin"><\/i><\/span>',disableSource:!0,disableOthers:[]};r.prototype={init:function(){n(this.element).is("body")&&(this.options.position="overlay");this.show()},show:function(){var t=this.options.tpl.replace("%wrapper%"," isloading-show  isloading-"+this.options.position),r,i;t=t.replace("%class%",this.options["class"]);t=t.replace("%text%",this.options.text!==""?this.options.text+" ":"");this._loader=n(t);n(this.element).is("input, textarea")&&!0===this.options.disableSource?n(this.element).attr("disabled","disabled"):!0===this.options.disableSource&&n(this.element).addClass("disabled");switch(this.options.position){case"inside":n(this.element).html(this._loader);break;case"overlay":n(this.element).is("body")?n("body").prepend('<div class="isloading-overlay" style="position:fixed; left:0; top:0; z-index: 10000; background: rgba(0,0,0,0.5); width: 100%; height: '+n(this.element).outerHeight()+'px;" />'):(r=n(this.element).css("position"),i=null,i="relative"===r||"absolute"===r?{top:0,left:0}:n(this.element).position(),n(this.element).prepend('<div class="isloading-overlay" style="position:absolute; top: '+i.top+"px; left: "+i.left+"px; z-index: 10000; background: rgba(0,0,0,0.5); width: "+n(this.element).outerWidth()+"px; height: "+n(this.element).outerHeight()+'px;" />'));n(".isloading-overlay").html(this._loader);break;default:n(this.element).after(this._loader)}this.disableOthers()},hide:function(){"overlay"===this.options.position?n(this.element).find(".isloading-overlay").remove():(n(this._loader).remove(),n(this.element).text(n(this.element).attr("data-isloading-label")));n(this.element).removeAttr("disabled").removeClass("disabled");this.enableOthers()},disableOthers:function(){n.each(this.options.disableOthers,function(t,i){var r=n(i);r.is("button, input, textarea")?r.attr("disabled","disabled"):r.addClass("disabled")})},enableOthers:function(){n.each(this.options.disableOthers,function(t,i){var r=n(i);r.is("button, input, textarea")?r.removeAttr("disabled"):r.removeClass("disabled")})}};n.fn[t]=function(i){return this.each(function(){if(i&&"hide"!==i||!n.data(this,"plugin_"+t))n.data(this,"plugin_"+t,new r(this,i));else{var u=n.data(this,"plugin_"+t);"hide"===i?u.hide():u.show()}})};u()})(jQuery,window,document);var BlueSoho=BlueSoho||{};BlueSoho.Blog||(BlueSoho.Blog={});BlueSoho.Blog.Subscribe=function(n){"use strict";function e(){c.hide();f.hide()}function l(n,t){n===undefined||n===null||n===""?t!==undefined&&t!==null&&t.resolve(!1):$.ajax({url:"https://internal.hubapi.com/emailvalidation/v1/public/validate/"+n,dataType:"jsonp",jsonp:"callback",success:function(n){t!==undefined&&t!==null&&t.resolve(n.success)}})}function a(n,t){var r=$(".hs-input",u),c=$("form",u),i=new $.Deferred;e();i.done(function(t){if(t)try{r.val(n.val());c.submit();h.show();n.val("")}catch(i){s.show()}else o.show()}).always(function(){t.isLoading("hide");f.show()});t.isLoading({tpl:"<span class='isloading-wrapper %wrapper%'><i class='fa fa-refresh fa-spin'><\/i><\/span>"});l(n.val(),i)}function v(n,t){return n.which&&n.which===13||n.keyCode&&n.keyCode===13?(t.click(),!1):!0}var t=$("#"+n.elementIds.container),o=$("."+n.classes.alertMissingDiv,t),s=$("."+n.classes.alertErrorDiv,t),h=$("."+n.classes.alertOkDiv,t),c=$("."+n.classes.alertHide,t),i=$("."+n.classes.subscribeEmailAddress,t),r=$("."+n.classes.subscribeButton,t),u=$("#"+n.elementIds.hubSpotContainer),f=$("."+n.classes.alertsContainer,t);r.on("click",function(){a(i,$(this).parent())});i.on("keypress",function(n){v(n,r)});e()}