!function(e){OUAnimatedHeadlines=function(e){this.selector=e.id,this.animationDelay=parseInt(e.animationDelay),this.barAnimationDelay=parseInt(e.barAnimationDelay),this.barWaiting=this.barAnimationDelay-3e3,this.lettersDelay=parseInt(e.lettersDelay),this.typeLettersDelay=parseInt(e.typeLettersDelay),this.selectionDuration=parseInt(e.selectionDuration),this.typeAnimationDelay=this.selectionDuration+800,this.revealDuration=parseInt(e.revealDuration),this.revealAnimationDelay=parseInt(e.revealAnimationDelay),this._initHeadlines()},OUAnimatedHeadlines.prototype={_initHeadlines:function(){this._singleLetters(e("#"+this.selector+" .cd-headline.letters").find("b")),this._animateHeadline(e("#"+this.selector+" .cd-headline"))},_singleLetters:function(t){t.each(function(){var t=e(this),s=t.text().split(""),a=t.hasClass("is-visible");for(i in s)t.parents(".rotate-2").length>0&&(s[i]="<em>"+s[i]+"</em>"),s[i]=a?'<i class="in">'+s[i]+"</i>":"<i>"+s[i]+"</i>";var n=s.join("");t.html(n).css("opacity",1)})},_animateHeadline:function(i){var t=this,s=this.animationDelay;i.each(function(){var i=e(this);if(i.hasClass("loading-bar"))s=this.barAnimationDelay,setTimeout(function(){i.find(".cd-words-wrapper").addClass("is-loading")},t.barWaiting);else if(i.hasClass("clip")){var a=i.find(".cd-words-wrapper"),n=a.width()+10;a.css("width",n)}else if(!i.hasClass("type")){var r=i.find(".cd-words-wrapper b"),d=0;r.each(function(){var i=e(this).innerWidth();i>d&&(d=i)}),i.find(".cd-words-wrapper").css("width",d)}setTimeout(function(){t._hideWord(i.find(".is-visible").eq(0))},s)})},_hideWord:function(e){var i=this,t=this._takeNext(e);if(e.parents(".cd-headline").hasClass("type")){var s=e.parent(".cd-words-wrapper");s.addClass("selected").removeClass("waiting"),setTimeout(function(){s.removeClass("selected"),e.removeClass("is-visible").addClass("is-hidden").children("i").removeClass("in").addClass("out")},i.selectionDuration),setTimeout(function(){i._showWord(t,i.typeLettersDelay)},i.typeAnimationDelay)}else if(e.parents(".cd-headline").hasClass("letters")){var a=e.children("i").length>=t.children("i").length;i._hideLetter(e.find("i").eq(0),e,a,i.lettersDelay),i._showLetter(t.find("i").eq(0),t,a,i.lettersDelay)}else e.parents(".cd-headline").hasClass("clip")?e.parents(".cd-words-wrapper").animate({width:"2px"},i.revealDuration,function(){i._switchWord(e,t),i._showWord(t)}):e.parents(".cd-headline").hasClass("loading-bar")?(e.parents(".cd-words-wrapper").removeClass("is-loading"),i._switchWord(e,t),setTimeout(function(){i._hideWord(t)},i.barAnimationDelay),setTimeout(function(){e.parents(".cd-words-wrapper").addClass("is-loading")},i.barWaiting)):(i._switchWord(e,t),setTimeout(function(){i._hideWord(t)},i.animationDelay))},_showWord:function(e,i){var t=this;e.parents(".cd-headline").hasClass("type")?(t._showLetter(e.find("i").eq(0),e,!1,i),e.addClass("is-visible").removeClass("is-hidden")):e.parents(".cd-headline").hasClass("clip")&&e.parents(".cd-words-wrapper").animate({width:e.width()+10},t.revealDuration,function(){setTimeout(function(){t._hideWord(e)},t.revealAnimationDelay)})},_hideLetter:function(i,t,s,a){var n=this;if(i.removeClass("in").addClass("out"),i.is(":last-child")?s&&setTimeout(function(){n._hideWord(n._takeNext(t))},n.animationDelay):setTimeout(function(){n._hideLetter(i.next(),t,s,a)},a),i.is(":last-child")&&e("html").hasClass("no-csstransitions")){var r=n._takeNext(t);n._switchWord(t,r)}},_showLetter:function(e,i,t,s){var a=this;e.addClass("in").removeClass("out"),e.is(":last-child")?(i.parents(".cd-headline").hasClass("type")&&setTimeout(function(){i.parents(".cd-words-wrapper").addClass("waiting")},200),t||setTimeout(function(){a._hideWord(i)},a.animationDelay)):setTimeout(function(){a._showLetter(e.next(),i,t,s)},s)},_takeNext:function(e){return e.is(":last-child")?e.parent().children().eq(0):e.next()},_takePrev:function(e){return e.is(":first-child")?e.parent().children().last():e.prev()},_switchWord:function(e,i){e.removeClass("is-visible").addClass("is-hidden"),i.removeClass("is-hidden").addClass("is-visible")}}}(jQuery);